2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define _STLP_DEBUG 1
|
|
|
|
#endif
|
|
|
|
#include "ext/SmoothDeformation.h"
|
|
|
|
#include "ext/StrokeDeformation.h"
|
|
|
|
//#include "ext/SquarePotential.h"
|
|
|
|
//#include "ext/StrokeParametricDeformer.h"
|
2016-09-06 01:20:21 +12:00
|
|
|
#include "ext/NotSymmetricBezierPotential.h"
|
2016-03-19 06:57:51 +13:00
|
|
|
#include "ext/ContextStatus.h"
|
|
|
|
#include "ext/Designer.h"
|
|
|
|
//#include "ext/TriParam.h"
|
|
|
|
#include "ext/ExtUtil.h"
|
|
|
|
|
|
|
|
#include "DeformationSelector.h"
|
|
|
|
|
|
|
|
//#include <tcurves.h>
|
|
|
|
//#include <tstrokeutil.h>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <iterator>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <tstroke.h>
|
|
|
|
|
|
|
|
using namespace ToonzExt;
|
|
|
|
|
|
|
|
REGISTER(SmoothDeformation, 1);
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
SmoothDeformation::SmoothDeformation() {
|
2016-09-06 01:20:21 +12:00
|
|
|
setPotential(new NotSymmetricBezierPotential);
|
2016-06-15 18:43:10 +12:00
|
|
|
shortcutKey_ = ContextStatus::ALT;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
SmoothDeformation::~SmoothDeformation() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void SmoothDeformation::draw(Designer *designer) {
|
|
|
|
StrokeDeformationImpl::draw(0);
|
|
|
|
designer->draw(this);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
bool SmoothDeformation::check_(const ContextStatus *status) {
|
|
|
|
assert(status && "Not status available");
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
if (!isASpireCorner(status->stroke2change_, status->w_, status->cornerSize_,
|
|
|
|
&this->getSpiresList()))
|
|
|
|
return true;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
return false;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
bool SmoothDeformation::findExtremes_(const ContextStatus *status,
|
2016-06-15 18:43:10 +12:00
|
|
|
Interval &ret) {
|
|
|
|
return ToonzExt::findNearestSpireCorners(status->stroke2change_, status->w_,
|
|
|
|
ret, status->cornerSize_,
|
|
|
|
&this->getSpiresList());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
double SmoothDeformation::findActionLength() {
|
|
|
|
// this means that all length needs to be used
|
|
|
|
return 2.0 * stroke2manipulate_->getLength();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
SmoothDeformation *SmoothDeformation::instance() {
|
|
|
|
static SmoothDeformation singleton;
|
|
|
|
return &singleton;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// End Of File
|
|
|
|
//-----------------------------------------------------------------------------
|