Fix T87448: Avoid uiBut update if value was same
Previously, clicking into a number field, changing nothing and then clicking outside the field again would trigger an update (RNA prop would be set to the same value again). This could potentially cause an expensive operation (like a modifer) to run again, even if all the parameters were identical. The fix prevents this by treating unchanging values in the field as a cancel operation. Reviewed By: Severin Maniphest Tasks: T87448 Differential Revision: https://developer.blender.org/D10976
This commit is contained in:
		@@ -1126,6 +1126,12 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
 | 
			
		||||
    ui_but_value_set(but, data->value);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /* If the value entered is the exact same, do not trigger an update. */
 | 
			
		||||
  if (data->value == data->startvalue) {
 | 
			
		||||
    data->cancel = true;
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ui_but_update_edited(but);
 | 
			
		||||
  ui_apply_but_func(C, but);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user