diff options
Diffstat (limited to 'source/blender/editors/curves')
-rw-r--r-- | source/blender/editors/curves/CMakeLists.txt | 13 | ||||
-rw-r--r-- | source/blender/editors/curves/intern/curves_ops.cc | 27 |
2 files changed, 33 insertions, 7 deletions
diff --git a/source/blender/editors/curves/CMakeLists.txt b/source/blender/editors/curves/CMakeLists.txt index 3c31e8014ff..303d2fb71dc 100644 --- a/source/blender/editors/curves/CMakeLists.txt +++ b/source/blender/editors/curves/CMakeLists.txt @@ -8,6 +8,7 @@ set(INC ../../depsgraph ../../functions ../../geometry + ../../gpu ../../makesdna ../../makesrna ../../windowmanager @@ -27,5 +28,17 @@ set(LIB bf_blenlib ) +if(WITH_TBB) + list(APPEND INC_SYS + ${TBB_INCLUDE_DIRS} + ) + add_definitions(-DWITH_TBB) + if(WIN32) + # TBB includes Windows.h which will define min/max macros + # that will collide with the stl versions. + add_definitions(-DNOMINMAX) + endif() +endif() + blender_add_lib(bf_editor_curves "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") add_dependencies(bf_editor_curves bf_rna) diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc index 25bcba6cfb3..dd7edf66920 100644 --- a/source/blender/editors/curves/intern/curves_ops.cc +++ b/source/blender/editors/curves/intern/curves_ops.cc @@ -72,7 +72,7 @@ static bool object_has_editable_curves(const Main &bmain, const Object &object) return true; } -static VectorSet<Curves *> get_unique_editable_curves(const bContext &C) +VectorSet<Curves *> get_unique_editable_curves(const bContext &C) { VectorSet<Curves *> unique_curves; @@ -715,7 +715,7 @@ static void CURVES_OT_snap_curves_to_surface(wmOperatorType *ot) "How to find the point on the surface to attach to"); } -static bool selection_poll(bContext *C) +bool selection_operator_poll(bContext *C) { const Object *object = CTX_data_active_object(C); if (object == nullptr) { @@ -784,7 +784,7 @@ static void CURVES_OT_set_selection_domain(wmOperatorType *ot) ot->description = "Change the mode used for selection masking in curves sculpt mode"; ot->exec = set_selection_domain::curves_set_selection_domain_exec; - ot->poll = selection_poll; + ot->poll = selection_operator_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -820,13 +820,11 @@ static void CURVES_OT_disable_selection(wmOperatorType *ot) ot->description = "Disable the drawing of influence of selection in sculpt mode"; ot->exec = disable_selection::curves_disable_selection_exec; - ot->poll = selection_poll; + ot->poll = selection_operator_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -namespace select_all { - static bool varray_contains_nonzero(const VArray<float> &data) { bool contains_nonzero = false; @@ -841,6 +839,19 @@ static bool varray_contains_nonzero(const VArray<float> &data) return contains_nonzero; } +bool has_anything_selected(const Curves &curves_id) +{ + const CurvesGeometry &curves = CurvesGeometry::wrap(curves_id.geometry); + switch (curves_id.selection_domain) { + case ATTR_DOMAIN_POINT: + return varray_contains_nonzero(curves.selection_point_float()); + case ATTR_DOMAIN_CURVE: + return varray_contains_nonzero(curves.selection_curve_float()); + } + BLI_assert_unreachable(); + return false; +} + static bool any_point_selected(const CurvesGeometry &curves) { return varray_contains_nonzero(curves.selection_point_float()); @@ -856,6 +867,8 @@ static bool any_point_selected(const Span<Curves *> curves_ids) return false; } +namespace select_all { + static void invert_selection(MutableSpan<float> selection) { threading::parallel_for(selection.index_range(), 2048, [&](IndexRange range) { @@ -924,7 +937,7 @@ static void SCULPT_CURVES_OT_select_all(wmOperatorType *ot) ot->description = "(De)select all control points"; ot->exec = select_all::select_all_exec; - ot->poll = selection_poll; + ot->poll = selection_operator_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |