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