Blender  V2.93
texture.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 
29 #include "MEM_guardedalloc.h"
30 
31 #include "BLI_kdopbvh.h"
32 #include "BLI_listbase.h"
33 #include "BLI_math.h"
34 #include "BLI_math_color.h"
35 #include "BLI_utildefines.h"
36 
37 #include "BLT_translation.h"
38 
39 /* Allow using deprecated functionality for .blend file I/O. */
40 #define DNA_DEPRECATED_ALLOW
41 
42 #include "DNA_brush_types.h"
43 #include "DNA_color_types.h"
44 #include "DNA_defaults.h"
45 #include "DNA_key_types.h"
46 #include "DNA_linestyle_types.h"
47 #include "DNA_material_types.h"
48 #include "DNA_node_types.h"
49 #include "DNA_object_types.h"
50 #include "DNA_particle_types.h"
51 
52 #include "IMB_imbuf.h"
53 
54 #include "BKE_main.h"
55 
56 #include "BKE_anim_data.h"
57 #include "BKE_colorband.h"
58 #include "BKE_colortools.h"
59 #include "BKE_icons.h"
60 #include "BKE_idtype.h"
61 #include "BKE_image.h"
62 #include "BKE_key.h"
63 #include "BKE_lib_id.h"
64 #include "BKE_lib_query.h"
65 #include "BKE_material.h"
66 #include "BKE_node.h"
67 #include "BKE_scene.h"
68 #include "BKE_texture.h"
69 
70 #include "RE_texture.h"
71 
72 #include "BLO_read_write.h"
73 
74 static void texture_init_data(ID *id)
75 {
76  Tex *texture = (Tex *)id;
77 
79 
81 
83 }
84 
85 static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
86 {
87  Tex *texture_dst = (Tex *)id_dst;
88  const Tex *texture_src = (const Tex *)id_src;
89 
90  const bool is_localized = (flag & LIB_ID_CREATE_LOCAL) != 0;
91  /* We always need allocation of our private ID data. */
92  const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE;
93 
94  if (!BKE_texture_is_image_user(texture_src)) {
95  texture_dst->ima = NULL;
96  }
97 
98  if (texture_dst->coba) {
99  texture_dst->coba = MEM_dupallocN(texture_dst->coba);
100  }
101  if (texture_src->nodetree) {
102  if (texture_src->nodetree->execdata) {
103  ntreeTexEndExecTree(texture_src->nodetree->execdata);
104  }
105 
106  if (is_localized) {
107  texture_dst->nodetree = ntreeLocalize(texture_src->nodetree);
108  }
109  else {
111  bmain, (ID *)texture_src->nodetree, (ID **)&texture_dst->nodetree, flag_private_id_data);
112  }
113  }
114 
115  if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
116  BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id);
117  }
118  else {
119  texture_dst->preview = NULL;
120  }
121 }
122 
123 static void texture_free_data(ID *id)
124 {
125  Tex *texture = (Tex *)id;
126 
127  /* is no lib link block, but texture extension */
128  if (texture->nodetree) {
129  ntreeFreeEmbeddedTree(texture->nodetree);
130  MEM_freeN(texture->nodetree);
131  texture->nodetree = NULL;
132  }
133 
134  MEM_SAFE_FREE(texture->coba);
135 
137  BKE_previewimg_free(&texture->preview);
138 }
139 
141 {
142  Tex *texture = (Tex *)id;
143  if (texture->nodetree) {
144  /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
146  }
148 }
149 
150 static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
151 {
152  Tex *tex = (Tex *)id;
153  if (tex->id.us > 0 || BLO_write_is_undo(writer)) {
154  /* write LibData */
155  BLO_write_id_struct(writer, Tex, id_address, &tex->id);
156  BKE_id_blend_write(writer, &tex->id);
157 
158  if (tex->adt) {
159  BKE_animdata_blend_write(writer, tex->adt);
160  }
161 
162  /* direct data */
163  if (tex->coba) {
164  BLO_write_struct(writer, ColorBand, tex->coba);
165  }
166 
167  /* nodetree is integral part of texture, no libdata */
168  if (tex->nodetree) {
170  ntreeBlendWrite(writer, tex->nodetree);
171  }
172 
174  }
175 }
176 
177 static void texture_blend_read_data(BlendDataReader *reader, ID *id)
178 {
179  Tex *tex = (Tex *)id;
180  BLO_read_data_address(reader, &tex->adt);
182 
183  BLO_read_data_address(reader, &tex->coba);
184 
185  BLO_read_data_address(reader, &tex->preview);
187 
188  tex->iuser.ok = 1;
189  tex->iuser.scene = NULL;
190 }
191 
192 static void texture_blend_read_lib(BlendLibReader *reader, ID *id)
193 {
194  Tex *tex = (Tex *)id;
195  BLO_read_id_address(reader, tex->id.lib, &tex->ima);
196  BLO_read_id_address(reader, tex->id.lib, &tex->ipo); /* XXX deprecated - old animation system */
197 }
198 
199 static void texture_blend_read_expand(BlendExpander *expander, ID *id)
200 {
201  Tex *tex = (Tex *)id;
202  BLO_expand(expander, tex->ima);
203  BLO_expand(expander, tex->ipo); /* XXX deprecated - old animation system */
204 }
205 
207  .id_code = ID_TE,
208  .id_filter = FILTER_ID_TE,
209  .main_listbase_index = INDEX_ID_TE,
210  .struct_size = sizeof(Tex),
211  .name = "Texture",
212  .name_plural = "textures",
213  .translation_context = BLT_I18NCONTEXT_ID_TEXTURE,
214  .flags = 0,
215 
217  .copy_data = texture_copy_data,
218  .free_data = texture_free_data,
219  .make_local = NULL,
220  .foreach_id = texture_foreach_id,
221  .foreach_cache = NULL,
222  .owner_get = NULL,
223 
224  .blend_write = texture_blend_write,
225  .blend_read_data = texture_blend_read_data,
226  .blend_read_lib = texture_blend_read_lib,
227  .blend_read_expand = texture_blend_read_expand,
228 
229  .blend_read_undo_preserve = NULL,
230 
231  .lib_override_apply_post = NULL,
232 };
233 
234 /* Utils for all IDs using those texture slots. */
236 {
239 }
240 
241 /* ****************** Mapping ******************* */
242 
244 {
245  TexMapping *texmap = MEM_callocN(sizeof(TexMapping), "TexMapping");
246 
248 
249  return texmap;
250 }
251 
253 {
254  memset(texmap, 0, sizeof(TexMapping));
255 
256  texmap->size[0] = texmap->size[1] = texmap->size[2] = 1.0f;
257  texmap->max[0] = texmap->max[1] = texmap->max[2] = 1.0f;
258  unit_m4(texmap->mat);
259 
260  texmap->projx = PROJ_X;
261  texmap->projy = PROJ_Y;
262  texmap->projz = PROJ_Z;
263  texmap->mapping = MTEX_FLAT;
264  texmap->type = type;
265 }
266 
268 {
269  float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
270 
271  if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
272  is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) {
273  unit_m4(texmap->mat);
274 
275  texmap->flag |= TEXMAP_UNIT_MATRIX;
276  }
277  else {
278  /* axis projection */
279  zero_m4(proj);
280  proj[3][3] = 1.0f;
281 
282  if (texmap->projx != PROJ_N) {
283  proj[texmap->projx - 1][0] = 1.0f;
284  }
285  if (texmap->projy != PROJ_N) {
286  proj[texmap->projy - 1][1] = 1.0f;
287  }
288  if (texmap->projz != PROJ_N) {
289  proj[texmap->projz - 1][2] = 1.0f;
290  }
291 
292  /* scale */
293  copy_v3_v3(size, texmap->size);
294 
296  /* keep matrix invertible */
297  if (fabsf(size[0]) < 1e-5f) {
298  size[0] = signf(size[0]) * 1e-5f;
299  }
300  if (fabsf(size[1]) < 1e-5f) {
301  size[1] = signf(size[1]) * 1e-5f;
302  }
303  if (fabsf(size[2]) < 1e-5f) {
304  size[2] = signf(size[2]) * 1e-5f;
305  }
306  }
307 
308  size_to_mat4(smat, texmap->size);
309 
310  /* rotation */
311  eul_to_mat4(rmat, texmap->rot);
312 
313  /* translation */
314  unit_m4(tmat);
315  copy_v3_v3(tmat[3], texmap->loc);
316 
317  if (texmap->type == TEXMAP_TYPE_TEXTURE) {
318  /* to transform a texture, the inverse transform needs
319  * to be applied to the texture coordinate */
320  mul_m4_series(texmap->mat, tmat, rmat, smat);
321  invert_m4(texmap->mat);
322  }
323  else if (texmap->type == TEXMAP_TYPE_POINT) {
324  /* forward transform */
325  mul_m4_series(texmap->mat, tmat, rmat, smat);
326  }
327  else if (texmap->type == TEXMAP_TYPE_VECTOR) {
328  /* no translation for vectors */
329  mul_m4_m4m4(texmap->mat, rmat, smat);
330  }
331  else if (texmap->type == TEXMAP_TYPE_NORMAL) {
332  /* no translation for normals, and inverse transpose */
333  mul_m4_m4m4(texmap->mat, rmat, smat);
334  invert_m4(texmap->mat);
335  transpose_m4(texmap->mat);
336  }
337 
338  /* projection last */
339  mul_m4_m4m4(texmap->mat, texmap->mat, proj);
340 
341  texmap->flag &= ~TEXMAP_UNIT_MATRIX;
342  }
343 }
344 
346 {
347  ColorMapping *colormap = MEM_callocN(sizeof(ColorMapping), "ColorMapping");
348 
350 
351  return colormap;
352 }
353 
355 {
356  memset(colormap, 0, sizeof(ColorMapping));
357 
358  BKE_colorband_init(&colormap->coba, true);
359 
360  colormap->bright = 1.0;
361  colormap->contrast = 1.0;
362  colormap->saturation = 1.0;
363 
364  colormap->blend_color[0] = 0.8f;
365  colormap->blend_color[1] = 0.8f;
366  colormap->blend_color[2] = 0.8f;
367  colormap->blend_type = MA_RAMP_BLEND;
368  colormap->blend_factor = 0.0f;
369 }
370 
371 /* ******************* TEX ************************ */
372 
373 /* ------------------------------------------------------------------------- */
374 
376 {
378 }
379 
381 {
382  tex->type = type;
383 }
384 
385 /* ------------------------------------------------------------------------- */
386 
387 Tex *BKE_texture_add(Main *bmain, const char *name)
388 {
389  Tex *tex;
390 
391  tex = BKE_id_new(bmain, ID_TE, name);
392 
393  return tex;
394 }
395 
396 /* ------------------------------------------------------------------------- */
397 
399 {
400  memcpy(mtex, DNA_struct_default_get(MTex), sizeof(*mtex));
401 }
402 
403 /* ------------------------------------------------------------------------- */
404 
406 {
407  MTex *mtex;
408 
409  mtex = MEM_callocN(sizeof(MTex), "BKE_texture_mtex_add");
410 
412 
413  return mtex;
414 }
415 
416 /* slot -1 for first free ID */
418 {
419  MTex **mtex_ar;
420  short act;
421 
422  give_active_mtex(id, &mtex_ar, &act);
423 
424  if (mtex_ar == NULL) {
425  return NULL;
426  }
427 
428  if (slot == -1) {
429  /* find first free */
430  int i;
431  for (i = 0; i < MAX_MTEX; i++) {
432  if (!mtex_ar[i]) {
433  slot = i;
434  break;
435  }
436  }
437  if (slot == -1) {
438  return NULL;
439  }
440  }
441  else {
442  /* make sure slot is valid */
443  if (slot < 0 || slot >= MAX_MTEX) {
444  return NULL;
445  }
446  }
447 
448  if (mtex_ar[slot]) {
449  id_us_min((ID *)mtex_ar[slot]->tex);
450  MEM_freeN(mtex_ar[slot]);
451  mtex_ar[slot] = NULL;
452  }
453 
454  mtex_ar[slot] = BKE_texture_mtex_add();
455 
456  return mtex_ar[slot];
457 }
458 
459 /* ------------------------------------------------------------------------- */
460 
462 {
463  MTex *mtex = NULL;
464  Tex *tex = NULL;
465 
466  if (linestyle) {
467  mtex = linestyle->mtex[(int)(linestyle->texact)];
468  if (mtex) {
469  tex = mtex->tex;
470  }
471  }
472 
473  return tex;
474 }
475 
477 {
478  int act = linestyle->texact;
479 
480  if (linestyle->mtex[act] && linestyle->mtex[act]->tex) {
481  id_us_min(&linestyle->mtex[act]->tex->id);
482  }
483 
484  if (newtex) {
485  if (!linestyle->mtex[act]) {
487  linestyle->mtex[act]->texco = TEXCO_STROKE;
488  }
489 
490  linestyle->mtex[act]->tex = newtex;
491  id_us_plus(&newtex->id);
492  }
493  else if (linestyle->mtex[act]) {
494  MEM_freeN(linestyle->mtex[act]);
495  linestyle->mtex[act] = NULL;
496  }
497 }
498 
499 bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
500 {
501  switch (GS(id->name)) {
502  case ID_LS:
503  *mtex_ar = ((FreestyleLineStyle *)id)->mtex;
504  if (act) {
505  *act = (((FreestyleLineStyle *)id)->texact);
506  }
507  break;
508  case ID_PA:
509  *mtex_ar = ((ParticleSettings *)id)->mtex;
510  if (act) {
511  *act = (((ParticleSettings *)id)->texact);
512  }
513  break;
514  default:
515  *mtex_ar = NULL;
516  if (act) {
517  *act = 0;
518  }
519  return false;
520  }
521 
522  return true;
523 }
524 
525 void set_active_mtex(ID *id, short act)
526 {
527  if (act < 0) {
528  act = 0;
529  }
530  else if (act >= MAX_MTEX) {
531  act = MAX_MTEX - 1;
532  }
533 
534  switch (GS(id->name)) {
535  case ID_LS:
536  ((FreestyleLineStyle *)id)->texact = act;
537  break;
538  case ID_PA:
539  ((ParticleSettings *)id)->texact = act;
540  break;
541  default:
542  break;
543  }
544 }
545 
547 {
548  return br->mtex.tex;
549 }
550 
552 {
553  if (br->mtex.tex) {
554  id_us_min(&br->mtex.tex->id);
555  }
556 
557  if (newtex) {
558  br->mtex.tex = newtex;
559  id_us_plus(&newtex->id);
560  }
561 }
562 
564 {
565  MTex *mtex = NULL;
566  Tex *tex = NULL;
567 
568  if (!part) {
569  return NULL;
570  }
571 
572  mtex = part->mtex[(int)(part->texact)];
573  if (mtex) {
574  tex = mtex->tex;
575  }
576 
577  return tex;
578 }
579 
581 {
582  int act = part->texact;
583 
584  if (part->mtex[act] && part->mtex[act]->tex) {
585  id_us_min(&part->mtex[act]->tex->id);
586  }
587 
588  if (newtex) {
589  if (!part->mtex[act]) {
590  part->mtex[act] = BKE_texture_mtex_add();
591  part->mtex[act]->texco = TEXCO_ORCO;
592  part->mtex[act]->blendtype = MTEX_MUL;
593  }
594 
595  part->mtex[act]->tex = newtex;
596  id_us_plus(&newtex->id);
597  }
598  else if (part->mtex[act]) {
599  MEM_freeN(part->mtex[act]);
600  part->mtex[act] = NULL;
601  }
602 }
603 
604 /* ------------------------------------------------------------------------- */
605 
607 {
608  pd->flag = 0;
609  pd->radius = 0.3f;
611  pd->falloff_softness = 2.0;
612  pd->source = TEX_PD_PSYS;
613  pd->point_tree = NULL;
614  pd->point_data = NULL;
615  pd->noise_size = 0.5f;
616  pd->noise_depth = 1;
617  pd->noise_fac = 1.0f;
619  pd->coba = BKE_colorband_add(true);
620  pd->speed_scale = 1.0f;
621  pd->totpoints = 0;
622  pd->object = NULL;
623  pd->psys = 0;
625  pd->falloff_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
626 
630  &pd->falloff_curve->clipr,
631  pd->falloff_curve->preset,
634 }
635 
637 {
638  PointDensity *pd = MEM_callocN(sizeof(PointDensity), "pointdensity");
640  return pd;
641 }
642 
644 {
645  PointDensity *pdn;
646 
647  pdn = MEM_dupallocN(pd);
648  pdn->point_tree = NULL;
649  pdn->point_data = NULL;
650  if (pdn->coba) {
651  pdn->coba = MEM_dupallocN(pdn->coba);
652  }
653  pdn->falloff_curve = BKE_curvemapping_copy(pdn->falloff_curve); /* can be NULL */
654  return pdn;
655 }
656 
658 {
659  if (pd->point_tree) {
661  pd->point_tree = NULL;
662  }
663  if (pd->point_data) {
664  MEM_freeN(pd->point_data);
665  pd->point_data = NULL;
666  }
667  if (pd->coba) {
668  MEM_freeN(pd->coba);
669  pd->coba = NULL;
670  }
671 
672  BKE_curvemapping_free(pd->falloff_curve); /* can be NULL */
673 }
674 
676 {
678  MEM_freeN(pd);
679 }
680 /* ------------------------------------------------------------------------- */
681 
685 bool BKE_texture_is_image_user(const struct Tex *tex)
686 {
687  switch (tex->type) {
688  case TEX_IMAGE: {
689  return true;
690  }
691  }
692 
693  return false;
694 }
695 
696 /* ------------------------------------------------------------------------- */
698 {
699  if (texture->ima && BKE_image_is_animated(texture->ima)) {
700  return true;
701  }
702  if (texture->adt) {
703  /* assume anything in adt means the texture is animated */
704  return true;
705  }
706  if (texture->type == TEX_NOISE) {
707  /* noise always varies with time */
708  return true;
709  }
710  return false;
711 }
712 
713 /* ------------------------------------------------------------------------- */
714 
716  Tex *texture,
717  const float *tex_co,
718  TexResult *texres,
719  struct ImagePool *pool,
720  bool use_color_management)
721 {
722  int result_type;
723  bool do_color_manage = false;
724 
725  if (scene && use_color_management) {
727  }
728 
729  /* no node textures for now */
730  result_type = multitex_ext_safe(texture, tex_co, texres, pool, do_color_manage, false);
731 
732  /* if the texture gave an RGB value, we assume it didn't give a valid
733  * intensity, since this is in the context of modifiers don't use perceptual color conversion.
734  * if the texture didn't give an RGB value, copy the intensity across
735  */
736  if (result_type & TEX_RGB) {
737  texres->tin = (1.0f / 3.0f) * (texres->tr + texres->tg + texres->tb);
738  }
739  else {
740  copy_v3_fl(&texres->tr, texres->tin);
741  }
742 }
743 
745  Tex *texture,
746  const float *tex_co,
747  TexResult *texres,
748  bool use_color_management)
749 {
750  BKE_texture_get_value_ex(scene, texture, tex_co, texres, NULL, use_color_management);
751 }
752 
754  bNodeTree *ntree,
755  struct ImagePool *pool)
756 {
758  if (node->type == SH_NODE_TEX_IMAGE && node->id != NULL) {
759  Image *image = (Image *)node->id;
760  BKE_image_pool_acquire_ibuf(image, &texture->iuser, pool);
761  }
762  else if (node->type == NODE_GROUP && node->id != NULL) {
763  /* TODO(sergey): Do we need to control recursion here? */
764  bNodeTree *nested_tree = (bNodeTree *)node->id;
766  }
767  }
768 }
769 
770 /* Make sure all images used by texture are loaded into pool. */
772 {
773  if (texture->nodetree != NULL) {
775  }
776  else {
777  if (texture->type == TEX_IMAGE) {
778  if (texture->ima != NULL) {
780  }
781  }
782  }
783 }
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
Definition: anim_data.c:1574
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
Definition: anim_data.c:1552
struct ColorBand * BKE_colorband_add(bool rangetype)
Definition: colorband.c:312
void BKE_colorband_init(struct ColorBand *coba, bool rangetype)
Definition: colorband.c:38
struct CurveMapping * BKE_curvemapping_copy(const struct CurveMapping *cumap)
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
void BKE_curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles)
Definition: colortools.c:877
void BKE_curvemapping_free(struct CurveMapping *cumap)
Definition: colortools.c:119
@ CURVEMAP_SLOPE_POSITIVE
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:88
void BKE_icon_id_delete(struct ID *id)
Definition: icons.cc:919
void BKE_previewimg_free(struct PreviewImage **prv)
Definition: icons.cc:295
void BKE_previewimg_id_copy(struct ID *new_id, const struct ID *old_id)
void BKE_previewimg_blend_read(struct BlendDataReader *reader, struct PreviewImage *prv)
Definition: icons.cc:651
void BKE_previewimg_blend_write(struct BlendWriter *writer, const struct PreviewImage *prv)
struct ImBuf * BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool)
Definition: image.c:5213
bool BKE_image_is_animated(struct Image *image)
Definition: image.c:5640
void BKE_imageuser_default(struct ImageUser *iuser)
Definition: image.c:3451
void id_us_min(struct ID *id)
Definition: lib_id.c:297
@ LIB_ID_CREATE_NO_ALLOCATE
Definition: BKE_lib_id.h:96
@ LIB_ID_COPY_NO_PREVIEW
Definition: BKE_lib_id.h:116
@ LIB_ID_CREATE_LOCAL
Definition: BKE_lib_id.h:105
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag)
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
Definition: lib_id.c:2395
void * BKE_id_new(struct Main *bmain, const short type, const char *name)
Definition: lib_id.c:1177
#define BKE_LIB_FOREACHID_PROCESS(_data, _id_super, _cb_flag)
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:87
@ IDWALK_CB_NOP
Definition: BKE_lib_query.h:47
bool BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct ID **id_pp)
Definition: lib_query.c:161
General operations, lookup, etc. for materials.
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree)
Definition: node.cc:472
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree)
Definition: node.cc:3021
bool BKE_scene_check_color_management_enabled(const struct Scene *scene)
#define BLI_assert(a)
Definition: BLI_assert.h:58
void BLI_bvhtree_free(BVHTree *tree)
Definition: BLI_kdopbvh.c:945
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
MINLINE float signf(float f)
void zero_m4(float m[4][4])
Definition: math_matrix.c:46
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:262
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1187
void unit_m4(float m[4][4])
Definition: rct.c:1140
void size_to_mat4(float R[4][4], const float size[3])
Definition: math_matrix.c:2118
#define mul_m4_series(...)
void transpose_m4(float R[4][4])
Definition: math_matrix.c:1358
void eul_to_mat4(float mat[4][4], const float eul[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool is_one_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
#define UNUSED(x)
#define ELEM(...)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_expand(expander, id)
bool BLO_write_is_undo(BlendWriter *writer)
Definition: writefile.c:1412
#define BLT_I18NCONTEXT_ID_TEXTURE
#define FILTER_ID_TE
Definition: DNA_ID.h:728
@ INDEX_ID_TE
Definition: DNA_ID.h:812
@ ID_TE
Definition: DNA_ID_enums.h:64
@ ID_LS
Definition: DNA_ID_enums.h:87
@ ID_PA
Definition: DNA_ID_enums.h:82
@ CUMA_EXTEND_EXTRAPOLATE
@ CURVE_PRESET_LINE
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:44
#define TEXCO_STROKE
#define TEXCO_ORCO
#define MA_RAMP_BLEND
Object is a sort of wrapper for general info.
#define MTEX_MUL
#define PROJ_Z
#define TEX_PD_NOISE_STATIC
#define TEX_PD_PSYS
#define TEXMAP_TYPE_NORMAL
#define TEXMAP_TYPE_VECTOR
#define PROJ_X
#define TEXMAP_TYPE_POINT
#define PROJ_N
#define TEXMAP_UNIT_MATRIX
#define TEX_RGB
#define TEX_PD_FALLOFF_STD
struct Tex Tex
#define MTEX_FLAT
#define TEX_PD_WORLDSPACE
#define TEXMAP_TYPE_TEXTURE
#define PROJ_Y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
static void init_data(ModifierData *md)
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume TEX_IMAGE
NODE_GROUP
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky TEX_NOISE
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume SH_NODE_TEX_IMAGE
#define MAX_MTEX
Definition: Stroke.h:45
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
OperationNode * node
Scene scene
FreestyleLineStyle linestyle
bNodeTree * ntree
#define GS(x)
Definition: iris.c:241
#define fabsf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
struct MTex mtex
struct ColorBand coba
float blend_color[3]
CurveMap cm[4]
struct MTex * mtex[18]
short id_code
Definition: BKE_idtype.h:120
Definition: DNA_ID.h:273
struct Library * lib
Definition: DNA_ID.h:277
int us
Definition: DNA_ID.h:293
char name[66]
Definition: DNA_ID.h:283
struct Scene * scene
short texco
short blendtype
struct Object * object
struct Tex * tex
Definition: BKE_main.h:116
struct MTex * mtex[18]
struct CurveMapping * falloff_curve
struct Object * object
struct ColorBand * coba
float mat[4][4]
float tb
Definition: RE_texture.h:84
float tin
Definition: RE_texture.h:84
float tr
Definition: RE_texture.h:84
float tg
Definition: RE_texture.h:84
struct AnimData * adt
struct PreviewImage * preview
struct ImageUser iuser
struct ColorBand * coba
short type
struct bNodeTree * nodetree
struct Image * ima
ListBase nodes
struct bNodeTreeExec * execdata
Tex * give_current_brush_texture(Brush *br)
Definition: texture.c:546
void BKE_texture_pointdensity_free(PointDensity *pd)
Definition: texture.c:675
PointDensity * BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag))
Definition: texture.c:643
void BKE_texture_get_value(const Scene *scene, Tex *texture, const float *tex_co, TexResult *texres, bool use_color_management)
Definition: texture.c:744
void BKE_texture_get_value_ex(const Scene *scene, Tex *texture, const float *tex_co, TexResult *texres, struct ImagePool *pool, bool use_color_management)
Definition: texture.c:715
bool BKE_texture_dependsOnTime(const struct Tex *texture)
Definition: texture.c:697
static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
Definition: texture.c:85
Tex * give_current_particle_texture(ParticleSettings *part)
Definition: texture.c:563
void BKE_texture_type_set(Tex *tex, int type)
Definition: texture.c:380
void BKE_texture_mapping_default(TexMapping *texmap, int type)
Definition: texture.c:252
void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
Definition: texture.c:580
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: texture.c:140
static void texture_init_data(ID *id)
Definition: texture.c:74
void set_current_brush_texture(Brush *br, Tex *newtex)
Definition: texture.c:551
void BKE_texture_colormapping_default(ColorMapping *colormap)
Definition: texture.c:354
IDTypeInfo IDType_ID_TE
Definition: texture.c:206
void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex)
Definition: texture.c:235
void BKE_texture_fetch_images_for_pool(Tex *texture, struct ImagePool *pool)
Definition: texture.c:771
static void texture_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: texture.c:192
void BKE_texture_mapping_init(TexMapping *texmap)
Definition: texture.c:267
void set_active_mtex(ID *id, short act)
Definition: texture.c:525
void set_current_linestyle_texture(FreestyleLineStyle *linestyle, Tex *newtex)
Definition: texture.c:476
bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
Definition: texture.c:499
TexMapping * BKE_texture_mapping_add(int type)
Definition: texture.c:243
static void texture_blend_read_expand(BlendExpander *expander, ID *id)
Definition: texture.c:199
static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, struct ImagePool *pool)
Definition: texture.c:753
MTex * BKE_texture_mtex_add(void)
Definition: texture.c:405
void BKE_texture_pointdensity_init_data(PointDensity *pd)
Definition: texture.c:606
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: texture.c:150
void BKE_texture_pointdensity_free_data(PointDensity *pd)
Definition: texture.c:657
MTex * BKE_texture_mtex_add_id(ID *id, int slot)
Definition: texture.c:417
void BKE_texture_mtex_default(MTex *mtex)
Definition: texture.c:398
Tex * give_current_linestyle_texture(FreestyleLineStyle *linestyle)
Definition: texture.c:461
bool BKE_texture_is_image_user(const struct Tex *tex)
Definition: texture.c:685
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
Definition: texture.c:177
static void texture_free_data(ID *id)
Definition: texture.c:123
PointDensity * BKE_texture_pointdensity_add(void)
Definition: texture.c:636
void BKE_texture_default(Tex *tex)
Definition: texture.c:375
ColorMapping * BKE_texture_colormapping_add(void)
Definition: texture.c:345
Tex * BKE_texture_add(Main *bmain, const char *name)
Definition: texture.c:387
int multitex_ext_safe(Tex *tex, const float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)