From 21533b6b90e724a72891418b607862a61dd31b1d Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Tue, 8 Nov 2016 17:51:23 +0100 Subject: [PATCH] Add tex coord polling in case texture not loaded yet --- src/Gui/Widgets/TextureEditorWidget.cpp | 14 ++++++++++++++ src/Gui/Widgets/TextureEditorWidget.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/Gui/Widgets/TextureEditorWidget.cpp b/src/Gui/Widgets/TextureEditorWidget.cpp index 2f0a3c0..6ce0a88 100644 --- a/src/Gui/Widgets/TextureEditorWidget.cpp +++ b/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 & 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()); diff --git a/src/Gui/Widgets/TextureEditorWidget.h b/src/Gui/Widgets/TextureEditorWidget.h index 2495ad6..ded19a8 100644 --- a/src/Gui/Widgets/TextureEditorWidget.h +++ b/src/Gui/Widgets/TextureEditorWidget.h @@ -50,7 +50,9 @@ class TextureEditorWidget : public GuiBaseWidget { private: BaseSurface * surface; vector joints; + bool bShiftKeyDown; + bool _pollCreateJoints; };