[Bf-blender-cvs] [17a209ea02e] temp-dynamic-overrides: Fix 'add new dynamic override' func, could store NULL rna path string.

Bastien Montagne noreply at git.blender.org
Sun May 13 19:14:48 CEST 2018


Commit: 17a209ea02e59b6bb99e411b06e6695af8b8e0ac
Author: Bastien Montagne
Date:   Sun May 13 19:11:05 2018 +0200
Branches: temp-dynamic-overrides
https://developer.blender.org/rB17a209ea02e59b6bb99e411b06e6695af8b8e0ac

Fix 'add new dynamic override' func, could store NULL rna path string.

Do not generate the dynamic override data in case a valid RNA path
cannot be built.

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

M	source/blender/blenkernel/intern/layer.c

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

diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index e44bf7c4dea..c828b6e7840 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -2004,6 +2004,12 @@ DynamicOverrideProperty *BKE_view_layer_override_property_add(
 			return NULL;
 	}
 
+	char *rna_path_str = RNA_path_from_ID_to_property_index(ptr, prop, 0, index);
+	if (rna_path_str == NULL) {
+		printf("%s: could not get valid RNA path!\n", __func__);
+		return NULL;
+	}
+
 	DynamicOverrideProperty *dyn_prop = MEM_callocN(sizeof(DynamicOverrideProperty), __func__);
 	dyn_prop->flag = DYN_OVERRIDE_PROP_USE;
 	dyn_prop->multiply_factor = 1.0f;
@@ -2013,7 +2019,7 @@ DynamicOverrideProperty *BKE_view_layer_override_property_add(
 	dyn_prop->root = owner_id;
 	dyn_prop->id_type = id_type;
 	dyn_prop->property_type = property_type;
-	dyn_prop->rna_path = RNA_path_from_ID_to_property_index(ptr, prop, 0, index);
+	dyn_prop->rna_path = rna_path_str;
 
 	/* TODO handle array. */
 	switch (RNA_property_type(prop)) {



More information about the Bf-blender-cvs mailing list