diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 12:57:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 12:57:49 +0300 |
commit | 43ce201125ff97e16a56b372a91442590498dacc (patch) | |
tree | 10b6ef3c41cab5b9cef0b93d99de0a14fca4157f | |
parent | 75188552a113f4dc226f21076f883ac3c11c9a98 (diff) | |
parent | 42103a3eb8e9ee341c89310cc2343bc21b6ae7e2 (diff) |
Merge branch 'master' into blender2.8
14 files changed, 24 insertions, 19 deletions
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 31abf258d0f..61f53f938e2 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -129,6 +129,7 @@ set(SRC BLI_array_store.h BLI_array_store_utils.h BLI_array_utils.h + BLI_assert.h BLI_astar.h BLI_bitmap.h BLI_bitmap_draw_2d.h @@ -164,6 +165,7 @@ set(SRC BLI_kdtree.h BLI_lasso_2d.h BLI_link_utils.h + BLI_linklist.h BLI_linklist_lockfree.h BLI_linklist_stack.h BLI_listbase.h diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index fba2aac087b..a35bb81a1c2 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -1223,7 +1223,7 @@ bool BM_mesh_intersect( if (BM_vert_in_edge(e, v_prev)) { BMEdge *e_split; - v_prev = BM_edge_split(bm, e, v_prev, &e_split, CLAMPIS(fac, 0.0f, 1.0f)); + v_prev = BM_edge_split(bm, e, v_prev, &e_split, clamp_f(fac, 0.0f, 1.0f)); BLI_assert(BM_vert_in_edge(e, v_end)); if (!BM_edge_exists(v_prev, vi) && diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp index 8450b521267..0185b85e772 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cpp +++ b/source/blender/compositor/nodes/COM_TimeNode.cpp @@ -54,7 +54,7 @@ void TimeNode::convertToOperations(NodeConverter &converter, const CompositorCon curvemapping_initialize((CurveMapping *)node->storage); fac = curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac); - operation->setValue(CLAMPIS(fac, 0.0f, 1.0f)); + operation->setValue(clamp_f(fac, 0.0f, 1.0f)); converter.addOperation(operation); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 23859ef8514..e7655192eb3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5142,12 +5142,12 @@ static int ui_do_but_COLOR( rgb_to_hsv_compat_v(col, hsv); if (event->type == WHEELDOWNMOUSE) - hsv[2] = CLAMPIS(hsv[2] - 0.05f, 0.0f, 1.0f); + hsv[2] = clamp_f(hsv[2] - 0.05f, 0.0f, 1.0f); else if (event->type == WHEELUPMOUSE) - hsv[2] = CLAMPIS(hsv[2] + 0.05f, 0.0f, 1.0f); + hsv[2] = clamp_f(hsv[2] + 0.05f, 0.0f, 1.0f); else { float fac = 0.005 * (event->y - event->prevy); - hsv[2] = CLAMPIS(hsv[2] + fac, 0.0f, 1.0f); + hsv[2] = clamp_f(hsv[2] + fac, 0.0f, 1.0f); } hsv_to_rgb_v(hsv, data->vec); @@ -5866,12 +5866,12 @@ static int ui_do_but_HSVCIRCLE( } /* XXX hardcoded keymap check.... */ else if (event->type == WHEELDOWNMOUSE) { - hsv[2] = CLAMPIS(hsv[2] - 0.05f, 0.0f, 1.0f); + hsv[2] = clamp_f(hsv[2] - 0.05f, 0.0f, 1.0f); ui_but_hsv_set(but); /* converts to rgb */ ui_numedit_apply(C, block, but, data); } else if (event->type == WHEELUPMOUSE) { - hsv[2] = CLAMPIS(hsv[2] + 0.05f, 0.0f, 1.0f); + hsv[2] = clamp_f(hsv[2] + 0.05f, 0.0f, 1.0f); ui_but_hsv_set(but); /* converts to rgb */ ui_numedit_apply(C, block, but, data); } diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c index 4309e913d9e..00462b456ea 100644 --- a/source/blender/editors/interface/interface_region_color_picker.c +++ b/source/blender/editors/interface/interface_region_color_picker.c @@ -585,7 +585,7 @@ static int ui_colorpicker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *blo ui_rgb_to_color_picker_compat_v(rgb, hsv); - hsv[2] = CLAMPIS(hsv[2] + add, 0.0f, 1.0f); + hsv[2] = clamp_f(hsv[2] + add, 0.0f, 1.0f); ui_color_picker_to_rgb_v(hsv, rgb); if (use_display_colorspace) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c39e2f8a771..4bc3aaaf842 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2825,7 +2825,7 @@ void ui_hsvcircle_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float else radius_t = hsv[1]; - radius = CLAMPIS(radius_t, 0.0f, 1.0f) * radius; + radius = clamp_f(radius_t, 0.0f, 1.0f) * radius; *xpos = centx + cosf(-ang) * radius; *ypos = centy + sinf(-ang) * radius; } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index fbc8fe790c9..b9e6d43aa87 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1123,7 +1123,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event /* some view2d's (graph) don't have min/max zoom, or extreme ones */ if (v2d->maxzoom > 0.0f) - zoomfac = CLAMPIS(0.001f * v2d->maxzoom, 0.001f, 0.01f); + zoomfac = clamp_f(0.001f * v2d->maxzoom, 0.001f, 0.01f); /* x-axis transform */ fac = zoomfac * (event->x - vzd->lastx); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index b7d87949ddb..7dac9a09b97 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -870,7 +870,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) if (cuts != lcd->cuts) { /* allow zero so you can backspace and type in a value * otherwise 1 as minimum would make more sense */ - lcd->cuts = CLAMPIS(cuts, 0, SUBD_CUTS_MAX); + lcd->cuts = clamp_i(cuts, 0, SUBD_CUTS_MAX); RNA_int_set(op->ptr, "number_cuts", (int)lcd->cuts); ringsel_find_edge(lcd, (int)lcd->cuts); show_cuts = true; @@ -878,7 +878,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) } if (smoothness != lcd->smoothness) { - lcd->smoothness = CLAMPIS(smoothness, -SUBD_SMOOTH_MAX, SUBD_SMOOTH_MAX); + lcd->smoothness = clamp_f(smoothness, -SUBD_SMOOTH_MAX, SUBD_SMOOTH_MAX); RNA_float_set(op->ptr, "smoothness", lcd->smoothness); show_cuts = true; ED_region_tag_redraw(lcd->ar); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index a7fb6071f4e..bae186097a8 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1811,7 +1811,7 @@ static void view_zoom_to_window_xy_camera( { RegionView3D *rv3d = ar->regiondata; const float zoomfac = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); - const float zoomfac_new = CLAMPIS(zoomfac * (1.0f / dfac), RV3D_CAMZOOM_MIN_FACTOR, RV3D_CAMZOOM_MAX_FACTOR); + const float zoomfac_new = clamp_f(zoomfac * (1.0f / dfac), RV3D_CAMZOOM_MIN_FACTOR, RV3D_CAMZOOM_MAX_FACTOR); const float camzoom_new = BKE_screen_view3d_zoom_from_fac(zoomfac_new); diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 24cfde90804..fa21facefc2 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -87,6 +87,7 @@ set(SRC ../include/ED_transform_snap_object_context.h ../include/ED_transverts.h ../include/ED_types.h + ../include/ED_undo.h ../include/ED_util.h ../include/ED_uvedit.h ../include/ED_view3d.h diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index c2d159538cb..d32b8696c9c 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1403,7 +1403,7 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar return NULL; } - BM_data_interp_from_verts(bm, vert_array[0], vert_array[1], self->v, CLAMPIS(fac, 0.0f, 1.0f)); + BM_data_interp_from_verts(bm, vert_array[0], vert_array[1], self->v, clamp_f(fac, 0.0f, 1.0f)); PyMem_FREE(vert_array); Py_RETURN_NONE; diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index e2241ade7f0..15548714113 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -1127,7 +1127,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj ret = -1; } else { - *(float *)value = CLAMPIS(tmp_val, 0.0f, 1.0f); + *(float *)value = clamp_f(tmp_val, 0.0f, 1.0f); } break; } @@ -1139,7 +1139,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj ret = -1; } else { - *(float *)value = CLAMPIS(tmp_val, 0.0f, 1.0f); + *(float *)value = clamp_f(tmp_val, 0.0f, 1.0f); } break; } diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index 54b33e7b6b6..bc96ce606a9 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -38,6 +38,7 @@ #include "DNA_meshdata_types.h" #include "BLI_utildefines.h" +#include "BLI_math_base.h" #include "BLI_math_vector.h" #include "BKE_deform.h" @@ -465,7 +466,7 @@ static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key, return -1; } - dw->weight = CLAMPIS(f, 0.0f, 1.0f); + dw->weight = clamp_f(f, 0.0f, 1.0f); } } else { diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c index 224c8295a9b..ca34de219b8 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.c +++ b/source/blender/python/bmesh/bmesh_py_utils.c @@ -33,6 +33,7 @@ #include <Python.h> #include "BLI_utildefines.h" +#include "BLI_math_base.h" #include "MEM_guardedalloc.h" @@ -159,7 +160,7 @@ static PyObject *bpy_bm_utils_vert_collapse_faces(PyObject *UNUSED(self), PyObje bm = py_edge->bm; - e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, CLAMPIS(fac, 0.0f, 1.0f), true, do_join_faces, true); + e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, clamp_f(fac, 0.0f, 1.0f), true, do_join_faces, true); if (e_new) { return BPy_BMEdge_CreatePyObject(bm, e_new); @@ -365,7 +366,7 @@ static PyObject *bpy_bm_utils_edge_split(PyObject *UNUSED(self), PyObject *args) bm = py_edge->bm; - v_new = BM_edge_split(bm, py_edge->e, py_vert->v, &e_new, CLAMPIS(fac, 0.0f, 1.0f)); + v_new = BM_edge_split(bm, py_edge->e, py_vert->v, &e_new, clamp_f(fac, 0.0f, 1.0f)); if (v_new && e_new) { PyObject *ret = PyTuple_New(2); |