Commit 8b65debe authored by Mike Kremer's avatar Mike Kremer
Browse files

Added scripting function to directly load selections from files.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11939 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 10990410
......@@ -156,6 +156,9 @@ void BSplineCurveSelectionPlugin::updateSlotDescriptions() {
QStringList("objectId"), QStringList("Id of object"));
emit setSlotDescription("selectControlPoints(int,IdList)", tr("Select the specified control points"),
QString("objectId,control pointList").split(","), QString("Id of object,List of control points").split(","));
emit setSlotDescription("loadSelection(int,QString)", tr("Load selection from selection file"),
QString("objectId,filename").split(","), QString("Id of an object,Selection file").split(","));
emit setSlotDescription("selectAllKnots(int)", tr("Select all knots of a B-spline curve"),
QStringList("objectId"), QStringList("Id of object"));
......@@ -474,6 +477,22 @@ void BSplineCurveSelectionPlugin::slotVolumeLassoSelection(QMouseEvent* _event,
//==============================================================================================
void BSplineCurveSelectionPlugin::loadSelection(int _objId, const QString& _filename) {
// Load ini file
INIFile file;
if(!file.connect(_filename, false)) {
emit log(LOGERR, QString("Could not read file '%1'!").arg(_filename));
return;
}
// Load selection from file
loadIniFile(file, _objId);
}
//==============================================================================================
void BSplineCurveSelectionPlugin::loadIniFile(INIFile& _ini, int _id) {
// From INI Interface
// Load plugin specific settings
......
......@@ -138,6 +138,11 @@ private slots:
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
public slots:
// SelectionInterface
void loadSelection(int _objId, const QString& _filename);
public:
// BaseInterface
......
......@@ -158,7 +158,10 @@ void BSplineSurfaceSelectionPlugin::updateSlotDescriptions() {
QStringList("objectId"), QStringList("Id of object"));
emit setSlotDescription("selectControlPoints(int,IdList)", tr("Select the specified control points"),
QString("objectId,control pointList").split(","), QString("Id of object,List of control points").split(","));
emit setSlotDescription("loadSelection(int,QString)", tr("Load selection from selection file"),
QString("objectId,filename").split(","), QString("Id of an object,Selection file").split(","));
emit setSlotDescription("selectAllKnots(int)", tr("Select all knots of a B-spline surface"),
QStringList("objectId"), QStringList("Id of object"));
emit setSlotDescription("deselectAllKnots(int)", tr("Deselect all knots of a B-spline surface"),
......@@ -550,6 +553,22 @@ void BSplineSurfaceSelectionPlugin::slotVolumeLassoSelection(QMouseEvent* _event
//==============================================================================================
void BSplineSurfaceSelectionPlugin::loadSelection(int _objId, const QString& _filename) {
// Load ini file
INIFile file;
if(!file.connect(_filename, false)) {
emit log(LOGERR, QString("Could not read file '%1'!").arg(_filename));
return;
}
// Load selection from file
loadIniFile(file, _objId);
}
//==============================================================================================
void BSplineSurfaceSelectionPlugin::loadIniFile(INIFile& _ini, int _id) {
// From INI Interface
// Load plugin specific settings
......
......@@ -138,6 +138,11 @@ private slots:
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
public slots:
// SelectionInterface
void loadSelection(int _objId, const QString& _filename);
public:
// BaseInterface
......
......@@ -269,6 +269,9 @@ void MeshObjectSelectionPlugin::updateSlotDescriptions() {
emit setSlotDescription("setAllModelingVertices(int)", tr("Add al vertices of an object to modeling area"),
QStringList("objectId"), QStringList("Id of an object"));
emit setSlotDescription("loadSelection(int,QString)", tr("Load selection from selection file"),
QString("objectId,filename").split(","), QString("Id of an object,Selection file").split(","));
emit setSlotDescription("loadFlipperModelingSelection(int,QString)", tr("Load selection from Flipper selection file"),
QString("objectId,filename").split(","), QString("Id of an object,Flipper selection file").split(","));
emit setSlotDescription("saveFlipperModelingSelection(int,QString)", tr("Save selection into Flipper selection file"),
......@@ -1154,6 +1157,20 @@ void MeshObjectSelectionPlugin::slotComponentsSelection(QMouseEvent* _event, Sel
}
}
void MeshObjectSelectionPlugin::loadSelection(int _objId, const QString& _filename) {
// Load ini file
INIFile file;
if(!file.connect(_filename, false)) {
emit log(LOGERR, QString("Could not read file '%1'!").arg(_filename));
return;
}
// Load selection from file
loadIniFile(file, _objId);
}
void MeshObjectSelectionPlugin::loadIniFile(INIFile& _ini, int _id) {
BaseObjectData* object = 0;
......
......@@ -130,6 +130,11 @@ signals:
// ScriptInterface
void scriptInfo(QString _functionName);
public slots:
// SelectionInterface
void loadSelection(int _objId, const QString& _filename);
private slots:
// INIInterface
......
......@@ -128,6 +128,9 @@ void ObjectSelectionPlugin::updateSlotDescriptions() {
QStringList("objectId"), QStringList("Id of object"));
emit setSlotDescription("selectObjects(int,IdList)", tr("Select the specified objects"),
QString("objectId,objectList").split(","), QString("Id of object,List of objects").split(","));
emit setSlotDescription("loadSelection(int,QString)", tr("Load selection from selection file"),
QString("objectId,filename").split(","), QString("Id of an object,Selection file").split(","));
}
//==============================================================================================
......@@ -240,6 +243,22 @@ void ObjectSelectionPlugin::slotVolumeLassoSelection(QMouseEvent* _event, Select
//==============================================================================================
void ObjectSelectionPlugin::loadSelection(int _objId, const QString& _filename) {
// Load ini file
INIFile file;
if(!file.connect(_filename, false)) {
emit log(LOGERR, QString("Could not read file '%1'!").arg(_filename));
return;
}
// Load selection from file
loadIniFile(file, _objId);
}
//==============================================================================================
void ObjectSelectionPlugin::loadIniFile(INIFile& _ini, int _id) {
// From INI Interface
// Load plugin specific settings
......
......@@ -137,6 +137,11 @@ private slots:
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
public slots:
// SelectionInterface
void loadSelection(int _objId, const QString& _filename);
public:
// BaseInterface
......
Markdown is supported
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