60 #include "SkeletonObjectInfoPlugin.hh"
63 #include <MeshTools/MeshInfoT.hh>
64 #include <ACG/Geometry/Algorithms.hh>
66 #if QT_VERSION >= 0x050000
73 void InfoSkeletonObjectPlugin::initializePlugin() {
75 if ( OpenFlipper::Options::gui()) {
97 void InfoSkeletonObjectPlugin::printSkeletonInfo(
Skeleton* _skeleton,
unsigned int _objectId,
unsigned int _index,
ACG::Vec3d& _hitPoint ) {
105 info_->generalBox->setTitle( tr(
"General object information for %1").arg( obj->
name() ) );
110 info_->id->setText( locale.toString(_objectId) );
112 info_->joints->setText( QString::number( _skeleton->
jointCount() ) );
116 info_->comboBoxAnimations->clear();
117 QString animationInfo;
120 for (
size_t i = 0; i < aniCount; ++i) {
122 animationInfo =
"Name: " + QString(aniName.c_str())
123 +
" : Frames: " + locale.toString(_skeleton->
animation(aniName)->frameCount());
124 info_->comboBoxAnimations->addItem(animationInfo);
129 info_->jointHandle->setText( locale.toString( _index ) );
131 QString adjacentHandles;
135 adjacentHandles = adjacentHandles +
"Parent: " + QString::number( _skeleton->
joint(_index)->
parent()->
id() ) +
" ;";
139 if ( _skeleton->
joint(_index)->
size() != 0 ) {
141 adjacentHandles = adjacentHandles +
"Children:";
143 for ( Skeleton::Joint::ChildIter it = _skeleton->
joint(_index)->
begin(); it != _skeleton->
joint(_index)->
end(); ++it) {
146 adjacentHandles = adjacentHandles +
" " + QString::number(joint->
id());
152 info_->adjacentJointsHandles->setText(adjacentHandles);
155 Skeleton::Point bbMin( FLT_MAX, FLT_MAX, FLT_MAX);
156 Skeleton::Point bbMax(-FLT_MAX, -FLT_MAX, -FLT_MAX);
157 Skeleton::Point cog(0.0,0.0,0.0);
173 Skeleton::Point diff = bbMax-bbMin;
175 info_->bbMinX->setText( QString::number(bbMin[0],
'f') );
176 info_->bbMinY->setText( QString::number(bbMin[1],
'f') );
177 info_->bbMinZ->setText( QString::number(bbMin[2],
'f') );
179 info_->bbMaxX->setText( QString::number(bbMax[0],
'f') );
180 info_->bbMaxY->setText( QString::number(bbMax[1],
'f') );
181 info_->bbMaxZ->setText( QString::number(bbMax[2],
'f') );
183 info_->bbSizeX->setText( QString::number(diff[0],
'f') );
184 info_->bbSizeY->setText( QString::number(diff[1],
'f') );
185 info_->bbSizeZ->setText( QString::number(diff[2],
'f') );
191 info_->cogX->setText( QString::number(cog[0],
'f') );
192 info_->cogY->setText( QString::number(cog[1],
'f') );
193 info_->cogZ->setText( QString::number(cog[2],
'f') );
196 info_->pointX->setText( QString::number( _hitPoint[0],
'f' ) );
197 info_->pointY->setText( QString::number( _hitPoint[1],
'f' ) );
198 info_->pointZ->setText( QString::number( _hitPoint[2],
'f' ) );
200 info_->setWindowFlags(info_->windowFlags() | Qt::WindowStaysOnTopHint);
214 size_t node_idx, target_idx;
231 #if QT_VERSION < 0x050000
Represents a single joint in the skeleton.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
void setDescriptions()
set scripting slot descriptions
Pose * referencePose()
Returns a pointer to the reference pose.
virtual bool picked(uint _node_idx)
detect if the node has been picked
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
DataType supportedDataTypes()
Get data type for information requests.
size_t id() const
returns the joint id
ChildIter begin()
Returns an iterator on the joints children.
bool getObject(int _identifier, BSplineCurveObject *&_object)
const std::string & animationName(size_t _index)
Returns the name of the animation with the given index.
pick any of the prior targets (should be implemented for all nodes)
Iterator class for the skeleton.
size_t jointCount()
Returns the number of joints.
void pluginsInitialized()
initialize the plugin
size_t size() const
Returns the number of children.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
QString name()
Name of the Plugin.
ChildIter end()
Returns the end iterator for the joints children.
void slotInformationRequested(const QPoint _clickedPoint, DataType _type)
Show information dialog on clicked object.
A general pose, used to store the frames of the animation.
Joint * parent()
Returns the parent joint.
size_t animationCount()
Returns the number of animations stored in this skeleton.
PickTarget
What target to use for picking.
Plugin to visualize information about objects in the scene.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
Joint * joint(const size_t &_index)
Returns the joint with the given index.