Add command line option: -toggle-color
parent
873e6423bb
commit
a9dd15991f
|
@ -420,20 +420,7 @@ DocumentWindow::DocumentWindow()
|
|||
m_viewMenu->addAction(m_toggleRotationAction);
|
||||
|
||||
m_toggleColorAction = new QAction(tr("Toggle Color"), this);
|
||||
connect(m_toggleColorAction, &QAction::triggered, [&]() {
|
||||
m_modelRemoveColor = !m_modelRemoveColor;
|
||||
ModelMesh *mesh = nullptr;
|
||||
if (m_document->isMeshGenerating() ||
|
||||
m_document->isPostProcessing() ||
|
||||
m_document->isTextureGenerating()) {
|
||||
mesh = m_document->takeResultMesh();
|
||||
} else {
|
||||
mesh = m_document->takeResultTextureMesh();
|
||||
}
|
||||
if (m_modelRemoveColor && mesh)
|
||||
mesh->removeColor();
|
||||
m_modelRenderWidget->updateMesh(mesh);
|
||||
});
|
||||
connect(m_toggleColorAction, &QAction::triggered, this, &DocumentWindow::toggleRenderColor);
|
||||
m_viewMenu->addAction(m_toggleColorAction);
|
||||
|
||||
m_windowMenu = menuBar()->addMenu(tr("&Window"));
|
||||
|
@ -1410,3 +1397,19 @@ bool DocumentWindow::isWorking()
|
|||
{
|
||||
return nullptr == m_inprogressIndicator || m_inprogressIndicator->isSpinning();
|
||||
}
|
||||
|
||||
void DocumentWindow::toggleRenderColor()
|
||||
{
|
||||
m_modelRemoveColor = !m_modelRemoveColor;
|
||||
ModelMesh *mesh = nullptr;
|
||||
if (m_document->isMeshGenerating() ||
|
||||
m_document->isPostProcessing() ||
|
||||
m_document->isTextureGenerating()) {
|
||||
mesh = m_document->takeResultMesh();
|
||||
} else {
|
||||
mesh = m_document->takeResultTextureMesh();
|
||||
}
|
||||
if (m_modelRemoveColor && mesh)
|
||||
mesh->removeColor();
|
||||
m_modelRenderWidget->updateMesh(mesh);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public slots:
|
|||
void updateInprogressIndicator();
|
||||
void openRecentFile();
|
||||
void updateRecentFileActions();
|
||||
void toggleRenderColor();
|
||||
private:
|
||||
void setCurrentFilename(const QString &filename);
|
||||
void updateTitle();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QDebug>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <dust3d/base/string.h>
|
||||
#include "document_window.h"
|
||||
#include "document.h"
|
||||
#include "theme.h"
|
||||
|
@ -30,6 +31,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
QStringList openFileList;
|
||||
QStringList waitingExportList;
|
||||
bool toggleColor = false;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if ('-' == argv[i][0]) {
|
||||
if (0 == strcmp(argv[i], "-output") ||
|
||||
|
@ -38,6 +40,11 @@ int main(int argc, char *argv[])
|
|||
if (i < argc)
|
||||
waitingExportList.append(argv[i]);
|
||||
continue;
|
||||
} else if (0 == strcmp(argv[i], "-toggle-color")) {
|
||||
++i;
|
||||
if (i < argc)
|
||||
toggleColor = dust3d::String::isTrue(argv[i]);
|
||||
continue;
|
||||
}
|
||||
qDebug() << "Unknown option:" << argv[i];
|
||||
continue;
|
||||
|
@ -68,6 +75,10 @@ int main(int argc, char *argv[])
|
|||
for (int i = 1; i < openFileList.size(); ++i) {
|
||||
windowList.push_back(DocumentWindow::createDocumentWindow());
|
||||
}
|
||||
if (toggleColor) {
|
||||
for (auto &it: windowList)
|
||||
it->toggleRenderColor();
|
||||
}
|
||||
if (!waitingExportList.empty() &&
|
||||
openFileList.size() == 1) {
|
||||
totalExportFileNum = openFileList.size() * waitingExportList.size();
|
||||
|
|
Loading…
Reference in New Issue