Fix image user count not being decreased when deleting a 3DView background image.
Patch by julien (Julien DUROURE) as T40568 (with own minor style edits), many thanks!
This commit is contained in:
parent
a51aeedade
commit
320b7a59c3
Notes:
blender-bot
2023-02-14 10:30:44 +01:00
Referenced by commit 0fc05c1c03
, Followup to rB320b7a59c3eed: also handle background image ID refcount when duplicating/freeing View3D.
Referenced by issue #40569, Image user count is not decreased when deleting a background image
|
@ -4265,6 +4265,19 @@ static int background_image_remove_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (bgpic_rem) {
|
||||
ED_view3D_background_image_remove(v3d, bgpic_rem);
|
||||
|
||||
if (bgpic_rem->source == V3D_BGPIC_IMAGE) {
|
||||
Image *ima = bgpic_rem->ima;
|
||||
if (ima) {
|
||||
id_us_min(&ima->id);
|
||||
}
|
||||
}
|
||||
else if (bgpic_rem->source == V3D_BGPIC_MOVIE) {
|
||||
MovieClip *clip = bgpic_rem->clip;
|
||||
if (clip) {
|
||||
id_us_min(&clip->id);
|
||||
}
|
||||
}
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue