From 16100f8261770e367b0892bb38c778699ed609fe Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 31 May 2018 16:04:04 +0200 Subject: Cleanup: get rid of last G.main usages in BKE library code. --- source/blender/editors/object/object_add.c | 6 +++--- source/blender/editors/object/object_relations.c | 3 ++- source/blender/editors/object/object_select.c | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/object') 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"); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index ee78dc83c26..68bcdc59f4e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2485,12 +2485,13 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent *event) { + Main *bmain = CTX_data_main(C); Base *base = ED_view3d_give_base_under_cursor(C, event->mval); Material *ma; char name[MAX_ID_NAME - 2]; RNA_string_get(op->ptr, "name", name); - ma = (Material *)BKE_libblock_find_name(ID_MA, name); + ma = (Material *)BKE_libblock_find_name(bmain, ID_MA, name); if (base == NULL || ma == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 8d5c2387fe9..440c9d01487 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -1076,6 +1076,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot) static int object_select_same_group_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Group *group; char group_name[MAX_ID_NAME]; @@ -1084,7 +1085,7 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "group", group_name); - group = (Group *)BKE_libblock_find_name(ID_GR, group_name); + group = (Group *)BKE_libblock_find_name(bmain, ID_GR, group_name); if (!group) { return OPERATOR_PASS_THROUGH; @@ -1123,6 +1124,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) /**************************** Select Mirror ****************************/ static int object_select_mirror_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bool extend; @@ -1135,7 +1137,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op) BLI_string_flip_side_name(name_flip, primbase->object->id.name + 2, true, sizeof(name_flip)); if (!STREQ(name_flip, primbase->object->id.name + 2)) { - Object *ob = (Object *)BKE_libblock_find_name(ID_OB, name_flip); + Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, name_flip); if (ob) { Base *secbase = BKE_scene_base_find(scene, ob); -- cgit v1.2.3