From 61aaeb3745ad72c681c17f4535dd06ffaaf78c58 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 18 Feb 2022 09:12:41 +0100 Subject: Curves: initial brush system integration for curves sculpt mode This adds the boilerplate code that is necessary to use the tool/brush/paint systems in the new sculpt curves mode. Two temporary dummy tools are part of this patch. They do nothing and only serve to test the boilerplate. When the first actual tool is added, those dummy tools will be removed. Differential Revision: https://developer.blender.org/D14117 --- source/blender/editors/curves/CMakeLists.txt | 1 + source/blender/editors/curves/intern/curves_ops.cc | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'source/blender/editors/curves') diff --git a/source/blender/editors/curves/CMakeLists.txt b/source/blender/editors/curves/CMakeLists.txt index d2b7dacbc20..93b21a46916 100644 --- a/source/blender/editors/curves/CMakeLists.txt +++ b/source/blender/editors/curves/CMakeLists.txt @@ -6,6 +6,7 @@ set(INC ../../blenlib ../../blentranslation ../../depsgraph + ../../functions ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc index fdda8e636f7..0aa8c4b253e 100644 --- a/source/blender/editors/curves/intern/curves_ops.cc +++ b/source/blender/editors/curves/intern/curves_ops.cc @@ -10,9 +10,13 @@ #include "ED_object.h" #include "WM_api.h" +#include "WM_toolsystem.h" #include "WM_types.h" #include "BKE_context.h" +#include "BKE_paint.h" + +#include "DNA_scene_types.h" #include "RNA_access.h" #include "RNA_define.h" @@ -32,6 +36,7 @@ static bool curves_sculptmode_toggle_poll(bContext *C) static int curves_sculptmode_toggle_exec(bContext *C, wmOperator *op) { + Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); const bool is_mode_set = ob->mode == OB_MODE_SCULPT_CURVES; @@ -45,9 +50,11 @@ static int curves_sculptmode_toggle_exec(bContext *C, wmOperator *op) ob->mode = OB_MODE_OBJECT; } else { + BKE_paint_ensure(scene->toolsettings, (Paint **)&scene->toolsettings->curves_sculpt); ob->mode = OB_MODE_SCULPT_CURVES; } + WM_toolsystem_update_from_context_view3d(C); WM_event_add_notifier(C, NC_SCENE | ND_MODE, nullptr); return OPERATOR_CANCELLED; } -- cgit v1.2.3