diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-07-30 03:12:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-07-30 03:12:30 +0400 |
commit | 239b78c6377c41ba49e36a1dbd3cede6a3347f64 (patch) | |
tree | de928373585b2e0c4bf07938413ea3cb0749b99d /source | |
parent | 408ba429e6aa392f769aac4a442a7a06c1740326 (diff) |
- include operator commands in tooltips (needs sanitizing for transform operators, there are massive :|)
- WM_operator_pystring can now be used with an operator type and properties (rather then a wmOperator instance)
- removed menus from file selector
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 16 |
7 files changed, 32 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 7cce7a0bbed..94442c5de22 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -391,6 +391,21 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->linedark[data->totline]= 1; data->totline++; } + else if (but->optype) { + PointerRNA *opptr; + char *str; + opptr= uiButGetOperatorPtrRNA(but); + + str= WM_operator_pystring(but->optype, opptr); + + /* operator info */ + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str); + data->linedark[data->totline]= 1; + data->totline++; + + WM_operator_properties_free(opptr); + MEM_freeN(str); + } if(data->totline == 0) { MEM_freeN(data); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index e807bad28bf..933b9cc69ad 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -81,6 +81,7 @@ /* ui geometry */ #define IMASEL_BUTTONS_HEIGHT 40 +#define IMASEL_BUTTONS_MARGIN 6 #define TILE_BORDER_X 8 #define TILE_BORDER_Y 8 @@ -134,8 +135,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar) /* Button layout. */ const short min_x = 10; const short max_x = ar->winx - 10; - const short line2_y = ar->winy - IMASEL_BUTTONS_HEIGHT - 12; - const short line1_y = line2_y + IMASEL_BUTTONS_HEIGHT/2 + 4; + const short line2_y = IMASEL_BUTTONS_HEIGHT/2 + IMASEL_BUTTONS_MARGIN*2; + const short line1_y = IMASEL_BUTTONS_MARGIN; const short input_minw = 20; const short btn_h = UI_UNIT_Y; const short btn_fn_w = UI_UNIT_X; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index a217dbe9f57..9c73956d375 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -716,6 +716,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot) /* identifiers */ ot->name= "Create New Directory"; ot->idname= "FILE_OT_directory_new"; + ot->description= "Create a new directory"; /* api callbacks */ ot->invoke= WM_operator_confirm; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f65e5b1b077..3670f1a613f 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -172,7 +172,7 @@ void WM_operator_properties_free(struct PointerRNA *ptr); void WM_operator_properties_filesel(struct wmOperatorType *ot, int filter); /* operator as a python command (resultuing string must be free'd) */ -char *WM_operator_pystring(struct wmOperator *op); +char *WM_operator_pystring(struct wmOperatorType *ot, struct PointerRNA *opptr); void WM_operator_bl_idname(char *to, const char *from); void WM_operator_py_idname(char *to, const char *from); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index c0ac7b06f5a..46cf13f7d75 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -103,7 +103,7 @@ void wm_operator_register(bContext *C, wmOperator *op) /* Report the string representation of the operator */ - buf = WM_operator_pystring(op); + buf = WM_operator_pystring(op->type, op->ptr); BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf); MEM_freeN(buf); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3f668b23b24..86de5498ce9 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -362,7 +362,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P static void wm_operator_print(wmOperator *op) { - char *buf = WM_operator_pystring(op); + char *buf = WM_operator_pystring(op->type, op->ptr); printf("%s\n", buf); MEM_freeN(buf); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 2b7a18dc1cf..d0d50810fdc 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -340,8 +340,12 @@ void WM_operator_bl_idname(char *to, const char *from) } /* print a string representation of the operator, with the args that it runs - * so python can run it again */ -char *WM_operator_pystring(wmOperator *op) + * so python can run it again, + * + * When calling from an existing wmOperator do. + * WM_operator_pystring(op->type, op->ptr); + */ +char *WM_operator_pystring(wmOperatorType *ot, PointerRNA *opptr) { const char *arg_name= NULL; char idname_py[OP_MAX_TYPENAME]; @@ -353,18 +357,18 @@ char *WM_operator_pystring(wmOperator *op) char *cstring, *buf; int first_iter=1; - WM_operator_py_idname(idname_py, op->idname); + WM_operator_py_idname(idname_py, ot->idname); BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py); - iterprop= RNA_struct_iterator_property(op->ptr->type); + iterprop= RNA_struct_iterator_property(opptr->type); - RNA_PROP_BEGIN(op->ptr, propptr, iterprop) { + RNA_PROP_BEGIN(opptr, propptr, iterprop) { prop= propptr.data; arg_name= RNA_property_identifier(prop); if (strcmp(arg_name, "rna_type")==0) continue; - buf= RNA_property_as_string(op->ptr, prop); + buf= RNA_property_as_string(opptr, prop); BLI_dynstr_appendf(dynstr, first_iter?"%s=%s":", %s=%s", arg_name, buf); |