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