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>2014-05-07 10:53:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-07 10:53:58 +0400
commitdcabd3f81fd278c6029764df415b1257402c07ad (patch)
treee7168aaafa7a61f312e070aa3149b7db088a65cf /source/blender/editors/object/object_add.c
parent77d11a52b30f9eecbf2080e353ce59fa4db7e0e7 (diff)
Fix for dropping images into the 3D View
- wasn't allocing image-user. - wasn't managing user counts.
Diffstat (limited to 'source/blender/editors/object/object_add.c')
-rw-r--r--source/blender/editors/object/object_add.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index eaa89583bb6..99dd8b75609 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -795,6 +795,8 @@ void OBJECT_OT_empty_add(wmOperatorType *ot)
static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
+ Scene *scene = CTX_data_scene(C);
+
Base *base = NULL;
Image *ima = NULL;
Object *ob = NULL;
@@ -823,7 +825,7 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
/* if empty under cursor, then set object */
if (base && base->object->type == OB_EMPTY) {
ob = base->object;
- WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
else {
/* add new empty */
@@ -840,8 +842,11 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
ED_view3d_cursor3d_position(C, ob->loc, event->mval);
}
- ob->empty_drawtype = OB_EMPTY_IMAGE;
+ BKE_object_empty_draw_type_set(ob, OB_EMPTY_IMAGE);
+
+ id_us_min(ob->data);
ob->data = ima;
+ id_us_plus(ob->data);
return OPERATOR_FINISHED;
}