Fix T70447: 'WholeCharacter' Keying set doesn't key None properties

The issue is that `something.path_resolve('"custom_property"')` raises a
`ValueError` when the custom property is set to `None`. Since `None`
cannot be stored in a keyframe anyway, the property is now silently
skipped. Not having an explicit value is the closest we can get to
`None`. This of course breaks when the value should be `None` in between
not-`None` values, but I would consider that as a problem with the rig,
and not something Blender can fix.
This commit is contained in:
Sybren A. Stüvel 2019-12-10 15:12:15 +01:00
parent 96a1bc2997
commit 4d0643a185
Notes: blender-bot 2023-02-14 19:07:42 +01:00
Referenced by issue blender/blender-addons#70447, 'WholeCharacter' Keying set doesn't key the whole character [due to non-editable custom property]. (Traceback error in console)
1 changed files with 7 additions and 1 deletions

View File

@ -521,7 +521,13 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
prop_rna = type(bone).bl_rna.properties.get(prop, None)
if prop_rna is None:
prop_path = '["%s"]' % prop
if bone.path_resolve(prop_path, False).rna_type in prop_type_compat:
try:
rna_property = bone.path_resolve(prop_path, False)
except ValueError as ex:
# This happens when a custom property is set to None. In that case it cannot
# be converted to an FCurve-compatible value, so we can't keyframe it anyway.
continue
if rna_property.rna_type in prop_type_compat:
ksi.addProp(ks, bone, prop_path)
elif prop_rna.is_animatable:
ksi.addProp(ks, bone, prop)