WIP: Onion Skinning Prototype #107641

Closed
Christoph Lendenfeld wants to merge 22 commits from ChrisLend/blender:onion_skin_test into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 20 additions and 8 deletions
Showing only changes of commit 1dc4512cde - Show all commits

View File

@ -18,6 +18,17 @@ void OVERLAY_onion_skin_init(OVERLAY_Data *vedata)
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
}
static bool str_equals(const char *__restrict str, const char *__restrict start)
{
for (; *str && *start; str++, start++) {
if (*str != *start) {
return false;
}
}
return (*start == *str);
}
void OVERLAY_onion_skin_populate(OVERLAY_Data *vedata, Object *ob)
{
OVERLAY_PrivateData *pd = vedata->stl->pd;
@ -29,20 +40,22 @@ void OVERLAY_onion_skin_populate(OVERLAY_Data *vedata, Object *ob)
DRW_shgroup_uniform_float_copy(grp, "alpha", draw_ctx->scene->onion_skin_cache.alpha);
LISTBASE_FOREACH (OnionSkinMeshLink *, mesh_link, &draw_ctx->scene->onion_skin_cache.objects) {
if (ob != mesh_link->object) {
// if(BKE_id_comp)
if (!str_equals(ob->id.name, mesh_link->object->id.name)) {
continue;
}
Mesh *mesh = BKE_mesh_from_object(ob);
/* Mesh *mesh = BKE_mesh_from_object(ob);
struct GPUBatch *geom = DRW_mesh_batch_cache_get_surface(mesh);
if (geom) {
DRW_shgroup_call(pd->onion_skin_grp, geom, ob);
} */
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
DRW_shgroup_call(pd->onion_skin_grp, geom, ob);
}
}
/* struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
DRW_shgroup_call(pd->onion_skin_grp, geom, ob);
} */
}
void OVERLAY_onion_skin_draw(OVERLAY_Data *vedata)

View File

@ -67,8 +67,7 @@ static int onion_skin_add_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT | ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}