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.
3 changed files with 15 additions and 7 deletions
Showing only changes of commit ba45e6bca3 - Show all commits

View File

@ -39,18 +39,22 @@ void OVERLAY_onion_skin_populate(OVERLAY_Data *vedata, Object *ob)
DRW_shgroup_uniform_vec3_copy(grp, "color", draw_ctx->scene->onion_skin_cache.color);
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(BKE_id_comp)
Scene *scene = draw_ctx->scene;
const float current_frame = BKE_scene_ctime_get(scene);
LISTBASE_FOREACH (OnionSkinMeshLink *, mesh_link, &scene->onion_skin_cache.objects) {
if (!str_equals(ob->id.name, mesh_link->object->id.name)) {
continue;
}
/* 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);
} */
if (mesh_link->frame < current_frame - scene->onion_skin_cache.relative_left) {
continue;
}
if (mesh_link->frame > current_frame + scene->onion_skin_cache.relative_right) {
continue;
}
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
DRW_shgroup_call(pd->onion_skin_grp, geom, ob);

View File

@ -4,6 +4,7 @@
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DNA_scene_types.h"
@ -60,6 +61,7 @@ static int onion_skin_add_exec(bContext *C, wmOperator *op)
OnionSkinMeshLink *link = MEM_callocN(sizeof(OnionSkinMeshLink), "onion skin mesh link");
link->object = ob_new;
ob_new->adt = NULL;
link->frame = BKE_scene_ctime_get(scene);
BLI_addtail(&scene->onion_skin_cache.objects, link);
ED_outliner_select_sync_from_object_tag(C);

View File

@ -1861,6 +1861,8 @@ typedef struct OnionSkinMeshLink {
struct OnionSkinMeshLink *prev, *next;
/* Having a Mesh pointer here breaks compilation. Complains about "extern C" issues. */
struct Object *object;
float frame;
char _pad[4];
} OnionSkinMeshLink;
typedef struct SceneOnionSkin {