Commit 5577f749 authored by Jan Möbius's avatar Jan Möbius

Marlin: Fixed Matrix conversions in VSI Plugin

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9560 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1da7b229
......@@ -54,7 +54,11 @@ Matrix4x4Widget::Matrix4x4Widget(QMap< QString, QString > &_hints, QString _type
QGridLayout *gL = new QGridLayout;
for (int i = 0; i < 16; i++)
{
default_[i] = 0.0;
if (i%5 == 0) //set diagonal to 1, convenient for e.g. transformation matrices
default_[i] = 1.0;
}
ok = true;
if (_hints.contains ("default"))
......@@ -110,7 +114,7 @@ Matrix4x4Widget::~ Matrix4x4Widget()
/// Convert current value to string
QString Matrix4x4Widget::toValue()
{
QString rv = "Matrix (";
QString rv = "Matrix4x4 (";
for (int i = 0; i < 16; i++)
rv += QString::number (current_[i]) + ",";
......@@ -124,8 +128,8 @@ QString Matrix4x4Widget::toValue()
/// Read value from string
void Matrix4x4Widget::fromValue(QString _from)
{
if (_from.startsWith ("Matrix ("))
_from.remove (0, 8);
if (_from.startsWith ("Matrix4x4 ("))
_from.remove (0, 11);
if (_from.endsWith (")"))
_from.remove (_from.length () - 1, 1);
......
......@@ -134,15 +134,23 @@ void VsiPlugin::initContext()
if (!dir.exists ())
return;
dir.makeAbsolute ();
foreach (QString file, dir.entryList (QStringList("*.xml"), QDir::Files))
foreach (QString sub, dir.entryList(QDir::Dirs))
{
QFile f (dir.filePath (file));
if (!f.open (QIODevice::ReadOnly))
if (sub == "..")
continue;
QDir subdir = dir;
subdir.cd (sub);
subdir.makeAbsolute();
foreach (QString file, subdir.entryList (QStringList("*.xml"), QDir::Files))
{
QFile f (subdir.filePath (file));
if (!f.open (QIODevice::ReadOnly))
continue;
context_->parse (f.readAll ());
context_->parse (f.readAll ());
}
}
}
......@@ -191,7 +199,8 @@ QScriptValue VsiPlugin::askForInputs(QString _element, QString _inputs)
context_->scriptEngine ()->pushContext ();
QScriptValue rv = context_->scriptEngine ()->evaluate (script);
rv = context_->scriptEngine ()->globalObject ().property ("inputs");
context_->scriptEngine ()->globalObject ().setProperty ("inputs", rv);
//rv = context_->scriptEngine ()->globalObject ().property ("inputs");
context_->scriptEngine ()->popContext ();
return rv;
......
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