[Bf-blender-cvs] [bd9602036a1] master: Fix pose-slide failing with array custom properties
Campbell Barton
noreply at git.blender.org
Wed Jan 11 03:06:45 CET 2023
Commit: bd9602036a182df778228a838c67feaf3e9299c4
Author: Campbell Barton
Date: Wed Jan 11 13:03:46 2023 +1100
Branches: master
https://developer.blender.org/rBbd9602036a182df778228a838c67feaf3e9299c4
Fix pose-slide failing with array custom properties
Pose slide would attempt to use non-array functions to get/set RNA
array properties. Asserting in debug mode.
===================================================================
M source/blender/editors/armature/pose_slide.c
===================================================================
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index e2610628f97..86675a1bef2 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -521,24 +521,75 @@ static void pose_slide_apply_props(tPoseSlideOp *pso,
switch (RNA_property_type(prop)) {
/* Continuous values that can be smoothly interpolated. */
case PROP_FLOAT: {
- float tval = RNA_property_float_get(&ptr, prop);
+ const bool is_array = RNA_property_array_check(prop);
+ float tval;
+ if (is_array) {
+ if (UNLIKELY((uint)fcu->array_index >= RNA_property_array_length(&ptr, prop))) {
+ break; /* Out of range, skip. */
+ }
+ tval = RNA_property_float_get_index(&ptr, prop, fcu->array_index);
+ }
+ else {
+ tval = RNA_property_float_get(&ptr, prop);
+ }
+
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
- RNA_property_float_set(&ptr, prop, tval);
+
+ if (is_array) {
+ RNA_property_float_set_index(&ptr, prop, fcu->array_index, tval);
+ }
+ else {
+ RNA_property_float_set(&ptr, prop, tval);
+ }
break;
}
case PROP_INT: {
- float tval = (float)RNA_property_int_get(&ptr, prop);
+ const bool is_array = RNA_property_array_check(prop);
+ float tval;
+ if (is_array) {
+ if (UNLIKELY((uint)fcu->array_index >= RNA_property_array_length(&ptr, prop))) {
+ break; /* Out of range, skip. */
+ }
+ tval = RNA_property_int_get_index(&ptr, prop, fcu->array_index);
+ }
+ else {
+ tval = RNA_property_int_get(&ptr, prop);
+ }
+
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
- RNA_property_int_set(&ptr, prop, (int)tval);
+
+ if (is_array) {
+ RNA_property_int_set_index(&ptr, prop, fcu->array_index, tval);
+ }
+ else {
+ RNA_property_int_set(&ptr, prop, tval);
+ }
break;
}
/* Values which can only take discrete values. */
case PROP_BOOLEAN: {
- float tval = (float)RNA_property_boolean_get(&ptr, prop);
+ const bool is_array = RNA_property_array_check(prop);
+ float tval;
+ if (is_array) {
+ if (UNLIKELY((uint)fcu->array_index >= RNA_property_array_length(&ptr, prop))) {
+ break; /* Out of range, skip. */
+ }
+ tval = RNA_property_boolean_get_index(&ptr, prop, fcu->array_index);
+ }
+ else {
+ tval = RNA_property_boolean_get(&ptr, prop);
+ }
+
pose_slide_apply_val(pso, fcu, pfl->ob, &tval);
- RNA_property_boolean_set(
- &ptr, prop, (int)tval); /* XXX: do we need threshold clamping here? */
+
+ /* XXX: do we need threshold clamping here? */
+ if (is_array) {
+ RNA_property_boolean_set_index(&ptr, prop, fcu->array_index, tval);
+ }
+ else {
+ RNA_property_boolean_set(&ptr, prop, tval);
+ }
break;
}
case PROP_ENUM: {
More information about the Bf-blender-cvs
mailing list