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