static void edbm_bevel_update_header(bContext *C, wmOperator *op) { const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Clamp Overlap: %s (C), " "Vertex Only: %s (V), Profile Control: %s (P), Offset: %s, Segments: %d, Profile: %.3f"); char msg[UI_MAX_DRAW_STR]; ScrArea *sa = CTX_wm_area(C); Scene *sce = CTX_data_scene(C); if (sa) { BevelData *opdata = op->customdata; char offset_str[NUM_STR_REP_LEN]; const char *type_str; PropertyRNA *prop = RNA_struct_find_property(op->ptr, "offset_type"); if (hasNumInput(&opdata->num_input[OFFSET_VALUE])) { outputNumInput(&opdata->num_input[OFFSET_VALUE], offset_str, &sce->unit); } else { BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset")); } RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &type_str); BLI_snprintf(msg, sizeof(msg), str, type_str, WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")), WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")), WM_bool_as_string(opdata->value_mode == PROFILE_VALUE), offset_str, RNA_int_get(op->ptr, "segments"), RNA_float_get(op->ptr, "profile")); ED_area_headerprint(sa, msg); } }
static void fly_update_header(bContext *C, wmOperator *op, FlyInfo *fly) { char header[UI_MAX_DRAW_STR]; char buf[UI_MAX_DRAW_STR]; char *p = buf; int available_len = sizeof(buf); #define WM_MODALKEY(_id) \ WM_modalkeymap_operator_items_to_string_buf(op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p) BLI_snprintf(header, sizeof(header), IFACE_("%s: confirm, %s: cancel, " "%s: pan enable, " "%s|%s|%s|%s|%s|%s: direction, " "%s: slow, %s: free look, " "%s: Upright x axis (%s), " "%s: Upright z axis (%s), " "%s: increase speed, %s: decrease speed"), WM_MODALKEY(FLY_MODAL_CONFIRM), WM_MODALKEY(FLY_MODAL_CANCEL), WM_MODALKEY(FLY_MODAL_PAN_ENABLE), WM_MODALKEY(FLY_MODAL_DIR_FORWARD), WM_MODALKEY(FLY_MODAL_DIR_LEFT), WM_MODALKEY(FLY_MODAL_DIR_BACKWARD), WM_MODALKEY(FLY_MODAL_DIR_RIGHT), WM_MODALKEY(FLY_MODAL_DIR_UP), WM_MODALKEY(FLY_MODAL_DIR_DOWN), WM_MODALKEY(FLY_MODAL_PRECISION_ENABLE), WM_MODALKEY(FLY_MODAL_FREELOOK_ENABLE), WM_MODALKEY(FLY_MODAL_AXIS_LOCK_X), WM_bool_as_string(fly->xlock != FLY_AXISLOCK_STATE_OFF), WM_MODALKEY(FLY_MODAL_AXIS_LOCK_Z), WM_bool_as_string(fly->zlock != FLY_AXISLOCK_STATE_OFF), WM_MODALKEY(FLY_MODAL_ACCELERATE), WM_MODALKEY(FLY_MODAL_DECELERATE)); #undef WM_MODALKEY ED_area_headerprint(CTX_wm_area(C), header); }
static void edbm_inset_update_header(wmOperator *op, bContext *C) { InsetData *opdata = op->customdata; const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); Scene *sce = CTX_data_scene(C); if (sa) { char flts_str[NUM_STR_REP_LEN * 2]; if (hasNumInput(&opdata->num_input)) outputNumInput(&opdata->num_input, flts_str, &sce->unit); else { BLI_snprintf(flts_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "thickness")); BLI_snprintf(flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "depth")); } BLI_snprintf(msg, HEADER_LENGTH, str, flts_str, flts_str + NUM_STR_REP_LEN, WM_bool_as_string(opdata->modify_depth), WM_bool_as_string(RNA_boolean_get(op->ptr, "use_outset")), WM_bool_as_string(RNA_boolean_get(op->ptr, "use_boundary")), WM_bool_as_string(RNA_boolean_get(op->ptr, "use_individual")) ); ED_area_headerprint(sa, msg); } }
static void walk_update_header(bContext *C, wmOperator *op, WalkInfo *walk) { const bool gravity = (walk->navigation_mode == WALK_MODE_GRAVITY) || ((walk->teleport.state == WALK_TELEPORT_STATE_ON) && (walk->teleport.navigation_mode == WALK_MODE_GRAVITY)); char header[UI_MAX_DRAW_STR]; char buf[UI_MAX_DRAW_STR]; char *p = buf; int available_len = sizeof(buf); #define WM_MODALKEY(_id) \ WM_modalkeymap_operator_items_to_string_buf(op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p) BLI_snprintf(header, sizeof(header), IFACE_("%s: confirm, %s: cancel, " "%s: gravity (%s), " "%s|%s|%s|%s: move around, " "%s: fast, %s: slow, " "%s|%s: up and down, " "%s: teleport, %s: jump, " "%s: increase speed, %s: decrease speed"), WM_MODALKEY(WALK_MODAL_CONFIRM), WM_MODALKEY(WALK_MODAL_CANCEL), WM_MODALKEY(WALK_MODAL_TOGGLE), WM_bool_as_string(gravity), WM_MODALKEY(WALK_MODAL_DIR_FORWARD), WM_MODALKEY(WALK_MODAL_DIR_LEFT), WM_MODALKEY(WALK_MODAL_DIR_BACKWARD), WM_MODALKEY(WALK_MODAL_DIR_RIGHT), WM_MODALKEY(WALK_MODAL_FAST_ENABLE), WM_MODALKEY(WALK_MODAL_SLOW_ENABLE), WM_MODALKEY(WALK_MODAL_DIR_UP), WM_MODALKEY(WALK_MODAL_DIR_DOWN), WM_MODALKEY(WALK_MODAL_TELEPORT), WM_MODALKEY(WALK_MODAL_JUMP), WM_MODALKEY(WALK_MODAL_ACCELERATE), WM_MODALKEY(WALK_MODAL_DECELERATE)); #undef WM_MODALKEY ED_area_headerprint(CTX_wm_area(C), header); }
static void walk_update_header(bContext *C, WalkInfo *walk) { bool gravity = walk->navigation_mode == WALK_MODE_GRAVITY || (walk->teleport.state == WALK_TELEPORT_STATE_ON && walk->teleport.navigation_mode == WALK_MODE_GRAVITY); #define HEADER_LENGTH 256 char header[HEADER_LENGTH]; BLI_snprintf(header, HEADER_LENGTH, IFACE_("LMB/Return: confirm, Esc/RMB: cancel, " "Tab: gravity (%s), " "WASD: move around, " "QE: up and down, MMB/Space: teleport, V: jump, " "Pad +/Wheel Up: increase speed, Pad -/Wheel Down: decrease speed"), WM_bool_as_string(gravity)); ED_area_headerprint(CTX_wm_area(C), header); #undef HEADER_LENGTH }
static void edbm_bevel_update_header(bContext *C, wmOperator *op) { char header[UI_MAX_DRAW_STR]; char buf[UI_MAX_DRAW_STR]; char *p = buf; int available_len = sizeof(buf); Scene *sce = CTX_data_scene(C); char offset_str[NUM_STR_REP_LEN]; const char *mode_str, *omiter_str, *imiter_str; PropertyRNA *prop; #define WM_MODALKEY(_id) \ WM_modalkeymap_operator_items_to_string_buf( \ op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p) if (RNA_enum_get(op->ptr, "offset_type") == BEVEL_AMT_PERCENT) { BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%.1f%%", RNA_float_get(op->ptr, "offset_pct")); } else { bUnit_AsString2(offset_str, NUM_STR_REP_LEN, (double)RNA_float_get(op->ptr, "offset"), 3, B_UNIT_LENGTH, &sce->unit, true); } prop = RNA_struct_find_property(op->ptr, "offset_type"); RNA_property_enum_name_gettexted( C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &mode_str); prop = RNA_struct_find_property(op->ptr, "miter_outer"); RNA_property_enum_name_gettexted( C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &omiter_str); prop = RNA_struct_find_property(op->ptr, "miter_inner"); RNA_property_enum_name_gettexted( C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &imiter_str); BLI_snprintf(header, sizeof(header), IFACE_("%s: confirm, " "%s: cancel, " "%s: mode (%s), " "%s: width (%s), " "%s: segments (%d), " "%s: profile (%.3f), " "%s: clamp overlap (%s), " "%s: vertex only (%s), " "%s: outer miter (%s), " "%s: inner miter (%s), " "%s: harden normals (%s), " "%s: mark seam (%s), " "%s: mark sharp (%s)"), WM_MODALKEY(BEV_MODAL_CONFIRM), WM_MODALKEY(BEV_MODAL_CANCEL), WM_MODALKEY(BEV_MODAL_OFFSET_MODE_CHANGE), mode_str, WM_MODALKEY(BEV_MODAL_VALUE_OFFSET), offset_str, WM_MODALKEY(BEV_MODAL_VALUE_SEGMENTS), RNA_int_get(op->ptr, "segments"), WM_MODALKEY(BEV_MODAL_VALUE_PROFILE), RNA_float_get(op->ptr, "profile"), WM_MODALKEY(BEV_MODAL_CLAMP_OVERLAP_TOGGLE), WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")), WM_MODALKEY(BEV_MODAL_VERTEX_ONLY_TOGGLE), WM_bool_as_string(RNA_boolean_get(op->ptr, "vertex_only")), WM_MODALKEY(BEV_MODAL_OUTER_MITER_CHANGE), omiter_str, WM_MODALKEY(BEV_MODAL_INNER_MITER_CHANGE), imiter_str, WM_MODALKEY(BEV_MODAL_HARDEN_NORMALS_TOGGLE), WM_bool_as_string(RNA_boolean_get(op->ptr, "harden_normals")), WM_MODALKEY(BEV_MODAL_MARK_SEAM_TOGGLE), WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_seam")), WM_MODALKEY(BEV_MODAL_MARK_SHARP_TOGGLE), WM_bool_as_string(RNA_boolean_get(op->ptr, "mark_sharp"))); #undef WM_MODALKEY ED_workspace_status_text(C, header); }