Skip to content

Commit

Permalink
Adjust color theme for part list mini button to make a better visible…
Browse files Browse the repository at this point in the history
… effect
  • Loading branch information
huxingyi committed Apr 16, 2018
1 parent 9fc345e commit dd976b7
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 41 deletions.
26 changes: 5 additions & 21 deletions src/meshgenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,34 +223,18 @@ void MeshGenerator::process()
zMirroredMeshId = meshlite_mirror_in_z(meshliteContext, meshId, 0);
}
}
//bool subdived = isTrueValueString(valueOfKeyInMapOrEmpty(part->second, "subdived"));
bool subdived = false;
if (m_requirePartPreviewMap.find(partIdIt) != m_requirePartPreviewMap.end()) {
ModelOfflineRender *render = m_partPreviewRenderMap[partIdIt];
int trimedMeshId = meshlite_trim(meshliteContext, meshId, 1);
if (subdived) {
int subdivedMeshId = subdivMesh(meshliteContext, trimedMeshId);
if (subdivedMeshId > 0) {
trimedMeshId = subdivedMeshId;
}
}
render->updateMesh(new Mesh(meshliteContext, trimedMeshId));
QImage *image = new QImage(render->toImage(QSize(Theme::previewImageSize, Theme::previewImageSize)));
m_partPreviewMap[partIdIt] = image;
}
if (subdived) {
subdivMeshIds.push_back(meshId);
if (xMirroredMeshId)
subdivMeshIds.push_back(xMirroredMeshId);
if (zMirroredMeshId)
subdivMeshIds.push_back(zMirroredMeshId);
} else {
meshIds.push_back(meshId);
if (xMirroredMeshId)
meshIds.push_back(xMirroredMeshId);
if (zMirroredMeshId)
meshIds.push_back(zMirroredMeshId);
}
meshIds.push_back(meshId);
if (xMirroredMeshId)
meshIds.push_back(xMirroredMeshId);
if (zMirroredMeshId)
meshIds.push_back(zMirroredMeshId);
}

if (!subdivMeshIds.empty()) {
Expand Down
8 changes: 5 additions & 3 deletions src/modelofflinerender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ QImage ModelOfflineRender::toImage(const QSize &size)
m_context->functions()->glViewport(0, 0, size.width(), size.height());

if (nullptr != m_mesh) {
int xRot = -30 * 16;
int yRot = 45 * 16;
//int xRot = -30 * 16;
//int yRot = 45 * 16;
int xRot = 0;
int yRot = 0;
int zRot = 0;
QMatrix4x4 proj;
QMatrix4x4 camera;
Expand All @@ -74,7 +76,7 @@ QImage ModelOfflineRender::toImage(const QSize &size)
m_context->functions()->glEnable(GL_LINE_SMOOTH);

camera.setToIdentity();
camera.translate(0, 0, -2.1);
camera.translate(0, 0, -3.0);

world.setToIdentity();
world.rotate(180.0f - (xRot / 16.0f), 1, 0, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/skeletondocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ class SkeletonPart
{
id = withId.isNull() ? QUuid::createUuid() : withId;
}
bool isEditVisible() const
{
return visible && !disabled;
}
void copyAttributes(const SkeletonPart &other)
{
visible = other.visible;
Expand Down
1 change: 1 addition & 0 deletions src/skeletondocumentwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
connect(m_document, &SkeletonDocument::nodeRadiusChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeRadiusChanged);
connect(m_document, &SkeletonDocument::nodeOriginChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeOriginChanged);
connect(m_document, &SkeletonDocument::partVisibleStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged);
connect(m_document, &SkeletonDocument::partDisableStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged);
connect(m_document, &SkeletonDocument::cleanup, graphicsWidget, &SkeletonGraphicsWidget::removeAllContent);
connect(m_document, &SkeletonDocument::originChanged, graphicsWidget, &SkeletonGraphicsWidget::originChanged);

Expand Down
8 changes: 4 additions & 4 deletions src/skeletongraphicswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,16 +1278,16 @@ void SkeletonGraphicsWidget::partVisibleStateChanged(QUuid partId)
qDebug() << "Edge item not found:" << *edgeIt;
continue;
}
edgeItemIt->second.first->setVisible(part->visible);
edgeItemIt->second.second->setVisible(part->visible);
edgeItemIt->second.first->setVisible(part->isEditVisible());
edgeItemIt->second.second->setVisible(part->isEditVisible());
}
auto nodeItemIt = nodeItemMap.find(nodeId);
if (nodeItemIt == nodeItemMap.end()) {
qDebug() << "Node item not found:" << nodeId;
continue;
}
nodeItemIt->second.first->setVisible(part->visible);
nodeItemIt->second.second->setVisible(part->visible);
nodeItemIt->second.first->setVisible(part->isEditVisible());
nodeItemIt->second.second->setVisible(part->isEditVisible());
}
}

Expand Down
26 changes: 13 additions & 13 deletions src/skeletonpartlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
m_partId(partId)
{
m_visibleButton = new QPushButton();
updateButton(m_visibleButton, QChar(fa::eye), false);
initButton(m_visibleButton);
updateVisibleButton();

m_lockButton = new QPushButton();
updateButton(m_lockButton, QChar(fa::unlock), false);
initButton(m_lockButton);
updateLockButton();

m_subdivButton = new QPushButton();
updateButton(m_subdivButton, QChar(fa::cube), false);
initButton(m_subdivButton);
updateSubdivButton();

m_disableButton = new QPushButton();
updateButton(m_disableButton, QChar(fa::toggleon), false);
initButton(m_disableButton);
updateDisableButton();

m_xMirrorButton = new QPushButton();
updateButton(m_xMirrorButton, QChar(fa::quoteleft), false);
initButton(m_xMirrorButton);
updateXmirrorButton();

m_zMirrorButton = new QPushButton();
updateButton(m_zMirrorButton, QChar(fa::quoteright), false);
initButton(m_zMirrorButton);
updateZmirrorButton();

m_previewLabel = new QLabel;

Expand Down Expand Up @@ -139,7 +139,7 @@ void SkeletonPartWidget::updateButton(QPushButton *button, QChar icon, bool high
{
button->setText(icon);
if (highlighted)
button->setStyleSheet("QPushButton {border: none; background: none; color: #f7d9c8;}");
button->setStyleSheet("QPushButton {border: none; background: none; color: #925935;}");
else
button->setStyleSheet("QPushButton {border: none; background: none; color: #252525;}");
}
Expand Down Expand Up @@ -188,9 +188,9 @@ void SkeletonPartWidget::updateSubdivButton()
return;
}
if (part->subdived)
updateButton(m_subdivButton, QChar(fa::connectdevelop), true);
updateButton(m_subdivButton, QChar(fa::circle), true);
else
updateButton(m_subdivButton, QChar(fa::cube), false);
updateButton(m_subdivButton, QChar(fa::square), false);
}

void SkeletonPartWidget::updateDisableButton()
Expand All @@ -214,9 +214,9 @@ void SkeletonPartWidget::updateXmirrorButton()
return;
}
if (part->xMirrored)
updateButton(m_xMirrorButton, QChar(fa::quoteleft), true);
updateButton(m_xMirrorButton, QChar(fa::balancescale), true);
else
updateButton(m_xMirrorButton, QChar(fa::quoteleft), false);
updateButton(m_xMirrorButton, QChar(fa::balancescale), false);
}

void SkeletonPartWidget::updateZmirrorButton()
Expand All @@ -227,9 +227,9 @@ void SkeletonPartWidget::updateZmirrorButton()
return;
}
if (part->zMirrored)
updateButton(m_zMirrorButton, QChar(fa::quoteright), true);
updateButton(m_zMirrorButton, QChar(fa::balancescale), true);
else
updateButton(m_zMirrorButton, QChar(fa::quoteright), false);
updateButton(m_zMirrorButton, QChar(fa::balancescale), false);
}

void SkeletonPartWidget::reload()
Expand Down

0 comments on commit dd976b7

Please sign in to comment.