Fix: Custom Properties named identical to existing properties fails to key
When inserting keys in the viewport by pressing `I`, certain custom properties would not get keyed if their name was identical to existing properties (for example `scale`). That was because we use the name of the property to resolve an rna path and check if the path resolved. This was of course true in the described case and the square brackets would never be added. The solution is to check for `RNA_property_is_runtime` which is false for properties defined inside Blender. Pull Request: https://projects.blender.org/blender/blender/pulls/135304
This commit is contained in:
committed by
Christoph Lendenfeld
parent
a485bf6556
commit
b834ca4fb1
@@ -155,7 +155,10 @@ Vector<RNAPath> get_keyable_id_property_paths(const PointerRNA &ptr)
|
||||
* Those need to be animated through an RNA path without the brackets. */
|
||||
bool is_resolved = RNA_path_resolve_property(
|
||||
&ptr, path.c_str(), &resolved_ptr, &resolved_prop);
|
||||
if (!is_resolved) {
|
||||
/* ID properties can be named the same as internal properties, for example `scale`. In that
|
||||
* case they would resolve, but it wouldn't be the correct property. `RNA_property_is_runtime`
|
||||
* catches that case. */
|
||||
if (!is_resolved || !RNA_property_is_runtime(resolved_prop)) {
|
||||
char name_escaped[MAX_IDPROP_NAME * 2];
|
||||
BLI_str_escape(name_escaped, id_prop->name, sizeof(name_escaped));
|
||||
path = fmt::format("[\"{}\"]", name_escaped);
|
||||
|
||||
Reference in New Issue
Block a user