45 #include "TypeSkeleton.hh" 48 #include <OpenFlipper/common/BackupData.hh> 50 #include "SkeletonBackup.hh" 54 TypeSkeletonPlugin::TypeSkeletonPlugin()
55 : showIndicesAction_(0),
56 showCoordFramesAction_(0),
67 if ( OpenFlipper::Options::gui() ){
69 QMenu* contextMenu =
new QMenu(
"Options");
71 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
74 showIndicesAction_ =
new QAction(tr(
"Show &Indices"),
this);
75 showIndicesAction_->setStatusTip(tr(
"Show Joint Indices"));
76 showIndicesAction_->setIcon( QIcon(iconPath +
"showIndices.png") );
77 showIndicesAction_->setCheckable(
true);
78 showIndicesAction_->setChecked(
false);
80 showCoordFramesAction_ =
new QAction(tr(
"Show &Coordinate Frames"),
this);
81 showCoordFramesAction_->setStatusTip(tr(
"Show Coordinate Frames for joints"));
82 showCoordFramesAction_->setIcon( QIcon(iconPath +
"coordsys.png") );
83 showCoordFramesAction_->setCheckable(
true);
84 showCoordFramesAction_->setChecked(
false);
86 showMotionAction_ =
new QAction(tr(
"Show &Motion Path"),
this);
87 showMotionAction_->setStatusTip(tr(
"Show path of motions for joints"));
88 showMotionAction_->setIcon( QIcon(iconPath +
"motionPath.png") );
89 showMotionAction_->setCheckable(
true);
90 showMotionAction_->setChecked(
false);
92 connect(showIndicesAction_, SIGNAL(triggered()),
this, SLOT(slotShowIndices()) );
93 connect(showCoordFramesAction_, SIGNAL(triggered()),
this, SLOT(slotShowCoordFrames()) );
94 connect(showMotionAction_, SIGNAL(triggered()),
this, SLOT(slotShowMotionPath()) );
96 contextMenu->addAction(showIndicesAction_);
97 contextMenu->addAction(showCoordFramesAction_);
98 contextMenu->addAction(showMotionAction_);
106 if ( _objectId == -1)
115 if(skeletonObject != 0){
116 showIndicesAction_->setChecked( skeletonObject->indicesVisible() );
117 showCoordFramesAction_->setChecked( skeletonObject->
skeletonNode()->coordFramesVisible() );
118 showMotionAction_->setChecked( skeletonObject->motionPathVisible() );
122 void TypeSkeletonPlugin::slotShowIndices(){
124 QVariant contextObject = showIndicesAction_->data();
125 int objectId = contextObject.toInt();
136 if(skeletonObject != 0){
137 skeletonObject->
showIndices( showIndicesAction_->isChecked() );
142 void TypeSkeletonPlugin::slotShowCoordFrames(){
144 QVariant contextObject = showCoordFramesAction_->data();
145 int objectId = contextObject.toInt();
156 if(skeletonObject != 0){
157 skeletonObject->
skeletonNode()->showCoordFrames( showCoordFramesAction_->isChecked() );
162 void TypeSkeletonPlugin::slotShowMotionPath(){
164 QVariant contextObject = showMotionAction_->data();
165 int objectId = contextObject.toInt();
176 if(skeletonObject != 0){
182 bool TypeSkeletonPlugin::registerType() {
194 object->target(
true);
199 object->target(
true);
203 object->target(
true);
206 QString
name = QString(tr(
"New Skeleton %1.skl").arg( object->
id() ));
210 object->setName( f.fileName() );
213 object->materialNode()->set_color(
ACG::Vec4f(0.654f, 0.8f, 1.0f, 1.0f));
219 emit emptyObjectAdded (object->
id() );
237 backupData = dynamic_cast< BackupData* >(object->
objectData(OBJECT_BACKUPS));
241 object->setObjectData(OBJECT_BACKUPS, backupData);
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
int addEmpty()
Create an empty object.
QString name()
Get the backups name)
SkeletonObject * skeletonObject(BaseObjectData *_object)
Cast an BaseObject to a SkeletonObject if possible.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
DLLEXPORT void setTypeIcon(DataType _id, QString _icon)
Set an Icon for a given DataType.
void pluginsInitialized()
Second initialization phase.
void generateBackup(int _id, QString _name, UpdateType _type)
This slot should be implemented in a TypePlugin to generate type specific backups.
Abstract class that is used to store backups.
DLLEXPORT DataType addDataType(QString _name, QString _readableName)
Adds a datatype and returns the id for the new type.
void storeBackup(BaseBackup *_backup)
store a backup
void showIndices(bool _bVisible=true)
Shows or hides the indices.
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
int objectCount()
Get the number of available objects.
int targetCount()
Get the number of target objects.
The Menu will be shown when an object was picked.
Class that encapsulates a backup.
void slotUpdateContextMenu(int _objectId)