svn merge ^/trunk/blender -r49601:49620
authorCampbell Barton <ideasman42@gmail.com>
Mon, 6 Aug 2012 14:02:03 +0000 (14:02 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 6 Aug 2012 14:02:03 +0000 (14:02 +0000)
1  2 
release/scripts/startup/bl_ui/space_image.py
source/blender/editors/space_image/space_image.c
source/blender/makesrna/intern/rna_space.c

index d7b676e38e88d5d480c7e4f147574dae13551b3e,6585abe0babb76718973d0a79e87230684257242..0138ddc0ac0734e6f694205cfdaf3fcb3c2598ea
@@@ -383,11 -383,17 +383,17 @@@ class IMAGE_HT_header(Header)
  
          layout.prop(sima, "mode", text="")
  
+         if show_maskedit:
+             row = layout.row()
+             row.template_ID(sima, "mask", new="mask.new")
+         if show_uvedit or show_maskedit:
+             layout.prop(sima, "pivot_point", text="", icon_only=True)
          # uv editing
          if show_uvedit:
              uvedit = sima.uv_editor
  
-             layout.prop(uvedit, "pivot_point", text="", icon_only=True)
              layout.prop(toolsettings, "use_uv_select_sync", text="")
  
              if toolsettings.use_uv_select_sync:
              mesh = context.edit_object.data
              layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
  
-         if show_maskedit:
-             row = layout.row()
-             row.template_ID(sima, "mask", new="mask.new")
-             # reused for mask
-             uvedit = sima.uv_editor
-             layout.prop(uvedit, "pivot_point", text="", icon_only=True)
          if ima:
              # layers
              layout.template_image_layers(ima, iuser)
              layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED')
  
  
 +class IMAGE_PT_display_properties(Panel):
 +    bl_space_type = 'IMAGE_EDITOR'
 +    bl_region_type = 'UI'
 +    bl_label = "Display Properties"
 +
 +    def draw(self, context):
 +        layout = self.layout
 +        space = context.space_data
 +
 +        layout.template_colormanaged_view_settings(space, "view_settings", True)
 +
 +
  class IMAGE_PT_image_properties(Panel):
      bl_space_type = 'IMAGE_EDITOR'
      bl_region_type = 'UI'
@@@ -629,6 -615,7 +627,7 @@@ class IMAGE_PT_view_properties(Panel)
          sima = context.space_data
          ima = sima.image
          show_uvedit = sima.show_uvedit
+         show_maskedit = sima.show_maskedit
          uvedit = sima.uv_editor
  
          split = layout.split()
              col.label(text="Coordinates:")
              col.prop(uvedit, "show_normalized_coords", text="Normalized")
  
-         if show_uvedit:
+         if show_uvedit or show_maskedit:
              col = layout.column()
              col.label("Cursor Location:")
-             col.row().prop(uvedit, "cursor_location", text="")
+             col.row().prop(sima, "cursor_location", text="")
  
+         if show_uvedit:
              col.separator()
  
              col.label(text="UVs:")
index 4058eb375c18d692b27d6df9a4b636a1a657051c,cc8940201e2faf68f78c77a2d1294a7335ceae9e..86048a704668a4f917baecf90dd7e6851df78405
@@@ -151,8 -151,6 +151,8 @@@ static SpaceLink *image_new(const bCont
        simage->zoom = 1.0f;
        simage->lock = TRUE;
  
 +      BKE_color_managed_view_settings_init(&simage->view_settings);
 +
        simage->iuser.ok = TRUE;
        simage->iuser.fie_ima = 2;
        simage->iuser.frames = 100;
@@@ -215,7 -213,6 +215,7 @@@ static void image_init(struct wmWindowM
  
  static SpaceLink *image_duplicate(SpaceLink *sl)
  {
 +      SpaceImage *simage = (SpaceImage *) sl;
        SpaceImage *simagen = MEM_dupallocN(sl);
        
        /* clear or remove stuff from old */
  
        scopes_new(&simagen->scopes);
  
 +      BKE_color_managed_view_settings_copy(&simagen->view_settings, &simage->view_settings);
 +
        return (SpaceLink *)simagen;
  }
  
@@@ -323,6 -318,19 +323,19 @@@ static void image_keymap(struct wmKeyCo
                RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slot");
                RNA_int_set(kmi->ptr, "value", i);
        }
+       /* pivot */
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
+       RNA_string_set(kmi->ptr, "value", "CENTER");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
+       RNA_string_set(kmi->ptr, "value", "MEDIAN");
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
+       RNA_string_set(kmi->ptr, "value", "CURSOR");
  }
  
  /* dropboxes */
@@@ -366,9 -374,11 +379,11 @@@ static void image_refresh(const bContex
        /* check if we have to set the image from the editmesh */
        if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
                if (sima->lock) {
-                       Mask *mask = ED_space_image_get_mask(sima);
-                       if (mask) {
-                               ED_node_composite_job(C, scene->nodetree, scene);
+                       if (scene->nodetree) {
+                               Mask *mask = ED_space_image_get_mask(sima);
+                               if (mask) {
+                                       ED_node_composite_job(C, scene->nodetree, scene);
+                               }
                        }
                }
        }
@@@ -637,7 -647,7 +652,7 @@@ static void image_main_area_draw(const 
        image_main_area_set_view2d(sima, ar);
  
        /* we draw image in pixelspace */
 -      draw_image_main(sima, ar, scene);
 +      draw_image_main(C, ar);
  
        /* and uvs in 0.0-1.0 space */
        UI_view2d_view_ortho(v2d);
index f0395a4623179bfeea4263c97e833047a398691a,01a58463fb6deb3527c850585c1381dbb8407166..1db3e9678a4efebdc50167e10913ba9fceea3e39
@@@ -152,7 -152,6 +152,7 @@@ EnumPropertyItem clip_editor_mode_items
  #include "ED_sequencer.h"
  #include "ED_clip.h"
  
 +#include "IMB_colormanagement.h"
  #include "IMB_imbuf_types.h"
  
  static StructRNA *rna_Space_refine(struct PointerRNA *ptr)
@@@ -1166,13 -1165,6 +1166,6 @@@ static void rna_def_space_image_uv(Blen
                {0, NULL, 0, NULL, NULL}
        };
  
-       static EnumPropertyItem pivot_items[] = {
-               {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
-               {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
-               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
        srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
        RNA_def_struct_sdna(srna, "SpaceImage");
        RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
        RNA_def_property_ui_text(prop, "Draw Faces", "Draw faces over the image");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
  
-       prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
-       RNA_def_property_array(prop, 2);
-       RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
-                                    "rna_SpaceImageEditor_cursor_location_set", NULL);
-       RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
        /* todo: move edge and face drawing options here from G.f */
  
        prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_ui_text(prop, "Live Unwrap",
                                 "Continuously unwrap the selected UV island while transforming pinned vertices");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-       prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "around");
-       RNA_def_property_enum_items(prop, pivot_items);
-       RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
  }
  
  static void rna_def_space_outliner(BlenderRNA *brna)
@@@ -1929,7 -1908,7 +1909,7 @@@ static void rna_def_space_buttons(Blend
                {SB_TEXC_MAT_OR_LAMP, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
                {0, NULL, 0, NULL, NULL}
        };                             /*actually populated dynamically trough a function */
 -              
 +
        srna = RNA_def_struct(brna, "SpaceProperties", "Space");
        RNA_def_struct_sdna(srna, "SpaceButs");
        RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
@@@ -1978,6 -1957,13 +1958,13 @@@ static void rna_def_space_image(Blender
                {0, NULL, 0, NULL, NULL}
        };
  
+       static EnumPropertyItem pivot_items[] = {
+               {V3D_CENTER, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
+               {V3D_CENTROID, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
+               {V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
+               {0, NULL, 0, NULL, NULL}
+       };
        StructRNA *srna;
        PropertyRNA *prop;
  
        RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
  
+       /* transform */
+       prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+       RNA_def_property_array(prop, 2);
+       RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
+                                    "rna_SpaceImageEditor_cursor_location_set", NULL);
+       RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+       prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "around");
+       RNA_def_property_enum_items(prop, pivot_items);
+       RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
        /* grease pencil */
        prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "gpd");
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
  
 +      prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
 +      RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
 +      RNA_def_property_ui_text(prop, "View Settings", "Color management settings used for displaying images on the display");
 +
        prop = RNA_def_property(srna, "show_maskedit", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_maskedit_get", NULL);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@@ -2209,11 -2204,6 +2210,11 @@@ static void rna_def_space_sequencer(Ble
        RNA_def_property_struct_type(prop, "GreasePencil");
        RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
 +
 +      prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
 +      RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
 +      RNA_def_property_ui_text(prop, "View Settings", "Color management settings used for displaying images on the display");
  }
  
  static void rna_def_space_text(BlenderRNA *brna)
@@@ -3008,11 -2998,6 +3009,11 @@@ static void rna_def_space_node(BlenderR
        RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
  
 +      prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
 +      RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
 +      RNA_def_property_ui_text(prop, "View Settings", "Color management settings used for displaying images on the display");
 +
        prop = RNA_def_property(srna, "show_highlight", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_HIGHLIGHT);
        RNA_def_property_ui_text(prop, "Highlight", "Highlight nodes that are being calculated");
@@@ -3330,12 -3315,6 +3331,12 @@@ static void rna_def_space_clip(BlenderR
        RNA_def_property_enum_items(prop, pivot_items);
        RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
 +
 +      /* color management view settings */
 +      prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
 +      RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
 +      RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
 +      RNA_def_property_ui_text(prop, "View Settings", "Color management settings used for displaying images on the display");
  }