diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-02 20:30:26 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-03 17:35:54 +0300 |
commit | beca377c278fe7a1eedbd4491ece2686150081f0 (patch) | |
tree | 5c6196bac89c10bab926ce3f391714515b4894ea /source/blender/editors/include | |
parent | 53c9fbef606f34d2a8d8da8c982448490d29d5fb (diff) | |
parent | 6de656b4f2ac66922d34bedbeb8f857bc878c5ae (diff) |
Merge branch 'blender2.8' into ui_layout_gridflow
Conflicts:
release/scripts/startup/bl_ui/properties_texture.py
source/blenderplayer/bad_level_call_stubs/stubs.c
Diffstat (limited to 'source/blender/editors/include')
34 files changed, 1013 insertions, 441 deletions
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h index e264d9e16a3..f91e7d42bca 100644 --- a/source/blender/editors/include/BIF_gl.h +++ b/source/blender/editors/include/BIF_gl.h @@ -36,45 +36,6 @@ #include "GPU_glew.h" #include "BLI_utildefines.h" -/* - * these should be phased out. cpack should be replaced in - * code with calls to glColor3ub. - zr - */ -/* - * - * This define converts a numerical value to the equivalent 24-bit - * color, while not being endian-sensitive. On little-endians, this - * is the same as doing a 'naive' indexing, on big-endian, it is not! - * */ -void cpack(unsigned int x); - -#ifdef WITH_GL_PROFILE_COMPAT -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -# define glMultMatrixf(x) \ - glMultMatrixf(_Generic((x), \ - float *: (float *)(x), \ - float [16]: (float *)(x), \ - float (*)[4]: (float *)(x), \ - float [4][4]: (float *)(x), \ - const float *: (float *)(x), \ - const float [16]: (float *)(x), \ - const float (*)[4]: (float *)(x), \ - const float [4][4]: (float *)(x)) \ -) -# define glLoadMatrixf(x) \ - glLoadMatrixf(_Generic((x), \ - float *: (float *)(x), \ - float [16]: (float *)(x), \ - float (*)[4]: (float *)(x), \ - float [4][4]: (float *)(x)) \ -) -#else -# define glMultMatrixf(x) glMultMatrixf((float *)(x)) -# define glLoadMatrixf(x) glLoadMatrixf((float *)(x)) -#endif /* C11 */ -#endif /* WITH_GL_PROFILE_COMPAT */ - - /* hacking pointsize and linewidth */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define glPointSize(f) glPointSize(U.pixelsize * _Generic((f), double: (float)(f), default: (f))) @@ -86,19 +47,5 @@ void cpack(unsigned int x); #define GLA_PIXEL_OFS 0.375f - -BLI_INLINE void glTranslate3iv(const int vec[3]) { glTranslatef(UNPACK3_EX((const float), vec, )); } -BLI_INLINE void glTranslate2iv(const int vec[2]) { glTranslatef(UNPACK2_EX((const float), vec, ), 0.0f); } -BLI_INLINE void glTranslate3fv(const float vec[3]) { glTranslatef(UNPACK3(vec)); } -BLI_INLINE void glTranslate2fv(const float vec[2]) { glTranslatef(UNPACK2(vec), 0.0f); } - -BLI_INLINE void glScale3iv(const int vec[3]) { glTranslatef(UNPACK3_EX((const float), vec, )); } -BLI_INLINE void glScale2iv(const int vec[2]) { glTranslatef(UNPACK2_EX((const float), vec, ), 0.0f); } -BLI_INLINE void glScale3fv(const float vec[3]) { glScalef(UNPACK3(vec)); } -BLI_INLINE void glScale2fv(const float vec[2]) { glScalef(UNPACK2(vec), 0.0); } - -/* v2 versions don't make much sense for rotation */ -BLI_INLINE void glRotate3fv(const float angle, const float vec[3]) { glRotatef(angle, UNPACK3(vec)); } - #endif /* #ifdef __BIF_GL_H__ */ diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index d3d2c465d46..863d817d19a 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -38,56 +38,14 @@ struct bContext; struct ColorManagedViewSettings; struct ColorManagedDisplaySettings; -void fdrawbezier(float vec[4][3]); -void fdrawline(float x1, float y1, float x2, float y2); -void fdrawbox(float x1, float y1, float x2, float y2); -void sdrawline(int x1, int y1, int x2, int y2); -#if 0 -void sdrawtri(int x1, int y1, int x2, int y2); -void sdrawtrifill(int x1, int y1, int x2, int y2); -#endif -void sdrawbox(int x1, int y1, int x2, int y2); - -void sdrawXORline(int x0, int y0, int x1, int y1); -void sdrawXORline4(int nr, int x0, int y0, int x1, int y1); - -void fdrawXORellipse(float xofs, float yofs, float hw, float hh); -void fdrawXORcirc(float xofs, float yofs, float rad); - -void fdrawcheckerboard(float x1, float y1, float x2, float y2); - -/* OpenGL stipple defines */ -extern const unsigned char stipple_halftone[128]; -extern const unsigned char stipple_quarttone[128]; -extern const unsigned char stipple_diag_stripes_pos[128]; -extern const unsigned char stipple_diag_stripes_neg[128]; -extern const unsigned char stipple_checker_8px[128]; - -/** - * Draw a lined (non-looping) arc with the given - * \a radius, starting at angle \a start and arcing - * through \a angle. The arc is centered at the origin - * and drawn in the XY plane. +/* A few functions defined here are being DEPRECATED for Blender 2.8 * - * \param start The initial angle (in radians). - * \param angle The length of the arc (in radians). - * \param radius The arc radius. - * \param nsegments The number of segments to use in drawing the arc. - */ -void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments); - -/** - * Draw a filled arc with the given \a radius, - * starting at angle \a start and arcing through - * \a angle. The arc is centered at the origin - * and drawn in the XY plane. + * Do not use them in new code, and you are encouraged to + * convert existing code to draw without these. * - * \param start The initial angle (in radians). - * \param angle The length of the arc (in radians). - * \param radius The arc radius. - * \param nsegments The number of segments to use in drawing the arc. + * These will be deleted before we ship 2.8! + * - merwin */ -void glutil_draw_filled_arc(float start, float angle, float radius, int nsegments); /** * Returns a float value as obtained by glGetFloatv. @@ -109,88 +67,46 @@ int glaGetOneInt(int param); */ void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y); -/** - * Functions like a limited glDrawPixels, except ensures that - * the image is displayed onscreen even if the \a x and \a y - * coordinates for would be clipped. The routine respects the - * glPixelZoom values, pixel unpacking parameters are _not_ - * respected. - * - * \attention This routine makes many assumptions: the rect data - * is expected to be in RGBA unsigned byte format, the coordinate - * (GLA_PIXEL_OFS, GLA_PIXEL_OFS) is assumed to be within the view frustum, - * and the modelview and projection matrices are assumed to define a - * 1-to-1 mapping to screen space. - * \attention Furthermore, in the case of zoomed or unpixel aligned - * images extending outside the view frustum, but still within the - * window, some portion of the image may be visible left and/or - * below of the given \a x and \a y coordinates. It is recommended - * to use the glScissor functionality if images are to be drawn - * with an inset view matrix. - */ -void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect); +typedef struct IMMDrawPixelsTexState { + struct GPUShader *shader; + unsigned int pos; + unsigned int texco; + bool do_shader_unbind; +} IMMDrawPixelsTexState; + +/* To be used before calling immDrawPixelsTex + * Default shader is GPU_SHADER_2D_IMAGE_COLOR + * Returns a shader to be able to set uniforms */ +IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); /** - * glaDrawPixelsTex - Functions like a limited glDrawPixels, but actually draws the + * immDrawPixelsTex - Functions like a limited glDrawPixels, but actually draws the * image using textures, which can be tremendously faster on low-end * cards, and also avoids problems with the raster position being - * clipped when offscreen. The routine respects the glPixelZoom values, - * pixel unpacking parameters are _not_ respected. + * clipped when offscreen. Pixel unpacking parameters and + * the glPixelZoom values are _not_ respected. + * + * \attention Use immDrawPixelsTexSetup before calling this function. * * \attention This routine makes many assumptions: the rect data * is expected to be in RGBA byte or float format, and the * modelview and projection matrices are assumed to define a * 1-to-1 mapping to screen space. */ - -void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect); -void glaDrawPixelsTex_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, - float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y); - -/** - * glaDrawPixelsAuto - Switches between texture or pixel drawing using UserDef. - * only RGBA - * needs glaDefine2DArea to be set. - */ -void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect); -void glaDrawPixelsAuto_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, - float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y); - - -void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY); -void glaDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, - float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y); - -/* 2D Drawing Assistance */ - -/** Define a 2D area (viewport, scissor, matrices) for OpenGL rendering. - * - * glaDefine2DArea and glaBegin2DDraw set up an OpenGL state appropriate - * for drawing using both vertex (Vertex, etc) and raster (RasterPos, Rect) - * commands. All coordinates should be at integer positions. There is little - * to no reason to use glVertex2f etc. functions during 2D rendering, and - * thus no reason to +-0.5 the coordinates or perform other silly - * tricks. - * - * \param screen_rect The screen rectangle to be defined for 2D drawing. - */ -void glaDefine2DArea(struct rcti *screen_rect); - -typedef struct gla2DDrawInfo gla2DDrawInfo; - -/* UNUSED */ -#if 0 - -gla2DDrawInfo *glaBegin2DDraw(struct rcti *screen_rect, struct rctf *world_rect); -void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *r_sc_x, int *r_sc_y); -void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int r_screen[2]); - -void glaEnd2DDraw(gla2DDrawInfo *di); - -/** Adjust the transformation mapping of a 2d area */ -void gla2DGetMap(gla2DDrawInfo *di, struct rctf *rect); -void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect); -#endif +void immDrawPixelsTex(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, + float xzoom, float yzoom, float color[4]); +void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, + float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, + float xzoom, float yzoom, float color[4]); +void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, + float xzoom, float yzoom, float color[4]); +void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, + float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect, float scaleX, float scaleY, + float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, + float xzoom, float yzoom, float color[4]); void set_inverted_drawing(int enable); void setlinestyle(int nr); @@ -198,37 +114,32 @@ void setlinestyle(int nr); /* own working polygon offset */ void bglPolygonOffset(float viewdist, float dist); -/* For caching opengl matrices (gluProject/gluUnProject) */ -typedef struct bglMats { - double modelview[16]; - double projection[16]; - int viewport[4]; -} bglMats; -void bgl_get_mats(bglMats *mats); - /* **** Color management helper functions for GLSL display/transform ***** */ /* Draw imbuf on a screen, preferably using GLSL display transform */ void glaDrawImBuf_glsl(struct ImBuf *ibuf, float x, float y, int zoomfilter, struct ColorManagedViewSettings *view_settings, - struct ColorManagedDisplaySettings *display_settings); + struct ColorManagedDisplaySettings *display_settings, + float zoom_x, float zoom_y); void glaDrawImBuf_glsl_clipping(struct ImBuf *ibuf, float x, float y, int zoomfilter, struct ColorManagedViewSettings *view_settings, struct ColorManagedDisplaySettings *display_settings, float clip_min_x, float clip_min_y, - float clip_max_x, float clip_max_y); + float clip_max_x, float clip_max_y, + float zoom_x, float zoom_y); /* Draw imbuf on a screen, preferably using GLSL display transform */ -void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter); +void glaDrawImBuf_glsl_ctx(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter, + float zoom_x, float zoom_y); void glaDrawImBuf_glsl_ctx_clipping(const struct bContext *C, struct ImBuf *ibuf, float x, float y, int zoomfilter, float clip_min_x, float clip_min_y, - float clip_max_x, float clip_max_y); + float clip_max_x, float clip_max_y, + float zoom_x, float zoom_y); -void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy); +void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy); #endif /* __BIF_GLUTIL_H__ */ - diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 483e10faaf6..a25b1b84cc5 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -81,7 +81,9 @@ typedef struct bAnimContext { struct bDopeSheet *ads; /* dopesheet data for editor (or which is being used) */ + struct Depsgraph *depsgraph; /* active dependency graph */ struct Scene *scene; /* active scene */ + struct ViewLayer *view_layer; /* active scene layer */ struct Object *obact; /* active object */ ListBase *markers; /* active set of markers */ @@ -101,7 +103,8 @@ typedef enum eAnimCont_Types { ANIMCONT_DRIVERS = 6, /* drivers (bDopesheet) */ ANIMCONT_NLA = 7, /* nla (bDopesheet) */ ANIMCONT_CHANNEL = 8, /* animation channel (bAnimListElem) */ - ANIMCONT_MASK = 9 /* mask dopesheet */ + ANIMCONT_MASK = 9, /* mask dopesheet */ + ANIMCONT_TIMELINE = 10, /* "timeline" editor (bDopeSheet) */ } eAnimCont_Types; /* --------------- Channels -------------------- */ @@ -533,22 +536,29 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, st enum eAnimEditDraw_CurrentFrame { /* plain time indicator with no special indicators */ DRAWCFRA_PLAIN = 0, - /* draw box indicating current frame number */ - DRAWCFRA_SHOW_NUMBOX = (1 << 0), /* time indication in seconds or frames */ - DRAWCFRA_UNIT_SECONDS = (1 << 1), + DRAWCFRA_UNIT_SECONDS = (1 << 0), /* draw indicator extra wide (for timeline) */ - DRAWCFRA_WIDE = (1 << 2) + DRAWCFRA_WIDE = (1 << 1) }; /* main call to draw current-frame indicator in an Animation Editor */ void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag); +/* main call to draw "number box" in scrollbar for current frame indicator */ +void ANIM_draw_cfra_number(const struct bContext *C, struct View2D *v2d, short flag); + /* ------------- Preview Range Drawing -------------- */ /* main call to draw preview range curtains */ void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d, int end_frame_width); + +/* -------------- Frame Range Drawing --------------- */ + +/* main call to draw normal frame range indicators */ +void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d); + /* ************************************************* */ /* F-MODIFIER TOOLS */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 567e477ec6c..2934745484a 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -39,16 +39,19 @@ struct Base; struct bContext; struct Bone; struct bPoseChannel; +struct Depsgraph; struct IDProperty; struct ListBase; struct MeshDeformModifierData; -struct DerivedMesh; +struct Mesh; struct Object; struct ReportList; struct Scene; +struct ViewLayer; struct ViewContext; struct wmKeyConfig; struct wmOperator; +struct Main; struct UndoType; typedef struct EditBone { @@ -86,6 +89,12 @@ typedef struct EditBone { short segments; + /* Used for display */ + float disp_mat[4][4]; /* in Armature space, rest pos matrix */ + float disp_tail_mat[4][4]; /* in Armature space, rest pos matrix */ + /* 32 == MAX_BBONE_SUBDIV */ + float disp_bbone_mat[32][4][4]; /* in Armature space, rest pos matrix */ + /* Used to store temporary data */ union { struct EditBone *ebone; @@ -133,19 +142,29 @@ void ED_armature_edit_free(struct bArmature *arm); void ED_armature_edit_deselect_all(struct Object *obedit); void ED_armature_edit_deselect_all_visible(struct Object *obedit); +void ED_armature_edit_deselect_all_multi(struct Object **objects, uint objects_len); +void ED_armature_edit_deselect_all_visible_multi(struct Object **objects, uint objects_len); + bool ED_armature_pose_select_pick_with_buffer( - struct Scene *scene, struct Base *base, const unsigned int *buffer, short hits, + struct ViewLayer *view_layer, struct Base *base, const unsigned int *buffer, short hits, bool extend, bool deselect, bool toggle, bool do_nearest); bool ED_armature_edit_select_pick( struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); int join_armature_exec(struct bContext *C, struct wmOperator *op); -struct Bone *ED_armature_bone_find_index(struct Object *ob, int index); float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float new_up_axis[3], const bool axis_only); EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name); EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, EditBone *ebo); void ED_armature_edit_sync_selection(struct ListBase *edbo); void ED_armature_edit_validate_active(struct bArmature *arm); +struct Base *ED_armature_base_and_ebone_from_select_buffer( + struct Base **bases, uint bases_len, int hit, struct EditBone **r_ebone); +struct Object *ED_armature_object_and_ebone_from_select_buffer( + struct Object **objects, uint objects_len, int hit, struct EditBone **r_ebone); + +struct Base *ED_armature_base_and_bone_from_select_buffer( + struct Base **bases, uint bases_len, int hit, struct Bone **r_bone); + EditBone *ED_armature_ebone_add_primitive(struct Object *obedit_arm, float length, bool view_aligned); EditBone *ED_armature_ebone_add(struct bArmature *arm, const char *name); @@ -162,7 +181,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]); void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]); void ED_armature_edit_transform_mirror_update(struct Object *obedit); -void ED_armature_origin_set(struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around); +void ED_armature_origin_set(struct Object *ob, float cursor[3], int centermode, int around); void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props); void ED_armature_transform_apply(struct Object *ob, float mat[4][4], const bool do_props); @@ -172,8 +191,9 @@ void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do #define ARM_GROUPS_ENVELOPE 2 #define ARM_GROUPS_AUTO 3 -void ED_object_vgroup_calc_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, - struct Object *par, const int mode, const bool mirror); +void ED_object_vgroup_calc_from_armature( + struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene, + struct Object *ob, struct Object *par, const int mode, const bool mirror); /* if bone is already in list, pass it as param to ignore it */ void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, EditBone *bone); @@ -196,41 +216,23 @@ void ED_armature_ebone_listbase_free(struct ListBase *lb); void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src); /* poseobject.c */ -bool ED_object_posemode_exit_ex(struct Object *ob); +bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob); bool ED_object_posemode_exit(struct bContext *C, struct Object *ob); -bool ED_object_posemode_enter_ex(struct Object *ob); +bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob); bool ED_object_posemode_enter(struct bContext *C, struct Object *ob); void ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility); +void ED_pose_deselect_all_multi(struct Object **objects, uint objects_len, int select_mode, const bool ignore_visibility); void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select); -void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob); +void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob); struct Object *ED_pose_object_from_context(struct bContext *C); -/* sketch */ - -int ED_operator_sketch_mode_active_stroke(struct bContext *C); -int ED_operator_sketch_full_mode(struct bContext *C); -int ED_operator_sketch_mode(const struct bContext *C); - -void BIF_convertSketch(struct bContext *C); -void BIF_deleteSketch(struct bContext *C); -void BIF_selectAllSketch(struct bContext *C, int mode); /* -1: deselect, 0: select, 1: toggle */ - -void BIF_makeListTemplates(const struct bContext *C); -int BIF_currentTemplate(const struct bContext *C); -void BIF_freeTemplates(struct bContext *C); -void BIF_setTemplate(struct bContext *C, int index); -int BIF_nbJointsTemplate(const struct bContext *C); -const char *BIF_nameBoneTemplate(const struct bContext *C); - -void BDR_drawSketch(const struct bContext *vc); -int BDR_drawSketchNames(struct ViewContext *vc); - /* meshlaplacian.c */ -void ED_mesh_deform_bind_callback(struct Scene *scene, - struct MeshDeformModifierData *mmd, - struct DerivedMesh *cagedm, - float *vertexcos, int totvert, float cagemat[4][4]); - +void ED_mesh_deform_bind_callback( + struct Scene *scene, + struct MeshDeformModifierData *mmd, + struct Mesh *cagemesh, + float *vertexcos, int totvert, float cagemat[4][4]); + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h index 64c16605dec..5cc695b6ce8 100644 --- a/source/blender/editors/include/ED_buttons.h +++ b/source/blender/editors/include/ED_buttons.h @@ -27,14 +27,4 @@ #ifndef __ED_BUTTONS_H__ #define __ED_BUTTONS_H__ -#include "BLI_utildefines.h" - -/* Used to check whether a given texture context is valid in current context. */ -bool ED_texture_context_check_world(const struct bContext *C); -bool ED_texture_context_check_material(const struct bContext *C); -bool ED_texture_context_check_lamp(const struct bContext *C); -bool ED_texture_context_check_particles(const struct bContext *C); -bool ED_texture_context_check_linestyle(const struct bContext *C); -bool ED_texture_context_check_others(const struct bContext *C); - #endif /* __ED_BUTTONS_H__ */ diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index bbd27df46ce..f2b7d2cb4a1 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -113,6 +113,17 @@ void ED_file_change_dir(struct bContext *C); /* File menu stuff */ +/* FSMenuEntry's without paths indicate separators */ +typedef struct FSMenuEntry { + struct FSMenuEntry *next; + + char *path; + char name[256]; /* FILE_MAXFILE */ + short save; + short valid; + short pad[2]; +} FSMenuEntry; + typedef enum FSMenuCategory { FS_CATEGORY_SYSTEM, FS_CATEGORY_SYSTEM_BOOKMARKS, diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 74d9ad0886d..57ca1f04c0a 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -35,6 +35,7 @@ struct ID; struct ListBase; struct bContext; +struct Depsgraph; struct ScrArea; struct ARegion; struct View3D; @@ -48,6 +49,8 @@ struct bGPDpalettecolor; struct bAnimContext; struct KeyframeEditData; struct PointerRNA; +struct Scene; +struct ViewLayer; struct wmWindowManager; struct wmKeyConfig; @@ -113,7 +116,7 @@ struct bGPdata *ED_gpencil_data_get_active_direct(struct ID *screen_id, struct S struct ScrArea *sa, struct Object *ob); /* 3D View */ -struct bGPdata *ED_gpencil_data_get_active_v3d(struct Scene *scene, struct View3D *v3d); +struct bGPdata *ED_gpencil_data_get_active_v3d(struct Scene *scene, struct ViewLayer *view_layer); bool ED_gpencil_has_keyframe_v3d(struct Scene *scene, struct Object *ob, int cfra); @@ -147,7 +150,13 @@ void ED_gpencil_strokes_copybuf_free(void); void ED_gpencil_draw_2dimage(const struct bContext *C); void ED_gpencil_draw_view2d(const struct bContext *C, bool onlyv2d); -void ED_gpencil_draw_view3d(struct wmWindowManager *wm, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, bool only3d); +void ED_gpencil_draw_view3d(struct wmWindowManager *wm, + struct Scene *scene, + struct ViewLayer *view_layer, + struct Depsgraph *depsgraph, + struct View3D *v3d, + struct ARegion *ar, + bool only3d); void ED_gpencil_draw_ex(struct Scene *scene, struct bGPdata *gpd, int winx, int winy, const int cfra, const char spacetype); void ED_gp_draw_interpolation(struct tGPDinterpolate *tgpi, const int type); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index aeace9d679a..ce12c2fcd7a 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -39,11 +39,11 @@ struct ToolSettings; struct wmWindowManager; struct ARegion; struct Scene; +struct ViewLayer; /* image_edit.c, exported for transform */ struct Image *ED_space_image(struct SpaceImage *sima); -void ED_space_image_set( - struct Main *bmain, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima); +void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima); struct Mask *ED_space_image_get_mask(struct SpaceImage *sima); void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask); @@ -75,7 +75,7 @@ bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit); bool ED_space_image_paint_curve(const struct bContext *C); -bool ED_space_image_check_show_maskedit(struct Scene *scene, struct SpaceImage *sima); +bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer); int ED_space_image_maskedit_poll(struct bContext *C); int ED_space_image_maskedit_mask_poll(struct bContext *C); diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h index 6970abaa633..072b1a135a3 100644 --- a/source/blender/editors/include/ED_info.h +++ b/source/blender/editors/include/ED_info.h @@ -28,7 +28,7 @@ #define __ED_INFO_H__ /* info_stats.c */ -void ED_info_stats_clear(struct Scene *scene); -const char *ED_info_stats_string(struct Scene *scene); +void ED_info_stats_clear(struct ViewLayer *view_layer); +const char *ED_info_stats_string(struct Scene *scene, struct ViewLayer *view_layer); #endif /* __ED_INFO_H__ */ diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index c478a8b17e5..62f1a617fcb 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -108,8 +108,10 @@ typedef enum eKeyframeShapeDrawOpts { KEYFRAME_SHAPE_BOTH } eKeyframeShapeDrawOpts; -/* draw simple diamond-shape keyframe (with OpenGL) */ -void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha); +/* draw simple diamond-shape keyframe */ +/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GWN_PRIM_POINTS, n), then call this n times */ +void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha, + unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id); /* ******************************* Methods ****************************** */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index bf4e9495e01..066fc600c76 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -50,6 +50,8 @@ struct bPoseChannel; struct bContext; struct ReportList; +struct Depsgraph; + struct PointerRNA; struct PropertyRNA; struct EnumPropertyItem; @@ -107,7 +109,7 @@ int insert_vert_fcurve(struct FCurve *fcu, float x, float y, eBezTriple_Keyframe * Use this to insert a keyframe using the current value being keyframed, in the * nominated F-Curve (no creation of animation data performed). Returns success. */ -bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); +bool insert_keyframe_direct(struct Depsgraph *depsgraph, struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); /* -------- */ @@ -115,7 +117,7 @@ bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, s * Use this to create any necessary animation data, and then insert a keyframe * using the current value being keyframed, in the relevant place. Returns success. */ -short insert_keyframe(struct ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); +short insert_keyframe(struct Depsgraph *depsgraph, struct ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); /* Main Keyframing API call: * Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case. diff --git a/source/blender/editors/include/ED_manipulator_library.h b/source/blender/editors/include/ED_manipulator_library.h new file mode 100644 index 00000000000..b67af4274a6 --- /dev/null +++ b/source/blender/editors/include/ED_manipulator_library.h @@ -0,0 +1,215 @@ +/* + * ***** 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 ED_manipulator_library.h + * \ingroup wm + * + * \name Generic Manipulators. + * + * This is exposes pre-defined manipulators for re-use. + */ + + +#ifndef __ED_MANIPULATOR_LIBRARY_H__ +#define __ED_MANIPULATOR_LIBRARY_H__ + +/* initialize manipulators */ +void ED_manipulatortypes_arrow_2d(void); +void ED_manipulatortypes_arrow_3d(void); +void ED_manipulatortypes_button_2d(void); +void ED_manipulatortypes_cage_2d(void); +void ED_manipulatortypes_cage_3d(void); +void ED_manipulatortypes_dial_3d(void); +void ED_manipulatortypes_grab_3d(void); +void ED_manipulatortypes_facemap_3d(void); +void ED_manipulatortypes_primitive_3d(void); + +struct wmManipulator; +struct wmManipulatorGroup; + + +/* -------------------------------------------------------------------- */ +/* Shape Presets + * + * Intended to be called by custom draw functions. + */ + +/* manipulator_library_presets.c */ +void ED_manipulator_draw_preset_box( + const struct wmManipulator *mpr, float mat[4][4], int select_id); +void ED_manipulator_draw_preset_arrow( + const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id); +void ED_manipulator_draw_preset_circle( + const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id); +void ED_manipulator_draw_preset_facemap( + const struct bContext *C, const struct wmManipulator *mpr, struct Scene *scene, + struct Object *ob, const int facemap, int select_id); + + +/* -------------------------------------------------------------------- */ +/* 3D Arrow Manipulator */ + +enum { + ED_MANIPULATOR_ARROW_STYLE_NORMAL = 0, + ED_MANIPULATOR_ARROW_STYLE_CROSS = 1, + ED_MANIPULATOR_ARROW_STYLE_BOX = 2, + ED_MANIPULATOR_ARROW_STYLE_CONE = 3, +}; + +enum { + /* inverted offset during interaction - if set it also sets constrained below */ + ED_MANIPULATOR_ARROW_STYLE_INVERTED = (1 << 3), + /* clamp arrow interaction to property width */ + ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED = (1 << 4), +}; + +void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *mpr, const float min, const float max); +void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *mpr, const float range_fac); + +/* -------------------------------------------------------------------- */ +/* 2D Arrow Manipulator */ + +/* none */ + +/* -------------------------------------------------------------------- */ +/* Cage Manipulator */ + +enum { + ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE = (1 << 0), /* Translates */ + ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE = (1 << 1), /* Rotates */ + ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE = (1 << 2), /* Scales */ + ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM = (1 << 3), /* Scales uniformly */ + ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED = (1 << 4), /* Negative scale allowed */ +}; + +/* draw_style */ +enum { + ED_MANIPULATOR_CAGE2D_STYLE_BOX = 0, + ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE = 1, +}; + +/* draw_options */ +enum { + /** Draw a central handle (instead of having the entire area selectable) + * Needed for large rectangles that we don't want to swallow all events. */ + ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE = (1 << 0), +}; + +/** #wmManipulator.highlight_part */ +enum { + ED_MANIPULATOR_CAGE2D_PART_TRANSLATE = 0, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X = 1, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X = 2, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y = 3, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y = 4, + /* Corners */ + ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y = 5, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y = 6, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y = 7, + ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y = 8, + + ED_MANIPULATOR_CAGE2D_PART_ROTATE = 9, +}; + +/** #wmManipulator.highlight_part */ +enum { + /* ordered min/mid/max so we can loop over values (MIN/MID/MAX) on each axis. */ + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z = 0, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MID_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MID_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MID_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MIN_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MIN_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MIN_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MAX_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MAX_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MAX_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MID_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MID_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MID_Y_MAX_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MIN_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MID_Z, + ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, + + ED_MANIPULATOR_CAGE3D_PART_TRANSLATE, + + ED_MANIPULATOR_CAGE3D_PART_ROTATE, +}; + +/* -------------------------------------------------------------------- */ +/* Dial Manipulator */ + +/* draw_options */ +enum { + ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP = 0, + ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP = (1 << 0), + ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL = (1 << 1), + ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR = (1 << 2), + ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y = (1 << 3), +}; + +/* -------------------------------------------------------------------- */ +/* Grab Manipulator */ + +/* draw_options */ +enum { + ED_MANIPULATOR_GRAB_DRAW_FLAG_NOP = 0, + /* only for solid shapes */ + ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL = (1 << 0), + ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW = (1 << 1), +}; + +enum { + ED_MANIPULATOR_GRAB_STYLE_RING_2D = 0, + ED_MANIPULATOR_GRAB_STYLE_CROSS_2D = 1, +}; + +/* -------------------------------------------------------------------- */ +/* Button Manipulator */ + +enum { + ED_MANIPULATOR_BUTTON_SHOW_OUTLINE = (1 << 0), + /** + * Draw a line from the origin to the offset (similar to an arrow) + * sometimes needed to show what the button edits. + */ + ED_MANIPULATOR_BUTTON_SHOW_HELPLINE = (1 << 1), +}; + + +/* -------------------------------------------------------------------- */ +/* Primitive Manipulator */ + +enum { + ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE = 0, +}; + +#endif /* __ED_MANIPULATOR_LIBRARY_H__ */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 8edbcc5f56c..0d323258a19 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -39,6 +39,7 @@ struct ID; struct View3D; struct ARegion; struct bContext; +struct Depsgraph; struct wmOperator; struct wmKeyConfig; struct ReportList; @@ -47,7 +48,6 @@ struct bDeformGroup; struct MDeformVert; struct Scene; struct Mesh; -struct MTexPoly; struct UvVertMap; struct UvMapVert; struct BMEditMesh; @@ -114,8 +114,7 @@ struct UvElement *BM_uv_element_get(struct UvElementMap *map, struct BMFace * bool EDBM_uv_check(struct BMEditMesh *em); struct BMFace *EDBM_uv_active_face_get( - struct BMEditMesh *em, const bool sloppy, const bool selected, - struct MTexPoly **r_tf); + struct BMEditMesh *em, const bool sloppy, const bool selected); void BM_uv_vert_map_free(struct UvVertMap *vmap); struct UvMapVert *BM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v); @@ -127,6 +126,7 @@ void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag); void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag); bool BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, + struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, struct Object *obedit); /* editmesh_undo.c */ @@ -221,13 +221,18 @@ typedef struct MirrTopoStore_t { intptr_t *index_lookup; int prev_vert_tot; int prev_edge_tot; - int prev_ob_mode; + bool prev_is_editmode; } MirrTopoStore_t; bool ED_mesh_mirrtopo_recalc_check( - struct Mesh *me, struct DerivedMesh *dm, const int ob_mode, MirrTopoStore_t *mesh_topo_store); + struct Mesh *me, struct DerivedMesh *dm, MirrTopoStore_t *mesh_topo_store); +bool ED_mesh_mirrtopo_recalc_check__real_mesh( + struct Mesh *me, struct Mesh *dm, MirrTopoStore_t *mesh_topo_store); void ED_mesh_mirrtopo_init( - struct Mesh *me, struct DerivedMesh *dm, const int ob_mode, MirrTopoStore_t *mesh_topo_store, + struct Mesh *me, struct DerivedMesh *dm, MirrTopoStore_t *mesh_topo_store, + const bool skip_em_vert_array_init); +void ED_mesh_mirrtopo_init__real_mesh( + struct Mesh *me, struct Mesh *dm, MirrTopoStore_t *mesh_topo_store, const bool skip_em_vert_array_init); void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store); @@ -266,7 +271,6 @@ void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGrou float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum); void ED_vgroup_vert_active_mirror(struct Object *ob, int def_nr); - /* mesh_data.c */ // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces); void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count); @@ -319,16 +323,21 @@ int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op); /* mirror lookup api */ int ED_mesh_mirror_spatial_table( struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, const float co[3], char mode); +int ED_mesh_mirror_spatial_table__real_mesh( + struct Object *ob, struct BMEditMesh *em, struct Mesh *mesh, const float co[3], char mode); int ED_mesh_mirror_topo_table(struct Object *ob, struct DerivedMesh *dm, char mode); +int ED_mesh_mirror_topo_table__real_mesh(struct Object *ob, struct Mesh *mesh, char mode); /* retrieves mirrored cache vert, or NULL if there isn't one. * note: calling this without ensuring the mirror cache state * is bad.*/ int mesh_get_x_mirror_vert(struct Object *ob, struct DerivedMesh *dm, int index, const bool use_topology); +int mesh_get_x_mirror_vert__real_mesh(struct Object *ob, struct Mesh *mesh, int index, const bool use_topology); struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index, const bool use_topology); int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm); +int *mesh_get_x_mirror_faces__real_mesh(struct Object *ob, struct BMEditMesh *em, struct Mesh *mesh); int ED_mesh_mirror_get_vert(struct Object *ob, int index); @@ -341,6 +350,9 @@ struct MDeformVert *ED_mesh_active_dvert_get_em(struct Object *ob, struct BMVert struct MDeformVert *ED_mesh_active_dvert_get_ob(struct Object *ob, int *r_index); struct MDeformVert *ED_mesh_active_dvert_get_only(struct Object *ob); +void EDBM_mesh_stats_multi(struct Object **objects, const uint objects_len, int totelem[3], int totelem_sel[3]); +void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, const uint objects_len, const char htype); + #define ED_MESH_PICK_DEFAULT_VERT_SIZE 50 #define ED_MESH_PICK_DEFAULT_FACE_SIZE 3 diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index b4d4ffe44dd..6828cedbd80 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -75,7 +75,7 @@ void ED_init_custom_node_socket_type(struct bNodeSocketType *stype); void ED_init_standard_node_socket_type(struct bNodeSocketType *stype); void ED_init_node_socket_type_virtual(struct bNodeSocketType *stype); void ED_node_sample_set(const float col[4]); -void ED_node_draw_snap(struct View2D *v2d, const float cent[2], float size, NodeBorder border); +void ED_node_draw_snap(struct View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos); /* node_draw.c */ void ED_node_tree_update(const struct bContext *C); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 72cc245d772..c793c0aad2b 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -35,6 +35,7 @@ extern "C" { #endif +struct bFaceMap; struct Base; struct EnumPropertyItem; struct ID; @@ -43,6 +44,7 @@ struct ModifierData; struct Object; struct ReportList; struct Scene; +struct ViewLayer; struct bConstraint; struct bContext; struct bPoseChannel; @@ -50,9 +52,12 @@ struct wmKeyConfig; struct wmKeyMap; struct wmOperator; struct wmOperatorType; +struct wmWindow; +struct wmWindowManager; struct PointerRNA; struct PropertyRNA; struct EnumPropertyItem; +struct Depsgraph; #include "DNA_object_enums.h" @@ -82,16 +87,21 @@ typedef enum eParentType { PAR_VERTEX_TRI, } eParentType; +typedef enum eObjectSelect_Mode { + BA_DESELECT = 0, + BA_SELECT = 1, + BA_INVERT = 2, +} eObjectSelect_Mode; + #ifdef __RNA_TYPES_H__ extern struct EnumPropertyItem prop_clear_parent_types[]; extern struct EnumPropertyItem prop_make_parent_types[]; #endif -bool ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, +bool ED_object_parent_set(struct ReportList *reports, const struct bContext *C, struct Scene *scene, struct Object *ob, struct Object *par, int partype, const bool xmirror, const bool keep_transform, const int vert_par[3]); void ED_object_parent_clear(struct Object *ob, const int type); -struct Base *ED_object_scene_link(struct Scene *scene, struct Object *ob); void ED_keymap_proportional_cycle(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap); void ED_keymap_proportional_obmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap); @@ -99,15 +109,12 @@ void ED_keymap_proportional_maskmode(struct wmKeyConfig *keyconf, struct wmKeyMa void ED_keymap_proportional_editmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, const bool do_connected); -/* send your own notifier for select! */ -void ED_base_object_select(struct Base *base, short mode); -/* includes notifier */ -void ED_base_object_activate(struct bContext *C, struct Base *base); - -void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Base *base); +void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode); +void ED_object_base_activate(struct bContext *C, struct Base *base); +void ED_object_base_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob); /* single object duplicate, if (dupflag == 0), fully linked, else it uses the flags given */ -struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct Base *base, int dupflag); +struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, int dupflag); void ED_object_parent(struct Object *ob, struct Object *parent, const int type, const char *substr); @@ -116,9 +123,13 @@ enum { EM_FREEDATA = (1 << 0), EM_WAITCURSOR = (1 << 1), EM_IGNORE_LAYER = (1 << 3), + EM_NO_CONTEXT = (1 << 4), }; -bool ED_object_editmode_exit_ex(struct Scene *scene, struct Object *obedit, int flag); +bool ED_object_editmode_exit_ex( + struct Scene *scene, struct Object *obedit, int flag); bool ED_object_editmode_exit(struct bContext *C, int flag); + +bool ED_object_editmode_enter_ex(struct Main *bmain, struct Scene *scene, struct Object *ob, int flag); bool ED_object_editmode_enter(struct bContext *C, int flag); bool ED_object_editmode_load(struct Main *bmain, struct Object *obedit); @@ -126,11 +137,11 @@ bool ED_object_editmode_calc_active_center(struct Object *obedit, const bool sel void ED_object_vpaintmode_enter_ex( - struct wmWindowManager *wm, + struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct Scene *scene, struct Object *ob); void ED_object_vpaintmode_enter(struct bContext *C); void ED_object_wpaintmode_enter_ex( - struct wmWindowManager *wm, + struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct Scene *scene, struct Object *ob); void ED_object_wpaintmode_enter(struct bContext *C); @@ -140,10 +151,12 @@ void ED_object_wpaintmode_exit_ex(struct Object *ob); void ED_object_wpaintmode_exit(struct bContext *C); void ED_object_sculptmode_enter_ex( + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ReportList *reports); void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports); void ED_object_sculptmode_exit_ex( + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void ED_object_sculptmode_exit(struct bContext *C); @@ -199,6 +212,21 @@ bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, eObjectMod void ED_object_mode_toggle(struct bContext *C, eObjectMode mode); void ED_object_mode_set(struct bContext *C, eObjectMode mode); +bool ED_object_mode_generic_enter( + struct bContext *C, + eObjectMode object_mode); +void ED_object_mode_generic_exit( + struct Main *bmain, + struct Depsgraph *depsgraph, + struct Scene *scene, struct Object *ob); +bool ED_object_mode_generic_has_data( + struct Depsgraph *depsgraph, + struct Object *ob); + +bool ED_object_mode_generic_exists( + struct wmWindowManager *wm, struct Object *ob, + eObjectMode object_mode); + /* object_modifier.c */ enum { MODIFIER_APPLY_DATA = 1, @@ -215,9 +243,10 @@ int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_convert( struct ReportList *reports, struct Main *bmain, struct Scene *scene, - struct Object *ob, struct ModifierData *md); -int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene, - struct Object *ob, struct ModifierData *md, int mode); + struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md); +int ED_object_modifier_apply( + struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene, + struct Object *ob, struct ModifierData *md, int mode); int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md); bool ED_object_iter_other( @@ -240,8 +269,15 @@ const struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( void ED_object_check_force_modifiers( struct Main *bmain, struct Scene *scene, struct Object *object); +/* object_facemap_ops.c */ +void ED_object_facemap_face_add(struct Object *ob, struct bFaceMap *fmap, int facenum); +void ED_object_facemap_face_remove(struct Object *ob, struct bFaceMap *fmap, int facenum); + #ifdef __cplusplus } #endif +/* Don't allow switching object-modes when selecting objects. */ +#define USE_OBJECT_MODE_STRICT + #endif /* __ED_OBJECT_H__ */ diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h index 73ee2542247..c1b3c3e9e1c 100644 --- a/source/blender/editors/include/ED_outliner.h +++ b/source/blender/editors/include/ED_outliner.h @@ -27,4 +27,11 @@ #ifndef __ED_OUTLINER_H__ #define __ED_OUTLINER_H__ +struct bContext; +struct ListBase; + +int ED_outliner_collections_editor_poll(struct bContext *C); + +void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects); + #endif /* __ED_OUTLINER_H__ */ diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 4f6aa1cc702..8b522c91188 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -34,10 +34,12 @@ struct bContext; struct Object; +struct ParticleSystem; struct ParticleEditSettings; struct rcti; struct PTCacheEdit; struct Scene; +struct ViewLayer; struct UndoType; /* particle edit mode */ @@ -45,15 +47,18 @@ void PE_free_ptcache_edit(struct PTCacheEdit *edit); int PE_start_edit(struct PTCacheEdit *edit); /* access */ +struct PTCacheEdit *PE_get_current_from_psys(struct ParticleSystem *psys); struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob); -struct PTCacheEdit *PE_create_current(struct Scene *scene, struct Object *ob); -void PE_current_changed(struct Scene *scene, struct Object *ob); -int PE_minmax(struct Scene *scene, float min[3], float max[3]); +struct PTCacheEdit *PE_create_current(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); +void PE_current_changed(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); +int PE_minmax(struct Scene *scene, struct ViewLayer *view_layer, float min[3], float max[3]); struct ParticleEditSettings *PE_settings(struct Scene *scene); /* update calls */ void PE_hide_keys_time(struct Scene *scene, struct PTCacheEdit *edit, float cfra); -void PE_update_object(struct Scene *scene, struct Object *ob, int useflag); +void PE_update_object( + struct Depsgraph *depsgraph, struct Scene *scene, + struct Object *ob, int useflag); /* selection tools */ int PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index 707d7c6c693..2615847e90a 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -31,6 +31,7 @@ #include "DNA_vec_types.h" struct bContext; +struct DEGEditorUpdateContext; struct ID; struct Main; struct MTex; @@ -43,15 +44,16 @@ struct wmWindowManager; void ED_operatortypes_render(void); -/* render_shading.c */ +/* render_update.c */ -void ED_render_id_flush_update(struct Main *bmain, struct ID *id); void ED_render_engine_changed(struct Main *bmain); void ED_render_engine_area_exit(struct Main *bmain, struct ScrArea *sa); -void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated); -void ED_render_scene_update_pre(struct Main *bmain, struct Scene *scene, bool time); -void ED_viewport_render_kill_jobs(struct wmWindowManager *wm, struct Main *bmain, bool free_database); +/* Callbacks handling data update events coming from depsgraph. */ + +void ED_render_id_flush_update(const struct DEGEditorUpdateContext *update_ctx, struct ID *id); +void ED_render_scene_update(const struct DEGEditorUpdateContext *update_ctx, int updated); + struct Scene *ED_render_job_get_scene(const struct bContext *C); struct Scene *ED_render_job_get_current_scene(const struct bContext *C); diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h new file mode 100644 index 00000000000..9b48187e541 --- /dev/null +++ b/source/blender/editors/include/ED_scene.h @@ -0,0 +1,44 @@ +/* + * ***** 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 ED_scene.h + * \ingroup editors + */ + +#ifndef __ED_SCENE_H__ +#define __ED_SCENE_H__ + +#include "BLI_compiler_attrs.h" + +enum eSceneCopyMethod; + +struct Scene *ED_scene_add(struct Main *bmain, struct bContext *C, struct wmWindow *win, enum eSceneCopyMethod method) ATTR_NONNULL(); +bool ED_scene_delete(struct bContext *C, struct Main *bmain, struct wmWindow *win, struct Scene *scene) ATTR_NONNULL(); +void ED_scene_change_update( + struct Main *bmain, struct bContext *C, + struct wmWindow *win, const struct bScreen *screen, + struct Scene *scene_old, struct Scene *scene_new) ATTR_NONNULL(); +bool ED_scene_view_layer_delete( + struct Main *bmain, struct Scene *scene, struct ViewLayer *layer, + struct ReportList *reports) ATTR_NONNULL(1, 2, 3); + +void ED_operatortypes_scene(void); + +#endif /* __ED_SCENE_H__ */ diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index b80f69fd406..63485800a9b 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -35,47 +35,82 @@ #include "DNA_space_types.h" #include "DNA_view2d_types.h" #include "DNA_view3d_types.h" +#include "DNA_workspace_types.h" +#include "DNA_object_enums.h" + +#include "BLI_compiler_attrs.h" + +struct Depsgraph; struct wmWindowManager; struct wmWindow; struct wmNotifier; struct wmEvent; struct wmKeyConfig; +struct WorkSpace; +struct WorkSpaceInstanceHook; struct bContext; struct Scene; +struct ViewLayer; struct bScreen; struct ARegion; struct uiBlock; struct rcti; struct Main; +struct wmMsgBus; +struct wmMsgSubscribeKey; +struct wmMsgSubscribeValue; /* regions */ -void ED_region_do_listen(struct bScreen *sc, struct ScrArea *sa, struct ARegion *ar, struct wmNotifier *note); +void ED_region_do_listen( + struct bScreen *sc, struct ScrArea *sa, struct ARegion *ar, + struct wmNotifier *note, const Scene *scene); +void ED_region_do_layout(struct bContext *C, struct ARegion *ar); void ED_region_do_draw(struct bContext *C, struct ARegion *ar); void ED_region_exit(struct bContext *C, struct ARegion *ar); void ED_region_pixelspace(struct ARegion *ar); -void ED_region_set(const struct bContext *C, struct ARegion *ar); void ED_region_update_rect(struct bContext *C, struct ARegion *ar); void ED_region_init(struct bContext *C, struct ARegion *ar); void ED_region_tag_redraw(struct ARegion *ar); void ED_region_tag_redraw_partial(struct ARegion *ar, const struct rcti *rct); void ED_region_tag_redraw_overlay(struct ARegion *ar); +void ED_region_tag_redraw_no_rebuild(struct ARegion *ar); void ED_region_tag_refresh_ui(struct ARegion *ar); void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar); void ED_region_panels( const struct bContext *C, struct ARegion *ar, - const char *context, int contextnr, + const char *contexts[], int contextnr, const bool vertical); void ED_region_header_init(struct ARegion *ar); void ED_region_header(const struct bContext *C, struct ARegion *ar); +void ED_region_header_layout(const struct bContext *C, struct ARegion *ar); +void ED_region_header_draw(const struct bContext *C, struct ARegion *ar); void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar); void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar); +void ED_region_visibility_change_update(struct bContext *C, struct ARegion *ar); void ED_region_info_draw(struct ARegion *ar, const char *text, float fill_color[4], const bool full_redraw); +void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float fill_color[4], const bool full_redraw); void ED_region_image_metadata_draw(int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy); void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy); -float ED_region_blend_factor(struct ARegion *ar); +float ED_region_blend_alpha(struct ARegion *ar); void ED_region_visible_rect(struct ARegion *ar, struct rcti *rect); +bool ED_region_is_overlap(int spacetype, int regiontype); + +int ED_region_snap_size_test(const struct ARegion *ar); +bool ED_region_snap_size_apply(struct ARegion *ar, int snap_flag); + +/* message_bus callbacks */ +void ED_region_do_msg_notify_tag_redraw( + struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); +void ED_area_do_msg_notify_tag_refresh( + struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); +/* message bus */ +void ED_region_message_subscribe( + struct bContext *C, + struct WorkSpace *workspace, struct Scene *scene, + struct bScreen *screen, struct ScrArea *sa, struct ARegion *ar, + struct wmMsgBus *mbus); /* spaces */ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); @@ -85,8 +120,12 @@ int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *bl void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *sa); void ED_area_exit(struct bContext *C, struct ScrArea *sa); int ED_screen_area_active(const struct bContext *C); -void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note); +void ED_screen_global_areas_create( + struct wmWindow *win); +void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note, Scene *scene, + struct WorkSpace *workspace); void ED_area_tag_redraw(ScrArea *sa); +void ED_area_tag_redraw_no_rebuild(ScrArea *sa); void ED_area_tag_redraw_regiontype(ScrArea *sa, int type); void ED_area_tag_refresh(ScrArea *sa); void ED_area_do_refresh(struct bContext *C, ScrArea *sa); @@ -96,6 +135,29 @@ void ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool s void ED_area_prevspace(struct bContext *C, ScrArea *sa); void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2); int ED_area_headersize(void); +int ED_area_header_alignment(const ScrArea *area); +int ED_area_global_size_y(const ScrArea *area); +bool ED_area_is_global(const ScrArea *area); +int ED_region_global_size_y(void); +void ED_area_update_region_sizes(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area); + +ScrArea *ED_screen_areas_iter_first(const struct wmWindow *win, const bScreen *screen); +ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area); +/** + * Iterate over all areas visible in the screen (screen as in everything + * visible in the window, not just bScreen). + * \note Skips global areas with flag GLOBAL_AREA_IS_HIDDEN. + */ +#define ED_screen_areas_iter(win, screen, area_name) \ + for (ScrArea *area_name = ED_screen_areas_iter_first(win, screen); \ + area_name != NULL; \ + area_name = ED_screen_areas_iter_next(screen, area_name)) +#define ED_screen_verts_iter(win, screen, vert_name) \ + for (ScrVert *vert_name = (win)->global_areas.vertbase.first ? \ + (win)->global_areas.vertbase.first : \ + screen->vertbase.first; \ + vert_name != NULL; \ + vert_name = (vert_name == (win)->global_areas.vertbase.last) ? (screen)->vertbase.first : vert_name->next) /* screens */ void ED_screens_initialize(struct wmWindowManager *wm); @@ -103,14 +165,14 @@ void ED_screen_draw_edges(struct wmWindow *win); void ED_screen_draw_join_shape(struct ScrArea *sa1, struct ScrArea *sa2); void ED_screen_draw_split_preview(struct ScrArea *sa, const int dir, const float fac); void ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win); +void ED_screen_ensure_updated(struct wmWindowManager *wm, struct wmWindow *win, struct bScreen *screen); void ED_screen_do_listen(struct bContext *C, struct wmNotifier *note); -bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc); -bScreen *ED_screen_add(struct wmWindow *win, struct Scene *scene, const char *name); -bool ED_screen_set(struct bContext *C, struct bScreen *sc); -bool ED_screen_delete(struct bContext *C, struct bScreen *sc); -void ED_screen_set_scene(struct bContext *C, struct bScreen *screen, struct Scene *scene); -bool ED_screen_delete_scene(struct bContext *C, struct Scene *scene); -void ED_screen_set_subwinactive(struct bContext *C, const struct wmEvent *event); +bool ED_screen_change(struct bContext *C, struct bScreen *sc); +void ED_screen_update_after_scene_change( + const struct bScreen *screen, + struct Scene *scene_new, + struct ViewLayer *view_layer); +void ED_screen_set_active_region(struct bContext *C, struct wmWindow *win, const int xy[2]); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable); void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh); @@ -120,10 +182,55 @@ void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa); void ED_screen_full_restore(struct bContext *C, ScrArea *sa); struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa, const short state); void ED_screens_header_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); -bool ED_screen_stereo3d_required(struct bScreen *screen); +bool ED_screen_stereo3d_required(const struct bScreen *screen, const struct Scene *scene); +Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm); +Scene *ED_screen_scene_find_with_window(const struct bScreen *screen, const struct wmWindowManager *wm, struct wmWindow **r_window); +struct wmWindow *ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm); +void ED_screen_preview_render(const struct bScreen *screen, int size_x, int size_y, unsigned int *r_rect) ATTR_NONNULL(); + +/* workspaces */ +struct WorkSpace *ED_workspace_add( + struct Main *bmain, + const char *name, + Scene *scene, + ViewLayer *act_render_layer) ATTR_NONNULL(); +bool ED_workspace_change( + struct WorkSpace *workspace_new, + struct bContext *C, + struct wmWindowManager *wm, struct wmWindow *win) ATTR_NONNULL(); +struct WorkSpace *ED_workspace_duplicate( + struct WorkSpace *workspace_old, + struct Main *bmain, struct wmWindow *win); +bool ED_workspace_delete( + struct WorkSpace *workspace, + struct Main *bmain, struct bContext *C, + struct wmWindowManager *wm) ATTR_NONNULL(); +void ED_workspace_scene_data_sync( + struct WorkSpaceInstanceHook *hook, Scene *scene) ATTR_NONNULL(); +void ED_workspace_view_layer_unset( + const struct Main *bmain, struct Scene *scene, + const ViewLayer *layer_unset, ViewLayer *layer_new) ATTR_NONNULL(1, 2); +struct WorkSpaceLayout *ED_workspace_layout_add( + struct WorkSpace *workspace, + struct wmWindow *win, + const char *name) ATTR_NONNULL(); +struct WorkSpaceLayout *ED_workspace_layout_duplicate( + struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, + struct wmWindow *win) ATTR_NONNULL(); +bool ED_workspace_layout_delete( + struct WorkSpace *workspace, struct WorkSpaceLayout *layout_old, + struct bContext *C) ATTR_NONNULL(); +bool ED_workspace_layout_cycle( + struct WorkSpace *workspace, const short direction, + struct bContext *C) ATTR_NONNULL(); + +void ED_workspace_object_mode_sync_from_object( + struct wmWindowManager *wm, WorkSpace *workspace, struct Object *obact); +void ED_workspace_object_mode_sync_from_scene( + struct wmWindowManager *wm, WorkSpace *workspace, struct Scene *scene); /* anim */ -void ED_update_for_newframe(struct Main *bmain, struct Scene *scene, int mute); +void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph); void ED_refresh_viewport_fps(struct bContext *C); int ED_screen_animation_play(struct bContext *C, int sync, int mode); @@ -133,6 +240,8 @@ bScreen *ED_screen_animation_no_scrub(const struct wmWindowManager *wm); /* screen keymaps */ void ED_operatortypes_screen(void); void ED_keymap_screen(struct wmKeyConfig *keyconf); +/* workspace keymaps */ +void ED_operatortypes_workspace(void); /* operators; context poll callbacks */ int ED_operator_screenactive(struct bContext *C); @@ -147,7 +256,6 @@ int ED_operator_objectmode(struct bContext *C); int ED_operator_view3d_active(struct bContext *C); int ED_operator_region_view3d_active(struct bContext *C); int ED_operator_animview_active(struct bContext *C); -int ED_operator_timeline_active(struct bContext *C); int ED_operator_outliner_active(struct bContext *C); int ED_operator_outliner_active_no_editobject(struct bContext *C); int ED_operator_file_active(struct bContext *C); @@ -160,7 +268,6 @@ int ED_operator_sequencer_active(struct bContext *C); int ED_operator_sequencer_active_editable(struct bContext *C); int ED_operator_image_active(struct bContext *C); int ED_operator_nla_active(struct bContext *C); -int ED_operator_logic_active(struct bContext *C); int ED_operator_info_active(struct bContext *C); int ED_operator_console_active(struct bContext *C); @@ -189,6 +296,7 @@ int ED_operator_posemode_context(struct bContext *C); int ED_operator_posemode(struct bContext *C); int ED_operator_posemode_local(struct bContext *C); int ED_operator_mask(struct bContext *C); +int ED_operator_camera(struct bContext *C); /* Cache display helpers */ diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index e6c697b9d06..271e84e3ec2 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -83,13 +83,22 @@ typedef enum { AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_ edge is action zone. Region minimized to the top left */ } AZEdge; +typedef enum { + AZ_SCROLL_VERT, + AZ_SCROLL_HOR, +} AZScrollDirection; + /* for editing areas/regions */ typedef struct AZone { struct AZone *next, *prev; ARegion *ar; int type; - /* region-azone, which of the edges (only for AZONE_REGION) */ - AZEdge edge; + + union { + /* region-azone, which of the edges (only for AZONE_REGION) */ + AZEdge edge; + AZScrollDirection direction; + }; /* for draw */ short x1, y1, x2, y2; /* for clip */ @@ -99,8 +108,15 @@ typedef struct AZone { } AZone; /* actionzone type */ -#define AZONE_AREA 1 /* corner widgets for splitting areas */ -#define AZONE_REGION 2 /* when a region is collapsed, draw a handle to expose */ -#define AZONE_FULLSCREEN 3 /* when in editor fullscreen draw a corner to go to normal mode */ +enum { + /* corner widgets for splitting areas */ + AZONE_AREA = 1, + /* when a region is collapsed, draw a handle to expose */ + AZONE_REGION, + /* when in editor fullscreen draw a corner to go to normal mode */ + AZONE_FULLSCREEN, + /* Hotspot azone around scrollbars to show/hide them. */ + AZONE_REGION_SCROLL, +}; #endif /* __ED_SCREEN_TYPES_H__ */ diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index ee2eff3ebba..c624405cd0c 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -42,8 +42,7 @@ struct ListBase; /* sculpt.c */ void ED_operatortypes_sculpt(void); -void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, - struct RegionView3D *rv3d, struct Object *ob); +void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, struct Object *ob); int ED_sculpt_mask_box_select(struct bContext *C, struct ViewContext *vc, const struct rcti *rect, bool select, bool extend); /* sculpt_undo.c */ diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index 6de1f9c6f1f..eedd5336fb8 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -41,7 +41,6 @@ void ED_spacemacros_init(void); /* calls for registering default spaces */ void ED_spacetype_outliner(void); -void ED_spacetype_time(void); void ED_spacetype_view3d(void); void ED_spacetype_ipo(void); void ED_spacetype_image(void); @@ -58,6 +57,8 @@ void ED_spacetype_logic(void); void ED_spacetype_console(void); void ED_spacetype_userpref(void); void ED_spacetype_clip(void); +void ED_spacetype_statusbar(void); +void ED_spacetype_topbar(void); /* calls for instancing and freeing spacetype static data * called in WM_init_exit */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 9a0a7f8f1bb..1e3c8995314 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -43,6 +43,7 @@ struct wmEvent; struct wmKeyConfig; struct wmKeyMap; struct wmOperatorType; +struct WorkSpace; struct Main; struct SnapObjectContext; struct SnapObjectParams; @@ -101,6 +102,7 @@ enum TfmMode { #define CTX_MASK (1 << 7) #define CTX_PAINT_CURVE (1 << 8) #define CTX_GPENCIL_STROKES (1 << 9) +#define CTX_CURSOR (1 << 10) /* Standalone call to get the transformation center corresponding to the current situation * returns 1 if successful, 0 otherwise (usually means there's no selection) @@ -109,9 +111,10 @@ enum TfmMode { bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]); struct TransInfo; -struct Base; struct Scene; struct Object; +struct wmManipulatorGroup; +struct wmManipulatorGroupType; struct wmOperator; /* UNUSED */ @@ -128,7 +131,7 @@ void BIF_createTransformOrientation(struct bContext *C, struct ReportList *repor const char *name, const bool use_view, const bool activate, const bool overwrite); void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts); -void BIF_selectTransformOrientationValue(struct bContext *C, int orientation); +void BIF_selectTransformOrientationValue(struct Scene *scene, int orientation); void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const short around); @@ -150,13 +153,20 @@ int BIF_countTransformOrientation(const struct bContext *C); #define P_NO_TEXSPACE (1 << 11) #define P_CENTER (1 << 12) #define P_GPENCIL_EDIT (1 << 13) +#define P_CURSOR_EDIT (1 << 14) void Transform_Properties(struct wmOperatorType *ot, int flags); -/* view3d manipulators */ +/* transform manipulators */ + +void TRANSFORM_WGT_manipulator(struct wmManipulatorGroupType *wgt); +void VIEW3D_WGT_xform_cage(struct wmManipulatorGroupType *wgt); + +bool ED_widgetgroup_manipulator2d_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt); +void ED_widgetgroup_manipulator2d_setup(const struct bContext *C, struct wmManipulatorGroup *mgroup); +void ED_widgetgroup_manipulator2d_refresh(const struct bContext *C, struct wmManipulatorGroup *mgroup); +void ED_widgetgroup_manipulator2d_draw_prepare(const struct bContext *C, struct wmManipulatorGroup *mgroup); -int BIF_do_manipulator(struct bContext *C, const struct wmEvent *event, struct wmOperator *op); -void BIF_draw_manipulator(const struct bContext *C); /* Snapping */ @@ -186,4 +196,24 @@ bool snapNodesTransform( /* return args */ float r_loc[2], float *r_dist_px, char *r_node_border); +struct TransformBounds { + float center[3]; /* Center for transform widget. */ + float min[3], max[3]; /* Boundbox of selection for transform widget. */ + + /* Normalized axis */ + float axis[3][3]; + float axis_min[3], axis_max[3]; +}; + +struct TransformCalcParams { + uint use_only_center : 1; + uint use_local_axis : 1; + /* Use 'Scene.orientation_type' when zero, otherwise subtract one and use. */ + ushort orientation_type; +}; +int ED_transform_calc_manipulator_stats( + const struct bContext *C, + const struct TransformCalcParams *params, + struct TransformBounds *tbounds); + #endif /* __ED_TRANSFORM_H__ */ diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h index c20d92963a9..18d5101ebf7 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -29,12 +29,15 @@ struct BMVert; struct BMEdge; struct BMFace; +struct Depsgraph; struct ListBase; struct Scene; +struct ViewLayer; struct Main; struct Object; struct ARegion; struct View3D; +struct bContext; /* transform_snap_object.c */ @@ -69,13 +72,16 @@ struct SnapObjectParams { char snap_select; /* use editmode cage */ unsigned int use_object_edit_cage : 1; + /* snap to the closest element, use when using more than one snap type */ + unsigned int use_occlusion_test : 1; + }; typedef struct SnapObjectContext SnapObjectContext; SnapObjectContext *ED_transform_snap_object_context_create( - struct Main *bmain, struct Scene *scene, int flag); + struct Scene *scene, struct Depsgraph *depsgraph, int flag); SnapObjectContext *ED_transform_snap_object_context_create_view3d( - struct Main *bmain, struct Scene *scene, int flag, + struct Scene *scene, struct Depsgraph *depsgraph, int flag, /* extra args for view3d */ const struct ARegion *ar, const struct View3D *v3d); void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx); @@ -113,7 +119,6 @@ bool ED_transform_snap_object_project_view3d_ex( const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, - float *ray_depth, float r_loc[3], float r_no[3], int *r_index, struct Object **r_ob, float r_obmat[4][4]); bool ED_transform_snap_object_project_view3d( @@ -121,16 +126,8 @@ bool ED_transform_snap_object_project_view3d( const unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], float *dist_px, - float *ray_depth, /* return args */ float r_loc[3], float r_no[3]); -bool ED_transform_snap_object_project_view3d_mixed( - SnapObjectContext *sctx, - const unsigned short snap_to_flag, - const struct SnapObjectParams *params, - const float mval_fl[2], float *dist_px, - bool use_depth, - float r_co[3], float r_no[3]); bool ED_transform_snap_object_project_all_view3d_ex( SnapObjectContext *sctx, diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h index 084c97dba2a..5103ac97361 100644 --- a/source/blender/editors/include/ED_undo.h +++ b/source/blender/editors/include/ED_undo.h @@ -25,7 +25,10 @@ #ifndef __ED_UNDO_H__ #define __ED_UNDO_H__ +#include "BLI_compiler_attrs.h" + struct bContext; +struct CLG_LogRef; struct wmOperator; struct wmOperatorType; struct UndoStack; @@ -49,10 +52,22 @@ int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); void ED_undo_operator_repeat_cb(struct bContext *C, void *arg_op, void *arg_unused); void ED_undo_operator_repeat_cb_evt(struct bContext *C, void *arg_op, int arg_unused); +/* Context sanity helpers for operator repeat. */ +typedef struct OperatorRepeatContextHandle OperatorRepeatContextHandle; + +const OperatorRepeatContextHandle *ED_operator_repeat_prepare_context( + struct bContext *C, struct wmOperator *op) ATTR_WARN_UNUSED_RESULT; +void ED_operator_repeat_reset_context( + struct bContext *C, const OperatorRepeatContextHandle *context_info); + bool ED_undo_is_valid(const struct bContext *C, const char *undoname); struct UndoStack *ED_undo_stack_get(void); +/* helpers */ +void ED_undo_object_set_active_or_warn( + struct ViewLayer *view_layer, struct Object *ob, const char *info, struct CLG_LogRef *log); + /* undo_system_types.c */ void ED_undosys_type_init(void); void ED_undosys_type_free(void); diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 5a051271926..3a35bddeb77 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -31,11 +31,10 @@ #ifndef __ED_UTIL_H__ #define __ED_UTIL_H__ +#include "BLI_compiler_attrs.h" + struct bContext; struct wmOperatorType; -struct ScrArea; -struct SpaceLink; -struct PackedFile; /* ed_util.c */ diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index e84106aec20..e6cd276e5c7 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -35,12 +35,13 @@ struct BMesh; struct BMEditMesh; struct BMFace; struct BMLoop; +struct Depsgraph; struct Image; struct ImageUser; -struct MTexPoly; struct Main; struct Object; struct Scene; +struct ViewLayer; struct SpaceImage; struct bNode; struct wmKeyConfig; @@ -49,11 +50,15 @@ struct wmKeyConfig; void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); -void ED_uvedit_assign_image( - struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); bool ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]); +bool ED_uvedit_center(Scene *scene, Image *ima, struct Object *obedit, float cent[2], char mode); void ED_uvedit_select_all(struct BMesh *bm); +bool ED_uvedit_minmax_multi( + struct Scene *scene, struct Image *ima, struct Object **objects_edit, uint objects_len, float r_min[2], float r_max[2]); +bool ED_uvedit_center_multi( + Scene *scene, Image *ima, struct Object **objects_edit, uint objects_len, float r_cent[2], char mode); + bool ED_object_get_active_image( struct Object *ob, int mat_nr, struct Image **r_ima, struct ImageUser **r_iuser, struct bNode **r_node, struct bNodeTree **r_ntree); @@ -62,7 +67,8 @@ void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int ma bool ED_uvedit_test(struct Object *obedit); /* visibility and selection */ -bool uvedit_face_visible_test(struct Scene *scene, struct Image *ima, struct BMFace *efa, struct MTexPoly *tf); +bool uvedit_face_visible_test( + struct Scene *scene, struct Object *obedit, struct Image *ima, struct BMFace *efa); bool uvedit_face_select_test( struct Scene *scene, struct BMFace *efa, const int cd_loop_uv_offset); @@ -116,21 +122,24 @@ void ED_uvedit_live_unwrap_end(short cancel); void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit); void ED_uvedit_pack_islands( - struct Scene *scene, struct Object *ob, struct BMesh *bm, + struct Scene *scene, struct Object *ob, struct BMesh *bm, bool selected, bool correct_aspect, bool do_rotate); +void ED_uvedit_pack_islands_multi( + struct Scene *scene, struct Object **objects, const uint objects_len, bool selected, bool correct_aspect, bool do_rotate); void ED_uvedit_unwrap_cube_project( struct BMesh *bm, float cube_size, bool use_select, const float center[3]); /* single call up unwrap using scene settings, used for edge tag unwrapping */ -void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel); +void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel, const bool pack); /* uvedit_draw.c */ void ED_image_draw_cursor( - struct ARegion *ar, const float cursor[2]); + struct ARegion *ar, const float cursor[2]); void ED_uvedit_draw_main( - struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, - struct Object *obedit, struct Object *obact); + struct SpaceImage *sima, + struct ARegion *ar, struct Scene *scene, struct ViewLayer *view_layer, + struct Object *obedit, struct Object *obact, struct Depsgraph *depsgraph); /* uvedit_buttons.c */ void ED_uvedit_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 99aa392effc..ae59f6da14b 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -40,6 +40,8 @@ struct BPoint; struct Base; struct BezTriple; struct BoundBox; +struct Camera; +struct Depsgraph; struct EditBone; struct ImBuf; struct MVert; @@ -49,14 +51,15 @@ struct Nurb; struct Object; struct RV3DMatrixStore; struct RegionView3D; +struct RenderEngineType; struct Scene; +struct ViewLayer; struct ScrArea; struct View3D; struct ViewContext; struct bContext; struct bPoseChannel; struct bScreen; -struct bglMats; struct rctf; struct rcti; struct wmOperator; @@ -66,11 +69,15 @@ struct wmWindowManager; struct GPUFX; struct GPUOffScreen; struct GPUFXSettings; +struct GPUViewport; +struct WorkSpace; enum eGPUFXFlags; /* for derivedmesh drawing callbacks, for view3d_select, .... */ typedef struct ViewContext { + struct Depsgraph *depsgraph; struct Scene *scene; + struct ViewLayer *view_layer; struct Object *obact; struct Object *obedit; struct ARegion *ar; @@ -90,17 +97,23 @@ typedef struct ViewDepths { bool damaged; } ViewDepths; -float *ED_view3d_cursor3d_get(struct Scene *scene, struct View3D *v3d); +struct View3DCursor *ED_view3d_cursor3d_get(struct Scene *scene, struct View3D *v3d); +void ED_view3d_cursor3d_calc_mat3(const struct Scene *scene, const struct View3D *v3d, float mat[3][3]); +void ED_view3d_cursor3d_calc_mat4(const struct Scene *scene, const struct View3D *v3d, float mat[4][4]); void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]); void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2]); struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d); void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist); -void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist); +void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], float *dist); -void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); -void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist); +void ED_view3d_from_object( + const struct Object *ob, + float ofs[3], float quat[4], float *dist, float *lens); +void ED_view3d_to_object( + const struct Depsgraph *depsgraph, struct Object *ob, + const float ofs[3], const float quat[4], const float dist); void ED_view3d_lastview_store(struct RegionView3D *rv3d); @@ -108,10 +121,10 @@ void ED_view3d_lastview_store(struct RegionView3D *rv3d); void ED_view3d_depth_update(struct ARegion *ar); float ED_view3d_depth_read_cached(const struct ViewContext *vc, const int mval[2]); bool ED_view3d_depth_read_cached_normal( - const ViewContext *vc, const struct bglMats *mats, const int mval[2], + const ViewContext *vc, const int mval[2], float r_normal[3]); bool ED_view3d_depth_unproject( - const struct ARegion *ar, const struct bglMats *mats, + const struct ARegion *ar, const int mval[2], const double depth, float r_location_world[3]); void ED_view3d_depth_tag_update(struct RegionView3D *rv3d); @@ -221,9 +234,11 @@ float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const fl float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip); bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]); bool ED_view3d_win_to_ray( + struct Depsgraph *depsgraph, const struct ARegion *ar, const struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3], const bool do_clip); bool ED_view3d_win_to_ray_ex( + struct Depsgraph *depsgraph, const struct ARegion *ar, const struct View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip); void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]); @@ -238,11 +253,14 @@ void ED_view3d_win_to_3d_int( void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac); void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]); void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]); -bool ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2], +bool ED_view3d_win_to_segment(struct Depsgraph *depsgraph, + const struct ARegion *ar, struct View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_end[3], const bool do_clip); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, float obmat[4][4], float pmat[4][4]); -void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z); + +void ED_view3d_project(const struct ARegion *ar, const float world[3], float region[3]); +bool ED_view3d_unproject(const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]); /* end */ @@ -251,28 +269,34 @@ void ED_view3d_dist_range_get( const struct View3D *v3d, float r_dist_range[2]); bool ED_view3d_clip_range_get( + struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, float *r_clipsta, float *r_clipend, const bool use_ortho_factor); bool ED_view3d_viewplane_get( + struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *r_viewplane, float *r_clipsta, float *r_clipend, float *r_pixsize); void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist); void ED_view3d_calc_camera_border( - const struct Scene *scene, const struct ARegion *ar, + const struct Scene *scene, struct Depsgraph *depsgraph, + const struct ARegion *ar, const struct View3D *v3d, const struct RegionView3D *rv3d, struct rctf *r_viewborder, const bool no_shift); void ED_view3d_calc_camera_border_size( - const struct Scene *scene, const struct ARegion *ar, + const struct Scene *scene, struct Depsgraph *depsgraph, + const struct ARegion *ar, const struct View3D *v3d, const struct RegionView3D *rv3d, float r_size[2]); bool ED_view3d_calc_render_border( - const struct Scene *scene, const struct View3D *v3d, - const struct ARegion *ar, struct rcti *rect); + const struct Scene *scene, struct Depsgraph *depsgraph, + struct View3D *v3d, + struct ARegion *ar, struct rcti *rect); void ED_view3d_clipping_calc_from_boundbox(float clip[6][4], const struct BoundBox *clipbb, const bool is_flip); -void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], struct bglMats *mats, const struct rcti *rect); +void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], + const struct ARegion *ar, const struct Object *ob, const struct rcti *rect); void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]); bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], const bool is_local); void ED_view3d_clipping_set(struct RegionView3D *rv3d); @@ -283,27 +307,31 @@ float ED_view3d_radius_to_dist_persp(const float angle, const float radius); float ED_view3d_radius_to_dist_ortho(const float lens, const float radius); float ED_view3d_radius_to_dist( const struct View3D *v3d, const struct ARegion *ar, + const struct Depsgraph *depsgraph, const char persp, const bool use_aspect, const float radius); -void drawcircball(int mode, const float cent[3], float rad, const float tmat[4][4]); +void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos); /* backbuffer select and draw support */ +void ED_view3d_backbuf_validate_with_select_mode(struct ViewContext *vc, short select_mode); void ED_view3d_backbuf_validate(struct ViewContext *vc); -struct ImBuf *ED_view3d_backbuf_read(struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax); +struct ImBuf *ED_view3d_backbuf_read( + struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax); unsigned int ED_view3d_backbuf_sample_rect( struct ViewContext *vc, const int mval[2], int size, unsigned int min, unsigned int max, float *r_dist); int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist); -unsigned int ED_view3d_backbuf_sample(struct ViewContext *vc, int x, int y); +unsigned int ED_view3d_backbuf_sample( + struct ViewContext *vc, int x, int y); bool ED_view3d_autodist( - struct Scene *scene, struct ARegion *ar, struct View3D *v3d, + struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], const bool alphaoverride, const float fallback_depth_pt[3]); /* only draw so ED_view3d_autodist_simple can be called many times after */ -void ED_view3d_autodist_init(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, int mode); +void ED_view3d_autodist_init(struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, int mode); bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth); bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth); bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); @@ -331,10 +359,10 @@ int view3d_opengl_select( /* view3d_select.c */ float ED_view3d_select_dist_px(void); void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc); +void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact); void view3d_operator_needs_opengl(const struct bContext *C); void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar); void view3d_opengl_read_pixels(struct ARegion *ar, int x, int y, int w, int h, int format, int type, void *data); -void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats); /* XXX should move to BLI_math */ bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2]); @@ -353,49 +381,58 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d); # define ED_view3d_clear_mats_rv3d(rv3d) (void)(rv3d) # define ED_view3d_check_mats_rv3d(rv3d) (void)(rv3d) #endif -int ED_view3d_scene_layer_set(int lay, const int *values, int *active); +int ED_view3d_view_layer_set(int lay, const int *values, int *active); struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d); void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat); +void ED_draw_object_facemap( + struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, const float col[4], const int facemap); + +struct RenderEngineType *ED_view3d_engine_type(struct Scene *scene, int drawtype); + bool ED_view3d_context_activate(struct bContext *C); -void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d); void ED_view3d_draw_offscreen( - struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], - float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, - struct GPUFX *fx, struct GPUFXSettings *fx_settings, - struct GPUOffScreen *ofs); + struct Depsgraph *depsgraph, struct Scene *scene, + int drawtype, + struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], + float winmat[4][4], bool do_sky, bool is_persp, const char *viewname, + struct GPUFXSettings *fx_settings, + struct GPUOffScreen *ofs, struct GPUViewport *viewport); void ED_view3d_draw_setup_view( - struct wmWindow *win, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, + struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, float viewmat[4][4], float winmat[4][4], const struct rcti *rect); enum { V3D_OFSDRAW_NONE = (0), - V3D_OFSDRAW_USE_BACKGROUND = (1 << 0), - V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 1), + V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 0), /* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */ - V3D_OFSDRAW_USE_GPENCIL = (1 << 2), + V3D_OFSDRAW_USE_GPENCIL = (1 << 1), V3D_OFSDRAW_USE_SOLID_TEX = (1 << 2), V3D_OFSDRAW_USE_CAMERA_DOF = (1 << 3), }; struct ImBuf *ED_view3d_draw_offscreen_imbuf( - struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, - unsigned int flag, unsigned int draw_flags, + struct Depsgraph *depsgraph, struct Scene *scene, + int drawtype, + struct View3D *v3d, struct ARegion *ar, + int sizex, int sizey, unsigned int flag, unsigned int draw_flags, int alpha_mode, int samples, const char *viewname, - struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); + struct GPUOffScreen *ofs, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - struct Scene *scene, struct Object *camera, int width, int height, - unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode, + struct Depsgraph *depsgraph, struct Scene *scene, + int drawtype, + struct Object *camera, int width, int height, + unsigned int flag, unsigned int draw_flags, int alpha_mode, int samples, const char *viewname, - struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); + struct GPUOffScreen *ofs, char err_out[256]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip); void ED_view3d_update_viewmat( - struct Scene *scene, struct View3D *v3d, struct ARegion *ar, + struct Depsgraph *depsgraph, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4], const struct rcti *rect); bool ED_view3d_quat_from_axis_view(const char view, float quat[4]); char ED_view3d_quat_to_axis_view(const float quat[4], const float epsilon); @@ -404,20 +441,28 @@ char ED_view3d_axis_view_opposite(char view); bool ED_view3d_lock(struct RegionView3D *rv3d); uint64_t ED_view3d_datamask(const struct Scene *scene, const struct View3D *v3d); -uint64_t ED_view3d_screen_datamask(const struct bScreen *screen); +uint64_t ED_view3d_screen_datamask(const struct Scene *scene, const struct bScreen *screen); bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d); -void ED_view3d_persp_switch_from_camera(struct View3D *v3d, struct RegionView3D *rv3d, const char persp); -bool ED_view3d_persp_ensure(struct View3D *v3d, struct ARegion *ar); +void ED_view3d_persp_switch_from_camera( + const struct Depsgraph *depsgraph, + struct View3D *v3d, struct RegionView3D *rv3d, const char persp); +bool ED_view3d_persp_ensure( + const struct Depsgraph *depsgraph, + struct View3D *v3d, struct ARegion *ar); /* camera lock functions */ bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d); /* copy the camera to the view before starting a view transformation */ -void ED_view3d_camera_lock_init_ex(struct View3D *v3d, struct RegionView3D *rv3d, const bool calc_dist); -void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); +void ED_view3d_camera_lock_init_ex( + const struct Depsgraph *depsgraph, + struct View3D *v3d, struct RegionView3D *rv3d, const bool calc_dist); +void ED_view3d_camera_lock_init(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d); /* copy the view to the camera, return true if */ -bool ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); +bool ED_view3d_camera_lock_sync( + const struct Depsgraph *depsgraph, + struct View3D *v3d, struct RegionView3D *rv3d); bool ED_view3d_camera_autokey( struct Scene *scene, struct ID *id_key, @@ -428,10 +473,6 @@ bool ED_view3d_camera_lock_autokey( void ED_view3d_lock_clear(struct View3D *v3d); -struct BGpic *ED_view3d_background_image_new(struct View3D *v3d); -void ED_view3d_background_image_remove(struct View3D *v3d, struct BGpic *bgpic); -void ED_view3d_background_image_clear(struct View3D *v3d); - #define VIEW3D_MARGIN 1.4f #define VIEW3D_DIST_FALLBACK 1.0f @@ -460,4 +501,11 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr void ED_view3d_id_remap(struct View3D *v3d, const struct ID *old_id, struct ID *new_id); +/* view3d_draw_legacy.c */ +/* Try avoid using these more move out of legacy. */ +void ED_view3d_draw_bgpic_test( + struct Scene *scene, struct Depsgraph *depsgraph, + struct ARegion *ar, struct View3D *v3d, + const bool do_foreground, const bool do_camera_frame); + #endif /* __ED_VIEW3D_H__ */ diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index a0d24ad60bf..b168ca00747 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -190,8 +190,8 @@ DEF_ICON(SCULPTMODE_HLT) DEF_ICON(POSE_HLT) DEF_ICON(PARTICLEMODE) DEF_ICON(LIGHTPAINT) +DEF_ICON(GREASEPENCIL_STROKE_PAINT) #ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK063) DEF_ICON(BLANK064) DEF_ICON(BLANK065) DEF_ICON(BLANK066) @@ -257,9 +257,7 @@ DEF_ICON(STRANDS) DEF_ICON(LIBRARY_DATA_INDIRECT) DEF_ICON(GREASEPENCIL) DEF_ICON(LINE_DATA) -#ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK084) -#endif +DEF_ICON(LIBRARY_DATA_OVERRIDE) DEF_ICON(GROUP_BONE) DEF_ICON(GROUP_VERTEX) DEF_ICON(GROUP_VCOL) @@ -315,9 +313,9 @@ DEF_ICON(OUTLINER_OB_SURFACE) DEF_ICON(OUTLINER_OB_SPEAKER) DEF_ICON(OUTLINER_OB_FORCE_FIELD) DEF_ICON(OUTLINER_OB_GROUP_INSTANCE) +DEF_ICON(OUTLINER_OB_GREASEPENCIL) +DEF_ICON(OUTLINER_OB_LIGHTPROBE) #ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK122) - DEF_ICON(BLANK123) DEF_ICON(BLANK124) DEF_ICON(BLANK125) #endif @@ -346,8 +344,8 @@ DEF_ICON(OUTLINER_DATA_FONT) DEF_ICON(OUTLINER_DATA_SURFACE) DEF_ICON(OUTLINER_DATA_SPEAKER) DEF_ICON(OUTLINER_DATA_POSE) +DEF_ICON(OUTLINER_DATA_GREASEPENCIL) #ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK130) DEF_ICON(BLANK131) DEF_ICON(BLANK132) DEF_ICON(BLANK133) @@ -414,10 +412,10 @@ DEF_ICON(CURVE_BEZCIRCLE) DEF_ICON(CURVE_NCURVE) DEF_ICON(CURVE_NCIRCLE) DEF_ICON(CURVE_PATH) +DEF_ICON(LIGHTPROBE_CUBEMAP) +DEF_ICON(LIGHTPROBE_PLANAR) +DEF_ICON(LIGHTPROBE_GRID) #ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK644) - DEF_ICON(BLANK645) - DEF_ICON(BLANK646) DEF_ICON(BLANK647) DEF_ICON(BLANK648) #endif @@ -715,8 +713,8 @@ DEF_ICON(CLIPUV_DEHLT) DEF_ICON(CLIPUV_HLT) DEF_ICON(SNAP_PEEL_OBJECT) DEF_ICON(GRID) +DEF_ICON(OBJECT_ORIGIN) #ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK221) DEF_ICON(BLANK222) DEF_ICON(BLANK224) DEF_ICON(BLANK225) @@ -1033,4 +1031,3 @@ DEF_VICO(COLORSET_17_VEC) DEF_VICO(COLORSET_18_VEC) DEF_VICO(COLORSET_19_VEC) DEF_VICO(COLORSET_20_VEC) - diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 9c88d225421..e2432d914b2 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -42,6 +42,7 @@ struct ID; struct IDProperty; struct ListBase; struct ARegion; +struct ARegionType; struct ScrArea; struct bScreen; struct wmEvent; @@ -64,7 +65,6 @@ struct Image; struct ImageUser; struct wmKeyConfig; struct wmOperatorType; -struct uiWidgetColors; struct MTex; struct ImBuf; struct bNodeTree; @@ -73,6 +73,9 @@ struct bNodeSocket; struct wmDropBox; struct wmDrag; struct wmEvent; +struct wmManipulator; +struct wmMsgBus; +struct wmKeyMap; typedef struct uiBut uiBut; typedef struct uiBlock uiBlock; @@ -99,6 +102,8 @@ enum { UI_EMBOSS_NONE = 1, /* Nothing, only icon and/or text */ UI_EMBOSS_PULLDOWN = 2, /* Pulldown menu style */ UI_EMBOSS_RADIAL = 3, /* Pie Menu */ + + UI_EMBOSS_UNDEFINED = 255, /* For layout engine, use emboss from block. */ }; /* uiBlock->direction */ @@ -107,7 +112,8 @@ enum { UI_DIR_DOWN = (1 << 1), UI_DIR_LEFT = (1 << 2), UI_DIR_RIGHT = (1 << 3), - UI_DIR_CENTER_Y = (1 << 4), + UI_DIR_CENTER_X = (1 << 4), + UI_DIR_CENTER_Y = (1 << 5), UI_DIR_ALL = (UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT), }; @@ -139,6 +145,10 @@ enum { #define UI_BLOCK_POPUP_HOLD (1 << 18) #define UI_BLOCK_LIST_ITEM (1 << 19) #define UI_BLOCK_RADIAL (1 << 20) +#define UI_BLOCK_POPOVER (1 << 21) +#define UI_BLOCK_POPOVER_ONCE (1 << 22) +/** Always show keymaps, even for non-menus. */ +#define UI_BLOCK_SHOW_SHORTCUT_ALWAYS (1 << 23) /* uiPopupBlockHandle->menuretval */ #define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */ @@ -178,11 +188,13 @@ enum { UI_BUT_COLOR_CUBIC = (1 << 23), /* cubic saturation for the color wheel */ UI_BUT_LIST_ITEM = (1 << 24), /* This but is "inside" a list item (currently used to change theme colors). */ UI_BUT_DRAG_MULTI = (1 << 25), /* edit this button as well as the active button (not just dragging) */ - UI_BUT_SCA_LINK_GREY = (1 << 26), /* used to flag if sca links shoud be gray out */ + UI_BUT_HAS_SEP_CHAR = (1 << 27), /* but->str contains UI_SEP_CHAR, used for key shortcuts */ UI_BUT_UPDATE_DELAY = (1 << 28), /* don't run updates while dragging (needed in rare cases). */ UI_BUT_TEXTEDIT_UPDATE = (1 << 29), /* when widget is in textedit mode, update value on each char stroke */ UI_BUT_VALUE_CLEAR = (1 << 30), /* show 'x' icon to clear/unlink value of text or search button */ + + UI_BUT_OVERRIDEN = (1 << 31), /* RNA property of the button is overriden from linked reference data. */ }; #define UI_PANEL_WIDTH 340 @@ -218,11 +230,14 @@ enum { UI_BUT_ALIGN_ALL = (UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT), UI_BUT_BOX_ITEM = (1 << 20), /* This but is "inside" a box item (currently used to change theme colors). */ + + UI_BUT_ACTIVE_LEFT = (1 << 21), /* Active left part of number button */ + UI_BUT_ACTIVE_RIGHT = (1 << 22), /* Active right part of number button */ }; /* scale fixed button widths by this to account for DPI */ -#define UI_DPI_FAC ((U.pixelsize * (float)U.dpi) / 72.0f) +#define UI_DPI_FAC (U.dpi_fac) /* 16 to copy ICON_DEFAULT_HEIGHT */ #define UI_DPI_ICON_SIZE ((float)16 * UI_DPI_FAC) @@ -261,11 +276,11 @@ typedef enum { UI_BTYPE_CHECKBOX = (13 << 9), /* similar to toggle, display a 'tick' */ UI_BTYPE_CHECKBOX_N = (14 << 9), UI_BTYPE_COLOR = (15 << 9), + UI_BTYPE_TAB = (16 << 9), + UI_BTYPE_POPOVER = (17 << 9), UI_BTYPE_SCROLL = (18 << 9), UI_BTYPE_BLOCK = (19 << 9), UI_BTYPE_LABEL = (20 << 9), - UI_BTYPE_LINK = (22 << 9), - UI_BTYPE_INLINK = (23 << 9), UI_BTYPE_KEY_EVENT = (24 << 9), UI_BTYPE_HSVCUBE = (26 << 9), UI_BTYPE_PULLDOWN = (27 << 9), /* menu (often used in headers), **_MENU /w different draw-type */ @@ -313,18 +328,25 @@ typedef enum { * Functions to draw various shapes, taking theme settings into account. * Used for code that draws its own UI style elements. */ -void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad); +void UI_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3, const float color[4]); +void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float color[4]); + void UI_draw_roundbox_corner_set(int type); +void UI_draw_roundbox_aa(bool filled, float minx, float miny, float maxx, float maxy, float rad, const float color[4]); +void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[4]); +void UI_draw_roundbox_3ubAlpha(bool filled, float minx, float miny, float maxx, float maxy, float rad, const unsigned char col[3], unsigned char alpha); +void UI_draw_roundbox_3fvAlpha(bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[3], float alpha); +void UI_draw_roundbox_shade_x(bool filled, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown, const float col[4]); + +#if 0 /* unused */ int UI_draw_roundbox_corner_get(void); -void UI_draw_roundbox_unfilled(float minx, float miny, float maxx, float maxy, float rad); +void UI_draw_roundbox_shade_y(bool filled, float minx, float miny, float maxx, float maxy, float rad, float shadeleft, float shaderight, const float col[4]); +#endif + void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy); -void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, float maxy, float rad); -void UI_draw_roundbox_shade_x(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown); -void UI_draw_roundbox_shade_y(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight); -void UI_draw_text_underline(int pos_x, int pos_y, int len, int height); +void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4]); -void UI_draw_safe_areas( - float x1, float x2, float y1, float y2, +void UI_draw_safe_areas(uint pos, float x1, float x2, float y1, float y2, const float title_aspect[2], const float action_aspect[2]); /* state for scrolldrawing */ @@ -403,6 +425,19 @@ int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportLi void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable); void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but); +/* interface_region_popover.c */ + +typedef struct uiPopover uiPopover; + +int UI_popover_panel_invoke( + struct bContext *C, int space_id, int region_id, const char *idname, + bool keep_open, struct ReportList *reports); + +uiPopover *UI_popover_begin(struct bContext *C) ATTR_NONNULL(1); +void UI_popover_end(struct bContext *C, struct uiPopover *head, struct wmKeyMap *keymap); +struct uiLayout *UI_popover_layout(uiPopover *head); +void UI_popover_once_clear(uiPopover *pup); + /* interface_region_menu_pie.c */ /* Pie menus */ typedef struct uiPieMenu uiPieMenu; @@ -452,6 +487,8 @@ uiBlock *UI_block_begin(const struct bContext *C, struct ARegion *region, const void UI_block_end_ex(const struct bContext *C, uiBlock *block, const int xy[2], int r_xy[2]); void UI_block_end(const struct bContext *C, uiBlock *block); void UI_block_draw(const struct bContext *C, struct uiBlock *block); +void UI_blocklist_update_window_matrix(const struct bContext *C, const struct ListBase *lb); +void UI_blocklist_draw(const struct bContext *C, const struct ListBase *lb); void UI_block_update_from_old(const struct bContext *C, struct uiBlock *block); uiBlock *UI_block_find_in_region(const char *name, struct ARegion *ar); @@ -496,6 +533,7 @@ void UI_block_direction_set(uiBlock *block, char direction); void UI_block_order_flip(uiBlock *block); void UI_block_flag_enable(uiBlock *block, int flag); void UI_block_flag_disable(uiBlock *block, int flag); +void UI_block_translate(uiBlock *block, int x, int y); int UI_but_return_value_get(uiBut *but); @@ -659,6 +697,7 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0 #define UI_ID_FAKE_USER (1 << 8) #define UI_ID_PIN (1 << 9) #define UI_ID_PREVIEWS (1 << 10) +#define UI_ID_OVERRIDE (1 << 11) #define UI_ID_FULL (UI_ID_RENAME | UI_ID_BROWSE | UI_ID_ADD_NEW | UI_ID_OPEN | UI_ID_ALONE | UI_ID_DELETE | UI_ID_LOCAL) /** @@ -692,18 +731,30 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, struct IDP void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip); -uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2); -int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align); - -/* Links - * - * Game engine logic brick links. Non-functional currently in 2.5, - * code to handle and draw these is disabled internally. */ -void UI_but_link_set(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to); +/* For uiDefAutoButsRNA */ +typedef enum { + /* Keep current layout for aligning label with property button. */ + UI_BUT_LABEL_ALIGN_NONE, + /* Align label and property button vertically. */ + UI_BUT_LABEL_ALIGN_COLUMN, + /* Split layout into a column for the label and one for property button. */ + UI_BUT_LABEL_ALIGN_SPLIT_COLUMN, +} eButLabelAlign; + +/* Return info for uiDefAutoButsRNA */ +typedef enum { + /* Returns when no buttons were added */ + UI_PROP_BUTS_NONE_ADDED = (1 << 0), + /* Returned when any property failed the custom check callback (check_prop) */ + UI_PROP_BUTS_ANY_FAILED_CHECK = (1 << 1), +} eAutoPropButsReturn; -void UI_block_links_compose(uiBlock *block); -uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin); +uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2); +eAutoPropButsReturn uiDefAutoButsRNA( + uiLayout *layout, struct PointerRNA *ptr, + bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), + eButLabelAlign label_align, const bool compact); /* use inside searchfunc to add items */ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid); @@ -790,6 +841,8 @@ struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *ar, void UI_panel_category_clear_all(struct ARegion *ar); void UI_panel_category_draw_all(struct ARegion *ar, const char *category_id_active); +struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname); + /* Handlers * * Handlers that can be registered in regions, areas and windows for @@ -809,7 +862,6 @@ void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers) void UI_init(void); void UI_init_userdef(void); void UI_reinit_font(void); -void UI_reinit_gl_state(void); void UI_exit(void); /* Layout @@ -840,6 +892,7 @@ void UI_exit(void); #define UI_LAYOUT_ALIGN_CENTER 2 #define UI_LAYOUT_ALIGN_RIGHT 3 +#define UI_ITEM_O_RETURN_PROPS (1 << 0) #define UI_ITEM_R_EXPAND (1 << 1) #define UI_ITEM_R_SLIDER (1 << 2) #define UI_ITEM_R_TOGGLE (1 << 3) @@ -849,10 +902,15 @@ void UI_exit(void); #define UI_ITEM_R_NO_BG (1 << 7) #define UI_ITEM_R_IMMEDIATE (1 << 8) #define UI_ITEM_O_DEPRESS (1 << 9) +#define UI_ITEM_R_COMPACT (1 << 10) -/* uiTemplateOperatorPropertyButs flags */ -#define UI_TEMPLATE_OP_PROPS_SHOW_TITLE 1 -#define UI_TEMPLATE_OP_PROPS_SHOW_EMPTY 2 + +/* uiLayoutOperatorButs flags */ +enum { + UI_TEMPLATE_OP_PROPS_SHOW_TITLE = (1 << 0), + UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = (1 << 1), + UI_TEMPLATE_OP_PROPS_COMPACT = (1 << 2), +}; /* used for transp checkers */ #define UI_ALPHA_CHECKER_DARK 100 @@ -874,13 +932,12 @@ enum { UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT) }; -/* not apart of the corner flags but mixed in some functions */ -#define UI_RB_ALPHA (UI_CNR_ALL + 1) - uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style); void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); void UI_block_layout_resolve(uiBlock *block, int *x, int *y); +void UI_region_message_subscribe(struct ARegion *ar, struct wmMsgBus *mbus); + uiBlock *uiLayoutGetBlock(uiLayout *layout); void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv); @@ -888,7 +945,9 @@ void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct Pointe void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context); const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing struct MenuType *UI_but_menutype_get(uiBut *but); +struct PanelType *UI_but_paneltype_get(uiBut *but); void UI_menutype_draw(struct bContext *C, struct MenuType *mt, struct uiLayout *layout); +void UI_paneltype_draw(struct bContext *C, struct PanelType *pt, struct uiLayout *layout); /* Only for convenience. */ void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but); @@ -901,6 +960,8 @@ void uiLayoutSetAlignment(uiLayout *layout, char alignment); void uiLayoutSetKeepAspect(uiLayout *layout, bool keepaspect); void uiLayoutSetScaleX(uiLayout *layout, float scale); void uiLayoutSetScaleY(uiLayout *layout, float scale); +void uiLayoutSetEmboss(uiLayout *layout, char emboss); +void uiLayoutSetPropSep(uiLayout *layout, bool is_sep); int uiLayoutGetOperatorContext(uiLayout *layout); bool uiLayoutGetActive(uiLayout *layout); @@ -911,6 +972,8 @@ bool uiLayoutGetKeepAspect(uiLayout *layout); int uiLayoutGetWidth(uiLayout *layout); float uiLayoutGetScaleX(uiLayout *layout); float uiLayoutGetScaleY(uiLayout *layout); +int uiLayoutGetEmboss(uiLayout *layout); +bool uiLayoutGetPropSep(uiLayout *layout); /* layout specifiers */ uiLayout *uiLayoutRow(uiLayout *layout, int align); @@ -938,11 +1001,30 @@ void uiTemplateIDBrowse( void uiTemplateIDPreview( uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols, int filter); +void uiTemplateIDTabs( + uiLayout *layout, struct bContext *C, + 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 uiTemplateSearch( + uiLayout *layout, struct bContext *C, + struct PointerRNA *ptr, const char *propname, + struct PointerRNA *searchptr, const char *searchpropname, + const char *newop, const char *unlinkop); +void uiTemplateSearchPreview( + uiLayout *layout, struct bContext *C, + struct PointerRNA *ptr, const char *propname, + 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); 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, int show_buttons, struct ID *parent, struct MTex *slot, const char *preview_id); @@ -957,8 +1039,6 @@ void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int color); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *used_ptr, const char *used_propname, int active_layer); -void uiTemplateGameStates(uiLayout *layout, struct PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_state); void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview); void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management); void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr); @@ -969,9 +1049,11 @@ void uiTemplateImageInfo(uiLayout *layout, struct bContext *C, struct Image *ima void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); void UI_but_func_operator_search(uiBut *but); void uiTemplateOperatorSearch(uiLayout *layout); -void uiTemplateOperatorPropertyButs(const struct bContext *C, uiLayout *layout, struct wmOperator *op, - bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), - const char label_align, const short flag); +eAutoPropButsReturn uiTemplateOperatorPropertyButs( + const struct bContext *C, uiLayout *layout, struct wmOperator *op, + bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), + const eButLabelAlign label_align, const short flag); +void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C); void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C); void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C); @@ -1046,6 +1128,19 @@ void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const c void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */ void uiItemS(uiLayout *layout); /* separator */ +void uiItemPopoverPanel_ptr( + uiLayout *layout, struct bContext *C, + struct PanelType *pt, + const char *name, int icon); +void uiItemPopoverPanel( + uiLayout *layout, struct bContext *C, + int space_id, int region_id, const char *panelname, + const char *name, int icon); +void uiItemPopoverPanelFromGroup( + uiLayout *layout, struct bContext *C, + int space_id, int region_id, + const char *context, const char *category); + void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg); void uiItemMenuEnumO_ptr(uiLayout *layout, struct bContext *C, struct wmOperatorType *ot, const char *propname, const char *name, int icon); void uiItemMenuEnumO(uiLayout *layout, struct bContext *C, const char *opname, const char *propname, const char *name, int icon); @@ -1087,20 +1182,22 @@ 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, - size_t len, float *r_xofs, float *r_yofs); -void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str); -void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str); -void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str); +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 unsigned char fg[4], const unsigned char bg[4]); + const float col_fg[4], const float col_bg[4]); int UI_fontstyle_string_width(const struct uiFontStyle *fs, const char *str); int UI_fontstyle_height_max(const struct uiFontStyle *fs); -void UI_draw_icon_tri(float x, float y, char dir); +void UI_draw_icon_tri(float x, float y, char dir, const float[4]); struct uiStyle *UI_style_get(void); /* use for fonts etc */ struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ @@ -1128,6 +1225,7 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); /* ui_interface_region_tooltip.c */ struct ARegion *UI_tooltip_create_from_button(struct bContext *C, struct ARegion *butregion, uiBut *but); +struct ARegion *UI_tooltip_create_from_manipulator(struct bContext *C, struct wmManipulator *mpr); void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar); /* How long before a tool-tip shows. */ @@ -1143,4 +1241,17 @@ void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar) int UI_calc_float_precision(int prec, double value); +/* widget batched drawing */ +void UI_widgetbase_draw_cache_begin(void); +void UI_widgetbase_draw_cache_flush(void); +void UI_widgetbase_draw_cache_end(void); + +/* Special drawing for toolbar, mainly workarounds for inflexible icon sizing. */ +#define USE_TOOLBAR_HACK + +/* Support click-drag motion which presses the button and closes a popover (like a menu). */ +#define USE_POPOVER_ONCE + +bool UI_but_is_tool(const uiBut *but); + #endif /* __UI_INTERFACE_H__ */ diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 308504ef4c4..ee43b987a49 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -49,6 +49,8 @@ typedef struct IconFile { #define ICON_DEFAULT_HEIGHT 16 #define ICON_DEFAULT_WIDTH 16 +#define ICON_DEFAULT_HEIGHT_TOOLBAR 38 + #define ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f)) #define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f)) @@ -66,6 +68,7 @@ void UI_id_icon_render( int UI_preview_render_size(enum eIconSizes size); void UI_icon_draw(float x, float y, int icon_id); +void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha); void UI_icon_draw_preview(float x, float y, int icon_id); void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect); void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, float alpha, int size); @@ -73,9 +76,13 @@ void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspec void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha); void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3]); void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha); +void UI_icon_draw_desaturate(float x, float y, int icon_id, float aspect, float alpha, float desaturate); void UI_icons_free(void); void UI_icons_free_drawinfo(void *drawinfo); +void UI_icon_draw_cache_begin(void); +void UI_icon_draw_cache_end(void); + struct ListBase *UI_iconfile_list(void); int UI_iconfile_get_index(const char *filename); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 7249cfda244..b89a57b02d1 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -51,7 +51,7 @@ typedef enum { /* use to denote intentionally unset theme color */ #define TH_UNDEFINED -1 -enum { +typedef enum ThemeColorID { TH_REDALERT, TH_THEMEUI, @@ -275,10 +275,18 @@ enum { TH_WIDGET_EMBOSS, + TH_EDITOR_OUTLINE, + TH_AXIS_X, /* X/Y/Z Axis */ TH_AXIS_Y, TH_AXIS_Z, + TH_MANIPULATOR_HI, + TH_MANIPULATOR_PRIMARY, + TH_MANIPULATOR_SECONDARY, + TH_MANIPULATOR_A, + TH_MANIPULATOR_B, + TH_LOW_GRAD, TH_HIGH_GRAD, TH_SHOW_BACK_GRAD, @@ -302,7 +310,7 @@ enum { TH_EDGE_BEVEL, TH_VERTEX_BEVEL -}; +} ThemeColorID; /* specific defines per space should have higher define values */ @@ -319,13 +327,13 @@ struct bThemeState { void UI_ThemeColor(int colorid); // sets the color plus alpha -void UI_ThemeColor4(int colorid); +void UI_ThemeColor4(int colorid); // sets color plus offset for shade -void UI_ThemeColorShade(int colorid, int offset); +void UI_ThemeColorShade(int colorid, int offset); // sets color plus offset for alpha -void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset); +void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset); // sets color, which is blend between two theme colors void UI_ThemeColorBlend(int colorid1, int colorid2, float fac); @@ -343,14 +351,27 @@ int UI_GetThemeValueType(int colorid, int spacetype); // get three color values, scaled to 0.0-1.0 range void UI_GetThemeColor3fv(int colorid, float col[3]); void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]); +void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]); // get the color, range 0.0-1.0, complete with shading offset void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]); void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]); +void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4]); + +// get three color values, range 0-255, complete with shading offset for the RGB components and blending +void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, unsigned char col[3]); // get four color values, scaled to 0.0-1.0 range void UI_GetThemeColor4fv(int colorid, float col[4]); // get four color values, range 0.0-1.0, complete with shading offset for the RGB components void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]); +void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]); + +// get four colour values ranged between 0 and 255; includes the alpha channel +void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]); + +// get four color values, range 0.0-1.0, complete with shading offset for the RGB components and blending +void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3]); +void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4]); // get the 3 or 4 byte values void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]); @@ -368,6 +389,10 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3] // get a 3 byte color, blended and shaded between two other char color pointers void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset); +// sets the font color +// (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color) +void UI_FontThemeColor(int fontid, int colorid); + // clear the openGL ClearColor using the input colorid void UI_ThemeClearColor(int colorid); diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index e7280398b33..e5d105f0d94 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -103,8 +103,13 @@ enum eView2D_Gridlines { /* ------ Defines for Scrollers ----- */ /* scroller area */ -#define V2D_SCROLL_HEIGHT (0.85f * U.widget_unit) -#define V2D_SCROLL_WIDTH (0.85f * U.widget_unit) +#define V2D_SCROLL_HEIGHT_MIN (0.25f * U.widget_unit) +#define V2D_SCROLL_WIDTH_MIN (0.25f * U.widget_unit) +#define V2D_SCROLL_HEIGHT (0.45f * U.widget_unit) +#define V2D_SCROLL_WIDTH (0.45f * U.widget_unit) +/* For scrollers with scale markings (text written onto them) */ +#define V2D_SCROLL_HEIGHT_TEXT (0.79f * U.widget_unit) +#define V2D_SCROLL_WIDTH_TEXT (0.79f * U.widget_unit) /* scroller 'handles' hotspot radius for mouse */ #define V2D_SCROLLER_HANDLE_SIZE (0.6f * U.widget_unit) @@ -219,7 +224,7 @@ void UI_view2d_center_set(struct View2D *v2d, float x, float y); void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac); -short UI_view2d_mouse_in_scrollers(const struct bContext *C, struct View2D *v2d, int x, int y); +short UI_view2d_mouse_in_scrollers(const struct ARegion *ar, struct View2D *v2d, int x, int y); /* cached text drawing in v2d, to allow pixel-aligned draw as post process */ void UI_view2d_text_cache_add(struct View2D *v2d, float x, float y, |