diff --git a/stuff/library/shaders/radialblurGPU.xml b/stuff/library/shaders/radialblurGPU.xml
index b24bb65..267c051 100644
--- a/stuff/library/shaders/radialblurGPU.xml
+++ b/stuff/library/shaders/radialblurGPU.xml
@@ -85,3 +85,13 @@
center
+
+
+ compass_ui
+
+ Center
+
+
+ center
+
+
diff --git a/stuff/library/shaders/spinblurGPU.xml b/stuff/library/shaders/spinblurGPU.xml
index 57df18a..e3ca331 100644
--- a/stuff/library/shaders/spinblurGPU.xml
+++ b/stuff/library/shaders/spinblurGPU.xml
@@ -84,4 +84,14 @@
center
+
+
+
+ compass_spin_ui
+
+ Center
+
+
+ center
+
\ No newline at end of file
diff --git a/toonz/sources/include/stdfx/shaderinterface.h b/toonz/sources/include/stdfx/shaderinterface.h
index 19e9f8d..ec601af 100644
--- a/toonz/sources/include/stdfx/shaderinterface.h
+++ b/toonz/sources/include/stdfx/shaderinterface.h
@@ -86,6 +86,8 @@ public: // Enums
SIZE_UI,
QUAD_UI,
RECT_UI,
+ COMPASS_UI,
+ COMPASS_SPIN_UI,
CONCEPTSCOUNT,
UI_CONCEPTS = RADIUS_UI
diff --git a/toonz/sources/include/tparamuiconcept.h b/toonz/sources/include/tparamuiconcept.h
index d527e5f..091c39b 100644
--- a/toonz/sources/include/tparamuiconcept.h
+++ b/toonz/sources/include/tparamuiconcept.h
@@ -65,7 +65,8 @@ public:
// [TDoubleParamP] }
LINEAR_RANGE, // A band-like range between two points.
// { [2 TPointParamP] }
- RAYLIT,
+ COMPASS, // a line widget pointing toward some point. [TPointParamP]
+ COMPASS_SPIN, // ... with guides in rotational direction.
RAINBOW_WIDTH,
diff --git a/toonz/sources/stdfx/ino_radial_blur.cpp b/toonz/sources/stdfx/ino_radial_blur.cpp
index 6cbd8ef..32c2d28 100644
--- a/toonz/sources/stdfx/ino_radial_blur.cpp
+++ b/toonz/sources/stdfx/ino_radial_blur.cpp
@@ -90,7 +90,7 @@ public:
//,this->m_radius->getValue(frame) * scale
,
0 /* debug:2012-02-01:ゼロ以上だとmarginが小さすぎになり画像が切れてしまう
- */
+ */
,
(this->m_anti_alias->getValue() ? 4 : 1));
@@ -143,7 +143,7 @@ public:
// add 20140130
void getParamUIs(TParamUIConcept *&concepts, int &length) override {
- concepts = new TParamUIConcept[length = 2];
+ concepts = new TParamUIConcept[length = 3];
concepts[0].m_type = TParamUIConcept::POINT;
concepts[0].m_label = "Center";
@@ -153,6 +153,9 @@ public:
concepts[1].m_label = "Radius";
concepts[1].m_params.push_back(m_radius);
concepts[1].m_params.push_back(m_center);
+
+ concepts[2].m_type = TParamUIConcept::COMPASS;
+ concepts[2].m_params.push_back(m_center);
}
// add 20140130
};
@@ -210,7 +213,7 @@ void fx_(const TRasterP in_ras // with margin
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), out_ras, margin);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_radial_blur::doCompute(TTile &tile, double frame,
const TRenderSettings &ri) {
@@ -282,7 +285,8 @@ void ino_radial_blur::doCompute(TTile &tile, double frame,
std::ostringstream os;
os << "params"
<< " cx " << center.x << " cy " << center.y << " blur " << blur
- << " radius " << radius << " twist " << twist
+ << " radius " << radius << " twist "
+ << twist
// << " twist_radius " << twist_radius
<< " reference " << refer_mode << " alpha_rendering " << alpha_rend_sw
<< " anti_alias " << anti_alias_sw << " render_center "
diff --git a/toonz/sources/stdfx/ino_spin_blur.cpp b/toonz/sources/stdfx/ino_spin_blur.cpp
index e22989c..51fda1f 100644
--- a/toonz/sources/stdfx/ino_spin_blur.cpp
+++ b/toonz/sources/stdfx/ino_spin_blur.cpp
@@ -127,7 +127,7 @@ public:
// add 20140130
void getParamUIs(TParamUIConcept *&concepts, int &length) override {
- concepts = new TParamUIConcept[length = 2];
+ concepts = new TParamUIConcept[length = 3];
concepts[0].m_type = TParamUIConcept::POINT;
concepts[0].m_label = "Center";
@@ -137,6 +137,9 @@ public:
concepts[1].m_label = "Radius";
concepts[1].m_params.push_back(m_radius);
concepts[1].m_params.push_back(m_center);
+
+ concepts[2].m_type = TParamUIConcept::COMPASS_SPIN;
+ concepts[2].m_params.push_back(m_center);
}
// add 20140130
};
@@ -196,7 +199,7 @@ void fx_(const TRasterP in_ras // with margin
ino::arr_to_ras(in_gr8->getRawData(), ino::channels(), out_ras, margin);
in_gr8->unlock();
}
-}
+} // namespace
//------------------------------------------------------------
void ino_spin_blur::doCompute(TTile &tile, double frame,
const TRenderSettings &ri) {
diff --git a/toonz/sources/stdfx/radialblurfx.cpp b/toonz/sources/stdfx/radialblurfx.cpp
index 4344613..d57fc5b 100644
--- a/toonz/sources/stdfx/radialblurfx.cpp
+++ b/toonz/sources/stdfx/radialblurfx.cpp
@@ -81,7 +81,7 @@ public:
}
void getParamUIs(TParamUIConcept *&concepts, int &length) override {
- concepts = new TParamUIConcept[length = 2];
+ concepts = new TParamUIConcept[length = 3];
concepts[0].m_type = TParamUIConcept::POINT;
concepts[0].m_label = "Center";
@@ -91,6 +91,9 @@ public:
concepts[1].m_label = "Radius";
concepts[1].m_params.push_back(m_radius);
concepts[1].m_params.push_back(m_point);
+
+ concepts[2].m_type = TParamUIConcept::COMPASS;
+ concepts[2].m_params.push_back(m_point);
}
};
diff --git a/toonz/sources/stdfx/raylitfx.cpp b/toonz/sources/stdfx/raylitfx.cpp
index 08c9260..d5eea48 100644
--- a/toonz/sources/stdfx/raylitfx.cpp
+++ b/toonz/sources/stdfx/raylitfx.cpp
@@ -72,7 +72,7 @@ public:
concepts[1].m_params.push_back(m_radius);
concepts[1].m_params.push_back(m_p);
- concepts[2].m_type = TParamUIConcept::RAYLIT;
+ concepts[2].m_type = TParamUIConcept::COMPASS;
concepts[2].m_params.push_back(m_p);
}
};
diff --git a/toonz/sources/stdfx/rotationalblurfx.cpp b/toonz/sources/stdfx/rotationalblurfx.cpp
index 03b8fb2..bbc18de 100644
--- a/toonz/sources/stdfx/rotationalblurfx.cpp
+++ b/toonz/sources/stdfx/rotationalblurfx.cpp
@@ -52,7 +52,7 @@ public:
if (dist > radius)
blurangle = intensity * ((dist - radius));
else
- blurangle = 0;
+ blurangle = 0;
if (blurangle > M_PI) blurangle = M_PI;
return tround(4 * blurangle * dist);
}
@@ -88,7 +88,7 @@ public:
}
void getParamUIs(TParamUIConcept *&concepts, int &length) override {
- concepts = new TParamUIConcept[length = 2];
+ concepts = new TParamUIConcept[length = 3];
concepts[0].m_type = TParamUIConcept::POINT;
concepts[0].m_label = "Center";
@@ -98,6 +98,9 @@ public:
concepts[1].m_label = "Radius";
concepts[1].m_params.push_back(m_radius);
concepts[1].m_params.push_back(m_point);
+
+ concepts[2].m_type = TParamUIConcept::COMPASS_SPIN;
+ concepts[2].m_params.push_back(m_point);
}
};
@@ -141,9 +144,9 @@ void doSpinBlur(const TRasterPT rout, const TRasterPT rin,
if (dist > radius)
blurangle = intensity * ((dist - radius));
else
- blurangle = 0;
+ blurangle = 0;
if (blurangle > M_PI) blurangle = M_PI;
- range = (int)(4 * blurangle * dist);
+ range = (int)(4 * blurangle * dist);
if (range >= 1) {
angle = atan2((double)vy, (double)vx) - blurangle;
ddist = 0.5 / dist;
diff --git a/toonz/sources/stdfx/shaderfx.cpp b/toonz/sources/stdfx/shaderfx.cpp
index b68b427..0996ce3 100644
--- a/toonz/sources/stdfx/shaderfx.cpp
+++ b/toonz/sources/stdfx/shaderfx.cpp
@@ -131,7 +131,8 @@ static const TParamUIConcept::Type
TParamUIConcept::ANGLE, TParamUIConcept::POINT,
TParamUIConcept::POINT_2, TParamUIConcept::VECTOR,
TParamUIConcept::POLAR, TParamUIConcept::SIZE,
- TParamUIConcept::QUAD, TParamUIConcept::RECT};
+ TParamUIConcept::QUAD, TParamUIConcept::RECT,
+ TParamUIConcept::COMPASS, TParamUIConcept::COMPASS_SPIN};
// Functions
@@ -400,7 +401,7 @@ void ShaderFx::initialize() {
TParamUIConcept &uiConcept = m_this->m_uiConcepts.back();
uiConcept.m_type = ::l_conceptTypes[siParam.m_concept.m_type -
ShaderInterface::UI_CONCEPTS];
- uiConcept.m_label = siParam.m_concept.m_label.toStdString();
+ uiConcept.m_label = siParam.m_concept.m_label.toStdString();
uiConcept.m_params.push_back(param);
}
}
diff --git a/toonz/sources/stdfx/shaderinterface.cpp b/toonz/sources/stdfx/shaderinterface.cpp
index 30e9613..23c8aa1 100644
--- a/toonz/sources/stdfx/shaderinterface.cpp
+++ b/toonz/sources/stdfx/shaderinterface.cpp
@@ -47,9 +47,10 @@ const static QString l_typeNames[ShaderInterface::TYPESCOUNT] = {
"int", "ivec2", "ivec3", "ivec4", "rgba", "rgb"};
const static QString l_conceptNames[ShaderInterface::CONCEPTSCOUNT] = {
- "none", "percent", "length", "angle", "point",
- "radius_ui", "width_ui", "angle_ui", "point_ui", "xy_ui",
- "vector_ui", "polar_ui", "size_ui", "quad_ui", "rect_ui"};
+ "none", "percent", "length", "angle", "point",
+ "radius_ui", "width_ui", "angle_ui", "point_ui", "xy_ui",
+ "vector_ui", "polar_ui", "size_ui", "quad_ui", "rect_ui",
+ "compass_ui", "compass_spin_ui"};
const static QString l_hwtNames[ShaderInterface::HWTCOUNT] = {"none", "any",
"isotropic"};
diff --git a/toonz/sources/tnztools/edittoolgadgets.cpp b/toonz/sources/tnztools/edittoolgadgets.cpp
index 7b94414..18bb6d0 100644
--- a/toonz/sources/tnztools/edittoolgadgets.cpp
+++ b/toonz/sources/tnztools/edittoolgadgets.cpp
@@ -1532,7 +1532,7 @@ void LinearRangeFxGadget::leftButtonUp(const TPointD &pos,
//=============================================================================
-class RayLitFxGadget final : public FxGadget {
+class CompassFxGadget final : public FxGadget {
TPointParamP m_center;
enum HANDLE { Body = 0, Near, Far, None } m_handle = None;
@@ -1540,9 +1540,11 @@ class RayLitFxGadget final : public FxGadget {
TPointD m_clickedPos, m_mousePos;
TPointD m_targetPos, m_anotherPos;
+ bool m_isSpin;
+
public:
- RayLitFxGadget(FxGadgetController *controller,
- const TPointParamP ¢erPoint);
+ CompassFxGadget(FxGadgetController *controller,
+ const TPointParamP ¢erPoint, bool isSpin = false);
void draw(bool picking) override;
@@ -1553,16 +1555,16 @@ public:
//---------------------------------------------------------------------------
-RayLitFxGadget::RayLitFxGadget(FxGadgetController *controller,
- const TPointParamP ¢erPoint)
- : FxGadget(controller, 3), m_center(centerPoint) {
+CompassFxGadget::CompassFxGadget(FxGadgetController *controller,
+ const TPointParamP ¢erPoint, bool isSpin)
+ : FxGadget(controller, 3), m_center(centerPoint), m_isSpin(isSpin) {
addParam(centerPoint->getX());
addParam(centerPoint->getY());
}
//---------------------------------------------------------------------------
-void RayLitFxGadget::draw(bool picking) {
+void CompassFxGadget::draw(bool picking) {
auto setColorById = [&](int id) {
if (isSelected(id))
glColor3dv(m_selectedColor);
@@ -1615,6 +1617,7 @@ void RayLitFxGadget::draw(bool picking) {
double angle = std::atan2(-center.y, -center.x) * M_180_PI;
double theta = M_180_PI * lineInterval / dCenter;
+ // draw guides
glColor3d(0, 0, 1);
glLineStipple(1, 0x00FF);
glEnable(GL_LINE_STIPPLE);
@@ -1622,14 +1625,26 @@ void RayLitFxGadget::draw(bool picking) {
glTranslated(center.x, center.y, 0);
glRotated(angle, 0, 0, 1);
for (int i = -3; i <= 3; i++) {
- if (i == 0) continue;
- glPushMatrix();
- glRotated(theta * (double)i, 0, 0, 1);
- glBegin(GL_LINES);
- glVertex2d(dCenter - lineHalf, 0.0);
- glVertex2d(dCenter + lineHalf, 0.0);
- glEnd();
- glPopMatrix();
+ if (!m_isSpin) { // radial direction
+ if (i == 0) continue;
+ glPushMatrix();
+ glRotated(theta * (double)i, 0, 0, 1);
+ glBegin(GL_LINES);
+ glVertex2d(dCenter - lineHalf, 0.0);
+ glVertex2d(dCenter + lineHalf, 0.0);
+ glEnd();
+ glPopMatrix();
+ } else { // rotational direction
+ if (i == 3 || i == -3) continue;
+ double tmpRad = dCenter + (double)i * lineInterval;
+ double d_angle = (lineInterval / dCenter) * 6.0 / 10.0;
+ glBegin(GL_LINE_STRIP);
+ for (int r = -5; r <= 5; r++) {
+ double tmpAngle = (double)r * d_angle;
+ glVertex2d(tmpRad * std::cos(tmpAngle), tmpRad * std::sin(tmpAngle));
+ }
+ glEnd();
+ }
}
glPopMatrix();
@@ -1663,7 +1678,7 @@ void RayLitFxGadget::draw(bool picking) {
//---------------------------------------------------------------------------
-void RayLitFxGadget::leftButtonDown(const TPointD &pos, const TMouseEvent &) {
+void CompassFxGadget::leftButtonDown(const TPointD &pos, const TMouseEvent &) {
m_handle = (HANDLE)m_selected;
if (m_handle == None) return;
m_clickedPos = pos;
@@ -1672,7 +1687,7 @@ void RayLitFxGadget::leftButtonDown(const TPointD &pos, const TMouseEvent &) {
//---------------------------------------------------------------------------
-void RayLitFxGadget::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
+void CompassFxGadget::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
if (m_handle == None) return;
TPointD d = pos - m_clickedPos;
@@ -1695,7 +1710,7 @@ void RayLitFxGadget::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
//---------------------------------------------------------------------------
-void RayLitFxGadget::leftButtonUp(const TPointD &pos, const TMouseEvent &) {
+void CompassFxGadget::leftButtonUp(const TPointD &pos, const TMouseEvent &) {
m_handle = None;
}
@@ -1979,9 +1994,15 @@ FxGadget *FxGadgetController::allocateGadget(const TParamUIConcept &uiConcept) {
break;
}
- case TParamUIConcept::RAYLIT: {
+ case TParamUIConcept::COMPASS: {
+ assert(uiConcept.m_params.size() == 1);
+ gadget = new CompassFxGadget(this, uiConcept.m_params[0]);
+ break;
+ }
+
+ case TParamUIConcept::COMPASS_SPIN: {
assert(uiConcept.m_params.size() == 1);
- gadget = new RayLitFxGadget(this, uiConcept.m_params[0]);
+ gadget = new CompassFxGadget(this, uiConcept.m_params[0], true);
break;
}