51 #include "TypeCamera.hh" 56 TypeCameraPlugin::TypeCameraPlugin() :
57 contextMenu_(0), showFrustumAction_(0)
64 if ( OpenFlipper::Options::gui() ){
65 contextMenu_ =
new QMenu(tr(
"CameraNode"));
67 showFrustumAction_ = contextMenu_->addAction( tr(
"Show viewing frustum") );
68 showFrustumAction_->setCheckable(
true);
69 showFrustumAction_->setChecked(
false);
70 showFrustumAction_->setToolTip(tr(
"Visualize cameras viewing frustum."));
71 showFrustumAction_->setStatusTip( showFrustumAction_->toolTip() );
73 QAction* flyAction = contextMenu_->addAction( tr(
"Fly to") );
74 flyAction->setToolTip(tr(
"Fly viewer to the camera position."));
75 flyAction->setStatusTip( flyAction->toolTip() );
80 connect(contextMenu_, SIGNAL(triggered(QAction*)),
this ,SLOT(contextMenuClicked(QAction*)));
93 if (showFrustumAction_)
97 void TypeCameraPlugin::contextMenuClicked(QAction* _contextAction) {
99 QVariant contextObject = _contextAction->data();
100 int objectId = contextObject.toInt();
109 if (_contextAction->text() == tr(
"Show viewing frustum")) {
116 else if (_contextAction->text() == tr(
"Fly to")) {
124 ACG::Vec3d camPosWS(mInv(0,3), mInv(1,3), mInv(2,3));
125 ACG::Vec3d camViewWS(mInv(0,2), mInv(1,2), mInv(2,2));
127 ACG::Vec3d camCenterWS = camPosWS - camViewWS;
135 bool TypeCameraPlugin::registerType() {
148 object->target(
true);
153 object->target(
true);
157 object->target(
true);
160 QString name = QString(tr(
"New Camera %1.cam").arg( object->
id() ));
163 object->setName ( name );
171 emit emptyObjectAdded ( object->
id() );
bool invert()
matrix inversion (returns true on success)
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
int addEmpty()
Create an empty object.
QString getObjectinfo()
Get all Info for the Object as a string.
const UpdateType UPDATE_VISIBILITY(UpdateTypeSet(1)<< 1)
This is the update identifier for global Object visibility ( show/hide )
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()
Initialize Plugin step 2.
DLLEXPORT DataType addDataType(QString _name, QString _readableName)
Adds a datatype and returns the id for the new type.
void slotUpdateContextMenu(int _objectId)
void flyTo(const ACG::Vec3d &_position, const ACG::Vec3d &_center, double _time)
Fly to point and viewing direction (animated).
CameraNode * cameraNode()
Get the scenegraph Node.
int objectCount()
Get the number of available objects.
void showFrustum(bool _showFrustum)
Set if viewing frustum should be shown or not.
int targetCount()
Get the number of target objects.
The Menu will be shown when an object was picked.