Fix T64969: changing color space in image texture node loses changes
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 22 May 2019 08:06:31 +0000 (10:06 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 22 May 2019 08:12:27 +0000 (10:12 +0200)
Don't allow changing it for painted images until they have been saved, similar
to sidebar panels. This could be solved better, for now the important thing is
not to lose changes.

source/blender/editors/space_node/drawnode.c

index bf6ec96..e39e024 100644 (file)
@@ -713,6 +713,11 @@ static void node_buts_image_user(uiLayout *layout,
   PointerRNA colorspace_settings_ptr = RNA_pointer_get(imaptr, "colorspace_settings");
   uiItemL(split, IFACE_("Color Space"), ICON_NONE);
   uiItemR(split, &colorspace_settings_ptr, "name", 0, "", ICON_NONE);
+
+  /* Avoid losing changes image is painted. */
+  if (BKE_image_is_dirty(imaptr->data)) {
+    uiLayoutSetEnabled(split, false);
+  }
 }
 
 static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)