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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-23 17:31:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-23 21:52:47 +0300
commit85c1e61375532e91d5fc37b1d754cf76c17f7721 (patch)
tree459ed56b972e108036dc1c7e097003f2b234fdd7 /source/blender/blenloader
parent2fa231a86b4179ed513da2469df877497b346162 (diff)
UI: Add user defined context menu
- Add/Remove from RMB context menu. - Stored in user preferences. - Access from Q key. See T55027.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c6
-rw-r--r--source/blender/blenloader/intern/writefile.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a169dc82d1f..22bd3ee3a17 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8713,6 +8713,12 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
user->uifonts.first = user->uifonts.last= NULL;
link_list(fd, &user->uistyles);
+ link_list(fd, &user->user_menu_items);
+
+ for (bUserMenuItem *umi = user->user_menu_items.first; umi; umi = umi->next) {
+ umi->prop = newdataadr(fd, umi->prop);
+ IDP_DirectLinkGroup_OrFree(&umi->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+ }
/* free fd->datamap again */
oldnewmap_free_unused(fd->datamap);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 9c55c949fcf..5652ad895d3 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1258,6 +1258,13 @@ static void write_userdef(WriteData *wd, const UserDef *userdef)
for (const uiStyle *style = userdef->uistyles.first; style; style = style->next) {
writestruct(wd, DATA, uiStyle, 1, style);
}
+
+ for (const bUserMenuItem *umi = userdef->user_menu_items.first; umi; umi = umi->next) {
+ writestruct(wd, DATA, bUserMenuItem, 1, umi);
+ if (umi->prop) {
+ IDP_WriteProperty(umi->prop, wd);
+ }
+ }
}
static void write_boid_state(WriteData *wd, BoidState *state)