bugfix [#23247] Load Image in Textures does not use a usefull path

This commit is contained in:
Campbell Barton 2010-08-11 03:31:56 +00:00
parent c4f1c0fda1
commit 8c39326962
3 changed files with 19 additions and 3 deletions

@ -739,7 +739,23 @@ static int open_exec(bContext *C, wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{ {
SpaceImage *sima= CTX_wm_space_image(C); 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")) if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);

@ -32,7 +32,7 @@
#define DNA_TEXTURE_TYPES_H #define DNA_TEXTURE_TYPES_H
#include "DNA_ID.h" #include "DNA_ID.h"
#include "DNA_image_types.h" #include "DNA_image_types.h" /* ImageUser */
struct AnimData; struct AnimData;
struct Ipo; struct Ipo;

@ -33,7 +33,7 @@
#define DNA_USERDEF_TYPES_H #define DNA_USERDEF_TYPES_H
#include "DNA_listBase.h" #include "DNA_listBase.h"
#include "DNA_texture_types.h" #include "DNA_texture_types.h" /* ColorBand */
/* themes; defines in BIF_resource.h */ /* themes; defines in BIF_resource.h */
struct ColorBand; struct ColorBand;