Blender V4.3
texture.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cmath>
10#include <cstdio>
11#include <cstdlib>
12#include <cstring>
13#include <optional>
14
15#include "MEM_guardedalloc.h"
16
17#include "BLI_kdopbvh.h"
18#include "BLI_listbase.h"
19#include "BLI_math_color.h"
20#include "BLI_math_matrix.h"
21#include "BLI_math_rotation.h"
22#include "BLI_math_vector.h"
23#include "BLI_utildefines.h"
24
25#include "BLT_translation.hh"
26
27/* Allow using deprecated functionality for .blend file I/O. */
28#define DNA_DEPRECATED_ALLOW
29
30#include "DNA_brush_types.h"
31#include "DNA_color_types.h"
32#include "DNA_defaults.h"
33#include "DNA_linestyle_types.h"
34#include "DNA_material_types.h"
35#include "DNA_node_types.h"
36#include "DNA_object_types.h"
37#include "DNA_particle_types.h"
38
39#include "BKE_brush.hh"
40#include "BKE_colorband.hh"
41#include "BKE_colortools.hh"
42#include "BKE_icons.h"
43#include "BKE_idtype.hh"
44#include "BKE_image.hh"
45#include "BKE_lib_id.hh"
46#include "BKE_lib_query.hh"
47#include "BKE_node_runtime.hh"
48#include "BKE_preview_image.hh"
49#include "BKE_texture.h"
50
51#include "NOD_texture.h"
52
53#include "RE_texture.h"
54
55#include "DRW_engine.hh"
56
57#include "BLO_read_write.hh"
58
59static void texture_init_data(ID *id)
60{
61 Tex *texture = (Tex *)id;
62
64
66
67 BKE_imageuser_default(&texture->iuser);
68}
69
70static void texture_copy_data(Main *bmain,
71 std::optional<Library *> owner_library,
72 ID *id_dst,
73 const ID *id_src,
74 const int flag)
75{
76 Tex *texture_dst = (Tex *)id_dst;
77 const Tex *texture_src = (const Tex *)id_src;
78
79 const bool is_localized = (flag & LIB_ID_CREATE_LOCAL) != 0;
80 /* Never handle user-count here for own sub-data. */
81 const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
82 /* Always need allocation of the embedded ID data. */
83 const int flag_embedded_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE;
84
85 if (!BKE_texture_is_image_user(texture_src)) {
86 texture_dst->ima = nullptr;
87 }
88
89 if (texture_dst->coba) {
90 texture_dst->coba = static_cast<ColorBand *>(MEM_dupallocN(texture_dst->coba));
91 }
92 if (texture_src->nodetree) {
93 if (texture_src->nodetree->runtime->execdata) {
94 ntreeTexEndExecTree(texture_src->nodetree->runtime->execdata);
95 }
96
97 if (is_localized) {
98 texture_dst->nodetree = blender::bke::node_tree_localize(texture_src->nodetree,
99 &texture_dst->id);
100 }
101 else {
102 BKE_id_copy_in_lib(bmain,
103 owner_library,
104 &texture_src->nodetree->id,
105 &texture_dst->id,
106 reinterpret_cast<ID **>(&texture_dst->nodetree),
107 flag_embedded_id_data);
108 }
109 }
110
111 BLI_listbase_clear((ListBase *)&texture_dst->drawdata);
112
113 if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
114 BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id);
115 }
116 else {
117 texture_dst->preview = nullptr;
118 }
119}
120
121static void texture_free_data(ID *id)
122{
123 Tex *texture = (Tex *)id;
124
126
127 /* is no lib link block, but texture extension */
128 if (texture->nodetree) {
130 MEM_freeN(texture->nodetree);
131 texture->nodetree = nullptr;
132 }
133
134 MEM_SAFE_FREE(texture->coba);
135
136 BKE_icon_id_delete((ID *)texture);
137 BKE_previewimg_free(&texture->preview);
138}
139
141{
142 Tex *texture = reinterpret_cast<Tex *>(id);
144
145 if (texture->nodetree) {
146 /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
148 data, BKE_library_foreach_ID_embedded(data, (ID **)&texture->nodetree));
149 }
151
154 }
155}
156
157static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
158{
159 Tex *tex = (Tex *)id;
160
161 /* write LibData */
162 BLO_write_id_struct(writer, Tex, id_address, &tex->id);
163 BKE_id_blend_write(writer, &tex->id);
164
165 /* direct data */
166 if (tex->coba) {
168 }
169
170 /* nodetree is integral part of texture, no libdata */
171 if (tex->nodetree) {
172 BLO_Write_IDBuffer *temp_embedded_id_buffer = BLO_write_allocate_id_buffer();
174 temp_embedded_id_buffer, &tex->nodetree->id, BLO_write_is_undo(writer));
176 bNodeTree,
177 tex->nodetree,
178 BLO_write_get_id_buffer_temp_id(temp_embedded_id_buffer));
180 writer,
181 reinterpret_cast<bNodeTree *>(BLO_write_get_id_buffer_temp_id(temp_embedded_id_buffer)));
182 BLO_write_destroy_id_buffer(&temp_embedded_id_buffer);
183 }
184
186}
187
189{
190 Tex *tex = (Tex *)id;
191
192 BLO_read_struct(reader, ColorBand, &tex->coba);
193
196
197 tex->iuser.scene = nullptr;
198}
199
201 /*id_code*/ ID_TE,
202 /*id_filter*/ FILTER_ID_TE,
203 /*dependencies_id_types*/ FILTER_ID_IM | FILTER_ID_OB,
204 /*main_listbase_index*/ INDEX_ID_TE,
205 /*struct_size*/ sizeof(Tex),
206 /*name*/ "Texture",
207 /*name_plural*/ N_("textures"),
208 /*translation_context*/ BLT_I18NCONTEXT_ID_TEXTURE,
210 /*asset_type_info*/ nullptr,
211
212 /*init_data*/ texture_init_data,
213 /*copy_data*/ texture_copy_data,
214 /*free_data*/ texture_free_data,
215 /*make_local*/ nullptr,
216 /*foreach_id*/ texture_foreach_id,
217 /*foreach_cache*/ nullptr,
218 /*foreach_path*/ nullptr,
219 /*owner_pointer_get*/ nullptr,
220
221 /*blend_write*/ texture_blend_write,
222 /*blend_read_data*/ texture_blend_read_data,
223 /*blend_read_after_liblink*/ nullptr,
224
225 /*blend_read_undo_preserve*/ nullptr,
226
227 /*lib_override_apply_post*/ nullptr,
228};
229
235
236/* ****************** Mapping ******************* */
237
239{
240 TexMapping *texmap = MEM_cnew<TexMapping>("TexMapping");
241
242 BKE_texture_mapping_default(texmap, type);
243
244 return texmap;
245}
246
248{
249 memset(texmap, 0, sizeof(TexMapping));
250
251 texmap->size[0] = texmap->size[1] = texmap->size[2] = 1.0f;
252 texmap->max[0] = texmap->max[1] = texmap->max[2] = 1.0f;
253 unit_m4(texmap->mat);
254
255 texmap->projx = PROJ_X;
256 texmap->projy = PROJ_Y;
257 texmap->projz = PROJ_Z;
258 texmap->mapping = MTEX_FLAT;
259 texmap->type = type;
260}
261
263{
264 float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
265
266 if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
267 is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size))
268 {
269 unit_m4(texmap->mat);
270
271 texmap->flag |= TEXMAP_UNIT_MATRIX;
272 }
273 else {
274 /* axis projection */
275 zero_m4(proj);
276 proj[3][3] = 1.0f;
277
278 if (texmap->projx != PROJ_N) {
279 proj[texmap->projx - 1][0] = 1.0f;
280 }
281 if (texmap->projy != PROJ_N) {
282 proj[texmap->projy - 1][1] = 1.0f;
283 }
284 if (texmap->projz != PROJ_N) {
285 proj[texmap->projz - 1][2] = 1.0f;
286 }
287
288 /* scale */
289 copy_v3_v3(size, texmap->size);
290
292 /* keep matrix invertible */
293 if (fabsf(size[0]) < 1e-5f) {
294 size[0] = signf(size[0]) * 1e-5f;
295 }
296 if (fabsf(size[1]) < 1e-5f) {
297 size[1] = signf(size[1]) * 1e-5f;
298 }
299 if (fabsf(size[2]) < 1e-5f) {
300 size[2] = signf(size[2]) * 1e-5f;
301 }
302 }
303
304 size_to_mat4(smat, texmap->size);
305
306 /* rotation */
307 eul_to_mat4(rmat, texmap->rot);
308
309 /* translation */
310 unit_m4(tmat);
311 copy_v3_v3(tmat[3], texmap->loc);
312
313 if (texmap->type == TEXMAP_TYPE_TEXTURE) {
314 /* to transform a texture, the inverse transform needs
315 * to be applied to the texture coordinate */
316 mul_m4_series(texmap->mat, tmat, rmat, smat);
317 invert_m4(texmap->mat);
318 }
319 else if (texmap->type == TEXMAP_TYPE_POINT) {
320 /* forward transform */
321 mul_m4_series(texmap->mat, tmat, rmat, smat);
322 }
323 else if (texmap->type == TEXMAP_TYPE_VECTOR) {
324 /* no translation for vectors */
325 mul_m4_m4m4(texmap->mat, rmat, smat);
326 }
327 else if (texmap->type == TEXMAP_TYPE_NORMAL) {
328 /* no translation for normals, and inverse transpose */
329 mul_m4_m4m4(texmap->mat, rmat, smat);
330 invert_m4(texmap->mat);
331 transpose_m4(texmap->mat);
332 }
333
334 /* projection last */
335 mul_m4_m4m4(texmap->mat, texmap->mat, proj);
336
337 texmap->flag &= ~TEXMAP_UNIT_MATRIX;
338 }
339}
340
342{
343 ColorMapping *colormap = MEM_cnew<ColorMapping>("ColorMapping");
344
346
347 return colormap;
348}
349
351{
352 memset(colormap, 0, sizeof(ColorMapping));
353
354 BKE_colorband_init(&colormap->coba, true);
355
356 colormap->bright = 1.0;
357 colormap->contrast = 1.0;
358 colormap->saturation = 1.0;
359
360 colormap->blend_color[0] = 0.8f;
361 colormap->blend_color[1] = 0.8f;
362 colormap->blend_color[2] = 0.8f;
363 colormap->blend_type = MA_RAMP_BLEND;
364 colormap->blend_factor = 0.0f;
365}
366
367/* ******************* TEX ************************ */
368
369/* ------------------------------------------------------------------------- */
370
375
377{
378 tex->type = type;
379}
380
381/* ------------------------------------------------------------------------- */
382
383Tex *BKE_texture_add(Main *bmain, const char *name)
384{
385 Tex *tex;
386
387 tex = static_cast<Tex *>(BKE_id_new(bmain, ID_TE, name));
388
389 return tex;
390}
391
392/* ------------------------------------------------------------------------- */
393
395{
396 *mtex = blender::dna::shallow_copy(*DNA_struct_default_get(MTex));
397}
398
399/* ------------------------------------------------------------------------- */
400
402{
403 MTex *mtex;
404
405 mtex = static_cast<MTex *>(MEM_callocN(sizeof(MTex), "BKE_texture_mtex_add"));
406
408
409 return mtex;
410}
411
413{
414 MTex **mtex_ar;
415 short act;
416
417 give_active_mtex(id, &mtex_ar, &act);
418
419 if (mtex_ar == nullptr) {
420 return nullptr;
421 }
422
423 if (slot == -1) {
424 /* find first free */
425 int i;
426 for (i = 0; i < MAX_MTEX; i++) {
427 if (!mtex_ar[i]) {
428 slot = i;
429 break;
430 }
431 }
432 if (slot == -1) {
433 return nullptr;
434 }
435 }
436 else {
437 /* make sure slot is valid */
438 if (slot < 0 || slot >= MAX_MTEX) {
439 return nullptr;
440 }
441 }
442
443 if (mtex_ar[slot]) {
444 id_us_min((ID *)mtex_ar[slot]->tex);
445 MEM_freeN(mtex_ar[slot]);
446 mtex_ar[slot] = nullptr;
447 }
448
449 mtex_ar[slot] = BKE_texture_mtex_add();
450
451 return mtex_ar[slot];
452}
453
454/* ------------------------------------------------------------------------- */
455
457{
458 MTex *mtex = nullptr;
459 Tex *tex = nullptr;
460
461 if (linestyle) {
462 mtex = linestyle->mtex[int(linestyle->texact)];
463 if (mtex) {
464 tex = mtex->tex;
465 }
466 }
467
468 return tex;
469}
470
472{
473 int act = linestyle->texact;
474
475 if (linestyle->mtex[act] && linestyle->mtex[act]->tex) {
476 id_us_min(&linestyle->mtex[act]->tex->id);
477 }
478
479 if (newtex) {
480 if (!linestyle->mtex[act]) {
483 }
484
485 linestyle->mtex[act]->tex = newtex;
486 id_us_plus(&newtex->id);
487 }
488 else {
490 }
491}
492
493bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
494{
495 switch (GS(id->name)) {
496 case ID_LS:
497 *mtex_ar = ((FreestyleLineStyle *)id)->mtex;
498 if (act) {
499 *act = (((FreestyleLineStyle *)id)->texact);
500 }
501 break;
502 case ID_PA:
503 *mtex_ar = ((ParticleSettings *)id)->mtex;
504 if (act) {
505 *act = (((ParticleSettings *)id)->texact);
506 }
507 break;
508 default:
509 *mtex_ar = nullptr;
510 if (act) {
511 *act = 0;
512 }
513 return false;
514 }
515
516 return true;
517}
518
519void set_active_mtex(ID *id, short act)
520{
521 if (act < 0) {
522 act = 0;
523 }
524 else if (act >= MAX_MTEX) {
525 act = MAX_MTEX - 1;
526 }
527
528 switch (GS(id->name)) {
529 case ID_LS:
530 ((FreestyleLineStyle *)id)->texact = act;
531 break;
532 case ID_PA:
533 ((ParticleSettings *)id)->texact = act;
534 break;
535 default:
536 break;
537 }
538}
539
541{
542 return br->mtex.tex;
543}
544
546{
547 if (br->mtex.tex) {
548 id_us_min(&br->mtex.tex->id);
549 }
550
551 if (newtex) {
552 br->mtex.tex = newtex;
553 id_us_plus(&newtex->id);
554 }
556}
557
559{
560 MTex *mtex = nullptr;
561 Tex *tex = nullptr;
562
563 if (!part) {
564 return nullptr;
565 }
566
567 mtex = part->mtex[int(part->texact)];
568 if (mtex) {
569 tex = mtex->tex;
570 }
571
572 return tex;
573}
574
576{
577 int act = part->texact;
578
579 if (part->mtex[act] && part->mtex[act]->tex) {
580 id_us_min(&part->mtex[act]->tex->id);
581 }
582
583 if (newtex) {
584 if (!part->mtex[act]) {
585 part->mtex[act] = BKE_texture_mtex_add();
586 part->mtex[act]->texco = TEXCO_ORCO;
587 part->mtex[act]->blendtype = MTEX_MUL;
588 }
589
590 part->mtex[act]->tex = newtex;
591 id_us_plus(&newtex->id);
592 }
593 else {
594 MEM_SAFE_FREE(part->mtex[act]);
595 }
596}
597
598/* ------------------------------------------------------------------------- */
599
601{
602 pd->flag = 0;
603 pd->radius = 0.3f;
605 pd->falloff_softness = 2.0;
606 pd->source = TEX_PD_PSYS;
607 pd->point_tree = nullptr;
608 pd->point_data = nullptr;
609 pd->noise_size = 0.5f;
610 pd->noise_depth = 1;
611 pd->noise_fac = 1.0f;
613 pd->coba = BKE_colorband_add(true);
614 pd->speed_scale = 1.0f;
615 pd->totpoints = 0;
616 pd->object = nullptr;
617 pd->psys = 0;
619 pd->falloff_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
620
622 pd->falloff_curve->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
624 &pd->falloff_curve->clipr,
628}
629
631{
632 PointDensity *pd = static_cast<PointDensity *>(
633 MEM_callocN(sizeof(PointDensity), "pointdensity"));
635 return pd;
636}
637
639{
640 PointDensity *pdn;
641
642 pdn = static_cast<PointDensity *>(MEM_dupallocN(pd));
643 pdn->point_tree = nullptr;
644 pdn->point_data = nullptr;
645 if (pdn->coba) {
646 pdn->coba = static_cast<ColorBand *>(MEM_dupallocN(pdn->coba));
647 }
648 pdn->falloff_curve = BKE_curvemapping_copy(pdn->falloff_curve); /* can be nullptr */
649 return pdn;
650}
651
653{
654 if (pd->point_tree) {
655 BLI_bvhtree_free(static_cast<BVHTree *>(pd->point_tree));
656 pd->point_tree = nullptr;
657 }
659 MEM_SAFE_FREE(pd->coba);
660
661 BKE_curvemapping_free(pd->falloff_curve); /* can be nullptr */
662}
663
669/* ------------------------------------------------------------------------- */
670
672{
673 switch (tex->type) {
674 case TEX_IMAGE: {
675 return true;
676 }
677 }
678
679 return false;
680}
681
682bool BKE_texture_dependsOnTime(const Tex *texture)
683{
684 if (texture->ima && BKE_image_is_animated(texture->ima)) {
685 return true;
686 }
687 if (texture->adt) {
688 /* assume anything in adt means the texture is animated */
689 return true;
690 }
691 if (texture->type == TEX_NOISE) {
692 /* noise always varies with time */
693 return true;
694 }
695 return false;
696}
697
698/* ------------------------------------------------------------------------- */
699
701 const float *tex_co,
702 TexResult *texres,
703 ImagePool *pool,
704 bool use_color_management)
705{
706 /* no node textures for now */
707 const int result_type = multitex_ext_safe(
708 texture, tex_co, texres, pool, use_color_management, false);
709
710 /* if the texture gave an RGB value, we assume it didn't give a valid
711 * intensity, since this is in the context of modifiers don't use perceptual color conversion.
712 * if the texture didn't give an RGB value, copy the intensity across
713 */
714 if (result_type & TEX_RGB) {
715 texres->tin = (1.0f / 3.0f) * (texres->trgba[0] + texres->trgba[1] + texres->trgba[2]);
716 }
717 else {
718 copy_v3_fl(texres->trgba, texres->tin);
719 }
720}
721
723 const float *tex_co,
724 TexResult *texres,
725 bool use_color_management)
726{
727 BKE_texture_get_value_ex(texture, tex_co, texres, nullptr, use_color_management);
728}
729
730static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, ImagePool *pool)
731{
732 for (bNode *node : ntree->all_nodes()) {
733 if (node->type == SH_NODE_TEX_IMAGE && node->id != nullptr) {
734 Image *image = (Image *)node->id;
735 BKE_image_pool_acquire_ibuf(image, &texture->iuser, pool);
736 }
737 else if (node->type == NODE_GROUP && node->id != nullptr) {
738 /* TODO(sergey): Do we need to control recursion here? */
739 bNodeTree *nested_tree = (bNodeTree *)node->id;
740 texture_nodes_fetch_images_for_pool(texture, nested_tree, pool);
741 }
742 }
743}
744
746{
747 if (texture->nodetree != nullptr) {
748 texture_nodes_fetch_images_for_pool(texture, texture->nodetree, pool);
749 }
750 else {
751 if (texture->type == TEX_IMAGE) {
752 if (texture->ima != nullptr) {
753 BKE_image_pool_acquire_ibuf(texture->ima, &texture->iuser, pool);
754 }
755 }
756 }
757}
void BKE_brush_tag_unsaved_changes(Brush *brush)
Definition brush.cc:621
ColorBand * BKE_colorband_add(bool rangetype)
Definition colorband.cc:298
void BKE_colorband_init(ColorBand *coba, bool rangetype)
Definition colorband.cc:22
@ CURVEMAP_SLOPE_POSITIVE
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition colortools.cc:90
void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope)
void BKE_curvemapping_free(CurveMapping *cumap)
void BKE_curvemapping_changed(CurveMapping *cumap, bool rem_doubles)
void BKE_icon_id_delete(struct ID *id)
Definition icons.cc:451
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
Definition BKE_idtype.hh:39
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_COPY_NO_PREVIEW
@ LIB_ID_CREATE_LOCAL
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void id_us_plus(ID *id)
Definition lib_id.cc:351
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)
Definition lib_id.cc:656
void * BKE_id_new(Main *bmain, short type, const char *name)
Definition lib_id.cc:1482
void id_us_min(ID *id)
Definition lib_id.cc:359
void BKE_id_blend_write(BlendWriter *writer, ID *id)
Definition lib_id.cc:2560
#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)
Definition lib_query.cc:163
@ IDWALK_CB_USER
@ IDWALK_CB_NOP
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
Definition lib_query.cc:120
@ IDWALK_DO_DEPRECATED_POINTERS
#define BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data_, id_, cb_flag_)
#define SH_NODE_TEX_IMAGE
Definition BKE_node.hh:930
#define NODE_GROUP
Definition BKE_node.hh:800
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)
#define BLI_assert(a)
Definition BLI_assert.h:50
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])
Definition rct.c:1127
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 ELEM(...)
#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 FILTER_ID_OB
Definition DNA_ID.h:1181
#define FILTER_ID_TE
Definition DNA_ID.h:1187
@ INDEX_ID_TE
Definition DNA_ID.h:1279
#define FILTER_ID_IM
Definition DNA_ID.h:1171
@ ID_TE
@ ID_LS
@ ID_PA
@ CURVE_PRESET_LINE
#define DNA_struct_default_get(struct_name)
#define TEXCO_STROKE
@ TEXCO_ORCO
@ MA_RAMP_BLEND
Object is a sort of wrapper for general info.
@ TEX_IMAGE
@ MTEX_FLAT
@ TEXMAP_UNIT_MATRIX
@ TEX_RGB
@ MTEX_MUL
@ TEX_PD_FALLOFF_STD
@ TEX_PD_WORLDSPACE
@ TEXMAP_TYPE_NORMAL
@ TEXMAP_TYPE_POINT
@ TEXMAP_TYPE_TEXTURE
@ TEXMAP_TYPE_VECTOR
@ TEX_PD_NOISE_STATIC
struct Tex Tex
@ TEX_PD_PSYS
void DRW_drawdata_free(ID *id)
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
#define MAX_MTEX
Definition Stroke.h:33
FreestyleLineStyle linestyle
#define fabsf(x)
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
#define GS(x)
Definition iris.cc:202
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
void *(* MEM_dupallocN)(const void *vmemh)
Definition mallocn.cc:39
bNodeTree * node_tree_localize(bNodeTree *ntree, ID *new_owner_id)
Definition node.cc:3750
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
Definition node.cc:760
void node_tree_free_embedded_tree(bNodeTree *ntree)
Definition node.cc:3632
struct MTex mtex
struct ColorBand coba
CurveMap cm[4]
struct MTex * mtex[18]
Definition DNA_ID.h:413
struct Scene * scene
short texco
struct Object * object
struct Tex * tex
struct CurveMapping * falloff_curve
struct Object * object
struct ColorBand * coba
float mat[4][4]
float tin
Definition RE_texture.h:87
float trgba[4]
Definition RE_texture.h:88
DrawDataList drawdata
struct PreviewImage * preview
struct ImageUser iuser
struct ColorBand * coba
struct bNodeTree * nodetree
struct Image * ima
bNodeTreeRuntimeHandle * runtime
void BKE_texture_pointdensity_free(PointDensity *pd)
Definition texture.cc:664
static void texture_copy_data(Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
Definition texture.cc:70
Tex * BKE_texture_add(Main *bmain, const char *name)
Definition texture.cc:383
void BKE_texture_type_set(Tex *tex, int type)
Definition texture.cc:376
void BKE_texture_mapping_default(TexMapping *texmap, int type)
Definition texture.cc:247
Tex * give_current_particle_texture(ParticleSettings *part)
Definition texture.cc:558
void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
Definition texture.cc:575
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
Definition texture.cc:140
static void texture_init_data(ID *id)
Definition texture.cc:59
void set_current_brush_texture(Brush *br, Tex *newtex)
Definition texture.cc:545
void BKE_texture_colormapping_default(ColorMapping *colormap)
Definition texture.cc:350
MTex * BKE_texture_mtex_add_id(ID *id, int slot)
Definition texture.cc:412
Tex * give_current_linestyle_texture(FreestyleLineStyle *linestyle)
Definition texture.cc:456
IDTypeInfo IDType_ID_TE
Definition texture.cc:200
void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex)
Definition texture.cc:230
bool BKE_texture_dependsOnTime(const Tex *texture)
Definition texture.cc:682
PointDensity * BKE_texture_pointdensity_add()
Definition texture.cc:630
void BKE_texture_mapping_init(TexMapping *texmap)
Definition texture.cc:262
void set_active_mtex(ID *id, short act)
Definition texture.cc:519
void set_current_linestyle_texture(FreestyleLineStyle *linestyle, Tex *newtex)
Definition texture.cc:471
bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
Definition texture.cc:493
MTex * BKE_texture_mtex_add()
Definition texture.cc:401
void BKE_texture_pointdensity_init_data(PointDensity *pd)
Definition texture.cc:600
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition texture.cc:157
void BKE_texture_pointdensity_free_data(PointDensity *pd)
Definition texture.cc:652
void BKE_texture_mtex_default(MTex *mtex)
Definition texture.cc:394
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
Definition texture.cc:188
ColorMapping * BKE_texture_colormapping_add()
Definition texture.cc:341
void BKE_texture_get_value_ex(Tex *texture, const float *tex_co, TexResult *texres, ImagePool *pool, bool use_color_management)
Definition texture.cc:700
static void texture_free_data(ID *id)
Definition texture.cc:121
void BKE_texture_fetch_images_for_pool(Tex *texture, ImagePool *pool)
Definition texture.cc:745
void BKE_texture_default(Tex *tex)
Definition texture.cc:371
Tex * give_current_brush_texture(Brush *br)
Definition texture.cc:540
static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, ImagePool *pool)
Definition texture.cc:730
PointDensity * BKE_texture_pointdensity_copy(const PointDensity *pd, const int)
Definition texture.cc:638
bool BKE_texture_is_image_user(const Tex *tex)
Definition texture.cc:671
void BKE_texture_get_value(Tex *texture, const float *tex_co, TexResult *texres, bool use_color_management)
Definition texture.cc:722
TexMapping * BKE_texture_mapping_add(int type)
Definition texture.cc:238
int multitex_ext_safe(Tex *tex, const float texvec[3], TexResult *texres, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
#define N_(msgid)
uint8_t flag
Definition wm_window.cc:138