diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-05 06:35:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-05 06:38:58 +0300 |
commit | 5c8f1053b5f0f65168497fe5989cbc1b5cbba1ea (patch) | |
tree | ca29583fbe90a5315403a2192f11ef2d140f4be7 /source/blender/editors/space_image | |
parent | d59c4c9d61a1634f75369a02ff7f381612988c9f (diff) |
UI: split UV editor out of the image space
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 01d2fc28c6b..b5c7657d890 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -53,6 +53,10 @@ #include "BKE_screen.h" #include "BKE_workspace.h" +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_enum_types.h" + #include "DEG_depsgraph.h" #include "IMB_imbuf_types.h" @@ -69,8 +73,6 @@ #include "BIF_gl.h" -#include "RNA_access.h" - #include "WM_api.h" #include "WM_types.h" #include "WM_message.h" @@ -954,6 +956,37 @@ static void image_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID } } +/** + * \note Used for splitting out a subset of modes is more involved, + * The previous non-uv-edit mode is stored so switching back to the + * image doesn't always reset the sub-mode. + */ +static int image_space_subtype_get(ScrArea *sa) +{ + SpaceImage *sima = sa->spacedata.first; + return sima->mode == SI_MODE_UV ? SI_MODE_UV : SI_MODE_VIEW; +} + +static void image_space_subtype_set(ScrArea *sa, int value) +{ + SpaceImage *sima = sa->spacedata.first; + if (value == SI_MODE_UV) { + if (sima->mode != SI_MODE_UV) { + sima->mode_prev = sima->mode; + } + sima->mode = value; + } + else { + sima->mode = sima->mode_prev; + } +} + +static void image_space_subtype_item_extend( + bContext *UNUSED(C), EnumPropertyItem **item, int *totitem) +{ + RNA_enum_items_add(item, totitem, rna_enum_space_image_mode_items); +} + /**************************** spacetype *****************************/ /* only called once, from space/spacetypes.c */ @@ -977,6 +1010,9 @@ void ED_spacetype_image(void) st->context = image_context; st->gizmos = image_widgets; st->id_remap = image_id_remap; + st->space_subtype_item_extend = image_space_subtype_item_extend; + st->space_subtype_get = image_space_subtype_get; + st->space_subtype_set = image_space_subtype_set; /* regions: main window */ art = MEM_callocN(sizeof(ARegionType), "spacetype image region"); |