Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/texture.cc
- This file was moved from source/blender/blenkernel/intern/texture.c.
| Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag) | ||||
| Tex *texture_dst = (Tex *)id_dst; | Tex *texture_dst = (Tex *)id_dst; | ||||
| const Tex *texture_src = (const Tex *)id_src; | const Tex *texture_src = (const Tex *)id_src; | ||||
| const bool is_localized = (flag & LIB_ID_CREATE_LOCAL) != 0; | const bool is_localized = (flag & LIB_ID_CREATE_LOCAL) != 0; | ||||
| /* We always need allocation of our private ID data. */ | /* We always need allocation of our private ID data. */ | ||||
| const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE; | const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE; | ||||
| if (!BKE_texture_is_image_user(texture_src)) { | if (!BKE_texture_is_image_user(texture_src)) { | ||||
| texture_dst->ima = NULL; | texture_dst->ima = nullptr; | ||||
| } | } | ||||
| if (texture_dst->coba) { | if (texture_dst->coba) { | ||||
| texture_dst->coba = MEM_dupallocN(texture_dst->coba); | texture_dst->coba = static_cast<ColorBand *>(MEM_dupallocN(texture_dst->coba)); | ||||
| } | } | ||||
| if (texture_src->nodetree) { | if (texture_src->nodetree) { | ||||
| if (texture_src->nodetree->execdata) { | if (texture_src->nodetree->execdata) { | ||||
| ntreeTexEndExecTree(texture_src->nodetree->execdata); | ntreeTexEndExecTree(texture_src->nodetree->execdata); | ||||
| } | } | ||||
| if (is_localized) { | if (is_localized) { | ||||
| texture_dst->nodetree = ntreeLocalize(texture_src->nodetree); | texture_dst->nodetree = ntreeLocalize(texture_src->nodetree); | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_id_copy_ex( | BKE_id_copy_ex( | ||||
| bmain, (ID *)texture_src->nodetree, (ID **)&texture_dst->nodetree, flag_private_id_data); | bmain, (ID *)texture_src->nodetree, (ID **)&texture_dst->nodetree, flag_private_id_data); | ||||
| } | } | ||||
| texture_dst->nodetree->owner_id = &texture_dst->id; | texture_dst->nodetree->owner_id = &texture_dst->id; | ||||
| } | } | ||||
| if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { | if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) { | ||||
| BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id); | BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id); | ||||
| } | } | ||||
| else { | else { | ||||
| texture_dst->preview = NULL; | texture_dst->preview = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| static void texture_free_data(ID *id) | static void texture_free_data(ID *id) | ||||
| { | { | ||||
| Tex *texture = (Tex *)id; | Tex *texture = (Tex *)id; | ||||
| /* is no lib link block, but texture extension */ | /* is no lib link block, but texture extension */ | ||||
| if (texture->nodetree) { | if (texture->nodetree) { | ||||
| ntreeFreeEmbeddedTree(texture->nodetree); | ntreeFreeEmbeddedTree(texture->nodetree); | ||||
| MEM_freeN(texture->nodetree); | MEM_freeN(texture->nodetree); | ||||
| texture->nodetree = NULL; | texture->nodetree = nullptr; | ||||
| } | } | ||||
| MEM_SAFE_FREE(texture->coba); | MEM_SAFE_FREE(texture->coba); | ||||
| BKE_icon_id_delete((ID *)texture); | BKE_icon_id_delete((ID *)texture); | ||||
| BKE_previewimg_free(&texture->preview); | BKE_previewimg_free(&texture->preview); | ||||
| } | } | ||||
| Show All 40 Lines | static void texture_blend_read_data(BlendDataReader *reader, ID *id) | ||||
| BLO_read_data_address(reader, &tex->adt); | BLO_read_data_address(reader, &tex->adt); | ||||
| BKE_animdata_blend_read_data(reader, tex->adt); | BKE_animdata_blend_read_data(reader, tex->adt); | ||||
| BLO_read_data_address(reader, &tex->coba); | BLO_read_data_address(reader, &tex->coba); | ||||
| BLO_read_data_address(reader, &tex->preview); | BLO_read_data_address(reader, &tex->preview); | ||||
| BKE_previewimg_blend_read(reader, tex->preview); | BKE_previewimg_blend_read(reader, tex->preview); | ||||
| tex->iuser.scene = NULL; | tex->iuser.scene = nullptr; | ||||
| } | } | ||||
| static void texture_blend_read_lib(BlendLibReader *reader, ID *id) | static void texture_blend_read_lib(BlendLibReader *reader, ID *id) | ||||
| { | { | ||||
| Tex *tex = (Tex *)id; | Tex *tex = (Tex *)id; | ||||
| BLO_read_id_address(reader, tex->id.lib, &tex->ima); | BLO_read_id_address(reader, tex->id.lib, &tex->ima); | ||||
| BLO_read_id_address(reader, tex->id.lib, &tex->ipo); /* XXX deprecated - old animation system */ | BLO_read_id_address(reader, tex->id.lib, &tex->ipo); /* XXX deprecated - old animation system */ | ||||
| } | } | ||||
| Show All 9 Lines | IDTypeInfo IDType_ID_TE = { | ||||
| .id_code = ID_TE, | .id_code = ID_TE, | ||||
| .id_filter = FILTER_ID_TE, | .id_filter = FILTER_ID_TE, | ||||
| .main_listbase_index = INDEX_ID_TE, | .main_listbase_index = INDEX_ID_TE, | ||||
| .struct_size = sizeof(Tex), | .struct_size = sizeof(Tex), | ||||
| .name = "Texture", | .name = "Texture", | ||||
| .name_plural = "textures", | .name_plural = "textures", | ||||
| .translation_context = BLT_I18NCONTEXT_ID_TEXTURE, | .translation_context = BLT_I18NCONTEXT_ID_TEXTURE, | ||||
| .flags = IDTYPE_FLAGS_APPEND_IS_REUSABLE, | .flags = IDTYPE_FLAGS_APPEND_IS_REUSABLE, | ||||
| .asset_type_info = NULL, | .asset_type_info = nullptr, | ||||
| .init_data = texture_init_data, | .init_data = texture_init_data, | ||||
| .copy_data = texture_copy_data, | .copy_data = texture_copy_data, | ||||
| .free_data = texture_free_data, | .free_data = texture_free_data, | ||||
| .make_local = NULL, | .make_local = nullptr, | ||||
| .foreach_id = texture_foreach_id, | .foreach_id = texture_foreach_id, | ||||
| .foreach_cache = NULL, | .foreach_cache = nullptr, | ||||
| .foreach_path = NULL, | .foreach_path = nullptr, | ||||
| .owner_pointer_get = NULL, | .owner_pointer_get = nullptr, | ||||
| .blend_write = texture_blend_write, | .blend_write = texture_blend_write, | ||||
| .blend_read_data = texture_blend_read_data, | .blend_read_data = texture_blend_read_data, | ||||
| .blend_read_lib = texture_blend_read_lib, | .blend_read_lib = texture_blend_read_lib, | ||||
| .blend_read_expand = texture_blend_read_expand, | .blend_read_expand = texture_blend_read_expand, | ||||
| .blend_read_undo_preserve = NULL, | .blend_read_undo_preserve = nullptr, | ||||
| .lib_override_apply_post = NULL, | .lib_override_apply_post = nullptr, | ||||
| }; | }; | ||||
| void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex) | void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex) | ||||
| { | { | ||||
| BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mtex->object, IDWALK_CB_NOP); | BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mtex->object, IDWALK_CB_NOP); | ||||
| BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mtex->tex, IDWALK_CB_USER); | BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mtex->tex, IDWALK_CB_USER); | ||||
| } | } | ||||
| /* ****************** Mapping ******************* */ | /* ****************** Mapping ******************* */ | ||||
| TexMapping *BKE_texture_mapping_add(int type) | TexMapping *BKE_texture_mapping_add(int type) | ||||
| { | { | ||||
| TexMapping *texmap = MEM_callocN(sizeof(TexMapping), "TexMapping"); | TexMapping *texmap = MEM_cnew<TexMapping>("TexMapping"); | ||||
| BKE_texture_mapping_default(texmap, type); | BKE_texture_mapping_default(texmap, type); | ||||
| return texmap; | return texmap; | ||||
| } | } | ||||
| void BKE_texture_mapping_default(TexMapping *texmap, int type) | void BKE_texture_mapping_default(TexMapping *texmap, int type) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | else { | ||||
| mul_m4_m4m4(texmap->mat, texmap->mat, proj); | mul_m4_m4m4(texmap->mat, texmap->mat, proj); | ||||
| texmap->flag &= ~TEXMAP_UNIT_MATRIX; | texmap->flag &= ~TEXMAP_UNIT_MATRIX; | ||||
| } | } | ||||
| } | } | ||||
| ColorMapping *BKE_texture_colormapping_add(void) | ColorMapping *BKE_texture_colormapping_add(void) | ||||
| { | { | ||||
| ColorMapping *colormap = MEM_callocN(sizeof(ColorMapping), "ColorMapping"); | ColorMapping *colormap = MEM_cnew<ColorMapping>("ColorMapping"); | ||||
| BKE_texture_colormapping_default(colormap); | BKE_texture_colormapping_default(colormap); | ||||
| return colormap; | return colormap; | ||||
| } | } | ||||
| void BKE_texture_colormapping_default(ColorMapping *colormap) | void BKE_texture_colormapping_default(ColorMapping *colormap) | ||||
| { | { | ||||
| Show All 27 Lines | |||||
| } | } | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| Tex *BKE_texture_add(Main *bmain, const char *name) | Tex *BKE_texture_add(Main *bmain, const char *name) | ||||
| { | { | ||||
| Tex *tex; | Tex *tex; | ||||
| tex = BKE_id_new(bmain, ID_TE, name); | tex = static_cast<Tex *>(BKE_id_new(bmain, ID_TE, name)); | ||||
| return tex; | return tex; | ||||
| } | } | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| void BKE_texture_mtex_default(MTex *mtex) | void BKE_texture_mtex_default(MTex *mtex) | ||||
| { | { | ||||
| memcpy(mtex, DNA_struct_default_get(MTex), sizeof(*mtex)); | *mtex = blender::dna::shallow_copy(*DNA_struct_default_get(MTex)); | ||||
| } | } | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| MTex *BKE_texture_mtex_add(void) | MTex *BKE_texture_mtex_add(void) | ||||
| { | { | ||||
| MTex *mtex; | MTex *mtex; | ||||
| mtex = MEM_callocN(sizeof(MTex), "BKE_texture_mtex_add"); | mtex = MEM_cnew<MTex>("BKE_texture_mtex_add"); | ||||
| BKE_texture_mtex_default(mtex); | BKE_texture_mtex_default(mtex); | ||||
| return mtex; | return mtex; | ||||
| } | } | ||||
| MTex *BKE_texture_mtex_add_id(ID *id, int slot) | MTex *BKE_texture_mtex_add_id(ID *id, int slot) | ||||
| { | { | ||||
| MTex **mtex_ar; | MTex **mtex_ar; | ||||
| short act; | short act; | ||||
| give_active_mtex(id, &mtex_ar, &act); | give_active_mtex(id, &mtex_ar, &act); | ||||
| if (mtex_ar == NULL) { | if (mtex_ar == nullptr) { | ||||
| return NULL; | return nullptr; | ||||
| } | } | ||||
| if (slot == -1) { | if (slot == -1) { | ||||
| /* find first free */ | /* find first free */ | ||||
| int i; | int i; | ||||
| for (i = 0; i < MAX_MTEX; i++) { | for (i = 0; i < MAX_MTEX; i++) { | ||||
| if (!mtex_ar[i]) { | if (!mtex_ar[i]) { | ||||
| slot = i; | slot = i; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (slot == -1) { | if (slot == -1) { | ||||
| return NULL; | return nullptr; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* make sure slot is valid */ | /* make sure slot is valid */ | ||||
| if (slot < 0 || slot >= MAX_MTEX) { | if (slot < 0 || slot >= MAX_MTEX) { | ||||
| return NULL; | return nullptr; | ||||
| } | } | ||||
| } | } | ||||
| if (mtex_ar[slot]) { | if (mtex_ar[slot]) { | ||||
| id_us_min((ID *)mtex_ar[slot]->tex); | id_us_min((ID *)mtex_ar[slot]->tex); | ||||
| MEM_freeN(mtex_ar[slot]); | MEM_freeN(mtex_ar[slot]); | ||||
| mtex_ar[slot] = NULL; | mtex_ar[slot] = nullptr; | ||||
| } | } | ||||
| mtex_ar[slot] = BKE_texture_mtex_add(); | mtex_ar[slot] = BKE_texture_mtex_add(); | ||||
| return mtex_ar[slot]; | return mtex_ar[slot]; | ||||
| } | } | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| Tex *give_current_linestyle_texture(FreestyleLineStyle *linestyle) | Tex *give_current_linestyle_texture(FreestyleLineStyle *linestyle) | ||||
| { | { | ||||
| MTex *mtex = NULL; | MTex *mtex = nullptr; | ||||
| Tex *tex = NULL; | Tex *tex = nullptr; | ||||
| if (linestyle) { | if (linestyle) { | ||||
| mtex = linestyle->mtex[(int)(linestyle->texact)]; | mtex = linestyle->mtex[(int)(linestyle->texact)]; | ||||
| if (mtex) { | if (mtex) { | ||||
| tex = mtex->tex; | tex = mtex->tex; | ||||
| } | } | ||||
| } | } | ||||
| Show All 33 Lines | case ID_LS: | ||||
| break; | break; | ||||
| case ID_PA: | case ID_PA: | ||||
| *mtex_ar = ((ParticleSettings *)id)->mtex; | *mtex_ar = ((ParticleSettings *)id)->mtex; | ||||
| if (act) { | if (act) { | ||||
| *act = (((ParticleSettings *)id)->texact); | *act = (((ParticleSettings *)id)->texact); | ||||
| } | } | ||||
| break; | break; | ||||
| default: | default: | ||||
| *mtex_ar = NULL; | *mtex_ar = nullptr; | ||||
| if (act) { | if (act) { | ||||
| *act = 0; | *act = 0; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| Show All 33 Lines | void set_current_brush_texture(Brush *br, Tex *newtex) | ||||
| if (newtex) { | if (newtex) { | ||||
| br->mtex.tex = newtex; | br->mtex.tex = newtex; | ||||
| id_us_plus(&newtex->id); | id_us_plus(&newtex->id); | ||||
| } | } | ||||
| } | } | ||||
| Tex *give_current_particle_texture(ParticleSettings *part) | Tex *give_current_particle_texture(ParticleSettings *part) | ||||
| { | { | ||||
| MTex *mtex = NULL; | MTex *mtex = nullptr; | ||||
| Tex *tex = NULL; | Tex *tex = nullptr; | ||||
| if (!part) { | if (!part) { | ||||
| return NULL; | return nullptr; | ||||
| } | } | ||||
| mtex = part->mtex[(int)(part->texact)]; | mtex = part->mtex[(int)(part->texact)]; | ||||
| if (mtex) { | if (mtex) { | ||||
| tex = mtex->tex; | tex = mtex->tex; | ||||
| } | } | ||||
| return tex; | return tex; | ||||
| Show All 26 Lines | |||||
| void BKE_texture_pointdensity_init_data(PointDensity *pd) | void BKE_texture_pointdensity_init_data(PointDensity *pd) | ||||
| { | { | ||||
| pd->flag = 0; | pd->flag = 0; | ||||
| pd->radius = 0.3f; | pd->radius = 0.3f; | ||||
| pd->falloff_type = TEX_PD_FALLOFF_STD; | pd->falloff_type = TEX_PD_FALLOFF_STD; | ||||
| pd->falloff_softness = 2.0; | pd->falloff_softness = 2.0; | ||||
| pd->source = TEX_PD_PSYS; | pd->source = TEX_PD_PSYS; | ||||
| pd->point_tree = NULL; | pd->point_tree = nullptr; | ||||
| pd->point_data = NULL; | pd->point_data = nullptr; | ||||
| pd->noise_size = 0.5f; | pd->noise_size = 0.5f; | ||||
| pd->noise_depth = 1; | pd->noise_depth = 1; | ||||
| pd->noise_fac = 1.0f; | pd->noise_fac = 1.0f; | ||||
| pd->noise_influence = TEX_PD_NOISE_STATIC; | pd->noise_influence = TEX_PD_NOISE_STATIC; | ||||
| pd->coba = BKE_colorband_add(true); | pd->coba = BKE_colorband_add(true); | ||||
| pd->speed_scale = 1.0f; | pd->speed_scale = 1.0f; | ||||
| pd->totpoints = 0; | pd->totpoints = 0; | ||||
| pd->object = NULL; | pd->object = nullptr; | ||||
| pd->psys = 0; | pd->psys = 0; | ||||
| pd->psys_cache_space = TEX_PD_WORLDSPACE; | pd->psys_cache_space = TEX_PD_WORLDSPACE; | ||||
| pd->falloff_curve = BKE_curvemapping_add(1, 0, 0, 1, 1); | pd->falloff_curve = BKE_curvemapping_add(1, 0, 0, 1, 1); | ||||
| pd->falloff_curve->preset = CURVE_PRESET_LINE; | pd->falloff_curve->preset = CURVE_PRESET_LINE; | ||||
| pd->falloff_curve->flag &= ~CUMA_EXTEND_EXTRAPOLATE; | pd->falloff_curve->flag &= ~CUMA_EXTEND_EXTRAPOLATE; | ||||
| BKE_curvemap_reset(pd->falloff_curve->cm, | BKE_curvemap_reset(pd->falloff_curve->cm, | ||||
| &pd->falloff_curve->clipr, | &pd->falloff_curve->clipr, | ||||
| pd->falloff_curve->preset, | pd->falloff_curve->preset, | ||||
| CURVEMAP_SLOPE_POSITIVE); | CURVEMAP_SLOPE_POSITIVE); | ||||
| BKE_curvemapping_changed(pd->falloff_curve, false); | BKE_curvemapping_changed(pd->falloff_curve, false); | ||||
| } | } | ||||
| PointDensity *BKE_texture_pointdensity_add(void) | PointDensity *BKE_texture_pointdensity_add(void) | ||||
| { | { | ||||
| PointDensity *pd = MEM_callocN(sizeof(PointDensity), "pointdensity"); | PointDensity *pd = MEM_cnew<PointDensity>("pointdensity"); | ||||
| BKE_texture_pointdensity_init_data(pd); | BKE_texture_pointdensity_init_data(pd); | ||||
| return pd; | return pd; | ||||
| } | } | ||||
| PointDensity *BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag)) | PointDensity *BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag)) | ||||
| { | { | ||||
| PointDensity *pdn; | PointDensity *pdn; | ||||
| pdn = MEM_dupallocN(pd); | pdn = static_cast<PointDensity *>(MEM_dupallocN(pd)); | ||||
| pdn->point_tree = NULL; | pdn->point_tree = nullptr; | ||||
| pdn->point_data = NULL; | pdn->point_data = nullptr; | ||||
| if (pdn->coba) { | if (pdn->coba) { | ||||
| pdn->coba = MEM_dupallocN(pdn->coba); | pdn->coba = static_cast<ColorBand *>(MEM_dupallocN(pdn->coba)); | ||||
| } | } | ||||
| pdn->falloff_curve = BKE_curvemapping_copy(pdn->falloff_curve); /* can be NULL */ | pdn->falloff_curve = BKE_curvemapping_copy(pdn->falloff_curve); /* can be nullptr */ | ||||
| return pdn; | return pdn; | ||||
| } | } | ||||
| void BKE_texture_pointdensity_free_data(PointDensity *pd) | void BKE_texture_pointdensity_free_data(PointDensity *pd) | ||||
| { | { | ||||
| if (pd->point_tree) { | if (pd->point_tree) { | ||||
| BLI_bvhtree_free(pd->point_tree); | BLI_bvhtree_free(static_cast<BVHTree *>(pd->point_tree)); | ||||
| pd->point_tree = NULL; | pd->point_tree = nullptr; | ||||
| } | } | ||||
| MEM_SAFE_FREE(pd->point_data); | MEM_SAFE_FREE(pd->point_data); | ||||
| MEM_SAFE_FREE(pd->coba); | MEM_SAFE_FREE(pd->coba); | ||||
| BKE_curvemapping_free(pd->falloff_curve); /* can be NULL */ | BKE_curvemapping_free(pd->falloff_curve); /* can be nullptr */ | ||||
| } | } | ||||
| void BKE_texture_pointdensity_free(PointDensity *pd) | void BKE_texture_pointdensity_free(PointDensity *pd) | ||||
| { | { | ||||
| BKE_texture_pointdensity_free_data(pd); | BKE_texture_pointdensity_free_data(pd); | ||||
| MEM_freeN(pd); | MEM_freeN(pd); | ||||
| } | } | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void BKE_texture_get_value(const Scene *scene, | void BKE_texture_get_value(const Scene *scene, | ||||
| Tex *texture, | Tex *texture, | ||||
| const float *tex_co, | const float *tex_co, | ||||
| TexResult *texres, | TexResult *texres, | ||||
| bool use_color_management) | bool use_color_management) | ||||
| { | { | ||||
| BKE_texture_get_value_ex(scene, texture, tex_co, texres, NULL, use_color_management); | BKE_texture_get_value_ex(scene, texture, tex_co, texres, nullptr, use_color_management); | ||||
| } | } | ||||
| static void texture_nodes_fetch_images_for_pool(Tex *texture, | static void texture_nodes_fetch_images_for_pool(Tex *texture, | ||||
| bNodeTree *ntree, | bNodeTree *ntree, | ||||
| struct ImagePool *pool) | struct ImagePool *pool) | ||||
| { | { | ||||
| LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { | ||||
| if (node->type == SH_NODE_TEX_IMAGE && node->id != NULL) { | if (node->type == SH_NODE_TEX_IMAGE && node->id != nullptr) { | ||||
| Image *image = (Image *)node->id; | Image *image = (Image *)node->id; | ||||
| BKE_image_pool_acquire_ibuf(image, &texture->iuser, pool); | BKE_image_pool_acquire_ibuf(image, &texture->iuser, pool); | ||||
| } | } | ||||
| else if (node->type == NODE_GROUP && node->id != NULL) { | else if (node->type == NODE_GROUP && node->id != nullptr) { | ||||
| /* TODO(sergey): Do we need to control recursion here? */ | /* TODO(sergey): Do we need to control recursion here? */ | ||||
| bNodeTree *nested_tree = (bNodeTree *)node->id; | bNodeTree *nested_tree = (bNodeTree *)node->id; | ||||
| texture_nodes_fetch_images_for_pool(texture, nested_tree, pool); | texture_nodes_fetch_images_for_pool(texture, nested_tree, pool); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void BKE_texture_fetch_images_for_pool(Tex *texture, struct ImagePool *pool) | void BKE_texture_fetch_images_for_pool(Tex *texture, struct ImagePool *pool) | ||||
| { | { | ||||
| if (texture->nodetree != NULL) { | if (texture->nodetree != nullptr) { | ||||
| texture_nodes_fetch_images_for_pool(texture, texture->nodetree, pool); | texture_nodes_fetch_images_for_pool(texture, texture->nodetree, pool); | ||||
| } | } | ||||
| else { | else { | ||||
| if (texture->type == TEX_IMAGE) { | if (texture->type == TEX_IMAGE) { | ||||
| if (texture->ima != NULL) { | if (texture->ima != nullptr) { | ||||
| BKE_image_pool_acquire_ibuf(texture->ima, &texture->iuser, pool); | BKE_image_pool_acquire_ibuf(texture->ima, &texture->iuser, pool); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||