From 3418dd0859106791d5534c53b901c2be4ea6b4c4 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 15 Dec 2017 09:24:22 +0000 Subject: better paths --- gui/src/chainImage.cpp | 7 ++++++- gui/src/chainImage.h | 8 +++++--- gui/src/chainImageSet.cpp | 22 +++++++++++++++++++--- 3 files changed, 30 insertions(+), 7 deletions(-) (limited to 'gui') diff --git a/gui/src/chainImage.cpp b/gui/src/chainImage.cpp index 5a24c7b..7192fdc 100644 --- a/gui/src/chainImage.cpp +++ b/gui/src/chainImage.cpp @@ -130,6 +130,11 @@ void chainImage::updateRotationTimeline(){ } +ofPoint chainImage::getPathPoint(){ + //printf("get point at transition: %f \n",transition); + return path.getPointAtLength(transition); +} + int chainImage::updateOutput(float decayRatio){ //where there is rotation of the link, the path needs to be rotated @@ -150,7 +155,7 @@ int chainImage::updateOutput(float decayRatio){ ofPoint previous=getLinkPos()+(rotated_destination*getLinkScale()*(1.0f-BEZIER_IN)); path.bezierTo( - getLinkPos().x*(1.0f+BEZIER_OUT),getLinkPos().y*(1.0f+BEZIER_OUT), + getLinkPos().x*(1.0f+(BEZIER_OUT*linkScale)),getLinkPos().y*(1.0f+(BEZIER_OUT*linkScale)), previous.x,previous.y, destination.x,destination.y); diff --git a/gui/src/chainImage.h b/gui/src/chainImage.h index 1ac234c..2567e3c 100644 --- a/gui/src/chainImage.h +++ b/gui/src/chainImage.h @@ -6,9 +6,9 @@ #define THUMB_BORDER_RATIO 0.8 #define THUMB_SIZE 160 #define DEFAULT_FADEIN 1.0 -#define BEZIER_OUT 0.125 -#define BEZIER_IN 0.125 -#define ROTATION_BEZIER_FRACTION 0.1 +#define BEZIER_OUT 0.5 +#define BEZIER_IN 0.5 +#define ROTATION_BEZIER_FRACTION 0.2 #define SWITCH_NONE 0 #define SWITCH_FORWARD 1 @@ -70,6 +70,8 @@ class chainImage : public ofImage{ Json::Value toJson(); bool fromJson(Json::Value json); + ofPoint getPathPoint(); + chainImage *link; chainImage *linked; diff --git a/gui/src/chainImageSet.cpp b/gui/src/chainImageSet.cpp index 8f73013..65ea5f9 100644 --- a/gui/src/chainImageSet.cpp +++ b/gui/src/chainImageSet.cpp @@ -194,17 +194,24 @@ void chainImageSet::drawGui(int x,int y,bool is_selected){ glPopMatrix(); } + + //DRAW PATH PREVIEW glPushMatrix(); - ofSetColor(255,0,255); + if (((*ii)->linked)->link==(*currentImage)->link){ //seems like cheating + ofSetColor(0,255,0); + } + else { + ofSetColor(255,255,255); + } glTranslatef(t_xoffs+borderwidth+thumbx,borderwidth+thumby,0); //this gets us to the middle of the image - ofDrawRectangle(-5,-5,10,10); + //ofDrawRectangle(-2,-2,4,4); - ofSetLineWidth(5); + ofSetLineWidth(2); float pathscale=thumbscale/(((*ii)->linked)->linkScale); @@ -218,9 +225,18 @@ void chainImageSet::drawGui(int x,int y,bool is_selected){ glTranslatef(-start.x,-start.y,0); ((*ii)->linked)->path.draw(); + if (((*ii)->linked)->link==(*currentImage)->link){ //seems like cheating + ofPoint currentpos=((*ii)->linked)->getPathPoint(); + glTranslatef(currentpos.x,currentpos.y,0); + ofSetColor(255,255,255); + ofDrawRectangle(-2,-2,4,4); + } + ofSetLineWidth(1); glPopMatrix(); + + //jump to next image t_xoffs+=(*ii)->thumbnail.getWidth()+(borderwidth*2); -- cgit v1.2.3