More code cleanup

This commit is contained in:
parax0 2016-03-27 20:26:33 -06:00
parent 82ad4fb5c8
commit 1150ee2b22
7 changed files with 258 additions and 242 deletions

View File

@ -97,6 +97,19 @@ CModelEditorWindow::CModelEditorWindow(QWidget *pParent)
ui->AnimParamCSpinBox->setProperty ("ModelEditorWidgetType", eAnimParamCSpinBox);
ui->AnimParamDSpinBox->setProperty ("ModelEditorWidgetType", eAnimParamDSpinBox);
connect(ui->ActionOpen, SIGNAL(triggered()), this, SLOT(Open()));
connect(ui->ActionImport, SIGNAL(triggered()), this, SLOT(Import()));
connect(ui->ActionSave, SIGNAL(triggered()), this, SLOT(Save()));
connect(ui->ActionSaveAs, SIGNAL(triggered()), this, SLOT(SaveAs()));
connect(ui->ActionConvertToDDS, SIGNAL(triggered()), this, SLOT(ConvertToDDS()));
connect(ui->ActionConvertToTXTR, SIGNAL(triggered()), this, SLOT(ConvertToTXTR()));
connect(ui->MeshPreviewButton, SIGNAL(clicked()), this, SLOT(SetMeshPreview()));
connect(ui->SpherePreviewButton, SIGNAL(clicked()), this, SLOT(SetSpherePreview()));
connect(ui->FlatPreviewButton, SIGNAL(clicked()), this, SLOT(SetFlatPreview()));
connect(ui->ClearColorPicker, SIGNAL(ColorChanged(QColor)), this, SLOT(ClearColorChanged(QColor)));
connect(ui->CameraModeButton, SIGNAL(clicked()), this, SLOT(ToggleCameraMode()));
connect(ui->ToggleGridButton, SIGNAL(toggled(bool)), this, SLOT(ToggleGrid(bool)));
connect(ui->SetSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateUI(int)));
connect(ui->MatSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateUI(int)));
connect(ui->EnableTransparencyCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool)));
@ -109,10 +122,10 @@ CModelEditorWindow::CModelEditorWindow(QWidget *pParent)
connect(ui->EnableDynamicLightingCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool)));
connect(ui->SourceBlendComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->DestBlendComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->KonstColorPickerA, SIGNAL(colorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerB, SIGNAL(colorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerC, SIGNAL(colorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerD, SIGNAL(colorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerA, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerB, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerC, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->KonstColorPickerD, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor)));
connect(ui->PassTable, SIGNAL(cellClicked(int,int)), this, SLOT(UpdateMaterial(int, int)));
connect(ui->TevKColorSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
connect(ui->TevKAlphaSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int)));
@ -703,27 +716,7 @@ void CModelEditorWindow::UpdateAnimParamUI(int Mode)
}
}
void CModelEditorWindow::on_actionConvert_to_DDS_triggered()
{
QString Input = QFileDialog::getOpenFileName(this, "Retro Texture (*.TXTR)", "", "*.TXTR");
if (Input.isEmpty()) return;
TString TexFilename = Input.toStdString();
TResPtr<CTexture> pTex = (CTexture*) gResCache.GetResource(TexFilename);
TString OutName = TexFilename.GetFilePathWithoutExtension() + ".dds";
CFileOutStream Out(OutName.ToStdString(), IOUtil::eLittleEndian);
if (!Out.IsValid()) QMessageBox::warning(this, "Error", "Couldn't open output DDS!");
else
{
bool success = pTex->WriteDDS(Out);
if (!success) QMessageBox::warning(this, "Error", "Couldn't write output DDS!");
else QMessageBox::information(this, "Success", "Successfully converted to DDS!");
}
}
void CModelEditorWindow::on_actionOpen_triggered()
void CModelEditorWindow::Open()
{
QString ModelFilename = QFileDialog::getOpenFileName(this, "Save model", "", "Retro Model (*.CMDL)");
if (ModelFilename.isEmpty()) return;
@ -739,61 +732,20 @@ void CModelEditorWindow::on_actionOpen_triggered()
gResCache.Clean();
}
void CModelEditorWindow::on_actionSave_triggered()
void CModelEditorWindow::Import()
{
if (!mpCurrentModel) return;
QString FileName = QFileDialog::getOpenFileName(this, "Model", "", "*.obj;*.fbx;*.dae;*.3ds;*.blend");
if (FileName.isEmpty()) return;
if (mOutputFilename.isEmpty())
{
on_actionSave_as_triggered();
return;
}
CFileOutStream CMDLOut(mOutputFilename.toStdString(), IOUtil::eBigEndian);
CModelCooker::WriteCookedModel(mpCurrentModel, ePrime, CMDLOut);
QMessageBox::information(this, "Saved", "Model saved!");
}
void CModelEditorWindow::closeEvent(QCloseEvent*)
{
emit Closed();
}
void CModelEditorWindow::on_MeshPreviewButton_clicked()
{
ui->Viewport->SetDrawMode(CModelEditorViewport::eDrawMesh);
}
void CModelEditorWindow::on_SpherePreviewButton_clicked()
{
ui->Viewport->SetDrawMode(CModelEditorViewport::eDrawSphere);
}
void CModelEditorWindow::on_FlatPreviewButton_clicked()
{
ui->Viewport->SetDrawMode(CModelEditorViewport::eDrawSquare);
}
void CModelEditorWindow::on_ClearColorPicker_colorChanged(const QColor &Color)
{
CColor NewColor = CColor::Integral(Color.red(), Color.green(), Color.blue(), Color.alpha());
ui->Viewport->SetClearColor(NewColor);
}
void CModelEditorWindow::on_actionImport_triggered()
{
QString filename = QFileDialog::getOpenFileName(this, "Model", "", "*.obj;*.fbx;*.dae;*.3ds;*.blend");
if (filename.isEmpty()) return;
Assimp::Importer importer;
importer.SetPropertyInteger(AI_CONFIG_PP_FD_REMOVE, 1);
importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS,
Assimp::Importer Importer;
Importer.SetPropertyInteger(AI_CONFIG_PP_FD_REMOVE, 1);
Importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS,
aiComponent_TANGENTS_AND_BITANGENTS |
aiComponent_ANIMATIONS |
aiComponent_LIGHTS |
aiComponent_CAMERAS);
const aiScene *pScene = importer.ReadFile(filename.toStdString(),
const aiScene *pScene = Importer.ReadFile(FileName.toStdString(),
aiProcess_JoinIdenticalVertices |
aiProcess_Triangulate |
aiProcess_RemoveComponent |
@ -823,42 +775,54 @@ void CModelEditorWindow::on_actionImport_triggered()
gResCache.Clean();
}
void CModelEditorWindow::on_actionSave_as_triggered()
void CModelEditorWindow::Save()
{
if (!mpCurrentModel) return;
if (mOutputFilename.isEmpty())
{
SaveAs();
return;
}
CFileOutStream CMDLOut(mOutputFilename.toStdString(), IOUtil::eBigEndian);
CModelCooker::WriteCookedModel(mpCurrentModel, ePrime, CMDLOut);
QMessageBox::information(this, "Saved", "Model saved!");
}
void CModelEditorWindow::SaveAs()
{
QString FileName = QFileDialog::getSaveFileName(this, "Save model", "", "Retro Model (*.CMDL)");
if (FileName.isEmpty()) return;
mOutputFilename = FileName;
on_actionSave_triggered();
Save();
TString name = TString(FileName.toStdString());
setWindowTitle("Prime World Editor - Model Editor: " + TO_QSTRING(name));
TString Name = TString(FileName.toStdString());
setWindowTitle("Prime World Editor - Model Editor: " + TO_QSTRING(Name));
}
void CModelEditorWindow::on_CameraModeButton_clicked()
void CModelEditorWindow::ConvertToDDS()
{
CCamera *pCam = &ui->Viewport->Camera();
QString Input = QFileDialog::getOpenFileName(this, "Retro Texture (*.TXTR)", "", "*.TXTR");
if (Input.isEmpty()) return;
if (pCam->MoveMode() == eOrbitCamera)
TString TexFilename = Input.toStdString();
TResPtr<CTexture> pTex = gResCache.GetResource(TexFilename);
TString OutName = TexFilename.GetFilePathWithoutExtension() + ".dds";
CFileOutStream Out(OutName.ToStdString(), IOUtil::eLittleEndian);
if (!Out.IsValid()) QMessageBox::warning(this, "Error", "Couldn't open output DDS!");
else
{
pCam->SetMoveMode(eFreeCamera);
ui->CameraModeButton->setIcon(QIcon(":/icons/Show.png"));
ui->CameraModeButton->setToolTip(QString("Free Camera"));
}
else if (pCam->MoveMode() == eFreeCamera)
{
pCam->SetMoveMode(eOrbitCamera);
ui->CameraModeButton->setIcon(QIcon(":/icons/Orbit Camera.png"));
ui->CameraModeButton->setToolTip(QString("Orbit Camera"));
CVector3f Pos = pCam->Position();
CVector3f Target = mpCurrentModelNode->AABox().Center();
pCam->SetOrbitDistance(Pos.Distance(Target));
bool Success = pTex->WriteDDS(Out);
if (!Success) QMessageBox::warning(this, "Error", "Couldn't write output DDS!");
else QMessageBox::information(this, "Success", "Successfully converted to DDS!");
}
}
void CModelEditorWindow::on_actionConvert_DDS_to_TXTR_triggered()
void CModelEditorWindow::ConvertToTXTR()
{
QString Input = QFileDialog::getOpenFileName(this, "DirectDraw Surface (*.dds)", "", "*.dds");
if (Input.isEmpty()) return;
@ -883,7 +847,56 @@ void CModelEditorWindow::on_actionConvert_DDS_to_TXTR_triggered()
}
}
void CModelEditorWindow::on_ToggleGridButton_toggled(bool Checked)
void CModelEditorWindow::SetMeshPreview()
{
ui->Viewport->SetGridEnabled(Checked);
ui->Viewport->SetDrawMode(CModelEditorViewport::eDrawMesh);
}
void CModelEditorWindow::SetSpherePreview()
{
ui->Viewport->SetDrawMode(CModelEditorViewport::eDrawSphere);
}
void CModelEditorWindow::SetFlatPreview()
{
ui->Viewport->SetDrawMode(CModelEditorViewport::eDrawSquare);
}
void CModelEditorWindow::ClearColorChanged(const QColor& rkNewColor)
{
CColor Color = TO_CCOLOR(rkNewColor);
ui->Viewport->SetClearColor(Color);
}
void CModelEditorWindow::ToggleCameraMode()
{
CCamera *pCam = &ui->Viewport->Camera();
if (pCam->MoveMode() == eOrbitCamera)
{
pCam->SetMoveMode(eFreeCamera);
ui->CameraModeButton->setIcon(QIcon(":/icons/Show.png"));
ui->CameraModeButton->setToolTip(QString("Free Camera"));
}
else if (pCam->MoveMode() == eFreeCamera)
{
pCam->SetMoveMode(eOrbitCamera);
ui->CameraModeButton->setIcon(QIcon(":/icons/Orbit Camera.png"));
ui->CameraModeButton->setToolTip(QString("Orbit Camera"));
CVector3f Pos = pCam->Position();
CVector3f Target = mpCurrentModelNode->AABox().Center();
pCam->SetOrbitDistance(Pos.Distance(Target));
}
}
void CModelEditorWindow::ToggleGrid(bool Enabled)
{
ui->Viewport->SetGridEnabled(Enabled);
}
void CModelEditorWindow::closeEvent(QCloseEvent*)
{
emit Closed();
}

View File

@ -98,28 +98,18 @@ private:
};
private slots:
void on_actionConvert_to_DDS_triggered();
void on_actionOpen_triggered();
void on_actionSave_triggered();
void on_MeshPreviewButton_clicked();
void on_SpherePreviewButton_clicked();
void on_FlatPreviewButton_clicked();
void on_ClearColorPicker_colorChanged(const QColor &);
void on_actionImport_triggered();
void on_actionSave_as_triggered();
void on_CameraModeButton_clicked();
void on_actionConvert_DDS_to_TXTR_triggered();
void on_ToggleGridButton_toggled(bool checked);
void Open();
void Import();
void Save();
void SaveAs();
void ConvertToDDS();
void ConvertToTXTR();
void SetMeshPreview();
void SetSpherePreview();
void SetFlatPreview();
void ClearColorChanged(const QColor& rkNewColor);
void ToggleCameraMode();
void ToggleGrid(bool Enabled);
signals:
void Closed();

View File

@ -2396,8 +2396,8 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="ActionOpen"/>
<addaction name="ActionSave"/>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
@ -2412,29 +2412,29 @@
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionSave_as"/>
<addaction name="actionImport"/>
<addaction name="ActionOpen"/>
<addaction name="ActionSave"/>
<addaction name="ActionSaveAs"/>
<addaction name="ActionImport"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
<addaction name="ActionExit"/>
</widget>
<widget class="QMenu" name="menuTextures">
<property name="title">
<string>Textures</string>
</property>
<addaction name="actionConvert_to_DDS"/>
<addaction name="actionConvert_DDS_to_TXTR"/>
<addaction name="ActionConvertToDDS"/>
<addaction name="ActionConvertToTXTR"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuTextures"/>
</widget>
<action name="actionOpen">
<action name="ActionOpen">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="actionExit">
<action name="ActionExit">
<property name="text">
<string>Exit</string>
</property>
@ -2442,32 +2442,32 @@
<string>Esc</string>
</property>
</action>
<action name="actionSave">
<action name="ActionSave">
<property name="text">
<string>Save</string>
</property>
</action>
<action name="actionConvert_to_DDS">
<action name="ActionConvertToDDS">
<property name="text">
<string>Export to DDS</string>
</property>
</action>
<action name="actionExport_curent_model_s_textures">
<action name="ActionExportCurrentModelTextures">
<property name="text">
<string>Export curent model's textures</string>
</property>
</action>
<action name="actionImport">
<action name="ActionImport">
<property name="text">
<string>Import</string>
</property>
</action>
<action name="actionSave_as">
<action name="ActionSaveAs">
<property name="text">
<string>Save as...</string>
</property>
</action>
<action name="actionConvert_DDS_to_TXTR">
<action name="ActionConvertToTXTR">
<property name="text">
<string>Convert DDS to TXTR</string>
</property>
@ -2485,7 +2485,7 @@
<header>Editor/Widgets/WColorPicker.h</header>
<container>1</container>
<slots>
<signal>colorChanged(QColor)</signal>
<signal>ColorChanged(QColor)</signal>
</slots>
</customwidget>
<customwidget>

View File

@ -97,7 +97,7 @@ QWidget* CPropertyDelegate::createEditor(QWidget *pParent, const QStyleOptionVie
case eColorProperty:
{
WColorPicker *pColorPicker = new WColorPicker(pParent);
CONNECT_RELAY(pColorPicker, rkIndex, colorChanged(QColor));
CONNECT_RELAY(pColorPicker, rkIndex, ColorChanged(QColor));
pOut = pColorPicker;
break;
}
@ -265,14 +265,8 @@ void CPropertyDelegate::setEditorData(QWidget *pEditor, const QModelIndex &rkInd
WColorPicker *pColorPicker = static_cast<WColorPicker*>(pEditor);
TColorProperty *pColor = static_cast<TColorProperty*>(pProp);
CColor SrcColor = pColor->Get();
QColor Color;
Color.setRed(SrcColor.R * 255);
Color.setGreen(SrcColor.G * 255);
Color.setBlue(SrcColor.B * 255);
Color.setAlpha(SrcColor.A * 255);
pColorPicker->SetColor(Color);
CColor Color = pColor->Get();
pColorPicker->SetColor(TO_QCOLOR(Color));
break;
}
@ -430,13 +424,8 @@ void CPropertyDelegate::setModelData(QWidget *pEditor, QAbstractItemModel* /*pMo
WColorPicker *pColorPicker = static_cast<WColorPicker*>(pEditor);
TColorProperty *pColor = static_cast<TColorProperty*>(pProp);
QColor SrcColor = pColorPicker->Color();
CColor Color;
Color.R = SrcColor.red() / 255.f;
Color.G = SrcColor.green() / 255.f;
Color.B = SrcColor.blue() / 255.f;
Color.A = SrcColor.alpha() / 255.f;
pColor->Set(Color);
QColor Color = pColorPicker->Color();
pColor->Set(TO_CCOLOR(Color));
break;
}

View File

@ -5,9 +5,11 @@
#include <QMap>
#include <QString>
#define TO_QSTRING(str) UICommon::ToQString(str)
#define TO_TSTRING(str) UICommon::ToTString(str)
#define TO_TWIDESTRING(str) UICommon::ToTWideString(str)
#define TO_QSTRING(Str) UICommon::ToQString(Str)
#define TO_TSTRING(Str) UICommon::ToTString(Str)
#define TO_TWIDESTRING(Str) UICommon::ToTWideString(Str)
#define TO_CCOLOR(Clr) CColor::Integral(Clr.red(), Clr.green(), Clr.blue(), Clr.alpha())
#define TO_QCOLOR(Clr) QColor(Clr.R * 255, Clr.G * 255, Clr.B * 255, Clr.A * 255)
namespace UICommon
{

View File

@ -106,17 +106,39 @@ CWorldEditor::CWorldEditor(QWidget *parent)
connect(ui->TransformSpinBox, SIGNAL(ValueChanged(CVector3f)), this, SLOT(OnTransformSpinBoxModified(CVector3f)));
connect(ui->TransformSpinBox, SIGNAL(EditingDone(CVector3f)), this, SLOT(OnTransformSpinBoxEdited(CVector3f)));
connect(ui->CamSpeedSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnCameraSpeedChange(double)));
connect(ui->ActionLink, SIGNAL(toggled(bool)), this, SLOT(OnLinkButtonToggled(bool)));
connect(ui->ActionUnlink, SIGNAL(triggered()), this, SLOT(OnUnlinkClicked()));
connect(ui->ActionDelete, SIGNAL(triggered()), this, SLOT(DeleteSelection()));
connect(ui->ActionCut, SIGNAL(triggered()), this, SLOT(Cut()));
connect(ui->ActionCopy, SIGNAL(triggered()), this, SLOT(Copy()));
connect(ui->ActionPaste, SIGNAL(triggered()), this, SLOT(Paste()));
connect(qApp->clipboard(), SIGNAL(dataChanged()), this, SLOT(OnClipboardDataModified()));
connect(&mUndoStack, SIGNAL(indexChanged(int)), this, SLOT(OnUndoStackIndexChanged()));
connect(ui->ActionSave, SIGNAL(triggered()), this, SLOT(Save()));
connect(ui->ActionSaveAndRepack, SIGNAL(triggered()), this, SLOT(SaveAndRepack()));
connect(ui->ActionCut, SIGNAL(triggered()), this, SLOT(Cut()));
connect(ui->ActionCopy, SIGNAL(triggered()), this, SLOT(Copy()));
connect(ui->ActionPaste, SIGNAL(triggered()), this, SLOT(Paste()));
connect(ui->ActionDelete, SIGNAL(triggered()), this, SLOT(DeleteSelection()));
connect(ui->ActionSelectAll, SIGNAL(triggered()), this, SLOT(SelectAllTriggered()));
connect(ui->ActionInvertSelection, SIGNAL(triggered()), this, SLOT(InvertSelectionTriggered()));
connect(ui->ActionLink, SIGNAL(toggled(bool)), this, SLOT(OnLinkButtonToggled(bool)));
connect(ui->ActionUnlink, SIGNAL(triggered()), this, SLOT(OnUnlinkClicked()));
connect(ui->ActionDrawWorld, SIGNAL(triggered()), this, SLOT(ToggleDrawWorld()));
connect(ui->ActionDrawObjects, SIGNAL(triggered()), this, SLOT(ToggleDrawObjects()));
connect(ui->ActionDrawCollision, SIGNAL(triggered()), this, SLOT(ToggleDrawCollision()));
connect(ui->ActionDrawObjectCollision, SIGNAL(triggered()), this, SLOT(ToggleDrawObjectCollision()));
connect(ui->ActionDrawLights, SIGNAL(triggered()), this, SLOT(ToggleDrawLights()));
connect(ui->ActionGameMode, SIGNAL(triggered()), this, SLOT(ToggleGameMode()));
connect(ui->ActionDisableBackfaceCull, SIGNAL(triggered()), this, SLOT(ToggleBackfaceCull()));
connect(ui->ActionDisableAlpha, SIGNAL(triggered()), this, SLOT(ToggleDisableAlpha()));
connect(ui->ActionNoLighting, SIGNAL(triggered()), this, SLOT(SetNoLighting()));
connect(ui->ActionBasicLighting, SIGNAL(triggered()), this, SLOT(SetBasicLighting()));
connect(ui->ActionWorldLighting, SIGNAL(triggered()), this, SLOT(SetWorldLighting()));
connect(ui->ActionNoBloom, SIGNAL(triggered()), this, SLOT(SetNoBloom()));
connect(ui->ActionBloomMaps, SIGNAL(triggered()), this, SLOT(SetBloomMaps()));
connect(ui->ActionFakeBloom, SIGNAL(triggered()), this, SLOT(SetFakeBloom()));
connect(ui->ActionBloom, SIGNAL(triggered()), this, SLOT(SetBloom()));
connect(ui->ActionIncrementGizmo, SIGNAL(triggered()), this, SLOT(IncrementGizmo()));
connect(ui->ActionDecrementGizmo, SIGNAL(triggered()), this, SLOT(DecrementGizmo()));
connect(ui->ActionEditLayers, SIGNAL(triggered()), this, SLOT(EditLayers()));
connect(ui->ActionEditPoiToWorldMap, SIGNAL(triggered()), this, SLOT(EditPoiToWorldMap()));
ui->CreateTabEditorProperties->SyncToEditor(this);
ui->ModifyTabEditorProperties->SyncToEditor(this);
@ -189,7 +211,7 @@ void CWorldEditor::SetArea(CWorld *pWorld, CGameArea *pArea)
// Default bloom to Fake Bloom for Metroid Prime 3; disable for other games
bool AllowBloom = (mpWorld->Version() == eCorruptionProto || mpWorld->Version() == eCorruption);
AllowBloom ? on_ActionFakeBloom_triggered() : on_ActionNoBloom_triggered();
AllowBloom ? SetFakeBloom() : SetNoBloom();
ui->menuBloom->setEnabled(AllowBloom);
// Disable EGMC editing for Prime 1 and DKCR
@ -951,33 +973,66 @@ void CWorldEditor::OnClosePoiEditDialog()
ui->MainViewport->SetRenderMergedWorld(true);
}
// These functions are from "Go to slot" in the designer
void CWorldEditor::on_ActionDrawWorld_triggered()
void CWorldEditor::SelectAllTriggered()
{
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
NodeFlags &= ~(eModelNode | eStaticNode | eCollisionNode);
SelectAll(NodeFlags);
}
void CWorldEditor::InvertSelectionTriggered()
{
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
NodeFlags &= ~(eModelNode | eStaticNode | eCollisionNode);
InvertSelection(NodeFlags);
}
void CWorldEditor::ToggleDrawWorld()
{
ui->MainViewport->SetShowWorld(ui->ActionDrawWorld->isChecked());
}
void CWorldEditor::on_ActionDrawCollision_triggered()
{
ui->MainViewport->SetShowFlag(eShowWorldCollision, ui->ActionDrawCollision->isChecked());
}
void CWorldEditor::on_ActionDrawObjects_triggered()
void CWorldEditor::ToggleDrawObjects()
{
ui->MainViewport->SetShowFlag(eShowObjectGeometry, ui->ActionDrawObjects->isChecked());
}
void CWorldEditor::on_ActionDrawLights_triggered()
void CWorldEditor::ToggleDrawCollision()
{
ui->MainViewport->SetShowFlag(eShowWorldCollision, ui->ActionDrawCollision->isChecked());
}
void CWorldEditor::ToggleDrawObjectCollision()
{
ui->MainViewport->SetShowFlag(eShowObjectCollision, ui->ActionDrawObjectCollision->isChecked());
}
void CWorldEditor::ToggleDrawLights()
{
ui->MainViewport->SetShowFlag(eShowLights, ui->ActionDrawLights->isChecked());
}
void CWorldEditor::on_ActionDrawSky_triggered()
void CWorldEditor::ToggleDrawSky()
{
ui->MainViewport->SetShowFlag(eShowSky, ui->ActionDrawSky->isChecked());
}
void CWorldEditor::on_ActionNoLighting_triggered()
void CWorldEditor::ToggleGameMode()
{
ui->MainViewport->SetGameMode(ui->ActionGameMode->isChecked());
}
void CWorldEditor::ToggleBackfaceCull()
{
ui->MainViewport->Renderer()->ToggleBackfaceCull(!ui->ActionDisableBackfaceCull->isChecked());
}
void CWorldEditor::ToggleDisableAlpha()
{
ui->MainViewport->Renderer()->ToggleAlphaDisabled(ui->ActionDisableAlpha->isChecked());
}
void CWorldEditor::SetNoLighting()
{
CGraphics::sLightMode = CGraphics::eNoLighting;
ui->ActionNoLighting->setChecked(true);
@ -985,7 +1040,7 @@ void CWorldEditor::on_ActionNoLighting_triggered()
ui->ActionWorldLighting->setChecked(false);
}
void CWorldEditor::on_ActionBasicLighting_triggered()
void CWorldEditor::SetBasicLighting()
{
CGraphics::sLightMode = CGraphics::eBasicLighting;
ui->ActionNoLighting->setChecked(false);
@ -993,7 +1048,7 @@ void CWorldEditor::on_ActionBasicLighting_triggered()
ui->ActionWorldLighting->setChecked(false);
}
void CWorldEditor::on_ActionWorldLighting_triggered()
void CWorldEditor::SetWorldLighting()
{
CGraphics::sLightMode = CGraphics::eWorldLighting;
ui->ActionNoLighting->setChecked(false);
@ -1001,7 +1056,7 @@ void CWorldEditor::on_ActionWorldLighting_triggered()
ui->ActionWorldLighting->setChecked(true);
}
void CWorldEditor::on_ActionNoBloom_triggered()
void CWorldEditor::SetNoBloom()
{
ui->MainViewport->Renderer()->SetBloom(CRenderer::eNoBloom);
ui->ActionNoBloom->setChecked(true);
@ -1010,7 +1065,7 @@ void CWorldEditor::on_ActionNoBloom_triggered()
ui->ActionBloom->setChecked(false);
}
void CWorldEditor::on_ActionBloomMaps_triggered()
void CWorldEditor::SetBloomMaps()
{
ui->MainViewport->Renderer()->SetBloom(CRenderer::eBloomMaps);
ui->ActionNoBloom->setChecked(false);
@ -1019,7 +1074,7 @@ void CWorldEditor::on_ActionBloomMaps_triggered()
ui->ActionBloom->setChecked(false);
}
void CWorldEditor::on_ActionFakeBloom_triggered()
void CWorldEditor::SetFakeBloom()
{
ui->MainViewport->Renderer()->SetBloom(CRenderer::eFakeBloom);
ui->ActionNoBloom->setChecked(false);
@ -1028,7 +1083,7 @@ void CWorldEditor::on_ActionFakeBloom_triggered()
ui->ActionBloom->setChecked(false);
}
void CWorldEditor::on_ActionBloom_triggered()
void CWorldEditor::SetBloom()
{
ui->MainViewport->Renderer()->SetBloom(CRenderer::eBloom);
ui->ActionNoBloom->setChecked(false);
@ -1037,17 +1092,17 @@ void CWorldEditor::on_ActionBloom_triggered()
ui->ActionBloom->setChecked(true);
}
void CWorldEditor::on_ActionDisableBackfaceCull_triggered()
void CWorldEditor::IncrementGizmo()
{
ui->MainViewport->Renderer()->ToggleBackfaceCull(!ui->ActionDisableBackfaceCull->isChecked());
mGizmo.IncrementSize();
}
void CWorldEditor::on_ActionDisableAlpha_triggered()
void CWorldEditor::DecrementGizmo()
{
ui->MainViewport->Renderer()->ToggleAlphaDisabled(ui->ActionDisableAlpha->isChecked());
mGizmo.DecrementSize();
}
void CWorldEditor::on_ActionEditLayers_triggered()
void CWorldEditor::EditLayers()
{
// Launch layer editor
CLayerEditor Editor(this);
@ -1055,41 +1110,7 @@ void CWorldEditor::on_ActionEditLayers_triggered()
Editor.exec();
}
void CWorldEditor::on_ActionIncrementGizmo_triggered()
{
mGizmo.IncrementSize();
}
void CWorldEditor::on_ActionDecrementGizmo_triggered()
{
mGizmo.DecrementSize();
}
void CWorldEditor::on_ActionDrawObjectCollision_triggered()
{
ui->MainViewport->SetShowFlag(eShowObjectCollision, ui->ActionDrawObjectCollision->isChecked());
}
void CWorldEditor::on_ActionGameMode_triggered()
{
ui->MainViewport->SetGameMode(ui->ActionGameMode->isChecked());
}
void CWorldEditor::on_ActionSelectAll_triggered()
{
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
NodeFlags &= ~(eModelNode | eStaticNode | eCollisionNode);
SelectAll(NodeFlags);
}
void CWorldEditor::on_ActionInvertSelection_triggered()
{
FNodeFlags NodeFlags = CScene::NodeFlagsForShowFlags(ui->MainViewport->ShowFlags());
NodeFlags &= ~(eModelNode | eStaticNode | eCollisionNode);
InvertSelection(NodeFlags);
}
void CWorldEditor::on_ActionEditPoiToWorldMap_triggered()
void CWorldEditor::EditPoiToWorldMap()
{
if (!mpPoiDialog)
{

View File

@ -111,28 +111,29 @@ private slots:
void OnTransformSpinBoxModified(CVector3f Value);
void OnTransformSpinBoxEdited(CVector3f Value);
void OnClosePoiEditDialog();
void on_ActionDrawWorld_triggered();
void on_ActionDrawCollision_triggered();
void on_ActionDrawObjects_triggered();
void on_ActionDrawLights_triggered();
void on_ActionDrawSky_triggered();
void on_ActionNoLighting_triggered();
void on_ActionBasicLighting_triggered();
void on_ActionWorldLighting_triggered();
void on_ActionNoBloom_triggered();
void on_ActionBloomMaps_triggered();
void on_ActionFakeBloom_triggered();
void on_ActionBloom_triggered();
void on_ActionDisableBackfaceCull_triggered();
void on_ActionDisableAlpha_triggered();
void on_ActionEditLayers_triggered();
void on_ActionIncrementGizmo_triggered();
void on_ActionDecrementGizmo_triggered();
void on_ActionDrawObjectCollision_triggered();
void on_ActionGameMode_triggered();
void on_ActionSelectAll_triggered();
void on_ActionInvertSelection_triggered();
void on_ActionEditPoiToWorldMap_triggered();
void SelectAllTriggered();
void InvertSelectionTriggered();
void ToggleDrawWorld();
void ToggleDrawObjects();
void ToggleDrawCollision();
void ToggleDrawObjectCollision();
void ToggleDrawLights();
void ToggleDrawSky();
void ToggleGameMode();
void ToggleBackfaceCull();
void ToggleDisableAlpha();
void SetNoLighting();
void SetBasicLighting();
void SetWorldLighting();
void SetNoBloom();
void SetBloomMaps();
void SetFakeBloom();
void SetBloom();
void IncrementGizmo();
void DecrementGizmo();
void EditLayers();
void EditPoiToWorldMap();
signals:
void Closed();