Developer Documentation

SkeletonObject.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42
43
44 //=============================================================================
45 //
46 // MyTypes
47 //
48 //=============================================================================
49
50 #define SKELETONOBJECT_C
51
52 //== INCLUDES =================================================================
53
54 #include <string>
55 #include <sstream>
56 #include <ACG/Scenegraph/TextNode.hh>
57 #include <ACG/Scenegraph/LineNode.hh>
58 #include <OpenFlipper/common/Types.hh>
59 #include "Skeleton.hh"
60
61 #include <ACG/Scenegraph/MaterialNode.hh>
62 #include <ACG/Scenegraph/SeparatorNode.hh>
63
64 //== DEFINES ==================================================================
65
66 //== TYPEDEFS =================================================================
67
68 //== CLASS DEFINITION =========================================================
69
76 SkeletonObject::SkeletonObject( ) :
77 BaseObjectData( ),
78 skeleton_(NULL),
79 skeletonNode_(NULL)
80 {
81 setDataType(DATA_SKELETON);
82 init();
83 }
84
85 //-----------------------------------------------------------------------------
86
87 SkeletonObject::SkeletonObject( const SkeletonObject &_other ) :
88 BaseObjectData(_other)
89 {
90 init(_other.skeleton_);
91
92 setName(name());
93 }
94
95 //-----------------------------------------------------------------------------
96
100 SkeletonObject::~SkeletonObject()
101 {
102 // Delete the data attached to this object ( this will remove all perObject data)
103 // Not the best way to do it but it will work.
104 // This is only necessary if people use references to the skeleton below and
105 // they do something with the skeleton in the destructor of their
106 // perObjectData.
107 deleteData();
108
109 // Delete the Skeleton only, if this object contains a mesh
110 if ( skeleton_ != NULL) {
111 delete skeleton_;
112 skeleton_ = NULL;
113 } else {
114 std::cerr << "Destructor error : Skeleton already deleted" << std::endl;
115 }
116
117 // No need to delete the scenegraph Nodes as this will be managed by baseplugin
118 skeletonNode_ = NULL;
119 }
120
121 //-----------------------------------------------------------------------------
122
126 void SkeletonObject::cleanup() {
127 // Delete the Skeleton only, if this object contains a line
128 if ( skeleton_ != NULL) {
129 delete skeleton_;
130 skeleton_ = NULL;
131 } else {
132 std::cerr << "Cleanup error : Skeleton already deleted" << std::endl;
133 }
134
135 BaseObjectData::cleanup();
136
137 skeletonNode_ = NULL;
138
139 setDataType(DATA_SKELETON);
140
141 init();
142
143 }
144
145 //-----------------------------------------------------------------------------
146
150 void SkeletonObject::init() {
151 skeleton_ = new Skeleton();
152
153 if ( materialNode() == NULL)
154 std::cerr << "Error when creating Skeleton Object! materialNode is NULL!" << std::endl;
155
156 skeletonNode_ = new ACG::SceneGraph::SkeletonNodeT< Skeleton >(*skeleton_, materialNode() , "NEW SkeletonNode");
157 skeletonNode_->drawMode( ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED | ACG::SceneGraph::DrawModes::POINTS );
158
159 //set defaults for the material
160 materialNode()->set_color(ACG::Vec4f(0.654f, 0.8f, 1.0f, 1.0f));
161 materialNode()->set_point_size(8.0);
162 materialNode()->set_line_width(3.0);
163 materialNode()->set_round_points(true);
164
165 }
166
167 //-----------------------------------------------------------------------------
168
169 void SkeletonObject::init(Skeleton *_pSkeleton)
170 {
171 skeleton_ = new Skeleton(*_pSkeleton);
172
173 if(materialNode() == NULL)
174 std::cerr << "Error when creating Skeleton Object! materialNode is NULL!" << std::endl;
175
176 skeletonNode_ = new ACG::SceneGraph::SkeletonNodeT<Skeleton>(*skeleton_, materialNode(), "NEW SkeletonNode");
177 skeletonNode_->drawMode( ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED | ACG::SceneGraph::DrawModes::POINTS );
178
179 //set defaults for the material
180 materialNode()->set_color(ACG::Vec4f(0.654f, 0.8f, 1.0f, 1.0f));
181 materialNode()->set_point_size(8.0);
182 materialNode()->set_line_width(3.0);
183 materialNode()->set_round_points(true);
184 }
185
186 // ===============================================================================
187 // Name/Path Handling
188 // ===============================================================================
189
193 void SkeletonObject::setName( QString _name ) {
194 BaseObjectData::setName(_name);
195
196 std::string nodename = std::string("SkeletonNode for Skeleton " + _name.toUtf8() );
197 skeletonNode_->name( nodename );
198 }
199
200 // ===============================================================================
201 // Content
202 // ===============================================================================
203
207 Skeleton* SkeletonObject::skeleton() {
208 return skeleton_;
209 }
210
211 // ===============================================================================
212 // Visualization
213 // ===============================================================================
214
215 ACG::SceneGraph::SkeletonNodeT< Skeleton >* SkeletonObject::skeletonNode() {
216 return skeletonNode_;
217 }
218
219 // ===============================================================================
220 // Object information
221 // ===============================================================================
222
228 QString SkeletonObject::getObjectinfo() {
229 QString output;
230
231 output += "========================================================================\n";
232 output += BaseObjectData::getObjectinfo();
233
234 if ( dataType( DATA_SKELETON ) )
235 output += "Object Contains a Skeleton : ";
236
237 output += QString::number( skeleton()->jointCount()) + " joints.\n";
238
239 output += "========================================================================\n";
240 return output;
241 }
242
243 // ===============================================================================
244 // Picking
245 // ===============================================================================
246
253 bool SkeletonObject::picked( uint _node_idx ) {
254 return ( _node_idx == skeletonNode_->id() );
255 }
256
257 //-----------------------------------------------------------------------------
258
259 void SkeletonObject::enablePicking( bool _enable ) {
260 skeletonNode_->enablePicking( _enable );
261 }
262
263 //-----------------------------------------------------------------------------
264
265 bool SkeletonObject::pickingEnabled() {
266 return skeletonNode_->pickingEnabled();
267 }
268
269 //-----------------------------------------------------------------------------
270
271 AnimationHandle SkeletonObject::activePose() {
272 return skeletonNode()->activePose();
273 }
274
275 //-----------------------------------------------------------------------------
276
285 void SkeletonObject::setActivePose(const AnimationHandle &_hAni)
286 {
287 skeletonNode()->setActivePose(_hAni);
288
289 updateIndices(_hAni);
290 updateMotionPath(_hAni);
291 }
292
293 //-----------------------------------------------------------------------------
294
300 void SkeletonObject::updateIndices()
301 {
302 updateIndices(skeletonNode()->activePose());
303 }
304
305 //-----------------------------------------------------------------------------
306
314 void SkeletonObject::updateIndices(const AnimationHandle &_hAni)
315 {
316 ACG::SceneGraph::MaterialNode *pMatNode;
317 if(!getAdditionalNode(pMatNode, "SkeletonPlugin", "Text material node"))
318 return;
319
320 // update the position of existing nodes
321 PoseT<OpenMesh::Vec3d> *pose = skeleton_->pose(_hAni);
322 for(unsigned int i = 0; i < skeleton_->jointCount(); ++i)
323 {
324 std::stringstream buf;
325 std::string nameTransformNode;
326
327 buf << "TextNode " << i << " Transform";
328 nameTransformNode = buf.str();
329
330 ACG::SceneGraph::TransformNode *pTransNode;
331 if(!getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
332 continue;
333
334 pTransNode->loadIdentity();
335 pTransNode->translate(pose->globalTranslation(i));
336 pTransNode->scale(skeletonNode_->frameSize()*0.5);
337 }
338
339 // find and prune redundant nodes
340 unsigned int i = skeleton_->jointCount();
341 bool bAdditionalNodes = true;
342 do{
343 std::stringstream buf;
344 std::string nameTransformNode;
345
346 buf << "TextNode " << i << " Transform";
347 nameTransformNode = buf.str();
348
349 ACG::SceneGraph::TransformNode *pTransNode;
350 if(getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
351 {
352 removeAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str());
353 ++i;
354 continue;
355 }
356 bAdditionalNodes = false;
357 }while(bAdditionalNodes);
358 }
359
360 //-----------------------------------------------------------------------------
361
369 void SkeletonObject::showIndices(bool _bVisible)
370 {
371 ACG::SceneGraph::MaterialNode *pMatNode;
372 if(!getAdditionalNode(pMatNode, "SkeletonPlugin", "Text material node"))
373 {
374 pMatNode = new ACG::SceneGraph::MaterialNode(baseNode(), "Text material node");
375 addAdditionalNode(pMatNode, "SkeletonPlugin", "Text material node");
376 }
377
378 pMatNode->set_color(ACG::Vec4f(0, 0, 0, 1.0));
379 if(_bVisible)
380 pMatNode->show();
381 else
382 pMatNode->set_status(ACG::SceneGraph::BaseNode::HideSubtree);
383
384 // find and prune redundant nodes
385 unsigned int i = skeleton_->jointCount();
386 bool bAdditionalNodes = true;
387 do{
388 std::stringstream buf;
389 std::string nameTransformNode;
390
391 buf << "TextNode " << i << " Transform";
392 nameTransformNode = buf.str();
393
394 ACG::SceneGraph::TransformNode *pTransNode;
395 if(getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
396 {
397 removeAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str());
398 ++i;
399 continue;
400 }
401 bAdditionalNodes = false;
402 }while(bAdditionalNodes);
403
404 // add or update nodes
405 PoseT<OpenMesh::Vec3d>* ref = skeleton_->referencePose();
406 for(unsigned int i = 0; i < skeleton_->jointCount(); ++i)
407 {
408 std::stringstream buf;
409 std::string nameJoint, nameTextNode, nameTransformNode, nameSubMatNode;
410
411 buf.str("");
412 buf << i;
413 nameJoint = buf.str();
414
415 buf.str("");
416 buf << "TextNode " << i;
417 nameTextNode = buf.str();
418
419 buf << " Transform";
420 nameTransformNode = buf.str();
421
422 buf << " Material";
423 nameSubMatNode = buf.str();
424
425 ACG::SceneGraph::TransformNode *pTransNode;
426 if(!getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
427 {
428 pTransNode = new ACG::SceneGraph::TransformNode(pMatNode, nameTransformNode.c_str());
429 addAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str());
430 }
431 pTransNode->loadIdentity();
432 pTransNode->translate(ref->globalTranslation(i));
433 pTransNode->scale(skeletonNode_->frameSize()*0.5);
434
435 ACG::SceneGraph::MaterialNode *pSubMatNode;
436 if(!getAdditionalNode(pSubMatNode, "SkeletonPlugin", nameSubMatNode.c_str()))
437 {
438 pSubMatNode = new ACG::SceneGraph::MaterialNode(pTransNode, nameSubMatNode.c_str());
439 addAdditionalNode(pSubMatNode, "SkeletonPlugin", nameSubMatNode.c_str());
440 }
441 // pSubMatNode->set_color(skeleton_->joint(i)->color());
442
443 ACG::SceneGraph::TextNode *pTextNode = NULL;
444 if(!getAdditionalNode(pTextNode, "SkeletonPlugin", nameTextNode.c_str()))
445 {
446 pTextNode = new ACG::SceneGraph::TextNode(pSubMatNode,
447 nameTextNode.c_str(),
448 ACG::SceneGraph::TextNode::SCREEN_ALIGNED,
449 true);
450 addAdditionalNode(pTextNode, "SkeletonPlugin", nameTextNode.c_str());
451 }
452 pTextNode->setText(" " + nameJoint);
453 pTextNode->setSize(1);
454 pTextNode->multipassNodeSetActive(8, true);
455 }
456
457 //update the indices with the current animationhandle
458 updateIndices( skeletonNode()->activePose() );
459 }
460
461 //-----------------------------------------------------------------------------
462
463 bool SkeletonObject::indicesVisible()
464 {
465 ACG::SceneGraph::MaterialNode *pMatNode;
466 if(!getAdditionalNode(pMatNode, "SkeletonPlugin", "Text material node"))
467 return false;
468
469 return ( pMatNode->status() == ACG::SceneGraph::BaseNode::Active );
470 }
471
472 //-----------------------------------------------------------------------------
473
474 bool SkeletonObject::motionPathVisible()
475 {
476 ACG::SceneGraph::MaterialNode *pMatNode;
477 if(!getAdditionalNode(pMatNode, "SkeletonPlugin", "Motion material node"))
478 return false;
479
480 return ( pMatNode->status() == ACG::SceneGraph::BaseNode::Active );
481 }
482
483 //-----------------------------------------------------------------------------
484
488 void SkeletonObject::updateMotionPath()
489 {
490 updateMotionPath(skeletonNode()->activePose());
491 }
492
493 //-----------------------------------------------------------------------------
494
503 void SkeletonObject::updateMotionPath(const AnimationHandle &_hAni)
504 {
505
506 ACG::SceneGraph::MaterialNode *pMatNode;
507 if(!getAdditionalNode(pMatNode, "SkeletonPlugin", "Motion material node"))
508 return;
509
510 // update the position of existing nodes
511 PoseT<OpenMesh::Vec3d>* pose = skeleton_->pose(_hAni);
512
513 for(unsigned int i = 0; i < skeleton_->jointCount(); ++i)
514 {
515
516 std::stringstream buf;
517 std::string nameTransformNode;
518
519 buf << "LineNode " << i << " Transform";
520 nameTransformNode = buf.str();
521
522 ACG::SceneGraph::TransformNode *pTransNode;
523 if(!getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
524 continue;
525
526 pTransNode->loadIdentity();
527 pTransNode->translate( pose->globalTranslation(i) );
528 }
529
530 // find and prune redundant nodes
531 unsigned int i = skeleton_->jointCount();
532 bool bAdditionalNodes = true;
533 do{
534 std::stringstream buf;
535 std::string nameTransformNode;
536
537 buf << "LineNode " << i << " Transform";
538 nameTransformNode = buf.str();
539
540 ACG::SceneGraph::TransformNode *pTransNode;
541 if(getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
542 {
543 removeAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str());
544 ++i;
545 continue;
546 }
547 bAdditionalNodes = false;
548 }while(bAdditionalNodes);
549 }
550
551 //-----------------------------------------------------------------------------
552
560 void SkeletonObject::showMotionPath(bool _visible)
561 {
562 ACG::SceneGraph::MaterialNode *pMatNode;
563 if(!getAdditionalNode(pMatNode, "SkeletonPlugin", "Motion material node"))
564 {
565 pMatNode = new ACG::SceneGraph::MaterialNode(baseNode(), "Motion material node");
566 addAdditionalNode(pMatNode, "SkeletonPlugin", "Motion material node");
567 }
568 pMatNode->set_color(ACG::Vec4f(0, 0, 0, 1.0));
569
570 if(_visible)
571 pMatNode->show();
572 else
573 pMatNode->set_status(ACG::SceneGraph::BaseNode::HideSubtree);
574
575 // find and prune redundant nodes
576 unsigned int i = skeleton_->jointCount();
577 bool bAdditionalNodes = true;
578 do{
579 std::stringstream buf;
580 std::string nameTransformNode;
581
582 buf << "LineNode " << i << " Transform";
583 nameTransformNode = buf.str();
584
585 ACG::SceneGraph::TransformNode *pTransNode;
586 if(getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
587 {
588 removeAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str());
589 ++i;
590 continue;
591 }
592 bAdditionalNodes = false;
593 }while(bAdditionalNodes);
594
595
596 // add or update nodes
597 PoseT<OpenMesh::Vec3d>* ref = skeleton_->referencePose();
598
599 for(unsigned int i = 0; i < skeleton_->jointCount(); ++i)
600 {
601 std::stringstream buf;
602 std::string nameLineNode, nameTransformNode;
603
604 buf.str("");
605 buf << "LineNode " << i;
606 nameLineNode = buf.str();
607
608 buf << " Transform";
609 nameTransformNode = buf.str();
610
611 ACG::SceneGraph::TransformNode *pTransNode;
612 if(!getAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str()))
613 {
614 pTransNode = new ACG::SceneGraph::TransformNode(pMatNode, nameTransformNode.c_str());
615 addAdditionalNode(pTransNode, "SkeletonPlugin", nameTransformNode.c_str());
616 }
617 pTransNode->loadIdentity();
618 ACG::GLMatrixd mat( ref->globalMatrix(i).get_raw_data() );
619 pTransNode->scale(mat); //this is just a hack to set the global matrix
620
621 ACG::SceneGraph::LineNode *pLineNode = NULL;
622 if(!getAdditionalNode(pLineNode, "SkeletonPlugin", nameLineNode.c_str()))
623 {
624 pLineNode = new ACG::SceneGraph::LineNode( ACG::SceneGraph::LineNode::LineSegmentsMode, pTransNode, nameLineNode.c_str());
625 addAdditionalNode(pLineNode, "SkeletonPlugin", nameLineNode.c_str());
626 }
627 pLineNode->clear();
628
629 Skeleton::Joint* joint = skeleton_->joint(i);
630
631 if ( joint->size() > 0 ){
632
633 for (uint c=0; c < joint->size(); c++ ){
634 Skeleton::Joint* child = joint->child(c);
635
636 for (unsigned int a = 0; a < skeleton_->animationCount(); a++){
637
638 AnimationHandle animHandle = AnimationHandle(a, 0 );
639
640 //get animation
641 AnimationT<ACG::Vec3d>* animation = skeleton_->animation( animHandle );
642
643 if (animation->name() == "")
644 continue;
645
646 ACG::Vec3d lastPos(0.0, 0.0, 0.0);
647
648 // every frame of that animation
649 for(unsigned int k = 0; k < animation->frameCount(); ++k){
650 animHandle.setFrame(k);
651 Skeleton::Pose* pose = skeleton_->pose( animHandle );
652
653 ACG::Matrix4x4d globalInv = pose->globalMatrix( joint->id() );
654 globalInv.invert();
655
656 ACG::Matrix4x4d local = pose->globalMatrix(child->id());
657 ACG::Matrix4x4d unified = pose->unifiedMatrix( joint->id() );
658
659 ACG::Vec3d trans = pose->globalTranslation(child->id()) - pose->globalTranslation(joint->id());
660 trans *= 0.5;
661
662 pLineNode->add_line( ACG::Vec3d(0.0, 0.0, 0.0), trans );
663 pLineNode->add_color( ACG::Vec3uc(180,255,180));
664
665 pLineNode->add_line( lastPos, trans );
666 pLineNode->add_color( ACG::Vec3uc(110,160,110));
667
668 lastPos = trans;
669 }
670 }
671
672 ACG::Vec3d trans = ref->globalTranslation(child->id())-ref->globalTranslation(joint->id());
673 trans *= 0.6;
674
675 pLineNode->add_line( ACG::Vec3d(0.0, 0.0, 0.0), trans);
676 pLineNode->add_color( ACG::Vec3uc(255,0,0));
677 }
678 }
679 }
680
681 //update the indices with the current animationhandle
682 updateMotionPath( skeletonNode_->activePose() );
683 }
684
685 //-----------------------------------------------------------------------------
686
687 BaseObject* SkeletonObject::copy()
688 {
689 SkeletonObject *pObject = new SkeletonObject(*this);
690 return dynamic_cast<BaseObject*>(pObject);
691 }
692
693 // ===============================================================================
694 // Update
695 // ===============================================================================
696
697
698 void SkeletonObject::update(UpdateType _type) {
699 BaseObject::update(_type);
700 }
701
702 //=============================================================================
703
ACG::Matrix4x4T::invert
bool invert()
matrix inversion (returns true on success)
Definition: Matrix4x4T_impl.hh:291
JointT::child
Joint * child(size_t _index)
Returns the child joint with the given index.
Definition: JointT_impl.hh:211
SkeletonObject::skeletonNode
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
Definition: SkeletonObject.cc:215
UpdateType
Update type class.
Definition: UpdateType.hh:60
BaseObject::getObjectinfo
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Definition: BaseObject.cc:244
MaterialNode
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
Definition: BaseObjectData.hh:85
SkeletonObject::skeletonNode_
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode_
A pointer to the scenegraph node.
Definition: SkeletonObject.hh:125
ACG::SceneGraph::TransformNode::translate
void translate(const Vec3d &_v)
Add a translation to the current Transformation.
Definition: TransformNode.cc:125
DATA_SKELETON
#define DATA_SKELETON
Definition: Skeleton.hh:64
PoseT::globalTranslation
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
Definition: PoseT_impl.hh:227
Skeleton.hh
PoseT::globalMatrix
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
Definition: PoseT_impl.hh:193
ACG::SceneGraph::MaterialNode::set_round_points
void set_round_points(bool _b)
set round points enabled
Definition: MaterialNode.hh:496
Skeleton
SkeletonT< ACG::Vec3d > Skeleton
Simple Name for the Skeleton, based on double vectors.
Definition: SkeletonTypes.hh:66
ACG::SceneGraph::MaterialNode::set_color
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
Definition: MaterialNode.hh:411
SkeletonObject::getObjectinfo
QString getObjectinfo()
Returns a string holding information on this object.
Definition: SkeletonObject.cc:228
BaseObjectData::materialNode
MaterialNode * materialNode()
get a pointer to the materialnode
Definition: BaseObjectData.cc:263
BaseObject::setDataType
void setDataType(DataType _type)
Definition: BaseObject.cc:233
SkeletonT
Definition: JointT.hh:50
BaseObjectData::getAdditionalNode
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
Definition: BaseObjectDataT_impl.hh:84
BaseObject::deleteData
void deleteData()
Delete all data attached to this object ( calls delete on each object )
Definition: BaseObject.cc:812
SkeletonObject::picked
bool picked(uint _node_idx)
Returns true if the picked node given by _node_idx is this objects scenegraph node.
Definition: SkeletonObject.cc:253
SkeletonObject::cleanup
virtual void cleanup()
Reset current object, including all related nodes.
Definition: SkeletonObject.cc:126
BaseObject::update
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Definition: BaseObject.cc:745
BaseObjectData::cleanup
virtual void cleanup()
Definition: BaseObjectData.cc:102
ACG::SceneGraph::BaseNode::HideSubtree
Hide this node and its children.
Definition: BaseNode.hh:398
PoseT
A general pose, used to store the frames of the animation.
Definition: PoseT.hh:58
SkeletonObject::enablePicking
void enablePicking(bool _enable)
Enable or disable picking for this object.
Definition: SkeletonObject.cc:259
ACG::SceneGraph::MaterialNode
Definition: MaterialNode.hh:338
ACG::SceneGraph::LineNode
Definition: LineNode.hh:84
BaseObjectData::addAdditionalNode
bool addAdditionalNode(NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
add an additional node to the object
Definition: BaseObjectDataT_impl.hh:67
SkeletonT::animationCount
size_t animationCount()
Returns the number of animations stored in this skeleton.
Definition: SkeletonT_impl.hh:965
ACG::SceneGraph::SkeletonNodeT
Definition: SkeletonNodeT.hh:77
ACG::SceneGraph::ACG::SceneGraph::BaseNode::set_status
void set_status(StatusMode _s)
Set the status of this node.
Definition: MeshNode2T_impl.hh:403
SkeletonObject::updateMotionPath
void updateMotionPath()
Updates the node that visualizes the local space of joint motions.
Definition: SkeletonObject.cc:488
BaseObjectData::setName
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
Definition: BaseObjectData.cc:355
BaseObject::name
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Definition: BaseObject.cc:730
BaseObjectData::removeAdditionalNode
bool removeAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
remove an additional node from the object
Definition: BaseObjectDataT_impl.hh:99
AnimationHandle
A handle used to refer to an animation or to a specific frame in an animation.
Definition: AnimationHandle.hh:47
ACG::SceneGraph::LineNode::add_line
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
Definition: LineNode.cc:151
ACG::SceneGraph::ACG::SceneGraph::BaseNode::show
void show()
Show node: set status to Active.
Definition: MeshNode2T_impl.hh:407
ACG::SceneGraph::MaterialNode::set_line_width
void set_line_width(float _sz)
set line width (default: 1.0)
Definition: MaterialNode.hh:491
SkeletonT::referencePose
Pose * referencePose()
Returns a pointer to the reference pose.
Definition: SkeletonT_impl.hh:755
ACG::GLMatrixT< double >
SkeletonObject::skeleton
Skeleton * skeleton()
Returns a pointer to the skeleton.
Definition: SkeletonObject.cc:207
ACG::Matrix4x4T::get_raw_data
const Scalar * get_raw_data() const
Definition: Matrix4x4T.hh:256
SkeletonT::pose
Pose * pose(const AnimationHandle &_hAni)
Returns a pointer to the pose with the given animation handle.
Definition: SkeletonT_impl.hh:735
JointT
Represents a single joint in the skeleton.
Definition: JointT.hh:60
SkeletonObject::setActivePose
void setActivePose(const AnimationHandle &_hAni)
Call this to set the active pose.
Definition: SkeletonObject.cc:285
BaseObjectData::baseNode
SeparatorNode * baseNode()
Definition: BaseObjectData.cc:225
SkeletonObject::skeleton_
Skeleton * skeleton_
A pointer to the skeleton data.
Definition: SkeletonObject.hh:112
ACG::Matrix4x4T< double >
SkeletonObject::showIndices
void showIndices(bool _bVisible=true)
Shows or hides the indices.
Definition: SkeletonObject.cc:369
ACG::SceneGraph::TransformNode::loadIdentity
void loadIdentity()
Definition: TransformNode.cc:91
SkeletonObject::init
virtual void init()
Initialize current object, including all related nodes.
Definition: SkeletonObject.cc:150
ACG::SceneGraph::LineNode::clear
void clear()
clear points/lines and colors
Definition: LineNode.cc:101
ACG::SceneGraph::MaterialNode::set_point_size
void set_point_size(float _sz)
set point size (default: 1.0)
Definition: MaterialNode.hh:486
Types.hh
SkeletonObject::pickingEnabled
bool pickingEnabled()
Check if picking is enabled for this object.
Definition: SkeletonObject.cc:265
ACG::SceneGraph::ACG::SceneGraph::BaseNode::status
StatusMode status() const
Get node&#39;s status.
Definition: MeshNode2T_impl.hh:401
PoseT::unifiedMatrix
const Matrix & unifiedMatrix(size_t _joint)
Returns the unified matrix.
Definition: PoseT_impl.hh:397
BaseObject
Definition: BaseObject.hh:82
OpenMesh::VectorT
Definition: Vector11T.hh:83
ACG::SceneGraph::DrawModes::SOLID_FLAT_SHADED
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
Definition: DrawModes.cc:81
SkeletonObject::showMotionPath
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
Definition: SkeletonObject.cc:560
SkeletonT::jointCount
size_t jointCount()
Returns the number of joints.
Definition: SkeletonT_impl.hh:695
AnimationT< ACG::Vec3d >
ACG::SceneGraph::TransformNode::scale
void scale(double _s)
Add scaling to the current Transformation.
Definition: TransformNode.hh:145
SkeletonT::animation
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
Definition: SkeletonT_impl.hh:852
SkeletonObject::copy
virtual BaseObject * copy()
Returns a full copy of the object.
Definition: SkeletonObject.cc:687
ACG::SceneGraph::BaseNode::Active
Draw node & children.
Definition: BaseNode.hh:392
AnimationHandle::setFrame
void setFrame(size_t _iFrame)
Sets the current animation frame (not failsafe)
Definition: AnimationHandle.hh:62
SkeletonObject::update
void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
Definition: SkeletonObject.cc:698
SkeletonObject
Definition: SkeletonObject.hh:72
SkeletonT::joint
Joint * joint(const size_t &_index)
Returns the joint with the given index.
Definition: SkeletonT_impl.hh:636
ACG::SceneGraph::TextNode
Definition: TextNode.hh:87
BaseObjectData
Definition: BaseObjectData.hh:102
BaseObject::child
BaseObject * child(int row)
return a child
Definition: BaseObject.cc:506
SkeletonObject::~SkeletonObject
virtual ~SkeletonObject()
Destructor.
Definition: SkeletonObject.cc:100
JointT::size
size_t size() const
Returns the number of children.
Definition: JointT_impl.hh:197
SkeletonObject::setName
void setName(QString _name)
Set the name of the Object.
Definition: SkeletonObject.cc:193
ACG::SceneGraph::DrawModes::POINTS
DrawMode POINTS
draw unlighted points using the default base color
Definition: DrawModes.cc:73
BaseObject::dataType
DataType dataType() const
Definition: BaseObject.cc:229
ACG::SceneGraph::LineNode::add_color
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)
Definition: LineNode.cc:162
JointT::id
size_t id() const
returns the joint id
Definition: JointT_impl.hh:97
ACG::SceneGraph::TransformNode
Definition: TransformNode.hh:89
SkeletonObject::SkeletonObject
SkeletonObject()
Constructor.
Definition: SkeletonObject.cc:76
SkeletonObject::updateIndices
void updateIndices()
Updates the joint index text node positions.
Definition: SkeletonObject.cc:300