[Bf-blender-cvs] [b950a8fb797] master: Painting: Don't calculate rake rotation when texture is not set.

Jeroen Bakker noreply at git.blender.org
Tue Sep 20 08:30:48 CEST 2022


Commit: b950a8fb797a6248f0a89e47b960ae9a3638ac89
Author: Jeroen Bakker
Date:   Tue Sep 20 08:28:35 2022 +0200
Branches: master
https://developer.blender.org/rBb950a8fb797a6248f0a89e47b960ae9a3638ac89

Painting: Don't calculate rake rotation when texture is not set.

Currently the rake rotation is calculated when the angle mode is set. Even when the texture isn't valid.
This change will only calculate the rake rotation when the texture is valid and the angle mode is set.

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

M	source/blender/blenkernel/intern/paint.cc

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

diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index 5dc8e3e0112..0181c6e7eac 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -1315,13 +1315,22 @@ void paint_update_brush_rake_rotation(UnifiedPaintSettings *ups, Brush *brush, f
   }
 }
 
+static bool paint_rake_rotation_active(const MTex &mtex)
+{
+  return mtex.tex && mtex.brush_angle_mode & MTEX_ANGLE_RAKE;
+}
+
+static bool paint_rake_rotation_active(const Brush &brush)
+{
+  return paint_rake_rotation_active(brush.mtex) || paint_rake_rotation_active(brush.mask_mtex);
+}
+
 bool paint_calculate_rake_rotation(UnifiedPaintSettings *ups,
                                    Brush *brush,
                                    const float mouse_pos[2])
 {
   bool ok = false;
-  if ((brush->mtex.brush_angle_mode & MTEX_ANGLE_RAKE) ||
-      (brush->mask_mtex.brush_angle_mode & MTEX_ANGLE_RAKE)) {
+  if (paint_rake_rotation_active(*brush)) {
     const float r = RAKE_THRESHHOLD;
     float rotation;



More information about the Bf-blender-cvs mailing list