UI: Asset Shelf (Experimental Feature) #104831

Closed
Julian Eisel wants to merge 399 commits from asset-shelf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 12 additions and 2 deletions
Showing only changes of commit a2cf9a3386 - Show all commits

View File

@ -27,6 +27,7 @@ AssetShelfHook *ED_asset_shelf_hook_duplicate(const AssetShelfHook *hook)
LISTBASE_FOREACH (const AssetShelf *, shelf, &hook->shelves) {
AssetShelf *new_shelf = MEM_new<AssetShelf>("duplicate asset shelf",
blender::dna::shallow_copy(*shelf));
new_shelf->settings = shelf->settings;
BLI_addtail(&new_hook->shelves, new_shelf);
if (hook->active_shelf == shelf) {
new_hook->active_shelf = new_shelf;

View File

@ -29,17 +29,25 @@ AssetShelfSettings::AssetShelfSettings()
}
AssetShelfSettings::AssetShelfSettings(const AssetShelfSettings &other)
{
operator=(other);
}
AssetShelfSettings &AssetShelfSettings::operator=(const AssetShelfSettings &other)
{
/* Start with a shallow copy. */
memcpy(this, &other, sizeof(AssetShelfSettings));
next = prev = nullptr;
active_catalog_path = BLI_strdup(other.active_catalog_path);
JulianEisel marked this conversation as resolved Outdated

This can be null (noted in doc-string), crashes when duplicating an empty 3D view.

This can be null (noted in doc-string), crashes when duplicating an empty 3D view.
BLI_listbase_clear(&enabled_catalog_paths);
LISTBASE_FOREACH (LinkData *, catalog_path_item, &other.enabled_catalog_paths) {
LinkData *new_path_item = static_cast<LinkData *>(MEM_dupallocN(catalog_path_item));
new_path_item->data = BLI_strdup((char *)catalog_path_item->data);
LinkData *new_path_item = BLI_genericNodeN(BLI_strdup((char *)catalog_path_item->data));
BLI_addtail(&enabled_catalog_paths, new_path_item);
}
return *this;
}
AssetShelfSettings::~AssetShelfSettings()

View File

@ -775,6 +775,7 @@ typedef struct AssetShelfSettings {
AssetShelfSettings();
/* Proper deep copy. */
AssetShelfSettings(const AssetShelfSettings &other);
AssetShelfSettings &operator=(const AssetShelfSettings &other);
~AssetShelfSettings();
#endif
} AssetShelfSettings;