diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-12-06 02:04:15 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2016-12-06 02:04:15 +0300 |
commit | 8ce6de3bdd9f8869457ea39d20d7e08a01663c39 (patch) | |
tree | 307add2ca624c9c85b26dfc8ea92dae9984f37bc /source | |
parent | fe0520e2c841569712e14446f4afbb4036daae3a (diff) |
Fix T50020: adding a background image does not set image user data.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 6ca738b0e11..f5da7d57010 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -52,6 +52,7 @@ #include "DNA_node_types.h" #include "DNA_packedFile_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" #include "BKE_colortools.h" #include "BKE_context.h" @@ -1218,7 +1219,7 @@ static Image *image_open_single( static int image_open_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); - SpaceImage *sima = CTX_wm_space_image(C); /* XXX other space types can call */ + ScrArea *sa = CTX_wm_area(C); Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); ImageUser *iuser = NULL; @@ -1297,10 +1298,21 @@ static int image_open_exec(bContext *C, wmOperator *op) if (iod->iuser) { iuser = iod->iuser; } - else if (sima) { + else if (sa->spacetype == SPACE_IMAGE) { + SpaceImage *sima = sa->spacedata.first; ED_space_image_set(sima, scene, obedit, ima); iuser = &sima->iuser; } + else if (sa->spacetype == SPACE_VIEW3D) { + View3D *v3d = sa->spacedata.first; + + for (BGpic *bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) { + if (bgpic->ima == ima) { + iuser = &bgpic->iuser; + break; + } + } + } else { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; if (tex && tex->type == TEX_IMAGE) { |