|
@ -16,8 +16,13 @@ ProjectionMappingState * ProjectionMappingState::instance(){ |
|
|
return _instance; |
|
|
return _instance; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ProjectionMappingState::setup(Application *app){ |
|
|
|
|
|
Gui::instance()->getProjectionEditorWidget().setSurfaceManager(app->getSurfaceManager()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void ProjectionMappingState::update(Application * app){ |
|
|
void ProjectionMappingState::update(Application * app){ |
|
|
app->getGui()->getProjectionEditorWidget()->update(); |
|
|
//app->getGui()->getProjectionEditorWidget()->update();
|
|
|
|
|
|
Gui::instance()->getProjectionEditorWidget().update(); |
|
|
Gui::instance()->getScaleWidget().update(); |
|
|
Gui::instance()->getScaleWidget().update(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -28,7 +33,8 @@ void ProjectionMappingState::draw(Application * app){ |
|
|
ofPopStyle(); |
|
|
ofPopStyle(); |
|
|
|
|
|
|
|
|
// TODO: Extract projection editor, make it a widget
|
|
|
// TODO: Extract projection editor, make it a widget
|
|
|
app->getGui()->getProjectionEditorWidget()->draw(); |
|
|
//app->getGui()->getProjectionEditorWidget()->draw();
|
|
|
|
|
|
Gui::instance()->getProjectionEditorWidget().draw(); |
|
|
|
|
|
|
|
|
// Draw scale widget. The size of the widget is being set on surface select.
|
|
|
// Draw scale widget. The size of the widget is being set on surface select.
|
|
|
BaseSurface * selectedSurface = app->getSurfaceManager()->getSelectedSurface(); |
|
|
BaseSurface * selectedSurface = app->getSurfaceManager()->getSelectedSurface(); |
|
@ -292,11 +298,14 @@ void ProjectionMappingState::onMousePressed(Application * app, ofMouseEventArgs |
|
|
int hitJointIndex = -1; |
|
|
int hitJointIndex = -1; |
|
|
BaseSurface * hitSurface = 0; |
|
|
BaseSurface * hitSurface = 0; |
|
|
|
|
|
|
|
|
hitJoint = app->getGui()->getProjectionEditorWidget()->hitTestJoints(ofVec2f(args.x, args.y)); |
|
|
//hitJoint = app->getGui()->getProjectionEditorWidget()->hitTestJoints(ofVec2f(args.x, args.y));
|
|
|
|
|
|
hitJoint = Gui::instance()->getProjectionEditorWidget().hitTestJoints(ofVec2f(args.x, args.y)); |
|
|
|
|
|
|
|
|
if(hitJoint){ |
|
|
if(hitJoint){ |
|
|
for(int i = app->getGui()->getProjectionEditorWidget()->getJoints()->size() - 1; i >= 0 ; --i){ |
|
|
//for(int i = app->getGui()->getProjectionEditorWidget()->getJoints()->size() - 1; i >= 0 ; --i){
|
|
|
if((*app->getGui()->getProjectionEditorWidget()->getJoints())[i] == hitJoint){ |
|
|
for(int i = Gui::instance()->getProjectionEditorWidget().getJoints()->size() - 1; i >= 0 ; --i){ |
|
|
|
|
|
//if((*app->getGui()->getProjectionEditorWidget()->getJoints())[i] == hitJoint){
|
|
|
|
|
|
if((*Gui::instance()->getProjectionEditorWidget().getJoints())[i] == hitJoint){ |
|
|
hitJointIndex = i; |
|
|
hitJointIndex = i; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
@ -327,19 +336,22 @@ void ProjectionMappingState::onMousePressed(Application * app, ofMouseEventArgs |
|
|
|
|
|
|
|
|
void ProjectionMappingState::onMouseReleased(Application * app, ofMouseEventArgs & args){ |
|
|
void ProjectionMappingState::onMouseReleased(Application * app, ofMouseEventArgs & args){ |
|
|
Gui::instance()->onMouseReleased(args); |
|
|
Gui::instance()->onMouseReleased(args); |
|
|
app->getGui()->stopDrag(); |
|
|
app->getGui()->stopDrag(); // TODO: handle this locally
|
|
|
app->getGui()->getProjectionEditorWidget()->stopDragJoints(); |
|
|
//app->getGui()->getProjectionEditorWidget()->stopDragJoints();
|
|
|
|
|
|
Gui::instance()->getProjectionEditorWidget().stopDragJoints(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ProjectionMappingState::onMouseDragged(Application * app, ofMouseEventArgs & args){ |
|
|
void ProjectionMappingState::onMouseDragged(Application * app, ofMouseEventArgs & args){ |
|
|
Gui::instance()->onMouseDragged(args); |
|
|
Gui::instance()->onMouseDragged(args); |
|
|
app->getGui()->getProjectionEditorWidget()->mouseDragged(args); |
|
|
//app->getGui()->getProjectionEditorWidget()->mouseDragged(args);
|
|
|
|
|
|
Gui::instance()->getProjectionEditorWidget().mouseDragged(args); |
|
|
|
|
|
|
|
|
// TODO: Handle app->getGui()->clickPosition and app->getGui()->bDrag locally.
|
|
|
// TODO: Handle app->getGui()->clickPosition and app->getGui()->bDrag locally.
|
|
|
if(app->getGui()->bDrag){ |
|
|
if(app->getGui()->bDrag){ |
|
|
ofVec2f mousePosition = ofVec2f(args.x, args.y); |
|
|
ofVec2f mousePosition = ofVec2f(args.x, args.y); |
|
|
ofVec2f distance = mousePosition - app->getGui()->clickPosition; |
|
|
ofVec2f distance = mousePosition - app->getGui()->clickPosition; |
|
|
app->getGui()->getProjectionEditorWidget()->moveSelectedSurface(distance); |
|
|
//app->getGui()->getProjectionEditorWidget()->moveSelectedSurface(distance);
|
|
|
|
|
|
Gui::instance()->getProjectionEditorWidget().moveSelectedSurface(distance); |
|
|
app->getGui()->clickPosition = mousePosition; |
|
|
app->getGui()->clickPosition = mousePosition; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|