[Bf-blender-cvs] [a05d98884a3] master: RNA: disallow negative fcurve data-path array index

Campbell Barton noreply at git.blender.org
Tue Dec 15 02:49:38 CET 2020


Commit: a05d98884a3b0dae46c934c92c336b0b5d210dce
Author: Campbell Barton
Date:   Tue Dec 15 12:41:44 2020 +1100
Branches: master
https://developer.blender.org/rBa05d98884a3b0dae46c934c92c336b0b5d210dce

RNA: disallow negative fcurve data-path array index

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

M	source/blender/makesdna/DNA_anim_types.h
M	source/blender/makesrna/intern/rna_fcurve.c

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

diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index bfc72fdd45c..1eafa655195 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -612,7 +612,12 @@ typedef struct FCurve {
   char _pad[3];
 
   /* RNA - data link */
-  /** When the RNA property from `rna_path` is an array, use this to access the array index. */
+  /**
+   * When the RNA property from `rna_path` is an array, use this to access the array index.
+   *
+   * \note This may be negative (as it wasn't prevented in 2.91 and older).
+   * Currently it silently fails to resolve the data-path in this case.
+   */
   int array_index;
   /**
    * RNA-path to resolve data-access, see: #RNA_path_resolve_property.
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 8734984d4e1..475b4d33936 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -2341,7 +2341,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
   RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
 
   /* called 'index' when given as function arg */
-  prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
+  prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_UNSIGNED);
   RNA_def_property_ui_text(
       prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable");
   /* XXX need an update callback for this so that animation gets evaluated */



More information about the Bf-blender-cvs mailing list