28#define DNA_DEPRECATED_ALLOW
71 std::optional<Library *> owner_library,
76 Tex *texture_dst = (
Tex *)id_dst;
77 const Tex *texture_src = (
const Tex *)id_src;
83 const int flag_embedded_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE;
86 texture_dst->
ima =
nullptr;
89 if (texture_dst->
coba) {
106 reinterpret_cast<ID **
>(&texture_dst->
nodetree),
107 flag_embedded_id_data);
117 texture_dst->
preview =
nullptr;
128 if (texture->nodetree) {
131 texture->nodetree =
nullptr;
142 Tex *texture =
reinterpret_cast<Tex *
>(id);
145 if (texture->nodetree) {
240 TexMapping *texmap = MEM_cnew<TexMapping>(
"TexMapping");
251 texmap->
size[0] = texmap->
size[1] = texmap->
size[2] = 1.0f;
252 texmap->
max[0] = texmap->
max[1] = texmap->
max[2] = 1.0f;
264 float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
279 proj[texmap->
projx - 1][0] = 1.0f;
282 proj[texmap->
projy - 1][1] = 1.0f;
285 proj[texmap->
projz - 1][2] = 1.0f;
293 if (
fabsf(size[0]) < 1e-5f) {
294 size[0] =
signf(size[0]) * 1e-5f;
296 if (
fabsf(size[1]) < 1e-5f) {
297 size[1] =
signf(size[1]) * 1e-5f;
299 if (
fabsf(size[2]) < 1e-5f) {
300 size[2] =
signf(size[2]) * 1e-5f;
337 texmap->
flag &= ~TEXMAP_UNIT_MATRIX;
343 ColorMapping *colormap = MEM_cnew<ColorMapping>(
"ColorMapping");
419 if (mtex_ar ==
nullptr) {
446 mtex_ar[slot] =
nullptr;
451 return mtex_ar[slot];
458 MTex *mtex =
nullptr;
495 switch (
GS(id->name)) {
528 switch (
GS(id->name)) {
560 MTex *mtex =
nullptr;
567 mtex = part->mtex[
int(part->texact)];
577 int act = part->texact;
579 if (part->mtex[act] && part->mtex[act]->tex) {
584 if (!part->mtex[act]) {
587 part->mtex[act]->blendtype =
MTEX_MUL;
590 part->mtex[act]->tex = newtex;
691 if (texture->type == TEX_NOISE) {
704 bool use_color_management)
708 texture, tex_co, texres, pool, use_color_management,
false);
715 texres->
tin = (1.0f / 3.0f) * (texres->
trgba[0] + texres->
trgba[1] + texres->
trgba[2]);
725 bool use_color_management)
732 for (
bNode *node : ntree->all_nodes()) {
737 else if (node->type ==
NODE_GROUP && node->id !=
nullptr) {
747 if (texture->nodetree !=
nullptr) {
752 if (texture->ima !=
nullptr) {
void BKE_brush_tag_unsaved_changes(Brush *brush)
ColorBand * BKE_colorband_add(bool rangetype)
void BKE_colorband_init(ColorBand *coba, bool rangetype)
void BKE_icon_id_delete(struct ID *id)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
ImBuf * BKE_image_pool_acquire_ibuf(Image *ima, ImageUser *iuser, ImagePool *pool)
void BKE_imageuser_default(ImageUser *iuser)
bool BKE_image_is_animated(Image *image)
@ 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_)
#define SH_NODE_TEX_IMAGE
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)
void BLI_bvhtree_free(BVHTree *tree)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
MINLINE float signf(float f)
void zero_m4(float m[4][4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m4(float m[4][4])
void size_to_mat4(float R[4][4], const float size[3])
#define mul_m4_series(...)
bool invert_m4(float mat[4][4])
void transpose_m4(float R[4][4])
void eul_to_mat4(float mat[4][4], const float eul[3])
MINLINE bool is_one_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
#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_TEXTURE
#define DNA_struct_default_get(struct_name)
Object is a sort of wrapper for general info.
void DRW_drawdata_free(ID *id)
Read Guarded memory(de)allocation.
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
FreestyleLineStyle linestyle
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
bNodeTree * node_tree_localize(bNodeTree *ntree, ID *new_owner_id)
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
void node_tree_free_embedded_tree(bNodeTree *ntree)
struct CurveMapping * falloff_curve
struct PreviewImage * preview
struct bNodeTree * nodetree
bNodeTreeRuntimeHandle * runtime
void BKE_texture_pointdensity_free(PointDensity *pd)
static void texture_copy_data(Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
Tex * BKE_texture_add(Main *bmain, const char *name)
void BKE_texture_type_set(Tex *tex, int type)
void BKE_texture_mapping_default(TexMapping *texmap, int type)
Tex * give_current_particle_texture(ParticleSettings *part)
void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
static void texture_init_data(ID *id)
void set_current_brush_texture(Brush *br, Tex *newtex)
void BKE_texture_colormapping_default(ColorMapping *colormap)
MTex * BKE_texture_mtex_add_id(ID *id, int slot)
Tex * give_current_linestyle_texture(FreestyleLineStyle *linestyle)
void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex)
bool BKE_texture_dependsOnTime(const Tex *texture)
PointDensity * BKE_texture_pointdensity_add()
void BKE_texture_mapping_init(TexMapping *texmap)
void set_active_mtex(ID *id, short act)
void set_current_linestyle_texture(FreestyleLineStyle *linestyle, Tex *newtex)
bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
MTex * BKE_texture_mtex_add()
void BKE_texture_pointdensity_init_data(PointDensity *pd)
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_texture_pointdensity_free_data(PointDensity *pd)
void BKE_texture_mtex_default(MTex *mtex)
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
ColorMapping * BKE_texture_colormapping_add()
void BKE_texture_get_value_ex(Tex *texture, const float *tex_co, TexResult *texres, ImagePool *pool, bool use_color_management)
static void texture_free_data(ID *id)
void BKE_texture_fetch_images_for_pool(Tex *texture, ImagePool *pool)
void BKE_texture_default(Tex *tex)
Tex * give_current_brush_texture(Brush *br)
static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, ImagePool *pool)
PointDensity * BKE_texture_pointdensity_copy(const PointDensity *pd, const int)
bool BKE_texture_is_image_user(const Tex *tex)
void BKE_texture_get_value(Tex *texture, const float *tex_co, TexResult *texres, bool use_color_management)
TexMapping * BKE_texture_mapping_add(int type)
int multitex_ext_safe(Tex *tex, const float texvec[3], TexResult *texres, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)