19#define DNA_DEPRECATED_ALLOW
92 *((
short *)id->name) =
ID_MA;
96 std::optional<Library *> owner_library,
108 const int flag_embedded_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE;
110 if (material_src->
nodetree !=
nullptr) {
120 reinterpret_cast<ID **
>(&material_dst->
nodetree),
121 flag_embedded_id_data);
129 material_dst->
preview =
nullptr;
139 if (material_src->
gp_style !=
nullptr) {
157 if (material->nodetree) {
160 material->nodetree =
nullptr;
180 if (material->texpaintslot !=
nullptr) {
183 if (material->gp_style !=
nullptr) {
272 if ((ma) && (ma->
gp_style ==
nullptr)) {
292 if (
tree ==
nullptr) {
295 tree->runtime->previews_refresh_state++;
353 return &(curves->mat);
357 return &(pointcloud->
mat);
361 return &(volume->mat);
374 return &(mesh->totcol);
390 return &(curves->totcol);
394 return &(pointcloud->
totcol);
398 return &(volume->totcol);
412 switch (
GS(id->name)) {
414 return &(((
Mesh *)
id)->mat);
416 return &(((
Curve *)
id)->mat);
420 return &(((
bGPdata *)
id)->mat);
422 return &(((
Curves *)
id)->mat);
426 return &(((
Volume *)
id)->mat);
440 switch (
GS(id->name)) {
442 return &(((
Mesh *)
id)->totcol);
444 return &(((
Curve *)
id)->totcol);
448 return &(((
bGPdata *)
id)->totcol);
450 return &(((
Curves *)
id)->totcol);
454 return &(((
Volume *)
id)->totcol);
468 switch (
GS(id->name)) {
496 if (psys->part->omat == actcol) {
501 ID *ob_data =
static_cast<ID *
>(
object->data);
506 switch (
GS(ob_data->
name)) {
527 switch (
GS(id->name)) {
553 *materials_len_p_dst = *materials_len_p_src;
554 if (*materials_len_p_src != 0) {
557 for (
int a = 0; a < *materials_len_p_src; a++) {
571 if (matar ==
nullptr) {
575 if (do_id_user && totcol < (*totcolp)) {
577 for (i = totcol; i < (*totcolp); i++) {
602 Material **mat = MEM_cnew_array<Material *>((*totcol) + 1,
"newmatar");
604 memcpy(mat, *matar,
sizeof(
void *) * (*totcol));
611 (*matar)[(*totcol)++] = ma;
623 short index = short(index_i);
628 if (index >= 0 && index < (*totcol)) {
629 ret = (*matar)[index];
638 if (index + 1 != (*totcol)) {
639 memmove((*matar) + index,
640 (*matar) + (index + 1),
641 sizeof(
void *) * ((*totcol) - (index + 1)));
665 while ((*totcol)--) {
685 const short *totcolp;
693 if (totcolp ==
nullptr || *totcolp == 0) {
698 const int slot_index =
clamp_i(act - 1, 0, *totcolp - 1);
702 if (*totcolp < ob->totcol) {
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;
741 const ID *data =
static_cast<ID *
>(ob->
data);
746 if (mesh->runtime->edit_mesh && editmesh_eval_final) {
747 data = &editmesh_eval_final->
id;
759 const int tot_slots_data = tot_slots_data_ptr ? *tot_slots_data_ptr : 0;
761 if (tot_slots_data == 0) {
766 const int slot_index =
clamp_i(act - 1, 0, tot_slots_data - 1);
767 const int tot_slots_object = ob->
totcol;
774 if (slot_index < tot_slots_object) {
777 Material *material = materials_object[slot_index];
778 if (material !=
nullptr) {
785 if (slot_index < tot_slots_data) {
801 return len_p ? *len_p : 0;
809 if (
ELEM(
nullptr, materials_ptr, len_ptr)) {
814 const int slot_index = slot - 1;
815 const int old_length = *len_ptr;
817 if (slot_index >= old_length) {
819 const int new_length = slot_index + 1;
820 *materials_ptr =
static_cast<Material **
>(
821 MEM_reallocN(*materials_ptr,
sizeof(
void *) * new_length));
822 *len_ptr = new_length;
823 for (
int i = old_length; i < new_length; i++) {
824 (*materials_ptr)[i] =
nullptr;
828 (*materials_ptr)[slot_index] =
material;
834 if (len_ptr ==
nullptr) {
846 for (
short i = 0; i < *totcol; i++) {
858 if ((hint_index >= 0) && (hint_index < *totcol)) {
909 if (do_id_user && totcol < ob->totcol) {
910 for (
int i = totcol; i < ob->
totcol; i++) {
923 else if (ob->
totcol < totcol) {
924 newmatar = MEM_cnew_array<Material *>(totcol,
"newmatar");
925 newmatbits = MEM_cnew_array<char>(totcol,
"newmatbits");
927 memcpy(newmatar, ob->
mat,
sizeof(
void *) * ob->
totcol);
982 int processed_objects = 0;
986 if (ob->
data ==
id) {
989 BLI_assert(processed_objects <= id->us && processed_objects > 0);
990 if (processed_objects == id->us) {
1000 Material *mao, **matar, ***matarar;
1015 if (totcolp ==
nullptr || matarar ==
nullptr) {
1019 if (act > *totcolp) {
1020 matar = MEM_cnew_array<Material *>(act,
"matarray1");
1023 memcpy(matar, *matarar,
sizeof(
void *) * (*totcolp));
1032 mao = (*matarar)[act - 1];
1036 (*matarar)[act - 1] = ma;
1048 Material *mao, **matar, ***matarar;
1064 if (totcolp ==
nullptr || matarar ==
nullptr) {
1068 if (act > *totcolp) {
1069 matar = MEM_cnew_array<Material *>(act,
"matarray1");
1072 memcpy(matar, *matarar,
sizeof(
void *) * (*totcolp));
1084 ob->
matbits =
static_cast<char *
>(
1100 switch (assign_type) {
1118 mao = ob->
mat[act - 1];
1122 ob->
mat[act - 1] = ma;
1126 mao = (*matarar)[act - 1];
1130 (*matarar)[act - 1] = ma;
1184 if (ob_src->
totcol == 0) {
1190 for (
int i = 0; i < ob_dst->
totcol; i++) {
1199 for (; i < ob_src->
totcol; i++) {
1200 remap_src_to_dst[i] = i;
1204 for (; i < ob_dst->
totcol; i++) {
1205 remap_src_to_dst[i] = i;
1207 for (; i < ob_src->
totcol; i++) {
1208 remap_src_to_dst[i] = 0;
1213 for (
int i = 0; i < ob_src->
totcol; i++) {
1232 ID *data_orig =
static_cast<ID *
>(ob_orig->
data);
1241 if (
ELEM(
nullptr, orig_totcol, orig_mat, eval_totcol, eval_mat)) {
1246 for (
int i = 0; i < *orig_totcol; i++) {
1252 *orig_totcol = *eval_totcol;
1253 *orig_mat = *eval_totcol > 0 ? MEM_cnew_array<Material *>(*eval_totcol, __func__) :
nullptr;
1254 for (
int i = 0; i < *eval_totcol; i++) {
1255 Material *material_eval = (*eval_mat)[i];
1256 if (material_eval !=
nullptr) {
1258 (*orig_mat)[i] = material_orig;
1268 int actcol_orig = ob->
actcol;
1275 for (
int i = 0; i < totcol; i++) {
1287 if (actcol_orig > ob->
totcol) {
1288 actcol_orig = ob->
totcol;
1291 ob->
actcol = actcol_orig;
1299 if (ma ==
nullptr) {
1306 if (totcolp ==
nullptr || matarar ==
nullptr) {
1310 for (a = 0; a < *totcolp; a++) {
1311 if ((*matarar)[a] == ma) {
1323 if (ob ==
nullptr) {
1342 if (ob ==
nullptr || ob->
totcol == 0) {
1359 if (
ELEM(
nullptr, matarar, *matarar)) {
1369 mao = (*matarar)[ob->
actcol - 1];
1375 (*matarar)[a - 1] = (*matarar)[a];
1379 if (*totcolp == 0) {
1384 const int actcol = ob->
actcol;
1387 obt =
static_cast<Object *
>(obt->id.next))
1389 if (obt->data == ob->
data) {
1391 if (actcol > obt->totcol) {
1395 mao = obt->mat[actcol - 1];
1400 for (
int a = actcol; a < obt->totcol; a++) {
1401 obt->mat[a - 1] = obt->mat[a];
1402 obt->matbits[a - 1] = obt->matbits[a];
1405 if (obt->actcol > obt->totcol) {
1406 obt->actcol = obt->totcol;
1409 if (obt->totcol == 0) {
1413 obt->matbits =
nullptr;
1421 if (ob->
runtime->curve_cache) {
1433 bNode *inode = sock->link->fromnode;
1460 for (
bNode *node : nodetree->all_nodes()) {
1468 if (do_color_attributes && node->typeinfo->type == SH_NODE_ATTRIBUTE) {
1486 (*((
int *)userdata))++;
1511 int index = fill_data->
index;
1518 switch (node->type) {
1536 slot->
valid =
false;
1548 slot->
valid = layer !=
nullptr;
1596 const int prev_tot_slots = ma->
tot_slots;
1652 for (
int i = 1; i < ob->
totcol + 1; i++) {
1668 if (find_data->
slot->
ima == node_ima) {
1707 float tmp, facm = 1.0f - fac;
1711 r_col[0] = facm * (r_col[0]) + fac *
col[0];
1712 r_col[1] = facm * (r_col[1]) + fac *
col[1];
1713 r_col[2] = facm * (r_col[2]) + fac *
col[2];
1716 r_col[0] += fac *
col[0];
1717 r_col[1] += fac *
col[1];
1718 r_col[2] += fac *
col[2];
1721 r_col[0] *= (facm + fac *
col[0]);
1722 r_col[1] *= (facm + fac *
col[1]);
1723 r_col[2] *= (facm + fac *
col[2]);
1726 r_col[0] = 1.0f - (facm + fac * (1.0f -
col[0])) * (1.0f - r_col[0]);
1727 r_col[1] = 1.0f - (facm + fac * (1.0f -
col[1])) * (1.0f - r_col[1]);
1728 r_col[2] = 1.0f - (facm + fac * (1.0f -
col[2])) * (1.0f - r_col[2]);
1731 if (r_col[0] < 0.5f) {
1732 r_col[0] *= (facm + 2.0f * fac *
col[0]);
1735 r_col[0] = 1.0f - (facm + 2.0f * fac * (1.0f -
col[0])) * (1.0f - r_col[0]);
1737 if (r_col[1] < 0.5f) {
1738 r_col[1] *= (facm + 2.0f * fac *
col[1]);
1741 r_col[1] = 1.0f - (facm + 2.0f * fac * (1.0f -
col[1])) * (1.0f - r_col[1]);
1743 if (r_col[2] < 0.5f) {
1744 r_col[2] *= (facm + 2.0f * fac *
col[2]);
1747 r_col[2] = 1.0f - (facm + 2.0f * fac * (1.0f -
col[2])) * (1.0f - r_col[2]);
1751 r_col[0] -= fac *
col[0];
1752 r_col[1] -= fac *
col[1];
1753 r_col[2] -= fac *
col[2];
1756 if (
col[0] != 0.0f) {
1757 r_col[0] = facm * (r_col[0]) + fac * (r_col[0]) /
col[0];
1759 if (
col[1] != 0.0f) {
1760 r_col[1] = facm * (r_col[1]) + fac * (r_col[1]) /
col[1];
1762 if (
col[2] != 0.0f) {
1763 r_col[2] = facm * (r_col[2]) + fac * (r_col[2]) /
col[2];
1767 r_col[0] = facm * (r_col[0]) + fac *
fabsf(r_col[0] -
col[0]);
1768 r_col[1] = facm * (r_col[1]) + fac *
fabsf(r_col[1] -
col[1]);
1769 r_col[2] = facm * (r_col[2]) + fac *
fabsf(r_col[2] -
col[2]);
1772 r_col[0] =
max_ff(facm * (r_col[0]) + fac * (r_col[0] +
col[0] - 2.0f * r_col[0] *
col[0]),
1774 r_col[1] =
max_ff(facm * (r_col[1]) + fac * (r_col[1] +
col[1] - 2.0f * r_col[1] *
col[1]),
1776 r_col[2] =
max_ff(facm * (r_col[2]) + fac * (r_col[2] +
col[2] - 2.0f * r_col[2] *
col[2]),
1780 r_col[0] =
min_ff(r_col[0],
col[0]) * fac + r_col[0] * facm;
1781 r_col[1] =
min_ff(r_col[1],
col[1]) * fac + r_col[1] * facm;
1782 r_col[2] =
min_ff(r_col[2],
col[2]) * fac + r_col[2] * facm;
1786 if (tmp > r_col[0]) {
1790 if (tmp > r_col[1]) {
1794 if (tmp > r_col[2]) {
1799 if (r_col[0] != 0.0f) {
1800 tmp = 1.0f - fac *
col[0];
1804 else if ((tmp = (r_col[0]) / tmp) > 1.0f) {
1811 if (r_col[1] != 0.0f) {
1812 tmp = 1.0f - fac *
col[1];
1816 else if ((tmp = (r_col[1]) / tmp) > 1.0f) {
1823 if (r_col[2] != 0.0f) {
1824 tmp = 1.0f - fac *
col[2];
1828 else if ((tmp = (r_col[2]) / tmp) > 1.0f) {
1837 tmp = facm + fac *
col[0];
1842 else if ((tmp = (1.0f - (1.0f - (r_col[0])) / tmp)) < 0.0f) {
1845 else if (tmp > 1.0f) {
1852 tmp = facm + fac *
col[1];
1856 else if ((tmp = (1.0f - (1.0f - (r_col[1])) / tmp)) < 0.0f) {
1859 else if (tmp > 1.0f) {
1866 tmp = facm + fac *
col[2];
1870 else if ((tmp = (1.0f - (1.0f - (r_col[2])) / tmp)) < 0.0f) {
1873 else if (tmp > 1.0f) {
1882 float colH, colS, colV;
1883 float tmpr, tmpg, tmpb;
1886 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1887 hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
1888 r_col[0] = facm * (r_col[0]) + fac * tmpr;
1889 r_col[1] = facm * (r_col[1]) + fac * tmpg;
1890 r_col[2] = facm * (r_col[2]) + fac * tmpb;
1896 float colH, colS, colV;
1897 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1900 hsv_to_rgb(rH, (facm * rS + fac * colS), rV, r_col + 0, r_col + 1, r_col + 2);
1906 float colH, colS, colV;
1907 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1909 hsv_to_rgb(rH, rS, (facm * rV + fac * colV), r_col + 0, r_col + 1, r_col + 2);
1914 float colH, colS, colV;
1915 float tmpr, tmpg, tmpb;
1918 rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
1919 hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
1920 r_col[0] = facm * (r_col[0]) + fac * tmpr;
1921 r_col[1] = facm * (r_col[1]) + fac * tmpg;
1922 r_col[2] = facm * (r_col[2]) + fac * tmpb;
1927 float scr, scg, scb;
1930 scr = 1.0f - (1.0f -
col[0]) * (1.0f - r_col[0]);
1931 scg = 1.0f - (1.0f -
col[1]) * (1.0f - r_col[1]);
1932 scb = 1.0f - (1.0f -
col[2]) * (1.0f - r_col[2]);
1934 r_col[0] = facm * (r_col[0]) +
1935 fac * (((1.0f - r_col[0]) *
col[0] * (r_col[0])) + (r_col[0] * scr));
1936 r_col[1] = facm * (r_col[1]) +
1937 fac * (((1.0f - r_col[1]) *
col[1] * (r_col[1])) + (r_col[1] * scg));
1938 r_col[2] = facm * (r_col[2]) +
1939 fac * (((1.0f - r_col[2]) *
col[2] * (r_col[2])) + (r_col[2] * scb));
1943 if (
col[0] > 0.5f) {
1944 r_col[0] = r_col[0] + fac * (2.0f * (
col[0] - 0.5f));
1947 r_col[0] = r_col[0] + fac * (2.0f * (
col[0]) - 1.0f);
1949 if (
col[1] > 0.5f) {
1950 r_col[1] = r_col[1] + fac * (2.0f * (
col[1] - 0.5f));
1953 r_col[1] = r_col[1] + fac * (2.0f * (
col[1]) - 1.0f);
1955 if (
col[2] > 0.5f) {
1956 r_col[2] = r_col[2] + fac * (2.0f * (
col[2] - 0.5f));
1959 r_col[2] = r_col[2] + fac * (2.0f * (
col[2]) - 1.0f);
2016 principled->
locx = 10.0f;
2017 principled->
locy = 300.0f;
2018 output->locx = 300.0f;
2019 output->locy = 300.0f;
2033 nullptr, ntree, SH_NODE_VOLUME_PRINCIPLED);
2042 principled->
locx = 10.0f;
2043 principled->
locy = 300.0f;
2044 output->locx = 300.0f;
2045 output->locy = 300.0f;
2067 holdout->locx = 10.0f;
2068 holdout->locy = 300.0f;
2069 output->locx = 300.0f;
2070 output->locy = 300.0f;
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, const char *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)
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
@ LIB_ID_CREATE_NO_USER_REFCOUNT
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, const ID *new_owner_id, ID **new_id_p, int flag)
void * BKE_id_new(Main *bmain, 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)
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_DO_DEPRECATED_POINTERS
#define BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data_, id_, cb_flag_)
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
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 NODE_CUSTOM_GROUP
#define SH_NODE_OUTPUT_MATERIAL
#define NODE_CLASS_TEXTURE
#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()
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(struct 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])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#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)
BLO_Write_IDBuffer * BLO_write_allocate_id_buffer()
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_write_init_id_buffer_from_id(BLO_Write_IDBuffer *id_buffer, ID *id, const bool is_undo)
void BLO_write_destroy_id_buffer(BLO_Write_IDBuffer **id_buffer)
ID * BLO_write_get_id_buffer_temp_id(BLO_Write_IDBuffer *id_buffer)
#define BLO_read_struct(reader, struct_name, ptr_p)
bool BLO_write_is_undo(BlendWriter *writer)
#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)
ID * DEG_get_original_id(ID *id)
bool DEG_is_evaluated_object(const Object *object)
ID and Library types, which are fundamental for SDNA.
Object groups, one object can be in many groups at once.
#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
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
static void material_default_surface_init(Material *ma)
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)
static void material_data_index_clear_id(ID *id)
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)
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)
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)
static Material default_material_gpencil
Material * BKE_material_default_surface()
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)
static Material default_material_surface
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 bool texpaint_slot_node_find_cb(bNode *node, void *userdata)
static const ID * get_evaluated_object_data_with_materials(Object *ob)
static ePaintSlotFilter material_paint_slot_filter(const Object *ob)
bool(*)(bNode *node, void *userdata) ForEachTexNodeCallback
static Material default_material_empty
void BKE_id_materials_copy(Main *bmain, ID *id_src, ID *id_dst)
void BKE_object_material_remap(Object *ob, const uint *remap)
bool BKE_object_material_slot_add(Main *bmain, Object *ob)
Material * BKE_material_default_holdout()
static void material_free_data(ID *id)
void BKE_materials_init()
static Material * default_materials[]
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 Material default_material_holdout
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)
Material * BKE_material_add(Main *bmain, const char *name)
void BKE_object_materials_test(Main *bmain, Object *ob, ID *id)
void BKE_id_material_append(Main *bmain, ID *id, Material *ma)
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)
void BKE_objects_materials_test_all(Main *bmain, ID *id)
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_default_volume_init(Material *ma)
static void material_default_gpencil_init(Material *ma)
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)
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 Material default_material_volume
static bool fill_texpaint_slots_cb(bNode *node, void *userdata)
int BKE_object_material_index_get(Object *ob, const Material *ma)
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])
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
void *(* MEM_recallocN_id)(void *vmemh, size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
void node_set_active(bNodeTree *ntree, bNode *node)
bNodeTree * node_tree_localize(bNodeTree *ntree, ID *new_owner_id)
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
bNode * node_add_static_node(const bContext *C, bNodeTree *ntree, int type)
bNode * node_get_active_paint_canvas(bNodeTree *ntree)
bNodeLink * node_add_link(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
bNodeTree * node_tree_add_tree_embedded(Main *bmain, ID *owner_id, const char *name, const char *idname)
bNodeSocket * node_find_socket(bNode *node, eNodeSocketInOut in_out, StringRef identifier)
void node_tree_free_embedded_tree(bNodeTree *ntree)
struct Material ** material_array
struct bNodeTree * nodetree
struct PreviewImage * preview
struct MaterialGPencilStyle * gp_style
struct TexPaintSlot * texpaintslot
ObjectRuntimeHandle * runtime
struct ImageUser * image_user
bNodeTypeHandle * typeinfo
smooth(Type::VEC3, "normal_interp") .smooth(Type materials_data[]