diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2021-05-18 02:03:01 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2021-06-03 21:17:17 +0300 |
commit | dba3fb9e091acfa7d2144468a220b2b0d577c15d (patch) | |
tree | 817e5c84a1f7319b7ef7811226dabcae615b63ea /source/blender/editors | |
parent | 3e695a27cdfad560d0b28e742cfa069d098200d6 (diff) |
Overlay: Flash on Mode Transfer overlay
This implements T87633
This overlay renders a flash animation on the target object when
transfering the mode to it using the mode transfer operator.
This provides visual feedback when switching between objects without
extra overlays that affect the general color and lighting in the scene.
Differences with the design task:
- This uses just a fade out animation instead of a fade in/out animation.
The code is ready for fade in/out, but as the rest of the overlays
(face sets, masks...) change instantly without animation, having a fade
in/out effect gives the impression that the object flashes twice (once
for the face sets, twice for the peak alpha of the flash animation).
- The rendering uses a flat color without fresnel for now, but this can
be improved in the future to make it look more like the shader in the
prototype.
- Not enabled by default (can be enabled in the overlays panel), maybe
the defaults can change for 3.0 to disable fade inactive and enable this
instead.
Reviewed By: jbakker, JulienKaspar
Differential Revision: https://developer.blender.org/D11055
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/object/object_modes.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index edf9afd1fd6..3d1a5ac2d62 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -30,6 +30,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "PIL_time.h" + #include "BLT_translation.h" #include "BKE_context.h" @@ -438,6 +440,13 @@ static void object_transfer_mode_reposition_view_pivot(bContext *C, const int mv ups->last_stroke_valid = true; } +static void object_overlay_mode_transfer_animation_start(bContext *C, Object *ob_dst) +{ + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + Object *ob_dst_eval = DEG_get_evaluated_object(depsgraph, ob_dst); + ob_dst_eval->runtime.overlay_mode_transfer_start_time = PIL_check_seconds_timer(); +} + static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Base *base_dst) { Scene *scene = CTX_data_scene(C); @@ -475,6 +484,8 @@ static bool object_transfer_mode_to_base(bContext *C, wmOperator *op, Base *base ob_dst_orig = DEG_get_original_object(ob_dst); ED_object_mode_set_ex(C, last_mode, true, op->reports); + object_overlay_mode_transfer_animation_start(C, ob_dst); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); WM_toolsystem_update_from_context_view3d(C); mode_transfered = true; |