diff --git a/source/blender/editors/animation/keyframing.cc b/source/blender/editors/animation/keyframing.cc index 0516f152d2562ef2cb7945727188067126e47369..1fb8f268d1c443df5f404add99cb1fac7df6e835 100644 --- a/source/blender/editors/animation/keyframing.cc +++ b/source/blender/editors/animation/keyframing.cc @@ -252,6 +252,35 @@ static int insert_key_with_keyingset(bContext *C, wmOperator *op, KeyingSet *ks) return OPERATOR_FINISHED; } +static bool is_idproperty_keyable(IDProperty *prop, const PropertyRNA *property_rna) +{ + if (RNA_property_is_runtime(property_rna)) { + return false; + } + + if (ELEM(prop->type, + eIDPropertyType::IDP_BOOLEAN, + eIDPropertyType::IDP_INT, + eIDPropertyType::IDP_FLOAT, + eIDPropertyType::IDP_DOUBLE)) + { + return true; + } + + if (prop->type == eIDPropertyType::IDP_ARRAY) { + if (ELEM(prop->subtype, + eIDPropertyType::IDP_BOOLEAN, + eIDPropertyType::IDP_INT, + eIDPropertyType::IDP_FLOAT, + eIDPropertyType::IDP_DOUBLE)) + { + return true; + } + } + + return false; +} + static blender::Vector<std::string> construct_rna_paths(PointerRNA *ptr) { eRotationModes rotation_mode; @@ -307,7 +336,17 @@ static blender::Vector<std::string> construct_rna_paths(PointerRNA *ptr) LISTBASE_FOREACH (IDProperty *, prop, &properties->data.group) { char name_escaped[MAX_IDPROP_NAME * 2]; BLI_str_escape(name_escaped, prop->name, sizeof(name_escaped)); - paths.append(fmt::format("[\"{}\"]", name_escaped)); + std::string path = fmt::format("[\"{}\"]", name_escaped); + PointerRNA resolved_ptr; + PropertyRNA *resolved_prop; + const bool is_resolved = RNA_path_resolve_property( + ptr, path.c_str(), &resolved_ptr, &resolved_prop); + if (!is_resolved) { + continue; + } + if (is_idproperty_keyable(prop, resolved_prop)) { + paths.append(path); + } } } } diff --git a/source/blender/makesrna/RNA_access.hh b/source/blender/makesrna/RNA_access.hh index 802cffb763db7d33ab589c77ef912ce9cdd5982c..8cd5ba9aae21317f6e2e121d83d756bafdd48f9e 100644 --- a/source/blender/makesrna/RNA_access.hh +++ b/source/blender/makesrna/RNA_access.hh @@ -287,6 +287,11 @@ int RNA_property_enum_bitflag_identifiers( StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); +/** + * A property is a runtime property if the PROP_INTERN_RUNTIME flag is set on it. + */ +bool RNA_property_is_runtime(const PropertyRNA *prop); + bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop); /** * Version of #RNA_property_editable that tries to return additional info in \a r_info diff --git a/source/blender/makesrna/intern/rna_access.cc b/source/blender/makesrna/intern/rna_access.cc index 74ba9ce3a92c1feac9fe2bfd8e31f3e7bc36133f..9cdfee3a7333af09d7287096a71468097e102d82 100644 --- a/source/blender/makesrna/intern/rna_access.cc +++ b/source/blender/makesrna/intern/rna_access.cc @@ -2158,6 +2158,11 @@ static bool rna_property_editable_do(const PointerRNA *ptr, return true; } +bool RNA_property_is_runtime(const PropertyRNA *prop) +{ + return prop->flag_internal & PROP_INTERN_RUNTIME; +} + bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop) { return rna_property_editable_do(ptr, prop, -1, nullptr); diff --git a/source/blender/makesrna/intern/rna_rna.cc b/source/blender/makesrna/intern/rna_rna.cc index 8232141058c5e06ac65cb3cfe990af6cc46e2ad8..2daad6ed87beef84d40984092aea9c5e220d7c1e 100644 --- a/source/blender/makesrna/intern/rna_rna.cc +++ b/source/blender/makesrna/intern/rna_rna.cc @@ -825,7 +825,7 @@ static bool rna_Property_is_registered_optional_get(PointerRNA *ptr) static bool rna_Property_is_runtime_get(PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - return (prop->flag_internal & PROP_INTERN_RUNTIME) != 0; + return RNA_property_is_runtime(prop); } static bool rna_BoolProperty_default_get(PointerRNA *ptr)