From 6c4748e458fd8b63262c0f35e5a1ef8fa5d5b32b Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Mon, 18 Jan 2016 19:38:59 +0100 Subject: [PATCH] Integrate `TogglePerspectiveCmd` into `ProjectionMappingState` By hitting `p` while in the projection mapping editor, selected surface toggles perspective on and off --- src/Application/ProjectionMappingState.cpp | 14 ++++++++++++++ src/Application/ProjectionMappingState.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/Application/ProjectionMappingState.cpp b/src/Application/ProjectionMappingState.cpp index eda917b..f65413b 100644 --- a/src/Application/ProjectionMappingState.cpp +++ b/src/Application/ProjectionMappingState.cpp @@ -37,6 +37,20 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar app->getOfxPiMapper()->getCmdManager()->exec( new RmSurfaceCmd(app->getOfxPiMapper())); break; + + case 'p': + if(app->getOfxPiMapper()->getSurfaceManager()->getSelectedSurface() == 0){ + break; + } + + if(app->getOfxPiMapper()->getSurfaceManager()->getSelectedSurface()->getType() == + SurfaceType::QUAD_SURFACE){ + + app->getOfxPiMapper()->getCmdManager()->exec( + new TogglePerspectiveCmd( + (QuadSurface *)app->getOfxPiMapper()->getSurfaceManager()->getSelectedSurface() ) ); + } + break; default: break; diff --git a/src/Application/ProjectionMappingState.h b/src/Application/ProjectionMappingState.h index b406a49..1d7ec42 100644 --- a/src/Application/ProjectionMappingState.h +++ b/src/Application/ProjectionMappingState.h @@ -5,6 +5,7 @@ #include "ofLog.h" #include "ofGraphics.h" #include "AddSurfaceCmd.h" +#include "TogglePerspectiveCmd.h" #include "SurfaceType.h" namespace ofx {