Blender V4.5
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
8
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.hh"
18#include "BLI_listbase.h"
19#include "BLI_math_matrix.h"
20#include "BLI_math_rotation.h"
21#include "BLI_math_vector.h"
22#include "BLI_utildefines.h"
23
24#include "BLT_translation.hh"
25
26/* Allow using deprecated functionality for .blend file I/O. */
27#define DNA_DEPRECATED_ALLOW
28
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_particle_types.h"
37#include "DNA_texture_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
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 if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
112 BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id);
113 }
114 else {
115 texture_dst->preview = nullptr;
116 }
117}
118
119static void texture_free_data(ID *id)
120{
121 Tex *texture = (Tex *)id;
122
123 /* is no lib link block, but texture extension */
124 if (texture->nodetree) {
126 MEM_freeN(texture->nodetree);
127 texture->nodetree = nullptr;
128 }
129
130 MEM_SAFE_FREE(texture->coba);
131
133 BKE_previewimg_free(&texture->preview);
134}
135
137{
138 Tex *texture = reinterpret_cast<Tex *>(id);
140
141 if (texture->nodetree) {
142 /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
145 }
147
150 }
151}
152
153static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
154{
155 Tex *tex = (Tex *)id;
156
157 /* write LibData */
158 BLO_write_id_struct(writer, Tex, id_address, &tex->id);
159 BKE_id_blend_write(writer, &tex->id);
160
161 /* direct data */
162 if (tex->coba) {
163 BLO_write_struct(writer, ColorBand, tex->coba);
164 }
165
166 /* nodetree is integral part of texture, no libdata */
167 if (tex->nodetree) {
168 BLO_Write_IDBuffer temp_embedded_id_buffer{tex->nodetree->id, writer};
169 BLO_write_struct_at_address(writer, bNodeTree, tex->nodetree, temp_embedded_id_buffer.get());
171 writer, reinterpret_cast<bNodeTree *>(temp_embedded_id_buffer.get()));
172 }
173
175}
176
178{
179 Tex *tex = (Tex *)id;
180
181 BLO_read_struct(reader, ColorBand, &tex->coba);
182
183 BLO_read_struct(reader, PreviewImage, &tex->preview);
185
186 tex->iuser.scene = nullptr;
187
188 tex->runtime.last_update = 0;
189}
190
192 /*id_code*/ Tex::id_type,
193 /*id_filter*/ FILTER_ID_TE,
194 /*dependencies_id_types*/ FILTER_ID_IM | FILTER_ID_OB,
195 /*main_listbase_index*/ INDEX_ID_TE,
196 /*struct_size*/ sizeof(Tex),
197 /*name*/ "Texture",
198 /*name_plural*/ N_("textures"),
199 /*translation_context*/ BLT_I18NCONTEXT_ID_TEXTURE,
201 /*asset_type_info*/ nullptr,
202
203 /*init_data*/ texture_init_data,
204 /*copy_data*/ texture_copy_data,
205 /*free_data*/ texture_free_data,
206 /*make_local*/ nullptr,
207 /*foreach_id*/ texture_foreach_id,
208 /*foreach_cache*/ nullptr,
209 /*foreach_path*/ nullptr,
210 /*owner_pointer_get*/ nullptr,
211
212 /*blend_write*/ texture_blend_write,
213 /*blend_read_data*/ texture_blend_read_data,
214 /*blend_read_after_liblink*/ nullptr,
215
216 /*blend_read_undo_preserve*/ nullptr,
217
218 /*lib_override_apply_post*/ nullptr,
219};
220
226
227/* ****************** Mapping ******************* */
228
230{
231 TexMapping *texmap = MEM_callocN<TexMapping>("TexMapping");
232
233 BKE_texture_mapping_default(texmap, type);
234
235 return texmap;
236}
237
239{
240 *texmap = TexMapping{};
241
242 texmap->size[0] = texmap->size[1] = texmap->size[2] = 1.0f;
243 texmap->max[0] = texmap->max[1] = texmap->max[2] = 1.0f;
244 unit_m4(texmap->mat);
245
246 texmap->projx = PROJ_X;
247 texmap->projy = PROJ_Y;
248 texmap->projz = PROJ_Z;
249 texmap->mapping = MTEX_FLAT;
250 texmap->type = type;
251}
252
254{
255 float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
256
257 if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
258 is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size))
259 {
260 unit_m4(texmap->mat);
261
262 texmap->flag |= TEXMAP_UNIT_MATRIX;
263 }
264 else {
265 /* axis projection */
266 zero_m4(proj);
267 proj[3][3] = 1.0f;
268
269 if (texmap->projx != PROJ_N) {
270 proj[texmap->projx - 1][0] = 1.0f;
271 }
272 if (texmap->projy != PROJ_N) {
273 proj[texmap->projy - 1][1] = 1.0f;
274 }
275 if (texmap->projz != PROJ_N) {
276 proj[texmap->projz - 1][2] = 1.0f;
277 }
278
279 /* scale */
280 copy_v3_v3(size, texmap->size);
281
283 /* keep matrix invertible */
284 if (fabsf(size[0]) < 1e-5f) {
285 size[0] = signf(size[0]) * 1e-5f;
286 }
287 if (fabsf(size[1]) < 1e-5f) {
288 size[1] = signf(size[1]) * 1e-5f;
289 }
290 if (fabsf(size[2]) < 1e-5f) {
291 size[2] = signf(size[2]) * 1e-5f;
292 }
293 }
294
295 size_to_mat4(smat, texmap->size);
296
297 /* rotation */
298 eul_to_mat4(rmat, texmap->rot);
299
300 /* translation */
301 unit_m4(tmat);
302 copy_v3_v3(tmat[3], texmap->loc);
303
304 if (texmap->type == TEXMAP_TYPE_TEXTURE) {
305 /* to transform a texture, the inverse transform needs
306 * to be applied to the texture coordinate */
307 mul_m4_series(texmap->mat, tmat, rmat, smat);
308 invert_m4(texmap->mat);
309 }
310 else if (texmap->type == TEXMAP_TYPE_POINT) {
311 /* forward transform */
312 mul_m4_series(texmap->mat, tmat, rmat, smat);
313 }
314 else if (texmap->type == TEXMAP_TYPE_VECTOR) {
315 /* no translation for vectors */
316 mul_m4_m4m4(texmap->mat, rmat, smat);
317 }
318 else if (texmap->type == TEXMAP_TYPE_NORMAL) {
319 /* no translation for normals, and inverse transpose */
320 mul_m4_m4m4(texmap->mat, rmat, smat);
321 invert_m4(texmap->mat);
322 transpose_m4(texmap->mat);
323 }
324
325 /* projection last */
326 mul_m4_m4m4(texmap->mat, texmap->mat, proj);
327
328 texmap->flag &= ~TEXMAP_UNIT_MATRIX;
329 }
330}
331
333{
334 ColorMapping *colormap = MEM_callocN<ColorMapping>("ColorMapping");
335
337
338 return colormap;
339}
340
342{
343 *colormap = ColorMapping{};
344
345 BKE_colorband_init(&colormap->coba, true);
346
347 colormap->bright = 1.0;
348 colormap->contrast = 1.0;
349 colormap->saturation = 1.0;
350
351 colormap->blend_color[0] = 0.8f;
352 colormap->blend_color[1] = 0.8f;
353 colormap->blend_color[2] = 0.8f;
354 colormap->blend_type = MA_RAMP_BLEND;
355 colormap->blend_factor = 0.0f;
356}
357
358/* ******************* TEX ************************ */
359
360/* ------------------------------------------------------------------------- */
361
363{
364 texture_init_data(&tex->id);
365}
366
367void BKE_texture_type_set(Tex *tex, int type)
368{
369 tex->type = type;
370}
371
372/* ------------------------------------------------------------------------- */
373
374Tex *BKE_texture_add(Main *bmain, const char *name)
375{
376 Tex *tex;
377
378 tex = BKE_id_new<Tex>(bmain, name);
379
380 return tex;
381}
382
383/* ------------------------------------------------------------------------- */
384
386{
387 *mtex = blender::dna::shallow_copy(*DNA_struct_default_get(MTex));
388}
389
390/* ------------------------------------------------------------------------- */
391
393{
394 MTex *mtex;
395
396 mtex = MEM_callocN<MTex>("BKE_texture_mtex_add");
397
399
400 return mtex;
401}
402
404{
405 MTex **mtex_ar;
406 short act;
407
408 give_active_mtex(id, &mtex_ar, &act);
409
410 if (mtex_ar == nullptr) {
411 return nullptr;
412 }
413
414 if (slot == -1) {
415 /* find first free */
416 int i;
417 for (i = 0; i < MAX_MTEX; i++) {
418 if (!mtex_ar[i]) {
419 slot = i;
420 break;
421 }
422 }
423 if (slot == -1) {
424 return nullptr;
425 }
426 }
427 else {
428 /* make sure slot is valid */
429 if (slot < 0 || slot >= MAX_MTEX) {
430 return nullptr;
431 }
432 }
433
434 if (mtex_ar[slot]) {
435 id_us_min((ID *)mtex_ar[slot]->tex);
436 MEM_freeN(mtex_ar[slot]);
437 mtex_ar[slot] = nullptr;
438 }
439
440 mtex_ar[slot] = BKE_texture_mtex_add();
441
442 return mtex_ar[slot];
443}
444
445/* ------------------------------------------------------------------------- */
446
448{
449 MTex *mtex = nullptr;
450 Tex *tex = nullptr;
451
452 if (linestyle) {
453 mtex = linestyle->mtex[int(linestyle->texact)];
454 if (mtex) {
455 tex = mtex->tex;
456 }
457 }
458
459 return tex;
460}
461
463{
464 int act = linestyle->texact;
465
466 if (linestyle->mtex[act] && linestyle->mtex[act]->tex) {
467 id_us_min(&linestyle->mtex[act]->tex->id);
468 }
469
470 if (newtex) {
471 if (!linestyle->mtex[act]) {
472 linestyle->mtex[act] = BKE_texture_mtex_add();
473 linestyle->mtex[act]->texco = TEXCO_STROKE;
474 }
475
476 linestyle->mtex[act]->tex = newtex;
477 id_us_plus(&newtex->id);
478 }
479 else {
480 MEM_SAFE_FREE(linestyle->mtex[act]);
481 }
482}
483
484bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
485{
486 switch (GS(id->name)) {
487 case ID_LS:
488 *mtex_ar = ((FreestyleLineStyle *)id)->mtex;
489 if (act) {
490 *act = (((FreestyleLineStyle *)id)->texact);
491 }
492 break;
493 case ID_PA:
494 *mtex_ar = ((ParticleSettings *)id)->mtex;
495 if (act) {
496 *act = (((ParticleSettings *)id)->texact);
497 }
498 break;
499 default:
500 *mtex_ar = nullptr;
501 if (act) {
502 *act = 0;
503 }
504 return false;
505 }
506
507 return true;
508}
509
510void set_active_mtex(ID *id, short act)
511{
512 if (act < 0) {
513 act = 0;
514 }
515 else if (act >= MAX_MTEX) {
516 act = MAX_MTEX - 1;
517 }
518
519 switch (GS(id->name)) {
520 case ID_LS:
521 ((FreestyleLineStyle *)id)->texact = act;
522 break;
523 case ID_PA:
524 ((ParticleSettings *)id)->texact = act;
525 break;
526 default:
527 break;
528 }
529}
530
532{
533 return br->mtex.tex;
534}
535
537{
538 if (br->mtex.tex) {
539 id_us_min(&br->mtex.tex->id);
540 }
541
542 if (newtex) {
543 br->mtex.tex = newtex;
544 id_us_plus(&newtex->id);
545 }
547}
548
550{
551 MTex *mtex = nullptr;
552 Tex *tex = nullptr;
553
554 if (!part) {
555 return nullptr;
556 }
557
558 mtex = part->mtex[int(part->texact)];
559 if (mtex) {
560 tex = mtex->tex;
561 }
562
563 return tex;
564}
565
567{
568 int act = part->texact;
569
570 if (part->mtex[act] && part->mtex[act]->tex) {
571 id_us_min(&part->mtex[act]->tex->id);
572 }
573
574 if (newtex) {
575 if (!part->mtex[act]) {
576 part->mtex[act] = BKE_texture_mtex_add();
577 part->mtex[act]->texco = TEXCO_ORCO;
578 part->mtex[act]->blendtype = MTEX_MUL;
579 }
580
581 part->mtex[act]->tex = newtex;
582 id_us_plus(&newtex->id);
583 }
584 else {
585 MEM_SAFE_FREE(part->mtex[act]);
586 }
587}
588
589/* ------------------------------------------------------------------------- */
590
592{
593 pd->flag = 0;
594 pd->radius = 0.3f;
596 pd->falloff_softness = 2.0;
597 pd->source = TEX_PD_PSYS;
598 pd->point_tree = nullptr;
599 pd->point_data = nullptr;
600 pd->noise_size = 0.5f;
601 pd->noise_depth = 1;
602 pd->noise_fac = 1.0f;
604 pd->coba = BKE_colorband_add(true);
605 pd->speed_scale = 1.0f;
606 pd->totpoints = 0;
607 pd->object = nullptr;
608 pd->psys = 0;
610 pd->falloff_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
611
615 &pd->falloff_curve->clipr,
619}
620
627
629{
630 PointDensity *pdn;
631
632 pdn = static_cast<PointDensity *>(MEM_dupallocN(pd));
633 pdn->point_tree = nullptr;
634 pdn->point_data = nullptr;
635 if (pdn->coba) {
636 pdn->coba = static_cast<ColorBand *>(MEM_dupallocN(pdn->coba));
637 }
638 pdn->falloff_curve = BKE_curvemapping_copy(pdn->falloff_curve); /* can be nullptr */
639 return pdn;
640}
641
643{
644 if (pd->point_tree) {
645 BLI_bvhtree_free(static_cast<BVHTree *>(pd->point_tree));
646 pd->point_tree = nullptr;
647 }
649 MEM_SAFE_FREE(pd->coba);
650
651 BKE_curvemapping_free(pd->falloff_curve); /* can be nullptr */
652}
653
659/* ------------------------------------------------------------------------- */
660
662{
663 switch (tex->type) {
664 case TEX_IMAGE: {
665 return true;
666 }
667 }
668
669 return false;
670}
671
673{
674 if (texture->ima && BKE_image_is_animated(texture->ima)) {
675 return true;
676 }
677 if (texture->adt) {
678 /* assume anything in adt means the texture is animated */
679 return true;
680 }
681 if (texture->type == TEX_NOISE) {
682 /* noise always varies with time */
683 return true;
684 }
685 return false;
686}
687
688/* ------------------------------------------------------------------------- */
689
691 const float *tex_co,
692 TexResult *texres,
693 ImagePool *pool,
694 bool use_color_management)
695{
696 /* no node textures for now */
697 const int result_type = multitex_ext_safe(
698 texture, tex_co, texres, pool, use_color_management, false);
699
700 /* if the texture gave an RGB value, we assume it didn't give a valid
701 * intensity, since this is in the context of modifiers don't use perceptual color conversion.
702 * if the texture didn't give an RGB value, copy the intensity across
703 */
704 if (result_type & TEX_RGB) {
705 texres->tin = (1.0f / 3.0f) * (texres->trgba[0] + texres->trgba[1] + texres->trgba[2]);
706 }
707 else {
708 copy_v3_fl(texres->trgba, texres->tin);
709 }
710}
711
713 const float *tex_co,
714 TexResult *texres,
715 bool use_color_management)
716{
717 BKE_texture_get_value_ex(texture, tex_co, texres, nullptr, use_color_management);
718}
719
721{
722 for (bNode *node : ntree->all_nodes()) {
723 if (node->type_legacy == SH_NODE_TEX_IMAGE && node->id != nullptr) {
724 Image *image = (Image *)node->id;
725 BKE_image_pool_acquire_ibuf(image, &texture->iuser, pool);
726 }
727 else if (node->is_group() && node->id != nullptr) {
728 /* TODO(sergey): Do we need to control recursion here? */
729 bNodeTree *nested_tree = (bNodeTree *)node->id;
731 }
732 }
733}
734
736{
737 if (texture->nodetree != nullptr) {
739 }
740 else {
741 if (texture->type == TEX_IMAGE) {
742 if (texture->ima != nullptr) {
743 BKE_image_pool_acquire_ibuf(texture->ima, &texture->iuser, pool);
744 }
745 }
746 }
747}
void BKE_brush_tag_unsaved_changes(Brush *brush)
Definition brush.cc:720
ColorBand * BKE_colorband_add(bool rangetype)
Definition colorband.cc:297
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:89
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:437
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
Definition BKE_idtype.hh:44
IDTypeInfo IDType_ID_TE
Definition texture.cc:191
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)
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)
Definition lib_id.cc:663
void id_us_plus(ID *id)
Definition lib_id.cc:353
@ LIB_ID_CREATE_NO_ALLOCATE
@ LIB_ID_COPY_NO_PREVIEW
@ LIB_ID_CREATE_LOCAL
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void * BKE_id_new(Main *bmain, short type, const char *name)
Definition lib_id.cc:1495
void id_us_min(ID *id)
Definition lib_id.cc:361
void BKE_id_blend_write(BlendWriter *writer, ID *id)
Definition lib_id.cc:2611
#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:172
@ IDWALK_CB_USER
@ IDWALK_CB_NOP
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
Definition lib_query.cc:129
@ 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)
#define BLI_assert(a)
Definition BLI_assert.h:46
void BLI_bvhtree_free(BVHTree *tree)
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 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 unit_m4(float m[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)
#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_TEXTURE
@ INDEX_ID_TE
Definition DNA_ID.h:1220
@ ID_LS
@ ID_PA
@ CUMA_EXTEND_EXTRAPOLATE
@ CURVE_PRESET_LINE
#define DNA_struct_default_get(struct_name)
#define TEXCO_STROKE
@ TEXCO_ORCO
@ MA_RAMP_BLEND
@ TEXMAP_TYPE_NORMAL
@ TEXMAP_TYPE_POINT
@ TEXMAP_TYPE_TEXTURE
@ TEXMAP_TYPE_VECTOR
@ TEX_PD_NOISE_STATIC
@ TEX_PD_PSYS
@ TEX_RGB
@ TEXMAP_UNIT_MATRIX
@ MTEX_FLAT
@ TEX_NOISE
@ TEX_IMAGE
@ TEX_PD_FALLOFF_STD
@ TEX_PD_WORLDSPACE
@ MTEX_MUL
Read Guarded memory(de)allocation.
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
#define MAX_MTEX
Definition Stroke.h:31
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
#define fabsf(x)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
#define FILTER_ID_OB
#define MEM_SAFE_FREE(v)
#define FILTER_ID_TE
#define FILTER_ID_IM
#define GS(a)
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_dupallocN(const void *vmemh)
Definition mallocn.cc:143
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
Definition node.cc:1464
bNodeTree * node_tree_localize(bNodeTree *ntree, std::optional< ID * > new_owner_id)
Definition node.cc:4858
void node_tree_free_embedded_tree(bNodeTree *ntree)
Definition node.cc:4724
struct MTex mtex
struct ColorBand coba
CurveMap cm[4]
struct MTex * mtex[18]
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
struct Scene * scene
short texco
short blendtype
struct Object * object
struct Tex * tex
struct MTex * mtex[18]
struct CurveMapping * falloff_curve
struct Object * object
struct ColorBand * coba
float mat[4][4]
float tin
Definition RE_texture.h:83
float trgba[4]
Definition RE_texture.h:84
struct PreviewImage * preview
Tex_Runtime runtime
struct ImageUser iuser
struct ColorBand * coba
struct bNodeTree * nodetree
struct Image * ima
bNodeTreeRuntimeHandle * runtime
i
Definition text_draw.cc:230
void BKE_texture_pointdensity_free(PointDensity *pd)
Definition texture.cc:654
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:374
void BKE_texture_type_set(Tex *tex, int type)
Definition texture.cc:367
void BKE_texture_mapping_default(TexMapping *texmap, int type)
Definition texture.cc:238
Tex * give_current_particle_texture(ParticleSettings *part)
Definition texture.cc:549
void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
Definition texture.cc:566
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
Definition texture.cc:136
static void texture_init_data(ID *id)
Definition texture.cc:59
void set_current_brush_texture(Brush *br, Tex *newtex)
Definition texture.cc:536
void BKE_texture_colormapping_default(ColorMapping *colormap)
Definition texture.cc:341
MTex * BKE_texture_mtex_add_id(ID *id, int slot)
Definition texture.cc:403
Tex * give_current_linestyle_texture(FreestyleLineStyle *linestyle)
Definition texture.cc:447
void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex)
Definition texture.cc:221
bool BKE_texture_dependsOnTime(const Tex *texture)
Definition texture.cc:672
PointDensity * BKE_texture_pointdensity_add()
Definition texture.cc:621
void BKE_texture_mapping_init(TexMapping *texmap)
Definition texture.cc:253
void set_active_mtex(ID *id, short act)
Definition texture.cc:510
void set_current_linestyle_texture(FreestyleLineStyle *linestyle, Tex *newtex)
Definition texture.cc:462
bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
Definition texture.cc:484
MTex * BKE_texture_mtex_add()
Definition texture.cc:392
void BKE_texture_pointdensity_init_data(PointDensity *pd)
Definition texture.cc:591
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition texture.cc:153
void BKE_texture_pointdensity_free_data(PointDensity *pd)
Definition texture.cc:642
void BKE_texture_mtex_default(MTex *mtex)
Definition texture.cc:385
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
Definition texture.cc:177
ColorMapping * BKE_texture_colormapping_add()
Definition texture.cc:332
void BKE_texture_get_value_ex(Tex *texture, const float *tex_co, TexResult *texres, ImagePool *pool, bool use_color_management)
Definition texture.cc:690
static void texture_free_data(ID *id)
Definition texture.cc:119
void BKE_texture_fetch_images_for_pool(Tex *texture, ImagePool *pool)
Definition texture.cc:735
void BKE_texture_default(Tex *tex)
Definition texture.cc:362
Tex * give_current_brush_texture(Brush *br)
Definition texture.cc:531
static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, ImagePool *pool)
Definition texture.cc:720
PointDensity * BKE_texture_pointdensity_copy(const PointDensity *pd, const int)
Definition texture.cc:628
bool BKE_texture_is_image_user(const Tex *tex)
Definition texture.cc:661
void BKE_texture_get_value(Tex *texture, const float *tex_co, TexResult *texres, bool use_color_management)
Definition texture.cc:712
TexMapping * BKE_texture_mapping_add(int type)
Definition texture.cc:229
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:139