[Bf-blender-cvs] [45afc02] master: Solve threading conflict related on proxy group's inverse matrix

Sergey Sharybin noreply at git.blender.org
Mon May 18 13:41:05 CEST 2015


Commit: 45afc02f11871b5c9f4d7bc6794761c6a4d883d8
Author: Sergey Sharybin
Date:   Mon May 18 14:06:46 2015 +0500
Branches: master
https://developer.blender.org/rB45afc02f11871b5c9f4d7bc6794761c6a4d883d8

Solve threading conflict related on proxy group's inverse matrix

It was possible that two threads will start calculating proxy group's inverted
matrix and store it in the object itself. This isn't good idea because it means
some threads might be using partially written matrix.

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

M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/object_update.c

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

diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index e04f1b1..e05fc91 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3031,8 +3031,9 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
 				// printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
 				if (ob->proxy_from->proxy_group) { /* transform proxy into group space */
 					Object *obg = ob->proxy_from->proxy_group;
-					invert_m4_m4(obg->imat, obg->obmat);
-					mul_m4_m4m4(ob->obmat, obg->imat, ob->proxy_from->obmat);
+					float imat[4][4];
+					invert_m4_m4(imat, obg->obmat);
+					mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat);
 					if (obg->dup_group) { /* should always be true */
 						add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
 					}
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index d9373b9..483968c 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -318,8 +318,9 @@ void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx),
 		if (ob->proxy_from->proxy_group) {
 			/* Transform proxy into group space. */
 			Object *obg = ob->proxy_from->proxy_group;
-			invert_m4_m4(obg->imat, obg->obmat);
-			mul_m4_m4m4(ob->obmat, obg->imat, ob->proxy_from->obmat);
+			float imat[4][4];
+			invert_m4_m4(imat, obg->obmat);
+			mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat);
 			/* Should always be true. */
 			if (obg->dup_group) {
 				add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);




More information about the Bf-blender-cvs mailing list