fix for issue where you could easily make zero user datablocks (especially with masks which default to fake user).
- Make mask - assign to image editor - disable fake user This would make the image space reference a zero user mask datablock which wouldn't be saved. solve the bug by making mask and image assignments check the real usercount of the ID block (not taking into account fake user).
This commit is contained in:
@@ -78,8 +78,8 @@ void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *i
|
||||
if (sima->image)
|
||||
BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
|
||||
|
||||
if (sima->image && sima->image->id.us == 0)
|
||||
sima->image->id.us = 1;
|
||||
if (sima->image && ID_REAL_USERS(sima->image) <= 0)
|
||||
sima->image->id.us = MAX2(sima->image->id.us, 0) + 1;
|
||||
|
||||
if (obedit)
|
||||
WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
|
||||
@@ -97,8 +97,8 @@ void ED_space_image_set_mask(bContext *C, SpaceImage *sima, Mask *mask)
|
||||
sima->mask_info.mask = mask;
|
||||
|
||||
/* weak, but same as image/space */
|
||||
if (sima->mask_info.mask && sima->mask_info.mask->id.us == 0)
|
||||
sima->mask_info.mask->id.us = 1;
|
||||
if (sima->mask_info.mask && ID_REAL_USERS(sima->mask_info.mask) <= 0)
|
||||
sima->mask_info.mask->id.us = MAX2(sima->mask_info.mask->id.us, 0) + 1;
|
||||
|
||||
if (C) {
|
||||
WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask);
|
||||
|
||||
Reference in New Issue
Block a user