diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 32 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 126 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 2 |
10 files changed, 89 insertions, 89 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 721eb9a2a37..4f98290874e 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -290,7 +290,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts) * drawn. */ Material *ma = BLI_findstring(&bmain->materials, "Black Dots", offsetof(ID, name) + 2); if (ma == NULL) { - ma = BKE_material_add_gpencil(bmain, "Black Dots"); + ma = BKE_gpencil_material_add(bmain, "Black Dots"); } brush->gpencil_settings->material = ma; /* Pin the matterial to the brush. */ diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index b1cf8ad8570..e7242ca11a4 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -1121,14 +1121,14 @@ Material *BKE_gpencil_object_material_ensure_from_brush(Main *bmain, Object *ob, /* check if the material is already on object material slots and add it if missing */ if (ma && BKE_gpencil_object_material_get_index(ob, ma) < 0) { BKE_object_material_slot_add(bmain, ob); - assign_material(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF); + BKE_object_material_assign(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF); } return ma; } else { /* using active material instead */ - return give_current_material(ob, ob->actcol); + return BKE_object_material_get(ob, ob->actcol); } } @@ -1141,7 +1141,7 @@ int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *materi int index = BKE_gpencil_object_material_get_index(ob, material); if (index < 0) { BKE_object_material_slot_add(bmain, ob); - assign_material(bmain, ob, material, ob->totcol, BKE_MAT_ASSIGN_USERPREF); + BKE_object_material_assign(bmain, ob, material, ob->totcol, BKE_MAT_ASSIGN_USERPREF); return ob->totcol - 1; } return index; @@ -1154,11 +1154,11 @@ int BKE_gpencil_object_material_ensure(Main *bmain, Object *ob, Material *materi */ Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index) { - Material *ma = BKE_material_add_gpencil(bmain, name); + Material *ma = BKE_gpencil_material_add(bmain, name); id_us_min(&ma->id); /* no users yet */ BKE_object_material_slot_add(bmain, ob); - assign_material(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF); + BKE_object_material_assign(bmain, ob, ma, ob->totcol, BKE_MAT_ASSIGN_USERPREF); if (r_index) { *r_index = ob->actcol - 1; @@ -1175,7 +1175,7 @@ Material *BKE_gpencil_object_material_get_from_brush(Object *ob, Brush *brush) return ma; } else { - return give_current_material(ob, ob->actcol); + return BKE_object_material_get(ob, ob->actcol); } } @@ -1228,7 +1228,7 @@ Material *BKE_gpencil_object_material_ensure_from_active_input_brush(Main *bmain */ Material *BKE_gpencil_object_material_ensure_from_active_input_material(Object *ob) { - Material *ma = give_current_material(ob, ob->actcol); + Material *ma = BKE_object_material_get(ob, ob->actcol); if (ma) { return ma; } @@ -1248,7 +1248,7 @@ Material *BKE_gpencil_object_material_ensure_active(Object *ob) ma = BKE_gpencil_object_material_ensure_from_active_input_material(ob); if (ma->gp_style == NULL) { - BKE_material_init_gpencil_settings(ma); + BKE_gpencil_material_attr_init(ma); } return ma; @@ -2368,10 +2368,10 @@ void BKE_gpencil_stats_update(bGPdata *gpd) /* get material index (0-based like mat_nr not actcol) */ int BKE_gpencil_object_material_get_index(Object *ob, Material *ma) { - short *totcol = give_totcolp(ob); + short *totcol = BKE_object_material_num(ob); Material *read_ma = NULL; for (short i = 0; i < *totcol; i++) { - read_ma = give_current_material(ob, i + 1); + read_ma = BKE_object_material_get(ob, i + 1); if (ma == read_ma) { return i; } @@ -3027,7 +3027,7 @@ static int gpencil_check_same_material_color(Object *ob_gp, float color[4], Mate hsv1[3] = color[3]; for (int i = 1; i <= ob_gp->totcol; i++) { - ma = give_current_material(ob_gp, i); + ma = BKE_object_material_get(ob_gp, i); MaterialGPencilStyle *gp_style = ma->gp_style; /* Check color with small tolerance (better in HSV). */ float hsv2[4]; @@ -3194,7 +3194,7 @@ static void gpencil_convert_spline(Main *bmain, */ bool do_stroke = false; if (ob_cu->totcol == 1) { - Material *ma_stroke = give_current_material(ob_cu, 1); + Material *ma_stroke = BKE_object_material_get(ob_cu, 1); if ((ma_stroke) && (strstr(ma_stroke->id.name, "_stroke") != NULL)) { do_stroke = true; } @@ -3202,7 +3202,7 @@ static void gpencil_convert_spline(Main *bmain, int r_idx = gpencil_check_same_material_color(ob_gp, color, &mat_gp); if ((ob_cu->totcol > 0) && (r_idx < 0)) { - Material *mat_curve = give_current_material(ob_cu, 1); + Material *mat_curve = BKE_object_material_get(ob_cu, 1); mat_gp = gpencil_add_from_curve_material(bmain, ob_gp, color, gpencil_lines, fill, &r_idx); if ((mat_curve) && (mat_curve->gp_style != NULL)) { @@ -3216,8 +3216,8 @@ static void gpencil_convert_spline(Main *bmain, } /* If object has more than 1 material, use second material for stroke color. */ - if ((!only_stroke) && (ob_cu->totcol > 1) && (give_current_material(ob_cu, 2))) { - mat_curve = give_current_material(ob_cu, 2); + if ((!only_stroke) && (ob_cu->totcol > 1) && (BKE_object_material_get(ob_cu, 2))) { + mat_curve = BKE_object_material_get(ob_cu, 2); if (mat_curve) { linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &mat_curve->r); mat_gp->gp_style->stroke_rgba[3] = mat_curve->a; @@ -3226,7 +3226,7 @@ static void gpencil_convert_spline(Main *bmain, else if ((only_stroke) || (do_stroke)) { /* Also use the first color if the fill is none for stroke color. */ if (ob_cu->totcol > 0) { - mat_curve = give_current_material(ob_cu, 1); + mat_curve = BKE_object_material_get(ob_cu, 1); if (mat_curve) { linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &mat_curve->r); mat_gp->gp_style->stroke_rgba[3] = mat_curve->a; diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index bc0c54ed96e..181cb2d38a9 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -813,7 +813,7 @@ static void gpencil_frame_copy_noalloc(Object *ob, bGPDframe *gpf, bGPDframe *gp bGPDstroke *gps_dst = BKE_gpencil_stroke_duplicate(gps_src); /* copy color to temp fields to apply temporal changes in the stroke */ - MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps_src->mat_nr + 1); + MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(ob, gps_src->mat_nr + 1); if (gp_style) { copy_v4_v4(gps_dst->runtime.tmp_stroke_rgba, gp_style->stroke_rgba); copy_v4_v4(gps_dst->runtime.tmp_fill_rgba, gp_style->fill_rgba); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index e1b3212a92c..72b94e7b356 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -398,7 +398,7 @@ static void libblock_remap_data_postprocess_obdata_relink(Main *bmain, Object *o break; } test_object_modifiers(ob); - test_object_materials(bmain, ob, new_id); + BKE_object_materials_test(bmain, ob, new_id); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 54432c8da74..91fc0519c07 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -77,14 +77,14 @@ Material defgpencil_material; static CLG_LogRef LOG = {"bke.material"}; /* called on startup, creator.c */ -void init_def_material(void) +void BKE_materials_init(void) { BKE_material_init(&defmaterial); BKE_material_gpencil_init(&defgpencil_material); } /* Free the GPencil data of the default material, creator.c */ -void BKE_material_gpencil_default_free(void) +void BKE_materials_exit(void) { MEM_SAFE_FREE(defgpencil_material.gp_style); } @@ -112,7 +112,7 @@ void BKE_material_free(Material *ma) BKE_previewimg_free(&ma->preview); } -void BKE_material_init_gpencil_settings(Material *ma) +void BKE_gpencil_material_attr_init(Material *ma) { if ((ma) && (ma->gp_style == NULL)) { ma->gp_style = MEM_callocN(sizeof(MaterialGPencilStyle), "Grease Pencil Material Settings"); @@ -146,7 +146,7 @@ void BKE_material_gpencil_init(Material *ma) /* grease pencil settings */ strcpy(ma->id.name, "MADefault GPencil"); - BKE_material_init_gpencil_settings(ma); + BKE_gpencil_material_attr_init(ma); add_v3_fl(&ma->gp_style->stroke_rgba[0], 0.6f); } @@ -161,7 +161,7 @@ Material *BKE_material_add(Main *bmain, const char *name) return ma; } -Material *BKE_material_add_gpencil(Main *bmain, const char *name) +Material *BKE_gpencil_material_add(Main *bmain, const char *name) { Material *ma; @@ -169,7 +169,7 @@ Material *BKE_material_add_gpencil(Main *bmain, const char *name) /* grease pencil settings */ if (ma != NULL) { - BKE_material_init_gpencil_settings(ma); + BKE_gpencil_material_attr_init(ma); } return ma; } @@ -260,7 +260,7 @@ void BKE_material_make_local(Main *bmain, Material *ma, const bool lib_local) BKE_id_make_local_generic(bmain, &ma->id, true, lib_local); } -Material ***give_matarar(Object *ob) +Material ***BKE_object_material_array(Object *ob) { Mesh *me; Curve *cu; @@ -286,7 +286,7 @@ Material ***give_matarar(Object *ob) return NULL; } -short *give_totcolp(Object *ob) +short *BKE_object_material_num(Object *ob) { Mesh *me; Curve *cu; @@ -313,7 +313,7 @@ short *give_totcolp(Object *ob) } /* same as above but for ID's */ -Material ***give_matarar_id(ID *id) +Material ***BKE_id_material_array(ID *id) { /* ensure we don't try get materials from non-obdata */ BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name))); @@ -333,7 +333,7 @@ Material ***give_matarar_id(ID *id) return NULL; } -short *give_totcolp_id(ID *id) +short *BKE_id_material_num(ID *id) { /* ensure we don't try get materials from non-obdata */ BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name))); @@ -415,8 +415,8 @@ static void material_data_index_clear_id(ID *id) void BKE_material_resize_id(Main *bmain, ID *id, short totcol, bool do_id_user) { - Material ***matar = give_matarar_id(id); - short *totcolp = give_totcolp_id(id); + Material ***matar = BKE_id_material_array(id); + short *totcolp = BKE_id_material_num(id); if (matar == NULL) { return; @@ -447,8 +447,8 @@ void BKE_material_resize_id(Main *bmain, ID *id, short totcol, bool do_id_user) void BKE_material_append_id(Main *bmain, ID *id, Material *ma) { Material ***matar; - if ((matar = give_matarar_id(id))) { - short *totcol = give_totcolp_id(id); + if ((matar = BKE_id_material_array(id))) { + short *totcol = BKE_id_material_num(id); Material **mat = MEM_callocN(sizeof(void *) * ((*totcol) + 1), "newmatar"); if (*totcol) { memcpy(mat, *matar, sizeof(void *) * (*totcol)); @@ -461,7 +461,7 @@ void BKE_material_append_id(Main *bmain, ID *id, Material *ma) (*matar)[(*totcol)++] = ma; id_us_plus((ID *)ma); - test_all_objects_materials(bmain, id); + BKE_objects_materials_test_all(bmain, id); DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE); DEG_relations_tag_update(bmain); @@ -473,8 +473,8 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i) short index = (short)index_i; Material *ret = NULL; Material ***matar; - if ((matar = give_matarar_id(id))) { - short *totcol = give_totcolp_id(id); + if ((matar = BKE_id_material_array(id))) { + short *totcol = BKE_id_material_num(id); if (index >= 0 && index < (*totcol)) { ret = (*matar)[index]; id_us_min((ID *)ret); @@ -493,7 +493,7 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i) (*totcol)--; *matar = MEM_reallocN(*matar, sizeof(void *) * (*totcol)); - test_all_objects_materials(bmain, id); + BKE_objects_materials_test_all(bmain, id); } material_data_index_remove_id(id, index); @@ -509,8 +509,8 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i) void BKE_material_clear_id(Main *bmain, ID *id) { Material ***matar; - if ((matar = give_matarar_id(id))) { - short *totcol = give_totcolp_id(id); + if ((matar = BKE_id_material_array(id))) { + short *totcol = BKE_id_material_num(id); while ((*totcol)--) { id_us_min((ID *)((*matar)[*totcol])); @@ -521,7 +521,7 @@ void BKE_material_clear_id(Main *bmain, ID *id) *matar = NULL; } - test_all_objects_materials(bmain, id); + BKE_objects_materials_test_all(bmain, id); material_data_index_clear_id(id); DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE); @@ -529,7 +529,7 @@ void BKE_material_clear_id(Main *bmain, ID *id) } } -Material **give_current_material_p(Object *ob, short act) +Material **BKE_object_material_get_p(Object *ob, short act) { Material ***matarar, **ma_p; const short *totcolp; @@ -539,7 +539,7 @@ Material **give_current_material_p(Object *ob, short act) } /* if object cannot have material, (totcolp == NULL) */ - totcolp = give_totcolp(ob); + totcolp = BKE_object_material_num(ob); if (totcolp == NULL || ob->totcol == 0) { return NULL; } @@ -568,7 +568,7 @@ Material **give_current_material_p(Object *ob, short act) act = ob->totcol; } - matarar = give_matarar(ob); + matarar = BKE_object_material_array(ob); if (matarar && *matarar) { ma_p = &(*matarar)[act - 1]; @@ -581,15 +581,15 @@ Material **give_current_material_p(Object *ob, short act) return ma_p; } -Material *give_current_material(Object *ob, short act) +Material *BKE_object_material_get(Object *ob, short act) { - Material **ma_p = give_current_material_p(ob, act); + Material **ma_p = BKE_object_material_get_p(ob, act); return ma_p ? *ma_p : NULL; } -Material *BKE_material_gpencil_get(Object *ob, short act) +Material *BKE_gpencil_material(Object *ob, short act) { - Material *ma = give_current_material(ob, act); + Material *ma = BKE_object_material_get(ob, act); if (ma != NULL) { return ma; } @@ -598,17 +598,17 @@ Material *BKE_material_gpencil_get(Object *ob, short act) } } -struct Material *BKE_material_gpencil_default_get(void) +struct Material *BKE_gpencil_material_default(void) { return &defgpencil_material; } -MaterialGPencilStyle *BKE_material_gpencil_settings_get(Object *ob, short act) +MaterialGPencilStyle *BKE_gpencil_material_settings(Object *ob, short act) { - Material *ma = give_current_material(ob, act); + Material *ma = BKE_object_material_get(ob, act); if (ma != NULL) { if (ma->gp_style == NULL) { - BKE_material_init_gpencil_settings(ma); + BKE_gpencil_material_attr_init(ma); } return ma->gp_style; @@ -677,25 +677,25 @@ void BKE_material_resize_object(Main *bmain, Object *ob, const short totcol, boo DEG_relations_tag_update(bmain); } -void test_object_materials(Main *bmain, Object *ob, ID *id) +void BKE_object_materials_test(Main *bmain, Object *ob, ID *id) { /* make the ob mat-array same size as 'ob->data' mat-array */ const short *totcol; - if (id == NULL || (totcol = give_totcolp_id(id)) == NULL) { + if (id == NULL || (totcol = BKE_id_material_num(id)) == NULL) { return; } BKE_material_resize_object(bmain, ob, *totcol, false); } -void test_all_objects_materials(Main *bmain, ID *id) +void BKE_objects_materials_test_all(Main *bmain, ID *id) { /* make the ob mat-array same size as 'ob->data' mat-array */ Object *ob; const short *totcol; - if (id == NULL || (totcol = give_totcolp_id(id)) == NULL) { + if (id == NULL || (totcol = BKE_id_material_num(id)) == NULL) { return; } @@ -708,7 +708,7 @@ void test_all_objects_materials(Main *bmain, ID *id) BKE_main_unlock(bmain); } -void assign_material_id(Main *bmain, ID *id, Material *ma, short act) +void BKE_id_material_assign(Main *bmain, ID *id, Material *ma, short act) { Material *mao, **matar, ***matarar; short *totcolp; @@ -722,8 +722,8 @@ void assign_material_id(Main *bmain, ID *id, Material *ma, short act) /* test arraylens */ - totcolp = give_totcolp_id(id); - matarar = give_matarar_id(id); + totcolp = BKE_id_material_num(id); + matarar = BKE_id_material_array(id); if (totcolp == NULL || matarar == NULL) { return; @@ -752,10 +752,10 @@ void assign_material_id(Main *bmain, ID *id, Material *ma, short act) id_us_plus(&ma->id); } - test_all_objects_materials(bmain, id); + BKE_objects_materials_test_all(bmain, id); } -void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assign_type) +void BKE_object_material_assign(Main *bmain, Object *ob, Material *ma, short act, int assign_type) { Material *mao, **matar, ***matarar; short *totcolp; @@ -776,8 +776,8 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig /* test arraylens */ - totcolp = give_totcolp(ob); - matarar = give_matarar(ob); + totcolp = BKE_object_material_num(ob); + matarar = BKE_object_material_array(ob); if (totcolp == NULL || matarar == NULL) { return; @@ -836,7 +836,7 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig id_us_min(&mao->id); } ob->mat[act - 1] = ma; - test_object_materials(bmain, ob, ob->data); + BKE_object_materials_test(bmain, ob, ob->data); } else { /* in data */ mao = (*matarar)[act - 1]; @@ -844,7 +844,7 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig id_us_min(&mao->id); } (*matarar)[act - 1] = ma; - test_all_objects_materials(bmain, ob->data); /* Data may be used by several objects... */ + BKE_objects_materials_test_all(bmain, ob->data); /* Data may be used by several objects... */ } if (ma) { @@ -854,8 +854,8 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig void BKE_material_remap_object(Object *ob, const unsigned int *remap) { - Material ***matar = give_matarar(ob); - const short *totcol_p = give_totcolp(ob); + Material ***matar = BKE_object_material_array(ob); + const short *totcol_p = BKE_object_material_num(ob); BLI_array_permute(ob->mat, ob->totcol, remap); @@ -897,7 +897,7 @@ void BKE_material_remap_object_calc(Object *ob_dst, Object *ob_src, short *remap GHash *gh_mat_map = BLI_ghash_ptr_new_ex(__func__, ob_src->totcol); for (int i = 0; i < ob_dst->totcol; i++) { - Material *ma_src = give_current_material(ob_dst, i + 1); + Material *ma_src = BKE_object_material_get(ob_dst, i + 1); BLI_ghash_reinsert(gh_mat_map, ma_src, POINTER_FROM_INT(i), NULL, NULL); } @@ -920,9 +920,9 @@ void BKE_material_remap_object_calc(Object *ob_dst, Object *ob_src, short *remap } for (int i = 0; i < ob_src->totcol; i++) { - Material *ma_src = give_current_material(ob_src, i + 1); + Material *ma_src = BKE_object_material_get(ob_src, i + 1); - if ((i < ob_dst->totcol) && (ma_src == give_current_material(ob_dst, i + 1))) { + if ((i < ob_dst->totcol) && (ma_src == BKE_object_material_get(ob_dst, i + 1))) { /* when objects have exact matching materials - keep existing index */ } else { @@ -937,7 +937,7 @@ void BKE_material_remap_object_calc(Object *ob_dst, Object *ob_src, short *remap } /* XXX - this calls many more update calls per object then are needed, could be optimized */ -void assign_matarar(Main *bmain, struct Object *ob, struct Material ***matar, short totcol) +void BKE_object_material_array_assign(Main *bmain, struct Object *ob, struct Material ***matar, short totcol) { int actcol_orig = ob->actcol; short i; @@ -948,7 +948,7 @@ void assign_matarar(Main *bmain, struct Object *ob, struct Material ***matar, sh /* now we have the right number of slots */ for (i = 0; i < totcol; i++) { - assign_material(bmain, ob, (*matar)[i], i + 1, BKE_MAT_ASSIGN_USERPREF); + BKE_object_material_assign(bmain, ob, (*matar)[i], i + 1, BKE_MAT_ASSIGN_USERPREF); } if (actcol_orig > ob->totcol) { @@ -967,8 +967,8 @@ short BKE_object_material_slot_find_index(Object *ob, Material *ma) return 0; } - totcolp = give_totcolp(ob); - matarar = give_matarar(ob); + totcolp = BKE_object_material_num(ob); + matarar = BKE_object_material_array(ob); if (totcolp == NULL || matarar == NULL) { return 0; @@ -994,7 +994,7 @@ bool BKE_object_material_slot_add(Main *bmain, Object *ob) return false; } - assign_material(bmain, ob, NULL, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); + BKE_object_material_assign(bmain, ob, NULL, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); ob->actcol = ob->totcol; return true; } @@ -1024,8 +1024,8 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) * after that check indices in mesh/curve/mball!!! */ - totcolp = give_totcolp(ob); - matarar = give_matarar(ob); + totcolp = BKE_object_material_num(ob); + matarar = BKE_object_material_array(ob); if (ELEM(NULL, matarar, *matarar)) { return false; @@ -1264,7 +1264,7 @@ void BKE_texpaint_slots_refresh_object(Scene *scene, struct Object *ob) int i; for (i = 1; i < ob->totcol + 1; i++) { - Material *ma = give_current_material(ob, i); + Material *ma = BKE_object_material_get(ob, i); BKE_texpaint_slot_refresh_cache(scene, ma); } } @@ -1555,13 +1555,13 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) static Material matcopybuf; static short matcopied = 0; -void clear_matcopybuf(void) +void BKE_material_copybuf_clear(void) { memset(&matcopybuf, 0, sizeof(Material)); matcopied = 0; } -void free_matcopybuf(void) +void BKE_material_copybuf_free(void) { if (matcopybuf.nodetree) { ntreeFreeLocalTree(matcopybuf.nodetree); @@ -1572,10 +1572,10 @@ void free_matcopybuf(void) matcopied = 0; } -void copy_matcopybuf(Main *bmain, Material *ma) +void BKE_material_copybuf_copy(Main *bmain, Material *ma) { if (matcopied) { - free_matcopybuf(); + BKE_material_copybuf_free(); } memcpy(&matcopybuf, ma, sizeof(Material)); @@ -1590,7 +1590,7 @@ void copy_matcopybuf(Main *bmain, Material *ma) matcopied = 1; } -void paste_matcopybuf(Main *bmain, Material *ma) +void BKE_material_copybuf_paste(Main *bmain, Material *ma) { ID id; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index ba139c654d3..3835e405630 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1092,7 +1092,7 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me) id_us_plus((ID *)me); } - test_object_materials(bmain, ob, (ID *)me); + BKE_object_materials_test(bmain, ob, (ID *)me); test_object_modifiers(ob); } diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index fba84aaad42..c48b3b511d9 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -1073,7 +1073,7 @@ static Mesh *mesh_new_from_mball_object(Object *object) mesh_result->mat = MEM_dupallocN(mball->mat); if (mball->mat != NULL) { for (int i = mball->totcol; i-- > 0;) { - mesh_result->mat[i] = give_current_material(object, i + 1); + mesh_result->mat[i] = BKE_object_material_get(object, i + 1); } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 90205286a72..cf43dec132a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1677,7 +1677,7 @@ Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag) } if (dupflag & USER_DUP_MAT) { - matarar = give_matarar(obn); + matarar = BKE_object_material_array(obn); if (matarar) { for (a = 0; a < obn->totcol; a++) { id = (ID *)(*matarar)[a]; @@ -1907,7 +1907,7 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob) ob->mat = MEM_dupallocN(target->mat); ob->matbits = MEM_dupallocN(target->matbits); for (i = 0; i < target->totcol; i++) { - /* don't need to run test_object_materials + /* don't need to run BKE_object_materials_test * since we know this object is new and not used elsewhere */ id_us_plus((ID *)ob->mat[i]); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 97fcef4fd27..7a352f8c9f8 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2926,7 +2926,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re &psys->pathcachebufs, totpart, segments + 1); psys->lattice_deform_data = psys_create_lattice_deform_data(sim); - ma = give_current_material(sim->ob, psys->part->omat); + ma = BKE_object_material_get(sim->ob, psys->part->omat); if (ma && (psys->part->draw_col == PART_DRAW_COL_MAT)) { copy_v3_v3(col, &ma->r); } @@ -4309,7 +4309,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, PARTICLE_PSMD; ParticleSystem *psys = sim->psys; ParticleSettings *part = sim->psys->part; - Material *ma = give_current_material(sim->ob, part->omat); + Material *ma = BKE_object_material_get(sim->ob, part->omat); ParticleData *pa; ChildParticle *cpa; ParticleTexture ptex; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 172940760f9..95726e145b4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -465,7 +465,7 @@ void psys_thread_context_init(ParticleThreadContext *ctx, ParticleSimulationData memset(ctx, 0, sizeof(ParticleThreadContext)); ctx->sim = *sim; ctx->mesh = ctx->sim.psmd->mesh_final; - ctx->ma = give_current_material(sim->ob, sim->psys->part->omat); + ctx->ma = BKE_object_material_get(sim->ob, sim->psys->part->omat); } void psys_tasks_create(ParticleThreadContext *ctx, |