[Bf-blender-cvs] [c4a6f70783] temp-layers-ui-table: Draw collection names using layout/button engine
Julian Eisel
noreply at git.blender.org
Thu Feb 9 14:03:47 CET 2017
Commit: c4a6f70783a783456ff15f44ef7ce97946ad2e0b
Author: Julian Eisel
Date: Thu Feb 9 05:22:40 2017 +0100
Branches: temp-layers-ui-table
https://developer.blender.org/rBc4a6f70783a783456ff15f44ef7ce97946ad2e0b
Draw collection names using layout/button engine
Instead of drawing it directly via BLF call.
===================================================================
M source/blender/editors/space_collections/collections_draw.c
M source/blender/editors/space_collections/collections_intern.h
M source/blender/editors/space_collections/space_collections.c
===================================================================
diff --git a/source/blender/editors/space_collections/collections_draw.c b/source/blender/editors/space_collections/collections_draw.c
index 188789f81b..7be02c304a 100644
--- a/source/blender/editors/space_collections/collections_draw.c
+++ b/source/blender/editors/space_collections/collections_draw.c
@@ -31,23 +31,26 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_table.h"
#include "collections_intern.h"
-void collections_draw_table(SpaceCollections *spc, const ARegion *ar)
+void collections_draw_table(const struct bContext *C, SpaceCollections *spc, ARegion *ar)
{
+ uiBlock *block = UI_block_begin(C, ar, __func__, 0);
+
UI_table_max_width_set(spc->table, BLI_rctf_size_x(&ar->v2d.tot));
- UI_table_draw(spc->table);
+ UI_table_draw(spc->table, block, UI_style_get_dpi());
+
+ UI_block_end(C, block);
+ UI_block_draw(C, block);
}
-void collections_draw_cell(void *rowdata, rcti drawrect)
+void collections_draw_cell(uiLayout *layout, void *rowdata, rcti UNUSED(drawrect))
{
LayerCollection *collection = rowdata;
- const char *name = collection->scene_collection->name;
-
- UI_ThemeColor(TH_TEXT);
- BLF_draw_default(drawrect.xmin, drawrect.ymin, 0.0f, name, strlen(name));
+ uiItemL(layout, collection->scene_collection->name, ICON_NONE);
}
diff --git a/source/blender/editors/space_collections/collections_intern.h b/source/blender/editors/space_collections/collections_intern.h
index fdf135775b..6cae7c0037 100644
--- a/source/blender/editors/space_collections/collections_intern.h
+++ b/source/blender/editors/space_collections/collections_intern.h
@@ -25,8 +25,10 @@
#ifndef __COLLECTIONS_INTERN_H__
#define __COLLECTIONS_INTERN_H__
+struct bContext;
struct rcti;
struct SceneLayer;
+struct uiLayout;
struct wmKeyConfig;
/* collections_edit.c */
@@ -39,8 +41,8 @@ void collections_operatortypes(void);
void collections_keymap(struct wmKeyConfig *keyconf);
/* collections_draw.c */
-void collections_draw_table(struct SpaceCollections *spc, const ARegion *ar);
-void collections_draw_cell(void *rowdata, struct rcti drawrect);
+void collections_draw_table(const struct bContext *C, struct SpaceCollections *spc, ARegion *ar);
+void collections_draw_cell(struct uiLayout *layout, void *rowdata, struct rcti drawrect);
#endif /* __COLLECTIONS_INTERN_H__ */
diff --git a/source/blender/editors/space_collections/space_collections.c b/source/blender/editors/space_collections/space_collections.c
index a6034988e2..70e51e4312 100644
--- a/source/blender/editors/space_collections/space_collections.c
+++ b/source/blender/editors/space_collections/space_collections.c
@@ -120,7 +120,7 @@ static void collections_main_region_draw(const bContext *C, ARegion *ar)
BLI_assert(BLI_listbase_count(&layer->layer_collections) == UI_table_get_rowcount(spc->table));
UNUSED_VARS_NDEBUG(layer);
- collections_draw_table(spc, ar);
+ collections_draw_table(C, spc, ar);
/* reset view matrix */
UI_view2d_view_restore(C);
More information about the Bf-blender-cvs
mailing list