Fix T52749: New Depsgraph - Render View Mask is not initialized correctly

This commit is contained in:
Sergey Sharybin 2017-09-14 16:12:01 +05:00
parent 3573f49bfd
commit 09c6c6c486
Notes: blender-bot 2023-02-14 06:34:45 +01:00
Referenced by issue #53683, 2.79a release
Referenced by issue #52749, New Depsgraph - Render View Mask is not initialized correctly
7 changed files with 62 additions and 8 deletions

View File

@ -32,6 +32,7 @@
* \ingroup bke
*/
struct EvaluationContext;
struct ImageUser;
struct Image;
struct ListBase;
@ -236,6 +237,9 @@ float *BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, struct Mas
void BKE_mask_layer_evaluate_animation(struct MaskLayer *masklay, const float ctime);
void BKE_mask_layer_evaluate_deform(struct MaskLayer *masklay, const float ctime);
void BKE_mask_eval_animation(struct EvaluationContext *eval_ctx, struct Mask *mask);
void BKE_mask_eval_update(struct EvaluationContext *eval_ctx, struct Mask *mask);
/* mask_rasterize.c */
struct MaskRasterHandle;
typedef struct MaskRasterHandle MaskRasterHandle;

View File

@ -42,6 +42,8 @@
#include "DNA_mask_types.h"
#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_mask.h"
@ -811,7 +813,6 @@ float *BKE_mask_point_segment_diff(MaskSpline *spline, MaskSplinePoint *point,
return diff_points;
}
static void mask_evaluate_apply_point_parent(MaskSplinePoint *point, float ctime)
{
float parent_matrix[3][3];
@ -828,7 +829,7 @@ void BKE_mask_layer_evaluate_animation(MaskLayer *masklay, const float ctime)
MaskLayerShape *masklay_shape_b;
int found;
if ((found = BKE_mask_layer_shape_find_frame_range(
masklay, ctime, &masklay_shape_a, &masklay_shape_b)))
masklay, ctime, &masklay_shape_a, &masklay_shape_b)))
{
if (found == 1) {
#if 0
@ -895,3 +896,27 @@ void BKE_mask_layer_evaluate_deform(MaskLayer *masklay, const float ctime)
/* end extra calc handles loop */
}
}
#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
void BKE_mask_eval_animation(struct EvaluationContext *eval_ctx, Mask *mask)
{
DEBUG_PRINT("%s on %s (%p)\n", __func__, mask->id.name, mask);
for (MaskLayer *mask_layer = mask->masklayers.first;
mask_layer != NULL;
mask_layer = mask_layer->next)
{
BKE_mask_layer_evaluate_animation(mask_layer, eval_ctx->ctime);
}
}
void BKE_mask_eval_update(struct EvaluationContext *eval_ctx, Mask *mask)
{
DEBUG_PRINT("%s on %s (%p)\n", __func__, mask->id.name, mask);
for (MaskLayer *mask_layer = mask->masklayers.first;
mask_layer != NULL;
mask_layer = mask_layer->next)
{
BKE_mask_layer_evaluate_deform(mask_layer, eval_ctx->ctime);
}
}

View File

@ -1940,8 +1940,6 @@ void BKE_scene_update_tagged(EvaluationContext *eval_ctx, Main *bmain, Scene *sc
#endif
{
DEG_evaluate_on_refresh(eval_ctx, scene->depsgraph, scene);
/* TODO(sergey): This is to beocme a node in new depsgraph. */
BKE_mask_update_scene(bmain, scene);
}
/* update sound system animation (TODO, move to depsgraph) */
@ -2058,11 +2056,10 @@ void BKE_scene_update_for_newframe_ex(EvaluationContext *eval_ctx, Main *bmain,
/* Following 2 functions are recursive
* so don't call within 'scene_update_tagged_recursive' */
DAG_scene_update_flags(bmain, sce, lay, true, do_invisible_flush); // only stuff that moves or needs display still
BKE_mask_evaluate_all_masks(bmain, ctime, true);
}
#endif
BKE_mask_evaluate_all_masks(bmain, ctime, true);
/* Update animated cache files for modifiers. */
BKE_cachefile_update_frame(bmain, sce, ctime, (((double)sce->r.frs_sec) / (double)sce->r.frs_sec_base));

View File

@ -81,6 +81,7 @@ extern "C" {
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_mball.h"
@ -1097,7 +1098,18 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask)
{
ID *mask_id = &mask->id;
add_id_node(mask_id);
/* F-Curve based animation/ */
build_animdata(mask_id);
/* Animation based on mask's shapes. */
add_operation_node(mask_id,
DEG_NODE_TYPE_ANIMATION,
function_bind(BKE_mask_eval_animation, _1, mask),
DEG_OPCODE_MASK_ANIMATION);
/* Final mask evaluation. */
add_operation_node(mask_id,
DEG_NODE_TYPE_PARAMETERS,
function_bind(BKE_mask_eval_update, _1, mask),
DEG_OPCODE_MASK_EVAL);
}
void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) {

View File

@ -1835,8 +1835,18 @@ void DepsgraphRelationBuilder::build_cachefile(CacheFile *cache_file) {
void DepsgraphRelationBuilder::build_mask(Mask *mask)
{
/* Animation. */
build_animdata(&mask->id);
ID *mask_id = &mask->id;
/* F-Curve animation. */
build_animdata(mask_id);
/* Own mask animation. */
OperationKey mask_animation_key(mask_id,
DEG_NODE_TYPE_ANIMATION,
DEG_OPCODE_MASK_ANIMATION);
TimeSourceKey time_src_key;
add_relation(time_src_key, mask_animation_key, "TimeSrc -> Mask Animation");
/* Final mask evaluation. */
ComponentKey parameters_key(mask_id, DEG_NODE_TYPE_PARAMETERS);
add_relation(mask_animation_key, parameters_key, "Mask Animation -> Mask Eval");
}
void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip)

View File

@ -119,6 +119,8 @@ static const char *stringify_opcode(eDepsOperation_Code opcode)
STRINGIFY_OPCODE(BONE_DONE);
STRINGIFY_OPCODE(PSYS_EVAL);
STRINGIFY_OPCODE(PSYS_EVAL_INIT);
STRINGIFY_OPCODE(MASK_ANIMATION);
STRINGIFY_OPCODE(MASK_EVAL);
case DEG_NUM_OPCODES: return "SpecialCase";
#undef STRINGIFY_OPCODE

View File

@ -219,6 +219,10 @@ typedef enum eDepsOperation_Code {
DEG_OPCODE_PSYS_EVAL_INIT,
DEG_OPCODE_PSYS_EVAL,
/* Masks ------------------------------------------- */
DEG_OPCODE_MASK_ANIMATION,
DEG_OPCODE_MASK_EVAL,
DEG_NUM_OPCODES,
} eDepsOperation_Code;