[Bf-blender-cvs] [9f7f437af70] sculpt-dev: Sculpt-dev: add option to ignore UVs

Joseph Eagar noreply at git.blender.org
Tue Dec 14 20:16:59 CET 2021


Commit: 9f7f437af70a3a28ab11e926006cf3ae72684219
Author: Joseph Eagar
Date:   Tue Dec 14 11:16:10 2021 -0800
Branches: sculpt-dev
https://developer.blender.org/rB9f7f437af70a3a28ab11e926006cf3ae72684219

Sculpt-dev: add option to ignore UVs

* Added option to ignore UVs for sculpt
  mode.
* Tweaked sculpt header a bit.

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/blenkernel/intern/pbvh_intern.h
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/makesdna/DNA_mesh_types.h
M	source/blender/makesrna/intern/rna_mesh.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index ee55a2c1f7b..b82f1989fc3 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1148,11 +1148,11 @@ class FalloffPanel(BrushPanel):
         if mode == "SCULPT" and "falloff_curve" in brush.channels:
             ch, path = UnifiedPaintPanel.get_channel(context, brush, "falloff_curve", need_path=True)
             path += ".curve.curve"
-            template_curve(layout, ch.curve, "curve", path, True)
 
-            UnifiedPaintPanel.channel_unified(layout, context, brush, "falloff_shape", expand=True)
-            #layout.prop(brush, "falloff_shape", expand=True)
+            if ch.curve.curve_preset == "CUSTOM":
+                template_curve(layout, ch.curve, "curve", path, True)
 
+            UnifiedPaintPanel.channel_unified(layout, context, brush, "falloff_shape", expand=True)
             return
 
         col = layout.column(align=True)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index eb0acf4f199..bd2feb78ea7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -78,13 +78,23 @@ class VIEW3D_HT_tool_header(Header):
         def draw_3d_brush_settings(layout, tool_mode):
             layout.popover("VIEW3D_PT_tools_brush_settings_channels", text="Brush")
 
-            if tool_mode != 'PAINT_WEIGHT':
+            if tool_mode not in ('PAINT_WEIGHT', 'SCULPT'):
                 layout.popover("VIEW3D_PT_tools_brush_texture")
+
             if tool_mode == 'PAINT_TEXTURE':
                 layout.popover("VIEW3D_PT_tools_mask_texture")
+
             layout.popover("VIEW3D_PT_tools_brush_stroke")
-            layout.popover("VIEW3D_PT_tools_brush_falloff")
-            layout.popover("VIEW3D_PT_tools_brush_display")
+
+            sub = layout.row()
+            sub.ui_units_x = 5
+            sub.popover("VIEW3D_PT_tools_brush_falloff_popover")
+
+            # why show this in the header? it takes up space - joeedh
+            #layout.popover("VIEW3D_PT_tools_brush_display")
+
+            if tool_mode == 'SCULPT':
+                layout.popover("VIEW3D_PT_tools_brush_texture")
 
         # Note: general mode options should be added to 'draw_mode_settings'.
         if tool_mode == 'SCULPT':
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index aa03189da58..6d5199ec3c0 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -841,6 +841,25 @@ class VIEW3D_PT_tools_brush_falloff(Panel, View3DPaintPanel, FalloffPanel):
     bl_label = ""
     bl_options = {'DEFAULT_CLOSED'}
 
+class VIEW3D_PT_tools_brush_falloff_popover(Panel, View3DPaintPanel, FalloffPanel):
+    bl_context = ".brush_editor"  # dot on purpose (access from topbar)
+    #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
+    bl_label = ""
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw_header(self, context):
+        layout = self.layout
+        settings = self.paint_settings(context)
+        mode = self.get_brush_mode(context)
+        brush = settings.brush
+
+        if mode == "SCULPT" and "falloff_curve" in brush.channels:
+            #layout.label(text="Falloff")
+            ch = UnifiedPaintPanel.get_channel(context, brush, "falloff_curve")
+            layout.prop(ch.curve, "curve_preset", text="")
+        else:
+            layout.label(text="Falloff")
+            layout.prop(brush, "curve_preset", text="")
 
 class VIEW3D_PT_tools_brush_falloff_frontface(View3DPaintPanel, Panel):
     bl_context = ".imagepaint"  # dot on purpose (access from topbar)
@@ -1180,6 +1199,7 @@ class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
         #col.prop(sculpt, "use_dyntopo_cleanup")
         col.prop(sculpt, "use_smooth_shading")
         col.prop(sculpt, "use_flat_vcol_shading")
+        col.prop(context.object.data, "sculpt_ignore_uvs")
 
         UnifiedPaintPanel.channel_unified(layout, context, brush, "dyntopo_spacing", slider=True, ui_editing=False)
         UnifiedPaintPanel.channel_unified(layout, context, brush, "dyntopo_radius_scale", slider=True, ui_editing=False)
@@ -1254,6 +1274,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
         col.prop(sculpt, "use_fast_draw")
         col.prop(sculpt, "use_deform_only")
         col.prop(sculpt, "show_sculpt_pivot")
+        col.prop(context.object.data, "sculpt_ignore_uvs")
 
         UnifiedPaintPanel.channel_unified(layout.column(),
             context,
@@ -2666,6 +2687,7 @@ classes = (VIEW3D_MT_brush_context_menu,
     VIEW3D_PT_tools_brush_stroke,
     VIEW3D_PT_tools_brush_stroke_smooth_stroke,
     VIEW3D_PT_tools_brush_falloff,
+    VIEW3D_PT_tools_brush_falloff_popover,
     VIEW3D_PT_tools_brush_falloff_frontface,
     VIEW3D_PT_tools_brush_falloff_normal,
     VIEW3D_PT_tools_brush_display,
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index e7cee8c2b46..a29f471a995 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -764,6 +764,8 @@ typedef struct SculptSession {
   int totuv;
 
   bool bm_smooth_shading;
+  bool ignore_uvs;
+
   /* Undo/redo log for dynamic topology sculpting */
   struct BMLog *bm_log;
 
@@ -936,8 +938,9 @@ bool BKE_sculptsession_customlayer_release(struct Object *ob, SculptCustomLayer
 void BKE_sculptsession_bmesh_attr_update_internal(struct Object *ob);
 void BKE_sculptsession_update_attr_refs(struct Object *ob);
 int BKE_sculptsession_get_totvert(const SculptSession *ss);
+void BKE_sculptsession_ignore_uvs_set(struct Object *ob, bool value);
 
-/**
+    /**
  * Create new color layer on object if it doesn't have one and if experimental feature set has
  * sculpt vertex color enabled. Returns truth if new layer has been added, false otherwise.
  */
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 9c53d2939ab..10360e8183e 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -348,7 +348,8 @@ void BKE_pbvh_update_sculpt_verts(struct BMesh *bm,
                                   const int boundary_symmetry,
                                   const int vcol_type,
                                   const AttributeDomain vcol_domain,
-                                  const int cd_vcol_offset);
+                                  const int cd_vcol_offset,
+                                  bool do_uvs);
 
 /** update original data, only data whose r_** parameters are passed in will be updated*/
 void BKE_pbvh_bmesh_update_origvert(
@@ -905,7 +906,8 @@ void BKE_pbvh_update_vert_boundary(int cd_sculpt_vert,
                                    struct BMVert *v,
                                    int bound_symmetry,
                                    const CustomData *ldata,
-                                   const int totuv);
+                                   const int totuv,
+                                   const bool do_uvs);
 
 #define DYNTOPO_DYNAMIC_TESS
 
@@ -1133,3 +1135,5 @@ void BKE_pbvh_pmap_to_edges(PBVH *pbvh,
                             bool *heap_alloc,
                             int **r_polys);
 void BKE_pbvh_set_vemap(PBVH *pbvh, struct MeshElemMap *vemap);
+
+void BKE_pbvh_ignore_uvs_set(PBVH *pbvh, bool value);
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 54dc64a2995..99b3fcbe378 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1670,6 +1670,14 @@ char BKE_get_fset_boundary_symflag(Object *object)
   return mesh->flag & ME_SCULPT_MIRROR_FSET_BOUNDARIES ? mesh->symmetry : 0;
 }
 
+void BKE_sculptsession_ignore_uvs_set(Object *ob, bool value)
+{
+  ob->sculpt->ignore_uvs = value;
+
+  if (ob->sculpt->pbvh) {
+    BKE_pbvh_ignore_uvs_set(ob->sculpt->pbvh, value);
+  }
+}
 /**
  * \param need_mask: So that the evaluated mesh that is returned has mask data.
  */
@@ -1690,6 +1698,7 @@ static void sculpt_update_object(Depsgraph *depsgraph,
   ss->depsgraph = depsgraph;
 
   ss->bm_smooth_shading = scene->toolsettings->sculpt->flags & SCULPT_DYNTOPO_SMOOTH_SHADING;
+  ss->ignore_uvs = me->flag & ME_SCULPT_IGNORE_UVS;
 
   ss->deform_modifiers_active = sculpt_modifiers_active(scene, sd, ob);
   ss->show_mask = (sd->flags & SCULPT_HIDE_MASK) == 0;
@@ -3235,8 +3244,8 @@ static bool sculpt_temp_customlayer_get(SculptSession *ss,
         CustomData_add_layer_named(cdata, proptype, CD_CALLOC, NULL, totelem, name);
         idx = CustomData_get_named_layer_index(cdata, proptype, name);
 
-        //if (!permanent) {
-          cdata->layers[idx].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
+        // if (!permanent) {
+        cdata->layers[idx].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
         //}
       }
 
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 0be4536db20..ebb0a405f46 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -4611,6 +4611,32 @@ void BKE_pbvh_set_stroke_id(PBVH *pbvh, int stroke_id)
   pbvh->stroke_id = stroke_id;
 }
 
+static void pbvh_boundaries_flag_update(PBVH *pbvh)
+{
+
+  if (pbvh->bm) {
+    BMVert *v;
+    BMIter iter;
+
+    BM_ITER_MESH (v, &iter, pbvh->bm, BM_VERTS_OF_MESH) {
+      MSculptVert *mv = BM_ELEM_CD_GET_VOID_P(v, pbvh->cd_sculpt_vert);
+
+      mv->flag |= SCULPTVERT_NEED_BOUNDARY;
+    }
+  }
+  else {
+    int totvert = pbvh->totvert;
+
+    if (BKE_pbvh_type(pbvh) == PBVH_GRIDS) {
+      totvert = BKE_pbvh_get_grid_num_vertices(pbvh);
+    }
+
+    for (int i = 0; i < totvert; i++) {
+      pbvh->mdyntopo_verts[i].flag |= SCULPTVERT_NEED_BOUNDARY;
+    }
+  }
+}
+
 void BKE_pbvh_set_symmetry(PBVH *pbvh, int symmetry, int boundary_symmetry)
 {
   if (symmetry == pbvh->symmetry && boundary_symmetry == pbvh->boundary_symmetry) {
@@ -4

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list