Skip to content

Commit

Permalink
Warning Icons added.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmkolasinski committed Aug 11, 2016
1 parent 2b545c4 commit 7a57dd0
Show file tree
Hide file tree
Showing 14 changed files with 539 additions and 42 deletions.
5 changes: 5 additions & 0 deletions Sources/content.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,10 @@
<file>resources/actions/grungeL.png</file>
<file>resources/actions/recompileShader.png</file>
<file>resources/actions/settings3d.png</file>
<file>resources/actions/warnMaterials.png</file>
<file>resources/actions/ConversionWarning.png</file>
<file>resources/actions/grungeWarning.png</file>
<file>resources/actions/UVwarning.png</file>
<file>resources/actions/showOcclusionWarning.png</file>
</qresource>
</RCC>
6 changes: 3 additions & 3 deletions Sources/formmaterialindicesmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool FormMaterialIndicesManager::updateMaterials(QImage& image){


qDebug() << "Updating material indices. Total indices count:" << ui->listWidgetMaterialIndices->count();
for(int i = 0 ; i < METALLIC_TEXTURE ; i++){
for(int i = 0 ; i < MATERIAL_TEXTURE ; i++){
materialIndices[i].clear();
for(int m = 0 ; m < ui->listWidgetMaterialIndices->count() ; m++){
QString m_name = ui->listWidgetMaterialIndices->item(m)->text();
Expand Down Expand Up @@ -128,7 +128,7 @@ void FormMaterialIndicesManager::changeMaterial(int index){
ui->listWidgetMaterialIndices->item(lastMaterialIndex)->setText("Material"+QString::number(lastMaterialIndex+1));

QString m_name = ui->listWidgetMaterialIndices->item(lastMaterialIndex)->text();
for(int i = 0 ; i < METALLIC_TEXTURE ; i++){
for(int i = 0 ; i < MATERIAL_TEXTURE ; i++){
materialIndices[i][m_name].copySettings(imagesPointers[i]->imageProp);
}

Expand All @@ -140,7 +140,7 @@ void FormMaterialIndicesManager::changeMaterial(int index){

// load different material
m_name = ui->listWidgetMaterialIndices->item(index)->text();
for(int i = 0 ; i < METALLIC_TEXTURE ; i++){
for(int i = 0 ; i < MATERIAL_TEXTURE ; i++){
imagesPointers[i]->imageProp.copySettings(materialIndices[i][m_name]);
imagesPointers[i]->reloadSettings();
}
Expand Down
1 change: 1 addition & 0 deletions Sources/formsettingscontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ FormSettingsContainer::FormSettingsContainer(QWidget *parent) :
qDebug() << "Reading the list of available configs settings:";
// reading configs
for (int i = 0; i < iniFiles.size(); ++i){
if(iniFiles[i] == "gui.ini") continue;
FormSettingsField* sfield = new FormSettingsField("Configs/"+iniFiles[i],this);
connect(sfield,SIGNAL(emitDeleteSettings(FormSettingsField*)),this,SLOT(removeSetting(FormSettingsField*)));
connect(sfield,SIGNAL(emitLoadSettings(FormSettingsField*)) ,this,SLOT(reloadSettings(FormSettingsField*)));
Expand Down
46 changes: 44 additions & 2 deletions Sources/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ void MainWindow::initializeApp()
// ------------------------------------------------------
ui->statusbar->addWidget(statusLabel);



// Settings container
settingsContainer = new FormSettingsContainer;
ui->verticalLayout2DImage->addWidget(settingsContainer);
Expand Down Expand Up @@ -176,6 +178,11 @@ void MainWindow::initializeApp()
connect(ui->tabWidget,SIGNAL(tabBarClicked(int)),this,SLOT(updateImage(int)));

// imageChange and imageLoaded signals
connect(diffuseImageProp ,SIGNAL(imageChanged()),this,SLOT(checkWarnings()));
connect(grungeImageProp ,SIGNAL(imageChanged()),this,SLOT(checkWarnings()));
connect(occlusionImageProp ,SIGNAL(imageChanged()),this,SLOT(checkWarnings()));


connect(diffuseImageProp ,SIGNAL(imageChanged()),glImage,SLOT(imageChanged()));
connect(roughnessImageProp ,SIGNAL(imageChanged()),glImage,SLOT(imageChanged()));
connect(metallicImageProp ,SIGNAL(imageChanged()),glImage,SLOT(imageChanged()));
Expand Down Expand Up @@ -203,6 +210,7 @@ void MainWindow::initializeApp()
// Material Manager slots
connect(materialManager,SIGNAL(materialChanged()),this,SLOT(replotAllImages()));
connect(materialManager,SIGNAL(materialsToggled(bool)),ui->tabTilling,SLOT(setDisabled(bool)));
connect(materialManager,SIGNAL(materialsToggled(bool)),this,SLOT(materialsToggled(bool))); // disable conversion tool
connect(glWidget,SIGNAL(materialColorPicked(QColor)),materialManager,SLOT(chooseMaterialByColor(QColor)));


Expand Down Expand Up @@ -457,6 +465,13 @@ void MainWindow::initializeApp()

selectDiffuseTab();

// Hide warning icons
ui->pushButtonMaterialWarning ->setVisible(false);
ui->pushButtonConversionWarning->setVisible(false);
ui->pushButtonGrungeWarning->setVisible(false);
ui->pushButtonUVWarning->setVisible(false);
ui->pushButtonOccWarning->setVisible(false);

INIT_PROGRESS(100, tr("Done - UI ready."));


Expand All @@ -478,7 +493,6 @@ MainWindow::~MainWindow()
delete roughnessImageProp;
delete grungeImageProp;
delete metallicImageProp;

delete statusLabel;
delete glImage;
delete glWidget;
Expand Down Expand Up @@ -555,6 +569,34 @@ void MainWindow::replotAllImages(){
#endif
}

void MainWindow::materialsToggled(bool toggle){
static bool bLastValue;
ui->pushButtonMaterialWarning->setVisible(toggle);
ui->pushButtonUVWarning->setVisible(FBOImageProporties::seamlessMode != SEAMLESS_NONE);
if(toggle){

bLastValue = diffuseImageProp->imageProp.properties->BaseMapToOthers.EnableConversion;
diffuseImageProp->imageProp.properties->BaseMapToOthers.EnableConversion = false;
ui->pushButtonUVWarning->setVisible(false);
if(bLastValue) replotAllImages();
}else{
diffuseImageProp->imageProp.properties->BaseMapToOthers.EnableConversion = bLastValue;
}
diffuseImageProp->imageProp.properties->BaseMapToOthers.switchState(QtnPropertyStateInvisible,toggle);

}


void MainWindow::checkWarnings(){
ui->pushButtonConversionWarning->setVisible(FBOImageProporties::bConversionBaseMap);
ui->pushButtonGrungeWarning->setVisible(grungeImageProp->imageProp.properties->Grunge.OverallWeight.value() > 0);
ui->pushButtonUVWarning->setVisible(FBOImageProporties::seamlessMode != SEAMLESS_NONE);

bool bOccTest = (occlusionImageProp->imageProp.inputImageType == INPUT_FROM_HO_NO) ||
(occlusionImageProp->imageProp.inputImageType == INPUT_FROM_HI_NI);
ui->pushButtonOccWarning->setVisible(bOccTest);
}


void MainWindow::selectDiffuseTab(){
ui->tabWidget->setCurrentIndex(0);
Expand Down Expand Up @@ -1245,7 +1287,7 @@ void MainWindow::selectSeamlessMode(int mode){
break;
}
glImage->selectSeamlessMode((SeamlessMode)mode);

checkWarnings();
replotAllImages();
}

Expand Down
4 changes: 4 additions & 0 deletions Sources/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public slots:
void showSettingsManager();
void setOutputFormat(int index);
void replotAllImages();
void materialsToggled(bool toggle);
void checkWarnings();


// repaint views after selecting tab
void selectDiffuseTab();
Expand Down Expand Up @@ -175,6 +178,7 @@ public slots:
QAction *shortcutsAction; // show key shortcuts

QLabel *statusLabel;

DialogLogger* dialogLogger;
DialogShortcuts* dialogShortcuts;
QSettings defaults;
Expand Down
Loading

0 comments on commit 7a57dd0

Please sign in to comment.