mirror of
https://github.com/glest/glest-source.git
synced 2025-09-01 12:02:36 +02:00
- bugfixes for usage of 3D viewer (adding and clearing selections)
This commit is contained in:
@@ -184,6 +184,9 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
||||
string fileName;
|
||||
wxFileDialog fileDialog(this);
|
||||
fileDialog.SetWildcard(wxT("G3D files (*.g3d)|*.g3d"));
|
||||
|
||||
fileDialog.SetMessage(wxT("Selecting Glest Model for current view."));
|
||||
|
||||
if(fileDialog.ShowModal()==wxID_OK){
|
||||
modelPathList.clear();
|
||||
loadModel((const char*)wxFNCONV(fileDialog.GetPath().c_str()));
|
||||
@@ -194,6 +197,14 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||
string fileName;
|
||||
wxFileDialog fileDialog(this);
|
||||
fileDialog.SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
fileDialog.SetMessage(wxT("Adding Mega-Glest particle to current view."));
|
||||
}
|
||||
else {
|
||||
fileDialog.SetMessage(wxT("Selecting Mega-Glest particle for current view."));
|
||||
}
|
||||
|
||||
if(fileDialog.ShowModal()==wxID_OK){
|
||||
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
||||
loadParticle(path);
|
||||
@@ -204,6 +215,14 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||
string fileName;
|
||||
wxFileDialog fileDialog(this);
|
||||
fileDialog.SetWildcard(wxT("XML files (*.xml)|*.xml"));
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
fileDialog.SetMessage(wxT("Adding Mega-Glest projectile particle to current view."));
|
||||
}
|
||||
else {
|
||||
fileDialog.SetMessage(wxT("Selecting Mega-Glest projectile particle for current view."));
|
||||
}
|
||||
|
||||
if(fileDialog.ShowModal()==wxID_OK){
|
||||
string path = (const char*)wxFNCONV(fileDialog.GetPath().c_str());
|
||||
loadProjectileParticle(path);
|
||||
@@ -253,25 +272,24 @@ void MainWindow::loadModel(string path) {
|
||||
}
|
||||
|
||||
void MainWindow::loadParticle(string path) {
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
timer->Stop();
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
this->particlePathList.push_back(path);
|
||||
}
|
||||
else {
|
||||
this->particlePathList.clear();
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->end();
|
||||
|
||||
unitParticleSystems.clear();
|
||||
unitParticleSystemTypes.clear();
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
std::cout << "Adding to list..." << std::endl;
|
||||
this->particlePathList.push_back(path);
|
||||
}
|
||||
else {
|
||||
std::cout << "Clearing list..." << std::endl;
|
||||
this->particlePathList.clear();
|
||||
this->particlePathList.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
if(this->particlePathList.size() > 0) {
|
||||
renderer->initModelManager();
|
||||
|
||||
for(int idx = 0; idx < this->particlePathList.size(); idx++) {
|
||||
string particlePath = this->particlePathList[idx];
|
||||
string dir= extractDirectoryPathFromFile(particlePath);
|
||||
@@ -321,36 +339,35 @@ void MainWindow::loadParticle(string path) {
|
||||
ups->setVisible(true);
|
||||
}
|
||||
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->initModelManager();
|
||||
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();
|
||||
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->end();
|
||||
|
||||
projectileParticleSystems.clear();
|
||||
projectileParticleSystemTypes.clear();
|
||||
|
||||
if(isControlKeyPressed == true) {
|
||||
std::cout << "Adding to list..." << std::endl;
|
||||
this->particleProjectilePathList.push_back(path);
|
||||
|
||||
}
|
||||
else {
|
||||
std::cout << "Clearing list..." << std::endl;
|
||||
this->particleProjectilePathList.clear();
|
||||
this->particleProjectilePathList.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(this->particleProjectilePathList.size() > 0) {
|
||||
renderer->initModelManager();
|
||||
|
||||
for(int idx = 0; idx < this->particleProjectilePathList.size(); idx++) {
|
||||
string particlePath = this->particleProjectilePathList[idx];
|
||||
@@ -420,12 +437,14 @@ void MainWindow::loadProjectileParticle(string path) {
|
||||
//psProj->setFactionColor(unit->getFaction()->getTexture()->getPixmap()->getPixel3f(0,0));
|
||||
//renderer.manageParticleSystem(psProj, rsGame);
|
||||
}
|
||||
}
|
||||
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->initModelManager();
|
||||
renderer->initTextureManager();
|
||||
}
|
||||
}
|
||||
timer->Start(100);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onMenuModeNormals(wxCommandEvent &event){
|
||||
@@ -507,13 +526,18 @@ string MainWindow::getModelInfo(){
|
||||
}
|
||||
|
||||
void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||
if(e.ControlDown() == true) {
|
||||
|
||||
std::cout << "e.ControlDown() = " << e.ControlDown() << " e.GetKeyCode() = " << e.GetKeyCode() << " isCtrl = " << (e.GetKeyCode() == WXK_CONTROL) << std::endl;
|
||||
|
||||
if(e.ControlDown() == true || e.GetKeyCode() == WXK_CONTROL) {
|
||||
isControlKeyPressed = true;
|
||||
}
|
||||
else {
|
||||
isControlKeyPressed = false;
|
||||
}
|
||||
|
||||
std::cout << "isControlKeyPressed = " << isControlKeyPressed << std::endl;
|
||||
|
||||
/*
|
||||
if (currentBrush == btHeight || currentBrush == btGradient) { // 'height' brush
|
||||
if (e.GetKeyCode() >= '0' && e.GetKeyCode() <= '5') {
|
||||
@@ -605,8 +629,13 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||
*/
|
||||
|
||||
if (e.GetKeyCode() == 'R') {
|
||||
|
||||
std::cout << "pressed R..." << std::endl;
|
||||
|
||||
renderer->end();
|
||||
|
||||
//renderer->end();
|
||||
|
||||
unitParticleSystems.clear();
|
||||
unitParticleSystemTypes.clear();
|
||||
|
||||
@@ -616,6 +645,9 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||
loadModel("");
|
||||
loadParticle("");
|
||||
loadProjectileParticle("");
|
||||
|
||||
renderer->initModelManager();
|
||||
renderer->initTextureManager();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user