diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-29 16:59:18 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-29 17:02:53 +0300 |
commit | 8f670dd855b1d81fcf619b3b94ba4bfaf51e896d (patch) | |
tree | 681c0dabf0af6e17ead533d174fde08e55e9cd0f /source/blender/blenkernel/intern | |
parent | 9d037153f70c9bcc665fffa4971d1517044dbf29 (diff) | |
parent | f7af08b5feecd89ea32c8905de1e61d575ff4bf1 (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
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 38 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 4 |
3 files changed, 23 insertions, 24 deletions
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); } |