Blender V5.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
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.hh"
19#include "BLI_math_matrix_c.hh"
21#include "BLI_math_vector_c.hh"
22#include "BLI_utildefines.hh"
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_linestyle_types.h"
33#include "DNA_material_types.h"
34#include "DNA_node_types.h"
35#include "DNA_particle_types.h"
36#include "DNA_texture_types.h"
37
38#include "BKE_brush.hh"
39#include "BKE_colorband.hh"
40#include "BKE_colortools.hh"
41#include "BKE_icons.hh"
42#include "BKE_idtype.hh"
43#include "BKE_image.hh"
44#include "BKE_lib_id.hh"
45#include "BKE_lib_query.hh"
46#include "BKE_node_runtime.hh"
47#include "BKE_preview_image.hh"
48#include "BKE_texture.h"
49
50#include "NOD_texture.h"
51
52#include "RE_texture.h"
53
54#include "DRW_engine.hh"
55
56#include "BLO_read_write.hh"
57
58namespace blender {
59
60static void texture_init_data(ID *id)
61{
62 Tex *texture = id_cast<Tex *>(id);
64
66}
67
68static void texture_copy_data(Main *bmain,
69 std::optional<Library *> owner_library,
70 ID *id_dst,
71 const ID *id_src,
72 const int flag)
73{
74 Tex *texture_dst = id_cast<Tex *>(id_dst);
75 const Tex *texture_src = id_cast<const Tex *>(id_src);
76
77 const bool is_localized = (flag & LIB_ID_CREATE_LOCAL) != 0;
78 /* Never handle user-count here for own sub-data. */
79 const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
80 /* Always need allocation of the embedded ID data. */
81 const int flag_embedded_id_data = flag_subdata & ~LIB_ID_CREATE_NO_ALLOCATE;
82
83 if (!BKE_texture_is_image_user(texture_src)) {
84 texture_dst->ima = nullptr;
85 }
86
87 if (texture_dst->coba) {
88 texture_dst->coba = MEM_dupalloc(texture_dst->coba);
89 }
90 if (texture_src->nodetree) {
91 if (texture_src->nodetree->runtime->execdata) {
93 }
94
95 if (is_localized) {
96 texture_dst->nodetree = bke::node_tree_localize(texture_src->nodetree, &texture_dst->id);
97 }
98 else {
100 owner_library,
101 &texture_src->nodetree->id,
102 &texture_dst->id,
103 reinterpret_cast<ID **>(&texture_dst->nodetree),
104 flag_embedded_id_data);
105 }
106 }
107
108 if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
109 BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id);
110 }
111 else {
112 texture_dst->preview = nullptr;
113 }
114}
115
116static void texture_free_data(ID *id)
117{
118 Tex *texture = id_cast<Tex *>(id);
119
120 /* is no lib link block, but texture extension */
121 if (texture->nodetree) {
123 MEM_delete(texture->nodetree);
124 texture->nodetree = nullptr;
125 }
126
127 MEM_SAFE_DELETE(texture->coba);
128
129 BKE_icon_id_delete(id_cast<ID *>(texture));
131}
132
134{
135 Tex *texture = reinterpret_cast<Tex *>(id);
136
137 if (texture->nodetree) {
138 /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
141 }
143}
144
145static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
146{
147 Tex *tex = id_cast<Tex *>(id);
148
149 /* write LibData */
150 writer->write_id_struct(id_address, tex, [](BlendStructWriter<Tex> &struct_writer) {
151 struct_writer.shallow_data.runtime = {};
152 });
153 BKE_id_blend_write(writer, &tex->id);
154
155 /* direct data */
156 if (tex->coba) {
157 writer->write_struct(tex->coba);
158 }
159
160 /* nodetree is integral part of texture, no libdata */
161 if (tex->nodetree) {
162 BLO_Write_IDBuffer temp_embedded_id_buffer{tex->nodetree->id, writer};
163 bNodeTree *temp_ntree = reinterpret_cast<bNodeTree *>(temp_embedded_id_buffer.get());
164 writer->write_embedded_id_struct(tex->nodetree, temp_ntree);
165 bke::node_tree_blend_write(writer, temp_ntree);
166 }
167
169}
170
172{
173 Tex *tex = id_cast<Tex *>(id);
174
175 BLO_read_struct(reader, ColorBand, &tex->coba);
176
177 BLO_read_struct(reader, PreviewImage, &tex->preview);
179
180 tex->iuser.scene = nullptr;
181
182 tex->runtime.last_update = 0;
183}
184
186 .id_code = Tex::id_type,
187 .id_filter = FILTER_ID_TE,
188 .dependencies_id_types = FILTER_ID_IM | FILTER_ID_OB,
189 .main_listbase_index = INDEX_ID_TE,
190 .struct_size = sizeof(Tex),
191 .name = "Texture",
192 .name_plural = N_("textures"),
193 .translation_context = BLT_I18NCONTEXT_ID_TEXTURE,
195 .asset_type_info = nullptr,
196
197 .init_data = texture_init_data,
198 .copy_data = texture_copy_data,
199 .free_data = texture_free_data,
200 .make_local = nullptr,
201 .foreach_id = texture_foreach_id,
202 .foreach_cache = nullptr,
203 .foreach_path = nullptr,
204 .foreach_working_space_color = nullptr,
205 .foreach_asset_weak_reference = nullptr,
206 .owner_pointer_get = nullptr,
207
208 .blend_write = texture_blend_write,
209 .blend_read_data = texture_blend_read_data,
210 .blend_read_after_liblink = nullptr,
211
212 .blend_read_undo_preserve = nullptr,
213
214 .lib_override_apply_post = nullptr,
215};
216
222
223/* ****************** Mapping ******************* */
224
226{
227 TexMapping *texmap = MEM_new<TexMapping>("TexMapping");
228
229 BKE_texture_mapping_default(texmap, type);
230
231 return texmap;
232}
233
235{
236 *texmap = TexMapping{};
237
238 texmap->size[0] = texmap->size[1] = texmap->size[2] = 1.0f;
239 texmap->max[0] = texmap->max[1] = texmap->max[2] = 1.0f;
240 unit_m4(texmap->mat);
241
242 texmap->projx = PROJ_X;
243 texmap->projy = PROJ_Y;
244 texmap->projz = PROJ_Z;
245 texmap->mapping = MTEX_FLAT;
246 texmap->type = eTexMapping_Type(type);
247}
248
250{
251 float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
252
253 if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
254 is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size))
255 {
256 unit_m4(texmap->mat);
257
258 texmap->flag |= TEXMAP_UNIT_MATRIX;
259 }
260 else {
261 /* axis projection */
262 zero_m4(proj);
263 proj[3][3] = 1.0f;
264
265 if (texmap->projx != PROJ_N) {
266 proj[texmap->projx - 1][0] = 1.0f;
267 }
268 if (texmap->projy != PROJ_N) {
269 proj[texmap->projy - 1][1] = 1.0f;
270 }
271 if (texmap->projz != PROJ_N) {
272 proj[texmap->projz - 1][2] = 1.0f;
273 }
274
275 /* scale */
276 copy_v3_v3(size, texmap->size);
277
279 /* keep matrix invertible */
280 if (fabsf(size[0]) < 1e-5f) {
281 size[0] = signf(size[0]) * 1e-5f;
282 }
283 if (fabsf(size[1]) < 1e-5f) {
284 size[1] = signf(size[1]) * 1e-5f;
285 }
286 if (fabsf(size[2]) < 1e-5f) {
287 size[2] = signf(size[2]) * 1e-5f;
288 }
289 }
290
291 size_to_mat4(smat, texmap->size);
292
293 /* rotation */
294 eul_to_mat4(rmat, texmap->rot);
295
296 /* translation */
297 unit_m4(tmat);
298 copy_v3_v3(tmat[3], texmap->loc);
299
300 if (texmap->type == TEXMAP_TYPE_TEXTURE) {
301 /* to transform a texture, the inverse transform needs
302 * to be applied to the texture coordinate */
303 mul_m4_series(texmap->mat, tmat, rmat, smat);
304 invert_m4(texmap->mat);
305 }
306 else if (texmap->type == TEXMAP_TYPE_POINT) {
307 /* forward transform */
308 mul_m4_series(texmap->mat, tmat, rmat, smat);
309 }
310 else if (texmap->type == TEXMAP_TYPE_VECTOR) {
311 /* no translation for vectors */
312 mul_m4_m4m4(texmap->mat, rmat, smat);
313 }
314 else if (texmap->type == TEXMAP_TYPE_NORMAL) {
315 /* no translation for normals, and inverse transpose */
316 mul_m4_m4m4(texmap->mat, rmat, smat);
317 invert_m4(texmap->mat);
318 transpose_m4(texmap->mat);
319 }
320
321 /* projection last */
322 mul_m4_m4m4(texmap->mat, texmap->mat, proj);
323
324 texmap->flag &= ~TEXMAP_UNIT_MATRIX;
325 }
326}
327
329{
330 ColorMapping *colormap = MEM_new<ColorMapping>("ColorMapping");
331
333
334 return colormap;
335}
336
338{
339 *colormap = ColorMapping{};
340
341 BKE_colorband_init(&colormap->coba, true);
342
343 colormap->bright = 1.0;
344 colormap->contrast = 1.0;
345 colormap->saturation = 1.0;
346
347 colormap->blend_color[0] = 0.8f;
348 colormap->blend_color[1] = 0.8f;
349 colormap->blend_color[2] = 0.8f;
350 colormap->blend_type = MA_RAMP_BLEND;
351 colormap->blend_factor = 0.0f;
352}
353
354/* ******************* TEX ************************ */
355
356/* ------------------------------------------------------------------------- */
357
359{
360 texture_init_data(&tex->id);
361}
362
364{
365 tex->type = type;
366}
367
368/* ------------------------------------------------------------------------- */
369
370Tex *BKE_texture_add(Main *bmain, const char *name)
371{
372 Tex *tex;
373
374 tex = BKE_id_new<Tex>(bmain, name);
375
376 return tex;
377}
378
379/* ------------------------------------------------------------------------- */
380
382{
383 *mtex = dna::shallow_copy(MTex());
384}
385
386/* ------------------------------------------------------------------------- */
387
389{
390 MTex *mtex;
391
392 mtex = MEM_new<MTex>("BKE_texture_mtex_add");
393
395
396 return mtex;
397}
398
400{
401 MTex **mtex_ar;
402 short act;
403
404 give_active_mtex(id, &mtex_ar, &act);
405
406 if (mtex_ar == nullptr) {
407 return nullptr;
408 }
409
410 if (slot == -1) {
411 /* find first free */
412 int i;
413 for (i = 0; i < MAX_MTEX; i++) {
414 if (!mtex_ar[i]) {
415 slot = i;
416 break;
417 }
418 }
419 if (slot == -1) {
420 return nullptr;
421 }
422 }
423 else {
424 /* make sure slot is valid */
425 if (slot < 0 || slot >= MAX_MTEX) {
426 return nullptr;
427 }
428 }
429
430 if (mtex_ar[slot]) {
431 id_us_min(id_cast<ID *>(mtex_ar[slot]->tex));
432 MEM_delete(mtex_ar[slot]);
433 mtex_ar[slot] = nullptr;
434 }
435
436 mtex_ar[slot] = BKE_texture_mtex_add();
437
438 return mtex_ar[slot];
439}
440
441/* ------------------------------------------------------------------------- */
442
444{
445 MTex *mtex = nullptr;
446 Tex *tex = nullptr;
447
448 if (linestyle) {
449 mtex = linestyle->mtex[int(linestyle->texact)];
450 if (mtex) {
451 tex = mtex->tex;
452 }
453 }
454
455 return tex;
456}
457
459{
460 int act = linestyle->texact;
461
462 if (linestyle->mtex[act] && linestyle->mtex[act]->tex) {
463 id_us_min(&linestyle->mtex[act]->tex->id);
464 }
465
466 if (newtex) {
467 if (!linestyle->mtex[act]) {
468 linestyle->mtex[act] = BKE_texture_mtex_add();
469 linestyle->mtex[act]->texco = TEXCO_STROKE;
470 }
471
472 linestyle->mtex[act]->tex = newtex;
473 id_us_plus(&newtex->id);
474 }
475 else {
476 MEM_SAFE_DELETE(linestyle->mtex[act]);
477 }
478}
479
480bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
481{
482 switch (GS(id->name)) {
483 case ID_LS:
484 *mtex_ar = (id_cast<FreestyleLineStyle *>(id))->mtex;
485 if (act) {
486 *act = ((id_cast<FreestyleLineStyle *>(id))->texact);
487 }
488 break;
489 case ID_PA:
490 *mtex_ar = (id_cast<ParticleSettings *>(id))->mtex;
491 if (act) {
492 *act = ((id_cast<ParticleSettings *>(id))->texact);
493 }
494 break;
495 default:
496 *mtex_ar = nullptr;
497 if (act) {
498 *act = 0;
499 }
500 return false;
501 }
502
503 return true;
504}
505
506void set_active_mtex(ID *id, short act)
507{
508 if (act < 0) {
509 act = 0;
510 }
511 else if (act >= MAX_MTEX) {
512 act = MAX_MTEX - 1;
513 }
514
515 switch (GS(id->name)) {
516 case ID_LS:
517 (id_cast<FreestyleLineStyle *>(id))->texact = act;
518 break;
519 case ID_PA:
520 (id_cast<ParticleSettings *>(id))->texact = act;
521 break;
522 default:
523 break;
524 }
525}
526
528{
529 return br->mtex.tex;
530}
531
533{
534 if (br->mtex.tex) {
535 id_us_min(&br->mtex.tex->id);
536 }
537
538 if (newtex) {
539 br->mtex.tex = newtex;
540 id_us_plus(&newtex->id);
541 }
543}
544
546{
547 MTex *mtex = nullptr;
548 Tex *tex = nullptr;
549
550 if (!part) {
551 return nullptr;
552 }
553
554 mtex = part->mtex[int(part->texact)];
555 if (mtex) {
556 tex = mtex->tex;
557 }
558
559 return tex;
560}
561
563{
564 int act = part->texact;
565
566 if (part->mtex[act] && part->mtex[act]->tex) {
567 id_us_min(&part->mtex[act]->tex->id);
568 }
569
570 if (newtex) {
571 if (!part->mtex[act]) {
572 part->mtex[act] = BKE_texture_mtex_add();
573 part->mtex[act]->texco = TEXCO_ORCO;
574 part->mtex[act]->blendtype = MTEX_MUL;
575 }
576
577 part->mtex[act]->tex = newtex;
578 id_us_plus(&newtex->id);
579 }
580 else {
581 MEM_SAFE_DELETE(part->mtex[act]);
582 }
583}
584
585/* ------------------------------------------------------------------------- */
586
588{
589 switch (tex->type) {
590 case TEX_IMAGE: {
591 return true;
592 }
593 default:
594 break;
595 }
596
597 return false;
598}
599
601{
602 if (texture->ima && BKE_image_is_animated(texture->ima)) {
603 return true;
604 }
605 if (texture->adt) {
606 /* assume anything in adt means the texture is animated */
607 return true;
608 }
609 if (texture->type == TEX_NOISE) {
610 /* noise always varies with time */
611 return true;
612 }
613 return false;
614}
615
616/* ------------------------------------------------------------------------- */
617
619 const float *tex_co,
620 TexResult *texres,
621 ImagePool *pool,
622 bool use_color_management)
623{
624 /* no node textures for now */
625 const int result_type = multitex_ext_safe(
626 texture, tex_co, texres, pool, use_color_management, false);
627
628 /* if the texture gave an RGB value, we assume it didn't give a valid
629 * intensity, since this is in the context of modifiers don't use perceptual color conversion.
630 * if the texture didn't give an RGB value, copy the intensity across
631 */
632 if (result_type & TEX_RGB) {
633 texres->tin = (1.0f / 3.0f) * (texres->trgba[0] + texres->trgba[1] + texres->trgba[2]);
634 }
635 else {
636 copy_v3_fl(texres->trgba, texres->tin);
637 }
638}
639
641 const float *tex_co,
642 TexResult *texres,
643 bool use_color_management)
644{
645 BKE_texture_get_value_ex(texture, tex_co, texres, nullptr, use_color_management);
646}
647
649{
650 for (bNode *node : ntree->all_nodes()) {
651 if (node->type_legacy == SH_NODE_TEX_IMAGE && node->id != nullptr) {
652 Image *image = id_cast<Image *>(node->id);
654 }
655 else if (node->is_group() && node->id != nullptr) {
656 /* TODO(sergey): Do we need to control recursion here? */
657 bNodeTree *nested_tree = id_cast<bNodeTree *>(node->id);
659 }
660 }
661}
662
664{
665 if (texture->nodetree != nullptr) {
667 }
668 else {
669 if (texture->type == TEX_IMAGE) {
670 if (texture->ima != nullptr) {
671 BKE_image_pool_acquire_ibuf(texture->ima, &texture->iuser, pool);
672 }
673 }
674 }
675}
676
677} // namespace blender
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
#define SH_NODE_TEX_IMAGE
#define mul_m4_series(...)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_TEXTURE
#define FILTER_ID_OB
Definition DNA_ID.h:1216
#define FILTER_ID_TE
Definition DNA_ID.h:1222
#define FILTER_ID_IM
Definition DNA_ID.h:1206
#define TEXCO_STROKE
Read Blender memory allocation and freeing.
#define MAX_MTEX
Definition Stroke.h:31
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
#define ELEM(...)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
Definition node.cc:1361
bNodeTree * node_tree_localize(bNodeTree *ntree, std::optional< ID * > new_owner_id)
Definition node.cc:5355
void node_tree_free_embedded_tree(bNodeTree *ntree)
Definition node.cc:5231
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
Definition DNA_defs.h:147
BMesh Iterators.
void BKE_icon_id_delete(ID *id)
Definition icons.cc:524
bool BKE_image_is_animated(Image *image)
void BKE_previewimg_id_free(ID *id)
void BKE_colorband_init(ColorBand *coba, bool rangetype)
Definition colorband.cc:25
struct Tex * give_current_particle_texture(struct ParticleSettings *part)
Definition texture.cc:545
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv)
struct MTex * BKE_texture_mtex_add()
Definition texture.cc:388
void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex)
Definition texture.cc:562
void id_us_plus(ID *id)
Definition lib_id.cc:433
void BKE_previewimg_blend_write(BlendWriter *writer, const PreviewImage *prv)
static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, ImagePool *pool)
Definition texture.cc:648
struct TexMapping * BKE_texture_mapping_add(int type)
Definition texture.cc:225
bool BKE_texture_is_image_user(const struct Tex *tex)
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:68
void BKE_texture_get_value_ex(struct Tex *texture, const float *tex_co, struct TexResult *texres, struct ImagePool *pool, bool use_color_management)
Definition texture.cc:618
struct MTex * BKE_texture_mtex_add_id(struct ID *id, int slot)
Definition texture.cc:399
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
bool invert_m4(float mat[4][4])
void BKE_texture_mapping_init(struct TexMapping *texmap)
Definition texture.cc:249
void BKE_texture_fetch_images_for_pool(struct Tex *texture, struct ImagePool *pool)
Definition texture.cc:663
void BKE_id_blend_write(BlendWriter *writer, ID *id)
Definition lib_id.cc:2890
static void texture_free_data(ID *id)
Definition texture.cc:116
void set_current_brush_texture(struct Brush *br, struct Tex *tex)
Definition texture.cc:532
@ LIB_ID_CREATE_NO_USER_REFCOUNT
@ LIB_ID_COPY_NO_PREVIEW
@ LIB_ID_CREATE_LOCAL
@ LIB_ID_CREATE_NO_ALLOCATE
void BKE_brush_tag_unsaved_changes(Brush *brush)
Definition brush.cc:843
void size_to_mat4(float R[4][4], const float size[3])
IDTypeInfo IDType_ID_TE
Definition texture.cc:185
bool give_active_mtex(struct ID *id, struct MTex ***mtex_ar, short *act)
Definition texture.cc:480
BMesh const char void * data
MINLINE float signf(float f)
struct Tex * give_current_linestyle_texture(struct FreestyleLineStyle *linestyle)
Definition texture.cc:443
void BKE_library_foreach_ID_embedded(LibraryForeachIDData *data, ID **id_pp)
Definition lib_query.cc:176
void BKE_texture_mtex_default(struct MTex *mtex)
Definition texture.cc:381
void BKE_texture_default(struct Tex *tex)
Definition texture.cc:358
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
void unit_m4(float m[4][4])
MINLINE bool is_one_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
struct ColorMapping * BKE_texture_colormapping_add()
Definition texture.cc:328
void set_current_linestyle_texture(struct FreestyleLineStyle *linestyle, struct Tex *tex)
Definition texture.cc:458
struct Tex * give_current_brush_texture(struct Brush *br)
Definition texture.cc:527
void BKE_texture_mapping_default(struct TexMapping *texmap, int type)
Definition texture.cc:234
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
Definition texture.cc:171
void BKE_texture_type_set(struct Tex *tex, eTex_Type type)
Definition texture.cc:363
void BKE_texture_get_value(struct Tex *texture, const float *tex_co, struct TexResult *texres, bool use_color_management)
Definition texture.cc:640
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
Definition texture.cc:133
static void texture_init_data(ID *id)
Definition texture.cc:60
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
void eul_to_mat4(float mat[4][4], const float eul[3])
void transpose_m4(float R[4][4])
MINLINE void copy_v3_fl(float r[3], float f)
@ INDEX_ID_TE
Definition DNA_ID.h:1313
void set_active_mtex(struct ID *id, short act)
Definition texture.cc:506
int multitex_ext_safe(Tex *tex, const float texvec[3], TexResult *texres, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)
ID_Type GS(const char *name)
Definition DNA_ID.h:410
void BKE_texture_mtex_foreach_id(struct LibraryForeachIDData *data, struct MTex *mtex)
Definition texture.cc:217
struct Tex * BKE_texture_add(struct Main *bmain, const char *name)
Definition texture.cc:370
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition texture.cc:145
void zero_m4(float m[4][4])
void BKE_texture_colormapping_default(struct ColorMapping *colormap)
Definition texture.cc:337
bool BKE_texture_dependsOnTime(const struct Tex *texture)
ImBuf * BKE_image_pool_acquire_ibuf(Image *ima, ImageUser *iuser, ImagePool *pool)
void BKE_imageuser_default(ImageUser *iuser)
void id_us_min(ID *id)
Definition lib_id.cc:441
void * BKE_id_new(Main *bmain, short type, const char *name)
Definition lib_id.cc:1612
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
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:749
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
Definition BKE_idtype.hh:50
#define fabsf
void write_embedded_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
struct Scene * scene
eMTex_BlendType blendtype
struct Object * object
eTexMapping_Type type
eTexMapping_Flag flag
Tex_Runtime runtime
struct PreviewImage * preview
struct ColorBand * coba
struct ImageUser iuser
struct Image * ima
struct bNodeTree * nodetree
bke::bNodeTreeRuntime * runtime
#define N_(msgid)