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>2012-07-25 13:04:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-25 13:04:59 +0400
commit3af938918aae68488fc2fe8388f31ae4c3752b31 (patch)
tree75980ebc11c4b44f4561a2337255dfdd608c66fd
parent8f1666ee56c4ee30d2dfcc1c14d63fd398e164dc (diff)
fix annoying bug where image open from ID template didn't open in the existing images path.
-rw-r--r--source/blender/editors/interface/interface_templates.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4702253140a..63b201e4cf7 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -254,7 +254,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break;
case UI_ID_OPEN:
case UI_ID_ADD_NEW:
- /* these call uiIDContextPropertySet */
+ /* these call uiIDContextProperty */
break;
case UI_ID_DELETE:
memset(&idptr, 0, sizeof(idptr));
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index ca16558f3a6..7d1328ca266 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -901,6 +901,25 @@ static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
ima = tex->ima;
}
+ if (ima == NULL) {
+ PointerRNA ptr;
+ PropertyRNA *prop;
+
+ /* hook into UI */
+ uiIDContextProperty(C, &ptr, &prop);
+
+ if (prop) {
+ PointerRNA oldptr;
+
+ oldptr = RNA_property_pointer_get(&ptr, prop);
+ ima = (Image *)oldptr.id.data;
+ /* unlikely but better avoid strange crash */
+ if (ima && GS(ima->id.name) != ID_IM) {
+ ima = NULL;
+ }
+ }
+ }
+
if (ima)
path = ima->name;