WIP: Brush assets project #106303
|
@ -191,6 +191,11 @@ struct Main {
|
||||||
*/
|
*/
|
||||||
bool is_global_main;
|
bool is_global_main;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if main used to store weakly referenced assets.
|
||||||
|
*/
|
||||||
|
bool is_asset_weak_reference_main;
|
||||||
|
|
||||||
BlendThumbnail *blen_thumb;
|
BlendThumbnail *blen_thumb;
|
||||||
|
|
||||||
Library *curlib;
|
Library *curlib;
|
||||||
|
|
|
@ -144,6 +144,7 @@ struct AssetWeakReferenceMain {
|
||||||
AssetWeakReferenceMain(std::string filepath)
|
AssetWeakReferenceMain(std::string filepath)
|
||||||
: filepath(std::move(filepath)), main(BKE_main_new())
|
: filepath(std::move(filepath)), main(BKE_main_new())
|
||||||
{
|
{
|
||||||
|
main->is_asset_weak_reference_main = true;
|
||||||
}
|
}
|
||||||
AssetWeakReferenceMain(const AssetWeakReferenceMain &) = delete;
|
AssetWeakReferenceMain(const AssetWeakReferenceMain &) = delete;
|
||||||
AssetWeakReferenceMain(AssetWeakReferenceMain &&other)
|
AssetWeakReferenceMain(AssetWeakReferenceMain &&other)
|
||||||
|
|
|
@ -1269,6 +1269,9 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl
|
||||||
if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0) {
|
if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0) {
|
||||||
DEG_id_type_tag(bmain, type);
|
DEG_id_type_tag(bmain, type);
|
||||||
}
|
}
|
||||||
|
if (bmain->is_asset_weak_reference_main) {
|
||||||
|
id->tag |= LIB_TAG_ASSET_MAIN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2);
|
BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2);
|
||||||
|
@ -1462,6 +1465,10 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int ori
|
||||||
DEG_id_type_tag(bmain, GS(new_id->name));
|
DEG_id_type_tag(bmain, GS(new_id->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bmain && bmain->is_asset_weak_reference_main) {
|
||||||
|
new_id->tag |= LIB_TAG_ASSET_MAIN;
|
||||||
|
}
|
||||||
|
|
||||||
*r_newid = new_id;
|
*r_newid = new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1006,7 +1006,7 @@ enum {
|
||||||
* Datablocks like this can not be linked to and from datablocks in regular main.
|
* Datablocks like this can not be linked to and from datablocks in regular main.
|
||||||
* They should stay isolated from each other.
|
* They should stay isolated from each other.
|
||||||
*/
|
*/
|
||||||
LIB_TAG_ASSET_MAIN = 1 << 20,
|
LIB_TAG_ASSET_MAIN = 1 << 27,
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue