Skip to content

Commit

Permalink
LOD ui tweaks, bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbui78 committed Sep 2, 2023
1 parent 6a6ba59 commit c335cd6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/DzBridgeAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace DzBridgeNameSpace
Q_INVOKABLE virtual int getELodMethodMax() { return 1; }
ELodMethod m_eLodMethod = ELodMethod::Undefined; // WARNING: May need to change this to type int to support additional values in subclasses, depending on compiler handling of enum
virtual ELodMethod getLodMethod() const { return m_eLodMethod; }
int m_nNumberOfLods = 2; // total number of LOD levels (including Base LOD)
int m_nNumberOfLods = 3; // total number of LOD levels (including Base LOD)
bool m_bCreateLodGroup = false;

virtual QString getActionGroup() const { return tr("Bridges"); }
Expand Down
1 change: 1 addition & 0 deletions include/DzBridgeLodSettingsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace DzBridgeNameSpace

private:
static DzBridgeLodSettingsDialog* singleton;
bool bWarningShown = false;

};

Expand Down
30 changes: 27 additions & 3 deletions src/DzBridgeLodSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void DzBridgeLodSettingsDialog::showEvent(QShowEvent* event)
resize(sizeHint());

DzBasicDialog::showEvent(event);
bWarningShown = false;
}

void DzBridgeLodSettingsDialog::accept()
Expand Down Expand Up @@ -171,6 +172,18 @@ void DzBridgeLodSettingsDialog::accept()
}
//applyLodPresetHighPerformance();
}

float fEstimatedLodGenerationTime = calculateLodGenerationTime();

if (fEstimatedLodGenerationTime > 5.0 && !bWarningShown)
{
QString sWarningString = QString(tr("The estimated LOD generation time may be more than %1 minutes. Times will vary depending on your CPU.")).arg((int)fEstimatedLodGenerationTime);
// Warn User with Popup that estimated LOD generation will be more than 5 minutes
QMessageBox::warning(0, "Daz Bridge",
sWarningString, QMessageBox::Ok);
bWarningShown = true;
}

DzBasicDialog::accept();
}

Expand All @@ -182,18 +195,29 @@ void DzBridgeLodSettingsDialog::reject()
void DzBridgeLodSettingsDialog::HandleLodMethodComboChange(int state)
{
float fEstimatedLodGenerationTime = calculateLodGenerationTime();

if (fEstimatedLodGenerationTime > 5.0 && !bWarningShown)
{
QString sWarningString = QString(tr("The estimated LOD generation time may be more than %1 minutes. Times will vary depending on your CPU.")).arg((int)fEstimatedLodGenerationTime);
// Warn User with Popup that estimated LOD generation will be more than 5 minutes
QMessageBox::warning(0, "Daz Bridge",
sWarningString, QMessageBox::Ok);
bWarningShown = true;
}

}

void DzBridgeLodSettingsDialog::HandleNumberOfLodComboChange(int state)
{
float fEstimatedLodGenerationTime = calculateLodGenerationTime();

if (fEstimatedLodGenerationTime > 5.0)
if (fEstimatedLodGenerationTime > 5.0 && !bWarningShown)
{
QString sWarningString = QString(tr("The estimated LOD generation time may be more than %1 minutes. Times will vary depending on your CPU.")).arg((int) fEstimatedLodGenerationTime);
// Warn User with Popup that estimated LOD generation will be more than 5 minutes
QMessageBox::warning(0, "Daz Bridge",
sWarningString, QMessageBox::Ok);
bWarningShown = true;
}

}
Expand Down Expand Up @@ -282,9 +306,9 @@ int DzBridgeLodSettingsDialog::getSourceVertexCount()

float DzBridgeLodSettingsDialog::calculateLodGenerationTime()
{
int numLODs = m_wNumberOfLodComboBox->currentIndex();
int numLODs = m_wNumberOfLodComboBox->itemData(m_wNumberOfLodComboBox->currentIndex()).toInt();
int numVerts = getSourceVertexCount();
int lodMethod = m_wLodMethodComboBox->currentIndex();
int lodMethod = m_wLodMethodComboBox->itemData(m_wLodMethodComboBox->currentIndex()).toInt();
float fTimeScaleFactor = 0;

// hardcoded estimate for Unreal Builtin LOD generator and Zen 3 AMD processor.
Expand Down

0 comments on commit c335cd6

Please sign in to comment.