From 19e091ec5effed52f59dcdf92acce4ef7b837ac6 Mon Sep 17 00:00:00 2001 From: Elia Sarti Date: Mon, 22 Nov 2010 00:10:32 +0000 Subject: [PATCH] User preference to hide Python references in Tooltips. --- release/scripts/ui/space_userpref.py | 1 + .../editors/interface/interface_regions.c | 16 ++++++++++------ source/blender/makesdna/DNA_userdef_types.h | 1 + source/blender/makesrna/intern/rna_userdef.c | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 34231e1933b..b8dc549fc04 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -156,6 +156,7 @@ class USERPREF_PT_interface(bpy.types.Panel): col = row.column() col.label(text="Display:") col.prop(view, "show_tooltips") + col.prop(view, "hide_tooltips_python") col.prop(view, "show_object_info", text="Object Info") col.prop(view, "show_large_cursors") col.prop(view, "show_view_name", text="View Name") diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 247fa62b51c..d67d63423f2 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -403,9 +403,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } /* rna info */ - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); - data->color[data->totline]= 0x888888; - data->totline++; + if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + data->color[data->totline]= 0x888888; + data->totline++; + } if(but->rnapoin.id.data) { ID *id= but->rnapoin.id.data; @@ -424,9 +426,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) str= WM_operator_pystring(C, but->optype, opptr, 0); /* operator info */ - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str); - data->color[data->totline]= 0x888888; - data->totline++; + if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str); + data->color[data->totline]= 0x888888; + data->totline++; + } MEM_freeN(str); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index c504c61bc90..1609df827cb 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -425,6 +425,7 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_FILENOUI (1 << 23) #define USER_NONEGFRAMES (1 << 24) #define USER_TXT_TABSTOSPACES_DISABLE (1 << 25) +#define USER_TOOLTIPS_PYTHON (1 << 26) /* helper macro for checking frame clamping */ #define FRAMENUMBER_MIN_CLAMP(cfra) \ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 879378a4053..c53e1d1909a 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1923,6 +1923,10 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS); RNA_def_property_ui_text(prop, "Tooltips", "Display tooltips"); + prop= RNA_def_property(srna, "hide_tooltips_python", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS_PYTHON); + RNA_def_property_ui_text(prop, "Hide Python Tooltips", "Hide Python references in tooltips"); + prop= RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO); RNA_def_property_ui_text(prop, "Display Object Info", "Display objects name and frame number in 3D view");