5 changed files with 73 additions and 1 deletions
@ -0,0 +1,27 @@ |
|||||
|
#include "MvAllTexCoordsCmd.h" |
||||
|
|
||||
|
namespace ofx{ |
||||
|
namespace piMapper{ |
||||
|
|
||||
|
MvAllTexCoordsCmd::MvAllTexCoordsCmd(BaseSurface * surface, TextureEditor * texEditor){ |
||||
|
_surface = surface; |
||||
|
_texEditor = texEditor; |
||||
|
} |
||||
|
|
||||
|
void MvAllTexCoordsCmd::exec(){ |
||||
|
ofLogNotice("MvAllTexCoordsCmd", "exec"); |
||||
|
_texCoords = _surface->getTexCoords(); |
||||
|
} |
||||
|
|
||||
|
void MvAllTexCoordsCmd::undo(){ |
||||
|
ofLogNotice("MvAllTexCoordsCmd", "undo"); |
||||
|
ofVec2f dist = _texCoords[0] - _surface->getTexCoords()[0]; |
||||
|
dist.x = _surface->getSource()->getTexture()->getWidth() * dist.x; |
||||
|
dist.y = _surface->getSource()->getTexture()->getHeight() * dist.y; |
||||
|
_texEditor->moveTexCoords(dist); |
||||
|
_surface = 0; |
||||
|
} |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
||||
|
|
@ -0,0 +1,29 @@ |
|||||
|
// MvAllTexCoordsCmd
|
||||
|
// Move all texture coordinates of a selected surface undoable command
|
||||
|
// Created by Krisjanis Rijnieks 2015-05-15
|
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include "BaseCmd.h" |
||||
|
#include "BaseSurface.h" |
||||
|
#include "TextureEditor.h" |
||||
|
|
||||
|
namespace ofx{ |
||||
|
namespace piMapper{ |
||||
|
|
||||
|
class MvAllTexCoordsCmd : public BaseUndoCmd{ |
||||
|
|
||||
|
public: |
||||
|
MvAllTexCoordsCmd(BaseSurface * surface, TextureEditor * texEditor); |
||||
|
void exec(); |
||||
|
void undo(); |
||||
|
|
||||
|
private: |
||||
|
vector<ofVec2f> _texCoords; |
||||
|
BaseSurface * _surface; |
||||
|
TextureEditor * _texEditor; |
||||
|
}; |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
||||
|
|
Loading…
Reference in new issue