Fix #119909: Unkeyable custom properties receive keyframes #119914
|
@ -247,6 +247,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)
|
||||
mont29 marked this conversation as resolved
Outdated
|
||||
{
|
||||
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,
|
||||
Sybren A. Stüvel
commented
This could be a No strong feelings, because on one hand it has the nice advantage of being a clear point of return (instead of a nested one + a fallthrough), yet it looses a bit of the symmetry with the check above. Feel free to land either style. This could be a `return ELEM(...);`
No strong feelings, because on one hand it has the nice advantage of being a clear point of return (instead of a nested one + a fallthrough), yet it looses a bit of the symmetry with the check above. Feel free to land either style.
|
||||
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;
|
||||
|
@ -302,7 +331,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(
|
||||
mont29 marked this conversation as resolved
Outdated
Sybren A. Stüvel
commented
I think I think `is_resolved` (or simply `ok`) could be a better name than `resolved_path`, as this variable does not contain "the resolved path".
|
||||
ptr, path.c_str(), &resolved_ptr, &resolved_prop);
|
||||
if (!is_resolved) {
|
||||
continue;
|
||||
}
|
||||
if (is_idproperty_keyable(prop, resolved_prop)) {
|
||||
paths.append(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,6 +288,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.
|
||||
*/
|
||||
mont29 marked this conversation as resolved
Outdated
|
||||
bool RNA_property_is_runtime(const PropertyRNA *prop);
|
||||
mont29 marked this conversation as resolved
Bastien Montagne
commented
This should also be called by This should also be called by `rna_Property_is_runtime_get` then, to avoid code duplication.
|
||||
|
||||
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop);
|
||||
/**
|
||||
* Version of #RNA_property_editable that tries to return additional info in \a r_info
|
||||
|
|
|
@ -2162,6 +2162,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);
|
||||
|
|
|
@ -843,7 +843,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)
|
||||
|
|
Loading…
Reference in New Issue
This name is not specific enough. Should be something like
is_idproperty_keyable
or so (the_type
part can be removed I think, since it's not only checking the IDP type anymore).