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 );
Represents a single joint in the skeleton.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
void deleteData()
Delete all data attached to this object ( calls delete on each object )
void translate(const Vec3d &_v)
Add a translation to the current Transformation.
A handle used to refer to an animation or to a specific frame in an animation.
void set_point_size(float _sz)
set point size (default: 1.0)
void setActivePose(const AnimationHandle &_hAni)
Call this to set the active pose.
bool invert()
matrix inversion (returns true on success)
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode_
A pointer to the scenegraph node.
Skeleton * skeleton_
A pointer to the skeleton data.
bool removeAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
remove an additional node from the object
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
void scale(double _s)
Add scaling to the current Transformation.
void setSize(const double _size)
sets the size by which the quads displaying the text will be scaled
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
void setText(std::string _text)
sets the string that will be rendered
virtual QString getObjectinfo()
Get all Info for the Object as a string.
void set_round_points(bool _b)
set round points enabled
void multipassNodeSetActive(const unsigned int _i, bool _active)
Set Node status to traverse in a specific pass.
bool picked(uint _node_idx)
Returns true if the picked node given by _node_idx is this objects scenegraph node.
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
size_t id() const
returns the joint id
Hide this node and its children.
void updateIndices()
Updates the joint index text node positions.
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
Joint * child(size_t _index)
Returns the child joint with the given index.
DrawMode POINTS
draw unlighted points using the default base color
void showIndices(bool _bVisible=true)
Shows or hides the indices.
void clear()
clear points/lines and colors
bool addAdditionalNode(NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
add an additional node to the object
virtual void cleanup()
Reset current object, including all related nodes.
void updateMotionPath()
Updates the node that visualizes the local space of joint motions.
const Matrix & unifiedMatrix(size_t _joint)
Returns the unified matrix.
virtual void init()
Initialize current object, including all related nodes.
size_t size() const
Returns the number of children.
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
StatusMode status() const
Get node's status.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
MaterialNode * materialNode()
get a pointer to the materialnode
BaseObject * child(int row)
return a child
DataType dataType() const
const Scalar * get_raw_data() const
void setName(QString _name)
Set the name of the Object.
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
void enablePicking(bool _enable)
Enable or disable picking for this object.
void set_line_width(float _sz)
set line width (default: 1.0)
A general pose, used to store the frames of the animation.
void show()
Show node: set status to Active.
Skeleton * skeleton()
Returns a pointer to the skeleton.
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)
void setDataType(DataType _type)
SkeletonObject()
Constructor.
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
virtual ~SkeletonObject()
Destructor.
void set_status(StatusMode _s)
Set the status of this node.
QString getObjectinfo()
Returns a string holding information on this object.
SkeletonT< ACG::Vec3d > Skeleton
Simple Name for the Skeleton, based on double vectors.
void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
void setFrame(size_t _iFrame)
Sets the current animation frame (not failsafe)
virtual BaseObject * copy()
Returns a full copy of the object.
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
SeparatorNode * baseNode()
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
bool pickingEnabled()
Check if picking is enabled for this object.