diff options
Diffstat (limited to 'source/blender/editors/object/object_add.c')
-rw-r--r-- | source/blender/editors/object/object_add.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 101b5d4920d..5d5d1190775 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -967,6 +967,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot) static int group_instance_add_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Group *group; unsigned int layer; float loc[3], rot[3]; @@ -975,7 +976,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) char name[MAX_ID_NAME - 2]; RNA_string_get(op->ptr, "name", name); - group = (Group *)BKE_libblock_find_name(ID_GR, name); + group = (Group *)BKE_libblock_find_name(bmain, ID_GR, name); if (0 == RNA_struct_property_is_set(op->ptr, "location")) { const wmEvent *event = CTX_wm_window(C)->eventstate; @@ -994,7 +995,6 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if (group) { - Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *ob = ED_object_add_type(C, OB_EMPTY, group->id.name + 2, loc, rot, false, layer); ob->dup_group = group; @@ -2354,7 +2354,7 @@ static int add_named_exec(bContext *C, wmOperator *op) /* find object, create fake base */ RNA_string_get(op->ptr, "name", name); - ob = (Object *)BKE_libblock_find_name(ID_OB, name); + ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, name); if (ob == NULL) { BKE_report(op->reports, RPT_ERROR, "Object not found"); |