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:59:18 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-29 17:02:53 +0300
commit8f670dd855b1d81fcf619b3b94ba4bfaf51e896d (patch)
tree681c0dabf0af6e17ead533d174fde08e55e9cd0f
parent9d037153f70c9bcc665fffa4971d1517044dbf29 (diff)
parentf7af08b5feecd89ea32c8905de1e61d575ff4bf1 (diff)
Merge branch 'master' into blender2.8
Conflicts: source/blender/blenkernel/BKE_material.h source/blender/blenkernel/BKE_mesh.h source/blender/blenkernel/intern/library_remap.c source/blender/blenkernel/intern/material.c source/blender/editors/object/object_relations.c source/blender/editors/render/render_preview.c source/blender/makesrna/intern/rna_object.c
-rw-r--r--build_files/windows/parse_arguments.cmd1
-rw-r--r--source/blender/alembic/intern/abc_mesh.cc4
-rw-r--r--source/blender/blenkernel/BKE_material.h16
-rw-r--r--source/blender/blenkernel/BKE_mesh.h2
-rw-r--r--source/blender/blenkernel/intern/library_remap.c5
-rw-r--r--source/blender/blenkernel/intern/material.c38
-rw-r--r--source/blender/blenkernel/intern/mesh.c4
-rw-r--r--source/blender/collada/MeshImporter.cpp4
-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_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
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp2
-rw-r--r--source/blender/makesrna/intern/rna_ID.c2
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_object.c8
17 files changed, 61 insertions, 57 deletions
diff --git a/build_files/windows/parse_arguments.cmd b/build_files/windows/parse_arguments.cmd
index 016bc875c3b..a8956d350ae 100644
--- a/build_files/windows/parse_arguments.cmd
+++ b/build_files/windows/parse_arguments.cmd
@@ -40,6 +40,7 @@ if NOT "%1" == "" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
set WITH_CLANG=1
) else if "%1" == "release" (
+ set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake"
set TARGET=Release
) else if "%1" == "x86" (
set BUILD_ARCH=x86
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 56fa0a93532..d52d7f06048 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -667,7 +667,7 @@ static void assign_materials(Main *bmain, Object *ob, const std::map<std::string
int matcount = 0;
for (; it != mat_index_map.end(); ++it, ++matcount) {
- if (!BKE_object_material_slot_add(ob)) {
+ if (!BKE_object_material_slot_add(bmain, ob)) {
can_assign = false;
break;
}
@@ -696,7 +696,7 @@ static void assign_materials(Main *bmain, Object *ob, const std::map<std::string
assigned_mat = mat_iter->second;
}
- assign_material(ob, assigned_mat, it->second, BKE_MAT_ASSIGN_OBDATA);
+ assign_material(bmain, ob, assigned_mat, it->second, BKE_MAT_ASSIGN_OBDATA);
}
}
}
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 43f36618c19..c85017a2216 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -47,7 +47,7 @@ struct Scene;
void init_def_material(void);
void BKE_material_free(struct Material *ma);
void BKE_material_free_ex(struct Material *ma, bool do_id_user);
-void test_object_materials(struct Object *ob, struct ID *id);
+void test_object_materials(struct Main *bmain, struct Object *ob, struct ID *id);
void test_all_objects_materials(struct Main *bmain, struct ID *id);
void BKE_material_resize_object(struct Main *bmain, struct Object *ob, const short totcol, bool do_id_user);
void BKE_material_init(struct Material *ma);
@@ -79,13 +79,13 @@ enum {
};
struct Material *give_current_material(struct Object *ob, short act);
-void assign_material_id(struct ID *id, struct Material *ma, short act);
-void assign_material(struct Object *ob, struct Material *ma, short act, int assign_type);
-void assign_matarar(struct Object *ob, struct Material ***matar, short totcol);
+void assign_material_id(struct Main *bmain, struct ID *id, struct Material *ma, short act);
+void assign_material(struct Main *bmain, struct Object *ob, struct Material *ma, short act, int assign_type);
+void assign_matarar(struct Main *bmain, struct Object *ob, struct Material ***matar, short totcol);
short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma);
-bool BKE_object_material_slot_add(struct Object *ob);
-bool BKE_object_material_slot_remove(struct Object *ob);
+bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob);
+bool BKE_object_material_slot_remove(struct Main *bmain, struct Object *ob);
void BKE_texpaint_slot_refresh_cache(struct Scene *scene, struct Material *ma);
void BKE_texpaint_slots_refresh_object(struct Scene *scene, struct Object *ob);
@@ -102,8 +102,8 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]);
/* copy/paste */
void clear_matcopybuf(void);
void free_matcopybuf(void);
-void copy_matcopybuf(struct Material *ma);
-void paste_matcopybuf(struct Material *ma);
+void copy_matcopybuf(struct Main *bmain, struct Material *ma);
+void paste_matcopybuf(struct Main *bmain, struct Material *ma);
/* Evaluation. */
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index f1326974f10..499bea1dd51 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -127,7 +127,7 @@ float (*BKE_mesh_orco_verts_get(struct Object *ob))[3];
void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);
int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr);
struct Mesh *BKE_mesh_from_object(struct Object *ob);
-void BKE_mesh_assign_object(struct Object *ob, struct Mesh *me);
+void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *me);
void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me);
int BKE_mesh_nurbs_to_mdata(
struct Object *ob, struct MVert **r_allvert, int *r_totvert,
diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c
index cf2a001daaa..e3c10175feb 100644
--- a/source/blender/blenkernel/intern/library_remap.c
+++ b/source/blender/blenkernel/intern/library_remap.c
@@ -395,8 +395,7 @@ static void libblock_remap_data_postprocess_collection_update(Main *bmain, Colle
}
}
-
-static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), Object *ob, ID *new_id)
+static void libblock_remap_data_postprocess_obdata_relink(Main *bmain, Object *ob, ID *new_id)
{
if (ob->data == new_id) {
switch (GS(new_id->name)) {
@@ -410,7 +409,7 @@ static void libblock_remap_data_postprocess_obdata_relink(Main *UNUSED(bmain), O
break;
}
test_object_modifiers(ob);
- test_object_materials(ob, new_id);
+ test_object_materials(bmain, ob, new_id);
}
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 131d79c249f..404761d2c36 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -402,7 +402,7 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i, bool update_data
(*totcol)--;
*matar = MEM_reallocN(*matar, sizeof(void *) * (*totcol));
- test_all_objects_materials(G.main, id);
+ test_all_objects_materials(bmain, id);
}
if (update_data) {
@@ -535,7 +535,7 @@ void BKE_material_resize_object(Main *bmain, Object *ob, const short totcol, boo
DEG_relations_tag_update(bmain);
}
-void test_object_materials(Object *ob, ID *id)
+void test_object_materials(Main *bmain, Object *ob, ID *id)
{
/* make the ob mat-array same size as 'ob->data' mat-array */
const short *totcol;
@@ -544,7 +544,7 @@ void test_object_materials(Object *ob, ID *id)
return;
}
- BKE_material_resize_object(G.main, ob, *totcol, false);
+ BKE_material_resize_object(bmain, ob, *totcol, false);
}
void test_all_objects_materials(Main *bmain, ID *id)
@@ -566,7 +566,7 @@ void test_all_objects_materials(Main *bmain, ID *id)
BKE_main_unlock(bmain);
}
-void assign_material_id(ID *id, Material *ma, short act)
+void assign_material_id(Main *bmain, ID *id, Material *ma, short act)
{
Material *mao, **matar, ***matarar;
short *totcolp;
@@ -610,10 +610,10 @@ void assign_material_id(ID *id, Material *ma, short act)
if (ma)
id_us_plus(&ma->id);
- test_all_objects_materials(G.main, id);
+ test_all_objects_materials(bmain, id);
}
-void assign_material(Object *ob, Material *ma, short act, int assign_type)
+void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assign_type)
{
Material *mao, **matar, ***matarar;
short *totcolp;
@@ -685,14 +685,14 @@ void assign_material(Object *ob, Material *ma, short act, int assign_type)
if (mao)
id_us_min(&mao->id);
ob->mat[act - 1] = ma;
- test_object_materials(ob, ob->data);
+ test_object_materials(bmain, ob, ob->data);
}
else { /* in data */
mao = (*matarar)[act - 1];
if (mao)
id_us_min(&mao->id);
(*matarar)[act - 1] = ma;
- test_all_objects_materials(G.main, ob->data); /* Data may be used by several objects... */
+ test_all_objects_materials(bmain, ob->data); /* Data may be used by several objects... */
}
if (ma)
@@ -785,20 +785,20 @@ void BKE_material_remap_object_calc(
/* XXX - this calls many more update calls per object then are needed, could be optimized */
-void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
+void assign_matarar(Main *bmain, struct Object *ob, struct Material ***matar, short totcol)
{
int actcol_orig = ob->actcol;
short i;
while ((ob->totcol > totcol) &&
- BKE_object_material_slot_remove(ob))
+ BKE_object_material_slot_remove(bmain, ob))
{
/* pass */
}
/* now we have the right number of slots */
for (i = 0; i < totcol; i++)
- assign_material(ob, (*matar)[i], i + 1, BKE_MAT_ASSIGN_USERPREF);
+ assign_material(bmain, ob, (*matar)[i], i + 1, BKE_MAT_ASSIGN_USERPREF);
if (actcol_orig > ob->totcol)
actcol_orig = ob->totcol;
@@ -827,19 +827,19 @@ short BKE_object_material_slot_find_index(Object *ob, Material *ma)
return 0;
}
-bool BKE_object_material_slot_add(Object *ob)
+bool BKE_object_material_slot_add(Main *bmain, Object *ob)
{
if (ob == NULL) return false;
if (ob->totcol >= MAXMAT) return false;
- assign_material(ob, NULL, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
+ assign_material(bmain, ob, NULL, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
ob->actcol = ob->totcol;
return true;
}
/* ****************** */
-bool BKE_object_material_slot_remove(Object *ob)
+bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
{
Material *mao, ***matarar;
short *totcolp;
@@ -890,7 +890,7 @@ bool BKE_object_material_slot_remove(Object *ob)
actcol = ob->actcol;
- for (Object *obt = G.main->object.first; obt; obt = obt->id.next) {
+ for (Object *obt = bmain->object.first; obt; obt = obt->id.next) {
if (obt->data == ob->data) {
/* Can happen when object material lists are used, see: T52953 */
if (actcol > obt->totcol) {
@@ -1276,21 +1276,21 @@ void free_matcopybuf(void)
matcopied = 0;
}
-void copy_matcopybuf(Material *ma)
+void copy_matcopybuf(Main *bmain, Material *ma)
{
if (matcopied)
free_matcopybuf();
memcpy(&matcopybuf, ma, sizeof(Material));
- matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, G.main, false);
+ matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
matcopybuf.preview = NULL;
BLI_listbase_clear(&matcopybuf.gpumaterial);
/* TODO Duplicate Engine Settings and set runtime to NULL */
matcopied = 1;
}
-void paste_matcopybuf(Material *ma)
+void paste_matcopybuf(Main *bmain, Material *ma)
{
ID id;
@@ -1309,7 +1309,7 @@ void paste_matcopybuf(Material *ma)
memcpy(ma, &matcopybuf, sizeof(Material));
(ma->id) = id;
- ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, G.main, false);
+ ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
}
void BKE_material_eval(struct Depsgraph *depsgraph, Material *material)
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index f99818f39b9..6e8a4d55c69 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1026,7 +1026,7 @@ Mesh *BKE_mesh_from_object(Object *ob)
else return NULL;
}
-void BKE_mesh_assign_object(Object *ob, Mesh *me)
+void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me)
{
Mesh *old = NULL;
@@ -1042,7 +1042,7 @@ void BKE_mesh_assign_object(Object *ob, Mesh *me)
id_us_plus((ID *)me);
}
- test_object_materials(ob, (ID *)me);
+ test_object_materials(bmain, ob, (ID *)me);
test_object_modifiers(ob);
}
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 4c6d00a79cb..add4a93bccd 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -1035,7 +1035,7 @@ void MeshImporter::assign_material_to_geom(
// Attention! This temporaly assigns material to object on purpose!
// See note above.
ob->actcol=0;
- assign_material(ob, ma, mat_index + 1, BKE_MAT_ASSIGN_OBJECT);
+ assign_material(G.main, ob, ma, mat_index + 1, BKE_MAT_ASSIGN_OBJECT);
MaterialIdPrimitiveArrayMap& mat_prim_map = geom_uid_mat_mapping_map[*geom_uid];
COLLADAFW::MaterialId mat_id = cmaterial.getMaterialId();
@@ -1102,7 +1102,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
Mesh *old_mesh = (Mesh *)ob->data;
Mesh *new_mesh = uid_mesh_map[*geom_uid];
- BKE_mesh_assign_object(ob, new_mesh);
+ BKE_mesh_assign_object(G.main, ob, new_mesh);
BKE_mesh_calc_normals(new_mesh);
id_us_plus(&old_mesh->id); /* Because BKE_mesh_assign_object would have already decreased it... */
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 510b3381b7e..3a67abdb9a0 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3624,7 +3624,7 @@ static Base *mesh_separate_tagged(Main *bmain, Scene *scene, ViewLayer *view_lay
base_new = ED_object_add_duplicate(bmain, scene, view_layer, 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_object_base_select(base_new, BA_SELECT);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 6925daa4b6c..75ff3fc24e6 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1454,7 +1454,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);
DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break;
@@ -1462,7 +1462,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 */
}
DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
break;
@@ -1875,7 +1875,7 @@ static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, c
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);
}
}
}
@@ -2513,7 +2513,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);
DEG_id_tag_update(&base->object->id, OB_RECALC_OB);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index e792de01e2c..a57d5c95440 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -100,12 +100,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);
@@ -148,7 +149,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);
@@ -348,6 +349,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;
@@ -358,7 +360,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;
@@ -1494,7 +1496,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;
}
@@ -1520,7 +1522,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 dab75df8d13..45ee1ebac11 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5724,14 +5724,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 9bd0c622d66..ca26c9be9f2 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -2201,6 +2201,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;
@@ -2223,7 +2224,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);
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 362b34aa64c..8fc2353bc7a 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -838,7 +838,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
material_index++;
} // loop over strokes
- test_object_materials(object_mesh, (ID *)mesh);
+ test_object_materials(freestyle_bmain, object_mesh, (ID *)mesh);
#if 0 // XXX
BLI_assert(mesh->totvert == vertex_index);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 1ea452bf389..32407b26003 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -456,7 +456,7 @@ int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assig
short *totcol = give_totcolp_id(id);
Material *mat_id = assign_ptr->id.data;
if (totcol && (key >= 0 && key < *totcol)) {
- assign_material_id(id, mat_id, key + 1);
+ assign_material_id(G.main, id, mat_id, key + 1);
return 1;
}
else {
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 56035f8239c..295bb7f120f 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -251,7 +251,7 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char
ob = BKE_object_add_only_object(bmain, type, safe_name);
ob->data = data;
- test_object_materials(ob, ob->data);
+ test_object_materials(bmain, ob, ob->data);
return ob;
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index d9074aed29e..2bdb0a28fce 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -346,7 +346,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
}
}
else if (ob->type == OB_MESH) {
- BKE_mesh_assign_object(ob, (Mesh *)id);
+ BKE_mesh_assign_object(G.main, ob, (Mesh *)id);
}
else {
if (ob->data) {
@@ -358,7 +358,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
id_us_plus(id);
ob->data = id;
- test_object_materials(ob, id);
+ test_object_materials(G.main, ob, id);
if (GS(id->name) == ID_CU)
BKE_curve_type_test(ob);
@@ -745,7 +745,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
Object *ob = (Object *)ptr->id.data;
DEG_id_tag_update(value.data, 0);
- assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
+ assign_material(G.main, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
}
static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
@@ -922,7 +922,7 @@ static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
Object *ob = (Object *)ptr->id.data;
int index = (Material **)ptr->data - ob->mat;
- assign_material(ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
+ assign_material(G.main, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
}
static int rna_MaterialSlot_link_get(PointerRNA *ptr)