50#define SKELETONOBJECT_C
56#include <ACG/Scenegraph/TextNode.hh>
57#include <ACG/Scenegraph/LineNode.hh>
61#include <ACG/Scenegraph/MaterialNode.hh>
62#include <ACG/Scenegraph/SeparatorNode.hh>
114 std::cerr <<
"Destructor error : Skeleton already deleted" << std::endl;
132 std::cerr <<
"Cleanup error : Skeleton already deleted" << std::endl;
154 std::cerr <<
"Error when creating Skeleton Object! materialNode is NULL!" << std::endl;
174 std::cerr <<
"Error when creating Skeleton Object! materialNode is NULL!" << std::endl;
196 std::string nodename = std::string(
"SkeletonNode for Skeleton " + _name.toUtf8() );
231 output +=
"========================================================================\n";
235 output +=
"Object Contains a Skeleton : ";
237 output += QString::number(
skeleton()->jointCount()) +
" joints.\n";
239 output +=
"========================================================================\n";
324 std::stringstream buf;
325 std::string nameTransformNode;
327 buf <<
"TextNode " << i <<
" Transform";
328 nameTransformNode = buf.str();
341 bool bAdditionalNodes =
true;
343 std::stringstream buf;
344 std::string nameTransformNode;
346 buf <<
"TextNode " << i <<
" Transform";
347 nameTransformNode = buf.str();
356 bAdditionalNodes =
false;
358 }
while(bAdditionalNodes);
387 bool bAdditionalNodes =
true;
389 std::stringstream buf;
390 std::string nameTransformNode;
392 buf <<
"TextNode " << jointCount <<
" Transform";
393 nameTransformNode = buf.str();
402 bAdditionalNodes =
false;
404 }
while(bAdditionalNodes);
410 std::stringstream buf;
411 std::string nameJoint, nameTextNode, nameTransformNode, nameSubMatNode;
415 nameJoint = buf.str();
418 buf <<
"TextNode " << i;
419 nameTextNode = buf.str();
422 nameTransformNode = buf.str();
425 nameSubMatNode = buf.str();
449 nameTextNode.c_str(),
450 ACG::SceneGraph::TextNode::SCREEN_ALIGNED,
454 pTextNode->
setText(
" " + nameJoint);
518 std::stringstream buf;
519 std::string nameTransformNode;
521 buf <<
"LineNode " << i <<
" Transform";
522 nameTransformNode = buf.str();
534 bool bAdditionalNodes =
true;
536 std::stringstream buf;
537 std::string nameTransformNode;
539 buf <<
"LineNode " << i <<
" Transform";
540 nameTransformNode = buf.str();
549 bAdditionalNodes =
false;
551 }
while(bAdditionalNodes);
580 bool bAdditionalNodes =
true;
582 std::stringstream buf;
583 std::string nameTransformNode;
585 buf <<
"LineNode " << jointCount <<
" Transform";
586 nameTransformNode = buf.str();
595 bAdditionalNodes =
false;
597 }
while(bAdditionalNodes);
605 std::stringstream buf;
606 std::string nameLineNode, nameTransformNode;
609 buf <<
"LineNode " << i;
610 nameLineNode = buf.str();
613 nameTransformNode = buf.str();
623 pTransNode->
scale(mat);
628 pLineNode =
new ACG::SceneGraph::LineNode( ACG::SceneGraph::LineNode::LineSegmentsMode, pTransNode, nameLineNode.c_str());
635 if ( joint->
size() > 0 ){
637 for (uint c=0; c < joint->
size(); c++ ){
647 if (animation->name() ==
"")
653 for(
unsigned int k = 0; k < animation->frameCount(); ++k){
669 pLineNode->
add_line( lastPos, trans );
SkeletonT< ACG::Vec3d > Skeleton
Simple Name for the Skeleton, based on double vectors.
const Scalar * get_raw_data() const
bool invert()
matrix inversion (returns true on success)
@ HideSubtree
Hide this node and its children.
@ Active
Draw node & children.
void multipassNodeSetActive(const unsigned int _i, bool _active)
Set Node status to traverse in a specific pass.
StatusMode status() const
Get node's status.
void set_status(StatusMode _s)
Set the status of this node.
void show()
Show node: set status to Active.
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)
void clear()
clear points/lines and colors
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
void set_round_points(bool _b)
set round points enabled
void set_line_width(float _sz)
set line width (default: 1.0)
void set_point_size(float _sz)
set point size (default: 1.0)
void setSize(const double _size)
sets the size by which the quads displaying the text will be scaled
void setText(std::string _text)
sets the string that will be rendered
A handle used to refer to an animation or to a specific frame in an animation.
void setFrame(size_t _iFrame)
Sets the current animation frame (not failsafe)
Stores a single animation.
bool removeAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
remove an additional node from the object
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
SeparatorNode * baseNode()
virtual void setName(QString _name) override
path to the file from which the object is loaded ( defaults to "." )
MaterialNode * materialNode()
get a pointer to the materialnode
virtual void cleanup() override
bool addAdditionalNode(NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
add an additional node to the object
virtual QString getObjectinfo()
Get all Info for the Object as a string.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
void setDataType(DataType _type)
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
void deleteData()
Delete all data attached to this object ( calls delete on each object )
DataType dataType() const
BaseObject * child(int row)
return a child
Represents a single joint in the skeleton.
size_t size() const
Returns the number of children.
size_t id() const
returns the joint id
Joint * child(size_t _index)
Returns the child joint with the given index.
A general pose, used to store the frames of the animation.
const Matrix & unifiedMatrix(size_t _joint)
Returns the unified matrix.
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
bool indicesVisible()
Returns true if the picked node given by _node_idx is this objects scenegraph node.
virtual ~SkeletonObject()
Destructor.
AnimationHandle activePose()
Returns true if the picked node given by _node_idx is this objects scenegraph node.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
bool pickingEnabled()
Check if picking is enabled for this object.
bool picked(uint _node_idx)
Returns true if the picked node given by _node_idx is this objects scenegraph node.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode_
A pointer to the scenegraph node.
void setActivePose(const AnimationHandle &_hAni)
Call this to set the active pose.
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
void updateIndices()
Updates the joint index text node positions.
void setName(QString _name)
Set the name of the Object.
void updateMotionPath()
Updates the node that visualizes the local space of joint motions.
SkeletonObject()
Constructor.
Skeleton * skeleton()
Returns a pointer to the skeleton.
void enablePicking(bool _enable)
Enable or disable picking for this object.
virtual void init()
Initialize current object, including all related nodes.
Skeleton * skeleton_
A pointer to the skeleton data.
virtual void cleanup()
Reset current object, including all related nodes.
void showIndices(bool _bVisible=true)
Shows or hides the indices.
void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
virtual BaseObject * copy()
Returns a full copy of the object.
QString getObjectinfo()
Returns a string holding information on this object.
bool motionPathVisible()
Returns true if the picked node given by _node_idx is this objects scenegraph node.
Pose * referencePose()
Returns a pointer to the reference pose.
size_t jointCount()
Returns the number of joints.
size_t animationCount()
Returns the number of animations stored in this skeleton.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
Pose * pose(const AnimationHandle &_hAni)
Returns a pointer to the pose with the given animation handle.
Joint * joint(const size_t &_index)
Returns the joint with the given index.
DrawMode POINTS
draw unlighted points using the default base color
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)