Brush Assets: Make revert and delete operators affect dependencies #119806
|
@ -152,6 +152,9 @@ struct AssetWeakReferenceMain {
|
|||
}
|
||||
AssetWeakReferenceMain &operator=(AssetWeakReferenceMain &&other)
|
||||
{
|
||||
if (this == &other) {
|
||||
brecht marked this conversation as resolved
Outdated
|
||||
return *this;
|
||||
}
|
||||
this->filepath = std::exchange(other.filepath, "");
|
||||
this->main = std::exchange(other.main, nullptr);
|
||||
return *this;
|
||||
|
@ -183,7 +186,7 @@ void AssetWeakReferenceMain::reload(Main &global_main)
|
|||
|
||||
brecht marked this conversation as resolved
Hans Goudey
commented
`to be append` -> `to be appended`
|
||||
BKE_blendfile_link_append_context_library_add(lapp_context, this->filepath.c_str(), nullptr);
|
||||
|
||||
/* Requests all existing datablocks to be append again. */
|
||||
/* Requests all existing datablocks to be appended again. */
|
||||
ID *old_id;
|
||||
FOREACH_MAIN_ID_BEGIN (old_main, old_id) {
|
||||
ID_Type old_id_code = GS(old_id->name);
|
||||
|
|
|
@ -1361,7 +1361,8 @@ static int brush_asset_revert_exec(bContext *C, wmOperator * /*op*/)
|
|||
Brush *brush = BKE_paint_brush(paint);
|
||||
Main *asset_main = BKE_main_from_id(bmain, &brush->id);
|
||||
|
||||
/* Reload entire main, including texture dependencies. */
|
||||
/* Reload entire main, including texture dependencies. This relies on there
|
||||
brecht marked this conversation as resolved
Outdated
Hans Goudey
commented
I'd add a comment here that this relies on a single brush asset stored per file I'd add a comment here that this relies on a single brush asset stored per file
|
||||
* being only a single brush asset per blend file. */
|
||||
BKE_asset_weak_reference_main_reload(*bmain, *asset_main);
|
||||
|
||||
WM_main_add_notifier(NC_BRUSH | NA_EDITED, nullptr);
|
||||
|
|
Loading…
Reference in New Issue
I think this needs a
this == &other
check