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:
authorTon Roosendaal <ton@blender.org>2010-11-08 22:03:42 +0300
committerTon Roosendaal <ton@blender.org>2010-11-08 22:03:42 +0300
commit7fd87de47bbf45bb15cd9e37c2a98d0b729bf16c (patch)
treec7b36b151f5dda975547d40dd0c6bd8241ddd2bc /source/blender/editors/space_image
parentf9487fba3994c1a09803f7a80cb69fe28b914a90 (diff)
Small bug, reported by Andy in irc:
Image editor & texture properties, add new Image, inits 'start' now to frame 1 for sequences. Added triple-X warning in Image Open operator, it uses SpaceImage whilst it can be called from other editors. Code is safe but not correct.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_ops.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index f51576c613d..fe8b499285f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -688,9 +688,10 @@ static int open_cancel(bContext *UNUSED(C), wmOperator *op)
static int open_exec(bContext *C, wmOperator *op)
{
- SpaceImage *sima= CTX_wm_space_image(C);
+ SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
+ ImageUser *iuser= NULL;
PropertyPointerRNA *pprop;
PointerRNA idptr;
Image *ima= NULL;
@@ -724,11 +725,25 @@ static int open_exec(bContext *C, wmOperator *op)
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
- else if(sima)
+ else if(sima) {
ED_space_image_set(C, sima, scene, obedit, ima);
+ iuser= &sima->iuser;
+ }
+ else {
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+ if(tex && tex->type==TEX_IMAGE)
+ iuser= &tex->iuser;
+
+ }
+
+ /* initialize because of new image */
+ if(iuser) {
+ iuser->sfra= 1;
+ iuser->offset= 0;
+ iuser->fie_ima= 2;
+ }
- // XXX other users?
- BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_RELOAD);
+ BKE_image_signal(ima, iuser, IMA_SIGNAL_RELOAD);
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
MEM_freeN(op->customdata);
@@ -738,7 +753,7 @@ static int open_exec(bContext *C, wmOperator *op)
static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- SpaceImage *sima= CTX_wm_space_image(C);
+ SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
char *path=U.textudir;
Image *ima= NULL;
@@ -769,6 +784,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
return OPERATOR_RUNNING_MODAL;
}
+/* called by other space types too */
void IMAGE_OT_open(wmOperatorType *ot)
{
/* identifiers */