[Bf-blender-cvs] [66a3a589fa3] temp-T96709-painting-target: Don't trigger depsgraph update when switching tools.
Jeroen Bakker
noreply at git.blender.org
Tue Apr 5 15:20:35 CEST 2022
Commit: 66a3a589fa355bd3b158c68c7cf5faf395a0967c
Author: Jeroen Bakker
Date: Tue Apr 5 13:50:06 2022 +0200
Branches: temp-T96709-painting-target
https://developer.blender.org/rB66a3a589fa355bd3b158c68c7cf5faf395a0967c
Don't trigger depsgraph update when switching tools.
===================================================================
M source/blender/editors/include/ED_paint.h
M source/blender/editors/sculpt_paint/paint_canvas.cc
M source/blender/editors/space_view3d/space_view3d.c
===================================================================
diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h
index b6f0ba8947c..105f08a30bd 100644
--- a/source/blender/editors/include/ED_paint.h
+++ b/source/blender/editors/include/ED_paint.h
@@ -129,10 +129,6 @@ eV3DShadingColorType ED_paint_shading_color_override(struct bContext *C,
/** Does the active tool uses a paint canvas for the given object. */
bool ED_paint_tool_use_canvas(struct bContext *C, struct Object *ob);
-void ED_paint_do_msg_notify_active_tool_changed(struct bContext *C,
- struct wmMsgSubscribeKey *msg_key,
- struct wmMsgSubscribeValue *msg_val);
-
/* Store the last used tool in the sculpt session. */
void ED_paint_tool_update_sticky_shading_color(struct bContext *C, struct Object *ob);
diff --git a/source/blender/editors/sculpt_paint/paint_canvas.cc b/source/blender/editors/sculpt_paint/paint_canvas.cc
index f82bb0e642a..0cdc34bc00a 100644
--- a/source/blender/editors/sculpt_paint/paint_canvas.cc
+++ b/source/blender/editors/sculpt_paint/paint_canvas.cc
@@ -1,10 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include "ED_paint.h"
+#include "BLI_compiler_compat.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
+#include "DNA_screen_types.h"
#include "DNA_workspace_types.h"
#include "BKE_context.h"
@@ -104,20 +104,11 @@ bool ED_paint_tool_use_canvas(struct bContext *C, struct Object *ob)
return false;
}
-static bool paint_tool_last_used_tool_used_canvas(struct Object *ob)
-{
- if (ob == nullptr || ob->sculpt == nullptr) {
- return false;
- }
- return ob->sculpt->sticky_shading_color;
-}
-
eV3DShadingColorType ED_paint_shading_color_override(bContext *C,
const PaintModeSettings *settings,
Object *ob,
eV3DShadingColorType orig_color_type)
{
- printf("%s %d\n", __func__, orig_color_type);
/* NOTE: This early exit is temporarily, until a paint mode has been added.
* For better integration with the vertex paint in sculpt mode we sticky
* with the last stoke when using tools like masking.
@@ -160,7 +151,6 @@ eV3DShadingColorType ED_paint_shading_color_override(bContext *C,
if (!U.experimental.use_sculpt_texture_paint && color_type == V3D_SHADING_TEXTURE_COLOR) {
return orig_color_type;
}
- printf("%s %d->%d\n", __func__, orig_color_type, color_type);
return color_type;
}
@@ -219,20 +209,4 @@ int ED_paint_canvas_uvmap_layer_index_get(const struct PaintModeSettings *settin
}
return -1;
}
-
-void ED_paint_do_msg_notify_active_tool_changed(struct bContext *C,
- struct wmMsgSubscribeKey *msg_key,
- struct wmMsgSubscribeValue *msg_val)
-{
- Object *ob = CTX_data_active_object(C);
- if (ob == nullptr) {
- return;
- }
- if (ob->sculpt == nullptr) {
- return;
- }
- PBVH *pbvh = ob->sculpt->pbvh;
- BKE_pbvh_mark_update_color(pbvh);
- printf("%s\n", __func__);
-}
}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 9a9c60625f8..f8790397547 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1301,6 +1301,27 @@ static void view3d_main_region_listener(const wmRegionListenerParams *params)
}
}
+static void view3d_do_msg_notify_workbench_view_update(struct bContext *C,
+ struct wmMsgSubscribeKey *UNUSED(msg_key),
+ struct wmMsgSubscribeValue *msg_val)
+{
+ Scene *scene = CTX_data_scene(C);
+ ScrArea *area = (ScrArea *)msg_val->user_data;
+ View3D *v3d = (View3D *)area->spacedata.first;
+ if (v3d->shading.type == OB_SOLID) {
+ RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
+ DRWUpdateContext drw_context = {NULL};
+ drw_context.bmain = CTX_data_main(C);
+ drw_context.depsgraph = CTX_data_depsgraph_pointer(C);
+ drw_context.scene = scene;
+ drw_context.view_layer = CTX_data_view_layer(C);
+ drw_context.region = (ARegion *)(msg_val->owner);
+ drw_context.v3d = v3d;
+ drw_context.engine_type = engine_type;
+ DRW_notify_view_update(&drw_context);
+ }
+}
+
static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
{
struct wmMsgBus *mbus = params->message_bus;
@@ -1342,10 +1363,10 @@ static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeP
.notify = ED_region_do_msg_notify_tag_redraw,
};
- wmMsgSubscribeValue msg_sub_value_pbvh_refresh = {
+ wmMsgSubscribeValue msg_sub_value_workbench_view_update = {
.owner = region,
- .user_data = region,
- .notify = ED_paint_do_msg_notify_active_tool_changed,
+ .user_data = area,
+ .notify = view3d_do_msg_notify_workbench_view_update,
};
for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
@@ -1383,8 +1404,8 @@ static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeP
break;
case OB_MODE_SCULPT:
- WM_msg_subscribe_rna_anon_prop(mbus, WorkSpace, tools, &msg_sub_value_pbvh_refresh);
- WM_msg_subscribe_rna_anon_prop(mbus, WorkSpace, tools, &msg_sub_value_region_tag_redraw);
+ WM_msg_subscribe_rna_anon_prop(
+ mbus, WorkSpace, tools, &msg_sub_value_workbench_view_update);
break;
default:
break;
More information about the Bf-blender-cvs
mailing list