73 #ifdef ENABLE_SKELETON_SUPPORT
77 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
78 #include <OpenVolumeMesh/Attribs/NormalAttrib.hh>
81 #include "MoveToolbar.hh"
82 #include "MoveProps.hh"
83 #include "MoveObjectMarker.hh"
87 class MovePlugin :
public QObject,
BaseInterface,
MouseInterface,
KeyInterface,
PickingInterface,
ToolboxInterface,
BackupInterface,
LoggingInterface,
ScriptInterface,
ToolbarInterface,
ContextMenuInterface,
LoadSaveInterface,
RPCInterface
103 #if QT_VERSION >= 0x050000
104 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-Move")
108 typedef unsigned int SelectionType;
109 static const SelectionType VERTEX = 1;
110 static const SelectionType EDGE = 2;
111 static const SelectionType FACE = 4;
112 static const SelectionType CELL = 8;
117 void updatedObject(
int,
const UpdateType& _type);
118 void nodeVisibilityChanged(
int);
121 void addPickMode(
const std::string& _mode );
122 void addHiddenPickMode(
const std::string& _mode );
123 void setPickModeMouseTracking (
const std::string& _mode,
bool _mouseTracking);
124 void setPickModeToolbar (
const std::string& _mode, QToolBar * _toolbar);
133 void log(
Logtype _type, QString _message);
134 void log(QString _message);
137 void scriptInfo( QString _functionName );
138 void setSlotDescription(QString _slotName, QString _slotDescription,
139 QStringList _parameters, QStringList _descriptions);
142 void addToolbar(QToolBar* _toolbar);
143 void getToolBar( QString _name, QToolBar*& _toolbar);
146 void registerKey(
int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse =
false);
149 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
152 void pluginExists(QString _pluginName,
bool &_exists);
153 void functionExists(QString _pluginName, QString _functionName,
bool &_exists);
158 void initializePlugin();
161 void slotAllCleared();
164 void objectDeleted(
int _id );
167 void slotMouseWheelEvent(QWheelEvent * _event,
const std::string & _mode);
171 void slotKeyEvent (QKeyEvent* _event);
172 void slotKeyReleaseEvent (QKeyEvent* _event);
178 void slotBackupRequested(
int , QString ,
int ){};
179 void slotRestoreRequested(
int , QString ,
int ){};
190 QString
name(){
return (QString(
"Move")); };
193 QString
description() {
return (QString(tr(
"Moves Meshes with Manipulators"))); };
251 template <
typename MeshType>
255 template <
typename MeshType>
259 template <
typename MeshType>
345 template<
typename MeshT >
348 #ifdef ENABLE_POLYLINE_SUPPORT
349 template<
class PolyLineT >
354 #ifdef ENABLE_SKELETON_SUPPORT
359 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
360 template<
typename VolumeMeshT >
365 template<
typename VolumeMeshT >
366 ACG::Vec3d cogVolumeMesh( VolumeMeshT& _mesh );
369 template<
typename VolumeMeshT >
373 template<
typename VolumeMeshT >
377 template<
typename VolumeMeshT >
392 void placeManip(QMouseEvent * _event,
bool _snap =
false);
395 template<
typename MeshT >
399 template<
typename MeshT >
403 template<
typename MeshT >
614 QString version() {
return QString(
"1.2"); };
627 #endif //MOVEPLUGIN_HH
QAction * moveSelectionAction_
Called by Toolbar to enable move mode.
QAction * placeAndSnapAction_
Called by pick Toolbar.
Interface class from which all plugins have to be created.
void slotSetDirection()
Set Direction of manipulator in tab changed.
void setManipulatorDirection(int _objectId, Vector _directionX, Vector _directionY)
Set the direction of the manipulator.
Keyboard Event Interface.
void slotMoveToOrigin()
Move target Meshes cog to the origin.
Matrix4x4 getObjectRenderingMatrix(int _objectId)
Gets the Object Matrix in the scenegraph.
SelectionType selectionType_
Current SelectionType of SelectionPlugin.
Logtype
Log types for Message Window.
QActionGroup * toolBarActions_
Called by Toolbar to enable move mode.
QToolBar * pickToolbar_
Called by pick Toolbar.
void slotMoveManipToCOG()
Move the current manipulator to the cog of the object.
void translateEdgeSelection(int _objectId, Vector _vector)
translate current edge selection of an Object by a given vector
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
bool transformFaceSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void slotUnifyBoundingBoxAllAxis()
Scale all Boundingbox axis to unit size.
QAction * transformRefPoseManipAction_
Called by pick Toolbar.
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
void slotTranslation()
perform a translation for Manipulator in tab
void updateManipulatorDialog()
Update the Dialog with the last clicked manipulator.
void placeManip(QMouseEvent *_event, bool _snap=false)
Place and show the Manipulator.
bool transformEdgeSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
void setManipulatorPosition(int _objectId, Vector _position)
Set the position of the manipulator.
Interface for all Plugins which do logging to the logging window of the framework.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
void objectRenderingMatrixScale(int _objectId, double _s)
Adds a scaling factor to the Object rendering Matrix in the scenegraph.
void setPickModeProps(movePropsWidget *_pW, const std::string &_pickmode)
List of properties dialogs (each corresponding to one manipulator)
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
Vector manipulatorPosition(int _objectId)
Get the position of the manipulator.
QList< movePropsWidget * > propsWindows_
List of properties dialogs (each corresponding to one manipulator)
Interface to call functions across plugins.
Vector manipulatorDirectionZ(int _objectId)
Get the z-direction of the manipulator.
bool transformedSelected_
stores if any selected elements where transformed
QAction * rotateManipAction_
Called by pick Toolbar.
QAction * contextActionHide_
Context menu entry to hide a manipulator.
QAction * placeAction_
Called by pick Toolbar.
MovePlugin()
Default Constructor.
QAction * contextAction_
Context menu entry for showing per manipulator settings.
QAction * fixChildManipAction_
Called by pick Toolbar.
void objectRenderingMatrixIdentity(int _objectId)
Sets the Object Matrix in the scenegraph to identity.
QAction * moveAction_
Called by Toolbar to enable move mode.
movePropsWidget * getDialogWidget(BaseObjectData *_obj)
Get properties dialog widget that is attached to BaseDataObject obj.
int axisA_
stores the current axes in the tool
void slotUnifyBoundingBoxLongestAxis()
Scale Boundingbox longest axis to unit size (keeps aspect ratio)
void setAllTargets(bool _state)
Sets whether all targets should be affected or not.
QAction * toAllTargets_
Checked if transformation should be applied to all target objs.
int lastActiveManipulator_
Stores the last manipulator which has been clicked ( used for the toolbox dialog) ...
int axisB_
stores the current axes in the tool
OpenMesh::Vec3d getNearestFace(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest face to hitpoint.
OpenMesh::Vec3d getNearestEdge(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest edge to hitpoint.
void translateFaceSelection(int _objectId, Vector _vector)
translate current face selection of an Object by a given vector
std::vector< int > IdList
Standard Type for id Lists used for scripting.
QAction * rotateTranslateAction_
Called by pick Toolbar.
QString name()
Name of the Plugin.
QToolBar * toolbar_
Called by Toolbar to enable move mode.
void transformHandleRegion(int _objectId, Matrix4x4 _matrix)
Transform handle region using the given transformation matrix.
QMenu * contextMenuManipControl_
Additional Context Menu replicating the toolbar stuff.
bool transformVertexSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QAction * resizeAction_
Called by pick Toolbar.
Add a toolbox to OpenFlipper.
Interface for all Plugins which provide scriptable Functions.
void updateSelectionType()
Get current primitive selection.
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
void setManipMode(QtTranslationManipulatorNode::ManipulatorMode _mode)
Set the manipulator manipulation mode.
QAction * biggerManipAction_
Called by pick Toolbar.
void objectRenderingMatrixRotate(int _objectId, Vector _axis, double _angle)
Adds a scaling factor to the Object rendering Matrix in the scenegraph.
void slotEnableSelectionMode()
stores the current axes in the tool
void showManipulators()
Checks if the manipulators should be visible or not.
void moveObject(ACG::Matrix4x4d mat, int _id)
Move an object with given id.
Vector manipulatorDirectionX(int _objectId)
Get the x-direction of the manipulator.
void transform(int _objectId, Matrix4x4 _matrix)
transform an Object by a given matrix
void slotScale()
Scale (with values from Tab)
void slotToggleAxisB()
Toggle the second axis for changing direction in tab.
OpenMesh::Vec3d getNearestVertex(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest vertex to hitpoint.
void slotUnifyBoundingBoxDiagonal()
Scale Boundingbox Diagonal to unit size.
void showProps()
Show properties of move manipulator in a dialog ( Called via context for picking. Get the picked id f...
Interface for all plugins which want to Load or Save files and create Objects.
void slotSetPosition()
Position of manipulator in tab changed.
void slotSetMoveMode(QAction *_action)
Called by Toolbar to enable move mode.
ACG::Matrix4x4d getLastManipulatorMatrix(bool _reset=true)
Get the Matrix of the last active Manipulator ( Identity if not found or hidden Manipulator ) ...
void translateVertexSelection(int _objectId, Vector _vector)
translate current vertex selection of an Object by a given vector
moveToolbarWidget * tool_
Widget for Toolbox.
Allow access to picking functions.
void objectRenderingMatrixTranslate(int _objectId, Vector _translation)
Adds a scaling factor to the Object rendering Matrix in the scenegraph.
void slotProjectToTangentPlane()
Project the current manipulator onto the tangent plane of the object.
Interface class for backup handling.
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
double manip_size_modifier_
Modifier for the Size (changed by Mousewheel Events)
Interface class for creating custom context menus.
Interface class for receiving mouse events.
bool toolboxActive_
True if the toolbox widget is active.
void slotEnableObjectMode()
stores the current axes in the tool
double manip_size_
Size for the manipulators.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
QAction * currentPoseManipAction_
Called by pick Toolbar.
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
void moveSelection(ACG::Matrix4x4d mat, int _id, QEvent::Type _type)
Move selection on an object with given id.
void slotRotate()
Rotate Manipulator (with values from Tab)
std::vector< int > activeManipulators_
Size for the manipulators.
void slotUpdateContextMenuNode(int _nodeId)
Hide context menu entry when right clicking on node other than manipulator node.
void hideManipulator()
Hide the manipulator( Called via context for picking. Get the picked id from the Qvariant attached to...
Vector manipulatorDirectionY(int _objectId)
Get the y-direction of the manipulator.
void getBB(MeshT &_mesh, ACG::Vec3d &_bb_min, ACG::Vec3d &_bb_max)
get bounding box diagonal of a mesh
QAction * contextMenuManipControlsAction_
Action holding the context menu for toolbar replication.
bool transformCellSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
void setDescriptions()
Set Descriptions for scriptable functions.
void slotToggleAxisA()
Toggle the first axis for changing direction in tab.
QtTranslationManipulatorNode::ManipulatorMode manMode_
Holds the current manipulator mode.
movePropsWidget * getDialogFromButton(QPushButton *_but)
Get parent properties dialog widget of QPushButton but.
ManipulatorMode
enum to define the manipulator mode
QString description()
Description of the Plugin.
MoveObjectMarker objectMarker_
Object marker to dimm Objects during manipulator transformation.
void unifyBB(MeshT &_mesh, Unificationtype u=MovePlugin::DIAGONAL)
scale mesh to have a boundingboxdiagonal of one
QIcon * toolIcon_
stores the current axes in the tool
void translate(int _objectId, Vector _vector)
translate an Object by a given vector
void unifyBoundingBox(Unificationtype u)
Size for the manipulators.
void transformMesh(ACG::Matrix4x4d _mat, MeshT &_mesh)
Transform a mesh with the given transformation matrix.
QAction * smallerManipAction_
Called by pick Toolbar.
Unificationtype
stores the current axes in the tool