[Bf-blender-cvs] [cf8642d9fac] blender-v2.91-release: Fix T81949: Child Of Constraint can't assign inverse matrix

Campbell Barton noreply at git.blender.org
Thu Oct 22 09:47:44 CEST 2020


Commit: cf8642d9fac4cec7d3ee434a5403c2bbc8c5c21c
Author: Campbell Barton
Date:   Thu Oct 22 18:42:08 2020 +1100
Branches: blender-v2.91-release
https://developer.blender.org/rBcf8642d9fac4cec7d3ee434a5403c2bbc8c5c21c

Fix T81949: Child Of Constraint can't assign inverse matrix

Caused by ad70d4b0956f5, assigning the matrix now
clears the flag that would reset it.

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

M	source/blender/makesrna/intern/rna_constraint.c

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

diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 653056e4dc1..76b419926a1 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -512,6 +512,17 @@ static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRN
   rna_Constraint_update(bmain, scene, ptr);
 }
 
+/* Update only needed so this isn't overwritten on first evaluation. */
+static void rna_Constraint_childof_inverse_matrix_update(Main *bmain,
+                                                         Scene *scene,
+                                                         PointerRNA *ptr)
+{
+  bConstraint *con = ptr->data;
+  bChildOfConstraint *data = con->data;
+  data->flag &= ~CHILDOF_SET_INVERSE;
+  rna_Constraint_update(bmain, scene, ptr);
+}
+
 static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
 {
   bConstraint *con = ptr->data;
@@ -999,7 +1010,8 @@ static void rna_def_constraint_childof(BlenderRNA *brna)
   RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
-  RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+  RNA_def_property_update(
+      prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_childof_inverse_matrix_update");
 
   RNA_define_lib_overridable(false);
 }



More information about the Bf-blender-cvs mailing list