Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-22 17:29:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-22 17:35:37 +0300
commit8d20d6b2eb40c5a54863e33784eabb3fb6c8d012 (patch)
treec4054a1ec99840f2ebf0d8af2499de8142400ad7 /source/blender/makesrna/intern/rna_define.c
parentf309c93f1f6282d89937d86f0b13eaed932c9dac (diff)
RNA: add fallback update function
Use so we can have a default update function, that doesn't need to be set for every property.
Diffstat (limited to 'source/blender/makesrna/intern/rna_define.c')
-rw-r--r--source/blender/makesrna/intern/rna_define.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 8e24e9a8364..b1818cae62a 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -709,6 +709,14 @@ void RNA_define_animate_sdna(bool animate)
}
#endif
+#ifndef RNA_RUNTIME
+void RNA_define_fallback_property_update(int noteflag, const char *updatefunc)
+{
+ DefRNA.fallback.property_update.noteflag = noteflag;
+ DefRNA.fallback.property_update.updatefunc = updatefunc;
+}
+#endif
+
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
{
#ifdef RNA_RUNTIME
@@ -1413,6 +1421,12 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
}
/* TODO: do we want that for runtime-defined stuff too? I’d say no, but... maybe yes :/ */
+#ifndef RNA_RUNTIME
+ /* Both are typically cleared. */
+ RNA_def_property_update(
+ prop, DefRNA.fallback.property_update.noteflag, DefRNA.fallback.property_update.updatefunc);
+#endif
+
rna_addtail(&cont->properties, prop);
return prop;