From f3c5b0394f095bb017c19c5a945c8e7714205bf2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 4 May 2018 07:26:42 +0200 Subject: IDProp API: expose repr utility function Useful for logging properties passed to operators. --- source/blender/blenkernel/intern/idprop.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 5c13ba7907d..a224ef1e212 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -832,9 +832,9 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is if ((p1 != p2) && ((fabsf(p1 - p2) / max_ff(p1, p2)) < 0.001f)) { printf("WARNING: Comparing two float properties that have nearly the same value (%f vs. %f)\n", p1, p2); printf(" p1: "); - IDP_spit(prop1); + IDP_print(prop1); printf(" p2: "); - IDP_spit(prop2); + IDP_print(prop2); } } #endif @@ -1069,3 +1069,18 @@ void IDP_ClearProperty(IDProperty *prop) } /** \} */ + +/* We could write a C version, see: idprop_py_api.c */ +#ifndef WITH_PYTHON +char *IDP_reprN(IDProperty *UNUSED(prop)) +{ + return BLI_strdup(""); +} + +void IDP_print(IDProperty *prop) +{ + char *repr = IDP_reprN(prop); + printf("IDProperty(%p): %s\n", prop, repr); + MEM_freeN(repr); +} +#endif /* WITH_PYTHON */ -- cgit v1.2.3