Cleanup image's poll funcs.
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 17 Jul 2015 10:18:58 +0000 (12:18 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 17 Jul 2015 10:19:57 +0000 (12:19 +0200)
Checking space returned from CTX_wm_space_image() is SPACE_IMAGE type... tssst. :)

source/blender/editors/space_image/image_ops.c

index ac0f327af0d61c4e23a5d2b877a9a229780d5d3b..cc8a4357890e13b757084f6cd5432674c40ef86d 100644 (file)
@@ -159,10 +159,10 @@ static int image_poll(bContext *C)
 static int space_image_buffer_exists_poll(bContext *C)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
-       if (sima && sima->spacetype == SPACE_IMAGE)
-               if (ED_space_image_has_buffer(sima))
-                       return 1;
-       return 0;
+       if (sima && ED_space_image_has_buffer(sima)) {
+                       return true;
+       }
+       return false;
 }
 
 static int image_not_packed_poll(bContext *C)
@@ -205,26 +205,29 @@ static int space_image_file_exists_poll(bContext *C)
 
                return ret;
        }
-       return 0;
+       return false;
 }
 
+#if 0  /* UNUSED */
 static int space_image_poll(bContext *C)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
-       if (sima && sima->spacetype == SPACE_IMAGE && sima->image)
-               return 1;
-       return 0;
+       if (sima && sima->image) {
+               return true;
+       }
+       return false;
 }
+#endif
 
 int space_image_main_area_poll(bContext *C)
 {
        SpaceImage *sima = CTX_wm_space_image(C);
-       // XXX ARegion *ar = CTX_wm_region(C);
+       /* XXX ARegion *ar = CTX_wm_region(C); */
 
-       if (sima)
-               return 1;  // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW);
-       
-       return 0;
+       if (sima) {
+               return true;  /* XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW); */
+       }
+       return false;
 }
 
 /* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */