51 #include "TypeSkeleton.hh" 54 #include <OpenFlipper/common/BackupData.hh> 56 #include "SkeletonBackup.hh" 58 TypeSkeletonPlugin::TypeSkeletonPlugin()
59 : showIndicesAction_(0),
60 showCoordFramesAction_(0),
71 if ( OpenFlipper::Options::gui() ){
73 QMenu* contextMenu =
new QMenu(
"Options");
75 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
78 showIndicesAction_ =
new QAction(tr(
"Show &Indices"),
this);
79 showIndicesAction_->setStatusTip(tr(
"Show Joint Indices"));
80 showIndicesAction_->setIcon( QIcon(iconPath +
"showIndices.png") );
81 showIndicesAction_->setCheckable(
true);
82 showIndicesAction_->setChecked(
false);
84 showCoordFramesAction_ =
new QAction(tr(
"Show &Coordinate Frames"),
this);
85 showCoordFramesAction_->setStatusTip(tr(
"Show Coordinate Frames for joints"));
86 showCoordFramesAction_->setIcon( QIcon(iconPath +
"coordsys.png") );
87 showCoordFramesAction_->setCheckable(
true);
88 showCoordFramesAction_->setChecked(
false);
90 showMotionAction_ =
new QAction(tr(
"Show &Motion Path"),
this);
91 showMotionAction_->setStatusTip(tr(
"Show path of motions for joints"));
92 showMotionAction_->setIcon( QIcon(iconPath +
"motionPath.png") );
93 showMotionAction_->setCheckable(
true);
94 showMotionAction_->setChecked(
false);
96 connect(showIndicesAction_, SIGNAL(triggered()),
this, SLOT(slotShowIndices()) );
97 connect(showCoordFramesAction_, SIGNAL(triggered()),
this, SLOT(slotShowCoordFrames()) );
98 connect(showMotionAction_, SIGNAL(triggered()),
this, SLOT(slotShowMotionPath()) );
100 contextMenu->addAction(showIndicesAction_);
101 contextMenu->addAction(showCoordFramesAction_);
102 contextMenu->addAction(showMotionAction_);
110 if ( _objectId == -1)
119 if(skeletonObject != 0){
120 showIndicesAction_->setChecked( skeletonObject->indicesVisible() );
121 showCoordFramesAction_->setChecked( skeletonObject->
skeletonNode()->coordFramesVisible() );
122 showMotionAction_->setChecked( skeletonObject->motionPathVisible() );
126 void TypeSkeletonPlugin::slotShowIndices(){
128 QVariant contextObject = showIndicesAction_->data();
129 int objectId = contextObject.toInt();
140 if(skeletonObject != 0){
141 skeletonObject->
showIndices( showIndicesAction_->isChecked() );
146 void TypeSkeletonPlugin::slotShowCoordFrames(){
148 QVariant contextObject = showCoordFramesAction_->data();
149 int objectId = contextObject.toInt();
160 if(skeletonObject != 0){
161 skeletonObject->
skeletonNode()->showCoordFrames( showCoordFramesAction_->isChecked() );
166 void TypeSkeletonPlugin::slotShowMotionPath(){
168 QVariant contextObject = showMotionAction_->data();
169 int objectId = contextObject.toInt();
180 if(skeletonObject != 0){
186 bool TypeSkeletonPlugin::registerType() {
198 object->target(
true);
203 object->target(
true);
207 object->target(
true);
210 QString
name = QString(tr(
"New Skeleton %1.skl").arg( object->
id() ));
214 object->setName( f.fileName() );
217 object->materialNode()->set_color(
ACG::Vec4f(0.654f, 0.8f, 1.0f, 1.0f));
223 emit emptyObjectAdded (object->
id() );
241 backupData = dynamic_cast< BackupData* >(object->
objectData(OBJECT_BACKUPS));
245 object->setObjectData(OBJECT_BACKUPS, backupData);
254 #if QT_VERSION < 0x050000
void showIndices(bool _bVisible=true)
Shows or hides the indices.
bool getObject(int _identifier, BSplineCurveObject *&_object)
The Menu will be shown when an object was picked.
Abstract class that is used to store backups.
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
DLLEXPORT DataType addDataType(QString _name, QString _readableName)
Adds a datatype and returns the id for the new type.
int addEmpty()
Create an empty object.
int objectCount()
Get the number of available objects.
void storeBackup(BaseBackup *_backup)
store a backup
SkeletonObject * skeletonObject(BaseObjectData *_object)
Cast an BaseObject to a SkeletonObject if possible.
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
DLLEXPORT void setTypeIcon(DataType _id, QString _icon)
Set an Icon for a given DataType.
int targetCount()
Get the number of target objects.
void slotUpdateContextMenu(int _objectId)
void generateBackup(int _id, QString _name, UpdateType _type)
This slot should be implemented in a TypePlugin to generate type specific backups.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
QString name()
Get the backups name)
Class that encapsulates a backup.
void pluginsInitialized()
Second initialization phase.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.