Fix T70554: Snake Hook + Ctrl does not set the brush stroke in its normal direction
This commit also fixes the same issue in elastic deform Reviewed By: jbakker Maniphest Tasks: T70554 Differential Revision: https://developer.blender.org/D6014
This commit is contained in:
		@@ -935,6 +935,7 @@ void BKE_brush_sculpt_reset(Brush *br)
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case SCULPT_TOOL_SNAKE_HOOK:
 | 
					    case SCULPT_TOOL_SNAKE_HOOK:
 | 
				
			||||||
      br->alpha = 1.0f;
 | 
					      br->alpha = 1.0f;
 | 
				
			||||||
 | 
					      br->rake_factor = 1.0f;
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case SCULPT_TOOL_THUMB:
 | 
					    case SCULPT_TOOL_THUMB:
 | 
				
			||||||
      br->size = 75;
 | 
					      br->size = 75;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2107,7 +2107,10 @@ static void update_sculpt_normal(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
 | 
				
			|||||||
  StrokeCache *cache = ob->sculpt->cache;
 | 
					  StrokeCache *cache = ob->sculpt->cache;
 | 
				
			||||||
  /* Grab brush does not update the sculpt normal during a stroke */
 | 
					  /* Grab brush does not update the sculpt normal during a stroke */
 | 
				
			||||||
  const bool update_normal = !(brush->flag & BRUSH_ORIGINAL_NORMAL) &&
 | 
					  const bool update_normal = !(brush->flag & BRUSH_ORIGINAL_NORMAL) &&
 | 
				
			||||||
                             !(brush->sculpt_tool == SCULPT_TOOL_GRAB);
 | 
					                             !(brush->sculpt_tool == SCULPT_TOOL_GRAB) &&
 | 
				
			||||||
 | 
					                             !(brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM) &&
 | 
				
			||||||
 | 
					                             !(brush->sculpt_tool == SCULPT_TOOL_SNAKE_HOOK &&
 | 
				
			||||||
 | 
					                               cache->normal_weight > 0.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0 &&
 | 
					  if (cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0 &&
 | 
				
			||||||
      (cache->first_time || update_normal)) {
 | 
					      (cache->first_time || update_normal)) {
 | 
				
			||||||
@@ -3591,6 +3594,10 @@ static void do_elastic_deform_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
 | 
					  copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (ss->cache->normal_weight > 0.0f) {
 | 
				
			||||||
 | 
					    sculpt_project_v3_normal_align(ss, ss->cache->normal_weight, grab_delta);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SculptThreadedTaskData data = {
 | 
					  SculptThreadedTaskData data = {
 | 
				
			||||||
      .sd = sd,
 | 
					      .sd = sd,
 | 
				
			||||||
      .ob = ob,
 | 
					      .ob = ob,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -502,7 +502,8 @@ typedef enum eBrushUVSculptTool {
 | 
				
			|||||||
       SCULPT_TOOL_SCRAPE, \
 | 
					       SCULPT_TOOL_SCRAPE, \
 | 
				
			||||||
       SCULPT_TOOL_FLATTEN)
 | 
					       SCULPT_TOOL_FLATTEN)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SCULPT_TOOL_HAS_NORMAL_WEIGHT(t) ELEM(t, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)
 | 
					#define SCULPT_TOOL_HAS_NORMAL_WEIGHT(t) \
 | 
				
			||||||
 | 
					  ELEM(t, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_ELASTIC_DEFORM)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define SCULPT_TOOL_HAS_RAKE(t) ELEM(t, SCULPT_TOOL_SNAKE_HOOK)
 | 
					#define SCULPT_TOOL_HAS_RAKE(t) ELEM(t, SCULPT_TOOL_SNAKE_HOOK)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user