include menu ID's in tooltips when python tips are enabled, there was no way to find...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 26 Jul 2011 09:19:51 +0000 (09:19 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 26 Jul 2011 09:19:51 +0000 (09:19 +0000)
source/blender/editors/interface/interface_regions.c
source/blender/makesrna/intern/rna_wm.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm.c

index 62043f240e453fb6c44b4e38578edbb196226cb8..9e7717260e6f50a7a39930d08b49a2ceee8b6b8d 100644 (file)
@@ -484,6 +484,17 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
                        }
                }
        }
+       else if (ELEM(but->type, MENU, PULLDOWN)) {
+               if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
+                       if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) {
+                               MenuType *mt= (MenuType *)but->poin;
+                               BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", mt->idname);
+                               data->color[data->totline]= 0x888888;
+                               data->totline++;
+                       }
+               }
+
+       }
 
        assert(data->totline < MAX_TOOLTIP_LINES);
        
index 7ea4701dec3eb68432828227ebca614cea25c7e5..73221c47c90c3efa535744ad571bed647aaea2d2 100644 (file)
@@ -940,7 +940,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
                        rna_Operator_unregister(bmain, ot->ext.srna);
        }
 
-       /* create a new menu type */
+       /* create a new operator type */
        dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
        RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
        dummyot.ext.data= data;
index 67294a8eb53a6ed2b52514b8e1cec9ae7f5a50c7..e6325e2101a4bd356eff34234cd029d83080b56f 100644 (file)
@@ -272,6 +272,7 @@ void                WM_operator_py_idname(char *to, const char *from);
 /* *************** menu types ******************** */
 struct MenuType                *WM_menutype_find(const char *idname, int quiet);
 int                                    WM_menutype_add(struct MenuType* mt);
+int                                    WM_menutype_contains(struct MenuType* mt);
 void                           WM_menutype_freelink(struct MenuType* mt);
 void                           WM_menutype_free(void);
 
index bcd5cf38f8835740c1ec7dbe4101727db099f12b..a535c0bc1f8e783439e8aa0451de86ab4f81ba5a 100644 (file)
@@ -175,6 +175,12 @@ int WM_menutype_add(MenuType* mt)
        return 1;
 }
 
+/* inefficient but only used for tooltip code */
+int WM_menutype_contains(MenuType* mt)
+{
+       return (mt != NULL && BLI_findindex(&menutypes, mt) != -1);
+}
+
 void WM_menutype_freelink(MenuType* mt)
 {
        BLI_freelinkN(&menutypes, mt);