Skip to content

Commit

Permalink
IanniX 0.9.14 alpha 2
Browse files Browse the repository at this point in the history
- add trigger automatically on a curve (on a curve, select "RESAMPLE"
in inspector)
- websockets for remote control
- bug with saving and undo/redo fixed
  • Loading branch information
gjacquemin committed Aug 21, 2013
1 parent 08dea76 commit d7a7ed7
Show file tree
Hide file tree
Showing 17 changed files with 98 additions and 54 deletions.
2 changes: 1 addition & 1 deletion IanniX.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 2.7.1, 2013-08-20T16:18:50. -->
<!-- Written by QtCreator 2.7.1, 2013-08-21T14:45:02. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
Expand Down
2 changes: 1 addition & 1 deletion Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
<key>CFBundleSignature</key>
<string>INNX</string>
<key>CFBundleVersion</key>
<string>0.9.13</string>
<string>0.9.14</string>
</dict>
</plist>
Binary file modified Patches/Ableton Live/IanniX.als
Binary file not shown.
2 changes: 2 additions & 0 deletions Tools/Templates/_IanniX.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 12 additions & 14 deletions gui/uiinspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
}
Expand All @@ -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<QStandardItemModel*>(ui->equationTemplate->model())->item(ui->equationTemplate->count()-1)->setEnabled(false);
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion gui/uiinspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions gui/uiinspector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ POINTS</string>
</widget>
</item>
<item>
<widget class="QPushButton" name="pointsLists">
<widget class="QPushButton" name="pointsResample">
<property name="minimumSize">
<size>
<width>103</width>
Expand All @@ -1726,12 +1726,12 @@ POINTS</string>
<string>Click here to manually edit curve points</string>
</property>
<property name="text">
<string>EDIT POINTS</string>
<string>RESAMPLE</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pointsResample">
<widget class="QPushButton" name="pointsLists">
<property name="minimumSize">
<size>
<width>103</width>
Expand All @@ -1742,7 +1742,7 @@ POINTS</string>
<string>Click here to manually edit curve points</string>
</property>
<property name="text">
<string>RESAMPLE</string>
<string>EDIT POINTS</string>
</property>
</widget>
</item>
Expand Down
12 changes: 10 additions & 2 deletions gui/uimessagebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ UiMessageBox::~UiMessageBox() {
delete ui;
}

QPair<bool, bool> 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);
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion gui/uimessagebox.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ class UiMessageBox : public QDialog {
explicit UiMessageBox(QWidget *parent = 0);
~UiMessageBox();

public:
QPair<bool, bool> 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);
Expand Down
19 changes: 18 additions & 1 deletion gui/uimessagebox.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>297</width>
<width>339</width>
<height>203</height>
</rect>
</property>
Expand Down Expand Up @@ -203,6 +203,23 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkSmooth">
<property name="text">
<string>Make a smooth curve</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkTrigger">
<property name="text">
<string>Generate triggers instead of resampling curve</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
Expand Down
2 changes: 1 addition & 1 deletion gui/uiview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion iannixapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions icon.rc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
IDI_ICON1 ICON DISCARDABLE "icon.ico"

#include <windows.h>
#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"
Expand Down
48 changes: 34 additions & 14 deletions objects/nxcurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool, bool> 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<NxPoint> 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() {
Expand Down
10 changes: 2 additions & 8 deletions objects/nxcurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions objects/nxdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void NxDocument::popSnapshot(bool revert) {
if(canDo) {
clear();
NxObjectDispatchProperty::source = ExecuteSourceGui;
source = NxObjectDispatchProperty::source;
Application::current->executeAsScript(snapshots.at(snapshotsIndex));
}
}
Expand All @@ -111,6 +112,7 @@ void NxDocument::open() {
open(true);

NxObjectDispatchProperty::source = ExecuteSourceGui;
source = NxObjectDispatchProperty::source;
initialContent = Application::current->serialize();
}
}
Expand Down
2 changes: 1 addition & 1 deletion objects/nxobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ QVector< QVector<QByteArray> > 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);
Expand Down

0 comments on commit d7a7ed7

Please sign in to comment.