Page MenuHome
Paste P349

Simple image flipping preview
ActivePublic

Authored by Campbell Barton (campbellbarton) on Apr 15 2016, 3:09 AM.
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 10b4e24..7ef80b9 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -644,8 +644,15 @@ class IMAGE_PT_view_properties(Panel):
col = split.column()
if ima:
col.prop(ima, "display_aspect", text="Aspect Ratio")
+ if show_render:
+ render_slot = ima.render_slots.active
+ col.label("Slot Name")
+ col.prop(render_slot, "name", text="")
col = split.column()
+ col.label(text="Flip:")
+ col.prop(sima, "show_flip_x")
+ col.prop(sima, "show_flip_y")
col.label(text="Coordinates:")
col.prop(sima, "show_repeat", text="Repeat")
if show_uvedit:
@@ -679,11 +686,6 @@ class IMAGE_PT_view_properties(Panel):
sub.active = uvedit.show_stretch
sub.row().prop(uvedit, "draw_stretch_type", expand=True)
- if show_render and ima:
- layout.separator()
- render_slot = ima.render_slots.active
- layout.prop(render_slot, "name", text="Slot Name")
-
class IMAGE_PT_tools_transform_uvs(Panel, UVToolsPanel):
bl_label = "Transform"
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index ccf9e82..88efd99 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -600,6 +600,13 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar)
if (ima)
h *= ima->aspy / ima->aspx;
+ if (sima->flag & SI_SHOW_FLIP_X) {
+ w *= -1.0;
+ }
+ if (sima->flag & SI_SHOW_FLIP_Y) {
+ h *= -1.0;
+ }
+
winx = BLI_rcti_size_x(&ar->winrct) + 1;
winy = BLI_rcti_size_y(&ar->winrct) + 1;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 46b7d71..0e3d9bf 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -953,8 +953,8 @@ typedef enum eSpaceImage_Flag {
SI_PREVSPACE = (1 << 15),
SI_FULLWINDOW = (1 << 16),
-/* SI_DEPRECATED4 = (1 << 17), */ /* deprecated */
-/* SI_DEPRECATED5 = (1 << 18), */ /* deprecated */
+ SI_SHOW_FLIP_X = (1 << 17),
+ SI_SHOW_FLIP_Y = (1 << 18),
/* this means that the image is drawn until it reaches the view edge,
* in the image view, it's unrelated to the 'tile' mode for texface
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f4db027..e25aed2 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2949,6 +2949,16 @@ static void rna_def_space_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+ prop = RNA_def_property(srna, "show_flip_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SHOW_FLIP_X);
+ RNA_def_property_ui_text(prop, "Flip X", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_flip_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SHOW_FLIP_Y);
+ RNA_def_property_ui_text(prop, "Flip Y", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
prop = RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SHOW_GPENCIL);
RNA_def_property_ui_text(prop, "Show Grease Pencil",

Event Timeline

Campbell Barton (campbellbarton) changed the title of this paste from untitled to Simple image flipping preview.
Campbell Barton (campbellbarton) updated the paste's language from autodetect to autodetect.
Campbell Barton (campbellbarton) edited the content of this paste. (Show Details)