Browse Source

Replace TextureMappingMode::moveSelection with moveSelectedTexCoord()

master
Krisjanis Rijnieks 8 years ago
parent
commit
48b4153afd
  1. 32
      src/Application/Modes/TextureMappingMode.cpp
  2. 2
      src/Application/Modes/TextureMappingMode.h

32
src/Application/Modes/TextureMappingMode.cpp

@ -85,27 +85,19 @@ void TextureMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & args){
switch(args.key){ switch(args.key){
case OF_KEY_LEFT: case OF_KEY_LEFT:
if(app->getSurfaceManager()->getSelectedSurface() != 0){ moveSelectedTexCoord(app, ofVec2f(-moveStep, 0.0f));
moveSelection(app, ofVec2f(-moveStep, 0.0f));
}
break; break;
case OF_KEY_RIGHT: case OF_KEY_RIGHT:
if(app->getSurfaceManager()->getSelectedSurface() != 0){ moveSelectedTexCoord(app, ofVec2f(moveStep, 0.0f));
moveSelection(app, ofVec2f(moveStep, 0.0f));
}
break; break;
case OF_KEY_UP: case OF_KEY_UP:
if(app->getSurfaceManager()->getSelectedSurface() != 0){ moveSelectedTexCoord(app, ofVec2f(0.0f, -moveStep));
moveSelection(app, ofVec2f(0.0f, -moveStep));
}
break; break;
case OF_KEY_DOWN: case OF_KEY_DOWN:
if(app->getSurfaceManager()->getSelectedSurface() != 0){ moveSelectedTexCoord(app, ofVec2f(0.0f, moveStep));
moveSelection(app, ofVec2f(0.0f, moveStep));
}
break; break;
case '>': case '>':
@ -279,18 +271,10 @@ void TextureMappingMode::drawTexture(Application * app){
} }
} }
void TextureMappingMode::moveSelection(Application * app, ofVec2f by){ void TextureMappingMode::moveSelectedTexCoord(Application * app, ofVec2f by){
int selectedTexCoord = Gui::instance()->getTextureEditorWidget().getSelectedTexCoord(); if(app->getSurfaceManager()->getSelectedSurface() != 0){
int selectedTexCoord = Gui::instance()->getTextureEditorWidget().getSelectedTexCoord();
if(selectedTexCoord >= 0){ app->moveTexCoord(selectedTexCoord, by);
app->getCmdManager()->exec(
new MvTexCoordCmd(selectedTexCoord, by));
}else{
app->getCmdManager()->exec(new MvAllTexCoordsCmd(
app->getSurfaceManager()->getSelectedSurface(),
&Gui::instance()->getTextureEditorWidget()));
Gui::instance()->getTextureEditorWidget().moveSelection(by);
} }
} }

2
src/Application/Modes/TextureMappingMode.h

@ -34,7 +34,7 @@ class TextureMappingMode : public ApplicationBaseMode {
void onGuiEvent(Application * app, GuiEvent & e){} void onGuiEvent(Application * app, GuiEvent & e){}
void drawTexture(Application * app); void drawTexture(Application * app);
void moveSelection(Application * app, ofVec2f by); void moveSelectedTexCoord(Application * app, ofVec2f by);
void selectNextVertex(Application * app); void selectNextVertex(Application * app);
void selectPrevVertex(Application * app); void selectPrevVertex(Application * app);

Loading…
Cancel
Save