diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-07-17 16:16:41 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-07-17 16:16:41 +0300 |
commit | a8e4aae09104d596798aefc9ce7ff3836a2425a1 (patch) | |
tree | 9ae413067382f48ec10866f2fb6b7547b032cf92 /source/blender/blenkernel/intern/object.c | |
parent | a70e941fd0f14a9ee4036c8053c1483f37a56af1 (diff) |
Extend a bit 'NO_MAIN'/'NO_USER_REFCOUNT'/etc. flags to ID allocation itself.
No real reason we keep this only to copying, creating ID outside of
database is handy as well!
Also, add helpers to add/remove an ID from Main, and to set/clear its
'user refcounting' status. Those will be useful in future complex ID
manipulation cases (like static override...).
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8a626b123d2..cb851d2f955 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -670,7 +670,7 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name) if (!name) name = get_obdata_defname(type); - ob = BKE_libblock_alloc(bmain, ID_OB, name); + ob = BKE_libblock_alloc(bmain, ID_OB, name, 0); /* default object vars */ ob->type = type; @@ -957,7 +957,7 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f psysn->clmd->point_cache = psysn->pointcache; } - if ((flag & LIB_ID_COPY_NO_USER_REFCOUNT) == 0) { + if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { id_us_plus((ID *)psysn->part); } @@ -1113,7 +1113,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ ModifierData *md; /* We never handle usercount here for own data. */ - const int flag_subdata = flag | LIB_ID_COPY_NO_USER_REFCOUNT; + const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT; if (ob_src->totcol) { ob_dst->mat = MEM_dupallocN(ob_src->mat); |