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;
357 }
while(bAdditionalNodes);
386 bool bAdditionalNodes =
true;
388 std::stringstream buf;
389 std::string nameTransformNode;
391 buf <<
"TextNode " << i <<
" Transform";
392 nameTransformNode = buf.str();
401 bAdditionalNodes =
false;
402 }
while(bAdditionalNodes);
408 std::stringstream buf;
409 std::string nameJoint, nameTextNode, nameTransformNode, nameSubMatNode;
413 nameJoint = buf.str();
416 buf <<
"TextNode " << i;
417 nameTextNode = buf.str();
420 nameTransformNode = buf.str();
423 nameSubMatNode = buf.str();
447 nameTextNode.c_str(),
448 ACG::SceneGraph::TextNode::SCREEN_ALIGNED,
452 pTextNode->setText(
" " + nameJoint);
453 pTextNode->setSize(1);
454 pTextNode->multipassNodeSetActive(8,
true);
463 bool SkeletonObject::indicesVisible()
474 bool SkeletonObject::motionPathVisible()
516 std::stringstream buf;
517 std::string nameTransformNode;
519 buf <<
"LineNode " << i <<
" Transform";
520 nameTransformNode = buf.str();
532 bool bAdditionalNodes =
true;
534 std::stringstream buf;
535 std::string nameTransformNode;
537 buf <<
"LineNode " << i <<
" Transform";
538 nameTransformNode = buf.str();
547 bAdditionalNodes =
false;
548 }
while(bAdditionalNodes);
577 bool bAdditionalNodes =
true;
579 std::stringstream buf;
580 std::string nameTransformNode;
582 buf <<
"LineNode " << i <<
" Transform";
583 nameTransformNode = buf.str();
592 bAdditionalNodes =
false;
593 }
while(bAdditionalNodes);
601 std::stringstream buf;
602 std::string nameLineNode, nameTransformNode;
605 buf <<
"LineNode " << i;
606 nameLineNode = buf.str();
609 nameTransformNode = buf.str();
619 pTransNode->
scale(mat);
624 pLineNode =
new ACG::SceneGraph::LineNode( ACG::SceneGraph::LineNode::LineSegmentsMode, pTransNode, nameLineNode.c_str());
631 if ( joint->
size() > 0 ){
633 for (uint c=0; c < joint->
size(); c++ ){
643 if (animation->name() ==
"")
649 for(
unsigned int k = 0; k < animation->frameCount(); ++k){
665 pLineNode->
add_line( lastPos, trans );
bool invert()
matrix inversion (returns true on success)
Joint * child(size_t _index)
Returns the child joint with the given index.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
virtual QString getObjectinfo()
Get all Info for the Object as a string.
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode_
A pointer to the scenegraph node.
void translate(const Vec3d &_v)
Add a translation to the current Transformation.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
void set_round_points(bool _b)
set round points enabled
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
QString getObjectinfo()
Returns a string holding information on this object.
MaterialNode * materialNode()
get a pointer to the materialnode
void setDataType(DataType _type)
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
void deleteData()
Delete all data attached to this object ( calls delete on each object )
bool picked(uint _node_idx)
Returns true if the picked node given by _node_idx is this objects scenegraph node.
virtual void cleanup()
Reset current object, including all related nodes.
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Hide this node and its children.
A general pose, used to store the frames of the animation.
void enablePicking(bool _enable)
Enable or disable picking for this object.
bool addAdditionalNode(NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
add an additional node to the object
size_t animationCount()
Returns the number of animations stored in this skeleton.
void set_status(StatusMode _s)
Set the status of this node.
void updateMotionPath()
Updates the node that visualizes the local space of joint motions.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
QString name() const
return the name of the object. The name defaults to NONAME if unset.
bool removeAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
remove an additional node from the object
A handle used to refer to an animation or to a specific frame in an animation.
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
void show()
Show node: set status to Active.
void set_line_width(float _sz)
set line width (default: 1.0)
Pose * referencePose()
Returns a pointer to the reference pose.
Skeleton * skeleton()
Returns a pointer to the skeleton.
const Scalar * get_raw_data() const
Pose * pose(const AnimationHandle &_hAni)
Returns a pointer to the pose with the given animation handle.
Represents a single joint in the skeleton.
void setActivePose(const AnimationHandle &_hAni)
Call this to set the active pose.
SeparatorNode * baseNode()
Skeleton * skeleton_
A pointer to the skeleton data.
void showIndices(bool _bVisible=true)
Shows or hides the indices.
virtual void init()
Initialize current object, including all related nodes.
void clear()
clear points/lines and colors
void set_point_size(float _sz)
set point size (default: 1.0)
bool pickingEnabled()
Check if picking is enabled for this object.
StatusMode status() const
Get node's status.
const Matrix & unifiedMatrix(size_t _joint)
Returns the unified matrix.
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
size_t jointCount()
Returns the number of joints.
void scale(double _s)
Add scaling to the current Transformation.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
virtual BaseObject * copy()
Returns a full copy of the object.
void setFrame(size_t _iFrame)
Sets the current animation frame (not failsafe)
void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Joint * joint(const size_t &_index)
Returns the joint with the given index.
BaseObject * child(int row)
return a child
virtual ~SkeletonObject()
Destructor.
size_t size() const
Returns the number of children.
void setName(QString _name)
Set the name of the Object.
DrawMode POINTS
draw unlighted points using the default base color
DataType dataType() const
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)
size_t id() const
returns the joint id
SkeletonObject()
Constructor.
void updateIndices()
Updates the joint index text node positions.