[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50089] trunk/blender/source/blender: fix [#32374] Curve compositor UI drawing glitch
Campbell Barton
ideasman42 at gmail.com
Tue Aug 21 17:14:29 CEST 2012
Revision: 50089
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50089
Author: campbellbarton
Date: 2012-08-21 15:14:29 +0000 (Tue, 21 Aug 2012)
Log Message:
-----------
fix [#32374] Curve compositor UI drawing glitch
copy the curve for the compositor.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/colortools.c
trunk/blender/source/blender/compositor/nodes/COM_TimeNode.cpp
trunk/blender/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.h
trunk/blender/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
trunk/blender/source/blender/editors/interface/interface_draw.c
Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2012-08-21 15:14:29 UTC (rev 50089)
@@ -150,7 +150,7 @@
int a;
for (a = 0; a < 3; a++) {
- const float delta = MAX2(white[a] - black[a], 1e-5f);
+ const float delta = maxf(white[a] - black[a], 1e-5f);
r_bwmul[a] = 1.0f / delta;
}
}
Modified: trunk/blender/source/blender/compositor/nodes/COM_TimeNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_TimeNode.cpp 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/compositor/nodes/COM_TimeNode.cpp 2012-08-21 15:14:29 UTC (rev 50089)
@@ -33,8 +33,6 @@
/* pass */
}
-////curvemapping_initialize(&hcmd->curve_mapping);
-
void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
SetValueOperation *operation = new SetValueOperation();
Modified: trunk/blender/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ColorCurveOperation.cpp 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/compositor/operations/COM_ColorCurveOperation.cpp 2012-08-21 15:14:29 UTC (rev 50089)
@@ -98,11 +98,11 @@
void ColorCurveOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputFacProgram = NULL;
this->m_inputImageProgram = NULL;
this->m_inputBlackProgram = NULL;
this->m_inputWhiteProgram = NULL;
- curvemapping_premultiply(this->m_curveMapping, 1);
}
@@ -154,7 +154,7 @@
void ConstantLevelColorCurveOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputFacProgram = NULL;
this->m_inputImageProgram = NULL;
- curvemapping_premultiply(this->m_curveMapping, 1);
}
Modified: trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.cpp 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.cpp 2012-08-21 15:14:29 UTC (rev 50089)
@@ -38,3 +38,17 @@
{
curvemapping_initialize(this->m_curveMapping);
}
+void CurveBaseOperation::deinitExecution()
+{
+ curvemapping_free(this->m_curveMapping);
+ this->m_curveMapping = NULL;
+}
+
+void CurveBaseOperation::setCurveMapping(CurveMapping *mapping)
+{
+ /* duplicate the curve to avoid glitches while drawing, see bug [#32374] */
+ if (this->m_curveMapping) {
+ curvemapping_free(this->m_curveMapping);
+ }
+ this->m_curveMapping = curvemapping_copy(mapping);
+}
Modified: trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.h 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/compositor/operations/COM_CurveBaseOperation.h 2012-08-21 15:14:29 UTC (rev 50089)
@@ -38,7 +38,8 @@
* Initialize the execution
*/
void initExecution();
+ void deinitExecution();
- void setCurveMapping(CurveMapping *mapping) { this->m_curveMapping = mapping; }
+ void setCurveMapping(CurveMapping *mapping);
};
#endif
Modified: trunk/blender/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp 2012-08-21 15:14:29 UTC (rev 50089)
@@ -74,5 +74,6 @@
void HueSaturationValueCorrectOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputProgram = NULL;
}
Modified: trunk/blender/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_VectorCurveOperation.cpp 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/compositor/operations/COM_VectorCurveOperation.cpp 2012-08-21 15:14:29 UTC (rev 50089)
@@ -56,5 +56,6 @@
void VectorCurveOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputProgram = NULL;
}
Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c 2012-08-21 14:49:07 UTC (rev 50088)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c 2012-08-21 15:14:29 UTC (rev 50089)
@@ -1355,9 +1355,15 @@
rcti scissor_new;
int a;
- cumap = (CurveMapping *)(but->editcumap ? but->editcumap : but->poin);
- cuma = cumap->cm + cumap->cur;
+ if (but->editcumap) {
+ cumap = but->editcumap;
+ }
+ else {
+ cumap = (CurveMapping *)but->poin;
+ }
+ cuma = &cumap->cm[cumap->cur];
+
/* need scissor test, curve can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
scissor_new.xmin = ar->winrct.xmin + rect->xmin;
@@ -1485,8 +1491,9 @@
cmp = cuma->table;
/* first point */
- if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
glVertex2f(rect->xmin, rect->ymin + zoomy * (cmp[0].y - offsy));
+ }
else {
fx = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]);
fy = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]);
@@ -1498,8 +1505,9 @@
glVertex2f(fx, fy);
}
/* last point */
- if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
glVertex2f(rect->xmax, rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy));
+ }
else {
fx = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]);
fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]);
More information about the Bf-blender-cvs
mailing list