[Bf-blender-cvs] [19716326f4f] greasepencil-object: MOAR compile fixes for GP branch after merge

Joshua Leung noreply at git.blender.org
Tue Apr 17 17:04:46 CEST 2018


Commit: 19716326f4f50ecbce3912b58402be37680be1ac
Author: Joshua Leung
Date:   Tue Apr 17 16:08:35 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB19716326f4f50ecbce3912b58402be37680be1ac

MOAR compile fixes for GP branch after merge

Lots more fixes for various little things that broke after the merge and the
fixes required for that.

Unfortunately, I've had to disable a few things to get Blender compiling
again - those will require a bit more attention to fix.

Things currently broken/disabled:
* Apply/Bake for Hook and Lattice modifiers - disabled as we need to rethink how
  this works after EvaluationContext removal. Probably should go to a new depsgraph
  copy (instead of working in main depsgraph).

* Helplines for GP point edit - 1c9690e7607bc990cc4a3e6ba839949bb83a78af has been
  temporarily reverted due to conflicts with multiedit changes

===================================================================

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/modifiers/intern/MOD_gpencilbuild.c
M	source/blender/modifiers/intern/MOD_gpencilhook.c
M	source/blender/modifiers/intern/MOD_gpencillattice.c
M	source/blender/modifiers/intern/MOD_gpencilopacity.c
M	source/blender/modifiers/intern/MOD_gpencilsmooth.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index aa13fe3cc1d..762b32cb00a 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -33,7 +33,7 @@
 
 struct CurveMapping;
 struct bContext;
-struct EvaluationContext;
+struct Depsgraph;
 struct ToolSettings;
 struct ListBase;
 struct bGPdata;
@@ -191,16 +191,16 @@ bool BKE_gpencil_vgroup_remove_point_weight(struct bGPDspoint *pt, int index);
 void BKE_gpencil_stroke_weights_duplicate(struct bGPDstroke *gps_src, struct bGPDstroke *gps_dst);
 
 /* GPencil geometry evaluation */
-void BKE_gpencil_eval_geometry(const struct EvaluationContext *eval_ctx, struct bGPdata *gpd);
+void BKE_gpencil_eval_geometry(const struct Depsgraph *depsgraph, struct bGPdata *gpd);
 
 /* modifiers */
 bool BKE_gpencil_has_geometry_modifiers(struct Object *ob);
 
 void BKE_gpencil_stroke_modifiers(
-		struct EvaluationContext *eval_ctx, struct Object *ob, 
+		struct Depsgraph *depsgraph, struct Object *ob, 
 		struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps, bool is_render);
 void BKE_gpencil_geometry_modifiers(
-		struct EvaluationContext *eval_ctx, struct Object *ob, 
+		struct Depsgraph *depsgraph, struct Object *ob, 
 		struct bGPDlayer *gpl, struct bGPDframe *gpf, bool is_render);
 
 void BKE_gpencil_array_modifier_instance_tfm(struct GpencilArrayModifierData *mmd, const int elem_idx[3], float r_mat[4][4]);
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 0d5b8a9981c..0f2baeb860b 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -353,7 +353,7 @@ bool BKE_gpencil_has_geometry_modifiers(Object *ob)
 }
 
 /* apply stroke modifiers */
-void BKE_gpencil_stroke_modifiers(EvaluationContext *eval_ctx, Object *ob, bGPDlayer *gpl, bGPDframe *UNUSED(gpf), bGPDstroke *gps, bool is_render)
+void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDframe *UNUSED(gpf), bGPDstroke *gps, bool is_render)
 {
 	ModifierData *md;
 	bGPdata *gpd = ob->data;
@@ -370,14 +370,14 @@ void BKE_gpencil_stroke_modifiers(EvaluationContext *eval_ctx, Object *ob, bGPDl
 			}
 			
 			if (mti && mti->deformStroke) {
-				mti->deformStroke(md, eval_ctx, ob, gpl, gps);
+				mti->deformStroke(md, depsgraph, ob, gpl, gps);
 			}
 		}
 	}
 }
 
 /* apply stroke geometry modifiers */
-void BKE_gpencil_geometry_modifiers(EvaluationContext *eval_ctx, Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bool is_render)
+void BKE_gpencil_geometry_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bool is_render)
 {
 	ModifierData *md;
 	bGPdata *gpd = ob->data;
@@ -395,7 +395,7 @@ void BKE_gpencil_geometry_modifiers(EvaluationContext *eval_ctx, Object *ob, bGP
 			}
 
 			if (mti->generateStrokes) {
-				mti->generateStrokes(md, eval_ctx, ob, gpl, gpf, id);
+				mti->generateStrokes(md, depsgraph, ob, gpl, gpf, id);
 			}
 		}
 		id++;
@@ -404,7 +404,7 @@ void BKE_gpencil_geometry_modifiers(EvaluationContext *eval_ctx, Object *ob, bGP
 
 /* *************************************************** */
 
-void BKE_gpencil_eval_geometry(const EvaluationContext *UNUSED(eval_ctx),
+void BKE_gpencil_eval_geometry(const Depsgraph *UNUSED(depsgraph),
                                bGPdata *UNUSED(gpd))
 {
 	/* TODO: Move "derived_gpf" logic here from DRW_gpencil_populate_datablock()?
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 1fee9dc7e50..f9620e56bac 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -470,18 +470,6 @@ static void gpencil_draw_onion_strokes(GpencilBatchCache *cache, GPENCIL_e_data
 }
 
 
-/* Construct eval_ctx from draw_ctx state
- * Note: This function copies CTX_data_eval_ctx() / DEG_evaluation_context_init_from_scene()
- */
-static void gpencil_init_evalctx_from_drawctx(const DRWContextState *draw_ctx, EvaluationContext *eval_ctx)
-{
-	Scene *scene = draw_ctx->scene;
-	
-	eval_ctx->depsgraph = BKE_scene_get_depsgraph(scene, draw_ctx->view_layer, false);
-	eval_ctx->ctime = BKE_scene_frame_get(scene);
-	eval_ctx->view_layer = draw_ctx->view_layer;
-}
-
 /* main function to draw strokes */
 static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, ToolSettings *ts, Object *ob,
 	bGPdata *gpd, bGPDlayer *gpl, bGPDframe *src_gpf, bGPDframe *derived_gpf,
@@ -502,15 +490,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 	 * (i.e. the thumbnail offscreen rendering fails) 
 	 */
 	const DRWContextState *draw_ctx = DRW_context_state_get();
-	const bContext *C = draw_ctx->evil_C;
-
-	EvaluationContext eval_ctx = {0};
-	if (C) {
-		CTX_data_eval_ctx(C, &eval_ctx);
-	}
-	else {
-		gpencil_init_evalctx_from_drawctx(draw_ctx, &eval_ctx);
-	}
+	Depsgraph *depsgraph = draw_ctx->depsgraph;
 
 	/* get parent matrix and save as static data */
 	ED_gpencil_parent_location(ob, gpd, gpl, viewmatrix);
@@ -520,7 +500,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 	if ((cache->is_dirty) && (ob->modifiers.first) && (!is_multiedit)) {
 		if (!stl->storage->simplify_modif) {
 			if (BKE_gpencil_has_geometry_modifiers(ob)) {
-				BKE_gpencil_geometry_modifiers(&eval_ctx, ob, gpl, derived_gpf, stl->storage->is_render);
+				BKE_gpencil_geometry_modifiers(depsgraph, ob, gpl, derived_gpf, stl->storage->is_render);
 			}
 		}
 	}
@@ -588,7 +568,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 			/* apply modifiers (only modify geometry, but not create ) */
 			if ((cache->is_dirty) && (ob->modifiers.first) && (!is_multiedit)) {
 				if (!stl->storage->simplify_modif) {
-					BKE_gpencil_stroke_modifiers(&eval_ctx, ob, gpl, derived_gpf, gps, stl->storage->is_render);
+					BKE_gpencil_stroke_modifiers(depsgraph, ob, gpl, derived_gpf, gps, stl->storage->is_render);
 				}
 			}
 
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 6d69784ec4d..6f640e692e6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1869,7 +1869,7 @@ static void gp_session_cleanup(tGPsdata *p)
 }
 
 /* init new stroke */
-static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, const Depsgraph *depsgraph)
+static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Depsgraph *depsgraph)
 {
 	Scene *scene = p->scene;
 	ToolSettings *ts = scene->toolsettings;
@@ -2321,7 +2321,7 @@ static void gpencil_draw_status_indicators(tGPsdata *p)
 /* ------------------------------- */
 
 /* create a new stroke point at the point indicated by the painting context */
-static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, const Depsgraph *depsgraph)
+static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgraph *depsgraph)
 {
 	bGPdata *gpd = p->gpd;
 	tGPspoint *pt = NULL;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 903d5336264..2257fe4d7bc 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1724,19 +1724,23 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
 		float cent[2];
 		float mval[3] = { x, y, 0.0f };
 
-		Object *ob = t->obedit;
 
-		if ((t->flag & T_POINTS) && (t->options & CTX_GPENCIL_STROKES) &&
-			(ob) && (ob->type == OB_GPENCIL))
-		{
-			float vecrot[3];
-			copy_v3_v3(vecrot, t->center);
-			mul_m4_v3(ob->obmat, vecrot);
-			projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
+#if 0 /* XXX: Fix from 1c9690e7607bc990cc4a3e6ba839949bb83a78af cannot be used anymore */
+		if ((t->flag & T_POINTS) && (t->options & CTX_GPENCIL_STROKES)) {
+			FOREACH_TRANS_DATA_CONTAINER (t, tc) {
+				Object *ob = tc->obedit;
+				float vecrot[3];
+				copy_v3_v3(vecrot, t->center);
+				mul_m4_v3(ob->obmat, vecrot);
+				projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
+			}
 		}
 		else {
 			projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
 		}
+#else
+		projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
+#endif
 
 		gpuPushMatrix();
 
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 154db06fb8e..f8d0d114a66 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1767,13 +1767,15 @@ void calculateCenterCursor(TransInfo *t, float r_center[3])
 	}
 	else if (t->options & CTX_GPENCIL_STROKES) {
 		/* move cursor in local space */
-		Object *ob = t->obedit;
-		float mat[3][3], imat[3][3];
+		FOREACH_TRANS_DATA_CONTAINER (t, tc) {
+			Object *ob = tc->obedit;
+			float mat[3][3], imat[3][3];
 
-		sub_v3_v3v3(r_center, r_center, ob->obmat[3]);
-		copy_m3_m4(mat, ob->obmat);
-		invert_m3_m3(imat, mat);
-		mul_m3_v3(imat, r_center);
+			sub_v3_v3v3(r_center, r_center, ob->obmat[3]);
+			copy_m3_m4(mat, ob->obmat);
+			invert_m3_m3(imat, mat);
+			mul_m3_v3(imat, r_center);
+		}
 	}
 }
 
diff --git a/source/blender/modifiers/intern/MOD_gpencilbuild.c b/source/blender/modifiers/intern/MOD_gpencilbuild.c
index 0d639d05d5a..b9323db3f5c 100644
--- a/source/blender/modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/modifiers/intern/MOD_gpencilbuild.c
@@ -44,6 +44,7 @@
 #include "BKE_gpencil.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
 
 #include "MOD_modifiertypes.h"
 #include "MOD_gpencil_util.h"
@@ -407,7 +408,7 @@ static void generateStrokes(ModifierData *md, Depsgraph *depsgraph,
 	GpencilBuildModifierData *mmd = (GpencilBuildModifierData *)md;
 	const bool reverse = (mmd->transition != GP_BUILD_TRANSITION_GROW);
 	
-	const float ctime = depsgraph->ctime;
+	const float ctime = DEG_get_cti

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list