diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-26 15:13:53 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-26 16:16:52 +0300 |
commit | 9270c15af8fc6b1fccf6dd6976f5bd0fe0342790 (patch) | |
tree | b12ee92a094db4d0b8ad5e7022df25ac3e0b071f /source/blender/editors/gpencil/gpencil_brush.c | |
parent | ad18d331d773518088b1b918038244bc5c5d253d (diff) |
GPencil: Get current frame from scene
This change makes it so current frame is queried from a scene rather
than from a dependency graph. This makes it possible to avoid the
fact that dependency graph might not be fully evaluated yet.
There are still some cases where it frame is queried from the graph,
but those seems to be in a code path where we need to ensure valid
dependency graph anyway.
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5349
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_brush.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_brush.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 7d866aedd87..2df5f6a0cec 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -87,7 +87,6 @@ typedef struct tGP_BrushEditData { /* Current editor/region/etc. */ /* NOTE: This stuff is mainly needed to handle 3D view projection stuff... */ - Depsgraph *depsgraph; struct Main *bmain; Scene *scene; Object *object; @@ -1052,8 +1051,8 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) Object *ob = CTX_data_active_object(C); bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); - int cfra_eval = (int)DEG_get_ctime(depsgraph); + Scene *scene = CTX_data_scene(C); + int cfra_eval = CFRA; bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra_eval, GP_GETFRAME_ADD_NEW); bGPDstroke *gps; @@ -1224,7 +1223,6 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op) gso = MEM_callocN(sizeof(tGP_BrushEditData), "tGP_BrushEditData"); op->customdata = gso; - gso->depsgraph = CTX_data_depsgraph(C); gso->bmain = CTX_data_main(C); /* store state */ gso->settings = gpsculpt_get_settings(scene); @@ -1400,7 +1398,8 @@ static void gpsculpt_brush_init_stroke(tGP_BrushEditData *gso) bGPdata *gpd = gso->gpd; bGPDlayer *gpl; - int cfra_eval = (int)DEG_get_ctime(gso->depsgraph); + Scene *scene = gso->scene; + int cfra_eval = CFRA; /* only try to add a new frame if this is the first stroke, or the frame has changed */ if ((gpd == NULL) || (cfra_eval == gso->cfra)) { |