From 3eb8307160e327f64593d218125d02289285aa17 Mon Sep 17 00:00:00 2001 From: Patrick Busch Date: Tue, 2 Mar 2021 13:13:36 -0600 Subject: Python API: Expose CurveMapping Reset View function The Python API for the curve mapping widget offers the `update` function, but no way to reset the view to the clipping rectangle. This commit adds a blenkernel function for this operation, and exposes it to the CurvMapping RNA API. This allows addons to display a more user-friendly view of the data in this widget. Differential Revision: https://developer.blender.org/D10561 --- source/blender/blenkernel/intern/colortools.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/blenkernel/intern/colortools.c') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 3eb9fb6161d..44d9bd6b2d2 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -965,6 +965,12 @@ void BKE_curvemapping_changed_all(CurveMapping *cumap) cumap->cur = cur; } +/* Reset the view for current curve. */ +void BKE_curvemapping_reset_view(CurveMapping *cumap) +{ + cumap->curr = cumap->clipr; +} + /* table should be verified */ float BKE_curvemap_evaluateF(const CurveMapping *cumap, const CurveMap *cuma, float value) { -- cgit v1.2.3