Commit 6d2e9f63 authored by Jan Möbius's avatar Jan Möbius
Browse files

More ViewControl Scripting

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4968 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c28587e7
......@@ -36,6 +36,8 @@ void ViewControlPlugin::pluginsInitialized() {
connect( viewControlMenu_, SIGNAL( triggered(QAction*) ), this, SLOT( contextMenuTriggered(QAction*) ));
setDescriptions();
}
void ViewControlPlugin::updateShaderList() {
......@@ -828,11 +830,47 @@ void ViewControlPlugin::setShader(int _id, QString _drawMode, QString _name ){
emit updateView();
}
//-----------------------------------------------------------------------------
void ViewControlPlugin::setViewingDirection( Vector _direction, Vector _upvector , int _viewer){
PluginFunctions::viewingDirection(_direction, _upvector, _viewer);
}
//-----------------------------------------------------------------------------
void ViewControlPlugin::rotate( Vector _axis, double _angle, Vector _center , int _viewer) {
PluginFunctions::rotate( _axis, _angle, _center ,_viewer);
}
void ViewControlPlugin::setViewingDirection(Vector _dir){
//-----------------------------------------------------------------------------
void ViewControlPlugin::translate( Vector _vec , int _viewer) {
PluginFunctions::translate( _vec ,_viewer);
}
//-----------------------------------------------------------------------------
void
ViewControlPlugin::setDrawMode(QString _mode, int _viewer)
{
QStringList list = _mode.split(';');
std::vector< QString > drawModeList;
for ( int i = 0 ; i < list.size() ; ++i )
drawModeList.push_back(list[i]);
unsigned int mode = ListToDrawMode(drawModeList);
PluginFunctions::setDrawMode( mode , _viewer );
emit updateView();
}
//-----------------------------------------------------------------------------
void ViewControlPlugin::setEyePosition(Vector _eye){
}
......@@ -841,6 +879,33 @@ void ViewControlPlugin::setSceneCenter(Vector _center){
}
void ViewControlPlugin::setDescriptions() {
emit setSlotDescription("translate(Vector,int)", "Translate Scene",
QString("TranslationVector,Viewer").split(","),
QString("vector for the translation.,Viewer id (default is all)").split(","));
emit setSlotDescription("translate(Vector)", "Translate Scene in all Viewers",
QString("TranslationVector").split(","),
QString("vector for the translation.").split(","));
emit setSlotDescription("rotate(Vector,double,Vector,int)", "Rotate Scene",
QString("Axis,Angle,Center,Viewer").split(","),
QString("Rotation axis., Rotation Angle., Rotation Center.").split(","));
emit setSlotDescription("rotate(Vector,double,Vector)", "Rotate Scene in all viewers",
QString("Axis,Angle,Center").split(","),
QString("Rotation axis., Rotation Angle., Rotation Center.").split(","));
emit setSlotDescription("setViewingDirection(Vector,Vector,int)", "Set the viewing direction",
QString("direction,upVector,Viewer").split(","),
QString("Viewing direction., Up-Vector.,Viewer id (default is all)").split(","));
emit setSlotDescription("setViewingDirection(Vector,Vector)", "Set the viewing direction in all viewers",
QString("direction,upVector").split(","),
QString("Viewing direction., Up-Vector.").split(","));
emit setSlotDescription("setDrawMode(QString,int)", "Set the drawMode",
QString("DrawMode,Viewer").split(","),
QString("the drawMode ( ; separated list ),Viewer id (default is all)").split(","));
emit setSlotDescription("setDrawMode(QString)", "Set the drawMode for all viewers",
QStringList("DrawMode"), QStringList("the drawMode ( ; separated list )"));
}
Q_EXPORT_PLUGIN2( viewcontrolplugin , ViewControlPlugin );
......@@ -53,6 +53,9 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
void addContextMenu(QMenu* _menu ,DataType _objectType , ContextMenuType _type );
void setSlotDescription(QString _slotName, QString _slotDescription,
QStringList _parameters, QStringList _descriptions);
private slots:
void pluginsInitialized();
......@@ -120,6 +123,9 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
// initialize the shader Widget
void initShaderWidget();
// Announce local slots
void setDescriptions();
public slots:
/// For meshes returns if the selection for this object is visible
......@@ -148,8 +154,17 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
void setShader(int _id, QString _drawMode, QString _name );
void setViewingDirection(Vector _dir);
/// Set the viewing direction
void setViewingDirection( Vector _direction, Vector _upvector , int _viewer = PluginFunctions::ALL_VIEWERS );
/// Rotate Scene
void rotate( Vector _axis, double _angle, Vector _center , int _viewer = PluginFunctions::ALL_VIEWERS );
/// translate Scene
void translate( Vector _vec , int _viewer = PluginFunctions::ALL_VIEWERS );
/// Set the draw mode for a viewer
void setDrawMode(QString _mode, int _viewer = PluginFunctions::ALL_VIEWERS );
void setEyePosition(Vector _eye);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment