Fix T41708, active palette indicator not refreshing when clicking
Issue, after a lot of blood sweat and tears, was found in ui_but_update_from_old_block, where we restore a button to its old values when possible. The problem here is that a1 and a2 are not really meant to store temporary variables, because they tend to get overriden and palette selection is one of those temporary states. Instead, we now store the position of each button in the palette in a2 and pointer to the palette in the customdata pointer of each button and use that to test if it's active. The positions won't change when clicking so we are guaranteed that the old button won't override the new one with garbage. It's still hacky but it is better than testing button types when copying old values.
This commit is contained in:
		@@ -4318,9 +4318,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co
 | 
			
		||||
		else if ((int)(but->a1) == UI_PALETTE_COLOR &&
 | 
			
		||||
		         event->type == DELKEY && event->val == KM_PRESS)
 | 
			
		||||
		{
 | 
			
		||||
			Scene *scene = CTX_data_scene(C);
 | 
			
		||||
			Paint *paint = BKE_paint_get_active(scene);
 | 
			
		||||
			Palette *palette = BKE_paint_palette(paint);
 | 
			
		||||
			Palette *palette = but->rnapoin.id.data;
 | 
			
		||||
			PaletteColor *color = but->rnapoin.data;
 | 
			
		||||
 | 
			
		||||
			BKE_palette_color_remove(palette, color);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user