diff options
Diffstat (limited to 'source/blender/editors')
78 files changed, 1187 insertions, 533 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 6bd333294c5..c70790e0550 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -146,7 +146,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* set backdrop drawing color */ acf->get_backdrop_color(ac, ale, color); @@ -235,7 +235,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* set backdrop drawing color */ acf->get_backdrop_color(ac, ale, color); @@ -638,7 +638,7 @@ static int acf_object_icon(bAnimListElem *ale) /* icon depends on object-type */ switch (ob->type) { case OB_LAMP: - return ICON_OUTLINER_OB_LAMP; + return ICON_OUTLINER_OB_LIGHT; case OB_MESH: return ICON_OUTLINER_OB_MESH; case OB_CAMERA: @@ -1452,16 +1452,16 @@ static bAnimChannelType ACF_DSMAT = acf_dsmat_setting_ptr /* pointer for setting */ }; -/* Lamp Expander ------------------------------------------- */ +/* Light Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dslam_icon(bAnimListElem *UNUSED(ale)) +static int acf_dslight_icon(bAnimListElem *UNUSED(ale)) { - return ICON_LAMP_DATA; + return ICON_LIGHT_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) +static int acf_dslight_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1486,7 +1486,7 @@ static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Setting } /* get pointer to the setting */ -static void *acf_dslam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) +static void *acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Lamp *la = (Lamp *)ale->data; @@ -1510,9 +1510,9 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings set } /* lamp expander type define */ -static bAnimChannelType ACF_DSLAM = +static bAnimChannelType ACF_DSLIGHT = { - "Lamp Expander", /* type name */ + "Light Expander", /* type name */ ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ @@ -1521,12 +1521,12 @@ static bAnimChannelType ACF_DSLAM = acf_generic_basic_offset, /* offset */ acf_generic_idblock_name, /* name */ - acf_generic_idblock_name_prop, /* name prop */ - acf_dslam_icon, /* icon */ + acf_generic_idblock_name_prop, /* name prop */ + acf_dslight_icon, /* icon */ acf_generic_dataexpand_setting_valid, /* has setting */ - acf_dslam_setting_flag, /* flag for setting */ - acf_dslam_setting_ptr /* pointer for setting */ + acf_dslight_setting_flag, /* flag for setting */ + acf_dslight_setting_ptr /* pointer for setting */ }; /* Texture Expander ------------------------------------------- */ @@ -3580,7 +3580,7 @@ static void ANIM_init_channel_typeinfo_data(void) animchannelTypeInfo[type++] = &ACF_FILLDRIVERS; /* Drivers Expander */ animchannelTypeInfo[type++] = &ACF_DSMAT; /* Material Channel */ - animchannelTypeInfo[type++] = &ACF_DSLAM; /* Lamp Channel */ + animchannelTypeInfo[type++] = &ACF_DSLIGHT; /* Light Channel */ animchannelTypeInfo[type++] = &ACF_DSCAM; /* Camera Channel */ animchannelTypeInfo[type++] = &ACF_DSCACHEFILE; /* CacheFile Channel */ animchannelTypeInfo[type++] = &ACF_DSCUR; /* Curve Channel */ @@ -3868,7 +3868,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* for F-Curves, draw color-preview of curve behind checkbox */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { FCurve *fcu = (FCurve *)ale->data; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3924,7 +3924,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* draw red underline if channel is disabled */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE) && (ale->flag & FCURVE_DISABLED)) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3952,7 +3952,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float short draw_sliders = 0; float ymin_ofs = 0.0f; float color[3]; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 953898a0586..51ba7d9c269 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -142,7 +142,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) GPU_line_width((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -171,7 +171,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) GPU_blend(true); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_ANIM_ACTIVE, -25, -30); @@ -204,7 +204,7 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) GPU_blend(true); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 5f03704f9f5..c5f7782dcee 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -486,7 +486,7 @@ void ED_markers_draw(const bContext *C, int flag) v2d = UI_view2d_fromcontext(C); if (flag & DRAW_MARKERS_MARGIN) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); const unsigned char shade[4] = {0, 0, 0, 16}; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index fcccf07190b..78ce24db503 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -585,20 +585,20 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa copy_v4_v4(unsel_mhcol, unsel_color); unsel_mhcol[3] *= 0.8f; - unsigned int block_ct = 0; + uint block_len = 0; for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) { if (actkeyblock_is_valid(ab, keys)) { - block_ct++; + block_len++; } } - if (block_ct > 0) { + if (block_len > 0) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_TRIS, 6 * block_ct); + immBegin(GWN_PRIM_TRIS, 6 * block_len); for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) { if (actkeyblock_is_valid(ab, keys)) { if (ab->flag & ACTKEYBLOCK_FLAG_MOVING_HOLD) { @@ -622,25 +622,25 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa if (keys) { /* count keys */ - unsigned int key_ct = 0; + uint key_len = 0; for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) { /* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw * - this might give some improvements, since we current have to flip between view/region matrices */ if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) - key_ct++; + key_len++; } - if (key_ct > 0) { + if (key_len > 0) { /* draw keys */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); - unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, key_ct); + immBegin(GWN_PRIM_POINTS, key_len); for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) { if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) { diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 5e3fec93340..ce72a5ffc9f 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -430,7 +430,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); GPU_depth_test(false); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index a79a5052eb8..ec4310213ef 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -151,8 +151,8 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f /* draw triangulation data */ if (tot_triangles > 0) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -209,8 +209,8 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); const tGPspoint *pt = points; @@ -320,9 +320,9 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi return; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); @@ -347,9 +347,9 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints const float diff_mat[4][4], const float ink[4]) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); @@ -380,9 +380,9 @@ static void gp_draw_stroke_volumetric_3d( const float ink[4]) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); @@ -517,7 +517,7 @@ static void gp_draw_stroke_fill( } BLI_assert(gps->tot_triangles >= 1); - unsigned int pos; + uint pos; if (gps->flag & GP_STROKE_3DSPACE) { pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -576,7 +576,7 @@ static void gp_draw_stroke_point( mul_v3_m4v3(fpt, diff_mat, &pt->x); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (sflag & GP_STROKE_3DSPACE) { immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); @@ -618,8 +618,8 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -717,8 +717,8 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thi float fpt[3]; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GWN_PRIM_TRI_STRIP, totpoints * 2 + 4); @@ -1151,9 +1151,9 @@ static void gp_draw_strokes_edit( selectColor[3] = alpha; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos; /* specified later */ - unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos; /* specified later */ + uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (gps->flag & GP_STROKE_3DSPACE) { pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 75e4c510bcf..0ddd8700c09 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -986,7 +986,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda if (brush) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 4c67a306e75..a63855439f4 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -119,7 +119,7 @@ DEF_ICON(FULLSCREEN_EXIT) DEF_ICON(BLANK1) // Not actually blank - this is used all over the place /* BUTTONS */ -DEF_ICON(LAMP) +DEF_ICON(LIGHT) DEF_ICON(MATERIAL) DEF_ICON(TEXTURE) DEF_ICON(ANIM) @@ -216,7 +216,7 @@ DEF_ICON(MESH_DATA) DEF_ICON(CURVE_DATA) DEF_ICON(META_DATA) DEF_ICON(LATTICE_DATA) -DEF_ICON(LAMP_DATA) +DEF_ICON(LIGHT_DATA) DEF_ICON(MATERIAL_DATA) DEF_ICON(TEXTURE_DATA) DEF_ICON(ANIM_DATA) @@ -304,7 +304,7 @@ DEF_ICON(OUTLINER_OB_MESH) DEF_ICON(OUTLINER_OB_CURVE) DEF_ICON(OUTLINER_OB_LATTICE) DEF_ICON(OUTLINER_OB_META) -DEF_ICON(OUTLINER_OB_LAMP) +DEF_ICON(OUTLINER_OB_LIGHT) DEF_ICON(OUTLINER_OB_CAMERA) DEF_ICON(OUTLINER_OB_ARMATURE) DEF_ICON(OUTLINER_OB_FONT) @@ -336,7 +336,7 @@ DEF_ICON(OUTLINER_DATA_MESH) DEF_ICON(OUTLINER_DATA_CURVE) DEF_ICON(OUTLINER_DATA_LATTICE) DEF_ICON(OUTLINER_DATA_META) -DEF_ICON(OUTLINER_DATA_LAMP) +DEF_ICON(OUTLINER_DATA_LIGHT) DEF_ICON(OUTLINER_DATA_CAMERA) DEF_ICON(OUTLINER_DATA_ARMATURE) DEF_ICON(OUTLINER_DATA_FONT) @@ -377,11 +377,11 @@ DEF_ICON(MESH_CAPSULE) #ifndef DEF_ICON_BLANK_SKIP DEF_ICON(BLANK611) #endif -DEF_ICON(LAMP_POINT) -DEF_ICON(LAMP_SUN) -DEF_ICON(LAMP_SPOT) -DEF_ICON(LAMP_HEMI) -DEF_ICON(LAMP_AREA) +DEF_ICON(LIGHT_POINT) +DEF_ICON(LIGHT_SUN) +DEF_ICON(LIGHT_SPOT) +DEF_ICON(LIGHT_HEMI) +DEF_ICON(LIGHT_AREA) #ifndef DEF_ICON_BLANK_SKIP DEF_ICON(BLANK617) DEF_ICON(BLANK618) @@ -1032,3 +1032,55 @@ DEF_VICO(COLORSET_17_VEC) DEF_VICO(COLORSET_18_VEC) DEF_VICO(COLORSET_19_VEC) DEF_VICO(COLORSET_20_VEC) + +/* Events */ +DEF_ICON(EVENT_A) +DEF_ICON(EVENT_B) +DEF_ICON(EVENT_C) +DEF_ICON(EVENT_D) +DEF_ICON(EVENT_E) +DEF_ICON(EVENT_F) +DEF_ICON(EVENT_G) +DEF_ICON(EVENT_H) +DEF_ICON(EVENT_I) +DEF_ICON(EVENT_J) +DEF_ICON(EVENT_K) +DEF_ICON(EVENT_L) +DEF_ICON(EVENT_M) +DEF_ICON(EVENT_N) +DEF_ICON(EVENT_O) +DEF_ICON(EVENT_P) +DEF_ICON(EVENT_Q) +DEF_ICON(EVENT_R) +DEF_ICON(EVENT_S) +DEF_ICON(EVENT_T) +DEF_ICON(EVENT_U) +DEF_ICON(EVENT_V) +DEF_ICON(EVENT_W) +DEF_ICON(EVENT_X) +DEF_ICON(EVENT_Y) +DEF_ICON(EVENT_Z) +DEF_ICON(EVENT_SHIFT) +DEF_ICON(EVENT_CTRL) +DEF_ICON(EVENT_ALT) +DEF_ICON(EVENT_OS) +DEF_ICON(EVENT_F1) +DEF_ICON(EVENT_F2) +DEF_ICON(EVENT_F3) +DEF_ICON(EVENT_F4) +DEF_ICON(EVENT_F5) +DEF_ICON(EVENT_F6) +DEF_ICON(EVENT_F7) +DEF_ICON(EVENT_F8) +DEF_ICON(EVENT_F9) +DEF_ICON(EVENT_F10) +DEF_ICON(EVENT_F11) +DEF_ICON(EVENT_F12) +DEF_ICON(EVENT_ESC) +DEF_ICON(EVENT_TAB) +DEF_ICON(EVENT_PAGEUP) +DEF_ICON(EVENT_PAGEDOWN) +DEF_ICON(EVENT_HOME) +DEF_ICON(EVENT_END) +DEF_ICON(EVENT_RETURN) +/* add as needed. */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 8a758d01809..d23748356fa 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -76,6 +76,7 @@ struct wmEvent; struct wmManipulator; struct wmMsgBus; struct wmKeyMap; +struct wmKeyMapItem; typedef struct uiBut uiBut; typedef struct uiBlock uiBlock; @@ -554,7 +555,7 @@ void UI_but_drag_set_path(uiBut *but, const char *path, const bool use_free); void UI_but_drag_set_name(uiBut *but, const char *name); void UI_but_drag_set_value(uiBut *but); void UI_but_drag_set_image( - uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale, const bool use_free); + uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale, const bool use_free); bool UI_but_active_drop_name(struct bContext *C); bool UI_but_active_drop_color(struct bContext *C); @@ -592,13 +593,14 @@ bool UI_but_online_manual_id_from_active( * - R: RNA * - O: operator */ -uiBut *uiDefBut(uiBlock *block, - int type, int retval, const char *str, - int x1, int y1, - short x2, short y2, - void *poin, - float min, float max, - float a1, float a2, const char *tip); +uiBut *uiDefBut( + uiBlock *block, + int type, int retval, const char *str, + int x1, int y1, + short x2, short y2, + void *poin, + float min, float max, + float a1, float a2, const char *tip); uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); @@ -612,13 +614,14 @@ uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip); uiBut *uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconBut(uiBlock *block, - int type, int retval, int icon, - int x1, int y1, - short x2, short y2, - void *poin, - float min, float max, - float a1, float a2, const char *tip); +uiBut *uiDefIconBut( + uiBlock *block, + int type, int retval, int icon, + int x1, int y1, + short x2, short y2, + void *poin, + float min, float max, + float a1, float a2, const char *tip); uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); @@ -632,13 +635,14 @@ uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x, int y, short width, short height, const char *tip); uiBut *uiDefIconButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconTextBut(uiBlock *block, - int type, int retval, int icon, const char *str, - int x1, int y1, - short x2, short y2, - void *poin, - float min, float max, - float a1, float a2, const char *tip); +uiBut *uiDefIconTextBut( + uiBlock *block, + int type, int retval, int icon, const char *str, + int x1, int y1, + short x2, short y2, + void *poin, + float min, float max, + float a1, float a2, const char *tip); uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); @@ -723,6 +727,9 @@ enum { int UI_icon_from_id(struct ID *id); int UI_icon_from_report_type(int type); +int UI_icon_from_event_type(short event_type, short event_value); +int UI_icon_from_keymap_item(const struct wmKeyMapItem *kmi, int r_icon_mod[4]); + uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip); @@ -738,9 +745,10 @@ uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip); uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip); -uiBut *uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, struct IDProperty *properties, - void *arg, int retval, int icon, int maxlen, int x, int y, - short width, short height, float a1, float a2, const char *tip); +uiBut *uiDefSearchButO_ptr( + uiBlock *block, struct wmOperatorType *ot, struct IDProperty *properties, + void *arg, int retval, int icon, int maxlen, int x, int y, + short width, short height, float a1, float a2, const char *tip); /* For uiDefAutoButsRNA */ @@ -801,8 +809,9 @@ void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN); void UI_but_tooltip_refresh(struct bContext *C, uiBut *but); void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but); -bool UI_textbutton_activate_rna(const struct bContext *C, struct ARegion *ar, - const void *rna_poin_data, const char *rna_prop_id); +bool UI_textbutton_activate_rna( + const struct bContext *C, struct ARegion *ar, + const void *rna_poin_data, const char *rna_prop_id); bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); @@ -836,9 +845,10 @@ void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *x, int *y) void UI_panels_draw(const struct bContext *C, struct ARegion *ar); struct Panel *UI_panel_find_by_type(struct ListBase *lb, struct PanelType *pt); -struct Panel *UI_panel_begin(struct ScrArea *sa, struct ARegion *ar, struct ListBase *lb, - uiBlock *block, struct PanelType *pt, struct Panel *pa, - bool *r_open); +struct Panel *UI_panel_begin( + struct ScrArea *sa, struct ARegion *ar, struct ListBase *lb, + uiBlock *block, struct PanelType *pt, struct Panel *pa, + bool *r_open); void UI_panel_end(uiBlock *block, int width, int height); void UI_panels_scale(struct ARegion *ar, float new_width); void UI_panel_label_offset(struct uiBlock *block, int *x, int *y); @@ -998,8 +1008,9 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align); uiLayout *uiLayoutGridFlow( uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align); uiLayout *uiLayoutBox(uiLayout *layout); -uiLayout *uiLayoutListBox(uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop, - struct PointerRNA *actptr, struct PropertyRNA *actprop); +uiLayout *uiLayoutListBox( + uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop, + struct PointerRNA *actptr, struct PropertyRNA *actprop); uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align); uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align); uiLayout *uiLayoutOverlap(uiLayout *layout); @@ -1022,8 +1033,9 @@ void uiTemplateIDTabs( PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter); -void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname, - const char *proptypename, const char *text); +void uiTemplateAnyID( + uiLayout *layout, struct PointerRNA *ptr, const char *propname, + const char *proptypename, const char *text); void uiTemplateSearch( uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, @@ -1035,27 +1047,31 @@ void uiTemplateSearchPreview( struct PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, const int rows, const int cols); -void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char *propname, - struct PointerRNA *root_ptr, const char *text); +void uiTemplatePathBuilder( + uiLayout *layout, struct PointerRNA *ptr, const char *propname, + struct PointerRNA *root_ptr, const char *text); uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); void uiTemplateOperatorRedoProperties(uiLayout *layout, const struct bContext *C); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); -void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, bool show_buttons, struct ID *parent, - struct MTex *slot, const char *preview_id); +void uiTemplatePreview( + uiLayout *layout, struct bContext *C, struct ID *id, bool show_buttons, struct ID *parent, + struct MTex *slot, const char *preview_id); void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand); void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale); void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, - bool levels, bool brush, bool neg_slope); +void uiTemplateCurveMapping( + uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, + bool levels, bool brush, bool neg_slope); void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic); void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool color); -void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_layer); +void uiTemplateLayers( + uiLayout *layout, struct PointerRNA *ptr, const char *propname, + PointerRNA *used_ptr, const char *used_propname, int active_layer); void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, bool compact, bool multiview); void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, bool color_management); void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr); @@ -1082,10 +1098,11 @@ void uiTemplateCacheFile(uiLayout *layout, struct bContext *C, struct PointerRNA /* Default UIList class name, keep in sync with its declaration in bl_ui/__init__.py */ #define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list" -void uiTemplateList(uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id, - struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr, - const char *active_propname, const char *item_dyntip_propname, - int rows, int maxrows, int layout_type, int columns); +void uiTemplateList( + uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id, + struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr, + const char *active_propname, const char *item_dyntip_propname, + int rows, int maxrows, int layout_type, int columns); void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); @@ -1201,14 +1218,18 @@ uiBut *UI_region_active_but_get(struct ARegion *ar); /* Styled text draw */ void UI_fontstyle_set(const struct uiFontStyle *fs); -void UI_fontstyle_draw_ex(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - const unsigned char col[4], size_t len, float *r_xofs, float *r_yofs); -void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - const unsigned char col[4]); -void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - const unsigned char col[4]); -void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str, - const unsigned char col[4]); +void UI_fontstyle_draw_ex( + const struct uiFontStyle *fs, const struct rcti *rect, const char *str, + const unsigned char col[4], size_t len, float *r_xofs, float *r_yofs); +void UI_fontstyle_draw( + const struct uiFontStyle *fs, const struct rcti *rect, const char *str, + const unsigned char col[4]); +void UI_fontstyle_draw_rotated( + const struct uiFontStyle *fs, const struct rcti *rect, const char *str, + const unsigned char col[4]); +void UI_fontstyle_draw_simple( + const struct uiFontStyle *fs, float x, float y, const char *str, + const unsigned char col[4]); void UI_fontstyle_draw_simple_backdrop( const struct uiFontStyle *fs, float x, float y, const char *str, const float col_fg[4], const float col_bg[4]); diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index ee18f956cac..cf172441be1 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -54,6 +54,7 @@ set(SRC interface_eyedropper_driver.c interface_handlers.c interface_icons.c + interface_icons_event.c interface_layout.c interface_ops.c interface_panel.c diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 427f5621177..20361bde16f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3454,6 +3454,12 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu block->flag |= UI_BLOCK_IS_FLIP; } +static void ui_but_submenu_enable(uiBlock *block, uiBut *but) +{ + but->flag |= UI_BUT_ICON_SUBMENU; + block->content_hints |= BLOCK_CONTAINS_SUBMENU_BUT; +} + /** * ui_def_but_rna_propname and ui_def_but_rna * both take the same args except for propname vs prop, this is done so we can @@ -3589,7 +3595,7 @@ static uiBut *ui_def_but_rna( } if ((type == UI_BTYPE_MENU) && (but->dt == UI_EMBOSS_PULLDOWN)) { - but->flag |= UI_BUT_ICON_SUBMENU; + ui_but_submenu_enable(block, but); } const char *info; @@ -4328,7 +4334,7 @@ uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, in ui_def_but_icon(but, icon, UI_HAS_ICON); but->drawflag |= UI_BUT_ICON_LEFT; - but->flag |= UI_BUT_ICON_SUBMENU; + ui_but_submenu_enable(block, but); but->menu_create_func = func; ui_but_update(but); @@ -4360,7 +4366,7 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, but->drawflag |= UI_BUT_ICON_LEFT; } but->flag |= UI_HAS_ICON; - but->flag |= UI_BUT_ICON_SUBMENU; + ui_but_submenu_enable(block, but); but->block_create_func = func; ui_but_update(but); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index c336c48f62a..0a8a6d1f832 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -159,23 +159,23 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float int a; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* mult */ for (a = 0; a < 7; a++) { mul_v2_fl(vec[a], rad); } - unsigned int vert_ct = 0; - vert_ct += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1; - vert_ct += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1; - vert_ct += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1; - vert_ct += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1; + uint vert_len = 0; + vert_len += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1; + vert_len += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1; + vert_len += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1; + vert_len += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); - immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_ct); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_len); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { immVertex2f(pos, maxx - rad, miny); @@ -280,8 +280,8 @@ void UI_draw_roundbox_shade_x( int a; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -432,8 +432,8 @@ void UI_draw_roundbox_shade_y( } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -535,7 +535,7 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo int ofs_y = 4 * U.pixelsize; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -550,8 +550,8 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highlight[3], unsigned char highlight_fade[3]) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); /* add a 1px offset, looks nicer */ const int minx = rect->xmin + U.pixelsize, maxx = rect->xmax - U.pixelsize; const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize; @@ -818,7 +818,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS (rect.ymax + 1) - (rect.ymin - 1)); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -869,7 +869,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS static void waveform_draw_one(float *waveform, int nbr, const float col[3]) { Gwn_VertFormat format = {0}; - unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); GWN_vertbuf_data_alloc(vbo, nbr); @@ -957,7 +957,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1215,7 +1215,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN (rect.ymax + 1) - (rect.ymin - 1)); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1404,7 +1404,7 @@ static void ui_draw_colorband_handle( void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect) { struct ColorManagedDisplay *display = NULL; - unsigned int position, color; + uint pos_id, col_id; ColorBand *coba = (ColorBand *)(but->editcoba ? but->editcoba : but->poin); if (coba == NULL) return; @@ -1419,20 +1419,20 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti float y1 = rect->ymin; Gwn_VertFormat *format = immVertexFormat(); - position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); /* Drawing the checkerboard. */ immUniform4f("color1", UI_ALPHA_CHECKER_DARK / 255.0f, UI_ALPHA_CHECKER_DARK / 255.0f, UI_ALPHA_CHECKER_DARK / 255.0f, 1.0f); immUniform4f("color2", UI_ALPHA_CHECKER_LIGHT / 255.0f, UI_ALPHA_CHECKER_LIGHT / 255.0f, UI_ALPHA_CHECKER_LIGHT / 255.0f, 1.0f); immUniform1i("size", 8); - immRectf(position, x1, y1, x1 + sizex, rect->ymax); + immRectf(pos_id, x1, y1, x1 + sizex, rect->ymax); immUnbindProgram(); /* New format */ format = immVertexFormat(); - position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + col_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* layer: color ramp */ @@ -1455,9 +1455,9 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[0] = v2[0] = x1 + a; - immAttrib4fv(color, colf); - immVertex2fv(position, v1); - immVertex2fv(position, v2); + immAttrib4fv(col_id, colf); + immVertex2fv(pos_id, v1); + immVertex2fv(pos_id, v2); } immEnd(); @@ -1474,9 +1474,9 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[0] = v2[0] = x1 + a; - immAttrib4f(color, colf[0], colf[1], colf[2], 1.0f); - immVertex2fv(position, v1); - immVertex2fv(position, v2); + immAttrib4f(col_id, colf[0], colf[1], colf[2], 1.0f); + immVertex2fv(pos_id, v1); + immVertex2fv(pos_id, v2); } immEnd(); @@ -1486,27 +1486,27 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* layer: box outline */ immUniformColor4f(0.0f, 0.0f, 0.0f, 1.0f); - imm_draw_box_wire_2d(position, x1, y1, x1 + sizex, rect->ymax); + imm_draw_box_wire_2d(pos_id, x1, y1, x1 + sizex, rect->ymax); /* layer: box outline */ GPU_blend(true); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); immBegin(GWN_PRIM_LINES, 2); - immVertex2f(position, x1, y1); - immVertex2f(position, x1 + sizex, y1); + immVertex2f(pos_id, x1, y1); + immVertex2f(pos_id, x1 + sizex, y1); immEnd(); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); immBegin(GWN_PRIM_LINES, 2); - immVertex2f(position, x1, y1 - 1); - immVertex2f(position, x1 + sizex, y1 - 1); + immVertex2f(pos_id, x1, y1 - 1); + immVertex2f(pos_id, x1 + sizex, y1 - 1); immEnd(); GPU_blend(false); @@ -1515,7 +1515,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti for (int a = 0; a < coba->tot; a++, cbd++) { if (a != coba->cur) { float pos = x1 + cbd->pos * (sizex - 1) + 1; - ui_draw_colorband_handle(position, rect, pos, &cbd->r, display, false); + ui_draw_colorband_handle(pos_id, rect, pos, &cbd->r, display, false); } } @@ -1523,7 +1523,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti if (coba->tot != 0) { cbd = &coba->data[coba->cur]; float pos = x1 + cbd->pos * (sizex - 1) + 1; - ui_draw_colorband_handle(position, rect, pos, &cbd->r, display, true); + ui_draw_colorband_handle(pos_id, rect, pos, &cbd->r, display, true); } immUnbindProgram(); @@ -1568,7 +1568,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) /* AA circle */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->inner); @@ -1675,7 +1675,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti GPU_line_width(1.0f); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* backdrop */ @@ -1807,7 +1807,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* the points, use aspect to make them visible on edges */ format = immVertexFormat(); pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); cmp = cuma->curve; @@ -1926,8 +1926,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U BLI_rctf_size_y(&rect)); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); UI_GetThemeColor4fv(TH_SEL_MARKER, col_sel); @@ -2018,7 +2018,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol float y = 0.5f * (recti->ymin + recti->ymax); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(but->col); @@ -2115,8 +2115,8 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, GPU_blend(true); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c3246213d4e..9c5a4392f78 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -108,6 +108,7 @@ typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha); #define ICON_TYPE_BUFFER 3 #define ICON_TYPE_VECTOR 4 #define ICON_TYPE_GEOM 5 +#define ICON_TYPE_EVENT 6 /* draw keymap entries using custom renderer. */ typedef struct DrawInfo { int type; @@ -126,6 +127,14 @@ typedef struct DrawInfo { struct { int x, y, w, h; } texture; + struct { + /* Can be packed into a single int. */ + short event_type; + short event_value; + int icon; + /* Allow lookups. */ + struct DrawInfo *next; + } input; } data; } DrawInfo; @@ -241,7 +250,7 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float viconutil_set_point(pts[1], cx - d2, cy - d); viconutil_set_point(pts[2], cx + d2, cy); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.2f, 0.2f, 0.2f, alpha); @@ -272,10 +281,10 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, int yco = y + h / 2; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); - unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); @@ -334,7 +343,7 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU const int b = x + w / 3 * 2; const int c = x + w; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* XXX: Include alpha into this... */ @@ -437,6 +446,143 @@ static void init_brush_icons(void) #undef INIT_BRUSH_ICON } +static DrawInfo *g_di_event_list = NULL; + +int UI_icon_from_event_type(short event_type, short event_value) +{ + if (event_type == RIGHTSHIFTKEY) { + event_type = LEFTSHIFTKEY; + } + else if (event_type == RIGHTCTRLKEY) { + event_type = LEFTCTRLKEY; + } + else if (event_type == RIGHTALTKEY) { + event_type = LEFTALTKEY; + } + else if (event_type == EVT_TWEAK_L) { + event_type = LEFTMOUSE; + event_value = KM_CLICK_DRAG; + } + else if (event_type == EVT_TWEAK_M) { + event_type = MIDDLEMOUSE; + event_value = KM_CLICK_DRAG; + } + else if (event_type == EVT_TWEAK_R) { + event_type = RIGHTMOUSE; + event_value = KM_CLICK_DRAG; + } + + DrawInfo *di = g_di_event_list; + do { + if (di->data.input.event_type == event_type) { + return di->data.input.icon; + } + } while ((di = di->data.input.next)); + + if (event_type == LEFTMOUSE) { + return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_LMB : ICON_MOUSE_LMB_DRAG; + } + else if (event_type == MIDDLEMOUSE) { + return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_MMB : ICON_MOUSE_MMB_DRAG; + } + else if (event_type == RIGHTMOUSE) { + return ELEM(event_value, KM_CLICK, KM_PRESS) ? ICON_MOUSE_RMB : ICON_MOUSE_RMB_DRAG; + } + + return ICON_NONE; +} + +int UI_icon_from_keymap_item(const wmKeyMapItem *kmi, int r_icon_mod[4]) +{ + if (r_icon_mod) { + memset(r_icon_mod, 0x0, sizeof(int[4])); + int i = 0; + if (!ELEM(kmi->ctrl, KM_NOTHING, KM_ANY)) { + r_icon_mod[i++] = ICON_EVENT_CTRL; + } + if (!ELEM(kmi->alt, KM_NOTHING, KM_ANY)) { + r_icon_mod[i++] = ICON_EVENT_ALT; + } + if (!ELEM(kmi->shift, KM_NOTHING, KM_ANY)) { + r_icon_mod[i++] = ICON_EVENT_SHIFT; + } + if (!ELEM(kmi->oskey, KM_NOTHING, KM_ANY)) { + r_icon_mod[i++] = ICON_EVENT_OS; + } + } + return UI_icon_from_event_type(kmi->type, kmi->val); +} + +static void init_event_icons(void) +{ + DrawInfo *di_next = NULL; + +#define INIT_EVENT_ICON(icon_id, type, value) \ + { \ + DrawInfo *di = def_internal_icon(NULL, icon_id, 0, 0, w, ICON_TYPE_EVENT); \ + di->data.input.event_type = type; \ + di->data.input.event_value = value; \ + di->data.input.icon = icon_id; \ + di->data.input.next = di_next; \ + di_next = di; \ + } + /* end INIT_EVENT_ICON */ + + const int w = 16; /* DUMMY */ + + INIT_EVENT_ICON(ICON_EVENT_A, AKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_B, BKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_C, CKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_D, DKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_E, EKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F, FKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_G, GKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_H, HKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_I, IKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_J, JKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_K, KKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_L, LKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_M, MKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_N, NKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_O, OKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_P, PKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Q, QKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_R, RKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_S, SKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_T, TKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_U, UKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_V, VKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_W, WKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_X, XKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Y, YKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_Z, ZKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_SHIFT, LEFTSHIFTKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_CTRL, LEFTCTRLKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_ALT, LEFTALTKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_OS, OSKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F1, F1KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F2, F2KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F3, F3KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F4, F4KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F5, F5KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F6, F6KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F7, F7KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F8, F8KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F9, F9KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F10, F10KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F11, F11KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_F12, F12KEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_ESC, ESCKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_TAB, TABKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_PAGEUP, PAGEUPKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_PAGEDOWN, PAGEDOWNKEY, KM_ANY); + INIT_EVENT_ICON(ICON_EVENT_RETURN, RETKEY, KM_ANY); + + g_di_event_list = di_next; + +#undef INIT_EVENT_ICON +} + static void icon_verify_datatoc(IconImage *iimg) { /* if it has own rect, things are all OK */ @@ -795,6 +941,7 @@ void UI_icons_init(int first_dyn_id) init_iconfile_list(&iconfilelist); init_internal_icons(); init_brush_icons(); + init_event_icons(); #endif } @@ -1285,6 +1432,11 @@ static void icon_draw_size( icon_draw_rect(x, y, w, h, aspect, w, h, ibuf->rect, alpha, rgb, desaturate); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); } + else if (di->type == ICON_TYPE_EVENT) { + const short event_type = di->data.input.event_type; + const short event_value = di->data.input.event_value; + icon_draw_rect_input(x, y, w, h, alpha, event_type, event_value); + } else if (di->type == ICON_TYPE_TEXTURE) { /* texture image use premul alpha for correct scaling */ GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); @@ -1554,7 +1706,7 @@ int UI_idcode_icon_get(const int idcode) case ID_IM: return ICON_IMAGE_DATA; case ID_LA: - return ICON_LAMP_DATA; + return ICON_LIGHT_DATA; case ID_LS: return ICON_LINE_DATA; case ID_LT: diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c new file mode 100644 index 00000000000..dc444b98b2c --- /dev/null +++ b/source/blender/editors/interface/interface_icons_event.c @@ -0,0 +1,295 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/editors/interface/interface_icons_event.c + * \ingroup edinterface + * + * A special set of icons to represent input devices, + * this is a mix of text (via fonts) and a handful of custom glyphs for special keys. + * + * Event codes are used as identifiers. + */ + +#include <math.h> +#include <stdlib.h> +#include <string.h> + +#include "MEM_guardedalloc.h" + +#include "GPU_draw.h" +#include "GPU_matrix.h" +#include "GPU_batch.h" +#include "GPU_immediate.h" +#include "GPU_state.h" + +#include "BLI_blenlib.h" +#include "BLI_utildefines.h" +#include "BLI_fileops_types.h" +#include "BLI_math_vector.h" + +#include "DNA_brush_types.h" +#include "DNA_curve_types.h" +#include "DNA_dynamicpaint_types.h" +#include "DNA_object_types.h" +#include "DNA_screen_types.h" +#include "DNA_space_types.h" +#include "DNA_workspace_types.h" + +#include "RNA_access.h" +#include "RNA_enum_types.h" + +#include "BKE_context.h" +#include "BKE_global.h" +#include "BKE_icons.h" +#include "BKE_appdir.h" +#include "BKE_studiolight.h" + +#include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" +#include "IMB_thumbs.h" + +#include "BIF_glutil.h" +#include "BLF_api.h" + +#include "DEG_depsgraph.h" + +#include "DRW_engine.h" + +#include "ED_datafiles.h" +#include "ED_keyframes_draw.h" +#include "ED_render.h" + +#include "UI_interface.h" +#include "UI_interface_icons.h" + +#include "WM_api.h" +#include "WM_types.h" + +#include "interface_intern.h" + +static void icon_draw_rect_input_small_text_ex( + const rctf *rect, const float color[4], const float margin[2], const char *str, + int font_size) +{ + BLF_batch_draw_flush(); + const int font_id = BLF_default(); + BLF_color4fv(font_id, color); + BLF_size(font_id, font_size * U.pixelsize, U.dpi); + BLF_position(font_id, rect->xmin + margin[0] * 2, rect->ymin + margin[1] * 5, 0.0f); + BLF_draw(font_id, str, BLF_DRAW_STR_DUMMY_MAX); + BLF_batch_draw_flush(); +} + +static void icon_draw_rect_input_small_text( + const rctf *rect, const float color[4], const float margin[2], const char *str) +{ + icon_draw_rect_input_small_text_ex(rect, color, margin, str, 8); +} + +static void icon_draw_rect_input_default_text( + const rctf *rect, + const float color[4], const float margin[2], const char *str) +{ + BLF_batch_draw_flush(); + const int font_id = BLF_default(); + BLF_color4fv(font_id, color); + BLF_position(font_id, (int)(rect->xmin + margin[0] * 5), (int)(rect->ymin + margin[1] * 5), 0.0f); + BLF_draw(font_id, str, BLF_DRAW_STR_DUMMY_MAX); + BLF_batch_draw_flush(); +} + +static void icon_draw_rect_input_mono_text( + const rctf *rect, + const float color[4], const float margin[2], const char *str) +{ + BLF_batch_draw_flush(); + const int font_id = blf_mono_font; + BLF_color4fv(font_id, color); + BLF_size(font_id, 20 * U.pixelsize, U.dpi); + BLF_position(font_id, (int)(rect->xmin + margin[0] * 5), (int)(rect->ymin + margin[1] * 5), 0.0f); + BLF_draw(font_id, str, BLF_DRAW_STR_DUMMY_MAX); + BLF_batch_draw_flush(); +} + +static void icon_draw_rect_input_line_prim( + const rctf *rect, + const float color[4], + const int prim, + const char lines[][2], int lines_len) +{ + glEnable(GL_LINE_SMOOTH); + glEnable(GL_BLEND); + BLI_assert(ELEM(prim, GWN_PRIM_LINE_LOOP, GWN_PRIM_LINE_STRIP)); + const uint pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformColor4fv(color); + immBegin(prim, lines_len); + float w_inv = BLI_rctf_size_x(rect) / 255.0f; + float h_inv = BLI_rctf_size_y(rect) / 255.0f; + for (int i = 0; i < lines_len; i++) { + immVertex2f( + pos_id, + round_fl_to_int(rect->xmin + ((float)lines[i][0] * w_inv)), + round_fl_to_int(rect->ymin + ((float)lines[i][1] * h_inv)) + ); + } + immEnd(); + immUnbindProgram(); + glDisable(GL_LINE_SMOOTH); + glDisable(GL_BLEND); +} + +void icon_draw_rect_input( + float x, float y, int w, int h, float UNUSED(alpha), + short event_type, short UNUSED(event_value)) +{ + float color[4]; + const float margin[2] = {w / 20.0f, h / 20.0f}; + UI_GetThemeColor4fv(TH_TEXT, color); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_aa( + false, + (int)x, + (int)y, + (int)(x + w), + (int)(y + h), 4.0f, color + ); + + const rctf rect = { + .xmin = x, + .ymin = y, + .xmax = x + w, + .ymax = y + h, + }; + + const bool simple_text = false; + + if ((event_type >= AKEY) || (ZKEY <= event_type)) { + char str[2] = {'A' + (event_type - AKEY), '\0'}; + icon_draw_rect_input_default_text(&rect, color, margin, str); + } + if ((event_type >= F1KEY) || (F12KEY <= event_type)) { + char str[3] = {'F', '1' + (event_type - F1KEY), '\0'}; + icon_draw_rect_input_default_text(&rect, color, margin, str); + } + else if (event_type == LEFTSHIFTKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "Shift"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -14.0f), (w / -14.0f)); + icon_draw_rect_input_mono_text(&rect_ofs, color, margin, (const char[]){0xe2, 0x87, 0xa7, 0x0}); + } + } + else if (event_type == LEFTCTRLKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "Ctrl"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -16.0f), 0.0f); + icon_draw_rect_input_default_text(&rect_ofs, color, margin, "^"); + } + } + else if (event_type == LEFTALTKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "Alt"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -8.0f), 0.0f); + icon_draw_rect_input_default_text(&rect_ofs, color, margin, (const char[]){0xe2, 0x8c, 0xa5, 0x0}); + } + } + else if (event_type == OSKEY) { + icon_draw_rect_input_small_text(&rect, color, margin, "OS"); + } + else if (event_type == DELKEY) { + icon_draw_rect_input_small_text(&rect, color, margin, "Del"); + } + else if (event_type == TABKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "Tab"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -12.0f), (w / -12.0f)); + icon_draw_rect_input_mono_text(&rect_ofs, color, margin, (const char[]){0xe2, 0x86, 0xb9, 0x0}); + } + } + else if (event_type == HOMEKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "Home"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -12.0f), (w / -12.0f)); + icon_draw_rect_input_mono_text(&rect_ofs, color, margin, (const char[]){0xe2, 0x87, 0xa4, 0x0}); + } + } + else if (event_type == ENDKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "End"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -12.0f), (w / -12.0f)); + icon_draw_rect_input_mono_text(&rect_ofs, color, margin, (const char[]){0xe2, 0x87, 0xa5, 0x0}); + } + } + else if (event_type == RETKEY) { + if (simple_text) { + icon_draw_rect_input_small_text(&rect, color, margin, "Ret"); + } + else { + rctf rect_ofs = rect; + BLI_rctf_translate(&rect_ofs, (w / -8.0f), (w / -6.0f)); + icon_draw_rect_input_mono_text(&rect_ofs, color, margin, (const char[]){0xe2, 0x8f, 0x8e, 0x0}); + } + } + else if (event_type == ESCKEY) { + icon_draw_rect_input_small_text(&rect, color, margin, "Esc"); + } + else if (event_type == PAGEUPKEY) { + icon_draw_rect_input_small_text_ex(&rect, color, margin, (const char[]){'P', 0xe2, 0x86, 0x91, 0x0}, 10); + } + else if (event_type == PAGEDOWNKEY) { + icon_draw_rect_input_small_text_ex(&rect, color, margin, (const char[]){'P', 0xe2, 0x86, 0x93, 0x0}, 10); + } + else if (event_type == LEFTARROWKEY) { + icon_draw_rect_input_default_text(&rect, color, margin, (const char[]){0xe2, 0x86, 0x90, 0x0}); + } + else if (event_type == UPARROWKEY) { + icon_draw_rect_input_default_text(&rect, color, margin, (const char[]){0xe2, 0x86, 0x91, 0x0}); + } + else if (event_type == RIGHTARROWKEY) { + icon_draw_rect_input_default_text(&rect, color, margin, (const char[]){0xe2, 0x86, 0x92, 0x0}); + } + else if (event_type == DOWNARROWKEY) { + icon_draw_rect_input_default_text(&rect, color, margin, (const char[]){0xe2, 0x86, 0x93, 0x0}); + } + else if (event_type == SPACEKEY) { + const uchar lines[] = {60, 118, 60, 60, 195, 60, 195, 118}; + icon_draw_rect_input_line_prim( + &rect, color, GWN_PRIM_LINE_STRIP, + (const void *)lines, ARRAY_SIZE(lines) / 2); + } +} diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 04e9e2b18b4..ffc389c6dfd 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -105,7 +105,8 @@ typedef enum { UI_WTYPE_PROGRESSBAR, } uiWidgetTypeEnum; -#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9) +#define UI_MENU_WIDTH_MIN (UI_UNIT_Y * 9) +#define UI_MENU_SUBMENU_PADDING (6 * UI_DPI_FAC) /* some extra padding added to menus containing submenu icons */ /* menu scrolling */ #define UI_MENU_SCROLL_ARROW 12 @@ -349,6 +350,13 @@ struct PieMenuData { float alphafac; }; +/* uiBlock.content_hints */ +enum eBlockContentHints { + /* In a menu block, if there is a single sub-menu button, we add some + * padding to the right to put nicely aligned triangle icons there. */ + BLOCK_CONTAINS_SUBMENU_BUT = (1 << 0), +}; + struct uiBlock { uiBlock *next, *prev; @@ -395,11 +403,15 @@ struct uiBlock { int flag; short alignnr; + /* Hints about the buttons of this block. Used to avoid iterating over + * buttons to find out if some criteria is met by any. Instead, check this + * criteria when adding the button and set a flag here if it's met. */ + short content_hints; /* eBlockContentHints */ char direction; char dt; /* drawtype: UI_EMBOSS, UI_EMBOSS_NONE ... etc, copied to buttons */ bool auto_open; - char _pad[7]; + char _pad[5]; double auto_open_last; const char *lockstr; @@ -744,8 +756,7 @@ struct Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased); struct Gwn_Batch *ui_batch_roundbox_widget_get(int tria); struct Gwn_Batch *ui_batch_roundbox_shadow_get(void); -void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, - float rad, bool use_alpha, const float color[4]); +void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]); void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect); void ui_draw_pie_center(uiBlock *block); @@ -778,6 +789,11 @@ void uiStyleInit(void); void ui_icon_ensure_deferred(const struct bContext *C, const int icon_id, const bool big); int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big); +/* interface_icons_event.c */ +void icon_draw_rect_input( + float x, float y, int w, int h, float alpha, + short event_type, short event_value); + /* resources.c */ void init_userdef_do_versions(struct Main *bmain); void ui_theme_init_default(void); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index a99a6610e88..27afdcdd202 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -469,23 +469,6 @@ void UI_draw_icon_tri(float x, float y, char dir, const float color[4]) } } -/* triangle 'icon' inside rect */ -static void ui_draw_tria_rect(const rctf *rect, char dir) -{ - float color[4]; - UI_GetThemeColor3fv(TH_TITLE, color); - color[3] = 1.0f; - - if (dir == 'h') { - float half = 0.5f * BLI_rctf_size_y(rect); - UI_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half, color); - } - else { - float half = 0.5f * BLI_rctf_size_x(rect); - UI_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin, color); - } -} - static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float y2) { @@ -695,7 +678,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con titlerect.xmin += 5.0f / block->aspect; } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (!is_subpanel) { @@ -708,7 +691,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con if (UI_GetThemeValue(TH_PANEL_SHOW_HEADER)) { /* draw with background color */ immUniformThemeColor(TH_PANEL_HEADER); - immRectf(pos, minx, headrect.ymin + 1, maxx, y); + immRectf(pos, minx, headrect.ymin, maxx, y); immBegin(GWN_PRIM_LINES, 4); @@ -770,7 +753,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con ui_draw_aligned_panel_header(style, block, &titlerect, 'h'); if (show_drag) { - unsigned int col; + uint col; Gwn_VertFormat *format = immVertexFormat(); pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); @@ -853,12 +836,18 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con BLI_rctf_scale(&itemrect, 0.25f); - if (is_closed_y) - ui_draw_tria_rect(&itemrect, 'h'); - else if (is_closed_x) - ui_draw_tria_rect(&itemrect, 'h'); - else - ui_draw_tria_rect(&itemrect, 'v'); + { + float tria_color[4]; + UI_GetThemeColor3fv(TH_TITLE, tria_color); + tria_color[3] = 1.0f; + + if (is_closed_y) + ui_draw_anti_tria_rect(&itemrect, 'h', tria_color); + else if (is_closed_x) + ui_draw_anti_tria_rect(&itemrect, 'h', tria_color); + else + ui_draw_anti_tria_rect(&itemrect, 'v', tria_color); + } } /************************** panel alignment *************************/ @@ -1741,30 +1730,30 @@ static void ui_panel_category_draw_tab( int a; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); /* mult */ for (a = 0; a < 4; a++) { mul_v2_fl(vec[a], rad); } - unsigned int vert_ct = 0; + uint vert_len = 0; if (use_highlight) { - vert_ct += (roundboxtype & UI_CNR_TOP_RIGHT) ? 6 : 1; - vert_ct += (roundboxtype & UI_CNR_TOP_LEFT) ? 6 : 1; + vert_len += (roundboxtype & UI_CNR_TOP_RIGHT) ? 6 : 1; + vert_len += (roundboxtype & UI_CNR_TOP_LEFT) ? 6 : 1; } if (use_highlight && !use_shadow) { - vert_ct++; + vert_len++; } else { - vert_ct += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 6 : 1; - vert_ct += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 6 : 1; + vert_len += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 6 : 1; + vert_len += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 6 : 1; } immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_ct); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_len); /* start with corner right-top */ if (use_highlight) { @@ -1969,7 +1958,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* begin drawing */ GPU_line_smooth(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw the background */ diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 320ee1f4616..1bbf2242c5d 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -116,6 +116,9 @@ static void ui_popup_block_position(wmWindow *window, ARegion *butregion, uiBut BLI_rctf_init_minmax(&block->rect); for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { + if (block->content_hints & BLOCK_CONTAINS_SUBMENU_BUT) { + bt->rect.xmax += UI_MENU_SUBMENU_PADDING; + } BLI_rctf_union(&block->rect, &bt->rect); } } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 1c3ed3e3c75..f80e4e486d6 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -518,7 +518,7 @@ static const char *template_id_browse_tip(const StructRNA *type) case ID_IM: return N_("Browse Image to be linked"); case ID_LS: return N_("Browse Line Style Data to be linked"); case ID_LT: return N_("Browse Lattice Data to be linked"); - case ID_LA: return N_("Browse Lamp Data to be linked"); + case ID_LA: return N_("Browse Light Data to be linked"); case ID_CA: return N_("Browse Camera Data to be linked"); case ID_WO: return N_("Browse World Settings to be linked"); case ID_SCR: return N_("Choose Screen layout"); @@ -1863,7 +1863,7 @@ void uiTemplatePreview( char _preview_id[UI_MAX_NAME_STR]; if (id && !ELEM(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA, ID_LS)) { - RNA_warning("Expected ID of type material, texture, lamp, world or line style"); + RNA_warning("Expected ID of type material, texture, light, world or line style"); return; } @@ -1954,7 +1954,7 @@ void uiTemplatePreview( pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); } else if (GS(parent->name) == ID_LA) { - uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Lamp"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + uiDefButS(block, UI_BTYPE_ROW, B_MATPRV, IFACE_("Light"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); } else if (GS(parent->name) == ID_WO) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c390c3fdda8..03ff6593c59 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -259,7 +259,7 @@ static struct { static Gwn_VertFormat *vflag_format(void) { - if (g_ui_batch_cache.format.attrib_ct == 0) { + if (g_ui_batch_cache.format.attr_len == 0) { Gwn_VertFormat *format = &g_ui_batch_cache.format; g_ui_batch_cache.vflag_id = GWN_vertformat_attr_add(format, "vflag", GWN_COMP_U32, 1, GWN_FETCH_INT); } @@ -512,7 +512,7 @@ void UI_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); @@ -532,6 +532,20 @@ void UI_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y GPU_blend(false); } +/* triangle 'icon' inside rect */ +void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]) +{ + if (dir == 'h') { + float half = 0.5f * BLI_rctf_size_y(rect); + UI_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half, color); + } + else { + float half = 0.5f * BLI_rctf_size_x(rect); + UI_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin, color); + } +} + + void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float color[4]) { float draw_color[4]; @@ -541,7 +555,7 @@ void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float col GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); @@ -1255,8 +1269,8 @@ static int ui_but_draw_menu_icon(const uiBut *but) /* icons have been standardized... and this call draws in untransformed coordinates */ static void widget_draw_icon_ex( - const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, const bool show_menu_icon, - const int icon_size) + const uiBut *but, BIFIconID icon, float alpha, + const rcti *rect, const int icon_size) { float xs = 0.0f, ys = 0.0f; float aspect, height; @@ -1331,20 +1345,35 @@ static void widget_draw_icon_ex( } } - if (show_menu_icon) { - xs = rect->xmax - UI_DPI_ICON_SIZE - aspect; - ys = (rect->ymin + rect->ymax - height) / 2.0f; - - UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha); - } - GPU_blend(false); } static void widget_draw_icon( - const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, const bool show_menu_icon) + const uiBut *but, BIFIconID icon, float alpha, const rcti *rect) +{ + widget_draw_icon_ex(but, icon, alpha, rect, ICON_DEFAULT_HEIGHT); +} + +static void widget_draw_submenu_tria(const uiBut *but, const rcti *rect, const uiWidgetColors *wcol) { - widget_draw_icon_ex(but, icon, alpha, rect, show_menu_icon, ICON_DEFAULT_HEIGHT); + const float aspect = but->block->aspect / UI_DPI_FAC; + const int tria_height = (int)(ICON_DEFAULT_HEIGHT / aspect); + const int tria_width = (int)(ICON_DEFAULT_WIDTH / aspect) - 2 * U.pixelsize; + const int xs = rect->xmax - tria_width; + const int ys = (rect->ymin + rect->ymax - tria_height) / 2.0f; + float col[4]; + rctf tria_rect; + + rgba_uchar_to_float(col, (const uchar *)wcol->text); + col[3] *= 0.8f; + + BLI_rctf_init(&tria_rect, xs, xs + tria_width, ys, ys + tria_height); + BLI_rctf_scale(&tria_rect, 0.4f); + + GPU_blend(true); + UI_widgetbase_draw_cache_flush(); + GPU_blend(false); + ui_draw_anti_tria_rect(&tria_rect, 'h', col); } static void ui_text_clip_give_prev_off(uiBut *but, const char *str) @@ -1806,7 +1835,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->item); @@ -1842,7 +1871,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b UI_widgetbase_draw_cache_flush(); GPU_blend(false); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.6f, 0.9f); @@ -1987,7 +2016,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_POPOVER) && (but->flag & UI_BUT_NODE_LINK)) { rcti temp = *rect; temp.xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; - widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp, false); + widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp); rect->xmax = temp.xmin; } @@ -2057,17 +2086,17 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB else if (ui_block_is_menu(but->block)) rect->xmin += 0.3f * U.widget_unit; - widget_draw_icon(but, icon, alpha, rect, show_menu_icon); + widget_draw_icon(but, icon, alpha, rect); + if (show_menu_icon) { + BLI_assert(but->block->content_hints & BLOCK_CONTAINS_SUBMENU_BUT); + widget_draw_submenu_tria(but, rect, wcol); + } #ifdef USE_UI_TOOLBAR_HACK but->block->aspect = aspect_orig; #endif rect->xmin += icon_size; - /* without this menu keybindings will overlap the arrow icon [#38083] */ - if (show_menu_icon) { - rect->xmax -= icon_size / 2.0f; - } } if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT)) { @@ -2077,6 +2106,12 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB rect->xmax -= (UI_TEXT_MARGIN_X * U.widget_unit) / but->block->aspect; } + /* Menu contains sub-menu items with triangle icon on their right. Shortcut + * strings should be drawn with some padding to the right then. */ + if (ui_block_is_menu(but->block) && (but->block->content_hints & BLOCK_CONTAINS_SUBMENU_BUT)) { + rect->xmax -= UI_MENU_SUBMENU_PADDING; + } + /* extra icons, e.g. 'x' icon to clear text or icon for eyedropper */ if (extra_icon_type != UI_BUT_ICONEXTRA_NONE) { rcti temp = *rect; @@ -2084,10 +2119,10 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); if (extra_icon_type == UI_BUT_ICONEXTRA_CLEAR) { - widget_draw_icon(but, ICON_PANEL_CLOSE, alpha, &temp, false); + widget_draw_icon(but, ICON_PANEL_CLOSE, alpha, &temp); } else if (extra_icon_type == UI_BUT_ICONEXTRA_EYEDROPPER) { - widget_draw_icon(but, ICON_EYEDROPPER, alpha, &temp, false); + widget_draw_icon(but, ICON_EYEDROPPER, alpha, &temp); } else { BLI_assert(0); @@ -2387,7 +2422,7 @@ static void widget_softshadow(const rcti *rect, int roundboxalign, const float r /* we draw a number of increasing size alpha quad strips */ alphastep = 3.0f * btheme->tui.menu_shadow_fac / radout; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2439,7 +2474,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir static void ui_hsv_cursor(float x, float y) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2536,8 +2571,8 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -2647,8 +2682,8 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons /* old below */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); immBegin(GWN_PRIM_TRIS, steps * 3 * 6); @@ -2807,7 +2842,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) ui_hsv_cursor(x, y); /* outline */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ub(0, 0, 0); imm_draw_box_wire_2d(pos, (rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); @@ -2904,7 +2939,7 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol) 30 }; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_blend(true); @@ -3366,7 +3401,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat UI_widgetbase_draw_cache_flush(); GPU_blend(false); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(bw, bw, bw); @@ -3747,7 +3782,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * /* note: drawextra can change rect +1 or -1, to match round errors of existing previews */ but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* make mask to draw over image */ @@ -4384,7 +4419,7 @@ static void ui_draw_popover_back_impl( /* Draw popover arrow (top/bottom) */ if (ELEM(direction, UI_DIR_UP, UI_DIR_DOWN)) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->inner); GPU_blend(true); @@ -4521,7 +4556,7 @@ void ui_draw_pie_center(uiBlock *block) } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)btheme->tui.wcol_pie_menu.outline); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index fc282e50ce2..bf768f26a93 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1340,8 +1340,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) return; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GWN_PRIM_LINES, vertex_count); @@ -1482,8 +1482,8 @@ void UI_view2d_constant_grid_draw(View2D *v2d, float step) if (count_x > 0 || count_y > 0) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); @@ -1533,8 +1533,8 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); GPU_line_width(1.0f); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 6b5fce26deb..4717ef309f3 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -125,7 +125,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -213,7 +213,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); immUniform1f("size", 0.7f * handle_size); @@ -371,10 +371,10 @@ static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char r } } -static void mask_draw_array(unsigned int pos, Gwn_PrimType prim_type, const float (*points)[2], unsigned int vertex_ct) +static void mask_draw_array(unsigned int pos, Gwn_PrimType prim_type, const float (*points)[2], unsigned int vertex_len) { - immBegin(prim_type, vertex_ct); - for (unsigned int i = 0; i < vertex_ct; ++i) { + immBegin(prim_type, vertex_len); + for (unsigned int i = 0; i < vertex_len; ++i) { immVertex2fv(pos, points[i]); } immEnd(); @@ -403,7 +403,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); switch (draw_type) { @@ -747,7 +747,7 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra unsigned int num_lines = BLI_listbase_count(&masklay->splines_shapes); if (num_lines > 0) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 175, 0, 255); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 8f8400e2d20..8a9a5eadbdd 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1007,7 +1007,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) copy_v3_v3(v2, ray_hit_best[1]); } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_TRANSFORM); @@ -1048,7 +1048,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void gpuPushMatrix(); gpuMultMatrix(kcd->ob->obmat); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index b437bdca111..87c006095ed 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -116,7 +116,7 @@ static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *a gpuPushMatrix(); gpuMultMatrix(lcd->ob->obmat); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ub(255, 0, 255); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index a8c3c905dd4..a8917f4c4aa 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -120,12 +120,12 @@ /* this is an exact copy of the define in rna_lamp.c * kept here because of linking order. * Icons are only defined here */ -const EnumPropertyItem rna_enum_lamp_type_items[] = { - {LA_LOCAL, "POINT", ICON_LAMP_POINT, "Point", "Omnidirectional point light source"}, - {LA_SUN, "SUN", ICON_LAMP_SUN, "Sun", "Constant direction parallel ray light source"}, - {LA_SPOT, "SPOT", ICON_LAMP_SPOT, "Spot", "Directional cone light source"}, - {LA_HEMI, "HEMI", ICON_LAMP_HEMI, "Hemi", "180 degree constant light source"}, - {LA_AREA, "AREA", ICON_LAMP_AREA, "Area", "Directional area light source"}, +const EnumPropertyItem rna_enum_light_type_items[] = { + {LA_LOCAL, "POINT", ICON_LIGHT_POINT, "Point", "Omnidirectional point light source"}, + {LA_SUN, "SUN", ICON_LIGHT_SUN, "Sun", "Constant direction parallel ray light source"}, + {LA_SPOT, "SPOT", ICON_LIGHT_SPOT, "Spot", "Directional cone light source"}, + {LA_HEMI, "HEMI", ICON_LIGHT_HEMI, "Hemi", "180 degree constant light source"}, + {LA_AREA, "AREA", ICON_LIGHT_AREA, "Area", "Directional area light source"}, {0, NULL, 0, NULL, NULL} }; @@ -985,9 +985,9 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot) ED_object_add_generic_props(ot, false); } -/********************* Add Lamp Operator ********************/ +/********************* Add Light Operator ********************/ -static const char *get_lamp_defname(int type) +static const char *get_light_defname(int type) { switch (type) { case LA_LOCAL: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Point"); @@ -996,11 +996,11 @@ static const char *get_lamp_defname(int type) case LA_HEMI: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Hemi"); case LA_AREA: return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Area"); default: - return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Lamp"); + return CTX_DATA_(BLT_I18NCONTEXT_ID_LAMP, "Light"); } } -static int object_lamp_add_exec(bContext *C, wmOperator *op) +static int object_light_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob; @@ -1013,10 +1013,10 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op) if (!ED_object_add_generic_get_opts(C, op, 'Z', loc, rot, NULL, &layer, NULL)) return OPERATOR_CANCELLED; - ob = ED_object_add_type(C, OB_LAMP, get_lamp_defname(type), loc, rot, false, layer); + ob = ED_object_add_type(C, OB_LAMP, get_light_defname(type), loc, rot, false, layer); float size = RNA_float_get(op->ptr, "radius"); - /* Better defaults for lamp size. */ + /* Better defaults for light size. */ switch (type) { case LA_LOCAL: case LA_SPOT: @@ -1041,23 +1041,23 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void OBJECT_OT_lamp_add(wmOperatorType *ot) +void OBJECT_OT_light_add(wmOperatorType *ot) { /* identifiers */ - ot->name = "Add Lamp"; - ot->description = "Add a lamp object to the scene"; - ot->idname = "OBJECT_OT_lamp_add"; + ot->name = "Add Light"; + ot->description = "Add a light object to the scene"; + ot->idname = "OBJECT_OT_light_add"; /* api callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = object_lamp_add_exec; + ot->exec = object_light_add_exec; ot->poll = ED_operator_objectmode; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_lamp_type_items, 0, "Type", ""); + ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_light_type_items, 0, "Type", ""); RNA_def_property_translation_context(ot->prop, BLT_I18NCONTEXT_ID_LAMP); ED_object_add_unit_props(ot); diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index b1ea6d72346..1b5c6df2632 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -115,7 +115,7 @@ void OBJECT_OT_armature_add(struct wmOperatorType *ot); void OBJECT_OT_empty_add(struct wmOperatorType *ot); void OBJECT_OT_lightprobe_add(struct wmOperatorType *ot); void OBJECT_OT_drop_named_image(struct wmOperatorType *ot); -void OBJECT_OT_lamp_add(struct wmOperatorType *ot); +void OBJECT_OT_light_add(struct wmOperatorType *ot); void OBJECT_OT_effector_add(struct wmOperatorType *ot); void OBJECT_OT_camera_add(struct wmOperatorType *ot); void OBJECT_OT_speaker_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 43d993531bc..5a83d085aee 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -114,7 +114,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_empty_add); WM_operatortype_append(OBJECT_OT_lightprobe_add); WM_operatortype_append(OBJECT_OT_drop_named_image); - WM_operatortype_append(OBJECT_OT_lamp_add); + WM_operatortype_append(OBJECT_OT_light_add); WM_operatortype_append(OBJECT_OT_camera_add); WM_operatortype_append(OBJECT_OT_speaker_add); WM_operatortype_append(OBJECT_OT_add); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index b1dee812f45..d5f7a93cc6e 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -485,7 +485,7 @@ enum { OBJECT_GRPSEL_PASS = 8, OBJECT_GRPSEL_COLOR = 9, OBJECT_GRPSEL_KEYINGSET = 10, - OBJECT_GRPSEL_LAMP_TYPE = 11, + OBJECT_GRPSEL_LIGHT_TYPE = 11, }; static const EnumPropertyItem prop_select_grouped_types[] = { @@ -499,7 +499,7 @@ static const EnumPropertyItem prop_select_grouped_types[] = { {OBJECT_GRPSEL_PASS, "PASS", 0, "Pass", "Render pass Index"}, {OBJECT_GRPSEL_COLOR, "COLOR", 0, "Color", "Object Color"}, {OBJECT_GRPSEL_KEYINGSET, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"}, - {OBJECT_GRPSEL_LAMP_TYPE, "LAMP_TYPE", 0, "Lamp Type", "Matching lamp types"}, + {OBJECT_GRPSEL_LIGHT_TYPE, "LIGHT_TYPE", 0, "Light Type", "Matching light types"}, {0, NULL, 0, NULL, NULL} }; @@ -803,9 +803,9 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) case OBJECT_GRPSEL_KEYINGSET: changed |= select_grouped_keyingset(C, ob, op->reports); break; - case OBJECT_GRPSEL_LAMP_TYPE: + case OBJECT_GRPSEL_LIGHT_TYPE: if (ob->type != OB_LAMP) { - BKE_report(op->reports, RPT_ERROR, "Active object must be a lamp"); + BKE_report(op->reports, RPT_ERROR, "Active object must be a light"); break; } changed |= select_grouped_lamptype(C, ob); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 721d248ae4c..d2a0879464b 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -485,7 +485,7 @@ static int apply_objects_internal( if (la->type == LA_AREA) { if (apply_rot || apply_loc) { BKE_reportf(reports, RPT_ERROR, - "Area Lamps can only have scale applied: \"%s\"", + "Area Lights can only have scale applied: \"%s\"", ob->id.name + 2); changed = false; } @@ -1540,8 +1540,8 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const void OBJECT_OT_transform_axis_target(wmOperatorType *ot) { /* identifiers */ - ot->name = "Interactive Lamp Track to Cursor"; - ot->description = "Interactively point cameras and lamps to a location (Ctrl translates)"; + ot->name = "Interactive Light Track to Cursor"; + ot->description = "Interactively point cameras and lights to a location (Ctrl translates)"; ot->idname = "OBJECT_OT_transform_axis_target"; /* api callbacks */ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index a08e35d08a7..10d9c90aeb3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2892,7 +2892,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) brush = &pset->brush[pset->brushtype]; if (brush) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 128); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index ae364828119..d6a968d993c 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -427,7 +427,7 @@ static void make_renderinfo_string(const RenderStats *rs, if (rs->totface) spos += sprintf(spos, IFACE_("Fa:%d "), rs->totface); if (rs->tothalo) spos += sprintf(spos, IFACE_("Ha:%d "), rs->tothalo); if (rs->totstrand) spos += sprintf(spos, IFACE_("St:%d "), rs->totstrand); - if (rs->totlamp) spos += sprintf(spos, IFACE_("La:%d "), rs->totlamp); + if (rs->totlamp) spos += sprintf(spos, IFACE_("Li:%d "), rs->totlamp); if (rs->mem_peak == 0.0f) spos += sprintf(spos, IFACE_("| Mem:%.2fM (%.2fM, Peak %.2fM) "), diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 19f30ac59aa..886b3112aad 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -1836,7 +1836,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) if (id == NULL) { Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data; - Lamp *la = CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data; + Lamp *la = CTX_data_pointer_get_type(C, "light", &RNA_Light).data; World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data; ParticleSystem *psys = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data; FreestyleLineStyle *linestyle = CTX_data_pointer_get_type(C, "line_style", &RNA_FreestyleLineStyle).data; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 77e178bf0b2..137fd01a146 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -106,7 +106,7 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides) UI_GetThemeColor3fv(TH_EDITOR_OUTLINE, color); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -263,7 +263,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f BLI_rcti_init(&click_rect, x, x + icon_size, y, y + icon_size); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -296,7 +296,7 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2) float pad = 0.2f * U.widget_unit; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); GPU_blend(true); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -501,7 +501,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) #if 0 GPU_blend(true); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(drand48(), drand48(), drand48(), 0.1f); immRectf(pos, ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin, @@ -2473,7 +2473,7 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(fill_color); immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); @@ -2692,7 +2692,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); /* draw top box */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2717,7 +2717,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); /* draw top box */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2746,7 +2746,7 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) UI_view2d_view_to_region(&ar->v2d, 1.0f, 1.0f, &x2, &y2); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 20); @@ -2877,7 +2877,7 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect) void ED_region_cache_draw_background(const ARegion *ar) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 64); immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC); @@ -2897,7 +2897,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f BLF_width_and_height(fontid, numstr, sizeof(numstr), &font_dims[0], &font_dims[1]); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); immRecti(pos, x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f); @@ -2911,7 +2911,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f void ED_region_cache_draw_cached_segments(const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra) { if (num_segments) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 128); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index b5b0d16f6a7..9c46938a90f 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -323,7 +323,7 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey) /* Wrap up the corners with a nice embossing. */ rcti rect = sa->totrct; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -439,7 +439,7 @@ void ED_screen_draw_edges(wmWindow *win) ScrArea *sa; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Note: first loop only draws if U.pixelsize > 1, skip otherwise */ @@ -477,7 +477,7 @@ void ED_screen_draw_edges(wmWindow *win) */ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_width(1); @@ -518,7 +518,7 @@ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* splitpoint */ @@ -594,7 +594,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2 const float ofs_between_areas) { const float ofs_h = ofs_between_areas * 0.5f; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 4a8ab724c9a..381a20feca4 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -4888,9 +4888,11 @@ void ED_keymap_screen(wmKeyConfig *keyconf) /* tests */ WM_keymap_add_item(keymap, "SCREEN_OT_region_quadview", QKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); + + WM_keymap_add_item(keymap, "SCREEN_OT_repeat_last", RKEY, KM_PRESS, KM_SHIFT, 0); + #ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0); - WM_keymap_add_item(keymap, "SCREEN_OT_repeat_last", RKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 815bcd8a050..6b3c358d2ac 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -681,8 +681,8 @@ static void paint_draw_tex_overlay( /* set quad color. Colored overlay does not get blending */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (col) { immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -770,8 +770,8 @@ static void paint_draw_cursor_overlay( } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -930,7 +930,7 @@ static void paint_draw_curve_cursor(Brush *brush) GPU_blend(true); /* draw the bezier handles and the curve segment between the current and next point */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1118,7 +1118,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) GPU_blend(true); /* TODO: also set blend mode? */ GPU_line_smooth(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* set brush color */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 7f71270c52d..6276a2838f5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -420,7 +420,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda GPU_blend(true); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 8db78a41252..0ef25eb63a1 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -155,7 +155,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata ARegion *ar = stroke->vc.ar; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(paint->paint_cursor_col); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 29b258fc80d..a0ef753e200 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -215,7 +215,7 @@ static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(cu alpha *= (size - PX_SIZE_FADE_MIN) / (PX_SIZE_FADE_MAX - PX_SIZE_FADE_MIN); } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fvAlpha(brush->add_col, alpha); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 6105652a4c7..8e521c997fd 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -212,7 +212,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) y = (float)(-ACHANNEL_HEIGHT(ac)); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -404,7 +404,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* iterate over pointcaches on the active object, and draw each one's range */ diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 4c6de3ec012..faee9c2b7ac 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -234,7 +234,7 @@ static int buttons_context_path_data(ButsContextPath *path, int type) else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1; else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1; else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1; - else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1; + else if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) return 1; else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1; else if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) return 1; /* try to get an object in the path, no pinning supported here */ @@ -679,7 +679,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) const char *buttons_context_dir[] = { "texture_slot", "scene", "world", "object", "mesh", "armature", "lattice", "curve", - "meta_ball", "lamp", "speaker", "lightprobe", "camera", "material", "material_slot", + "meta_ball", "light", "speaker", "lightprobe", "camera", "material", "material_slot", "texture", "texture_user", "texture_user_property", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable", "particle_settings", "cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", @@ -736,8 +736,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_MetaBall); return 1; } - else if (CTX_data_equals(member, "lamp")) { - set_pointer_type(path, result, &RNA_Lamp); + else if (CTX_data_equals(member, "light")) { + set_pointer_type(path, result, &RNA_Light); return 1; } else if (CTX_data_equals(member, "camera")) { diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index d50d10d5cc3..76450cba3cb 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -128,10 +128,10 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) float strip[4], selected_strip[4]; float height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT); - unsigned int keyframe_ct = 0; + uint keyframe_len = 0; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* don't use totrect set, as the width stays the same @@ -186,10 +186,10 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) if (start_frame != end_frame) { immRectf(pos_id, start_frame, (float) y - STRIP_HEIGHT_HALF, end_frame, (float) y + STRIP_HEIGHT_HALF); - keyframe_ct += 2; + keyframe_len += 2; } else { - keyframe_ct++; + keyframe_len++; } } @@ -199,7 +199,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) MovieTrackingMarker *marker = &track->markers[i]; if ((marker->flag & (MARKER_DISABLED | MARKER_TRACKED)) == 0) { - keyframe_ct++; + keyframe_len++; } i++; @@ -212,17 +212,17 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) immUnbindProgram(); - if (keyframe_ct > 0) { + if (keyframe_len > 0) { /* draw keyframe markers */ format = immVertexFormat(); pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); - unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, keyframe_ct); + immBegin(GWN_PRIM_POINTS, keyframe_len); /* all same size with black outline */ immAttrib1f(size_id, 2.0f * STRIP_HEIGHT_HALF); @@ -316,7 +316,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) float y = (float) CHANNEL_FIRST; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 909f0a55c1c..164565192fd 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -167,7 +167,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points); ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* track */ @@ -290,7 +290,7 @@ static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx { int x, y; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* find window pixel coordinates of origin */ @@ -452,7 +452,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin i++; } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1145,8 +1145,8 @@ static void draw_plane_marker_image(Scene *scene, gpuMultMatrix(gl_matrix); Gwn_VertFormat *imm_format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, plane_track->image_opacity); @@ -1414,7 +1414,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie } } - unsigned int position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1598,7 +1598,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, gpuMultMatrix(sc->stabmat); gpuScale2f(width, height); - unsigned int position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index d463f585470..34720b3a627 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -328,7 +328,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_free(grid); if (clip) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_point_size(3.0f); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index c3208260b3b..c94853d4233 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -273,7 +273,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 66b203ff612..0ffbe451042 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -159,7 +159,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); xy[1] += tvc->lheight / 6; console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 4d4845c41b9..42ad34b659b 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -403,7 +403,7 @@ static void file_draw_preview( /* border */ if (use_dropshadow) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -466,7 +466,7 @@ static void draw_background(FileLayout *layout, View2D *v2d) int i; int sy; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, -7); @@ -486,14 +486,14 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) const int step = (layout->tile_w + 2 * layout->tile_border_x); - unsigned int vertex_ct = 0; + unsigned int vertex_len = 0; int sx = (int)v2d->tot.xmin; while (sx < v2d->cur.xmax) { sx += step; - vertex_ct += 4; /* vertex_count = 2 points per line * 2 lines per divider */ + vertex_len += 4; /* vertex_count = 2 points per line * 2 lines per divider */ } - if (vertex_ct > 0) { + if (vertex_len > 0) { int v1[2], v2[2]; unsigned char col_hi[3], col_lo[3]; @@ -504,11 +504,11 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) v2[1] = v2d->cur.ymin; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_LINES, vertex_ct); + immBegin(GWN_PRIM_LINES, vertex_len); sx = (int)v2d->tot.xmin; while (sx < v2d->cur.xmax) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 09e2660a762..968757bc637 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2357,7 +2357,7 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) filelist->filelist.entries[9].entry->relpath = BLI_strdup("Ika"); filelist->filelist.entries[10].entry->relpath = BLI_strdup("Wave"); filelist->filelist.entries[11].entry->relpath = BLI_strdup("Lattice"); - filelist->filelist.entries[12].entry->relpath = BLI_strdup("Lamp"); + filelist->filelist.entries[12].entry->relpath = BLI_strdup("Light"); filelist->filelist.entries[13].entry->relpath = BLI_strdup("Camera"); filelist->filelist.entries[14].entry->relpath = BLI_strdup("Ipo"); filelist->filelist.entries[15].entry->relpath = BLI_strdup("World"); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 4e9f8cd3733..16658c0d8db 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -286,7 +286,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool * - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users) */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); GPU_blend(true); GPU_enable_program_point_size(); @@ -331,8 +331,8 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) int sel, b; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBeginAtMost(GWN_PRIM_LINES, 4 * 2 * fcu->totvert); @@ -459,7 +459,7 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) GPU_line_smooth(true); GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor((fcu->flag & FCURVE_SELECTED) ? TH_TEXT_HI : TH_TEXT); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index c94f2b00db2..699dc29ff47 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -279,7 +279,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_grid_free(grid); if (((sipo->flag & SIPO_NODRAWCURSOR) == 0) || (sipo->mode == SIPO_MODE_DRIVERS)) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f70efa00244..24b02106021 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -127,7 +127,7 @@ static void draw_render_info(const bContext *C, (int)(-rd->border.ymin * rd->ysch * rd->size * 0.01f)); } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_FACE_SELECT); @@ -174,7 +174,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* noisy, high contrast make impossible to read if lower alpha is used. */ @@ -574,7 +574,7 @@ void draw_image_sample_line(SpaceImage *sima) Histogram *hist = &sima->sample_line_hist; Gwn_VertFormat *format = immVertexFormat(); - unsigned int shdr_dashed_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint shdr_dashed_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -779,7 +779,7 @@ void draw_image_cache(const bContext *C, ARegion *ar) /* Draw current frame. */ x = (cfra - sfra) / (efra - sfra + 1) * ar->winx; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index a1e3842f887..5c1b23e140c 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -86,7 +86,7 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2], GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(bg_sel); @@ -192,7 +192,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); @@ -243,7 +243,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index a21a62dc8e8..3f1bd0db74c 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -121,7 +121,7 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa color[3] *= 2.5f; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -138,17 +138,17 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa /* count keys before drawing */ /* Note: It's safe to cast DLRBT_Tree, as it's designed to degrade down to a ListBase */ - unsigned int key_ct = BLI_listbase_count((ListBase *)&keys); + uint key_len = BLI_listbase_count((ListBase *)&keys); - if (key_ct > 0) { + if (key_len > 0) { format = immVertexFormat(); pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); - unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, key_ct); + immBegin(GWN_PRIM_POINTS, key_len); /* - disregard the selection status of keyframes so they draw a certain way * - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction @@ -706,7 +706,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) { AnimData *adt = ale->adt; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index d7015ed5e53..335c135cfba 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1215,7 +1215,7 @@ static void node_shader_set_butfunc(bNodeType *ntype) ntype->draw_buttons = node_shader_buts_uvalongstroke; break; case SH_NODE_OUTPUT_MATERIAL: - case SH_NODE_OUTPUT_LAMP: + case SH_NODE_OUTPUT_LIGHT: case SH_NODE_OUTPUT_WORLD: ntype->draw_buttons = node_buts_output_shader; break; @@ -2182,7 +2182,7 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo const float cross_size = 12 * U.pixelsize; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2227,7 +2227,7 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2271,7 +2271,7 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3264,7 +3264,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b y + snode->zoom * viewer_border->ymin * ibuf->y, y + snode->zoom * viewer_border->ymax * ibuf->y); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE); @@ -3423,9 +3423,9 @@ static void set_nodelink_vertex( static void nodelink_batch_init(void) { Gwn_VertFormat format = {0}; - unsigned int uv_id = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_U8, 2, GWN_FETCH_INT_TO_FLOAT_UNIT); - unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int expand_id = GWN_vertformat_attr_add(&format, "expand", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint uv_id = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_U8, 2, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint expand_id = GWN_vertformat_attr_add(&format, "expand", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format_ex(&format, GWN_USAGE_STATIC); int vcount = LINK_RESOL * 2; /* curve */ vcount += 2; /* restart strip */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index c4ed35faabd..5b91796d41c 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -649,7 +649,7 @@ static void node_draw_preview_background(float tile, rctf *rect) float x, y; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -721,7 +721,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) GPU_blend(false); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, +100); imm_draw_box_wire_2d(pos, draw_rect.xmin, draw_rect.ymin, draw_rect.xmax, draw_rect.ymax); @@ -758,10 +758,10 @@ void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha) void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *node, bool draw_outputs, bool select_all) { - const unsigned int total_input_ct = BLI_listbase_count(&node->inputs); - const unsigned int total_output_ct = BLI_listbase_count(&node->outputs); + const uint total_input_len = BLI_listbase_count(&node->inputs); + const uint total_output_len = BLI_listbase_count(&node->outputs); - if (total_input_ct + total_output_ct == 0) { + if (total_input_len + total_output_len == 0) { return; } @@ -772,8 +772,8 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * UI_view2d_scale_get(v2d, &scale, NULL); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); GPU_blend(true); GPU_enable_program_point_size(); @@ -788,17 +788,17 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform1f("outlineWidth", 1.0f); immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 0.6f); - immBeginAtMost(GWN_PRIM_POINTS, total_input_ct + total_output_ct); + immBeginAtMost(GWN_PRIM_POINTS, total_input_len + total_output_len); } /* socket inputs */ - short selected_input_ct = 0; + short selected_input_len = 0; bNodeSocket *sock; for (sock = node->inputs.first; sock; sock = sock->next) { if (nodeSocketIsHidden(sock)) continue; if (select_all || (sock->flag & SELECT)) { - ++selected_input_ct; + ++selected_input_len; continue; } @@ -806,13 +806,13 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * } /* socket outputs */ - short selected_output_ct = 0; + short selected_output_len = 0; if (draw_outputs) { for (sock = node->outputs.first; sock; sock = sock->next) { if (nodeSocketIsHidden(sock)) continue; if (select_all || (sock->flag & SELECT)) { - ++selected_output_ct; + ++selected_output_len; continue; } @@ -825,36 +825,36 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * } /* go back and draw selected sockets */ - if (selected_input_ct + selected_output_ct > 0) { + if (selected_input_len + selected_output_len > 0) { /* outline for selected sockets */ float c[3]; UI_GetThemeColor3fv(TH_TEXT_HI, c); immUniform4f("outlineColor", c[0], c[1], c[2], 1.0f); immUniform1f("outlineWidth", 1.5f); - immBegin(GWN_PRIM_POINTS, selected_input_ct + selected_output_ct); + immBegin(GWN_PRIM_POINTS, selected_input_len + selected_output_len); - if (selected_input_ct) { + if (selected_input_len) { /* socket inputs */ for (sock = node->inputs.first; sock; sock = sock->next) { if (nodeSocketIsHidden(sock)) continue; if (select_all || (sock->flag & SELECT)) { node_socket_circle_draw(C, ntree, node_ptr, sock, pos, col); - if (--selected_input_ct == 0) + if (--selected_input_len == 0) break; /* stop as soon as last one is drawn */ } } } - if (selected_output_ct) { + if (selected_output_len) { /* socket outputs */ for (sock = node->outputs.first; sock; sock = sock->next) { if (nodeSocketIsHidden(sock)) continue; if (select_all || (sock->flag & SELECT)) { node_socket_circle_draw(C, ntree, node_ptr, sock, pos, col); - if (--selected_output_ct == 0) + if (--selected_output_len == 0) break; /* stop as soon as last one is drawn */ } } @@ -1102,7 +1102,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b } /* scale widget thing */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(color_id, -10); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index cc32e5ef499..1a6710035c2 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -424,7 +424,7 @@ void ED_node_shader_default(const bContext *C, ID *id) Lamp *la = (Lamp *)id; la->nodetree = ntree; - output_type = SH_NODE_OUTPUT_LAMP; + output_type = SH_NODE_OUTPUT_LIGHT; shader_type = SH_NODE_EMISSION; copy_v3_v3(color, &la->r); @@ -628,7 +628,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) nodeClearActiveID(ntree, ID_TE); if (ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, - SH_NODE_OUTPUT_WORLD, SH_NODE_OUTPUT_LAMP, SH_NODE_OUTPUT_LINESTYLE)) + SH_NODE_OUTPUT_WORLD, SH_NODE_OUTPUT_LIGHT, SH_NODE_OUTPUT_LINESTYLE)) { bNode *tnode; diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index b884db1ced4..e3aeb0244e8 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -446,21 +446,12 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) uiBut *but; NodeLinkArg *argN; int first = 1; - int compatibility = 0; - - if (ntree->type == NTREE_SHADER) { - compatibility = NODE_NEW_SHADING; - } /* generate array of node types sorted by UI name */ bNodeType **sorted_ntypes = NULL; BLI_array_declare(sorted_ntypes); NODE_TYPES_BEGIN(ntype) { - if (compatibility && !(ntype->compatibility & compatibility)) { - continue; - } - if (ntype->nclass != nclass) { continue; } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index ed4853f5ede..8a8f4715ea3 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -742,7 +742,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex) GPU_line_width(1.0f); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); @@ -1141,7 +1141,7 @@ static void tselem_draw_icon( ICON_DRAW(ICON_RENDER_RESULT); break; case TSE_LINKED_LAMP: - ICON_DRAW(ICON_LAMP_DATA); + ICON_DRAW(ICON_LIGHT_DATA); break; case TSE_LINKED_MAT: ICON_DRAW(ICON_MATERIAL_DATA); @@ -1200,7 +1200,7 @@ static void tselem_draw_icon( Object *ob = (Object *)tselem->id; switch (ob->type) { case OB_LAMP: - ICON_CLICK_DRAW(ICON_OUTLINER_OB_LAMP); break; + ICON_CLICK_DRAW(ICON_OUTLINER_OB_LIGHT); break; case OB_MESH: ICON_CLICK_DRAW(ICON_OUTLINER_OB_MESH); break; case OB_CAMERA: @@ -1251,17 +1251,17 @@ static void tselem_draw_icon( Lamp *la = (Lamp *)tselem->id; switch (la->type) { case LA_LOCAL: - tselem_draw_icon_uibut(&arg, ICON_LAMP_POINT); break; + tselem_draw_icon_uibut(&arg, ICON_LIGHT_POINT); break; case LA_SUN: - tselem_draw_icon_uibut(&arg, ICON_LAMP_SUN); break; + tselem_draw_icon_uibut(&arg, ICON_LIGHT_SUN); break; case LA_SPOT: - tselem_draw_icon_uibut(&arg, ICON_LAMP_SPOT); break; + tselem_draw_icon_uibut(&arg, ICON_LIGHT_SPOT); break; case LA_HEMI: - tselem_draw_icon_uibut(&arg, ICON_LAMP_HEMI); break; + tselem_draw_icon_uibut(&arg, ICON_LIGHT_HEMI); break; case LA_AREA: - tselem_draw_icon_uibut(&arg, ICON_LAMP_AREA); break; + tselem_draw_icon_uibut(&arg, ICON_LIGHT_AREA); break; default: - tselem_draw_icon_uibut(&arg, ICON_OUTLINER_DATA_LAMP); break; + tselem_draw_icon_uibut(&arg, ICON_OUTLINER_DATA_LIGHT); break; } break; } @@ -1740,7 +1740,7 @@ static void outliner_draw_tree_element( /* divider */ { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1797,7 +1797,7 @@ static void outliner_draw_tree_element_floating( const TreeElement *te_insert = te_floating->drag_data->insert_handle; const int line_width = 2; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); int coord_y = te_insert->ys; int coord_x = te_insert->xs; float col[4]; @@ -1902,7 +1902,7 @@ static void outliner_draw_hierarchy_lines_recursive( static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1925,7 +1925,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * if (TSELEM_OPEN(tselem, soops)) { if (tselem->type == TSE_RNA_STRUCT) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); immRecti(pos, 0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1); @@ -1938,7 +1938,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if (tselem->type == TSE_RNA_STRUCT) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); @@ -2008,7 +2008,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, GPU_blend(true); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); outliner_draw_highlights_recursive( pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch, @@ -2083,7 +2083,7 @@ static void outliner_back(ARegion *ar) ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 6); @@ -2114,7 +2114,7 @@ static void outliner_draw_restrictcols(ARegion *ar) { GPU_line_width(1.0f); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); immBegin(GWN_PRIM_LINES, 8); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7da20131069..a10eda5c3e6 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -343,7 +343,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, col[3] = 196; /* alpha, used for all meta children */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -719,7 +719,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp; y2 = seq->machine + SEQ_STRIP_OFSTOP; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1231,8 +1231,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq * Do it here because OCIO binds it's own shader. */ Gwn_VertFormat *imm_format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (scope) { IMB_freeImBuf(ibuf); @@ -1514,7 +1514,7 @@ static void draw_seq_backdrop(View2D *v2d) { int i; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* darker gray overlay over the view backdrop */ @@ -1539,10 +1539,10 @@ static void draw_seq_backdrop(View2D *v2d) /* Darker lines separating the horizontal bands */ i = max_ii(1, ((int)v2d->cur.ymin) - 1); - int line_ct = (int)v2d->cur.ymax - i + 1; + int line_len = (int)v2d->cur.ymax - i + 1; immUniformThemeColor(TH_GRID); - immBegin(GWN_PRIM_LINES, line_ct * 2); - while (line_ct--) { + immBegin(GWN_PRIM_LINES, line_len * 2); + while (line_len--) { immVertex2f(pos, v2d->cur.xmax, i); immVertex2f(pos, v2d->cur.xmin, i); } @@ -1593,7 +1593,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) const Sequence *seq = special_seq_update; GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 48); @@ -1613,7 +1613,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw darkened area outside of active timeline @@ -1735,7 +1735,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.2f, 0.2f); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 21cd24cf84c..748a5c05ef1 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -913,7 +913,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) float rad; /* background so highlights don't go behind the scrollbar */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax); @@ -967,7 +967,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) boxh = (DOC_HEIGHT + 1) * (st->lheight_dpi + TXT_LINE_SPACING); /* Draw panel */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); @@ -1066,7 +1066,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc /* not needed but stands out nicer */ UI_draw_box_shadow(220, x, y - boxh, x + boxw, y); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE1); @@ -1089,7 +1089,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc w = st->cwidth * text_get_char_pos(st, str, len); if (item == sel) { - unsigned int posi = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint posi = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE2); @@ -1130,7 +1130,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar) return; } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw the selection */ @@ -1443,7 +1443,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if (st->showlinenrs) { x = TXT_OFFSET + TEXTXLOC; - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_GRID); immRecti(pos, (TXT_OFFSET - 12), 0, (TXT_OFFSET - 5) + TEXTXLOC, ar->winy - 2); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index bca5faa314a..beb323fb21c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -748,7 +748,7 @@ void ED_draw_object_facemap( const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); if (facemap_data) { Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(col); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 7495733382c..9aaced3e583 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1065,11 +1065,11 @@ static void view3d_main_region_message_subscribe( &RNA_Window, /* These object have properties that impact drawing. */ - &RNA_AreaLamp, + &RNA_AreaLight, &RNA_Camera, - &RNA_Lamp, + &RNA_Light, &RNA_Speaker, - &RNA_SunLamp, + &RNA_SunLight, /* General types the 3D view depends on. */ &RNA_Object, diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index bcf9a7c4ad1..8fa327d8782 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1226,7 +1226,7 @@ void VIEW3D_OT_properties(wmOperatorType *ot) static int view3d_object_mode_menu(bContext *C, wmOperator *UNUSED(op)) { Object *ob = CTX_data_active_object(C); - if (ob->type == OB_ARMATURE) { + if (ob && ((ob->mode & OB_MODE_EDIT) == 0) && (ELEM(ob->type, OB_ARMATURE))) { ED_object_mode_toggle(C, OB_MODE_POSE); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a428b60643d..2c732586606 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -814,8 +814,8 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect) GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GWN_PRIM_LINES, 6); @@ -859,8 +859,8 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d) glDepthMask(GL_FALSE); /* don't overwrite zbuf */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index f9fdf8c2cc0..8c6bbaa94da 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -263,7 +263,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), y2 = yoff + 0.55f * fly->height; Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_view3d/view3d_manipulator_empty.c b/source/blender/editors/space_view3d/view3d_manipulator_empty.c index 75e4a9e3314..fc15ec593f5 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_empty.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_empty.c @@ -186,7 +186,7 @@ static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmManipulatorGrou void VIEW3D_WGT_empty_image(wmManipulatorGroupType *wgt) { - wgt->name = "Area Lamp Widgets"; + wgt->name = "Area Light Widgets"; wgt->idname = "VIEW3D_WGT_empty_image"; wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | diff --git a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c index f98a2f336bc..0e1015a66f1 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c @@ -99,13 +99,13 @@ static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmManipulatorGroup /* need to set property here for undo. TODO would prefer to do this in _init */ PointerRNA lamp_ptr; const char *propname = "spot_size"; - RNA_pointer_create(&la->id, &RNA_Lamp, la, &lamp_ptr); + RNA_pointer_create(&la->id, &RNA_Light, la, &lamp_ptr); WM_manipulator_target_property_def_rna(mpr, "offset", &lamp_ptr, propname, -1); } void VIEW3D_WGT_lamp_spot(wmManipulatorGroupType *wgt) { - wgt->name = "Spot Lamp Widgets"; + wgt->name = "Spot Light Widgets"; wgt->idname = "VIEW3D_WGT_lamp_spot"; wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | @@ -213,7 +213,7 @@ static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmManipulatorGroup void VIEW3D_WGT_lamp_area(wmManipulatorGroupType *wgt) { - wgt->name = "Area Lamp Widgets"; + wgt->name = "Area Light Widgets"; wgt->idname = "VIEW3D_WGT_lamp_area"; wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | @@ -291,7 +291,7 @@ static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmManipulato void VIEW3D_WGT_lamp_target(wmManipulatorGroupType *wgt) { - wgt->name = "Target Lamp Widgets"; + wgt->name = "Target Light Widgets"; wgt->idname = "VIEW3D_WGT_lamp_target"; wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | diff --git a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c index c33f15c0493..d102fdc6e04 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c @@ -793,7 +793,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr) float co_ss_snap[3]; ED_view3d_project_float_global(ar, ruler_item->co[inter->co_index], co_ss_snap, V3D_PROJ_TEST_NOP); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color_act); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 00f0dea8fe2..0fd109f858d 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -311,7 +311,8 @@ void view3d_keymap(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "center", true); #endif - WM_keymap_add_menu_pie(keymap, "VIEW3D_MT_view_pie", ACCENTGRAVEKEY, KM_CLICK_DRAG, 0, 0); + WM_keymap_add_menu_pie(keymap, "VIEW3D_MT_view_pie", ACCENTGRAVEKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_navigate", ACCENTGRAVEKEY, KM_PRESS, KM_SHIFT, 0); /* numpad view hotkeys*/ WM_keymap_add_item(keymap, "VIEW3D_OT_view_camera", PAD0, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 5911c8224be..4617b92c780 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -703,7 +703,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a float co_ss[3]; ED_view3d_project_float_global(ar, ruler_item->co[ruler_item->co_index], co_ss, V3D_PROJ_TEST_NOP); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color_act); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index b7dbb09e1a4..0f82dfa775c 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1062,6 +1062,8 @@ static Base *object_mouse_select_menu( short baseCount = 0; bool ok; LinkNode *linklist = NULL; + const int object_type_exclude_select = ( + vc->v3d->object_type_exclude_viewport | vc->v3d->object_type_exclude_select); /* handle base->object->select_color */ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) @@ -1079,6 +1081,9 @@ static Base *object_mouse_select_menu( } } else { + if (object_type_exclude_select & (1 << base->object->type)) { + continue; + } const int dist = 15 * U.pixelsize; if (ED_view3d_project_base(vc->ar, base) == V3D_PROJ_RET_OK) { const int delta_px[2] = {base->sx - mval[0], base->sy - mval[1]}; @@ -1447,9 +1452,13 @@ static bool ed_object_select_pick( basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, toggle); } else { + const int object_type_exclude_select = ( + vc.v3d->object_type_exclude_viewport | vc.v3d->object_type_exclude_select); base = startbase; while (base) { - if (BASE_SELECTABLE(base)) { + if (BASE_SELECTABLE(base) && + ((object_type_exclude_select & (1 << base->object->type)) == 0)) + { float screen_co[2]; if (ED_view3d_project_float_global( ar, base->object->obmat[3], screen_co, diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index e3e82e8b9c2..7356d4a6eea 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -344,7 +344,7 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a } Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d26da986a6c..1f2589d8a0c 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -813,25 +813,100 @@ enum { TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27, }; +static bool transform_modal_item_poll(const wmOperator *op, int value) +{ + const TransInfo *t = op->customdata; + switch (value) { + case TFM_MODAL_PROPSIZE: + case TFM_MODAL_PROPSIZE_UP: + case TFM_MODAL_PROPSIZE_DOWN: + { + if ((t->flag & T_PROP_EDIT) == 0) { + return false; + } + break; + } + case TFM_MODAL_ADD_SNAP: + case TFM_MODAL_REMOVE_SNAP: + { + if (t->spacetype != SPACE_VIEW3D) { + return false; + } + else if (t->tsnap.mode & (SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) { + return false; + } + else if (!validSnap(t)) { + return false; + } + break; + } + case TFM_MODAL_AXIS_X: + case TFM_MODAL_AXIS_Y: + case TFM_MODAL_AXIS_Z: + case TFM_MODAL_PLANE_X: + case TFM_MODAL_PLANE_Y: + case TFM_MODAL_PLANE_Z: + { + if (t->flag & T_NO_CONSTRAINT) { + return false; + } + if (!ELEM(value, TFM_MODAL_AXIS_X, TFM_MODAL_AXIS_Y)) { + if (t->flag & T_2D_EDIT) { + return false; + } + } + break; + } + case TFM_MODAL_CONS_OFF: + { + if ((t->con.mode & CON_APPLY) == 0) { + return false; + } + break; + } + case TFM_MODAL_EDGESLIDE_UP: + case TFM_MODAL_EDGESLIDE_DOWN: + { + if (t->mode != TFM_EDGE_SLIDE) { + return false; + } + break; + } + case TFM_MODAL_INSERTOFS_TOGGLE_DIR: + { + if (t->spacetype != SPACE_NODE) { + return false; + } + break; + } + case TFM_MODAL_AUTOIK_LEN_INC: + case TFM_MODAL_AUTOIK_LEN_DEC: + { + if ((t->flag & T_AUTOIK) == 0) { + return false; + } + break; + } + } + return true; +} + /* called in transform_ops.c, on each regeneration of keymaps */ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { - {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {TFM_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, - {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, - {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""}, - {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, - {TFM_MODAL_SNAP_INV_ON, "SNAP_INV_ON", 0, "Invert Snap On", ""}, + {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {TFM_MODAL_AXIS_X, "AXIS_X", 0, "X axis", ""}, + {TFM_MODAL_AXIS_Y, "AXIS_Y", 0, "Y axis", ""}, + {TFM_MODAL_AXIS_Z, "AXIS_Z", 0, "Z axis", ""}, + {TFM_MODAL_PLANE_X, "PLANE_X", 0, "X plane", ""}, + {TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Y plane", ""}, + {TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Z plane", ""}, + {TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Clear Constraints", ""}, + {TFM_MODAL_SNAP_INV_ON, "SNAP_INV_ON", 0, "Invert Snap", ""}, {TFM_MODAL_SNAP_INV_OFF, "SNAP_INV_OFF", 0, "Invert Snap Off", ""}, {TFM_MODAL_SNAP_TOGGLE, "SNAP_TOGGLE", 0, "Snap Toggle", ""}, - {TFM_MODAL_AXIS_X, "AXIS_X", 0, "Orientation X axis", ""}, - {TFM_MODAL_AXIS_Y, "AXIS_Y", 0, "Orientation Y axis", ""}, - {TFM_MODAL_AXIS_Z, "AXIS_Z", 0, "Orientation Z axis", ""}, - {TFM_MODAL_PLANE_X, "PLANE_X", 0, "Orientation X plane", ""}, - {TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Orientation Y plane", ""}, - {TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Orientation Z plane", ""}, - {TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Remove Constraints", ""}, {TFM_MODAL_ADD_SNAP, "ADD_SNAP", 0, "Add Snap Point", ""}, {TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""}, {NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""}, @@ -844,6 +919,9 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) {TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select previous Edge Slide Edge", ""}, {TFM_MODAL_PROPSIZE, "PROPORTIONAL_SIZE", 0, "Adjust Proportional Influence", ""}, {TFM_MODAL_INSERTOFS_TOGGLE_DIR, "INSERTOFS_TOGGLE_DIR", 0, "Toggle Direction for Node Auto-offset", ""}, + {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, + {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""}, + {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, {0, NULL, 0, NULL, NULL} }; @@ -853,12 +931,24 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) if (keymap && keymap->modal_items) return NULL; keymap = WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items); + keymap->poll_modal_item = transform_modal_item_poll; /* items for modal map */ - WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL); - WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM); + WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL); + WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL); + + WM_modalkeymap_add_item(keymap, XKEY, KM_PRESS, 0, 0, TFM_MODAL_AXIS_X); + WM_modalkeymap_add_item(keymap, YKEY, KM_PRESS, 0, 0, TFM_MODAL_AXIS_Y); + WM_modalkeymap_add_item(keymap, ZKEY, KM_PRESS, 0, 0, TFM_MODAL_AXIS_Z); + + WM_modalkeymap_add_item(keymap, XKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_PLANE_X); + WM_modalkeymap_add_item(keymap, YKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_PLANE_Y); + WM_modalkeymap_add_item(keymap, ZKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_PLANE_Z); + + WM_modalkeymap_add_item(keymap, CKEY, KM_PRESS, 0, 0, TFM_MODAL_CONS_OFF); WM_modalkeymap_add_item(keymap, GKEY, KM_PRESS, 0, 0, TFM_MODAL_TRANSLATE); WM_modalkeymap_add_item(keymap, RKEY, KM_PRESS, 0, 0, TFM_MODAL_ROTATE); @@ -1410,21 +1500,6 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } } - else { - if (!(t->flag & T_NO_CONSTRAINT)) { - stopConstraint(t); - t->redraw |= TREDRAW_HARD; - handled = true; - } - } - break; - case XKEY: - case YKEY: - case ZKEY: - if (!(t->flag & T_NO_CONSTRAINT)) { - transform_event_xyz_constraint(t, event->type, cmode); - handled = true; - } break; case OKEY: if (t->flag & T_PROP_EDIT && event->shift) { @@ -1551,6 +1626,12 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } + if (t->redraw && + !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) + { + WM_window_status_area_tag_redraw(CTX_wm_window(t->context)); + } + if (handled || t->redraw) { return 0; } @@ -1774,7 +1855,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } /* And now, solid lines. */ - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); UNUSED_VARS_NDEBUG(pos); /* silence warning */ BLI_assert(pos == POS_INDEX); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -6982,7 +7063,7 @@ static void drawEdgeSlide(TransInfo *t) gpuPushMatrix(); gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 744170d9aba..6685f785247 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -772,8 +772,8 @@ void snapGridIncrementAction(TransInfo *t, float *val, GearsType action); void snapSequenceBounds(TransInfo *t, const int mval[2]); -bool activeSnap(TransInfo *t); -bool validSnap(TransInfo *t); +bool activeSnap(const TransInfo *t); +bool validSnap(const TransInfo *t); void initSnapping(struct TransInfo *t, struct wmOperator *op); void freeSnapping(struct TransInfo *t); @@ -783,10 +783,10 @@ void applySnapping(TransInfo *t, float *vec); void resetSnapping(TransInfo *t); eRedrawFlag handleSnapping(TransInfo *t, const struct wmEvent *event); void drawSnapping(const struct bContext *C, TransInfo *t); -bool usingSnappingNormal(TransInfo *t); -bool validSnappingNormal(TransInfo *t); +bool usingSnappingNormal(const TransInfo *t); +bool validSnappingNormal(const TransInfo *t); -void getSnapPoint(TransInfo *t, float vec[3]); +void getSnapPoint(const TransInfo *t, float vec[3]); void addSnapPoint(TransInfo *t); eRedrawFlag updateSelectedSnapPoint(TransInfo *t); void removeSnapPoint(TransInfo *t); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 9df8264cc76..d40602f8d43 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -823,7 +823,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) if (depth_test_enabled) GPU_depth_test(false); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_GRID); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b007a8d1b99..3f71915a690 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1132,7 +1132,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis } UI_make_axis_color(col, col2, axis); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col2); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 9ffd14ad956..dc922b5c9ba 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -124,13 +124,13 @@ int BIF_snappingSupported(Object *obedit) } #endif -bool validSnap(TransInfo *t) +bool validSnap(const TransInfo *t) { return (t->tsnap.status & (POINT_INIT | TARGET_INIT)) == (POINT_INIT | TARGET_INIT) || (t->tsnap.status & (MULTI_POINTS | TARGET_INIT)) == (MULTI_POINTS | TARGET_INIT); } -bool activeSnap(TransInfo *t) +bool activeSnap(const TransInfo *t) { return ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP) || ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP_INVERT); @@ -165,7 +165,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) invert_m4_m4(imat, rv3d->viewmat); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) GPU_blend(true); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -451,12 +451,12 @@ void resetSnapping(TransInfo *t) t->tsnap.snapNodeBorder = 0; } -bool usingSnappingNormal(TransInfo *t) +bool usingSnappingNormal(const TransInfo *t) { return t->tsnap.align; } -bool validSnappingNormal(TransInfo *t) +bool validSnappingNormal(const TransInfo *t) { if (validSnap(t)) { if (!is_zero_v3(t->tsnap.snapNormal)) { @@ -789,7 +789,7 @@ void removeSnapPoint(TransInfo *t) } } -void getSnapPoint(TransInfo *t, float vec[3]) +void getSnapPoint(const TransInfo *t, float vec[3]) { if (t->tsnap.points.first) { TransSnapPoint *p; diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 411c4838252..f0d6b5c2a71 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -168,7 +168,7 @@ static void draw_uvs_shadow(Object *obedit) const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -229,7 +229,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME } } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -309,8 +309,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME col[3] = 0.5f; /* hard coded alpha, not that nice */ Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -495,7 +495,7 @@ static void draw_uvs_other_mesh(Object *ob, const Image *curimage, static void draw_uvs_other(ViewLayer *view_layer, Object *obedit, const Image *curimage, const int other_uv_filter) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -536,7 +536,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, ViewLayer *view_la mloopuv = me->mloopuv; } - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -765,7 +765,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje immEnd(); /* Then draw each face contour separately. */ - if (loop_vbo->vertex_ct != 0) { + if (loop_vbo->vertex_len != 0) { GWN_batch_program_use_begin(loop_batch); unsigned int index = 0, loop_vbo_count; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { @@ -792,7 +792,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje /* Create a color buffer. */ static Gwn_VertFormat format = { 0 }; static uint shdr_col; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { shdr_col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 9091f3eff0b..c3737787933 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1567,7 +1567,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar static Gwn_VertFormat format = { 0 }; static unsigned int pos_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } |