Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-08-11 07:31:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-11 07:31:56 +0400
commit8c393269622bf250ec9b0fbd3e689b534ad1e1ec (patch)
treee5424715db33b5c61485179e94ea6f923d5c2dc5 /source/blender/editors/space_image/image_ops.c
parentc4f1c0fda13ade79ac8320a59cb77c183340893a (diff)
bugfix [#23247] Load Image in Textures does not use a usefull path
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r--source/blender/editors/space_image/image_ops.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index be2782ab25c..fc1a5f345ae 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -739,7 +739,23 @@ static int open_exec(bContext *C, wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima= CTX_wm_space_image(C);
- char *path= (sima && sima->image)? sima->image->name: U.textudir;
+ char *path=U.textudir;
+ Image *ima= NULL;
+
+ if(sima) {
+ ima= sima->image;
+ }
+
+ if (ima==NULL) {
+ SpaceButs *sbuts= CTX_wm_space_buts(C);
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+ if(tex && tex->type==TEX_IMAGE)
+ ima= tex->ima;
+ }
+
+ if(ima)
+ path= ima->name;
+
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);