54 #include "SkeletonObjectInfoPlugin.hh" 57 #include <MeshTools/MeshInfoT.hh> 58 #include <ACG/Geometry/Algorithms.hh> 63 void InfoSkeletonObjectPlugin::initializePlugin() {
65 if ( OpenFlipper::Options::gui()) {
87 void InfoSkeletonObjectPlugin::printSkeletonInfo(
Skeleton* _skeleton,
unsigned int _objectId,
unsigned int _index,
ACG::Vec3d& _hitPoint ) {
95 info_->generalBox->setTitle( tr(
"General object information for %1").arg( obj->
name() ) );
100 info_->id->setText( locale.toString(_objectId) );
102 info_->joints->setText( QString::number( _skeleton->
jointCount() ) );
106 info_->comboBoxAnimations->clear();
107 QString animationInfo;
110 for (
size_t i = 0; i < aniCount; ++i) {
112 animationInfo =
"Name: " + QString(aniName.c_str())
113 +
" : Frames: " + locale.toString(_skeleton->
animation(aniName)->frameCount());
114 info_->comboBoxAnimations->addItem(animationInfo);
119 info_->jointHandle->setText( locale.toString( _index ) );
121 QString adjacentHandles;
125 adjacentHandles = adjacentHandles +
"Parent: " + QString::number( _skeleton->
joint(_index)->
parent()->
id() ) +
" ;";
129 if ( _skeleton->
joint(_index)->
size() != 0 ) {
131 adjacentHandles = adjacentHandles +
"Children:";
133 for ( Skeleton::Joint::ChildIter it = _skeleton->
joint(_index)->
begin(); it != _skeleton->
joint(_index)->
end(); ++it) {
136 adjacentHandles = adjacentHandles +
" " + QString::number(joint->
id());
142 info_->adjacentJointsHandles->setText(adjacentHandles);
145 Skeleton::Point bbMin( FLT_MAX, FLT_MAX, FLT_MAX);
146 Skeleton::Point bbMax(-FLT_MAX, -FLT_MAX, -FLT_MAX);
147 Skeleton::Point cog(0.0,0.0,0.0);
163 Skeleton::Point diff = bbMax-bbMin;
165 info_->bbMinX->setText( QString::number(bbMin[0],
'f') );
166 info_->bbMinY->setText( QString::number(bbMin[1],
'f') );
167 info_->bbMinZ->setText( QString::number(bbMin[2],
'f') );
169 info_->bbMaxX->setText( QString::number(bbMax[0],
'f') );
170 info_->bbMaxY->setText( QString::number(bbMax[1],
'f') );
171 info_->bbMaxZ->setText( QString::number(bbMax[2],
'f') );
173 info_->bbSizeX->setText( QString::number(diff[0],
'f') );
174 info_->bbSizeY->setText( QString::number(diff[1],
'f') );
175 info_->bbSizeZ->setText( QString::number(diff[2],
'f') );
181 info_->cogX->setText( QString::number(cog[0],
'f') );
182 info_->cogY->setText( QString::number(cog[1],
'f') );
183 info_->cogZ->setText( QString::number(cog[2],
'f') );
186 info_->pointX->setText( QString::number( _hitPoint[0],
'f' ) );
187 info_->pointY->setText( QString::number( _hitPoint[1],
'f' ) );
188 info_->pointZ->setText( QString::number( _hitPoint[2],
'f' ) );
190 info_->setWindowFlags(info_->windowFlags() | Qt::WindowStaysOnTopHint);
204 size_t node_idx, target_idx;
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
virtual QString getObjectinfo()
Get all Info for the Object as a string.
void pluginsInitialized()
initialize the plugin
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
pick any of the prior targets (should be implemented for all nodes)
DataType supportedDataTypes()
Get data type for information requests.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
ChildIter end()
Returns the end iterator for the joints children.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
void slotInformationRequested(const QPoint _clickedPoint, DataType _type)
Show information dialog on clicked object.
void setDescriptions()
set scripting slot descriptions
QString name()
Name of the Plugin.
A general pose, used to store the frames of the animation.
size_t animationCount()
Returns the number of animations stored in this skeleton.
Iterator class for the skeleton.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
const std::string & animationName(size_t _index)
Returns the name of the animation with the given index.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Joint * parent()
Returns the parent joint.
Pose * referencePose()
Returns a pointer to the reference pose.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
Represents a single joint in the skeleton.
ChildIter begin()
Returns an iterator on the joints children.
PickTarget
What target to use for picking.
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
size_t jointCount()
Returns the number of joints.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
virtual bool picked(uint _node_idx)
detect if the node has been picked
Joint * joint(const size_t &_index)
Returns the joint with the given index.
size_t size() const
Returns the number of children.
size_t id() const
returns the joint id