diff --git a/source/blender/blenkernel/BKE_colortools.hh b/source/blender/blenkernel/BKE_colortools.hh index 864eb0e00de..5ffaad2162d 100644 --- a/source/blender/blenkernel/BKE_colortools.hh +++ b/source/blender/blenkernel/BKE_colortools.hh @@ -68,7 +68,6 @@ void BKE_translate_selection(CurveMap *cuma, const float delta_x, const float de */ void BKE_curvemap_handle_set(CurveMap *cuma, int type); -void BKE_curvemap_runtime_update(CurveMap *cuma); void BKE_curvemap_get_selection_center(CurveMap *cuma, float *center_x_out, float *center_y_out); /** diff --git a/source/blender/blenkernel/BKE_curveprofile.h b/source/blender/blenkernel/BKE_curveprofile.h index 19e3b2f303d..045f11b736e 100644 --- a/source/blender/blenkernel/BKE_curveprofile.h +++ b/source/blender/blenkernel/BKE_curveprofile.h @@ -141,7 +141,6 @@ enum { * Controls removing doubles and clipping. */ void BKE_curveprofile_update(struct CurveProfile *profile, int update_flags); -void BKE_curveprofile_runtime_update(struct CurveProfile *profile); /** * Does a single evaluation along the profile's path. diff --git a/source/blender/blenkernel/intern/colortools.cc b/source/blender/blenkernel/intern/colortools.cc index 538ea008e53..038dd67fafd 100644 --- a/source/blender/blenkernel/intern/colortools.cc +++ b/source/blender/blenkernel/intern/colortools.cc @@ -930,10 +930,6 @@ void BKE_curvemapping_premultiply(CurveMapping *cumap, bool restore) } /* ************************ more CurveMapping calls *************** */ -void BKE_curvemap_runtime_update(CurveMap *cuma) -{ - BKE_curvemap_get_selection_center(cuma, &cuma->runtime.center_x, &cuma->runtime.center_y); -} void BKE_curvemap_get_selection_center(CurveMap *cuma, float *center_x_out, float *center_y_out) { diff --git a/source/blender/blenkernel/intern/curveprofile.cc b/source/blender/blenkernel/intern/curveprofile.cc index b644522ad22..b0cfe1758db 100644 --- a/source/blender/blenkernel/intern/curveprofile.cc +++ b/source/blender/blenkernel/intern/curveprofile.cc @@ -1041,12 +1041,6 @@ void BKE_curveprofile_update(CurveProfile *profile, const int update_flags) } } -void BKE_curveprofile_runtime_update(struct CurveProfile *profile) -{ - BKE_curveprofile_get_selection_center( - profile, &profile->runtime.center_x, &profile->runtime.center_y); -} - void BKE_curveprofile_get_selection_center(const struct CurveProfile *profile, float *center_x_out, float *center_y_out) diff --git a/source/blender/editors/interface/templates/interface_templates.cc b/source/blender/editors/interface/templates/interface_templates.cc index 6bda6d2ced1..f3ee824176f 100644 --- a/source/blender/editors/interface/templates/interface_templates.cc +++ b/source/blender/editors/interface/templates/interface_templates.cc @@ -102,6 +102,8 @@ using blender::StringRef; using blender::Vector; +static float ui_curve_template_runtime_center[2] = {0}; + /* we may want to make this optional, disable for now. */ // #define USE_OP_RESET_BUT @@ -4746,7 +4748,9 @@ static void curvemap_buttons_layout(uiLayout *layout, } /* Curve handle position */ - BKE_curvemap_runtime_update(active_cm); + + BKE_curvemap_get_selection_center( + active_cm, &ui_curve_template_runtime_center[0], &ui_curve_template_runtime_center[1]); bt = uiDefButF(block, UI_BTYPE_NUM, 0, @@ -4755,19 +4759,20 @@ static void curvemap_buttons_layout(uiLayout *layout, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, - &active_cm->runtime.center_x, + &ui_curve_template_runtime_center[0], bounds.xmin, bounds.xmax, ""); UI_but_number_step_size_set(bt, 1); UI_but_number_precision_set(bt, 5); UI_but_func_set(bt, [cumap, cb](bContext &C) { - CurveMap* cuma = cumap->cm + cumap->cur; + CurveMap *cuma = cumap->cm + cumap->cur; float center_x_pre = 0.0f; float center_y_pre = 0.0f; BKE_curvemap_get_selection_center(cuma, ¢er_x_pre, ¢er_y_pre); - BKE_translate_selection( - cuma, cuma->runtime.center_x - center_x_pre, cuma->runtime.center_y - center_y_pre); + BKE_translate_selection(cuma, + ui_curve_template_runtime_center[0] - center_x_pre, + ui_curve_template_runtime_center[1] - center_y_pre); BKE_curvemapping_changed(cumap, true); rna_update_cb(C, cb); }); @@ -4780,19 +4785,20 @@ static void curvemap_buttons_layout(uiLayout *layout, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, - &active_cm->runtime.center_y, + &ui_curve_template_runtime_center[1], bounds.ymin, bounds.ymax, ""); UI_but_number_step_size_set(bt, 1); UI_but_number_precision_set(bt, 5); UI_but_func_set(bt, [cumap, cb](bContext &C) { - CurveMap* cuma = cumap->cm + cumap->cur; + CurveMap *cuma = cumap->cm + cumap->cur; float center_x_pre = 0.0f; float center_y_pre = 0.0f; BKE_curvemap_get_selection_center(cuma, ¢er_x_pre, ¢er_y_pre); - BKE_translate_selection( - cuma, cuma->runtime.center_x - center_x_pre, cuma->runtime.center_y - center_y_pre); + BKE_translate_selection(cuma, + ui_curve_template_runtime_center[0] - center_x_pre, + ui_curve_template_runtime_center[1] - center_y_pre); BKE_curvemapping_changed(cumap, true); rna_update_cb(C, cb); }); @@ -5274,7 +5280,9 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const ICON_NONE); /* Position */ - BKE_curveprofile_runtime_update(profile); + + BKE_curveprofile_get_selection_center( + profile, &ui_curve_template_runtime_center[0], &ui_curve_template_runtime_center[1]); bt = uiDefButF(block, UI_BTYPE_NUM, 0, @@ -5283,7 +5291,7 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, - &profile->runtime.center_x, + &ui_curve_template_runtime_center[0], bounds.xmin, bounds.xmax, ""); @@ -5293,8 +5301,9 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const float center_x_pre = 0.0f; float center_y_pre = 0.0f; BKE_curveprofile_get_selection_center(profile, ¢er_x_pre, ¢er_y_pre); - BKE_curveprofile_translate_selection( - profile, profile->runtime.center_x - center_x_pre, profile->runtime.center_y - center_y_pre); + BKE_curveprofile_translate_selection(profile, + ui_curve_template_runtime_center[0] - center_x_pre, + ui_curve_template_runtime_center[1] - center_y_pre); BKE_curveprofile_update(profile, PROF_UPDATE_REMOVE_DOUBLES | PROF_UPDATE_CLIP); rna_update_cb(C, cb); }); @@ -5309,7 +5318,7 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, - &profile->runtime.center_y, + &ui_curve_template_runtime_center[1], bounds.ymin, bounds.ymax, ""); @@ -5319,8 +5328,9 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, const float center_x_pre = 0.0f; float center_y_pre = 0.0f; BKE_curveprofile_get_selection_center(profile, ¢er_x_pre, ¢er_y_pre); - BKE_curveprofile_translate_selection( - profile, profile->runtime.center_x - center_x_pre, profile->runtime.center_y - center_y_pre); + BKE_curveprofile_translate_selection(profile, + ui_curve_template_runtime_center[0] - center_x_pre, + ui_curve_template_runtime_center[1] - center_y_pre); BKE_curveprofile_update(profile, PROF_UPDATE_REMOVE_DOUBLES | PROF_UPDATE_CLIP); rna_update_cb(C, cb); }); diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index d5b652fa37c..54ac42d220f 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -27,12 +27,6 @@ typedef struct CurveMapPoint { short flag, shorty; } CurveMapPoint; -typedef struct CurveMap_Runtime { - /** Temp storage for multiple selections operation. */ - /** Center of selected points */ - float center_x, center_y; -} CurveMap_Runtime; - /** #CurveMapPoint.flag */ enum { CUMA_SELECT = (1 << 0), @@ -64,8 +58,6 @@ typedef struct CurveMap { float premul_ext_out[2]; short default_handle_type; char _pad[6]; - - CurveMap_Runtime runtime; } CurveMap; typedef struct CurveMapping { diff --git a/source/blender/makesdna/DNA_curveprofile_types.h b/source/blender/makesdna/DNA_curveprofile_types.h index 47dd3719ef1..260441762fa 100644 --- a/source/blender/makesdna/DNA_curveprofile_types.h +++ b/source/blender/makesdna/DNA_curveprofile_types.h @@ -31,12 +31,6 @@ typedef struct CurveProfilePoint { struct CurveProfile *profile; } CurveProfilePoint; -typedef struct CurveProfile_Runtime { - /** Temp storage for multiple selections operation. */ - /** Center of selected points */ - float center_x, center_y; -} CurveProfile_Runtime; - /** #CurveProfilePoint.flag */ enum { PROF_SELECT = (1 << 0), @@ -64,8 +58,6 @@ typedef struct CurveProfile { int changed_timestamp; /** Widget's current view, and clipping rect (is default rect too). */ rctf view_rect, clip_rect; - - CurveProfile_Runtime runtime; } CurveProfile; /** #CurveProfile.flag */