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