Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-06-05 14:09:31 +0300
committerJulian Eisel <julian@blender.org>2020-06-05 14:09:31 +0300
commit920a58d9b6d667894cf166cbbd25e4c2fbd238ea (patch)
tree7ca5a9da640753b5e070c439ac3bdd14dfad92cf /source/blender/blenkernel/intern/texture.c
parentc94b6209861ca7cc3985b53474feed7d94c0221a (diff)
parenta1d55bdd530390e58c51abe9707b8d3b0ae3e861 (diff)
Merge branch 'master' into wm-drag-drop-rewritewm-drag-drop-rewrite
Diffstat (limited to 'source/blender/blenkernel/intern/texture.c')
-rw-r--r--source/blender/blenkernel/intern/texture.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index b0f000d6e04..e2c3c20e36e 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -29,6 +29,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_kdopbvh.h"
+#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_utildefines.h"
@@ -49,7 +50,6 @@
#include "BKE_main.h"
-#include "BKE_animsys.h"
#include "BKE_colorband.h"
#include "BKE_colortools.h"
#include "BKE_icons.h"
@@ -57,6 +57,7 @@
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_lib_id.h"
+#include "BKE_lib_query.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_scene.h"
@@ -112,7 +113,7 @@ static void texture_free_data(ID *id)
/* is no lib link block, but texture extension */
if (texture->nodetree) {
- ntreeFreeNestedTree(texture->nodetree);
+ ntreeFreeEmbeddedTree(texture->nodetree);
MEM_freeN(texture->nodetree);
texture->nodetree = NULL;
}
@@ -123,6 +124,16 @@ static void texture_free_data(ID *id)
BKE_previewimg_free(&texture->preview);
}
+static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
+{
+ Tex *texture = (Tex *)id;
+ if (texture->nodetree) {
+ /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
+ BKE_library_foreach_ID_embedded(data, (ID **)&texture->nodetree);
+ }
+ BKE_LIB_FOREACHID_PROCESS(data, texture->ima, IDWALK_CB_USER);
+}
+
IDTypeInfo IDType_ID_TE = {
.id_code = ID_TE,
.id_filter = FILTER_ID_TE,
@@ -137,8 +148,16 @@ IDTypeInfo IDType_ID_TE = {
.copy_data = texture_copy_data,
.free_data = texture_free_data,
.make_local = NULL,
+ .foreach_id = texture_foreach_id,
};
+/* Utils for all IDs using those texture slots. */
+void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex)
+{
+ BKE_LIB_FOREACHID_PROCESS(data, mtex->object, IDWALK_CB_NOP);
+ BKE_LIB_FOREACHID_PROCESS(data, mtex->tex, IDWALK_CB_USER);
+}
+
/* ****************** Mapping ******************* */
TexMapping *BKE_texture_mapping_add(int type)
@@ -697,7 +716,7 @@ static void texture_nodes_fetch_images_for_pool(Tex *texture,
bNodeTree *ntree,
struct ImagePool *pool)
{
- for (bNode *node = ntree->nodes.first; node; node = node->next) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->type == SH_NODE_TEX_IMAGE && node->id != NULL) {
Image *image = (Image *)node->id;
BKE_image_pool_acquire_ibuf(image, &texture->iuser, pool);