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:
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r--source/blender/editors/interface/interface_templates.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index c3b58e2d1c1..5fcfbd253a2 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_cache_library_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
@@ -49,6 +50,7 @@
#include "BLF_api.h"
#include "BLF_translation.h"
+#include "BKE_cache_library.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -73,6 +75,7 @@
#include "ED_util.h"
#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -357,6 +360,7 @@ static const char *template_id_browse_tip(StructRNA *type)
case ID_MSK: return N_("Browse Mask to be linked");
case ID_PAL: return N_("Browse Palette Data to be linked");
case ID_PC: return N_("Browse Paint Curve Data to be linked");
+ case ID_CL: return N_("Browse Cache Library Data to be linked");
}
}
return N_("Browse ID data to be linked");
@@ -3703,3 +3707,51 @@ void uiTemplateNodeSocket(uiLayout *layout, bContext *UNUSED(C), float *color)
UI_block_align_end(block);
}
+
+/************************* Cache Library Item **************************/
+
+static int cache_item_indent(int type)
+{
+ switch (type) {
+ case CACHE_TYPE_OBJECT:
+ return 0;
+
+ default:
+ return 1;
+ }
+}
+
+uiLayout *uiTemplateCacheLibraryItem(uiLayout *layout, bContext *UNUSED(C), CacheLibrary *UNUSED(cachelib),
+ Object *ob, int datatype, int index, int enabled)
+{
+ uiLayout *split, *row, *col;
+ int i;
+ char name[2*MAX_NAME];
+ int icon = ICON_NONE;
+
+ row = uiLayoutRow(layout, false);
+ uiLayoutSetEnabled(row, enabled);
+ uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
+
+ split = uiLayoutSplit(row, 0.0f, false);
+
+ for (i = 0; i < cache_item_indent(datatype); ++i)
+ uiItemL(split, "", ICON_NONE);
+
+ col = uiLayoutColumn(split, false);
+
+ BKE_cache_item_name(ob, datatype, index, name);
+ RNA_enum_icon_from_value(cache_library_data_type_items, datatype, &icon);
+ uiItemL(split, name, icon);
+
+ /* display read result */
+ split = uiLayoutSplit(row, 0.9f, false);
+ // XXX TODO store cache read results in a hash table and display them here
+// if (item && (item->flag & CACHE_ITEM_ENABLED))
+// RNA_enum_icon_from_value(cache_library_read_result_items, item->read_result, &icon);
+// else
+// icon = ICON_NONE;
+// uiItemL(split, NULL, icon);
+
+ return col;
+}