WIP: Onion Skinning Prototype #107641
|
@ -734,7 +734,10 @@ class RENDER_PT_onion_skins(RenderButtonsPanel, Panel):
|
|||
scene = context.scene
|
||||
|
||||
col = layout.column()
|
||||
col.prop(scene, "onion_skin_color")
|
||||
col.prop(scene, "onion_skin_color_left")
|
||||
col.prop(scene, "onion_skin_color_right")
|
||||
col.prop(scene, "os_relative_left")
|
||||
col.prop(scene, "os_relative_right")
|
||||
col.prop(scene, "onion_skin_alpha")
|
||||
|
||||
|
||||
|
|
|
@ -36,17 +36,20 @@ void OVERLAY_onion_skin_populate(OVERLAY_Data *vedata, Object *ob)
|
|||
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
|
||||
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);
|
||||
|
||||
Scene *scene = draw_ctx->scene;
|
||||
const float current_frame = BKE_scene_ctime_get(scene);
|
||||
|
||||
DRW_shgroup_uniform_float_copy(grp, "alpha", draw_ctx->scene->onion_skin_cache.alpha);
|
||||
|
||||
LISTBASE_FOREACH (OnionSkinMeshLink *, mesh_link, &scene->onion_skin_cache.objects) {
|
||||
if (!str_equals(ob->id.name, mesh_link->object->id.name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (compare_ff(mesh_link->frame, current_frame, FLT_EPSILON)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mesh_link->frame < current_frame - scene->onion_skin_cache.relative_left) {
|
||||
continue;
|
||||
}
|
||||
|
@ -54,10 +57,16 @@ void OVERLAY_onion_skin_populate(OVERLAY_Data *vedata, Object *ob)
|
|||
if (mesh_link->frame > current_frame + scene->onion_skin_cache.relative_right) {
|
||||
continue;
|
||||
}
|
||||
if (mesh_link->frame < current_frame) {
|
||||
DRW_shgroup_uniform_vec3_copy(grp, "color", draw_ctx->scene->onion_skin_cache.color_left);
|
||||
}
|
||||
else {
|
||||
DRW_shgroup_uniform_vec3_copy(grp, "color", draw_ctx->scene->onion_skin_cache.color_right);
|
||||
}
|
||||
|
||||
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
|
||||
if (geom) {
|
||||
DRW_shgroup_call(pd->onion_skin_grp, geom, ob);
|
||||
DRW_shgroup_call(grp, geom, ob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1866,9 +1866,11 @@ typedef struct OnionSkinMeshLink {
|
|||
} OnionSkinMeshLink;
|
||||
|
||||
typedef struct SceneOnionSkin {
|
||||
float color[3];
|
||||
float color_left[3];
|
||||
float color_right[3];
|
||||
float alpha;
|
||||
int relative_left, relative_right;
|
||||
char _pad[4];
|
||||
ListBase objects /* OnionSkinMeshLink */;
|
||||
} SceneOnionSkin;
|
||||
|
||||
|
|
|
@ -8442,11 +8442,32 @@ void RNA_def_scene(BlenderRNA *brna)
|
|||
RNA_def_property_struct_type(prop, "SceneGpencil");
|
||||
RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil settings for the scene");
|
||||
|
||||
prop = RNA_def_property(srna, "onion_skin_color", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "onion_skin_cache.color");
|
||||
prop = RNA_def_property(srna, "onion_skin_color_left", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "onion_skin_cache.color_left");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Onion Skin Color", "Define the color of onion skins");
|
||||
RNA_def_property_ui_text(prop, "Onion Skin Color Left", "Define the color of onion skins");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "onion_skin_color_right", PROP_FLOAT, PROP_COLOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "onion_skin_cache.color_right");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Onion Skin Color Right", "Define the color of onion skins");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "os_relative_left", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "onion_skin_cache.relative_left");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Onion Skin Range Left", "how far to the lef to draw onion skins");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "os_relative_right", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "onion_skin_cache.relative_right");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Onion Skin Range Right", "how far to the lef to draw onion skins");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "onion_skin_alpha", PROP_FLOAT, PROP_FACTOR);
|
||||
|
|
Loading…
Reference in New Issue