[Bf-blender-cvs] [c71027705c3] temp-T96709-painting-target: Show Canvas selector only when experimental flag is enabled.

Jeroen Bakker noreply at git.blender.org
Fri Apr 8 08:27:08 CEST 2022


Commit: c71027705c37a31ccb41ae3910008497cd419798
Author: Jeroen Bakker
Date:   Fri Apr 8 08:15:02 2022 +0200
Branches: temp-T96709-painting-target
https://developer.blender.org/rBc71027705c37a31ccb41ae3910008497cd419798

Show Canvas selector only when experimental flag is enabled.

===================================================================

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/material.c
M	source/blender/editors/sculpt_paint/paint_canvas.cc
M	source/blender/makesrna/intern/rna_sculpt_paint.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 6eb85bf76cb..332933be68a 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -570,6 +570,9 @@ class VIEW3D_PT_slots_paint_canvas(SelectPaintSlotHelper, View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
+        if not context.preferences.experimental.use_sculpt_texture_paint:
+            return False
+
         from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
         tool = ToolSelectPanelHelper.tool_active_from_context(context)
         if tool is None:
@@ -578,6 +581,7 @@ class VIEW3D_PT_slots_paint_canvas(SelectPaintSlotHelper, View3DPanel, Panel):
 
     def get_mode_settings(self, context):
         return context.tool_settings.paint_mode
+
     def draw_image_interpolation(self, **kwargs):
         pass
 
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 07f158d7787..bc569956f66 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1477,13 +1477,9 @@ static void fill_texpaint_slots_recursive(bNodeTree *nodetree,
 /** Check which type of paint slots should be filled for the given object. */
 static ePaintSlotFilter material_paint_slot_filter(const struct Object *ob)
 {
-  ePaintSlotFilter slot_filter = 0;
-  if (ob->mode == OB_MODE_SCULPT) {
-    slot_filter = PAINT_SLOT_COLOR_ATTRIBUTE;
-    SET_FLAG_FROM_TEST(slot_filter, U.experimental.use_sculpt_texture_paint, PAINT_SLOT_IMAGE);
-  }
-  else if (ob->mode == OB_MODE_TEXTURE_PAINT) {
-    slot_filter = PAINT_SLOT_IMAGE;
+  ePaintSlotFilter slot_filter = PAINT_SLOT_IMAGE;
+  if (ob->mode == OB_MODE_SCULPT && U.experimental.use_sculpt_texture_paint) {
+    slot_filter |= PAINT_SLOT_COLOR_ATTRIBUTE;
   }
   return slot_filter;
 }
diff --git a/source/blender/editors/sculpt_paint/paint_canvas.cc b/source/blender/editors/sculpt_paint/paint_canvas.cc
index 25089387b3d..9a1a61cf3ab 100644
--- a/source/blender/editors/sculpt_paint/paint_canvas.cc
+++ b/source/blender/editors/sculpt_paint/paint_canvas.cc
@@ -105,6 +105,9 @@ eV3DShadingColorType ED_paint_shading_color_override(bContext *C,
                                                      Object *ob,
                                                      eV3DShadingColorType orig_color_type)
 {
+  if (!U.experimental.use_sculpt_texture_paint) {
+    return 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.
@@ -140,11 +143,6 @@ eV3DShadingColorType ED_paint_shading_color_override(bContext *C,
     }
   }
 
-  /* Reset to original color based on enabled experimental features */
-  if (!U.experimental.use_sculpt_texture_paint && color_type == V3D_SHADING_TEXTURE_COLOR) {
-    return orig_color_type;
-  }
-
   return color_type;
 }
 
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 234d21e2ece..37c687ddb2b 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -558,38 +558,6 @@ static bool rna_PaintModeSettings_canvas_image_poll(PointerRNA *UNUSED(ptr), Poi
   return !ELEM(image->type, IMA_TYPE_COMPOSITE, IMA_TYPE_R_RESULT);
 }
 
-static int rna_PaintModeSettings_canvas_source_get(PointerRNA *ptr)
-{
-  PaintModeSettings *settings = ptr->data;
-  if (!U.experimental.use_sculpt_texture_paint &&
-      settings->canvas_source == PAINT_CANVAS_SOURCE_IMAGE) {
-    return PAINT_CANVAS_SOURCE_COLOR_ATTRIBUTE;
-  }
-
-  return settings->canvas_source;
-}
-
-static const EnumPropertyItem *rna_PaintModeSettings_canvas_source_itemf(bContext *UNUSED(C),
-                                                                         PointerRNA *UNUSED(ptr),
-                                                                         PropertyRNA *UNUSED(prop),
-                                                                         bool *r_free)
-{
-  EnumPropertyItem *items = NULL;
-  int totitem = 0;
-
-  for (int index = 0; rna_enum_canvas_source_items[index].identifier != NULL; index++) {
-    if (!U.experimental.use_sculpt_texture_paint &&
-        rna_enum_canvas_source_items[index].value == PAINT_CANVAS_SOURCE_IMAGE) {
-      continue;
-    }
-    RNA_enum_item_add(&items, &totitem, &rna_enum_canvas_source_items[index]);
-  }
-
-  RNA_enum_item_end(&items, &totitem);
-  *r_free = true;
-  return items;
-}
-
 static void rna_PaintModeSettings_canvas_source_update(bContext *C, PointerRNA *UNUSED(ptr))
 {
   Scene *scene = CTX_data_scene(C);
@@ -1045,10 +1013,6 @@ static void rna_def_paint_mode(BlenderRNA *brna)
   prop = RNA_def_property(srna, "canvas_source", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, rna_enum_canvas_source_items);
   RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
-  RNA_def_property_enum_funcs(prop,
-                              "rna_PaintModeSettings_canvas_source_get",
-                              NULL,
-                              "rna_PaintModeSettings_canvas_source_itemf");
   RNA_def_property_ui_text(prop, "Source", "Source to select canvas from");
   RNA_def_property_update(prop, 0, "rna_PaintModeSettings_canvas_source_update");



More information about the Bf-blender-cvs mailing list