Fix turnaround resize
|
@ -1,3 +1,13 @@
|
|||
convert thirdparty/capicon/png/white/059.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/add.png
|
||||
convert thirdparty/capicon/png/white/262.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/select.png
|
||||
convert thirdparty/capicon/png/white/078.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/picture.png
|
||||
convert thirdparty/capicon/png/white/078.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/picture.png
|
||||
convert thirdparty/capicon/png/white/226.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/save.png
|
||||
convert thirdparty/capicon/png/white/341.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/info.png
|
||||
convert thirdparty/capicon/png/white/279.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/up.png
|
||||
convert thirdparty/capicon/png/white/278.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/down.png
|
||||
convert thirdparty/capicon/png/white/274.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/clip.png
|
||||
convert thirdparty/capicon/png/white/254.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/rangeselect.png
|
||||
convert thirdparty/capicon/png/white/057.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/delete.png
|
||||
convert thirdparty/capicon/png/white/047.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/new.png
|
||||
convert thirdparty/capicon/png/white/039.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/palette.png
|
||||
convert thirdparty/capicon/png/white/030.png -fuzz 90% -fill 'rgb(252,102,33)' -opaque 'rgb(255,255,255)' resources/trashbin.png
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>resources/add.png</file>
|
||||
<file>resources/select.png</file>
|
||||
<file>resources/picture.png</file>
|
||||
<file>resources/add.png</file>
|
||||
<file>resources/select.png</file>
|
||||
<file>resources/picture.png</file>
|
||||
<file>resources/save.png</file>
|
||||
<file>resources/info.png</file>
|
||||
<file>resources/up.png</file>
|
||||
<file>resources/down.png</file>
|
||||
<file>resources/clip.png</file>
|
||||
<file>resources/rangeselect.png</file>
|
||||
<file>resources/delete.png</file>
|
||||
<file>resources/new.png</file>
|
||||
<file>resources/palette.png</file>
|
||||
<file>resources/trashbin.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
|
@ -26,7 +26,7 @@ int main(int argc, char ** argv)
|
|||
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
qApp->setPalette(darkPalette);
|
||||
qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
|
||||
qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #fc6621; border: 1px solid white; }");
|
||||
|
||||
QCoreApplication::setApplicationName("Dust 3D");
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <QToolBar>
|
||||
#include <QThread>
|
||||
#include <QFileDialog>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <assert.h>
|
||||
#include "mainwindow.h"
|
||||
#include "skeletoneditwidget.h"
|
||||
|
@ -53,28 +55,42 @@ MainWindow::MainWindow() :
|
|||
m_modelingWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
m_modelingWidget->setWindowFlags(Qt::Tool | Qt::Window);
|
||||
m_modelingWidget->setWindowTitle("3D Model");
|
||||
|
||||
QPushButton *changeTurnaroundButton = new QPushButton("");
|
||||
changeTurnaroundButton->setIcon(QIcon(":/resources/picture.png"));
|
||||
|
||||
|
||||
QVBoxLayout *rightLayout = new QVBoxLayout;
|
||||
rightLayout->addSpacing(10);
|
||||
rightLayout->addWidget(changeTurnaroundButton);
|
||||
|
||||
//QPushButton *changeTurnaroundButton = new QPushButton("");
|
||||
//changeTurnaroundButton->setIcon(QIcon(":/resources/picture.png"));
|
||||
//changeTurnaroundButton->setToolTip(tr("Change turnaround reference image"));
|
||||
//rightLayout->addWidget(changeTurnaroundButton);
|
||||
|
||||
rightLayout->addStretch();
|
||||
|
||||
QToolBar *toolbar = new QToolBar;
|
||||
toolbar->setIconSize(QSize(16, 16));
|
||||
toolbar->setOrientation(Qt::Vertical);
|
||||
|
||||
QAction *addAction = new QAction(tr("Add"), this);
|
||||
addAction->setIcon(QIcon(":/resources/add.png"));
|
||||
toolbar->addAction(addAction);
|
||||
|
||||
QAction *selectAction = new QAction(tr("Select"), this);
|
||||
selectAction->setIcon(QIcon(":/resources/select.png"));
|
||||
toolbar->addAction(addAction);
|
||||
toolbar->addAction(selectAction);
|
||||
|
||||
QAction *rangeSelectAction = new QAction(tr("Range Select"), this);
|
||||
rangeSelectAction->setIcon(QIcon(":/resources/rangeselect.png"));
|
||||
toolbar->addAction(rangeSelectAction);
|
||||
|
||||
//m_clipTableWidget = new QTableWidget;
|
||||
//m_clipTableWidget->setFixedWidth(32);
|
||||
//m_clipTableWidget->verticalHeader()->setVisible(false);
|
||||
|
||||
QVBoxLayout *leftLayout = new QVBoxLayout;
|
||||
leftLayout->addWidget(toolbar);
|
||||
leftLayout->addStretch();
|
||||
//leftLayout->addWidget(m_clipTableWidget);
|
||||
leftLayout->addSpacing(10);
|
||||
|
||||
QHBoxLayout *middleLayout = new QHBoxLayout;
|
||||
middleLayout->addLayout(leftLayout);
|
||||
|
@ -106,22 +122,28 @@ MainWindow::MainWindow() :
|
|||
connectResult = connect(m_skeletonEditWidget, SIGNAL(sizeChanged()), this, SLOT(turnaroundChanged()));
|
||||
assert(connectResult);
|
||||
|
||||
connectResult = connect(changeTurnaroundButton, SIGNAL(released()), this, SLOT(changeTurnaround()));
|
||||
connectResult = connect(m_skeletonEditWidget->graphicsView(), SIGNAL(changeTurnaroundTriggered()), this, SLOT(changeTurnaround()));
|
||||
assert(connectResult);
|
||||
|
||||
//connectResult = connect(clipButton, SIGNAL(clicked()), this, SLOT(saveClip()));
|
||||
//assert(connectResult);
|
||||
}
|
||||
|
||||
void MainWindow::showModelingWidgetAtCorner()
|
||||
{
|
||||
if (!m_modelingWidget->isVisible()) {
|
||||
QPoint pos = QPoint(QApplication::desktop()->width(),
|
||||
QApplication::desktop()->height());
|
||||
m_modelingWidget->move(pos.x() - m_modelingWidget->width(),
|
||||
pos.y() - m_modelingWidget->height());
|
||||
m_modelingWidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::meshReady()
|
||||
{
|
||||
Mesh *resultMesh = m_skeletonToMesh->takeResultMesh();
|
||||
if (resultMesh) {
|
||||
if (!m_modelingWidget->isVisible()) {
|
||||
QRect referenceRect = m_skeletonEditWidget->geometry();
|
||||
QPoint pos = QPoint(referenceRect.right() - m_modelingWidget->width(),
|
||||
referenceRect.bottom() - m_modelingWidget->height());
|
||||
m_modelingWidget->move(pos.x(), pos.y());
|
||||
m_modelingWidget->show();
|
||||
}
|
||||
}
|
||||
showModelingWidgetAtCorner();
|
||||
m_modelingWidget->updateMesh(resultMesh);
|
||||
delete m_skeletonToMesh;
|
||||
m_skeletonToMesh = NULL;
|
||||
|
@ -196,3 +218,14 @@ void MainWindow::changeTurnaround()
|
|||
m_turnaroundFilename = fileName;
|
||||
turnaroundChanged();
|
||||
}
|
||||
|
||||
void MainWindow::saveClip()
|
||||
{
|
||||
QImage image = m_modelingWidget->grabFramebuffer();
|
||||
//QTableWidgetItem *item = new QTableWidgetItem;
|
||||
//item->setSizeHint(QSize(32, 32));
|
||||
//item->setIcon(QPixmap::fromImage(image.scaled(32, 32)));
|
||||
//m_clipTableWidget->insertRow(m_clipTableWidget->rowCount());
|
||||
//m_clipTableWidget->setItem(m_clipTableWidget->rowCount() - 1, 0, item);
|
||||
//image.save("/Users/jeremy/Repositories/dust3d/gl.png");
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define MAIN_WINDOW_H
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include "modelingwidget.h"
|
||||
#include "skeletoneditwidget.h"
|
||||
#include "skeletontomesh.h"
|
||||
|
@ -18,6 +20,8 @@ public slots:
|
|||
void turnaroundChanged();
|
||||
void turnaroundImageReady();
|
||||
void changeTurnaround();
|
||||
void saveClip();
|
||||
void showModelingWidgetAtCorner();
|
||||
private:
|
||||
ModelingWidget *m_modelingWidget;
|
||||
SkeletonEditWidget *m_skeletonEditWidget;
|
||||
|
|
|
@ -35,6 +35,8 @@ SkeletonEditGraphicsView::SkeletonEditGraphicsView(QWidget *parent) :
|
|||
|
||||
void SkeletonEditGraphicsView::toggleAddNodeMode()
|
||||
{
|
||||
if (!m_backgroundLoaded)
|
||||
return;
|
||||
m_inAddNodeMode = !m_inAddNodeMode;
|
||||
applyAddNodeMode();
|
||||
}
|
||||
|
@ -48,12 +50,16 @@ void SkeletonEditGraphicsView::applyAddNodeMode()
|
|||
|
||||
void SkeletonEditGraphicsView::turnOffAddNodeMode()
|
||||
{
|
||||
if (!m_backgroundLoaded)
|
||||
return;
|
||||
m_inAddNodeMode = false;
|
||||
applyAddNodeMode();
|
||||
}
|
||||
|
||||
void SkeletonEditGraphicsView::turnOnAddNodeMode()
|
||||
{
|
||||
if (!m_backgroundLoaded)
|
||||
return;
|
||||
m_inAddNodeMode = true;
|
||||
applyAddNodeMode();
|
||||
}
|
||||
|
@ -89,6 +95,12 @@ void SkeletonEditGraphicsView::mousePressEvent(QMouseEvent *event)
|
|||
m_lastMousePos = mapToScene(event->pos());
|
||||
}
|
||||
|
||||
void SkeletonEditGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
emit changeTurnaroundTriggered();
|
||||
}
|
||||
|
||||
float SkeletonEditGraphicsView::findXForSlave(float x)
|
||||
{
|
||||
return x - m_backgroundItem->boundingRect().width() / 4;
|
||||
|
@ -286,11 +298,38 @@ void SkeletonEditGraphicsView::setNextStartNodeItem(SkeletonEditNodeItem *item)
|
|||
|
||||
void SkeletonEditGraphicsView::updateBackgroundImage(const QImage &image)
|
||||
{
|
||||
QSizeF oldSceneSize = scene()->sceneRect().size();
|
||||
QPixmap pixmap = QPixmap::fromImage(image);
|
||||
m_backgroundItem->setPixmap(pixmap);
|
||||
scene()->setSceneRect(pixmap.rect());
|
||||
adjustItems(oldSceneSize, scene()->sceneRect().size());
|
||||
if (!m_backgroundLoaded) {
|
||||
m_backgroundLoaded = true;
|
||||
applyAddNodeMode();
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletonEditGraphicsView::adjustItems(QSizeF oldSceneSize, QSizeF newSceneSize)
|
||||
{
|
||||
if (oldSceneSize == newSceneSize)
|
||||
return;
|
||||
float radiusMul = (float)newSceneSize.height() / oldSceneSize.height();
|
||||
float xMul = (float)newSceneSize.width() / oldSceneSize.width();
|
||||
float yMul = radiusMul;
|
||||
QList<QGraphicsItem *>::iterator it;
|
||||
QList<QGraphicsItem *> list = scene()->items();
|
||||
for (it = list.begin(); it != list.end(); ++it) {
|
||||
if ((*it)->data(0).toString() == "node") {
|
||||
SkeletonEditNodeItem *nodeItem = static_cast<SkeletonEditNodeItem *>(*it);
|
||||
nodeItem->setRadius(nodeItem->radius() * radiusMul);
|
||||
QPointF oldOrigin = nodeItem->origin();
|
||||
nodeItem->setOrigin(QPointF(oldOrigin.x() * xMul, oldOrigin.y() * yMul));
|
||||
}
|
||||
}
|
||||
for (it = list.begin(); it != list.end(); ++it) {
|
||||
if ((*it)->data(0).toString() == "edge") {
|
||||
SkeletonEditEdgeItem *edgeItem = static_cast<SkeletonEditEdgeItem *>(*it);
|
||||
edgeItem->updatePosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ class SkeletonEditGraphicsView : public QGraphicsView
|
|||
Q_OBJECT
|
||||
signals:
|
||||
void nodesChanged();
|
||||
void changeTurnaroundTriggered();
|
||||
public slots:
|
||||
void turnOffAddNodeMode();
|
||||
void turnOnAddNodeMode();
|
||||
|
@ -21,6 +22,7 @@ protected:
|
|||
void wheelEvent(QWheelEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
private:
|
||||
QGraphicsPixmapItem *m_backgroundItem;
|
||||
QGraphicsEllipseItem *m_pendingNodeItem;
|
||||
|
@ -33,6 +35,7 @@ private:
|
|||
QPointF m_lastMousePos;
|
||||
bool m_isMovingNodeItem;
|
||||
bool m_backgroundLoaded;
|
||||
private:
|
||||
void toggleAddNodeMode();
|
||||
void applyAddNodeMode();
|
||||
SkeletonEditNodeItem *findNodeItemByPos(QPointF pos);
|
||||
|
@ -41,6 +44,7 @@ private:
|
|||
bool canNodeItemMoveTo(SkeletonEditNodeItem *item, QPointF moveTo);
|
||||
void AddItemRadius(QGraphicsEllipseItem *item, float delta);
|
||||
bool canAddItemRadius(QGraphicsEllipseItem *item, float delta);
|
||||
void adjustItems(QSizeF oldSceneSize, QSizeF newSceneSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,6 +61,21 @@ float SkeletonEditNodeItem::radius()
|
|||
return rect().width() / 2;
|
||||
}
|
||||
|
||||
void SkeletonEditNodeItem::setRadius(float radius)
|
||||
{
|
||||
QPointF oldOrigin = origin();
|
||||
setRect(oldOrigin.x() - radius, oldOrigin.y() - radius,
|
||||
radius * 2, radius * 2);
|
||||
}
|
||||
|
||||
void SkeletonEditNodeItem::setOrigin(QPointF point)
|
||||
{
|
||||
QPointF moveBy = point - origin();
|
||||
QRectF newRect = rect();
|
||||
newRect.adjust(moveBy.x(), moveBy.y(), moveBy.x(), moveBy.y());
|
||||
setRect(newRect);
|
||||
}
|
||||
|
||||
void SkeletonEditNodeItem::setHighlighted(bool highlighted)
|
||||
{
|
||||
m_highlighted = highlighted;
|
||||
|
|
|
@ -19,6 +19,8 @@ public:
|
|||
SkeletonEditNodeItem *master();
|
||||
SkeletonEditNodeItem *slave();
|
||||
SkeletonEditNodeItem *pair();
|
||||
void setRadius(float radius);
|
||||
void setOrigin(QPointF point);
|
||||
private:
|
||||
bool m_highlighted;
|
||||
bool m_isNextStartNode;
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
QColor Theme::skeletonMasterNodeBorderColor = QColor(0xfc, 0x66, 0x21, 128);
|
||||
QColor Theme::skeletonMasterNodeBorderHighlightColor = QColor(0xfc, 0x66, 0x21, 200);
|
||||
QColor Theme::skeletonMasterNodeFillColor = QColor(0xfc, 0x66, 0x21, 50);
|
||||
int Theme::skeletonMasterNodeBorderSize = 15;
|
||||
int Theme::skeletonMasterNodeBorderSize = 2;
|
||||
QColor Theme::skeletonSlaveNodeBorderColor = QColor(0xcc, 0xcc, 0xcc, 64);
|
||||
QColor Theme::skeletonSlaveNodeBorderHighlightColor = QColor(0xfc, 0x66, 0x21, 100);
|
||||
QColor Theme::skeletonSlaveNodeFillColor = QColor(0xcc, 0xcc, 0xcc, 25);
|
||||
int Theme::skeletonSlaveNodeBorderSize = 15;
|
||||
int Theme::skeletonSlaveNodeBorderSize = 2;
|
||||
|
||||
|
||||
|
|