Skip to content

Commit

Permalink
Merge branch 'release/0.9.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Nov 28, 2016
2 parents a6a2c52 + ef92160 commit 020910c
Show file tree
Hide file tree
Showing 41 changed files with 694 additions and 349 deletions.
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
*.pyc
.tags
.qmake.stash
*DS_Store
*.pro.user

build-*
build

*.pro.user
*.pyc
*.sublime-workspace
*DS_Store
.cproject
.project
.qmake.stash
.tags
.ycm_extra_conf.py
/debian
/obj-*-linux-gnu
build
build-*
33 changes: 33 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,39 @@ To put Antimony on your path, call `sudo ninja install`. This does two things:
- The `antimony` executable is copied to `/usr/local/bin`
- Antimony's Python libraries are copied to `/usr/local/share/antimony`

Debian packaging
----------------

Packaging for the Debian or flavors based on it can be done using the content of `deploy/linux/debian` directory.

In the project's root directory create a symbolic link:

```
ln -s deploy/linux/debian debian
```

Build the package:

```
dpkg-buildpackage -us -uc
```

At the end of this you'll find the packages in the directory containing the project's root directory. For example:

```
antimony_0.9.2_amd64.changes
antimony_0.9.2_amd64.deb
antimony_0.9.2.dsc
antimony_0.9.2.tar.xz
antimony-dbg_0.9.2_amd64.deb
```

To install the package, as root or using sudo:

```
dpkg --install antimony_0.9.2_amd64.deb
```

## Debugging
### `cannot find -lGL`
If running `make` gives the `/usr/bin/ld: cannot find -lGL`, create a symlink to the `libGL` file:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.1)
project(Antimony)
set(CMAKE_BUILD_TYPE RELEASE)

Expand Down
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,5 @@ target_include_directories(${ANTIMONY_APP} SYSTEM PRIVATE
################################################################################

set_property(TARGET ${ANTIMONY_APP} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${ANTIMONY_APP} PROPERTY C_STANDARD 99)

6 changes: 4 additions & 2 deletions app/canvas/datum_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,18 @@ void DatumEditor::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
if (target->getType() == &PyFloat_Type)
{
const double s = (event->modifiers() & Qt::AltModifier) ? 0.03 : 0.01;
const double scale = fmax(
0.01, fabs(PyFloat_AsDouble(target->currentValue()) * 0.01));
s, fabs(PyFloat_AsDouble(target->currentValue()) * s));
const double dx = (event->screenPos() - event->lastScreenPos()).x();
dragFloat(scale * dx);
return;
}
else if (target->getType() == &PyLong_Type)
{
const double s = (event->modifiers() & Qt::AltModifier) ? 10 : 30;
drag_accumulated += (event->screenPos() -
event->lastScreenPos()).x() / 30.;
event->lastScreenPos()).x() / s;
int q = drag_accumulated;
drag_accumulated -= q;
dragInt(q);
Expand Down
5 changes: 5 additions & 0 deletions app/canvas/datum_row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ DatumRow::DatumRow(Datum* d, InspectorFrame* parent)
connect(this, &DatumRow::layoutChanged,
parent, &InspectorFrame::redoLayout);
editor = new DatumEditor(d, this);

connect(editor, &DatumEditor::tabPressed,
parent, &InspectorFrame::focusNext);
connect(editor, &DatumEditor::shiftTabPressed,
parent, &InspectorFrame::focusPrev);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions app/canvas/datum_row.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ class DatumRow : public QGraphicsObject
DatumEditor* editor;

int index;

friend class InspectorFrame;
};
59 changes: 59 additions & 0 deletions app/canvas/inspector/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "canvas/inspector/frame.h"
#include "canvas/datum_row.h"
#include "canvas/datum_editor.h"
#include "canvas/inspector/title.h"
#include "canvas/inspector/export.h"
#include "canvas/scene.h"
Expand Down Expand Up @@ -45,6 +46,26 @@ QRectF InspectorFrame::tightBoundingRect() const
return b;
}

QList<DatumRow*> InspectorFrame::visibleRows() const
{
QList<DatumRow*> rows;
for (auto c : childItems())
if (auto row = dynamic_cast<DatumRow*>(c))
{
if (show_hidden || !row->shouldBeHidden())
{
rows.append(row);
}
}

// Sort datums by row order
qSort(rows.begin(), rows.end(),
[](const DatumRow* a, const DatumRow* b)
{ return a->getIndex() < b->getIndex(); });

return rows;
}

QRectF InspectorFrame::boundingRect() const
{
auto r = tightBoundingRect();
Expand Down Expand Up @@ -189,6 +210,44 @@ void InspectorFrame::setFocus(bool focus)
}
}

void InspectorFrame::focusNext(DatumEditor* prev)
{
bool next = false;

for (auto row : visibleRows())
{
if (prev == row->editor)
{
next = true;
}
else if (next && row->editor->isEnabled())
{
prev->clearFocus();
row->editor->setFocus();
return;
}
}
}

void InspectorFrame::focusPrev(DatumEditor* next)
{
DatumRow* prev = NULL;

for (auto row : visibleRows())
{
if (next == row->editor)
{
if (prev)
{
prev->editor->setFocus();
next->clearFocus();
}
return;
}
prev = row;
}
}

////////////////////////////////////////////////////////////////////////////////

void InspectorFrame::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
Expand Down
13 changes: 13 additions & 0 deletions app/canvas/inspector/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class Node;
class InspectorTitle;
class InspectorExportButton;
class ExportWorker;
class DatumEditor;
class DatumRow;

class InspectorFrame : public QGraphicsObject
{
Expand Down Expand Up @@ -87,6 +89,12 @@ public slots:
*/
void setFocus(bool focus);

/*
* Skips to the next or previous datum editor
*/
void focusNext(DatumEditor* d);
void focusPrev(DatumEditor* d);

protected:
/*
* On mouse move, fake the left button being held down.
Expand All @@ -110,6 +118,11 @@ public slots:
*/
QRectF tightBoundingRect() const;

/*
* Returns an ordered list of visible DatumRows
*/
QList<DatumRow*> visibleRows() const;

static const float PADDING_ROWS;

Node* const node;
Expand Down
1 change: 0 additions & 1 deletion app/graph/proxy/datum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ DatumProxy::DatumProxy(Datum* d, NodeProxy* parent)
row(new DatumRow(d, parent->getInspector()))
{
d->installWatcher(this);
static_cast<GraphProxy*>(parent->parent())->viewportScene()->installDatum(this);
connect(this, &QObject::destroyed, row, &QObject::deleteLater);
connect(this, &QObject::destroyed,
parent->getInspector(), &InspectorFrame::redoLayout,
Expand Down
5 changes: 5 additions & 0 deletions app/viewport/control/control_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ ControlInstance::ControlInstance(Control* c, ViewportView* v)

connect(v, &ViewportView::changed, this, &ControlInstance::onViewChanged);
v->scene()->addItem(this);

if (v->isUIhidden())
{
hide();
}
}

QMatrix4x4 ControlInstance::getMatrix() const
Expand Down
9 changes: 6 additions & 3 deletions app/viewport/render/instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

RenderInstance::RenderInstance(
BaseDatumProxy* parent, ViewportView* view, bool sub)
: QObject(), sub(sub), M(view->getMatrix()), image(this, view)
: QObject(), sub(sub), M(view->getMatrix()),
clip(view->geometry().width(), view->geometry().height()),
image(this, view)
{
connect(parent, &QObject::destroyed, this, &RenderInstance::makeOrphan);
connect(view, &ViewportView::changed,
Expand Down Expand Up @@ -51,9 +53,10 @@ void RenderInstance::datumChanged(Datum* d)
setPending();
}

void RenderInstance::viewChanged(QMatrix4x4 m)
void RenderInstance::viewChanged(QMatrix4x4 m, QRect clip_)
{
M = m;
clip = {float(clip_.width()), float(clip_.height())};
setPending();
}

Expand Down Expand Up @@ -138,7 +141,7 @@ void RenderInstance::startNextRender()
assert(orphan == false);

Q_ASSERT(starting_refinement >= 1);
current.reset(new RenderTask(this, shape, M, starting_refinement));
current.reset(new RenderTask(this, shape, M, clip, starting_refinement));

pending = false;
}
5 changes: 4 additions & 1 deletion app/viewport/render/instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public slots:
/*
* Sets M to the current viewport transform matrix
*/
void viewChanged(QMatrix4x4 m);
void viewChanged(QMatrix4x4 m, QRect clip);

/*
* When a render task finishes, load in its image and start the next
Expand Down Expand Up @@ -69,6 +69,9 @@ public slots:
/* Current transform matrix */
QMatrix4x4 M;

/* Window size (used for clipping) */
QVector2D clip;

/* Set to true if we should render again after the task finishes */
bool pending=false;

Expand Down
Loading

0 comments on commit 020910c

Please sign in to comment.