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
parentc4f1c0fda13ade79ac8320a59cb77c183340893a (diff)
bugfix [#23247] Load Image in Textures does not use a usefull path
-rw-r--r--source/blender/editors/space_image/image_ops.c18
-rw-r--r--source/blender/makesdna/DNA_texture_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
3 files changed, 19 insertions, 3 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);
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index e7a5a6e5f56..e9e058cbbd6 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -32,7 +32,7 @@
#define DNA_TEXTURE_TYPES_H
#include "DNA_ID.h"
-#include "DNA_image_types.h"
+#include "DNA_image_types.h" /* ImageUser */
struct AnimData;
struct Ipo;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 7c8a24e9e8c..ceac7e4d1d7 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -33,7 +33,7 @@
#define DNA_USERDEF_TYPES_H
#include "DNA_listBase.h"
-#include "DNA_texture_types.h"
+#include "DNA_texture_types.h" /* ColorBand */
/* themes; defines in BIF_resource.h */
struct ColorBand;