diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-29 16:49:21 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-29 16:49:21 +0300 |
commit | f7af08b5feecd89ea32c8905de1e61d575ff4bf1 (patch) | |
tree | b23f8e58157285ce3c6287f664f66bfcba85a69d /source/blender/editors/sculpt_paint | |
parent | c72a204001ae32ab082af66b373ce19b64e28e2d (diff) |
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...
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 7784926128f..a284b17a0b4 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5769,14 +5769,15 @@ static int texture_paint_add_texture_paint_slot_exec(bContext *C, wmOperator *op static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { char imagename[MAX_ID_NAME - 2]; + Main *bmain = CTX_data_main(C); Object *ob = CTX_data_active_object(C); Material *ma = give_current_material(ob, ob->actcol); int type = RNA_enum_get(op->ptr, "type"); if (!ma) { - ma = BKE_material_add(CTX_data_main(C), "Material"); + ma = BKE_material_add(bmain, "Material"); /* no material found, just assign to first slot */ - assign_material(ob, ma, ob->actcol, BKE_MAT_ASSIGN_USERPREF); + assign_material(bmain, ob, ma, ob->actcol, BKE_MAT_ASSIGN_USERPREF); } type = RNA_enum_from_value(layer_type_items, type); |