[Bf-blender-cvs] [ece878018f9] temp-T96709-painting-target: Merge remote-tracking branch 'origin/master' into temp-T96709-painting-target

Jeroen Bakker noreply at git.blender.org
Wed Apr 6 10:50:42 CEST 2022


Commit: ece878018f96dcb922434d04dbe06f57abf991e7
Author: Jeroen Bakker
Date:   Wed Apr 6 09:04:32 2022 +0200
Branches: temp-T96709-painting-target
https://developer.blender.org/rBece878018f96dcb922434d04dbe06f57abf991e7

Merge remote-tracking branch 'origin/master' into temp-T96709-painting-target

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



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

diff --cc release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 5b446bdfdbf,750e9b527f0..761edf3fca6
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@@ -472,55 -478,48 +475,62 @@@ class SelectPaintSlotHelper
  
          ob = context.active_object
  
 -        layout.prop(settings, "mode", text="Mode")
 +        layout.prop(mode_settings, self.canvas_source_attr_name, text="Mode")
          layout.separator()
  
 -        if settings.mode == 'MATERIAL':
 -            if len(ob.material_slots) > 1:
 -                layout.template_list("MATERIAL_UL_matslots", "layers",
 -                                     ob, "material_slots",
 -                                     ob, "active_material_index", rows=2)
 -            mat = ob.active_material
 -            if mat and mat.texture_paint_images:
 -                row = layout.row()
 -                row.template_list("TEXTURE_UL_texpaintslots", "",
 -                                  mat, "texture_paint_images",
 -                                  mat, "paint_active_slot", rows=2)
 -
 -                if mat.texture_paint_slots:
 -                    slot = mat.texture_paint_slots[mat.paint_active_slot]
 +        have_image = False
 +
 +        match getattr(mode_settings, self.canvas_source_attr_name):
 +            case 'MATERIAL':
 +                if len(ob.material_slots) > 1:
 +                    layout.template_list("MATERIAL_UL_matslots", "layers",
 +                                        ob, "material_slots",
 +                                        ob, "active_material_index", rows=2)
 +                mat = ob.active_material
 +                if mat and mat.texture_paint_images:
 +                    row = layout.row()
 +                    row.template_list("TEXTURE_UL_texpaintslots", "",
 +                                    mat, "texture_paint_slots",
 +                                    mat, "paint_active_slot", rows=2)
 +
 +                    if mat.texture_paint_slots:
 +                        slot = mat.texture_paint_slots[mat.paint_active_slot]
 +                    else:
 +                        slot = None
 +
 +                    have_image = slot is not None
                  else:
 -                    slot = None
 -
 -                have_image = slot is not None
 -            else:
 -                row = layout.row()
 +                    row = layout.row()
  
 -                box = row.box()
 -                box.label(text="No Textures")
 -                have_image = False
 +                    box = row.box()
 +                    box.label(text="No Textures")
  
 -            sub = row.column(align=True)
 -            sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="")
 -
 -        elif settings.mode == 'IMAGE':
 -            mesh = ob.data
 -            uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else ""
 -            layout.template_ID(settings, "canvas", new="image.new", open="image.open")
 -            if settings.missing_uvs:
 -                layout.operator("paint.add_simple_uvs", icon='ADD', text="Add UVs")
 -            else:
 -                layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
 -            have_image = settings.canvas is not None
 +                sub = row.column(align=True)
 +                sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="")
  
 -            layout.prop(settings, "interpolation", text="")
 +            case 'IMAGE':
 +                mesh = ob.data
 +                uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else ""
 +                layout.template_ID(mode_settings, self.canvas_image_attr_name, new="image.new", open="image.open")
 +                if settings.missing_uvs:
 +                    layout.operator("paint.add_simple_uvs", icon='ADD', text="Add UVs")
 +                else:
 +                    layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
 +                have_image = getattr(settings, self.canvas_image_attr_name) is not None
 +                
 +                self.draw_image_interpolation(layout=layout, mode_settings=mode_settings)
 +
 +            case 'COLOR_ATTRIBUTE':
-                 me = ob.data
-                 # TODO(jbakker): When vertex colors are committed change to color attributes
-                 layout.template_list("MESH_UL_vcols", "vcols", me, "vertex_colors", me.vertex_colors, "active_index", rows=2)
++                mesh = ob.data
++                layout.template_list(
++                    "MESH_UL_color_attributes",
++                    "color_attributes",
++                    mesh,
++                    "color_attributes",
++                    mesh.color_attributes,
++                    "active_color_index",
++                    rows=3,
++                )
  
          if settings.missing_uvs:
              layout.separator()
@@@ -532,48 -531,6 +542,46 @@@
              layout.operator("image.save_all_modified", text="Save All Images", icon='FILE_TICK')
  
  
 +class VIEW3D_PT_slots_projectpaint(SelectPaintSlotHelper, View3DPanel, Panel):
 +    bl_category = "Tool"
 +    bl_context = ".imagepaint"  # dot on purpose (access from topbar)
 +    bl_label = "Texture Slots"
 +
 +    canvas_source_attr_name = "mode"
 +    canvas_image_attr_name = "canvas"
 +
 +    @classmethod
 +    def poll(cls, context):
 +        brush = context.tool_settings.image_paint.brush
 +        return (brush is not None and context.active_object is not None)
 +
 +    def get_mode_settings(self, context):
 +        return context.tool_settings.image_paint
 +
 +    def draw_image_interpolation(self, layout, mode_settings):
 +        layout.prop(mode_settings, "interpolation", text="")
 +
 +
 +
 +class VIEW3D_PT_slots_paint_canvas(SelectPaintSlotHelper, View3DPanel, Panel):
 +    bl_category = "Tool"
 +    bl_context = ".sculpt_mode"  # dot on purpose (access from topbar)
 +    bl_label = "Canvas"
 +
 +    @classmethod
 +    def poll(cls, context):
-         if not context.preferences.experimental.use_sculpt_vertex_colors:
-             return False
 +        from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
 +        tool = ToolSelectPanelHelper.tool_active_from_context(context)
 +        if tool is None:
 +            return False
 +        return tool.use_paint_canvas
 +
 +    def get_mode_settings(self, context):
 +        return context.tool_settings.paint_mode
 +    def draw_image_interpolation(self, **kwargs):
 +        pass
 +
 +
  class VIEW3D_PT_mask(View3DPanel, Panel):
      bl_category = "Tool"
      bl_context = ".imagepaint"  # dot on purpose (access from topbar)
diff --cc source/blender/blenkernel/intern/material.c
index e1092120d06,7d01a92e829..63dabb51c07
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@@ -1454,29 -1425,13 +1454,28 @@@ static bool fill_texpaint_slots_cb(bNod
  static void fill_texpaint_slots_recursive(bNodeTree *nodetree,
                                            bNode *active_node,
                                            Material *ma,
 -                                          int slot_len)
 +                                          int slot_len,
 +                                          ePaintSlotFilter slot_filter)
  {
    struct FillTexPaintSlotsData fill_data = {active_node, ma, 0, slot_len};
 -  ntree_foreach_texnode_recursive(nodetree, fill_texpaint_slots_cb, &fill_data);
 +  ntree_foreach_texnode_recursive(nodetree, fill_texpaint_slots_cb, &fill_data, slot_filter);
  }
  
 -void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma)
 +/** 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) {
-     SET_FLAG_FROM_TEST(
-         slot_filter, U.experimental.use_sculpt_vertex_colors, PAINT_SLOT_COLOR_ATTRIBUTE);
++    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;
 +  }
 +  return slot_filter;
 +}
 +
 +void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const struct Object *ob)
  {
    int count = 0;
  
diff --cc source/blender/editors/sculpt_paint/CMakeLists.txt
index 7d5108f9d0e,fe7683d12f5..b89cbcf87fa
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@@ -31,9 -31,9 +31,10 @@@ set(SR
    curves_sculpt_add.cc
    curves_sculpt_comb.cc
    curves_sculpt_delete.cc
+   curves_sculpt_grow_shrink.cc
    curves_sculpt_ops.cc
    curves_sculpt_snake_hook.cc
 +  paint_canvas.cc
    paint_cursor.c
    paint_curve.c
    paint_curve_undo.c
diff --cc source/blender/editors/sculpt_paint/paint_canvas.cc
index ac934ee179d,00000000000..f66b36013a7
mode 100644,000000..100644
--- a/source/blender/editors/sculpt_paint/paint_canvas.cc
+++ b/source/blender/editors/sculpt_paint/paint_canvas.cc
@@@ -1,209 -1,0 +1,206 @@@
 +/* SPDX-License-Identifier: GPL-2.0-or-later */
 +#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"
 +#include "BKE_customdata.h"
 +#include "BKE_material.h"
 +#include "BKE_paint.h"
 +#include "BKE_pbvh.h"
 +
 +#include "DEG_depsgraph.h"
 +
 +#include "NOD_shader.h"
 +
 +#include "WM_toolsystem.h"
 +
 +namespace blender::ed::sculpt_paint::canvas {
 +static TexPaintSlot *get_active_slot(Object *ob)
 +{
 +  Material *mat = BKE_object_material_get(ob, ob->actcol);
 +  if (mat == nullptr) {
 +    return nullptr;
 +  }
 +  if (mat->texpaintslot == nullptr) {
 +    return nullptr;
 +  }
 +  if (mat->paint_active_slot >= mat->tot_slots) {
 +    return nullptr;
 +  }
 +
 +  TexPaintSlot *slot = &mat->texpaintslot[mat->paint_active_sl

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list