From 29605fc06ddd8fb9a5d80df1389a0cbfb150c9b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Oct 2010 21:57:45 +0000 Subject: Added function RNA_property_update_check() to check if an update call is needed, Simple python benchmark shows this to be about 3x faster in the case where an update isn't needed. This also speeds up rna function argument parsing, since each arg in a function call did 2 string lookups on the context which were never needed. --- source/blender/makesrna/intern/rna_access.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/makesrna/intern/rna_access.c') diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6cb5858648a..6cdb842fbc2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1268,6 +1268,14 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR } +/* must keep in sync with 'rna_property_update' + * note, its possible this returns a false positive in the case of PROP_CONTEXT_UPDATE + * but this isnt likely to be a performance problem. */ +int RNA_property_update_check(PropertyRNA *prop) +{ + return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag); +} + void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop) { rna_property_update(C, CTX_data_main(C), CTX_data_scene(C), ptr, prop); -- cgit v1.2.3