diff options
Diffstat (limited to 'source/blender/editors/interface')
3 files changed, 61 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 694ae78ca9e..c08bad2d8e5 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -1477,6 +1477,9 @@ void UI_OT_eyedropper_gpencil_color(struct wmOperatorType *ot); struct uiListType *UI_UL_asset_view(void); +/* interface_templates.c */ +struct uiListType *UI_UL_cache_file_attribute_mappings(void); + /** * For use with #ui_rna_collection_search_update_fn. */ diff --git a/source/blender/editors/interface/interface_template_list.cc b/source/blender/editors/interface/interface_template_list.cc index 40675da71a9..f0b01927965 100644 --- a/source/blender/editors/interface/interface_template_list.cc +++ b/source/blender/editors/interface/interface_template_list.cc @@ -1309,6 +1309,7 @@ void ED_uilisttypes_ui() { WM_uilisttype_add(UI_UL_asset_view()); WM_uilisttype_add(UI_UL_cache_file_layers()); + WM_uilisttype_add(UI_UL_cache_file_attribute_mappings()); } /** \} */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 2b7ca1f8b71..3e300f80ab4 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6505,6 +6505,63 @@ bool uiTemplateCacheFilePointer(PointerRNA *ptr, const char *propname, PointerRN return true; } +static void cache_file_attribute_mapping_item(uiList *UNUSED(ui_list), + bContext *UNUSED(C), + uiLayout *layout, + PointerRNA *UNUSED(dataptr), + PointerRNA *itemptr, + int UNUSED(icon), + PointerRNA *UNUSED(active_dataptr), + const char *UNUSED(active_propname), + int UNUSED(index), + int UNUSED(flt_flag)) +{ + uiLayout *row = uiLayoutRow(layout, true); + uiItemR(row, itemptr, "name", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(row, itemptr, "mapping", UI_ITEM_R_NO_BG, "", ICON_NONE); + uiItemR(row, itemptr, "domain", UI_ITEM_R_NO_BG, "", ICON_NONE); +} + +uiListType *UI_UL_cache_file_attribute_mappings() +{ + uiListType *list_type = (uiListType *)MEM_callocN(sizeof(*list_type), __func__); + + BLI_strncpy(list_type->idname, "UI_UL_cache_file_attribute_mappings", sizeof(list_type->idname)); + list_type->draw_item = cache_file_attribute_mapping_item; + + return list_type; +} + +void uiTemplateCacheFileAttributeRemapping(uiLayout *layout, + const bContext *C, + PointerRNA *fileptr) +{ + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ + uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); + + uiLayout *row = uiLayoutRow(layout, false); + uiLayout *col = uiLayoutColumn(row, true); + + uiTemplateList(col, + (bContext *)C, + "UI_UL_cache_file_attribute_mappings", + "cache_file_attribute_mappings", + fileptr, + "attribute_mappings", + fileptr, + "active_attribute_mapping_index", + "", + 1, + 5, + UILST_LAYOUT_DEFAULT, + 1, + UI_TEMPLATE_LIST_FLAG_NONE); + + col = uiLayoutColumn(row, true); + uiItemO(col, "", ICON_ADD, "cachefile.attribute_mapping_add"); + uiItemO(col, "", ICON_REMOVE, "cachefile.attribute_mapping_remove"); +} + void uiTemplateCacheFile(uiLayout *layout, const bContext *C, PointerRNA *ptr, |