Adjust color theme for part list mini button to make a better visible effect

master
Jeremy Hu 2018-04-16 20:06:48 +08:00
parent 9fc345e1e3
commit dd976b7fc2
6 changed files with 32 additions and 41 deletions

View File

@ -223,35 +223,19 @@ void MeshGenerator::process()
zMirroredMeshId = meshlite_mirror_in_z(meshliteContext, meshId, 0); 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()) { if (m_requirePartPreviewMap.find(partIdIt) != m_requirePartPreviewMap.end()) {
ModelOfflineRender *render = m_partPreviewRenderMap[partIdIt]; ModelOfflineRender *render = m_partPreviewRenderMap[partIdIt];
int trimedMeshId = meshlite_trim(meshliteContext, meshId, 1); 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)); render->updateMesh(new Mesh(meshliteContext, trimedMeshId));
QImage *image = new QImage(render->toImage(QSize(Theme::previewImageSize, Theme::previewImageSize))); QImage *image = new QImage(render->toImage(QSize(Theme::previewImageSize, Theme::previewImageSize)));
m_partPreviewMap[partIdIt] = image; 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); meshIds.push_back(meshId);
if (xMirroredMeshId) if (xMirroredMeshId)
meshIds.push_back(xMirroredMeshId); meshIds.push_back(xMirroredMeshId);
if (zMirroredMeshId) if (zMirroredMeshId)
meshIds.push_back(zMirroredMeshId); meshIds.push_back(zMirroredMeshId);
} }
}
if (!subdivMeshIds.empty()) { if (!subdivMeshIds.empty()) {
int mergedMeshId = 0; int mergedMeshId = 0;

View File

@ -54,8 +54,10 @@ QImage ModelOfflineRender::toImage(const QSize &size)
m_context->functions()->glViewport(0, 0, size.width(), size.height()); m_context->functions()->glViewport(0, 0, size.width(), size.height());
if (nullptr != m_mesh) { if (nullptr != m_mesh) {
int xRot = -30 * 16; //int xRot = -30 * 16;
int yRot = 45 * 16; //int yRot = 45 * 16;
int xRot = 0;
int yRot = 0;
int zRot = 0; int zRot = 0;
QMatrix4x4 proj; QMatrix4x4 proj;
QMatrix4x4 camera; QMatrix4x4 camera;
@ -74,7 +76,7 @@ QImage ModelOfflineRender::toImage(const QSize &size)
m_context->functions()->glEnable(GL_LINE_SMOOTH); m_context->functions()->glEnable(GL_LINE_SMOOTH);
camera.setToIdentity(); camera.setToIdentity();
camera.translate(0, 0, -2.1); camera.translate(0, 0, -3.0);
world.setToIdentity(); world.setToIdentity();
world.rotate(180.0f - (xRot / 16.0f), 1, 0, 0); world.rotate(180.0f - (xRot / 16.0f), 1, 0, 0);

View File

@ -82,6 +82,10 @@ public:
{ {
id = withId.isNull() ? QUuid::createUuid() : withId; id = withId.isNull() ? QUuid::createUuid() : withId;
} }
bool isEditVisible() const
{
return visible && !disabled;
}
void copyAttributes(const SkeletonPart &other) void copyAttributes(const SkeletonPart &other)
{ {
visible = other.visible; visible = other.visible;

View File

@ -385,6 +385,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
connect(m_document, &SkeletonDocument::nodeRadiusChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeRadiusChanged); connect(m_document, &SkeletonDocument::nodeRadiusChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeRadiusChanged);
connect(m_document, &SkeletonDocument::nodeOriginChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeOriginChanged); connect(m_document, &SkeletonDocument::nodeOriginChanged, graphicsWidget, &SkeletonGraphicsWidget::nodeOriginChanged);
connect(m_document, &SkeletonDocument::partVisibleStateChanged, graphicsWidget, &SkeletonGraphicsWidget::partVisibleStateChanged); 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::cleanup, graphicsWidget, &SkeletonGraphicsWidget::removeAllContent);
connect(m_document, &SkeletonDocument::originChanged, graphicsWidget, &SkeletonGraphicsWidget::originChanged); connect(m_document, &SkeletonDocument::originChanged, graphicsWidget, &SkeletonGraphicsWidget::originChanged);

View File

@ -1278,16 +1278,16 @@ void SkeletonGraphicsWidget::partVisibleStateChanged(QUuid partId)
qDebug() << "Edge item not found:" << *edgeIt; qDebug() << "Edge item not found:" << *edgeIt;
continue; continue;
} }
edgeItemIt->second.first->setVisible(part->visible); edgeItemIt->second.first->setVisible(part->isEditVisible());
edgeItemIt->second.second->setVisible(part->visible); edgeItemIt->second.second->setVisible(part->isEditVisible());
} }
auto nodeItemIt = nodeItemMap.find(nodeId); auto nodeItemIt = nodeItemMap.find(nodeId);
if (nodeItemIt == nodeItemMap.end()) { if (nodeItemIt == nodeItemMap.end()) {
qDebug() << "Node item not found:" << nodeId; qDebug() << "Node item not found:" << nodeId;
continue; continue;
} }
nodeItemIt->second.first->setVisible(part->visible); nodeItemIt->second.first->setVisible(part->isEditVisible());
nodeItemIt->second.second->setVisible(part->visible); nodeItemIt->second.second->setVisible(part->isEditVisible());
} }
} }

View File

@ -9,28 +9,28 @@ SkeletonPartWidget::SkeletonPartWidget(const SkeletonDocument *document, QUuid p
m_partId(partId) m_partId(partId)
{ {
m_visibleButton = new QPushButton(); m_visibleButton = new QPushButton();
updateButton(m_visibleButton, QChar(fa::eye), false);
initButton(m_visibleButton); initButton(m_visibleButton);
updateVisibleButton();
m_lockButton = new QPushButton(); m_lockButton = new QPushButton();
updateButton(m_lockButton, QChar(fa::unlock), false);
initButton(m_lockButton); initButton(m_lockButton);
updateLockButton();
m_subdivButton = new QPushButton(); m_subdivButton = new QPushButton();
updateButton(m_subdivButton, QChar(fa::cube), false);
initButton(m_subdivButton); initButton(m_subdivButton);
updateSubdivButton();
m_disableButton = new QPushButton(); m_disableButton = new QPushButton();
updateButton(m_disableButton, QChar(fa::toggleon), false);
initButton(m_disableButton); initButton(m_disableButton);
updateDisableButton();
m_xMirrorButton = new QPushButton(); m_xMirrorButton = new QPushButton();
updateButton(m_xMirrorButton, QChar(fa::quoteleft), false);
initButton(m_xMirrorButton); initButton(m_xMirrorButton);
updateXmirrorButton();
m_zMirrorButton = new QPushButton(); m_zMirrorButton = new QPushButton();
updateButton(m_zMirrorButton, QChar(fa::quoteright), false);
initButton(m_zMirrorButton); initButton(m_zMirrorButton);
updateZmirrorButton();
m_previewLabel = new QLabel; m_previewLabel = new QLabel;
@ -139,7 +139,7 @@ void SkeletonPartWidget::updateButton(QPushButton *button, QChar icon, bool high
{ {
button->setText(icon); button->setText(icon);
if (highlighted) if (highlighted)
button->setStyleSheet("QPushButton {border: none; background: none; color: #f7d9c8;}"); button->setStyleSheet("QPushButton {border: none; background: none; color: #925935;}");
else else
button->setStyleSheet("QPushButton {border: none; background: none; color: #252525;}"); button->setStyleSheet("QPushButton {border: none; background: none; color: #252525;}");
} }
@ -188,9 +188,9 @@ void SkeletonPartWidget::updateSubdivButton()
return; return;
} }
if (part->subdived) if (part->subdived)
updateButton(m_subdivButton, QChar(fa::connectdevelop), true); updateButton(m_subdivButton, QChar(fa::circle), true);
else else
updateButton(m_subdivButton, QChar(fa::cube), false); updateButton(m_subdivButton, QChar(fa::square), false);
} }
void SkeletonPartWidget::updateDisableButton() void SkeletonPartWidget::updateDisableButton()
@ -214,9 +214,9 @@ void SkeletonPartWidget::updateXmirrorButton()
return; return;
} }
if (part->xMirrored) if (part->xMirrored)
updateButton(m_xMirrorButton, QChar(fa::quoteleft), true); updateButton(m_xMirrorButton, QChar(fa::balancescale), true);
else else
updateButton(m_xMirrorButton, QChar(fa::quoteleft), false); updateButton(m_xMirrorButton, QChar(fa::balancescale), false);
} }
void SkeletonPartWidget::updateZmirrorButton() void SkeletonPartWidget::updateZmirrorButton()
@ -227,9 +227,9 @@ void SkeletonPartWidget::updateZmirrorButton()
return; return;
} }
if (part->zMirrored) if (part->zMirrored)
updateButton(m_zMirrorButton, QChar(fa::quoteright), true); updateButton(m_zMirrorButton, QChar(fa::balancescale), true);
else else
updateButton(m_zMirrorButton, QChar(fa::quoteright), false); updateButton(m_zMirrorButton, QChar(fa::balancescale), false);
} }
void SkeletonPartWidget::reload() void SkeletonPartWidget::reload()