Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-07-07 20:24:06 +0300
committerJulian Eisel <julian@blender.org>2021-07-07 20:24:06 +0300
commitf4cb3ccd9c070dce24db98436ccf2e0e70000077 (patch)
tree11bdbb53e466224db234bf35ef73e0fff67dac70 /source/blender/makesdna/DNA_space_types.h
parentfb98f22ddd5c814c01facacb48284acdfe8099fd (diff)
Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would often get lost in the Asset Browser (scrolled out of view). It would also get deactivated. This patch makes sure that if an asset is active whose ID gets renamed, it is kept active and visible. That is important for a fast, uninterrupted asset creation workflow, where users often rename assets while working in the asset browser. Old code stored the new file-name to identify a file after re-reading the file-list after the rename. For assets that doesn't work because there may be multiple assets with the same name. Here the simple solution of just storing the pointer to the renamed ID is chosen, rather than relying on the file-name in this case. (Should be fine with undo, since the ID * reference is short lived, it's not stored over possible undo steps. If it turns out to have issues, I rather switch to a rename_id_uuid, but keep that separate from the file->uid). Reviewed by: Sybren Stüvel Differential Revision: https://developer.blender.org/D11119
Diffstat (limited to 'source/blender/makesdna/DNA_space_types.h')
-rw-r--r--source/blender/makesdna/DNA_space_types.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 557343f79cd..73a44ec16bb 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -727,6 +727,12 @@ typedef struct FileSelectParams {
char renamefile[256];
short rename_flag;
+ char _pad[4];
+ /** An ID that was just renamed. Used to identify a renamed asset file over re-reads, similar to
+ * `renamefile` but for local IDs (takes precedence). Don't keep this stored across handlers!
+ * Would break on undo. */
+ const ID *rename_id;
+ void *_pad3;
/** List of filetypes to filter (FILE_MAXFILE). */
char filter_glob[256];
@@ -734,7 +740,6 @@ typedef struct FileSelectParams {
/** Text items name must match to be shown. */
char filter_search[64];
/** Same as filter, but for ID types (aka library groups). */
- int _pad0;
uint64_t filter_id;
/** Active file used for keyboard navigation. */