diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-03-26 21:13:34 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-03-27 15:01:47 +0300 |
commit | deda6a43fc710f30ceb9e3b30d1f8d79180fe8d1 (patch) | |
tree | cbe8c10668a697b47e5cbc219fef05ce24bceb60 /source/blender/draw/modes/edit_armature_mode.c | |
parent | 7ee41920fa0b7ed51a03fe4ee15c6fd782d294a8 (diff) |
Draw Engines: Make g_data struct part of the viewport storage
This makes viewport cache construction independant from each others and will allow multithread down the road.
Diffstat (limited to 'source/blender/draw/modes/edit_armature_mode.c')
-rw-r--r-- | source/blender/draw/modes/edit_armature_mode.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source/blender/draw/modes/edit_armature_mode.c b/source/blender/draw/modes/edit_armature_mode.c index a04ae608ce7..5361bd1c89f 100644 --- a/source/blender/draw/modes/edit_armature_mode.c +++ b/source/blender/draw/modes/edit_armature_mode.c @@ -42,6 +42,11 @@ typedef struct EDIT_ARMATURE_PassList { struct DRWPass *relationship; } EDIT_ARMATURE_PassList; +/* keep it under MAX_STORAGE */ +typedef struct EDIT_ARMATURE_StorageList { + struct g_data *g_data; +} EDIT_ARMATURE_StorageList; + typedef struct EDIT_ARMATURE_Data { char engine_name[32]; void *fbl; @@ -52,17 +57,21 @@ typedef struct EDIT_ARMATURE_Data { /* *********** STATIC *********** */ -static struct { +typedef struct g_data { DRWShadingGroup *relationship_lines; - EDIT_ARMATURE_Data *vedata; -} g_data = {NULL}; /* Transient data */ +} g_data; /* Transient data */ /* *********** FUNCTIONS *********** */ static void EDIT_ARMATURE_cache_init(void *vedata) { - EDIT_ARMATURE_PassList *psl = ((EDIT_ARMATURE_Data *)vedata)->psl; + EDIT_ARMATURE_StorageList *stl = ((EDIT_ARMATURE_Data *)vedata)->stl; + + if (!stl->g_data) { + /* Alloc transient pointers */ + stl->g_data = MEM_mallocN(sizeof(g_data), "g_data"); + } { /* Solid bones */ @@ -82,8 +91,8 @@ static void EDIT_ARMATURE_cache_init(void *vedata) psl->relationship = DRW_pass_create("Bone Relationship Pass", state); /* Relationship Lines */ - g_data.relationship_lines = shgroup_dynlines_uniform_color(psl->relationship, ts.colorWire); - DRW_shgroup_state_set(g_data.relationship_lines, DRW_STATE_STIPPLE_3); + stl->g_data->relationship_lines = shgroup_dynlines_uniform_color(psl->relationship, ts.colorWire); + DRW_shgroup_state_set(stl->g_data->relationship_lines, DRW_STATE_STIPPLE_3); } } @@ -91,10 +100,11 @@ static void EDIT_ARMATURE_cache_populate(void *vedata, Object *ob) { bArmature *arm = ob->data; EDIT_ARMATURE_PassList *psl = ((EDIT_ARMATURE_Data *)vedata)->psl; + EDIT_ARMATURE_StorageList *stl = ((EDIT_ARMATURE_Data *)vedata)->stl; if (ob->type == OB_ARMATURE) { if (arm->edbo) { - DRW_shgroup_armature_edit(ob, psl->bone_solid, psl->bone_wire, g_data.relationship_lines); + DRW_shgroup_armature_edit(ob, psl->bone_solid, psl->bone_wire, stl->g_data->relationship_lines); } } } |