diff --git a/source/blender/makesrna/RNA_path.hh b/source/blender/makesrna/RNA_path.hh index 213b6e9f95e..3dac93f824e 100644 --- a/source/blender/makesrna/RNA_path.hh +++ b/source/blender/makesrna/RNA_path.hh @@ -64,29 +64,18 @@ struct RNAPath { */ std::optional key = std::nullopt; std::optional index = std::nullopt; - - /** - * NOTE: equality is defined in a specific way here to reflect the semantic - * meaning of `RNAPath`. Since the key existing indicates a key-based array - * element, with the index then only serving as a fallback, the index only - * affects the equality result if *neither* `RNAPath` has a key specified. - * (See the main `RNAPath` documentation above for the specific semantics of - * key and index.) - */ - bool operator==(const RNAPath &other) const - { - if (this->path != other.path) { - return false; - } - - if (this->key.has_value() || other.key.has_value()) { - return this->key == other.key; - } - - return this->index == other.index; - } }; +/** + * NOTE: equality is defined in a specific way here to reflect the semantic + * meaning of `RNAPath`. Since the key existing indicates a key-based array + * element, with the index then only serving as a fallback, the index only + * affects the equality result if *neither* `RNAPath` has a key specified. + * (See the main `RNAPath` documentation above for the specific semantics of + * key and index.) + */ +bool operator==(const RNAPath &left, const RNAPath &right); + char *RNA_path_append( const char *path, const PointerRNA *ptr, PropertyRNA *prop, int intkey, const char *strkey); #if 0 /* UNUSED. */ diff --git a/source/blender/makesrna/intern/rna_path.cc b/source/blender/makesrna/intern/rna_path.cc index 9e1980c92cc..da793db7f4a 100644 --- a/source/blender/makesrna/intern/rna_path.cc +++ b/source/blender/makesrna/intern/rna_path.cc @@ -34,6 +34,19 @@ #include "rna_access_internal.h" #include "rna_internal.hh" +bool operator==(const RNAPath &left, const RNAPath &right) +{ + if (left.path != right.path) { + return false; + } + + if (left.key.has_value() || right.key.has_value()) { + return left.key == right.key; + } + + return left.index == right.index; +} + /** * Extract the first token from `path`. *