diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-04 22:17:23 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-04 22:17:23 +0300 |
commit | 2ac555fe47f575e37d0feb89c6ba23fe684ed44b (patch) | |
tree | 37190f588482487c54447af81a75b901741a5fb6 /source/blender/makesdna | |
parent | c35ad8d4a3e4b9c907b6a5bbceaff91aebf7c3c8 (diff) |
ID: Sanitize handling of 'USER_ONE' (ensure_user) case.
Note that this has little impact on current master - yet it allows to fix the 'Image Editor' bug
(open image in editor, use same image in texture, delete image from texture, image us is 0 and
red in image editor...) and probably a few other similar cases.
But that change is mandatory to get a proper handling of ID deletion/reamapping/reloading/etc. as done in id-remap branch.
Instead of just adding a user if none already present, new code use two new ID tags to get a three-states status:
- Normal: nothing changes.
- Needs extra user: we know that ID needs an extra user, so we take of never going down to 0 in 'real' usercount handling.
- Has extra user: we do have increased that ID usercount to get our needed extrauser.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1696
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 74a63be8bbc..0bf3c350263 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -313,6 +313,11 @@ enum { /* RESET_NEVER tag datablock as a place-holder (because the real one could not be linked from its library e.g.). */ LIB_TAG_MISSING = 1 << 6, + /* tag datablock has having an extra user. */ + LIB_TAG_EXTRAUSER = 1 << 2, + /* tag datablock has having actually increased usercount for the extra virtual user. */ + LIB_TAG_EXTRAUSER_SET = 1 << 7, + /* RESET_AFTER_USE tag newly duplicated/copied IDs. */ LIB_TAG_NEW = 1 << 8, /* RESET_BEFORE_USE free test flag. |