Fix T101405: Deleting a baked action results in an error.

RNA code to create new actions did not properly remove the extra user
set by default, as done in other `new` callbacks of other ID types.

NOTE: Mask ID had the same issue, also fixed in this commit.

NOTE: At some point this needs to be properly fixed, default super-low
level ID creation code should simply not add a 'default' user, this is
extremely bad design and forces higher-level code to do all kind of
extra work to get rid of it half of the time, in very unclear and
confusing ways and places.
This commit is contained in:
Bastien Montagne 2022-10-05 15:54:03 +02:00
parent b47a234f98
commit 6dd2e193e1
Notes: blender-bot 2023-02-13 14:30:15 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #101405, DDS image format improvements
Referenced by issue #101045, Deleting a baked action results in an error
1 changed files with 2 additions and 0 deletions

View File

@ -629,6 +629,7 @@ static bAction *rna_Main_actions_new(Main *bmain, const char *name)
bAction *act = BKE_action_add(bmain, safe_name);
id_fake_user_clear(&act->id);
id_us_min(&act->id);
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
@ -701,6 +702,7 @@ static Mask *rna_Main_mask_new(Main *bmain, const char *name)
rna_idname_validate(name, safe_name);
Mask *mask = BKE_mask_new(bmain, safe_name);
id_us_min(&mask->id);
WM_main_add_notifier(NC_ID | NA_ADDED, NULL);