-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5069 from blackwarthog/feature08h_assistants_sqash
Brush strokes replication feature
- Loading branch information
Showing
37 changed files
with
2,599 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#pragma once | ||
|
||
#ifndef MODIFIERCLONE_INCLUDED | ||
#define MODIFIERCLONE_INCLUDED | ||
|
||
// TnzTools includes | ||
#include <tools/inputmanager.h> | ||
|
||
#undef DVAPI | ||
#undef DVVAR | ||
#ifdef TNZTOOLS_EXPORTS | ||
#define DVAPI DV_EXPORT_API | ||
#define DVVAR DV_EXPORT_VAR | ||
#else | ||
#define DVAPI DV_IMPORT_API | ||
#define DVVAR DV_IMPORT_VAR | ||
#endif | ||
|
||
//=================================================================== | ||
|
||
//***************************************************************************************** | ||
// TModifierClone definition | ||
//***************************************************************************************** | ||
|
||
class DVAPI TModifierClone : public TInputModifier { | ||
public: | ||
class DVAPI Handler : public TMultiTrackHandler { | ||
public: | ||
TTrackP original; | ||
inline explicit Handler(const TTrackP &original = TTrackP()): | ||
original(original) { } | ||
}; | ||
|
||
class DVAPI Interpolator : public TTrackInterpolator { | ||
public: | ||
const TTrackTransform transform; | ||
inline Interpolator(TTrack &track, const TTrackTransform &transform): | ||
TTrackInterpolator(track), transform(transform) { } | ||
TTrackPoint interpolateFromOriginal(double originalIndex); | ||
TTrackPoint interpolate(double index) override; | ||
}; | ||
|
||
|
||
public: | ||
bool keepOriginals; | ||
TTrackTransformList transforms; | ||
|
||
TModifierClone(bool keepOriginals = true); | ||
|
||
void modifyTrack( | ||
const TTrack &track, | ||
TTrackList &outTracks ) override; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#pragma once | ||
|
||
#ifndef MODIFIERJITTER_INCLUDED | ||
#define MODIFIERJITTER_INCLUDED | ||
|
||
// TnzTools includes | ||
#include <tools/inputmanager.h> | ||
|
||
#undef DVAPI | ||
#undef DVVAR | ||
#ifdef TNZTOOLS_EXPORTS | ||
#define DVAPI DV_EXPORT_API | ||
#define DVVAR DV_EXPORT_VAR | ||
#else | ||
#define DVAPI DV_IMPORT_API | ||
#define DVVAR DV_IMPORT_VAR | ||
#endif | ||
|
||
//=================================================================== | ||
|
||
//***************************************************************************************** | ||
// TModifierJitter definition | ||
//***************************************************************************************** | ||
|
||
class DVAPI TModifierJitter : public TInputModifier { | ||
public: | ||
typedef TSubTrackHandler Handler; | ||
|
||
class DVAPI Interpolator : public TTrackInterpolator { | ||
public: | ||
const unsigned int seedX; | ||
const unsigned int seedY; | ||
const double frequency; | ||
const double amplitude; | ||
Interpolator(TTrack &track, double period, double amplitude); | ||
TTrackPoint interpolateFromOriginal(double originalIndex); | ||
TTrackPoint interpolate(double index) override; | ||
}; | ||
|
||
public: | ||
double period; | ||
double amplitude; | ||
int skipFirst; | ||
|
||
TModifierJitter( | ||
double period = 30, | ||
double amplitude = 10, | ||
int skipFirst = 0 ); | ||
|
||
void modifyTrack( | ||
const TTrack &track, | ||
TTrackList &outTracks ) override; | ||
|
||
void modifyTracks( | ||
const TTrackList &tracks, | ||
TTrackList &outTracks ) override; | ||
|
||
static double func(unsigned int seed, double x); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#pragma once | ||
|
||
#ifndef REPLICATOR_INCLUDED | ||
#define REPLICATOR_INCLUDED | ||
|
||
// TnzTools includes | ||
#include <tools/assistant.h> | ||
#include <tools/inputmanager.h> | ||
|
||
#undef DVAPI | ||
#undef DVVAR | ||
#ifdef TNZTOOLS_EXPORTS | ||
#define DVAPI DV_EXPORT_API | ||
#define DVVAR DV_EXPORT_VAR | ||
#else | ||
#define DVAPI DV_IMPORT_API | ||
#define DVVAR DV_IMPORT_VAR | ||
#endif | ||
|
||
|
||
//***************************************************************************************** | ||
// TReplicator definition | ||
//***************************************************************************************** | ||
|
||
class DVAPI TReplicator : public TAssistantBase { | ||
Q_DECLARE_TR_FUNCTIONS(TReplicator) | ||
public: | ||
typedef std::vector<TPointD> PointList; | ||
|
||
static const int multiplierSoftLimit; | ||
static const int multiplierLimit; | ||
|
||
TReplicator(TMetaObject &object); | ||
|
||
virtual int getMultipler() const; | ||
virtual void getPoints(const TAffine &toTool, PointList &points) const; | ||
virtual void getModifiers(const TAffine &toTool, TInputModifier::List &outModifiers) const; | ||
|
||
static void transformPoints(const TAffine &aff, PointList &points, int count); | ||
static void drawReplicatorPoints(const TPointD *points, int count); | ||
|
||
//! return summary multiplier, or 0 is no replicators found | ||
static int scanReplicators( | ||
TTool *tool, | ||
PointList *inOutPoints, | ||
TInputModifier::List *outModifiers, | ||
bool draw, | ||
bool enabledOnly, | ||
bool markEnabled, | ||
bool drawPoints, | ||
TImage *skipImage ); | ||
|
||
protected: | ||
TIntProperty* createCountProperty(const TStringId &id, int def = 1, int min = 1, int max = 0); | ||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.