Browse Source

Add tex coord polling in case texture not loaded yet

master
Krisjanis Rijnieks 9 years ago
parent
commit
21533b6b90
  1. 14
      src/Gui/Widgets/TextureEditorWidget.cpp
  2. 2
      src/Gui/Widgets/TextureEditorWidget.h

14
src/Gui/Widgets/TextureEditorWidget.cpp

@ -4,6 +4,8 @@ namespace ofx {
namespace piMapper {
TextureEditorWidget::TextureEditorWidget(){
_pollCreateJoints = false;
clear();
}
@ -15,6 +17,10 @@ void TextureEditorWidget::update(){
if(surface == 0){
return;
}
if(_pollCreateJoints){
createJoints();
}
// update surface if one of the joints is being dragged
ofVec2f textureSize = ofVec2f(surface->getSource()->getTexture()->getWidth(),
@ -127,6 +133,14 @@ void TextureEditorWidget::createJoints(){
}
clearJoints();
vector <ofVec2f> & texCoords = surface->getTexCoords();
if(surface->getSource()->getTexture()->isAllocated()){
_pollCreateJoints = false;
}else{
_pollCreateJoints = true;
return;
}
ofVec2f textureSize = ofVec2f(surface->getSource()->getTexture()->getWidth(),
surface->getSource()->getTexture()->getHeight());

2
src/Gui/Widgets/TextureEditorWidget.h

@ -50,7 +50,9 @@ class TextureEditorWidget : public GuiBaseWidget {
private:
BaseSurface * surface;
vector <CircleJoint *> joints;
bool bShiftKeyDown;
bool _pollCreateJoints;
};

Loading…
Cancel
Save