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