From 94f91827f8938153dad7d4b7f88fa8431f2f756c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 27 Sep 2020 11:59:07 +0200 Subject: Cleanup: IDManagement: Localize: tweak to flags. Add a specific flag for nodetree deep-copy special localization code. And add a new `LIB_ID_CREATE_LOCALIZE` flag, similar to `LIB_ID_COPY_LOCALIZE`, for creation purposes. No behavioral changes expected here. --- source/blender/blenkernel/BKE_lib_id.h | 9 +++++++-- source/blender/blenkernel/intern/mesh.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index 7af9165e036..c3c4c228b61 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -120,13 +120,18 @@ enum { LIB_ID_COPY_KEEP_LIB = 1 << 25, /** EXCEPTION! Deep-copy shapekeys used by copied obdata ID. */ LIB_ID_COPY_SHAPEKEY = 1 << 26, + /** EXCEPTION! Specific deep-copy of node trees used e.g. for rendering purposes. */ + LIB_ID_COPY_NODETREE_LOCALIZE = 1 << 27, /* *** Helper 'defines' gathering most common flag sets. *** */ /** Shapekeys are not real ID's, more like local data to geometry IDs... */ LIB_ID_COPY_DEFAULT = LIB_ID_COPY_SHAPEKEY, + + /** Create a local, outside of bmain, data-block to work on. */ + LIB_ID_CREATE_LOCALIZE = LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | + LIB_ID_CREATE_NO_DEG_TAG, /** Generate a local copy, outside of bmain, to work on (used by COW e.g.). */ - LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | - LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES, + LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_LOCALIZE | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES, }; void BKE_libblock_copy_ex(struct Main *bmain, diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 396db818408..fa87fef2b9a 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -892,7 +892,7 @@ Mesh *BKE_mesh_new_nomain( int verts_len, int edges_len, int tessface_len, int loops_len, int polys_len) { Mesh *mesh = BKE_libblock_alloc( - NULL, ID_ME, BKE_idtype_idcode_to_name(ID_ME), LIB_ID_COPY_LOCALIZE); + NULL, ID_ME, BKE_idtype_idcode_to_name(ID_ME), LIB_ID_CREATE_LOCALIZE); BKE_libblock_init_empty(&mesh->id); /* don't use CustomData_reset(...); because we dont want to touch customdata */ -- cgit v1.2.3