- added the ability to hold CTRL when adding particle types to add instead of replace
This commit is contained in:
parent
87a1eee48d
commit
4d1593a503
|
@ -9,6 +9,7 @@
|
|||
#include "platform_common.h"
|
||||
#include "xml_parser.h"
|
||||
#include <iostream>
|
||||
#include <wx/event.h>
|
||||
|
||||
using namespace Shared::Platform;
|
||||
using namespace Shared::PlatformCommon;
|
||||
|
@ -74,6 +75,7 @@ MainWindow::MainWindow(const string &modelPath)
|
|||
menuFile->Append(miFileLoad, wxT("Load"));
|
||||
menuFile->Append(miFileLoadParticleXML, wxT("Load Particle XML"));
|
||||
menuFile->Append(miFileLoadProjectileParticleXML, wxT("Load Projectile Particle XML"));
|
||||
menuFile->Append(miFileClearAll, wxT("Clear All"));
|
||||
menu->Append(menuFile, wxT("File"));
|
||||
|
||||
//mode
|
||||
|
@ -208,6 +210,30 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::onMenuFileClearAll(wxCommandEvent &event){
|
||||
modelPathList.clear();
|
||||
particlePathList.clear();
|
||||
particleProjectilePathList.clear();
|
||||
|
||||
timer->Stop();
|
||||
renderer->end();
|
||||
|
||||
unitParticleSystems.clear();
|
||||
unitParticleSystemTypes.clear();
|
||||
|
||||
projectileParticleSystems.clear();
|
||||
projectileParticleSystemTypes.clear();
|
||||
|
||||
delete model;
|
||||
model = NULL;
|
||||
|
||||
loadModel("");
|
||||
loadParticle("");
|
||||
loadProjectileParticle("");
|
||||
|
||||
timer->Start(100);
|
||||
}
|
||||
|
||||
void MainWindow::loadModel(string path) {
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
this->modelPathList.push_back(path);
|
||||
|
@ -216,17 +242,30 @@ void MainWindow::loadModel(string path) {
|
|||
for(int idx =0; idx < this->modelPathList.size(); idx++) {
|
||||
string modelPath = this->modelPathList[idx];
|
||||
|
||||
//this->modelPath = path;
|
||||
timer->Stop();
|
||||
delete model;
|
||||
Model *tmpModel= new ModelGl();
|
||||
renderer->loadTheModel(tmpModel, modelPath);
|
||||
model= tmpModel;
|
||||
GetStatusBar()->SetStatusText(ToUnicode(getModelInfo().c_str()));
|
||||
timer->Start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::loadParticle(string path) {
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
timer->Stop();
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
this->particlePathList.push_back(path);
|
||||
}
|
||||
else {
|
||||
this->particlePathList.clear();
|
||||
renderer->end();
|
||||
|
||||
unitParticleSystems.clear();
|
||||
unitParticleSystemTypes.clear();
|
||||
|
||||
this->particlePathList.push_back(path);
|
||||
}
|
||||
|
||||
|
@ -285,12 +324,30 @@ void MainWindow::loadParticle(string path) {
|
|||
renderer->initTextureManager();
|
||||
}
|
||||
}
|
||||
|
||||
timer->Start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::loadProjectileParticle(string path) {
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
timer->Stop();
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
this->particleProjectilePathList.push_back(path);
|
||||
}
|
||||
else {
|
||||
this->particleProjectilePathList.clear();
|
||||
|
||||
renderer->end();
|
||||
|
||||
projectileParticleSystems.clear();
|
||||
projectileParticleSystemTypes.clear();
|
||||
|
||||
this->particleProjectilePathList.push_back(path);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(this->particleProjectilePathList.size() > 0) {
|
||||
renderer->initModelManager();
|
||||
|
@ -367,6 +424,8 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||
renderer->initTextureManager();
|
||||
}
|
||||
}
|
||||
timer->Start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onMenuModeNormals(wxCommandEvent &event){
|
||||
|
@ -448,6 +507,13 @@ string MainWindow::getModelInfo(){
|
|||
}
|
||||
|
||||
void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||
if(e.ControlDown() == true) {
|
||||
isControlKeyPressed = true;
|
||||
}
|
||||
else {
|
||||
isControlKeyPressed = false;
|
||||
}
|
||||
|
||||
/*
|
||||
if (currentBrush == btHeight || currentBrush == btGradient) { // 'height' brush
|
||||
if (e.GetKeyCode() >= '0' && e.GetKeyCode() <= '5') {
|
||||
|
@ -541,22 +607,15 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
|||
if (e.GetKeyCode() == 'R') {
|
||||
renderer->end();
|
||||
|
||||
for(int idx = 0; idx < unitParticleSystems.size(); ++idx) {
|
||||
//UnitParticleSystem *ups = unitParticleSystems[idx];
|
||||
//delete ups;
|
||||
//ups = NULL;
|
||||
}
|
||||
unitParticleSystems.clear();
|
||||
|
||||
for(int idx = 0; idx < unitParticleSystemTypes.size(); ++idx) {
|
||||
//UnitParticleSystemType *unitParticleSystemType = unitParticleSystemTypes[idx];
|
||||
//delete unitParticleSystemType;
|
||||
//unitParticleSystemType = NULL;
|
||||
}
|
||||
unitParticleSystemTypes.clear();
|
||||
|
||||
projectileParticleSystems.clear();
|
||||
projectileParticleSystemTypes.clear();
|
||||
|
||||
loadModel("");
|
||||
loadParticle("");
|
||||
loadProjectileParticle("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,6 +625,7 @@ BEGIN_EVENT_TABLE(MainWindow, wxFrame)
|
|||
EVT_MENU(miFileLoad, MainWindow::onMenuFileLoad)
|
||||
EVT_MENU(miFileLoadParticleXML, MainWindow::onMenuFileLoadParticleXML)
|
||||
EVT_MENU(miFileLoadProjectileParticleXML, MainWindow::onMenuFileLoadProjectileParticleXML)
|
||||
EVT_MENU(miFileClearAll, MainWindow::onMenuFileClearAll)
|
||||
|
||||
EVT_MENU(miModeWireframe, MainWindow::onMenuModeWireframe)
|
||||
EVT_MENU(miModeNormals, MainWindow::onMenuModeNormals)
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
miFileLoad,
|
||||
miFileLoadParticleXML,
|
||||
miFileLoadProjectileParticleXML,
|
||||
miFileClearAll,
|
||||
miModeWireframe,
|
||||
miModeNormals,
|
||||
miModeGrid,
|
||||
|
@ -59,8 +60,6 @@ private:
|
|||
|
||||
Model *model;
|
||||
|
||||
//string modelPath;
|
||||
//string ParticlePath;
|
||||
std::vector<string> modelPathList;
|
||||
std::vector<string> particlePathList;
|
||||
std::vector<string> particleProjectilePathList;
|
||||
|
@ -77,6 +76,7 @@ private:
|
|||
std::vector<ParticleSystemTypeProjectile *> projectileParticleSystemTypes;
|
||||
std::vector<ProjectileParticleSystem *> projectileParticleSystems;
|
||||
|
||||
bool isControlKeyPressed;
|
||||
void loadModel(string path);
|
||||
void loadParticle(string path);
|
||||
void loadProjectileParticle(string path);
|
||||
|
@ -93,6 +93,7 @@ public:
|
|||
void onMenuFileLoad(wxCommandEvent &event);
|
||||
void onMenuFileLoadParticleXML(wxCommandEvent &event);
|
||||
void onMenuFileLoadProjectileParticleXML(wxCommandEvent &event);
|
||||
void onMenuFileClearAll(wxCommandEvent &event);
|
||||
void onMenuModeNormals(wxCommandEvent &event);
|
||||
void onMenuModeWireframe(wxCommandEvent &event);
|
||||
void onMenuModeGrid(wxCommandEvent &event);
|
||||
|
|
Loading…
Reference in New Issue
Block a user