diff --git a/IanniX.pro.user b/IanniX.pro.user index 4dbe94e..20df450 100644 --- a/IanniX.pro.user +++ b/IanniX.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/Info.plist b/Info.plist index dae7b51..9cb9574 100755 --- a/Info.plist +++ b/Info.plist @@ -72,6 +72,6 @@ CFBundleSignature INNX CFBundleVersion - 0.9.13 + 0.9.14 diff --git a/Patches/Ableton Live/IanniX.als b/Patches/Ableton Live/IanniX.als index ec606c5..6aae467 100644 Binary files a/Patches/Ableton Live/IanniX.als and b/Patches/Ableton Live/IanniX.als differ diff --git a/Tools/Templates/_IanniX.txt b/Tools/Templates/_IanniX.txt index 617c9c4..ad3948a 100644 --- a/Tools/Templates/_IanniX.txt +++ b/Tools/Templates/_IanniX.txt @@ -25,3 +25,5 @@ cartesian 6*cos(8*param1*param4*t*PI) , 6*sin(24*param2*param4*t*PI) , 12*param5 cartesian 5*sin(80*param1*param5*t*PI)*cos(8*param2*param5*t*PI) , 5*sin(80*param3*param5*t*PI)*sin(8*param4*param5*t*PI) , 5*cos(40*param5*t*PI) | 2D rosette or 3D sphere? cartesian 10*param2*t*cos(40*param4*param1*t*PI) , 10*param2*t*sin(40*param4*param1*t*PI) , 20*param3*param4*t-5*param5 | Conical spiral of Pappus cartesian (2+4*cos(48*param1*param4*t*PI))*cos(8*param2*param4*t*PI) , (2+4*cos(48*param1*param4*t*PI))*sin(8*param2*param4*t*PI) , 4*param5*sin(48*param3*param4*t*PI) | An other 3D flower +cartesian (5*param1+5*param2)*cos(50*param4*t*2*PI) + (5*param3)*cos((5*param1+5*param2)*50*param4*t*2*PI/(5*param2)), (5*param1+5*param2)*sin(50*param4*t*2*PI) + (5*param3)*sin((5*param1+5*param2)*50*param4*t*2*PI/(5*param2)), 0 | Base for 2D spirography +cartesian (5*param1+5*param2)*cos(50*param4*t*2*PI) + (5*param3)*cos((5*param1+5*param2)*50*param4*t*2*PI/(5*param2)), (5*param1+5*param2)*sin(50*param4*t*2*PI) + (5*param3)*sin((5*param1+5*param2)*50*param4*t*2*PI/(5*param2)), (5*param1+5*param2)*cos(500*param5*t*2*PI)*sin(50*param4*t*2*PI) | Base for 3D spirography \ No newline at end of file diff --git a/gui/uiinspector.cpp b/gui/uiinspector.cpp index 70d5b2c..9c21a1b 100644 --- a/gui/uiinspector.cpp +++ b/gui/uiinspector.cpp @@ -152,8 +152,8 @@ UiInspector::UiInspector(QWidget *parent) : //Templates ui->equationTemplate->clear(); - addEquationTemplate("Templates", true); - addEquationTemplate("--"); + addEquationTemplate("Templates", "", true); + addEquationTemplate("--", ""); QFileInfoList files = QDir(Application::pathApplication.absoluteFilePath() + "/Tools/Templates/").entryInfoList(QStringList() << "*.txt", QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); files << QDir(Application::pathDocuments.absoluteFilePath() + "/Templates/").entryInfoList(QStringList() << "*.txt", QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); bool firstTemplate = true; @@ -179,12 +179,13 @@ UiInspector::UiInspector(QWidget *parent) : else if(header == "[equations]") { if(!title.isEmpty()) { if(!firstTemplate) - addEquationTemplate("--"); + addEquationTemplate("--", ""); firstTemplate = false; - addEquationTemplate(title); + addEquationTemplate(title, ""); title.clear(); } - addEquationTemplate(" " + templateLong.trimmed(), true); + QStringList templateLongSplited = templateLong.trimmed().split(" | "); + addEquationTemplate(" " + templateLongSplited.at(qMax(1, templateLongSplited.count()-1)), templateLongSplited.first(), true); } } } @@ -196,9 +197,9 @@ UiInspector::UiInspector(QWidget *parent) : refresh(); refreshIp(); } -void UiInspector::addEquationTemplate(QString text, bool enabled) { +void UiInspector::addEquationTemplate(const QString &text, const QString &valeur, bool enabled) { if(text.trimmed() == "--") ui->equationTemplate->insertSeparator(ui->equationTemplate->count()); - else ui->equationTemplate->addItem(text); + else ui->equationTemplate->addItem(text, valeur); if(!enabled) qobject_cast(ui->equationTemplate->model())->item(ui->equationTemplate->count()-1)->setEnabled(false); } @@ -345,11 +346,8 @@ void UiInspector::actionInfo() { else if((ui->patternLine == sender()) || (ui->easingCombo == sender())) Application::current->execute(QString("%1 selection %2 0 %3").arg(COMMAND_CURSOR_START).arg(ui->easingCombo->currentIndex()).arg(ui->patternLine->currentText().split(" - ").at(0)), ExecuteSourceGui); - else if((ui->equationTemplate == sender()) && (ui->equationTemplate->currentText().length())) { - QStringList temp = ui->equationTemplate->currentText().split(" | "); - if(temp.count() > 1) - Application::current->execute(QString("%1 selection %2").arg(COMMAND_CURVE_EQUATION).arg(temp.at(0).trimmed()), ExecuteSourceGui); - } + else if((ui->equationTemplate == sender()) && (!ui->equationTemplate->itemData(ui->equationTemplate->currentIndex()).toString().isEmpty())) + Application::current->execute(QString("%1 selection %2").arg(COMMAND_CURVE_EQUATION).arg(ui->equationTemplate->itemData(ui->equationTemplate->currentIndex()).toString()), ExecuteSourceGui); refresh(); } @@ -783,9 +781,9 @@ void UiInspector::refresh() { ui->sizeLabel->setVisible(showCurvePointsInfo || showCurveEllipseInfo); ui->intertiaSpin->setVisible(showCurvePointsInfo); ui->intertiaLabel->setVisible(showCurvePointsInfo); - ui->pointsLabel->setVisible(showCurvePointsInfo); + ui->pointsLabel->setVisible(showCurveInfo); + ui->pointsResample->setVisible(showCurveInfo); ui->pointsLists->setVisible(showCurvePointsInfo); - ui->pointsResample->setVisible(showCurvePointsInfo); ui->equationTemplate->setVisible(showCurveEquationInfo); ui->equationLabel->setVisible(showCurveEquationInfo); ui->equationType->setVisible(showCurveEquationInfo); diff --git a/gui/uiinspector.h b/gui/uiinspector.h index 2170792..1006793 100644 --- a/gui/uiinspector.h +++ b/gui/uiinspector.h @@ -67,7 +67,7 @@ public slots: private: void timerEvent(QTimerEvent *); - void addEquationTemplate(QString text, bool enabled = false); + void addEquationTemplate(const QString &text, const QString &valeur, bool enabled = false); bool needRefresh; public slots: void refreshIp(); diff --git a/gui/uiinspector.ui b/gui/uiinspector.ui index 6ab5990..caf2b3a 100644 --- a/gui/uiinspector.ui +++ b/gui/uiinspector.ui @@ -1715,7 +1715,7 @@ POINTS - + 103 @@ -1726,12 +1726,12 @@ POINTS Click here to manually edit curve points - EDIT POINTS + RESAMPLE - + 103 @@ -1742,7 +1742,7 @@ POINTS Click here to manually edit curve points - RESAMPLE + EDIT POINTS diff --git a/gui/uimessagebox.cpp b/gui/uimessagebox.cpp index d188c80..a66e53d 100644 --- a/gui/uimessagebox.cpp +++ b/gui/uimessagebox.cpp @@ -13,6 +13,11 @@ UiMessageBox::~UiMessageBox() { delete ui; } +QPair UiMessageBox::getCheckboxes() { + return qMakePair(ui->checkSmooth->isChecked(), ui->checkTrigger->isChecked()); +} + + qreal UiMessageBox::getDouble(const QString &title, const QString &description, qreal value, qreal min, qreal max, qreal step, quint16 decimals, const QString &suffix, bool *ok) { setUpdatesEnabled(false); ui->choices->setCurrentIndex(0); @@ -40,9 +45,11 @@ qreal UiMessageBox::getDouble(const QString &title, const QString &description, delete this; return ret; } -qreal UiMessageBox::getDouble(const QString &title, const QString &description, const QPixmap &pixmap, qreal value, qreal min, qreal max, qreal step, quint16 decimals, const QString &suffix, bool *ok) { +qreal UiMessageBox::getDouble(const QString &title, const QString &description, const QPixmap &pixmap, qreal value, qreal min, qreal max, qreal step, quint16 decimals, const QString &suffix, bool resample, bool *ok) { setUpdatesEnabled(false); ui->choices->setCurrentIndex(1); + ui->checkSmooth->setVisible(resample); + ui->checkTrigger->setVisible(resample); ui->spinpLabel->setText(description); setWindowTitle(title); ui->spinpSpin->setMinimum(min); @@ -67,7 +74,8 @@ qreal UiMessageBox::getDouble(const QString &title, const QString &description, else *ok = false; } qreal ret = ui->spinpSpin->value(); - delete this; + if(!resample) + delete this; return ret; } int UiMessageBox::display(const QString &title, const QString &description, QDialogButtonBox::StandardButtons buttons, bool *ok) { diff --git a/gui/uimessagebox.h b/gui/uimessagebox.h index 51a277d..df5db08 100644 --- a/gui/uimessagebox.h +++ b/gui/uimessagebox.h @@ -17,9 +17,12 @@ class UiMessageBox : public QDialog { explicit UiMessageBox(QWidget *parent = 0); ~UiMessageBox(); +public: + QPair getCheckboxes(); + public: qreal getDouble(const QString &title, const QString &description, qreal value, qreal min, qreal max, qreal step, quint16 decimals, const QString &suffix, bool *ok = 0); - qreal getDouble(const QString &title, const QString &description, const QPixmap &pixmap, qreal value, qreal min, qreal max, qreal step, quint16 decimals, const QString &suffix, bool *ok = 0); + qreal getDouble(const QString &title, const QString &description, const QPixmap &pixmap, qreal value, qreal min, qreal max, qreal step, quint16 decimals, const QString &suffix, bool resample, bool *ok = 0); QString getText(const QString &title, const QString &description, const QString &value, bool *ok = 0); int display(const QString &title, const QString &description1, const QString &description2, const QString &description3, const QPixmap &pixmap, QDialogButtonBox::StandardButtons buttons, bool *ok = 0); int display(const QString &title, const QString &description, QDialogButtonBox::StandardButtons buttons, bool *ok = 0); diff --git a/gui/uimessagebox.ui b/gui/uimessagebox.ui index d131d31..c92f5c3 100644 --- a/gui/uimessagebox.ui +++ b/gui/uimessagebox.ui @@ -6,7 +6,7 @@ 0 0 - 297 + 339 203 @@ -203,6 +203,23 @@ + + + + Make a smooth curve + + + true + + + + + + + Generate triggers instead of resampling curve + + + diff --git a/gui/uiview.cpp b/gui/uiview.cpp index a437e72..135679d 100644 --- a/gui/uiview.cpp +++ b/gui/uiview.cpp @@ -320,7 +320,7 @@ void UiView::actionImportText() { void UiView::actionSnapshot() { bool ok = false; - qreal scaleFactor = (new UiMessageBox())->getDouble(tr("Score Snapshot"), tr("Snapshot will be saved on your desktop.\nPlease enter a scale factor:"), QPixmap(":/infos/res_info_export.png"), 4, 0.1, 30, 0.25, 2, "times current screen size", &ok); + qreal scaleFactor = (new UiMessageBox())->getDouble(tr("Score Snapshot"), tr("Snapshot will be saved on your desktop.\nPlease enter a scale factor:"), QPixmap(":/infos/res_info_export.png"), 4, 0.1, 30, 0.25, 2, "times current screen size", false, &ok); if(ok) ui->render->capture(scaleFactor); } diff --git a/iannixapp.cpp b/iannixapp.cpp index 67ecd9e..432456e 100644 --- a/iannixapp.cpp +++ b/iannixapp.cpp @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) { //iannixApp.installTranslator(&translator); QString appName = "IanniX "; - QString appVersion = "0.9.13"; + QString appVersion = "0.9.14"; #ifdef Q_OS_MAC appName += "Mac"; diff --git a/icon.rc b/icon.rc index db24fec..5d96b61 100644 --- a/icon.rc +++ b/icon.rc @@ -1,10 +1,10 @@ IDI_ICON1 ICON DISCARDABLE "icon.ico" #include -#define VER_FILEVERSION 0,9,13,0 -#define VER_FILEVERSION_STR "0.9,13\0" -#define VER_PRODUCTVERSION 0,9,13,0 -#define VER_PRODUCTVERSION_STR "0.9,13\0" +#define VER_FILEVERSION 0,9,14,0 +#define VER_FILEVERSION_STR "0.9,14\0" +#define VER_PRODUCTVERSION 0,9,14,0 +#define VER_PRODUCTVERSION_STR "0.9,14\0" #define VER_COMPANYNAME_STR "IanniX Association" #define VER_FILEDESCRIPTION_STR "IanniX" #define VER_INTERNALNAME_STR "IanniX" diff --git a/objects/nxcurve.cpp b/objects/nxcurve.cpp index ce99533..b037182 100644 --- a/objects/nxcurve.cpp +++ b/objects/nxcurve.cpp @@ -964,25 +964,45 @@ qreal NxCurve::intersects(const NxRect &rect, NxPoint* collisionPoint) { return -1; } -void NxCurve::resample(quint16 nbPoints, bool smooth) { +void NxCurve::setShowPathPointsResample(bool) { + bool ok = false; + UiMessageBox *messageBox = new UiMessageBox(); + quint16 nbPoints = messageBox->getDouble(tr("IanniX Curve Resample"), tr("Number of points:"), QPixmap(":/infos/res_info_curve.png"), 50, 0, 32767, 1, 0, "", true, &ok); + QPair checkboxes = messageBox->getCheckboxes(); + delete messageBox; + if(ok) + resample(nbPoints, checkboxes.first, checkboxes.second); +} + + +void NxCurve::resample(quint16 nbPoints, bool smooth, bool triggers) { qreal percentStep = 1.0 / (qreal)nbPoints; QList pts; for(qreal percent = 0 ; percent <= 1 ; percent += percentStep) pts.append(getPointAt(percent)); - pathPoints.clear(); - foreach(const NxPoint &pt, pts) { - NxCurvePoint cPt; - cPt.setX(pt.x()); - cPt.setY(pt.y()); - cPt.setZ(pt.z()); - cPt.smooth = smooth; - pathPoints.append(cPt); + if(triggers) { + foreach(NxPoint pt, pts) { + pt += pos; + Application::current->execute("add trigger auto", ExecuteSourceGui); + Application::current->execute(QString("%1 current %2 %3 %4").arg(COMMAND_POS).arg(pt.x()).arg(pt.y()).arg(pt.z()), ExecuteSourceGui); + } + } + else { + pathPoints.clear(); + foreach(const NxPoint &pt, pts) { + NxCurvePoint cPt; + cPt.setX(pt.x()); + cPt.setY(pt.y()); + cPt.setZ(pt.z()); + cPt.smooth = smooth; + pathPoints.append(cPt); + } + if(pathPoints.count()) + setPointAt(0, getPathPointsAt(0), getPathPointsAt(0).c1, getPathPointsAt(0).c2, getPathPointsAt(0).smooth); + curveType = CurveTypePoints; + calcBoundingRect(); + glListRecreate = true; } - if(pathPoints.count()) - setPointAt(0, getPathPointsAt(0), getPathPointsAt(0).c1, getPathPointsAt(0).c2, getPathPointsAt(0).smooth); - curveType = CurveTypePoints; - calcBoundingRect(); - glListRecreate = true; } void NxCurve::isOnPathPoint() { diff --git a/objects/nxcurve.h b/objects/nxcurve.h index 1cfaed8..e83cc8f 100644 --- a/objects/nxcurve.h +++ b/objects/nxcurve.h @@ -247,7 +247,7 @@ class NxCurve : public NxObject { inline quint16 getPathPointsCount() const { return pathPoints.count(); } - void resample(quint16 nbPoints, bool smooth); + void resample(quint16 nbPoints, bool smooth = true, bool triggers = false); void isOnPathPoint(); void isOnPathPoint(const NxRect & point); @@ -272,13 +272,7 @@ class NxCurve : public NxObject { if(show) pathPointsEditor->show(); else pathPointsEditor->hide(); } - inline void setShowPathPointsResample(bool = true) { - bool ok = false; - quint16 nbPoints = (new UiMessageBox())->getDouble(tr("IanniX Curve Resample"), tr("Number of points:"), QPixmap(":/infos/res_info_curve.png"), 50, 0, 32767, 1, 0, "", &ok); - bool smooth = (new UiMessageBox())->display(tr("IanniX Curve Resample"), tr("Do you want to smooth the curve?"), QDialogButtonBox::Yes | QDialogButtonBox::No); - if(ok) - resample(nbPoints, smooth); - } + void setShowPathPointsResample(bool = true); inline bool getShowPathPointsEditor() const { return true; } inline bool getShowPathPointsResample() const { return true; } inline void setPathPoints(const UiPathPointsItems &_pathPoints) { diff --git a/objects/nxdocument.cpp b/objects/nxdocument.cpp index 6548835..9bbdeb0 100644 --- a/objects/nxdocument.cpp +++ b/objects/nxdocument.cpp @@ -100,6 +100,7 @@ void NxDocument::popSnapshot(bool revert) { if(canDo) { clear(); NxObjectDispatchProperty::source = ExecuteSourceGui; + source = NxObjectDispatchProperty::source; Application::current->executeAsScript(snapshots.at(snapshotsIndex)); } } @@ -111,6 +112,7 @@ void NxDocument::open() { open(true); NxObjectDispatchProperty::source = ExecuteSourceGui; + source = NxObjectDispatchProperty::source; initialContent = Application::current->serialize(); } } diff --git a/objects/nxobject.cpp b/objects/nxobject.cpp index c8de570..8b22572 100644 --- a/objects/nxobject.cpp +++ b/objects/nxobject.cpp @@ -201,7 +201,7 @@ QVector< QVector > NxObject::parseMessagesPattern(const QString & me } void NxObject::dispatchProperty(const char *_property, const QVariant & value) { - QStringList asCurvePoints = QStringList() << COMMAND_CURVE_POINT_RMV << COMMAND_CURVE_TXT << COMMAND_CURVE_LINES << COMMAND_CURVE_POINT << COMMAND_CURVE_POINT_TRANSLATE << COMMAND_CURVE_POINT_SHIFT << COMMAND_CURVE_EDITOR << COMMAND_CURVE_PATH << COMMAND_CURVE_POINT_SMOOTH << COMMAND_CURVE_POINT_X << COMMAND_CURVE_POINT_Y << COMMAND_CURVE_POINT_Z << COMMAND_CURVE_POINT_TRANSLATE2; + QStringList asCurvePoints = QStringList() << COMMAND_CURVE_POINT_RMV << COMMAND_CURVE_TXT << COMMAND_CURVE_LINES << COMMAND_CURVE_POINT << COMMAND_CURVE_POINT_TRANSLATE << COMMAND_CURVE_POINT_SHIFT << COMMAND_CURVE_EDITOR << COMMAND_CURVE_RESAMPLE << COMMAND_CURVE_PATH << COMMAND_CURVE_POINT_SMOOTH << COMMAND_CURVE_POINT_X << COMMAND_CURVE_POINT_Y << COMMAND_CURVE_POINT_Z << COMMAND_CURVE_POINT_TRANSLATE2; QStringList forbiddenActions = QStringList() << COMMAND_POS_TRANSLATE; if(asCurvePoints.contains(QString(_property))) propertyChanged(COMMAND_CURVE_POINT); else if(!forbiddenActions.contains(QString(_property))) propertyChanged(_property);