Browse Source

Fix joints not redrawn on new surface selection while in projection editor

master
Krisjanis Rijnieks 11 years ago
parent
commit
7c26399452
  1. 12
      src/ofxProjectionEditor.cpp
  2. 1
      src/ofxProjectionEditor.h
  3. 3
      src/ofxSurfaceManager.cpp

12
src/ofxProjectionEditor.cpp

@ -13,16 +13,19 @@ ofxProjectionEditor::~ofxProjectionEditor()
surfaceManager = NULL;
unregisterAppEvents();
unregisterMouseEvents();
}
void ofxProjectionEditor::registerAppEvents()
{
ofAddListener(ofEvents().update, this, &ofxProjectionEditor::update);
ofAddListener(ofEvents().messageEvent, this, &ofxProjectionEditor::gotMessage);
}
void ofxProjectionEditor::unregisterAppEvents()
{
ofRemoveListener(ofEvents().update, this, &ofxProjectionEditor::update);
ofRemoveListener(ofEvents().messageEvent, this, &ofxProjectionEditor::gotMessage);
}
void ofxProjectionEditor::registerMouseEvents()
@ -60,6 +63,15 @@ void ofxProjectionEditor::mouseDragged(ofMouseEventArgs &args)
//
}
void ofxProjectionEditor::gotMessage(ofMessage& msg)
{
if (msg.message == "surfaceSelected") {
// refresh gui
clearJoints();
createJoints();
}
}
void ofxProjectionEditor::setSurfaceManager(ofxSurfaceManager *newSurfaceManager)
{
surfaceManager = newSurfaceManager;

1
src/ofxProjectionEditor.h

@ -18,6 +18,7 @@ public:
void update(ofEventArgs& args);
void draw();
void mouseDragged(ofMouseEventArgs& args);
void gotMessage(ofMessage& msg);
void setSurfaceManager(ofxSurfaceManager* newSurfaceManager);
void clearJoints();
void createJoints();

3
src/ofxSurfaceManager.cpp

@ -272,6 +272,9 @@ ofxBaseSurface* ofxSurfaceManager::selectSurface(int index)
}
selectedSurface = surfaces[index];
// notify that a new surface has been selected
ofSendMessage("surfaceSelected");
}
ofxBaseSurface* ofxSurfaceManager::getSelectedSurface()

Loading…
Cancel
Save