Fix T85223: Some modifier panels can dissapear in old files

The problem is that each uiBlock needs to be assigned a unique name,
but when there can be multiple modifiers of the same type, we use the
panel sort order for the unique part of the string. However, the most
recent test file has 1200+ panels in the property editor, so 4
characters isn't enough for a unique string.

That's not a situation I expected, but it makes sense, because we don't
remove legacy panels with unused types when loading old files. So they
tend to accumulate a bunch of unused panels. That's why this works fine
with a new property editor, it doesn't all of the extra old panels.

These panels must be stored for the expansion status and order, but
arguably we could cull unused panels on save. However, simply increasing
the length of the unique panel string is a valid fix in this situation.
In the future, we can look into removing unused panels when saving.
This commit is contained in:
Hans Goudey 2021-04-19 12:25:25 -05:00
parent 6f761c7110
commit b8b7b47a00
Notes: blender-bot 2023-02-14 07:45:38 +01:00
Referenced by issue #85223, Modifiers disappear when you have multiples of them (opening old files)
1 changed files with 1 additions and 1 deletions

View File

@ -1729,7 +1729,7 @@ struct Panel *UI_panel_add_instanced(const struct bContext *C,
struct PointerRNA *custom_data);
void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region);
#define INSTANCED_PANEL_UNIQUE_STR_LEN 4
#define INSTANCED_PANEL_UNIQUE_STR_LEN 16
void UI_list_panel_unique_str(struct Panel *panel, char *r_name);
typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname);