From 6f806045093419a55b16c596dd8690ea0bbae138 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 22 Sep 2016 00:10:53 +0200 Subject: RNA/UI: Allow displaying in tooltip why RNA property isn't editable This commit allows RNA properties to return additional info on their editable state which may then be displayed in tooltips. To show how it works, it also adds some info for the editable check of proxies. For generally un-editable properties or properties of a linked data-block, RNA returns default strings. | {F362785} | {F362786} | {F362787} | Reviewed by brecht, thanks! Differential Revision: https://developer.blender.org/D2243 --- source/blender/makesrna/intern/rna_internal_types.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna/intern/rna_internal_types.h') diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index ba0705b5caa..04b85b8997e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -62,7 +62,7 @@ struct Scene; typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr); typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr); -typedef int (*EditableFunc)(struct PointerRNA *ptr); +typedef int (*EditableFunc)(struct PointerRNA *ptr, const char **r_info); typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index); typedef struct IDProperty *(*IDPropertiesFunc)(struct PointerRNA *ptr, bool create); typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); @@ -188,7 +188,9 @@ struct PropertyRNA { UpdateFunc update; int noteflag; - /* callback for testing if editable */ + /* Callback for testing if editable. Its r_info parameter can be used to + * return info on editable state that might be shown to user. E.g. tooltips + * of disabled buttons can show reason why button is disabled using this. */ EditableFunc editable; /* callback for testing if array-item editable (if applicable) */ ItemEditableFunc itemeditable; -- cgit v1.2.3