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( locale.toString( _skeleton->
jointCount() ) );
116 info_->comboBoxAnimations->clear();
117 QString animationInfo;
120 for (
unsigned int 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: " + locale.toString( _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 +
" " + locale.toString(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 unsigned int node_idx, target_idx;
231 #if QT_VERSION < 0x050000 Iterator class for the skeleton.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
Plugin to visualize information about objects in the scene.
Represents a single joint in the skeleton.
bool getObject(int _identifier, BSplineCurveObject *&_object)
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
unsigned int jointCount()
Returns the number of joints.
ChildIter begin()
Returns an iterator on the joints children.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
const std::string & animationName(unsigned int _index)
Returns the name of the animation with the given index.
DataType supportedDataTypes()
Get data type for information requests.
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
unsigned int id()
returns the joint id
virtual bool picked(uint _node_idx)
detect if the node has been picked
PickTarget
What target to use for picking.
QString name()
Name of the Plugin.
A general pose, used to store the frames of the animation.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
void pluginsInitialized()
initialize the plugin
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
unsigned int animationCount()
Returns the number of animations stored in this skeleton.
void setDescriptions()
set scripting slot descriptions
Joint * parent()
Returns the parent joint.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
void slotInformationRequested(const QPoint _clickedPoint, DataType _type)
Show information dialog on clicked object.
virtual QString getObjectinfo()
Get all Info for the Object as a string.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
ChildIter end()
Returns the end iterator for the joints children.
pick any of the prior targets (should be implemented for all nodes)
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
Joint * joint(const unsigned int &_index)
Returns the joint with the given index.
size_t size()
Returns the number of children.
Pose * referencePose()
Returns a pointer to the reference pose.