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