Skip to content

Commit

Permalink
#assistants: apply column filter color
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwarthog committed Oct 30, 2023
1 parent ce9e891 commit e809e3d
Show file tree
Hide file tree
Showing 16 changed files with 250 additions and 123 deletions.
33 changes: 22 additions & 11 deletions toonz/sources/include/tools/assistant.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ class DVAPI TGuideline : public TSmartObject {
public:
const bool enabled;
const double magnetism;
const TPixelD color;

TGuideline(bool enabled, double magnetism):
enabled(enabled), magnetism(magnetism) { }
TGuideline(bool enabled, double magnetism, const TPixelD &color):
enabled(enabled), magnetism(magnetism), color(color) { }

virtual TTrackPoint transformPoint(const TTrackPoint &point) const
{ return point; }
Expand Down Expand Up @@ -204,6 +205,10 @@ class DVAPI TAssistantBase : public TMetaObjectHandler {
DRAW_ERROR = 1,
};

static TPixelD colorBase;
static TPixelD colorError;
static TPixelD colorEdit;
static TPixelD colorSelect;
static unsigned int drawFlags;
static const double lineWidthScale;

Expand Down Expand Up @@ -318,8 +323,18 @@ class DVAPI TAssistantBase : public TMetaObjectHandler {
double getDrawingAlpha(bool enabled = true) const;
double getDrawingGridAlpha() const;

TIntProperty* createSpinProperty(const TStringId &id, int def, int min, int max, bool hasMax = true);
inline TIntProperty* createSpinProperty(const TStringId &id, int def, int min)
{ return createSpinProperty(id, def, min, 0, false); }

void addProperty(TProperty *p);
void setTranslation(const TStringId &name, const QString &localName) const;

public:
static TPixelD makeContrastColor(const TPixelD &color);
static void drawSegment(const TPointD &p0, const TPointD &p1, double pixelSize, double alpha0, double alpha1);
static void drawMark(const TPointD &p, const TPointD &normal, double pixelSize, double alpha);
static void drawDot(const TPointD &p, const TPixelD &color);
static void drawDot(const TPointD &p, double alpha);
static void drawPoint(const TAssistantPoint &point, double pixelSize);
static void drawIndex(const TPointD &p, int index, bool selected, double pixelSize);
Expand All @@ -331,14 +346,6 @@ class DVAPI TAssistantBase : public TMetaObjectHandler {
inline void drawDot(const TPointD &p) const
{ drawDot(p, getDrawingAlpha()); }

TIntProperty* createSpinProperty(const TStringId &id, int def, int min, int max, bool hasMax = true);
inline TIntProperty* createSpinProperty(const TStringId &id, int def, int min)
{ return createSpinProperty(id, def, min, 0, false); }

void addProperty(TProperty *p);
void setTranslation(const TStringId &name, const QString &localName) const;

public:
virtual void updateTranslation() const;
virtual void draw(TToolViewer *viewer, bool enabled) const;
void draw(TToolViewer *viewer) const { draw(viewer, true); }
Expand Down Expand Up @@ -369,7 +376,11 @@ class DVAPI TAssistant : public TAssistantBase {

public:
void updateTranslation() const override;
virtual void getGuidelines(const TPointD &position, const TAffine &toTool, TGuidelineList &outGuidelines) const;
virtual void getGuidelines(
const TPointD &position,
const TAffine &toTool,
const TPixelD &color,
TGuidelineList &outGuidelines) const;

// calc W-coefficient and i-bounds for formula: x0 + 1/(i*W + 1)
static bool calcPerspectiveStep(
Expand Down
3 changes: 3 additions & 0 deletions toonz/sources/include/tools/assistants/guidelineellipse.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ class DVAPI TGuidelineEllipse : public TGuideline {
TGuidelineEllipse(
bool enabled,
double magnetism,
const TPixelD &color,
const TAffine &matrix );

TGuidelineEllipse(
bool enabled,
double magnetism,
const TPixelD &color,
const TAffine &matrix,
const TAffine &matrixInv );

TGuidelineEllipse(
bool enabled,
double magnetism,
const TPixelD &color,
const TAffine &matrix,
const TAffine &matrixInv,
double Rx,
Expand Down
8 changes: 4 additions & 4 deletions toonz/sources/include/tools/assistants/guidelineline.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DVAPI TGuidelineLineBase : public TGuideline {
const TPointD p0;
const TPointD p1;

TGuidelineLineBase(bool enabled, double magnetism, const TPointD &p0, const TPointD &p1);
TGuidelineLineBase(bool enabled, double magnetism, const TPixelD &color, const TPointD &p0, const TPointD &p1);
void drawLine(const TPointD &p0, const TPointD &p1, bool restrict0, bool restrict1, bool active, bool enabled) const;
static TPointD calcDirection(const TPointD &p0, const TPointD &p1);
static bool truncateInfiniteLine(const TRectD &bounds, TPointD &p0, TPointD &p1);
Expand All @@ -47,7 +47,7 @@ class DVAPI TGuidelineLine : public TGuidelineLineBase {
const TPointD dir;
const double dist;

TGuidelineLine(bool enabled, double magnetism, const TPointD &p0, const TPointD &p1);
TGuidelineLine(bool enabled, double magnetism, const TPixelD &color, const TPointD &p0, const TPointD &p1);
TTrackPoint transformPoint(const TTrackPoint &point) const override;
void draw(bool active, bool enabled) const override;
};
Expand All @@ -61,7 +61,7 @@ class DVAPI TGuidelineInfiniteLine : public TGuidelineLineBase {
public:
const TPointD dir;

TGuidelineInfiniteLine(bool enabled, double magnetism, const TPointD &p0, const TPointD &p1);
TGuidelineInfiniteLine(bool enabled, double magnetism, const TPixelD &color, const TPointD &p0, const TPointD &p1);
TTrackPoint transformPoint(const TTrackPoint &point) const override;
void draw(bool active, bool enabled) const override;
};
Expand All @@ -75,7 +75,7 @@ class DVAPI TGuidelineRay : public TGuidelineLineBase {
public:
const TPointD dir;

TGuidelineRay(bool enabled, double magnetism, const TPointD &p0, const TPointD &p1);
TGuidelineRay(bool enabled, double magnetism, const TPixelD &color, const TPointD &p0, const TPointD &p1);
TTrackPoint transformPoint(const TTrackPoint &point) const override;
void draw(bool active, bool enabled) const override;
};
Expand Down
Loading

0 comments on commit e809e3d

Please sign in to comment.