19#define DNA_DEPRECATED_ALLOW
93 std::optional<Library *> owner_library,
107 if (material_src->
nodetree !=
nullptr) {
117 reinterpret_cast<ID **
>(&material_dst->
nodetree),
118 flag_embedded_id_data);
126 material_dst->
preview =
nullptr;
136 if (material_src->
gp_style !=
nullptr) {
179 if (material->
gp_style !=
nullptr) {
210 ma->use_nodes =
true;
221 writer,
reinterpret_cast<bNodeTree *
>(temp_embedded_id_buffer.
get()));
279 if ((ma) && (ma->
gp_style ==
nullptr)) {
298 if (
tree ==
nullptr) {
301 tree->runtime->previews_refresh_state++;
303 if (node->is_group()) {
355 return &(curves->
mat);
359 return &(pointcloud->
mat);
363 return &(volume->
mat);
392 return &(pointcloud->
totcol);
412 return &(((
Mesh *)
id)->mat);
414 return &(((
Curve *)
id)->mat);
418 return &(((
bGPdata *)
id)->mat);
420 return &(((
Curves *)
id)->mat);
424 return &(((
Volume *)
id)->mat);
440 return &(((
Mesh *)
id)->totcol);
442 return &(((
Curve *)
id)->totcol);
446 return &(((
bGPdata *)
id)->totcol);
448 return &(((
Curves *)
id)->totcol);
452 return &(((
Volume *)
id)->totcol);
494 if (psys->part->omat == actcol) {
499 ID *ob_data =
static_cast<ID *
>(
object->data);
504 switch (
GS(ob_data->
name)) {
551 *materials_len_p_dst = *materials_len_p_src;
552 if (*materials_len_p_src != 0) {
555 for (
int a = 0; a < *materials_len_p_src; a++) {
569 if (matar ==
nullptr) {
572 if (totcol == *totcolp) {
577 if (do_id_user && totcol < (*totcolp)) {
579 for (
i = totcol;
i < (*totcolp);
i++) {
606 memcpy(mat, *matar,
sizeof(
void *) * (*totcol));
613 (*matar)[(*totcol)++] = ma;
625 short index = short(index_i);
630 if (index >= 0 && index < (*totcol)) {
631 ret = (*matar)[index];
640 if (index + 1 != (*totcol)) {
641 memmove((*matar) + index,
642 (*matar) + (index + 1),
643 sizeof(
void *) * ((*totcol) - (index + 1)));
667 while ((*totcol)--) {
687 const short *totcolp;
695 if (totcolp ==
nullptr || *totcolp == 0) {
700 const int slot_index =
clamp_i(act - 1, 0, *totcolp - 1);
706 if (slot_index < ob->totcol && ob->
matbits && ob->
matbits[slot_index]) {
708 ma_p = &ob->
mat[slot_index];
714 if (matarar && *matarar) {
715 ma_p = &(*matarar)[slot_index];
733 return ma->
gp_style !=
nullptr ? ma :
nullptr;
736 return ma_p ? *ma_p :
nullptr;
746 if (mesh->
runtime->edit_mesh && editmesh_eval_final) {
747 data = &editmesh_eval_final->
id;
765 if (slots_num == 0) {
770 const int slot_index =
clamp_i(act - 1, 0, slots_num - 1);
771 const int tot_slots_object = ob.
totcol;
774 if (slot_index < tot_slots_object) {
778 if (material !=
nullptr) {
787 if (!data_slots_num_ptr) {
790 const int data_slots_num = *data_slots_num_ptr;
792 if (slot_index < data_slots_num) {
793 Material *material = data_materials[slot_index];
808 return std::max(ob->
totcol, len_p ? *len_p : 0);
819 return std::max(ob.
totcol, len_p ? *len_p : 0);
826 return reinterpret_cast<const Mesh &
>(id).material_index_max();
828 return reinterpret_cast<const Curve &
>(id).material_index_max();
830 return reinterpret_cast<const Curves &
>(id).geometry.wrap().material_index_max();
832 return reinterpret_cast<const PointCloud &
>(id).material_index_max();
834 return reinterpret_cast<const GreasePencil &
>(id).material_index_max_eval();
852 return *max_index + 1;
860 return max_material_index + 1;
874 if (
ELEM(
nullptr, materials_ptr, len_ptr)) {
879 const int slot_index = slot - 1;
880 const int old_length = *len_ptr;
882 if (slot_index >= old_length) {
884 const int new_length = slot_index + 1;
885 *materials_ptr =
static_cast<Material **
>(
886 MEM_reallocN(*materials_ptr,
sizeof(
void *) * new_length));
887 *len_ptr = new_length;
888 for (
int i = old_length;
i < new_length;
i++) {
889 (*materials_ptr)[
i] =
nullptr;
893 (*materials_ptr)[slot_index] = material;
899 if (len_ptr ==
nullptr) {
911 for (
short i = 0;
i < *totcol;
i++) {
923 if ((hint_index >= 0) && (hint_index < *totcol)) {
986 if (totcol == ob->
totcol) {
994 if (do_id_user && totcol < ob->totcol) {
995 for (
int i = totcol;
i < ob->
totcol;
i++) {
1008 else if (ob->
totcol < totcol) {
1012 memcpy(newmatar, ob->
mat,
sizeof(
void *) * ob->
totcol);
1030 const short *totcol;
1053 const short *totcol;
1060 int processed_objects = 0;
1064 if (ob->
data ==
id) {
1067 processed_objects++;
1068 BLI_assert(processed_objects <= id->us && processed_objects > 0);
1069 if (processed_objects == id->
us) {
1079 Material *mao, **matar, ***matarar;
1085 act = std::max<int>(act, 1);
1092 if (totcolp ==
nullptr || matarar ==
nullptr) {
1096 if (act > *totcolp) {
1100 memcpy(matar, *matarar,
sizeof(
void *) * (*totcolp));
1109 mao = (*matarar)[act - 1];
1113 (*matarar)[act - 1] = ma;
1127 Material *mao, **matar, ***matarar;
1134 act = std::max<int>(act, 1);
1141 if (totcolp ==
nullptr || matarar ==
nullptr) {
1145 if (act > *totcolp) {
1149 memcpy(matar, *matarar,
sizeof(
void *) * (*totcolp));
1161 ob->
matbits =
static_cast<char *
>(
1177 switch (assign_type) {
1195 mao = ob->
mat[act - 1];
1199 ob->
mat[act - 1] = ma;
1203 mao = (*matarar)[act - 1];
1207 (*matarar)[act - 1] = ma;
1264 if (ob_src->
totcol == 0) {
1270 for (
int i = 0;
i < ob_dst->
totcol;
i++) {
1280 remap_src_to_dst[
i] =
i;
1285 remap_src_to_dst[
i] =
i;
1288 remap_src_to_dst[
i] = 0;
1293 for (
int i = 0;
i < ob_src->
totcol;
i++) {
1312 ID *data_orig =
static_cast<ID *
>(ob_orig->
data);
1321 if (
ELEM(
nullptr, orig_totcol, orig_mat, eval_totcol, eval_mat)) {
1326 for (
int i = 0;
i < *orig_totcol;
i++) {
1332 *orig_totcol = *eval_totcol;
1334 for (
int i = 0;
i < *eval_totcol;
i++) {
1335 Material *material_eval = (*eval_mat)[
i];
1336 if (material_eval !=
nullptr) {
1338 (*orig_mat)[
i] = material_orig;
1348 int actcol_orig = ob->
actcol;
1355 for (
int i = 0;
i < totcol;
i++) {
1367 actcol_orig = std::min(actcol_orig, ob->
totcol);
1369 ob->
actcol = actcol_orig;
1377 if (ma ==
nullptr) {
1384 if (totcolp ==
nullptr || matarar ==
nullptr) {
1388 for (a = 0; a < *totcolp; a++) {
1389 if ((*matarar)[a] == ma) {
1401 if (ob ==
nullptr) {
1422 if (ob ==
nullptr || ob->
totcol == 0) {
1439 if (
ELEM(
nullptr, matarar, *matarar)) {
1447 mao = (*matarar)[ob->
actcol - 1];
1452 for (
int a = ob->
actcol; a < ob->totcol; a++) {
1453 (*matarar)[a - 1] = (*matarar)[a];
1457 if (*totcolp == 0) {
1462 const int actcol = ob->
actcol;
1465 obt =
static_cast<Object *
>(obt->id.next))
1467 if (obt->data == ob->
data) {
1469 if (actcol > obt->totcol) {
1473 mao = obt->mat[actcol - 1];
1478 for (
int a = actcol; a < obt->totcol; a++) {
1479 obt->mat[a - 1] = obt->mat[a];
1480 obt->matbits[a - 1] = obt->matbits[a];
1485 if (obt->totcol == 0) {
1489 obt->matbits =
nullptr;
1497 if (ob->
runtime->curve_cache) {
1509 bNode *inode = sock->link->fromnode;
1538 for (
bNode *node : nodetree->all_nodes()) {
1539 if (do_image_nodes && node->typeinfo->nclass == NODE_CLASS_TEXTURE &&
1540 node->typeinfo->type_legacy == SH_NODE_TEX_IMAGE && node->id)
1542 if (!callback(node, userdata)) {
1547 if (!callback(node, userdata)) {
1551 else if (node->is_group() && node->id) {
1553 if (!ntree_foreach_texnode_recursive((bNodeTree *)node->id, callback, userdata, slot_filter))
1564 (*((
int *)userdata))++;
1589 int index = fill_data->
index;
1614 slot->
valid =
false;
1626 slot->
valid = layer !=
nullptr;
1674 const int prev_tot_slots = ma->
tot_slots;
1729 for (
int i = 1;
i < ob->
totcol + 1;
i++) {
1745 if (find_data->
slot->
ima == node_ima) {
1746 find_data->
r_node = node;
1754 find_data->
r_node = node;
1784 float tmp, facm = 1.0f - fac;
1788 r_col[0] = facm * (r_col[0]) + fac *
col[0];
1789 r_col[1] = facm * (r_col[1]) + fac *
col[1];
1790 r_col[2] = facm * (r_col[2]) + fac *
col[2];
1793 r_col[0] += fac *
col[0];
1794 r_col[1] += fac *
col[1];
1795 r_col[2] += fac *
col[2];
1798 r_col[0] *= (facm + fac *
col[0]);
1799 r_col[1] *= (facm + fac *
col[1]);
1800 r_col[2] *= (facm + fac *
col[2]);
1803 r_col[0] = 1.0f - (facm + fac * (1.0f -
col[0])) * (1.0f - r_col[0]);
1804 r_col[1] = 1.0f - (facm + fac * (1.0f -
col[1])) * (1.0f - r_col[1]);
1805 r_col[2] = 1.0f - (facm + fac * (1.0f -
col[2])) * (1.0f - r_col[2]);
1808 if (r_col[0] < 0.5f) {
1809 r_col[0] *= (facm + 2.0f * fac *
col[0]);
1812 r_col[0] = 1.0f - (facm + 2.0f * fac * (1.0f -
col[0])) * (1.0f - r_col[0]);
1814 if (r_col[1] < 0.5f) {
1815 r_col[1] *= (facm + 2.0f * fac *
col[1]);
1818 r_col[1] = 1.0f - (facm + 2.0f * fac * (1.0f -
col[1])) * (1.0f - r_col[1]);
1820 if (r_col[2] < 0.5f) {
1821 r_col[2] *= (facm + 2.0f * fac *
col[2]);
1824 r_col[2] = 1.0f - (facm + 2.0f * fac * (1.0f -
col[2])) * (1.0f - r_col[2]);
1828 r_col[0] -= fac *
col[0];
1829 r_col[1] -= fac *
col[1];
1830 r_col[2] -= fac *
col[2];
1833 if (
col[0] != 0.0f) {
1834 r_col[0] = facm * (r_col[0]) + fac * (r_col[0]) /
col[0];
1836 if (
col[1] != 0.0f) {
1837 r_col[1] = facm * (r_col[1]) + fac * (r_col[1]) /
col[1];
1839 if (
col[2] != 0.0f) {
1840 r_col[2] = facm * (r_col[2]) + fac * (r_col[2]) /
col[2];
1844 r_col[0] = facm * (r_col[0]) + fac *
fabsf(r_col[0] -
col[0]);
1845 r_col[1] = facm * (r_col[1]) + fac *
fabsf(r_col[1] -
col[1]);
1846 r_col[2] = facm * (r_col[2]) + fac *
fabsf(r_col[2] -
col[2]);
1849 r_col[0] =
max_ff(facm * (r_col[0]) + fac * (r_col[0] +
col[0] - 2.0f * r_col[0] *
col[0]),
1851 r_col[1] =
max_ff(facm * (r_col[1]) + fac * (r_col[1] +
col[1] - 2.0f * r_col[1] *
col[1]),
1853 r_col[2] =
max_ff(facm * (r_col[2]) + fac * (r_col[2] +
col[2] - 2.0f * r_col[2] *
col[2]),
1857 r_col[0] =
min_ff(r_col[0],
col[0]) * fac + r_col[0] * facm;
1858 r_col[1] =
min_ff(r_col[1],
col[1]) * fac + r_col[1] * facm;
1859 r_col[2] =
min_ff(r_col[2],
col[2]) * fac + r_col[2] * facm;
1862 r_col[0] =
max_ff(r_col[0],
col[0]) * fac + r_col[0] * facm;
1863 r_col[1] =
max_ff(r_col[1],
col[1]) * fac + r_col[1] * facm;
1864 r_col[2] =
max_ff(r_col[2],
col[2]) * fac + r_col[2] * facm;
1867 if (r_col[0] != 0.0f) {
1868 tmp = 1.0f - fac *
col[0];
1872 else if ((tmp = (r_col[0]) / tmp) > 1.0f) {
1879 if (r_col[1] != 0.0f) {
1880 tmp = 1.0f - fac *
col[1];
1884 else if ((tmp = (r_col[1]) / tmp) > 1.0f) {
1891 if (r_col[2] != 0.0f) {
1892 tmp = 1.0f - fac *
col[2];
1896 else if ((tmp = (r_col[2]) / tmp) > 1.0f) {
1905 tmp = facm + fac *
col[0];
1910 else if ((tmp = (1.0f - (1.0f - (r_col[0])) / tmp)) < 0.0f) {
1913 else if (tmp > 1.0f) {
1920 tmp = facm + fac *
col[1];
1924 else if ((tmp = (1.0f - (1.0f - (r_col[1])) / tmp)) < 0.0f) {
1927 else if (tmp > 1.0f) {
1934 tmp = facm + fac *
col[2];
1938 else if ((tmp = (1.0f - (1.0f - (r_col[2])) / tmp)) < 0.0f) {
1941 else if (tmp > 1.0f) {
1950 float colH, colS, colV;
1951 float tmpr, tmpg, tmpb;
1954 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1955 hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
1956 r_col[0] = facm * (r_col[0]) + fac * tmpr;
1957 r_col[1] = facm * (r_col[1]) + fac * tmpg;
1958 r_col[2] = facm * (r_col[2]) + fac * tmpb;
1964 float colH, colS, colV;
1965 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1968 hsv_to_rgb(rH, (facm * rS + fac * colS), rV, r_col + 0, r_col + 1, r_col + 2);
1974 float colH, colS, colV;
1975 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1977 hsv_to_rgb(rH, rS, (facm * rV + fac * colV), r_col + 0, r_col + 1, r_col + 2);
1982 float colH, colS, colV;
1983 float tmpr, tmpg, tmpb;
1986 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1987 hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
1988 r_col[0] = facm * (r_col[0]) + fac * tmpr;
1989 r_col[1] = facm * (r_col[1]) + fac * tmpg;
1990 r_col[2] = facm * (r_col[2]) + fac * tmpb;
1995 float scr, scg, scb;
1998 scr = 1.0f - (1.0f -
col[0]) * (1.0f - r_col[0]);
1999 scg = 1.0f - (1.0f -
col[1]) * (1.0f - r_col[1]);
2000 scb = 1.0f - (1.0f -
col[2]) * (1.0f - r_col[2]);
2002 r_col[0] = facm * (r_col[0]) +
2003 fac * (((1.0f - r_col[0]) *
col[0] * (r_col[0])) + (r_col[0] * scr));
2004 r_col[1] = facm * (r_col[1]) +
2005 fac * (((1.0f - r_col[1]) *
col[1] * (r_col[1])) + (r_col[1] * scg));
2006 r_col[2] = facm * (r_col[2]) +
2007 fac * (((1.0f - r_col[2]) *
col[2] * (r_col[2])) + (r_col[2] * scb));
2011 if (
col[0] > 0.5f) {
2012 r_col[0] = r_col[0] + fac * (2.0f * (
col[0] - 0.5f));
2015 r_col[0] = r_col[0] + fac * (2.0f * (
col[0]) - 1.0f);
2017 if (
col[1] > 0.5f) {
2018 r_col[1] = r_col[1] + fac * (2.0f * (
col[1] - 0.5f));
2021 r_col[1] = r_col[1] + fac * (2.0f * (
col[1]) - 1.0f);
2023 if (
col[2] > 0.5f) {
2024 r_col[2] = r_col[2] + fac * (2.0f * (
col[2] - 0.5f));
2027 r_col[2] = r_col[2] + fac * (2.0f * (
col[2]) - 1.0f);
2092 output->location[0] = 200.0f;
2093 output->location[1] = 100.0f;
2117 output->location[0] = 200.0f;
2118 output->location[1] = 100.0f;
2141 output->location[0] = 300.0f;
2142 output->location[1] = 300.0f;
2188 "Default material pointers should always be null when initializing them, maybe "
2189 "missing a call to `BKE_materials_exit` first?");
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, blender::StringRef name)
void BKE_curve_material_remap(Curve *cu, const unsigned int *remap, unsigned int remap_len)
void BKE_curve_material_index_remove(Curve *cu, int index)
bool BKE_curve_material_index_used(const Curve *cu, int index)
void BKE_curve_material_index_clear(Curve *cu)
Low-level operations for curves.
display list (or rather multi purpose list) stuff.
void BKE_displist_free(struct ListBase *lb)
Low-level operations for grease pencil.
void BKE_grease_pencil_material_remap(GreasePencil *grease_pencil, const uint *remap, int totcol)
void BKE_grease_pencil_material_index_remove(GreasePencil *grease_pencil, int index)
bool BKE_grease_pencil_material_index_used(GreasePencil *grease_pencil, int index)
void BKE_icon_id_delete(struct ID *id)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int flag)
void BKE_id_free(Main *bmain, void *idv)
void * BKE_id_new(Main *bmain, short type, const char *name)
@ LIB_ID_CREATE_NO_ALLOCATE
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void * BKE_id_new_nomain(short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
void BKE_library_foreach_ID_embedded(LibraryForeachIDData *data, ID **id_pp)
void BKE_main_lock(Main *bmain)
void BKE_main_unlock(Main *bmain)
General operations, lookup, etc. for materials.
@ BKE_MAT_ASSIGN_USERPREF
@ BKE_MAT_ASSIGN_EXISTING
bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
void BKE_mesh_material_remap(Mesh *mesh, const unsigned int *remap, unsigned int remap_len)
bool BKE_mesh_material_index_used(Mesh *mesh, short index)
void BKE_mesh_material_index_clear(Mesh *mesh)
void BKE_mesh_material_index_remove(Mesh *mesh, short index)
#define SH_NODE_TEX_IMAGE
#define SH_NODE_BSDF_PRINCIPLED
#define SH_NODE_OUTPUT_MATERIAL
#define SH_NODE_VOLUME_PRINCIPLED
#define SH_NODE_ATTRIBUTE
General operations, lookup, etc. for blender objects.
bool BKE_object_supports_material_slots(Object *ob)
const Mesh * BKE_object_get_editmesh_eval_final(const Object *object)
void BKE_previewimg_blend_write(BlendWriter *writer, const PreviewImage *prv)
void BKE_previewimg_free(PreviewImage **prv)
void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv)
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
Generic array manipulation API.
#define BLI_array_permute(arr, arr_len, order)
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
bool BLI_ghash_reinsert(GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void ** BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_ptr_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE int clamp_i(int value, int min, int max)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
MINLINE void add_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
#define ARRAY_SET_ITEMS(...)
#define STREQLEN(a, b, n)
#define ENUM_OPERATORS(_type, _max)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLO_write_struct_at_address(writer, struct_name, address, data_ptr)
#define BLT_I18NCONTEXT_ID_MATERIAL
#define CLOG_ERROR(clg_ref,...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_debug_print_eval(Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
void DEG_relations_tag_update(Main *bmain)
bool DEG_is_evaluated(const T *id)
T * DEG_get_original(T *id)
ID and Library types, which are fundamental for SDNA.
#define DNA_struct_default_get(struct_name)
@ GP_MATERIAL_STROKE_SHOW
Object is a sort of wrapper for general info.
#define OB_DATA_SUPPORT_ID(_id_type)
#define IMAGEPAINT_MODE_IMAGE
#define USER_EXPERIMENTAL_TEST(userdef, member)
void GPU_material_free(ListBase *gpumaterial)
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
#define MEM_reallocN(vmemh, len)
struct blender::bke::bNodeTreeType * ntreeType_Shader
void BKE_objects_materials_sync_length_all(Main *bmain, ID *id)
static Material * default_material_empty
int BKE_object_material_index_get_with_hint(Object *ob, const Material *ma, const int hint_index)
void BKE_texpaint_slots_refresh_object(Scene *scene, Object *ob)
short * BKE_object_material_len_p(Object *ob)
static void material_copy_data(Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
static void material_default_holdout_init(Material **ma_p)
static void material_data_index_clear_id(ID *id)
static void material_default_volume_init(Material **ma_p)
static void nodetree_mark_previews_dirty_reccursive(bNodeTree *tree)
static void fill_texpaint_slots_recursive(bNodeTree *nodetree, bNode *active_node, const Object *ob, Material *ma, int slot_len, ePaintSlotFilter slot_filter)
int BKE_object_material_count_eval(const Object *ob)
void BKE_object_material_array_assign(Main *bmain, Object *ob, Material ***matar, int totcol, const bool to_object_only)
void BKE_id_material_eval_ensure_default_slot(ID *id)
MaterialGPencilStyle * BKE_gpencil_material_settings(Object *ob, short act)
static Material * default_material_volume
void BKE_gpencil_material_attr_init(Material *ma)
void BKE_object_material_assign_single_obdata(Main *bmain, Object *ob, Material *ma, short act)
void BKE_id_material_clear(Main *bmain, ID *id)
Material ** BKE_object_material_get_p(Object *ob, short act)
static const ID * get_evaluated_object_data_with_materials(const Object *ob)
void BKE_id_material_assign(Main *bmain, ID *id, Material *ma, short act)
short * BKE_id_material_len_p(ID *id)
static bool ntree_foreach_texnode_recursive(bNodeTree *nodetree, ForEachTexNodeCallback callback, void *userdata, ePaintSlotFilter slot_filter)
Material * BKE_material_default_surface()
static Material * default_material_gpencil
static void material_foreach_id(ID *id, LibraryForeachIDData *data)
Material *** BKE_id_material_array_p(ID *id)
short BKE_object_material_slot_find_index(Object *ob, Material *ma)
Material * BKE_material_default_volume()
Material * BKE_gpencil_material(Object *ob, short act)
void BKE_material_eval(Depsgraph *depsgraph, Material *material)
void BKE_material_defaults_free_gpu()
void BKE_object_material_from_eval_data(Main *bmain, Object *ob_orig, const ID *data_eval)
Material * BKE_gpencil_material_add(Main *bmain, const char *name)
static void material_data_index_remove_id(ID *id, short index)
void BKE_object_materials_sync_length(Main *bmain, Object *ob, ID *id)
static void material_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Material * BKE_id_material_pop(Main *bmain, ID *id, int index_i)
static void material_default_surface_init(Material **ma_p)
static bool texpaint_slot_node_find_cb(bNode *node, void *userdata)
static void object_material_active_index_sanitize(Object *ob)
static ePaintSlotFilter material_paint_slot_filter(const Object *ob)
bool(*)(bNode *node, void *userdata) ForEachTexNodeCallback
static Material * default_material_surface
void BKE_id_materials_copy(Main *bmain, ID *id_src, ID *id_dst)
static Material * material_default_create(Material **ma_p, const char *name)
void BKE_object_material_remap(Object *ob, const uint *remap)
static Material * default_material_holdout
Material * BKE_material_default_holdout()
static void material_free_data(ID *id)
void BKE_materials_init()
void BKE_id_material_resize(Main *bmain, ID *id, short totcol, bool do_id_user)
void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const Object *ob)
static bNode * nodetree_uv_node_recursive(bNode *node)
Material * BKE_material_default_gpencil()
void BKE_id_material_eval_assign(ID *id, int slot, Material *material)
static Material ** default_materials[]
Material * BKE_material_add(Main *bmain, const char *name)
void BKE_id_material_append(Main *bmain, ID *id, Material *ma)
bool BKE_object_material_slot_add(Main *bmain, Object *ob, const bool set_active)
bool BKE_object_material_slot_used(Object *object, short actcol)
int BKE_object_material_ensure(Main *bmain, Object *ob, Material *material)
static void object_material_assign(Main *bmain, Object *ob, Material *ma, short act, int assign_type, bool do_test_all)
Material * BKE_material_default_empty()
void BKE_object_material_resize(Main *bmain, Object *ob, const short totcol, bool do_id_user)
int BKE_id_material_used_with_fallback_eval(const ID &id)
static void material_default_gpencil_init(Material **ma_p)
Material * BKE_object_material_get(Object *ob, short act)
void BKE_object_material_remap_calc(Object *ob_dst, Object *ob_src, short *remap_src_to_dst)
static void material_blend_read_data(BlendDataReader *reader, ID *id)
@ PAINT_SLOT_COLOR_ATTRIBUTE
static bool count_texture_nodes_cb(bNode *, void *userdata)
static int count_texture_nodes_recursive(bNodeTree *nodetree, ePaintSlotFilter slot_filter)
static void material_init_data(ID *id)
Material * BKE_object_material_get_eval(Object *ob, short act)
std::optional< int > BKE_id_material_index_max_eval(const ID &id)
void BKE_object_material_assign(Main *bmain, Object *ob, Material *ma, short act, int assign_type)
void BKE_materials_exit()
bNode * BKE_texpaint_slot_material_find_node(Material *ma, short texpaint_slot)
static bool fill_texpaint_slots_cb(bNode *node, void *userdata)
int BKE_object_material_used_with_fallback_eval(const Object &ob)
int BKE_object_material_index_get(Object *ob, const Material *ma)
int BKE_id_material_used_eval(const ID &id)
static void material_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
void BKE_material_make_node_previews_dirty(Material *ma)
Material *** BKE_object_material_array_p(Object *ob)
bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
BMesh const char void * data
BPy_StructRNA * depsgraph
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void *(* MEM_recallocN_id)(void *vmemh, size_t len, const char *str)
void MEM_freeN(void *vmemh)
bNodeTree * node_tree_add_tree_embedded(Main *bmain, ID *owner_id, StringRefNull name, StringRefNull idname)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
bNodeTree * node_tree_localize(bNodeTree *ntree, std::optional< ID * > new_owner_id)
bNode * node_get_active_paint_canvas(bNodeTree &ntree)
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
void node_set_active(bNodeTree &ntree, bNode &node)
void node_tree_free_embedded_tree(bNodeTree *ntree)
struct Material ** material_array
const blender::FunctionRef< void(float rgb[3])> single
struct bNodeTree * nodetree
struct PreviewImage * preview
struct MaterialGPencilStyle * gp_style
struct TexPaintSlot * texpaintslot
MeshRuntimeHandle * runtime
ObjectRuntimeHandle * runtime
struct ToolSettings * toolsettings
struct ImageUser * image_user
bNodeTypeHandle * typeinfo