[Bf-blender-cvs] [64de8c8f0de] blender2.8: Missed in last merge from master

Campbell Barton noreply at git.blender.org
Wed Sep 27 23:23:43 CEST 2017


Commit: 64de8c8f0de018f5d2b075db738d7b6322d6d21a
Author: Campbell Barton
Date:   Thu Sep 28 07:30:05 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB64de8c8f0de018f5d2b075db738d7b6322d6d21a

Missed in last merge from master

Local changes built, but merge-commit needed amending.

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

M	source/blender/editors/armature/armature_skinning.c
M	source/blender/editors/include/ED_armature.h
M	source/blender/editors/object/object_relations.c
M	source/blender/editors/sculpt_paint/paint_intern.h
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/sculpt_paint/paint_vertex_proj.c

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

diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 3f4a80c9a27..72b4837c1b8 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -250,8 +250,9 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
 	}
 }
 
-static void add_verts_to_dgroups(ReportList *reports, const bContext *C, Scene *scene, Object *ob, Object *par,
-                                 int heat, const bool mirror)
+static void add_verts_to_dgroups(
+        ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
+        int heat, const bool mirror)
 {
 	/* This functions implements the automatic computation of vertex group
 	 * weights, either through envelopes or using a heat equilibrium.
@@ -265,7 +266,6 @@ static void add_verts_to_dgroups(ReportList *reports, const bContext *C, Scene *
 	 * when parenting, or simply the original mesh coords.
 	 */
 
-	EvaluationContext eval_ctx;
 	bArmature *arm = par->data;
 	Bone **bonelist, *bone;
 	bDeformGroup **dgrouplist, **dgroupflip;
@@ -279,8 +279,6 @@ static void add_verts_to_dgroups(ReportList *reports, const bContext *C, Scene *
 	int wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT);
 	struct { Object *armob; void *list; int heat; } looper_data;
 
-	CTX_data_eval_ctx(C, &eval_ctx);
-
 	looper_data.armob = par;
 	looper_data.heat = heat;
 	looper_data.list = NULL;
@@ -378,7 +376,7 @@ static void add_verts_to_dgroups(ReportList *reports, const bContext *C, Scene *
 
 	if (wpmode) {
 		/* if in weight paint mode, use final verts from derivedmesh */
-		DerivedMesh *dm = mesh_get_derived_final(&eval_ctx, scene, ob, CD_MASK_BAREMESH);
+		DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH);
 		
 		if (dm->foreachMappedVert) {
 			mesh_get_mapped_verts_coords(dm, verts, mesh->totvert);
@@ -430,8 +428,9 @@ static void add_verts_to_dgroups(ReportList *reports, const bContext *C, Scene *
 	MEM_freeN(verts);
 }
 
-void create_vgroups_from_armature(ReportList *reports, const bContext *C, Scene *scene, Object *ob, Object *par,
-                                  const int mode, const bool mirror)
+void create_vgroups_from_armature(
+        ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
+        const int mode, const bool mirror)
 {
 	/* Lets try to create some vertex groups 
 	 * based on the bones of the parent armature.
@@ -457,6 +456,6 @@ void create_vgroups_from_armature(ReportList *reports, const bContext *C, Scene
 		 * that are populated with the vertices for which the
 		 * bone is closest.
 		 */
-		add_verts_to_dgroups(reports, C, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
+		add_verts_to_dgroups(reports, eval_ctx, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
 	}
 }
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index bbc6e8912c3..d65ea8e79f0 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -39,6 +39,7 @@ struct BaseLegacy;
 struct bContext;
 struct Bone;
 struct bPoseChannel;
+struct EvaluationContext;
 struct IDProperty;
 struct ListBase;
 struct MeshDeformModifierData;
@@ -174,8 +175,9 @@ void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do
 #define ARM_GROUPS_ENVELOPE 2
 #define ARM_GROUPS_AUTO     3
 
-void create_vgroups_from_armature(struct ReportList *reports, const struct bContext *C, struct Scene *scene,
-                                  struct Object *ob, struct Object *par, const int mode, const bool mirror);
+void create_vgroups_from_armature(
+        struct ReportList *reports, const struct EvaluationContext *eval_ctx, struct Scene *scene,
+        struct Object *ob, struct Object *par, const int mode, const bool mirror);
 
 /* if bone is already in list, pass it as param to ignore it */
 void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 04ac42a5471..c255ce4a45a 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -784,13 +784,15 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
 				copy_v3_v3(ob->loc, vec);
 			}
 			else if (pararm && (ob->type == OB_MESH) && (par->type == OB_ARMATURE)) {
-				if (partype == PAR_ARMATURE_NAME)
-					create_vgroups_from_armature(reports, C, scene, ob, par, ARM_GROUPS_NAME, false);
-				else if (partype == PAR_ARMATURE_ENVELOPE)
-					create_vgroups_from_armature(reports, C, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
+				if (partype == PAR_ARMATURE_NAME) {
+					create_vgroups_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_NAME, false);
+				}
+				else if (partype == PAR_ARMATURE_ENVELOPE) {
+					create_vgroups_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
+				}
 				else if (partype == PAR_ARMATURE_AUTO) {
 					WM_cursor_wait(1);
-					create_vgroups_from_armature(reports, C, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
+					create_vgroups_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
 					WM_cursor_wait(0);
 				}
 				/* get corrected inverse */
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index a320cf50d72..2b866118f19 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -127,10 +127,10 @@ unsigned int vpaint_get_current_col(struct Scene *scene, struct VPaint *vp);
 /* paint_vertex_proj.c */
 struct VertProjHandle;
 struct VertProjHandle *ED_vpaint_proj_handle_create(
-        const struct bContext *C, struct Scene *scene, struct Object *ob,
+        const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob,
         struct DMCoNo **r_vcosnos);
 void  ED_vpaint_proj_handle_update(
-        const struct bContext *C, struct VertProjHandle *vp_handle,
+        const struct EvaluationContext *eval_ctx, struct VertProjHandle *vp_handle,
         /* runtime vars */
         struct ARegion *ar, const float mval_fl[2]);
 void  ED_vpaint_proj_handle_free(
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 0a82ac88403..9046a768eaf 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1727,11 +1727,11 @@ static void do_weight_paint_vertex(
 
 
 /* Toggle operator for turning vertex paint mode on or off (copied from sculpt.c) */
-static void vertex_paint_init_session(Scene *scene, Object *ob)
+static void vertex_paint_init_session(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
 {
 	if (ob->sculpt == NULL) {
 		ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session");
-		BKE_sculpt_update_mesh_elements(scene, scene->toolsettings->sculpt, ob, 0, false);
+		BKE_sculpt_update_mesh_elements(eval_ctx, scene, scene->toolsettings->sculpt, ob, 0, false);
 	}
 }
 
@@ -1848,6 +1848,10 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 		paint_cursor_delete_textures();
 	}
 	else {
+		EvaluationContext eval_ctx;
+
+		CTX_data_eval_ctx(C, &eval_ctx);
+
 		ob->mode |= mode_flag;
 
 		if (wp == NULL)
@@ -1865,8 +1869,10 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 		if (ob->sculpt) {
 			BKE_sculptsession_free(ob);
 		}
-		vertex_paint_init_session(scene, ob);
+		vertex_paint_init_session(&eval_ctx, scene, ob);
 	}
+
+	BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
 	
 	/* Weightpaint works by overriding colors in mesh,
 	 * so need to make sure we recalc on enter and
@@ -2142,6 +2148,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
 	bool *defbase_sel;
 	SculptSession *ss = ob->sculpt;
 	VPaint *vd = CTX_data_tool_settings(C)->wpaint;
+	EvaluationContext eval_ctx;
 
 	float mat[4][4], imat[4][4];
 
@@ -2149,6 +2156,8 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
 		return false;
 	}
 
+	CTX_data_eval_ctx(C, &eval_ctx);
+
 	{
 		/* check if we are attempting to paint onto a locked vertex group,
 		 * and other options disallow it from doing anything useful */
@@ -2242,7 +2251,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
 
 	/* painting on subsurfs should give correct points too, this returns me->totvert amount */
 	ob->sculpt->building_vp_handle = true;
-	wpd->vp_handle = ED_vpaint_proj_handle_create(scene, ob, &wpd->vertexcosnos);
+	wpd->vp_handle = ED_vpaint_proj_handle_create(&eval_ctx, scene, ob, &wpd->vertexcosnos);
 	ob->sculpt->building_vp_handle = false;
 
 	/* imat for normals */
@@ -2251,7 +2260,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
 	copy_m3_m4(wpd->wpimat, imat);
 
 	/* If not previously created, create vertex/weight paint mode session data */
-	vertex_paint_init_session(scene, ob);
+	vertex_paint_init_session(&eval_ctx, scene, ob);
 	vwpaint_update_cache_invariants(C, vd, ss, op, mouse);
 	vertex_paint_init_session_data(ts, ob);
 
@@ -2900,6 +2909,8 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 	/* also needed for "View Selected" on last stroke */
 	paint_last_stroke_update(scene, vc->ar, mval);
 
+	BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
+
 	DEG_id_tag_update(ob->data, 0);
 	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
 	swap_m4m4(wpd->vc.rv3d->persmat, mat);
@@ -3117,6 +3128,10 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 		paint_cursor_delete_textures();
 	}
 	else {
+		EvaluationContext eval_ctx;
+
+		CTX_data_eval_ctx(C, &eval_ctx);
+
 		ob->mode |= mode_flag;
 
 		if (me->mloopcol == NULL) {
@@ -3138,9 +3153,11 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
 			

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list