Edit Mode overlay: Update cache on selection
This commit is contained in:
@@ -33,6 +33,7 @@ struct Batch;
|
||||
struct Mesh;
|
||||
|
||||
void BKE_mesh_batch_cache_dirty(struct Mesh *me);
|
||||
void BKE_mesh_batch_selection_dirty(struct Mesh *me);
|
||||
void BKE_mesh_batch_cache_clear(struct Mesh *me);
|
||||
void BKE_mesh_batch_cache_free(struct Mesh *me);
|
||||
struct Batch *BKE_mesh_batch_cache_get_all_edges(struct Mesh *me);
|
||||
|
||||
@@ -811,6 +811,30 @@ void BKE_mesh_batch_cache_dirty(struct Mesh *me)
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_mesh_batch_selection_dirty(struct Mesh *me)
|
||||
{
|
||||
MeshBatchCache *cache = me->batch_cache;
|
||||
if (cache) {
|
||||
/* TODO Separate Flag vbo */
|
||||
if (cache->overlay_triangles) {
|
||||
Batch_discard_all(cache->overlay_triangles);
|
||||
cache->overlay_triangles = NULL;
|
||||
}
|
||||
if (cache->overlay_loose_verts) {
|
||||
Batch_discard_all(cache->overlay_loose_verts);
|
||||
cache->overlay_loose_verts = NULL;
|
||||
}
|
||||
if (cache->overlay_loose_edges) {
|
||||
Batch_discard_all(cache->overlay_loose_edges);
|
||||
cache->overlay_loose_edges = NULL;
|
||||
}
|
||||
if (cache->overlay_facedots) {
|
||||
Batch_discard_all(cache->overlay_facedots);
|
||||
cache->overlay_facedots = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_mesh_batch_cache_clear(Mesh *me)
|
||||
{
|
||||
MeshBatchCache *cache = me->batch_cache;
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "BKE_icons.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mesh_render.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_scene.h"
|
||||
#include "BKE_screen.h"
|
||||
@@ -893,9 +894,18 @@ static void view3d_main_region_listener(bScreen *sc, ScrArea *sa, ARegion *ar, w
|
||||
break;
|
||||
case NC_GEOM:
|
||||
switch (wmn->data) {
|
||||
case ND_SELECT:
|
||||
{
|
||||
if (scene->obedit) {
|
||||
Object *ob = scene->obedit;
|
||||
if (ob->type == OB_MESH) {
|
||||
struct Mesh *me = ob->data;
|
||||
BKE_mesh_batch_selection_dirty(me);
|
||||
}
|
||||
}
|
||||
}
|
||||
case ND_DATA:
|
||||
case ND_VERTEX_GROUP:
|
||||
case ND_SELECT:
|
||||
ED_region_tag_redraw(ar);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user