From f7af08b5feecd89ea32c8905de1e61d575ff4bf1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 29 May 2018 15:49:21 +0200 Subject: Cleanup: Get rid of G.main in BKE_material. Note that in some cases, this only moves the G.main case to somne other places - in particular, RNA getters/setters are becoming annoying here... --- source/blender/editors/render/render_shading.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 49d74c25633..b716d61055e 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -97,12 +97,13 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Object *ob = ED_object_context(C); if (!ob) return OPERATOR_CANCELLED; - BKE_object_material_slot_add(ob); + BKE_object_material_slot_add(bmain, ob); if (ob->mode & OB_MODE_TEXTURE_PAINT) { Scene *scene = CTX_data_scene(C); @@ -145,7 +146,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BKE_object_material_slot_remove(ob); + BKE_object_material_slot_remove(CTX_data_main(C), ob); if (ob->mode & OB_MODE_TEXTURE_PAINT) { Scene *scene = CTX_data_scene(C); @@ -345,6 +346,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Object *ob = ED_object_context(C); Material ***matar; @@ -355,7 +357,7 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) { if (ob != ob_iter && give_matarar(ob_iter)) { if (ob->data != ob_iter->data) - assign_matarar(ob_iter, matar, ob->totcol); + assign_matarar(bmain, ob_iter, matar, ob->totcol); if (ob_iter->totcol == ob->totcol) { ob_iter->actcol = ob->actcol; @@ -1704,7 +1706,7 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op)) if (ma == NULL) return OPERATOR_CANCELLED; - copy_matcopybuf(ma); + copy_matcopybuf(CTX_data_main(C), ma); return OPERATOR_FINISHED; } @@ -1730,7 +1732,7 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) if (ma == NULL) return OPERATOR_CANCELLED; - paste_matcopybuf(ma); + paste_matcopybuf(CTX_data_main(C), ma); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); -- cgit v1.2.3