Browse Source

Adjust `GridWarpSurface` commands to not go less than 2 rows and cols

master
Krisjanis Rijnieks 9 years ago
parent
commit
72b0053e88
  1. 4
      src/Application/ProjectionMappingState.cpp
  2. 2
      src/Commands/RmGridColCmd.cpp
  3. 2
      src/Commands/RmGridRowCmd.cpp

4
src/Application/ProjectionMappingState.cpp

@ -83,7 +83,7 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
if(((GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface())->getGridRows() > 1){
if(((GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface())->getGridRows() > 2){
// TODO: The command should not require projection editor pointer
app->getCmdManager()->exec(
new RmGridRowCmd(
@ -111,7 +111,7 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::GRID_WARP_SURFACE){
if(((GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface())->getGridCols() > 1){
if(((GridWarpSurface *)app->getSurfaceManager()->getSelectedSurface())->getGridCols() > 2){
// TODO: The command should not require projection editor pointer
app->getCmdManager()->exec(
new RmGridColCmd(

2
src/Commands/RmGridColCmd.cpp

@ -12,7 +12,7 @@ void RmGridColCmd::exec(){
// TODO: Figure out nice math to not loose existing vertex positions
if(_surface->getGridCols() > 1){
if(_surface->getGridCols() > 2){
_vertices = _surface->getVertices();
_texCoords = _surface->getTexCoords();
_surface->setGridCols(_surface->getGridCols() - 1);

2
src/Commands/RmGridRowCmd.cpp

@ -12,7 +12,7 @@ void RmGridRowCmd::exec(){
// TODO: Figure out nice math to not loose existing vertex positions
if(_surface->getGridRows() > 1){
if(_surface->getGridRows() > 2){
_vertices = _surface->getVertices();
_texCoords = _surface->getTexCoords();
_surface->setGridRows(_surface->getGridRows() - 1);

Loading…
Cancel
Save