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:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-29 16:49:21 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-29 16:49:21 +0300
commitf7af08b5feecd89ea32c8905de1e61d575ff4bf1 (patch)
treeb23f8e58157285ce3c6287f664f66bfcba85a69d /source/blender/editors
parentc72a204001ae32ab082af66b373ce19b64e28e2d (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')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/object/object_relations.c8
-rw-r--r--source/blender/editors/render/render_preview.c2
-rw-r--r--source/blender/editors/render/render_shading.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c5
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c3
6 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 683e69a4ff6..0625ebe6dd6 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3207,7 +3207,7 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, Base *base_old, BMe
base_new = ED_object_add_duplicate(bmain, scene, base_old, USER_DUP_MESH);
/* DAG_relations_tag_update(bmain); */ /* normally would call directly after but in this case delay recalc */
- assign_matarar(base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
+ assign_matarar(bmain, base_new->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
ED_base_object_select(base_new, BA_SELECT);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 4618d05133e..ee78dc83c26 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1570,7 +1570,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
ob_dst->data = obdata_id;
/* if amount of material indices changed: */
- test_object_materials(ob_dst, ob_dst->data);
+ test_object_materials(bmain, ob_dst, ob_dst->data);
DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break;
@@ -1578,7 +1578,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
/* new approach, using functions from kernel */
for (a = 0; a < ob_src->totcol; a++) {
Material *ma = give_current_material(ob_src, a + 1);
- assign_material(ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF); /* also works with ma==NULL */
+ assign_material(bmain, ob_dst, ma, a + 1, BKE_MAT_ASSIGN_USERPREF); /* also works with ma==NULL */
}
DAG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break;
@@ -1978,7 +1978,7 @@ static void single_mat_users(Main *bmain, Scene *scene, const int flag, const bo
BKE_animdata_copy_id_action(&man->id, false);
man->id.us = 0;
- assign_material(ob, man, a, BKE_MAT_ASSIGN_USERPREF);
+ assign_material(bmain, ob, man, a, BKE_MAT_ASSIGN_USERPREF);
if (do_textures) {
for (b = 0; b < MAX_MTEX; b++) {
@@ -2494,7 +2494,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent
if (base == NULL || ma == NULL)
return OPERATOR_CANCELLED;
- assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF);
+ assign_material(CTX_data_main(C), base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF);
DAG_id_tag_update(&base->object->id, OB_RECALC_OB);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index e52dd7c65c8..d236a7ba93d 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -336,7 +336,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
BLI_addtail(&pr_main->mat, mat);
if (!BKE_scene_use_new_shading_nodes(scene)) {
- init_render_material(mat, 0, NULL); /* call that retrieves mode_l */
+ init_render_material(bmain, mat, 0, NULL); /* call that retrieves mode_l */
end_render_material(mat);
/* un-useful option */
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);
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);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 71edd855cf0..8a9f9f6aff7 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -2291,6 +2291,7 @@ static int material_drop_invoke(bContext *C, wmOperator *op, const wmEvent *even
{
Material *ma = NULL;
Object *ob = NULL;
+ Main *bmain = CTX_data_main(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
ARegion *ar = CTX_wm_region(C);
TreeElement *te = NULL;
@@ -2313,7 +2314,7 @@ static int material_drop_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_CANCELLED;
}
- assign_material(ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
+ assign_material(bmain, ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);