Allow changing pass textures in the model editor

This commit is contained in:
parax0 2015-11-28 02:27:52 -07:00
parent 4f51451149
commit 1e00c60516
3 changed files with 25 additions and 1 deletions

View File

@ -87,7 +87,8 @@ void CModelEditorViewport::Paint()
CGraphics::UpdateMVPBlock(); CGraphics::UpdateMVPBlock();
mpActiveMaterial->SetCurrent(eEnableUVScroll | eEnableOccluders); mpActiveMaterial->SetCurrent(eEnableUVScroll | eEnableOccluders);
CDrawUtil::DrawSquare(); float Aspect = (float) width() / (float) height();
CDrawUtil::DrawSquare(CVector2f(0,1), CVector2f(1 * Aspect, 1), CVector2f(1 * Aspect, 0), CVector2f(0,0));
} }
mpRenderer->EndFrame(); mpRenderer->EndFrame();

View File

@ -119,6 +119,7 @@ CModelEditorWindow::CModelEditorWindow(QWidget *parent) :
connect(ui->TevKAlphaSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); connect(ui->TevKAlphaSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->TevRasSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); connect(ui->TevRasSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->TexCoordSrcComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); connect(ui->TexCoordSrcComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->PassTextureResSelector, SIGNAL(ResourceChanged(QString)), this, SLOT(UpdateMaterial(QString)));
connect(ui->TevColor1ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); connect(ui->TevColor1ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->TevColor2ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); connect(ui->TevColor2ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->TevColor3ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); connect(ui->TevColor3ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
@ -562,6 +563,27 @@ void CModelEditorWindow::UpdateMaterial(QColor Color)
} }
} }
void CModelEditorWindow::UpdateMaterial(QString Value)
{
// This function takes input from WResourceSelectors
if (!mpCurrentMat) return;
if (mIgnoreSignals) return;
EModelEditorWidget Widget = (EModelEditorWidget) sender()->property("ModelEditorWidgetType").toInt();
CTexture *pTex = (CTexture*) gResCache.GetResource(TO_TSTRING(Value));
if (pTex->Type() != eTexture) pTex = nullptr;
switch (Widget)
{
case ePassTextureResSelector:
mpCurrentPass->SetTexture(pTex);
break;
case eIndTextureResSelector:
mpCurrentMat->SetIndTexture(pTex);
break;
}
}
void CModelEditorWindow::UpdateUI(int Value) void CModelEditorWindow::UpdateUI(int Value)
{ {
EModelEditorWidget Widget = (EModelEditorWidget) sender()->property("ModelEditorWidgetType").toInt(); EModelEditorWidget Widget = (EModelEditorWidget) sender()->property("ModelEditorWidgetType").toInt();

View File

@ -47,6 +47,7 @@ public slots:
void UpdateMaterial(double Value); void UpdateMaterial(double Value);
void UpdateMaterial(bool Value); void UpdateMaterial(bool Value);
void UpdateMaterial(QColor eColorProperty); void UpdateMaterial(QColor eColorProperty);
void UpdateMaterial(QString Value);
void UpdateUI(int Value); void UpdateUI(int Value);
void UpdateAnimParamUI(int Mode); void UpdateAnimParamUI(int Mode);