From 3d75763382da6fba4bcc58c91a99a2934b6ebb9f Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sat, 7 Jan 2017 20:51:48 +0100 Subject: [PATCH] Connect ofxPiMapper::selectNext and PrevVertex to TextureMappingMode --- src/Application/Modes/TextureMappingMode.cpp | 28 +++++++++++++------- src/Application/Modes/TextureMappingMode.h | 2 ++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Application/Modes/TextureMappingMode.cpp b/src/Application/Modes/TextureMappingMode.cpp index 765cb3e..1bcbb58 100644 --- a/src/Application/Modes/TextureMappingMode.cpp +++ b/src/Application/Modes/TextureMappingMode.cpp @@ -113,19 +113,11 @@ void TextureMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & args){ break; case '>': - if(app->getSurfaceManager()->getSelectedSurface() == 0){ - return; - } - app->getCmdManager()->exec( - new SelNextTexCoordCmd(&Gui::instance()->getTextureEditorWidget())); + selectNextVertex(app); break; case '<': - if(app->getSurfaceManager()->getSelectedSurface() == 0){ - return; - } - app->getCmdManager()->exec( - new SelPrevTexCoordCmd(&Gui::instance()->getTextureEditorWidget())); + selectPrevVertex(app); break; case ' ': @@ -322,6 +314,22 @@ void TextureMappingMode::moveSelection(Application * app, ofVec2f by){ } } +void TextureMappingMode::selectNextVertex(Application * app){ + if(app->getSurfaceManager()->getSelectedSurface() != 0){ + app->getCmdManager()->exec( + new SelNextTexCoordCmd( + &Gui::instance()->getTextureEditorWidget())); + } +} + +void TextureMappingMode::selectPrevVertex(Application * app){ + if(app->getSurfaceManager()->getSelectedSurface() != 0){ + app->getCmdManager()->exec( + new SelPrevTexCoordCmd( + &Gui::instance()->getTextureEditorWidget())); + } +} + ofPoint TextureMappingMode::getTranslation(){ return _canvasTranslate; } diff --git a/src/Application/Modes/TextureMappingMode.h b/src/Application/Modes/TextureMappingMode.h index 8a537ca..c5c9792 100644 --- a/src/Application/Modes/TextureMappingMode.h +++ b/src/Application/Modes/TextureMappingMode.h @@ -39,6 +39,8 @@ class TextureMappingMode : public ApplicationBaseMode { void drawTexture(Application * app); void moveSelection(Application * app, ofVec2f by); + void selectNextVertex(Application * app); + void selectPrevVertex(Application * app); void setTranslation(ofPoint p); void setDrawMode(int m);