diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/editors/include | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/editors/include')
49 files changed, 5453 insertions, 3527 deletions
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h index 4a1cdce2ead..84820c3c564 100644 --- a/source/blender/editors/include/BIF_gl.h +++ b/source/blender/editors/include/BIF_gl.h @@ -30,12 +30,14 @@ /* hacking pointsize and linewidth */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -# define glPointSize(f) glPointSize(U.pixelsize * _Generic((f), double: (float)(f), default: (f))) -# define glLineWidth(f) glLineWidth(U.pixelsize * _Generic((f), double: (float)(f), default: (f))) +# define glPointSize(f) \ + glPointSize(U.pixelsize *_Generic((f), double : (float)(f), default : (f))) +# define glLineWidth(f) \ + glLineWidth(U.pixelsize *_Generic((f), double : (float)(f), default : (f))) #else -# define glPointSize(f) glPointSize(U.pixelsize * (f)) -# define glLineWidth(f) glLineWidth(U.pixelsize * (f)) -#endif /* C11 */ +# define glPointSize(f) glPointSize(U.pixelsize *(f)) +# define glLineWidth(f) glLineWidth(U.pixelsize *(f)) +#endif /* C11 */ #define GLA_PIXEL_OFS 0.375f diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 9cb308d5145..a2e8d6afd4b 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -62,10 +62,10 @@ int glaGetOneInt(int param); void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y); typedef struct IMMDrawPixelsTexState { - struct GPUShader *shader; - unsigned int pos; - unsigned int texco; - bool do_shader_unbind; + struct GPUShader *shader; + unsigned int pos; + unsigned int texco; + bool do_shader_unbind; } IMMDrawPixelsTexState; /* To be used before calling immDrawPixelsTex @@ -88,19 +88,65 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); * 1-to-1 mapping to screen space. */ 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]); + 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]); + 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]); + 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]); + 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); @@ -111,28 +157,46 @@ void bglPolygonOffset(float viewdist, float dist); /* **** 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, +void glaDrawImBuf_glsl(struct ImBuf *ibuf, + float x, + float y, + int zoomfilter, struct ColorManagedViewSettings *view_settings, struct ColorManagedDisplaySettings *display_settings, - float zoom_x, float zoom_y); -void glaDrawImBuf_glsl_clipping(struct ImBuf *ibuf, float x, float y, int zoomfilter, + 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 zoom_x, float zoom_y); - + float clip_min_x, + float clip_min_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, - float zoom_x, float zoom_y); +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, + float x, + float y, int zoomfilter, - float clip_min_x, float clip_min_y, - float clip_max_x, float clip_max_y, - float zoom_x, float zoom_y); + float clip_min_x, + float clip_min_y, + float clip_max_x, + float clip_max_y, + float zoom_x, + float zoom_y); void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index dc5ffb4794d..3a9539ee52c 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -62,61 +62,61 @@ struct PropertyRNA; * 'context' information */ typedef struct bAnimContext { - /** data to be filtered for use in animation editor */ - void *data; - /** type of data eAnimCont_Types */ - short datatype; - - /** editor->mode */ - short mode; - /** sa->spacetype */ - short spacetype; - /** active region -> type (channels or main) */ - short regiontype; - - /** editor host */ - struct ScrArea *sa; - /** editor data */ - struct SpaceLink *sl; - /** region within editor */ - struct ARegion *ar; - - /** dopesheet data for editor (or which is being used) */ - struct bDopeSheet *ads; - - /** active dependency graph */ - struct Depsgraph *depsgraph; - /** Current Main */ - struct Main *bmain; - /** active scene */ - struct Scene *scene; - /** active scene layer */ - struct ViewLayer *view_layer; - /** active object */ - struct Object *obact; - /** active set of markers */ - ListBase *markers; - - /** pointer to current reports list */ - struct ReportList *reports; - - /** Scale factor for height of channels (i.e. based on the size of keyframes). */ - float yscale_fac; + /** data to be filtered for use in animation editor */ + void *data; + /** type of data eAnimCont_Types */ + short datatype; + + /** editor->mode */ + short mode; + /** sa->spacetype */ + short spacetype; + /** active region -> type (channels or main) */ + short regiontype; + + /** editor host */ + struct ScrArea *sa; + /** editor data */ + struct SpaceLink *sl; + /** region within editor */ + struct ARegion *ar; + + /** dopesheet data for editor (or which is being used) */ + struct bDopeSheet *ads; + + /** active dependency graph */ + struct Depsgraph *depsgraph; + /** Current Main */ + struct Main *bmain; + /** active scene */ + struct Scene *scene; + /** active scene layer */ + struct ViewLayer *view_layer; + /** active object */ + struct Object *obact; + /** active set of markers */ + ListBase *markers; + + /** pointer to current reports list */ + struct ReportList *reports; + + /** Scale factor for height of channels (i.e. based on the size of keyframes). */ + float yscale_fac; } bAnimContext; /* Main Data container types */ typedef enum eAnimCont_Types { - ANIMCONT_NONE = 0, /* invalid or no data */ - ANIMCONT_ACTION = 1, /* action (bAction) */ - ANIMCONT_SHAPEKEY = 2, /* shapekey (Key) */ - ANIMCONT_GPENCIL = 3, /* grease pencil (screen) */ - ANIMCONT_DOPESHEET = 4, /* dopesheet (bDopesheet) */ - ANIMCONT_FCURVES = 5, /* animation F-Curves (bDopesheet) */ - ANIMCONT_DRIVERS = 6, /* drivers (bDopesheet) */ - ANIMCONT_NLA = 7, /* nla (bDopesheet) */ - ANIMCONT_CHANNEL = 8, /* animation channel (bAnimListElem) */ - ANIMCONT_MASK = 9, /* mask dopesheet */ - ANIMCONT_TIMELINE = 10, /* "timeline" editor (bDopeSheet) */ + ANIMCONT_NONE = 0, /* invalid or no data */ + ANIMCONT_ACTION = 1, /* action (bAction) */ + ANIMCONT_SHAPEKEY = 2, /* shapekey (Key) */ + ANIMCONT_GPENCIL = 3, /* grease pencil (screen) */ + ANIMCONT_DOPESHEET = 4, /* dopesheet (bDopesheet) */ + ANIMCONT_FCURVES = 5, /* animation F-Curves (bDopesheet) */ + ANIMCONT_DRIVERS = 6, /* drivers (bDopesheet) */ + ANIMCONT_NLA = 7, /* nla (bDopesheet) */ + ANIMCONT_CHANNEL = 8, /* animation channel (bAnimListElem) */ + ANIMCONT_MASK = 9, /* mask dopesheet */ + ANIMCONT_TIMELINE = 10, /* "timeline" editor (bDopeSheet) */ } eAnimCont_Types; /* --------------- Channels -------------------- */ @@ -125,64 +125,62 @@ typedef enum eAnimCont_Types { * channels of animation data */ typedef struct bAnimListElem { - struct bAnimListElem *next, *prev; - - /** source data this elem represents */ - void *data; - /** (eAnim_ChannelType) one of the ANIMTYPE_* values */ - int type; - /** copy of elem's flags for quick access */ - int flag; - /** for un-named data, the index of the data in its collection */ - int index; - - /** (eAnim_Update_Flags) tag the element for updating */ - char update; - /** tag the included data. Temporary always */ - char tag; - - /** (eAnim_KeyType) type of motion data to expect */ - short datatype; - /** motion data - mostly F-Curves, but can be other types too */ - void *key_data; - - - /** - * \note - * id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree) - * from which evaluation of the RNA-paths takes place. It's used to figure out how deep - * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property - * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used - * bAction or something similar, none of this would be possible: although it's trivial - * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from - * (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited), - * it's impossible to go the other way (i.e. one action may be used in multiple places). - */ - /** ID block that channel is attached to */ - struct ID *id; - /** source of the animation data attached to ID block (for convenience) */ - struct AnimData *adt; - - /** - * For list element which corresponds to a f-curve, this is an ID which - * owns the f-curve. - * - * For example, if the f-curve is coming from Action, this id will be set to - * action's ID. But if this is a f-curve which is a driver, then the owner - * is set to, for example, object. - * - * Note, that this is different from id above. The id above will be set to - * an object if the f-curve is coming from action associated with that - * object. */ - struct ID *fcurve_owner_id; - - /** - * for per-element F-Curves - * (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */ - void *owner; + struct bAnimListElem *next, *prev; + + /** source data this elem represents */ + void *data; + /** (eAnim_ChannelType) one of the ANIMTYPE_* values */ + int type; + /** copy of elem's flags for quick access */ + int flag; + /** for un-named data, the index of the data in its collection */ + int index; + + /** (eAnim_Update_Flags) tag the element for updating */ + char update; + /** tag the included data. Temporary always */ + char tag; + + /** (eAnim_KeyType) type of motion data to expect */ + short datatype; + /** motion data - mostly F-Curves, but can be other types too */ + void *key_data; + + /** + * \note + * id here is the "IdAdtTemplate"-style datablock (e.g. Object, Material, Texture, NodeTree) + * from which evaluation of the RNA-paths takes place. It's used to figure out how deep + * channels should be nested (e.g. for Textures/NodeTrees) in the tree, and allows property + * lookups (e.g. for sliders and for inserting keyframes) to work. If we had instead used + * bAction or something similar, none of this would be possible: although it's trivial + * to use an IdAdtTemplate type to find the source action a channel (e.g. F-Curve) comes from + * (i.e. in the AnimEditors, it *must* be the active action, as only that can be edited), + * it's impossible to go the other way (i.e. one action may be used in multiple places). + */ + /** ID block that channel is attached to */ + struct ID *id; + /** source of the animation data attached to ID block (for convenience) */ + struct AnimData *adt; + + /** + * For list element which corresponds to a f-curve, this is an ID which + * owns the f-curve. + * + * For example, if the f-curve is coming from Action, this id will be set to + * action's ID. But if this is a f-curve which is a driver, then the owner + * is set to, for example, object. + * + * Note, that this is different from id above. The id above will be set to + * an object if the f-curve is coming from action associated with that + * object. */ + struct ID *fcurve_owner_id; + + /** + * for per-element F-Curves + * (e.g. NLA Control Curves), the element that this represents (e.g. NlaStrip) */ + void *owner; } bAnimListElem; - /** * Some types for easier type-testing * @@ -190,72 +188,72 @@ typedef struct bAnimListElem { * which is used for drawing and handling channel lists for. */ typedef enum eAnim_ChannelType { - ANIMTYPE_NONE = 0, - ANIMTYPE_ANIMDATA, - ANIMTYPE_SPECIALDATA, - - ANIMTYPE_SUMMARY, - - ANIMTYPE_SCENE, - ANIMTYPE_OBJECT, - ANIMTYPE_GROUP, - ANIMTYPE_FCURVE, - - ANIMTYPE_NLACONTROLS, - ANIMTYPE_NLACURVE, - - ANIMTYPE_FILLACTD, - ANIMTYPE_FILLDRIVERS, - - ANIMTYPE_DSMAT, - ANIMTYPE_DSLAM, - ANIMTYPE_DSCAM, - ANIMTYPE_DSCACHEFILE, - ANIMTYPE_DSCUR, - ANIMTYPE_DSSKEY, - ANIMTYPE_DSWOR, - ANIMTYPE_DSNTREE, - ANIMTYPE_DSPART, - ANIMTYPE_DSMBALL, - ANIMTYPE_DSARM, - ANIMTYPE_DSMESH, - ANIMTYPE_DSTEX, - ANIMTYPE_DSLAT, - ANIMTYPE_DSLINESTYLE, - ANIMTYPE_DSSPK, - ANIMTYPE_DSGPENCIL, - ANIMTYPE_DSMCLIP, - - ANIMTYPE_SHAPEKEY, - - ANIMTYPE_GPDATABLOCK, - ANIMTYPE_GPLAYER, - - ANIMTYPE_MASKDATABLOCK, - ANIMTYPE_MASKLAYER, - - ANIMTYPE_NLATRACK, - ANIMTYPE_NLAACTION, - - ANIMTYPE_PALETTE, - - /* always as last item, the total number of channel types... */ - ANIMTYPE_NUM_TYPES, + ANIMTYPE_NONE = 0, + ANIMTYPE_ANIMDATA, + ANIMTYPE_SPECIALDATA, + + ANIMTYPE_SUMMARY, + + ANIMTYPE_SCENE, + ANIMTYPE_OBJECT, + ANIMTYPE_GROUP, + ANIMTYPE_FCURVE, + + ANIMTYPE_NLACONTROLS, + ANIMTYPE_NLACURVE, + + ANIMTYPE_FILLACTD, + ANIMTYPE_FILLDRIVERS, + + ANIMTYPE_DSMAT, + ANIMTYPE_DSLAM, + ANIMTYPE_DSCAM, + ANIMTYPE_DSCACHEFILE, + ANIMTYPE_DSCUR, + ANIMTYPE_DSSKEY, + ANIMTYPE_DSWOR, + ANIMTYPE_DSNTREE, + ANIMTYPE_DSPART, + ANIMTYPE_DSMBALL, + ANIMTYPE_DSARM, + ANIMTYPE_DSMESH, + ANIMTYPE_DSTEX, + ANIMTYPE_DSLAT, + ANIMTYPE_DSLINESTYLE, + ANIMTYPE_DSSPK, + ANIMTYPE_DSGPENCIL, + ANIMTYPE_DSMCLIP, + + ANIMTYPE_SHAPEKEY, + + ANIMTYPE_GPDATABLOCK, + ANIMTYPE_GPLAYER, + + ANIMTYPE_MASKDATABLOCK, + ANIMTYPE_MASKLAYER, + + ANIMTYPE_NLATRACK, + ANIMTYPE_NLAACTION, + + ANIMTYPE_PALETTE, + + /* always as last item, the total number of channel types... */ + ANIMTYPE_NUM_TYPES, } eAnim_ChannelType; /* types of keyframe data in bAnimListElem */ typedef enum eAnim_KeyType { - ALE_NONE = 0, /* no keyframe data */ - ALE_FCURVE, /* F-Curve */ - ALE_GPFRAME, /* Grease Pencil Frames */ - ALE_MASKLAY, /* Mask */ - ALE_NLASTRIP, /* NLA Strips */ - - ALE_ALL, /* All channels summary */ - ALE_SCE, /* Scene summary */ - ALE_OB, /* Object summary */ - ALE_ACT, /* Action summary */ - ALE_GROUP, /* Action Group summary */ + ALE_NONE = 0, /* no keyframe data */ + ALE_FCURVE, /* F-Curve */ + ALE_GPFRAME, /* Grease Pencil Frames */ + ALE_MASKLAY, /* Mask */ + ALE_NLASTRIP, /* NLA Strips */ + + ALE_ALL, /* All channels summary */ + ALE_SCE, /* Scene summary */ + ALE_OB, /* Object summary */ + ALE_ACT, /* Action summary */ + ALE_GROUP, /* Action Group summary */ } eAnim_KeyType; /* Flags for specifying the types of updates (i.e. recalculation/refreshing) that @@ -263,9 +261,9 @@ typedef enum eAnim_KeyType { * For use with ANIM_animdata_update() */ typedef enum eAnim_Update_Flags { - ANIM_UPDATE_DEPS = (1 << 0), /* referenced data and dependencies get refreshed */ - ANIM_UPDATE_ORDER = (1 << 1), /* keyframes need to be sorted */ - ANIM_UPDATE_HANDLES = (1 << 2), /* recalculate handles */ + ANIM_UPDATE_DEPS = (1 << 0), /* referenced data and dependencies get refreshed */ + ANIM_UPDATE_ORDER = (1 << 1), /* keyframes need to be sorted */ + ANIM_UPDATE_HANDLES = (1 << 2), /* recalculate handles */ } eAnim_Update_Flags; /* used for most tools which change keyframes (flushed by ANIM_animdata_update) */ @@ -276,47 +274,47 @@ typedef enum eAnim_Update_Flags { /* filtering flags - under what circumstances should a channel be returned */ typedef enum eAnimFilter_Flags { - /** data which channel represents is fits the dopesheet filters - * (i.e. scene visibility criteria) */ - // XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit? - ANIMFILTER_DATA_VISIBLE = (1 << 0), - /** channel is visible within the channel-list hierarchy - * (i.e. F-Curves within Groups in ActEdit) */ - ANIMFILTER_LIST_VISIBLE = (1 << 1), - /** channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */ - ANIMFILTER_CURVE_VISIBLE = (1 << 2), - - /** include summary channels and "expanders" (for drawing/mouse-selection in channel list) */ - ANIMFILTER_LIST_CHANNELS = (1 << 3), - - /** for its type, channel should be "active" one */ - ANIMFILTER_ACTIVE = (1 << 4), - /** channel is a child of the active group (* Actions speciality) */ - ANIMFILTER_ACTGROUPED = (1 << 5), - - /** channel must be selected/not-selected, but both must not be set together */ - ANIMFILTER_SEL = (1 << 6), - ANIMFILTER_UNSEL = (1 << 7), - - /** editability status - must be editable to be included */ - ANIMFILTER_FOREDIT = (1 << 8), - /** only selected animchannels should be considerable as editable - mainly - * for Graph Editor's option for keys on select curves only */ - ANIMFILTER_SELEDIT = (1 << 9), - - /** flags used to enforce certain data types - * \node the ones for curves and NLA tracks were redundant and have been removed for now... - */ - ANIMFILTER_ANIMDATA = (1 << 10), - - /** duplicate entries for animation data attached to multi-user blocks must not occur */ - ANIMFILTER_NODUPLIS = (1 << 11), - - /** for checking if we should keep some collapsed channel around (internal use only!) */ - ANIMFILTER_TMP_PEEK = (1 << 30), - - /** ignore ONLYSEL flag from filterflag, (internal use only!) */ - ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31), + /** data which channel represents is fits the dopesheet filters + * (i.e. scene visibility criteria) */ + // XXX: it's hard to think of any examples where this *ISN'T* the case... perhaps becomes implicit? + ANIMFILTER_DATA_VISIBLE = (1 << 0), + /** channel is visible within the channel-list hierarchy + * (i.e. F-Curves within Groups in ActEdit) */ + ANIMFILTER_LIST_VISIBLE = (1 << 1), + /** channel has specifically been tagged as visible in Graph Editor (* Graph Editor Only) */ + ANIMFILTER_CURVE_VISIBLE = (1 << 2), + + /** include summary channels and "expanders" (for drawing/mouse-selection in channel list) */ + ANIMFILTER_LIST_CHANNELS = (1 << 3), + + /** for its type, channel should be "active" one */ + ANIMFILTER_ACTIVE = (1 << 4), + /** channel is a child of the active group (* Actions speciality) */ + ANIMFILTER_ACTGROUPED = (1 << 5), + + /** channel must be selected/not-selected, but both must not be set together */ + ANIMFILTER_SEL = (1 << 6), + ANIMFILTER_UNSEL = (1 << 7), + + /** editability status - must be editable to be included */ + ANIMFILTER_FOREDIT = (1 << 8), + /** only selected animchannels should be considerable as editable - mainly + * for Graph Editor's option for keys on select curves only */ + ANIMFILTER_SELEDIT = (1 << 9), + + /** flags used to enforce certain data types + * \node the ones for curves and NLA tracks were redundant and have been removed for now... + */ + ANIMFILTER_ANIMDATA = (1 << 10), + + /** duplicate entries for animation data attached to multi-user blocks must not occur */ + ANIMFILTER_NODUPLIS = (1 << 11), + + /** for checking if we should keep some collapsed channel around (internal use only!) */ + ANIMFILTER_TMP_PEEK = (1 << 30), + + /** ignore ONLYSEL flag from filterflag, (internal use only!) */ + ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31), } eAnimFilter_Flags; /* ---------- Flag Checking Macros ------------ */ @@ -330,24 +328,28 @@ typedef enum eAnimFilter_Flags { #define FILTER_WOR_SCED(wo) (CHECK_TYPE_INLINE(wo, World *), (wo->flag & WO_DS_EXPAND)) #define FILTER_LS_SCED(linestyle) ((linestyle->flag & LS_DS_EXPAND)) /* 'Object' channels */ -#define SEL_OBJC(base) (CHECK_TYPE_INLINE(base, Base *), ((base->flag & SELECT))) -#define EXPANDED_OBJC(ob) (CHECK_TYPE_INLINE(ob, Object *), ((ob->nlaflag & OB_ADS_COLLAPSED) == 0)) +#define SEL_OBJC(base) (CHECK_TYPE_INLINE(base, Base *), ((base->flag & SELECT))) +#define EXPANDED_OBJC(ob) \ + (CHECK_TYPE_INLINE(ob, Object *), ((ob->nlaflag & OB_ADS_COLLAPSED) == 0)) /* 'Sub-object' channels (flags stored in Data block) */ -#define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND))) -#define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND))) -#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND))) -#define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND))) -#define FILTER_CACHEFILE_OBJD(cf) (CHECK_TYPE_INLINE(cf, CacheFile *), ((cf->flag & CACHEFILE_DS_EXPAND))) -#define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND))) -#define FILTER_PART_OBJD(part) (CHECK_TYPE_INLINE(part, ParticleSettings *), ((part->flag & PART_DS_EXPAND))) -#define FILTER_MBALL_OBJD(mb) (CHECK_TYPE_INLINE(mb, MetaBall *), ((mb->flag2 & MB_DS_EXPAND))) -#define FILTER_ARM_OBJD(arm) (CHECK_TYPE_INLINE(arm, bArmature *), ((arm->flag & ARM_DS_EXPAND))) -#define FILTER_MESH_OBJD(me) (CHECK_TYPE_INLINE(me, Mesh *), ((me->flag & ME_DS_EXPAND))) +#define FILTER_SKE_OBJD(key) (CHECK_TYPE_INLINE(key, Key *), ((key->flag & KEY_DS_EXPAND))) +#define FILTER_MAT_OBJD(ma) (CHECK_TYPE_INLINE(ma, Material *), ((ma->flag & MA_DS_EXPAND))) +#define FILTER_LAM_OBJD(la) (CHECK_TYPE_INLINE(la, Light *), ((la->flag & LA_DS_EXPAND))) +#define FILTER_CAM_OBJD(ca) (CHECK_TYPE_INLINE(ca, Camera *), ((ca->flag & CAM_DS_EXPAND))) +#define FILTER_CACHEFILE_OBJD(cf) \ + (CHECK_TYPE_INLINE(cf, CacheFile *), ((cf->flag & CACHEFILE_DS_EXPAND))) +#define FILTER_CUR_OBJD(cu) (CHECK_TYPE_INLINE(cu, Curve *), ((cu->flag & CU_DS_EXPAND))) +#define FILTER_PART_OBJD(part) \ + (CHECK_TYPE_INLINE(part, ParticleSettings *), ((part->flag & PART_DS_EXPAND))) +#define FILTER_MBALL_OBJD(mb) (CHECK_TYPE_INLINE(mb, MetaBall *), ((mb->flag2 & MB_DS_EXPAND))) +#define FILTER_ARM_OBJD(arm) (CHECK_TYPE_INLINE(arm, bArmature *), ((arm->flag & ARM_DS_EXPAND))) +#define FILTER_MESH_OBJD(me) (CHECK_TYPE_INLINE(me, Mesh *), ((me->flag & ME_DS_EXPAND))) #define FILTER_LATTICE_OBJD(lt) (CHECK_TYPE_INLINE(lt, Lattice *), ((lt->flag & LT_DS_EXPAND))) -#define FILTER_SPK_OBJD(spk) (CHECK_TYPE_INLINE(spk, Speaker *), ((spk->flag & SPK_DS_EXPAND))) +#define FILTER_SPK_OBJD(spk) (CHECK_TYPE_INLINE(spk, Speaker *), ((spk->flag & SPK_DS_EXPAND))) /* Variable use expanders */ -#define FILTER_NTREE_DATA(ntree) (CHECK_TYPE_INLINE(ntree, bNodeTree *), ((ntree->flag & NTREE_DS_EXPAND))) -#define FILTER_TEX_DATA(tex) (CHECK_TYPE_INLINE(tex, Tex *), ((tex->flag & TEX_DS_EXPAND))) +#define FILTER_NTREE_DATA(ntree) \ + (CHECK_TYPE_INLINE(ntree, bNodeTree *), ((ntree->flag & NTREE_DS_EXPAND))) +#define FILTER_TEX_DATA(tex) (CHECK_TYPE_INLINE(tex, Tex *), ((tex->flag & TEX_DS_EXPAND))) /* 'Sub-object/Action' channels (flags stored in Action) */ #define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED)) @@ -355,13 +357,12 @@ typedef enum eAnimFilter_Flags { /* 'Sub-AnimData' channels */ #define EXPANDED_DRVD(adt) ((adt->flag & ADT_DRIVERS_COLLAPSED) == 0) - /* Actions (also used for Dopesheet) */ /* Action Channel Group */ #define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED) == 0) #define EXPANDED_AGRP(ac, agrp) \ - ( ((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED)) || \ - (( (ac) && ((ac)->spacetype == SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED_G)) ) + (((!(ac) || ((ac)->spacetype != SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED)) || \ + (((ac) && ((ac)->spacetype == SPACE_GRAPH)) && (agrp->flag & AGRP_EXPANDED_G))) #define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE)) /* F-Curve Channels */ #define EDITABLE_FCU(fcu) ((fcu->flag & FCURVE_PROTECTED) == 0) @@ -385,7 +386,6 @@ typedef enum eAnimFilter_Flags { #define EDITABLE_MASK(masklay) ((masklay->flag & MASK_LAYERFLAG_LOCKED) == 0) #define SEL_MASKLAY(masklay) (masklay->flag & SELECT) - /* NLA only */ #define SEL_NLT(nlt) (nlt->flag & NLATRACK_SELECTED) #define EDITABLE_NLT(nlt) ((nlt->flag & NLATRACK_PROTECTED) == 0) @@ -402,40 +402,45 @@ typedef enum eAnimFilter_Flags { /* -------------- Channel Defines -------------- */ /* channel heights */ -#define ACHANNEL_FIRST(ac) (-0.8f * (ac)->yscale_fac * U.widget_unit) -#define ACHANNEL_HEIGHT(ac) (0.8f * (ac)->yscale_fac * U.widget_unit) -#define ACHANNEL_HEIGHT_HALF(ac) (0.4f * (ac)->yscale_fac * U.widget_unit) -#define ACHANNEL_SKIP (0.1f * U.widget_unit) -#define ACHANNEL_STEP(ac) (ACHANNEL_HEIGHT(ac) + ACHANNEL_SKIP) +#define ACHANNEL_FIRST(ac) (-0.8f * (ac)->yscale_fac * U.widget_unit) +#define ACHANNEL_HEIGHT(ac) (0.8f * (ac)->yscale_fac * U.widget_unit) +#define ACHANNEL_HEIGHT_HALF(ac) (0.4f * (ac)->yscale_fac * U.widget_unit) +#define ACHANNEL_SKIP (0.1f * U.widget_unit) +#define ACHANNEL_STEP(ac) (ACHANNEL_HEIGHT(ac) + ACHANNEL_SKIP) /* channel widths */ -#define ACHANNEL_NAMEWIDTH (10 * U.widget_unit) +#define ACHANNEL_NAMEWIDTH (10 * U.widget_unit) /* channel toggle-buttons */ -#define ACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit) - +#define ACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit) /* -------------- NLA Channel Defines -------------- */ /* NLA channel heights */ -#define NLACHANNEL_FIRST (-0.8f * U.widget_unit) -#define NLACHANNEL_HEIGHT(snla) ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : (1.2f * U.widget_unit)) -#define NLACHANNEL_HEIGHT_HALF(snla) ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.4f * U.widget_unit) : (0.6f * U.widget_unit)) -#define NLACHANNEL_SKIP (0.1f * U.widget_unit) -#define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP) +#define NLACHANNEL_FIRST (-0.8f * U.widget_unit) +#define NLACHANNEL_HEIGHT(snla) \ + ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : (1.2f * U.widget_unit)) +#define NLACHANNEL_HEIGHT_HALF(snla) \ + ((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.4f * U.widget_unit) : (0.6f * U.widget_unit)) +#define NLACHANNEL_SKIP (0.1f * U.widget_unit) +#define NLACHANNEL_STEP(snla) (NLACHANNEL_HEIGHT(snla) + NLACHANNEL_SKIP) /* channel widths */ -#define NLACHANNEL_NAMEWIDTH (10 * U.widget_unit) +#define NLACHANNEL_NAMEWIDTH (10 * U.widget_unit) /* channel toggle-buttons */ -#define NLACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit) +#define NLACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit) /* ---------------- API -------------------- */ /* Obtain list of filtered Animation channels to operate on. * Returns the number of channels in the list */ -size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, void *data, eAnimCont_Types datatype); +size_t ANIM_animdata_filter(bAnimContext *ac, + ListBase *anim_data, + eAnimFilter_Flags filter_mode, + void *data, + eAnimCont_Types datatype); /* Obtain current anim-data context from Blender Context info. * Returns whether the operation was successful. @@ -461,80 +466,79 @@ void ANIM_animdata_freelist(ListBase *anim_data); /* role or level of animchannel in the hierarchy */ typedef enum eAnimChannel_Role { - /** datablock expander - a "composite" channel type */ - ACHANNEL_ROLE_EXPANDER = -1, - /** special purposes - not generally for hierarchy processing */ - ACHANNEL_ROLE_SPECIAL = 0, - /** data channel - a channel representing one of the actual building blocks of channels */ - ACHANNEL_ROLE_CHANNEL = 1, + /** datablock expander - a "composite" channel type */ + ACHANNEL_ROLE_EXPANDER = -1, + /** special purposes - not generally for hierarchy processing */ + ACHANNEL_ROLE_SPECIAL = 0, + /** data channel - a channel representing one of the actual building blocks of channels */ + ACHANNEL_ROLE_CHANNEL = 1, } eAnimChannel_Role; /* flag-setting behavior */ typedef enum eAnimChannels_SetFlag { - /** turn off */ - ACHANNEL_SETFLAG_CLEAR = 0, - /** turn on */ - ACHANNEL_SETFLAG_ADD = 1, - /** on->off, off->on */ - ACHANNEL_SETFLAG_INVERT = 2, - /** some on -> all off // all on */ - ACHANNEL_SETFLAG_TOGGLE = 3, + /** turn off */ + ACHANNEL_SETFLAG_CLEAR = 0, + /** turn on */ + ACHANNEL_SETFLAG_ADD = 1, + /** on->off, off->on */ + ACHANNEL_SETFLAG_INVERT = 2, + /** some on -> all off // all on */ + ACHANNEL_SETFLAG_TOGGLE = 3, } eAnimChannels_SetFlag; /* types of settings for AnimChannels */ typedef enum eAnimChannel_Settings { - ACHANNEL_SETTING_SELECT = 0, - /** warning: for drawing UI's, need to check if this is off (maybe inverse this later) */ - ACHANNEL_SETTING_PROTECT = 1, - ACHANNEL_SETTING_MUTE = 2, - ACHANNEL_SETTING_EXPAND = 3, - /** only for Graph Editor */ - ACHANNEL_SETTING_VISIBLE = 4, - /** only for NLA Tracks */ - ACHANNEL_SETTING_SOLO = 5, - /** only for NLA Actions */ - ACHANNEL_SETTING_PINNED = 6, - ACHANNEL_SETTING_MOD_OFF = 7, - /** channel is pinned and always visible */ - ACHANNEL_SETTING_ALWAYS_VISIBLE = 8, + ACHANNEL_SETTING_SELECT = 0, + /** warning: for drawing UI's, need to check if this is off (maybe inverse this later) */ + ACHANNEL_SETTING_PROTECT = 1, + ACHANNEL_SETTING_MUTE = 2, + ACHANNEL_SETTING_EXPAND = 3, + /** only for Graph Editor */ + ACHANNEL_SETTING_VISIBLE = 4, + /** only for NLA Tracks */ + ACHANNEL_SETTING_SOLO = 5, + /** only for NLA Actions */ + ACHANNEL_SETTING_PINNED = 6, + ACHANNEL_SETTING_MOD_OFF = 7, + /** channel is pinned and always visible */ + ACHANNEL_SETTING_ALWAYS_VISIBLE = 8, } eAnimChannel_Settings; - /* Drawing, mouse handling, and flag setting behavior... */ typedef struct bAnimChannelType { - /* -- Type data -- */ - /* name of the channel type, for debugging */ - const char *channel_type_name; - /* "level" or role in hierarchy - for finding the active channel */ - eAnimChannel_Role channel_role; - - /* -- Drawing -- */ - /* get RGB color that is used to draw the majority of the backdrop */ - void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3]); - /* draw backdrop strip for channel */ - void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc); - /* get depth of indention (relative to the depth channel is nested at) */ - short (*get_indent_level)(bAnimContext *ac, bAnimListElem *ale); - /* get offset in pixels for the start of the channel (in addition to the indent depth) */ - short (*get_offset)(bAnimContext *ac, bAnimListElem *ale); - - /* get name (for channel lists) */ - void (*name)(bAnimListElem *ale, char *name); - /* get RNA property+pointer for editing the name */ - bool (*name_prop)(bAnimListElem *ale, struct PointerRNA *ptr, struct PropertyRNA **prop); - /* get icon (for channel lists) */ - int (*icon)(bAnimListElem *ale); - - /* -- Settings -- */ - /* check if the given setting is valid in the current context */ - bool (*has_setting)(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting); - /* get the flag used for this setting */ - int (*setting_flag)(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg); - /* get the pointer to int/short where data is stored, - * with type being sizeof(ptr_data) which should be fine for runtime use... - * - assume that setting has been checked to be valid for current context - */ - void *(*setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *type); + /* -- Type data -- */ + /* name of the channel type, for debugging */ + const char *channel_type_name; + /* "level" or role in hierarchy - for finding the active channel */ + eAnimChannel_Role channel_role; + + /* -- Drawing -- */ + /* get RGB color that is used to draw the majority of the backdrop */ + void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3]); + /* draw backdrop strip for channel */ + void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc); + /* get depth of indention (relative to the depth channel is nested at) */ + short (*get_indent_level)(bAnimContext *ac, bAnimListElem *ale); + /* get offset in pixels for the start of the channel (in addition to the indent depth) */ + short (*get_offset)(bAnimContext *ac, bAnimListElem *ale); + + /* get name (for channel lists) */ + void (*name)(bAnimListElem *ale, char *name); + /* get RNA property+pointer for editing the name */ + bool (*name_prop)(bAnimListElem *ale, struct PointerRNA *ptr, struct PropertyRNA **prop); + /* get icon (for channel lists) */ + int (*icon)(bAnimListElem *ale); + + /* -- Settings -- */ + /* check if the given setting is valid in the current context */ + bool (*has_setting)(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting); + /* get the flag used for this setting */ + int (*setting_flag)(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg); + /* get the pointer to int/short where data is stored, + * with type being sizeof(ptr_data) which should be fine for runtime use... + * - assume that setting has been checked to be valid for current context + */ + void *(*setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *type); } bAnimChannelType; /* ------------------------ Drawing API -------------------------- */ @@ -546,16 +550,15 @@ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale); void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level); /* Draw the given channel */ -void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index); +void ANIM_channel_draw( + bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index); /* Draw the widgets for the given channel */ -void ANIM_channel_draw_widgets( - const struct bContext *C, - bAnimContext *ac, - bAnimListElem *ale, - struct uiBlock *block, - rctf *rect, - size_t channel_index); - +void ANIM_channel_draw_widgets(const struct bContext *C, + bAnimContext *ac, + bAnimListElem *ale, + struct uiBlock *block, + rctf *rect, + size_t channel_index); /* ------------------------ Editing API -------------------------- */ @@ -564,14 +567,18 @@ void ANIM_channel_draw_widgets( * * - setting: eAnimChannel_Settings */ -short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting); +short ANIM_channel_setting_get(bAnimContext *ac, + bAnimListElem *ale, + eAnimChannel_Settings setting); /* Change value of some setting for a channel * - setting: eAnimChannel_Settings * - mode: eAnimChannels_SetFlag */ -void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode); - +void ANIM_channel_setting_set(bAnimContext *ac, + bAnimListElem *ale, + eAnimChannel_Settings setting, + eAnimChannels_SetFlag mode); /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen @@ -582,15 +589,23 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel * - setting: type of setting to set * - on: whether the visibility setting has been enabled or disabled */ -void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode); - +void ANIM_flush_setting_anim_channels(bAnimContext *ac, + ListBase *anim_data, + bAnimListElem *ale_setting, + eAnimChannel_Settings setting, + eAnimChannels_SetFlag mode); /* Deselect all animation channels */ -void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types datatype, bool test, eAnimChannels_SetFlag sel); +void ANIM_deselect_anim_channels( + bAnimContext *ac, void *data, eAnimCont_Types datatype, bool test, eAnimChannels_SetFlag sel); /* Set the 'active' channel of type channel_type, in the given action */ -void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type); - +void ANIM_set_active_channel(bAnimContext *ac, + void *data, + eAnimCont_Types datatype, + eAnimFilter_Flags filter, + void *channel_data, + eAnim_ChannelType channel_type); /* Delete the F-Curve from the given AnimData block (if possible), * as appropriate according to animation context */ @@ -604,12 +619,12 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, st /* flags for Current Frame Drawing */ enum eAnimEditDraw_CurrentFrame { - /* plain time indicator with no special indicators */ - DRAWCFRA_PLAIN = 0, - /* time indication in seconds or frames */ - DRAWCFRA_UNIT_SECONDS = (1 << 0), - /* draw indicator extra wide (for timeline) */ - DRAWCFRA_WIDE = (1 << 1), + /* plain time indicator with no special indicators */ + DRAWCFRA_PLAIN = 0, + /* time indication in seconds or frames */ + DRAWCFRA_UNIT_SECONDS = (1 << 0), + /* draw indicator extra wide (for timeline) */ + DRAWCFRA_WIDE = (1 << 1), }; /* main call to draw current-frame indicator in an Animation Editor */ @@ -623,7 +638,6 @@ void ANIM_draw_cfra_number(const struct bContext *C, struct View2D *v2d, short f /* 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 */ @@ -635,12 +649,13 @@ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d); /* ------------- UI Panel Drawing -------------- */ /* draw a given F-Modifier for some layout/UI-Block */ -void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *fcurve_owner_id, - ListBase *modifiers, struct FModifier *fcm); +void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, + struct ID *fcurve_owner_id, + ListBase *modifiers, + struct FModifier *fcm); /* ------------- Copy/Paste Buffer -------------- */ - /* free the copy/paste buffer */ void ANIM_fmodifiers_copybuf_free(void); @@ -682,7 +697,10 @@ void nla_action_get_color(struct AnimData *adt, struct bAction *act, float color struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale); /* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */ -void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, bool restore, bool only_keys); +void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, + struct FCurve *fcu, + bool restore, + bool only_keys); /* ..... */ @@ -695,28 +713,29 @@ void ED_nla_postop_refresh(bAnimContext *ac); /* flags for conversion mapping */ typedef enum eAnimUnitConv_Flags { - /* restore to original internal values */ - ANIM_UNITCONV_RESTORE = (1 << 0), - /* ignore handles (i.e. only touch main keyframes) */ - ANIM_UNITCONV_ONLYKEYS = (1 << 1), - /* only touch selected BezTriples */ - ANIM_UNITCONV_ONLYSEL = (1 << 2), - /* only touch selected vertices */ - ANIM_UNITCONV_SELVERTS = (1 << 3), - ANIM_UNITCONV_SKIPKNOTS = (1 << 4), - /* Scale FCurve i a way it fits to -1..1 space */ - ANIM_UNITCONV_NORMALIZE = (1 << 5), - /* Only when normalization is used: use scale factor from previous run, - * prevents curves from jumping all over the place when tweaking them. - */ - ANIM_UNITCONV_NORMALIZE_FREEZE = (1 << 6), + /* restore to original internal values */ + ANIM_UNITCONV_RESTORE = (1 << 0), + /* ignore handles (i.e. only touch main keyframes) */ + ANIM_UNITCONV_ONLYKEYS = (1 << 1), + /* only touch selected BezTriples */ + ANIM_UNITCONV_ONLYSEL = (1 << 2), + /* only touch selected vertices */ + ANIM_UNITCONV_SELVERTS = (1 << 3), + ANIM_UNITCONV_SKIPKNOTS = (1 << 4), + /* Scale FCurve i a way it fits to -1..1 space */ + ANIM_UNITCONV_NORMALIZE = (1 << 5), + /* Only when normalization is used: use scale factor from previous run, + * prevents curves from jumping all over the place when tweaking them. + */ + ANIM_UNITCONV_NORMALIZE_FREEZE = (1 << 6), } eAnimUnitConv_Flags; /* Normalization flags from Space Graph passing to ANIM_unit_mapping_get_factor */ short ANIM_get_normalization_flags(bAnimContext *ac); /* Get unit conversion factor for given ID + F-Curve */ -float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag, float *r_offset); +float ANIM_unit_mapping_get_factor( + struct Scene *scene, struct ID *id, struct FCurve *fcu, short flag, float *r_offset); /* ------------- Utility macros ----------------------- */ @@ -731,11 +750,15 @@ float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FC * - sflag - bitflag to set */ #define ACHANNEL_SET_FLAG(channel, smode, sflag) \ - { \ - if (smode == ACHANNEL_SETFLAG_INVERT) (channel)->flag ^= (sflag); \ - else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag |= (sflag); \ - else (channel)->flag &= ~(sflag); \ - } ((void)0) + { \ + if (smode == ACHANNEL_SETFLAG_INVERT) \ + (channel)->flag ^= (sflag); \ + else if (smode == ACHANNEL_SETFLAG_ADD) \ + (channel)->flag |= (sflag); \ + else \ + (channel)->flag &= ~(sflag); \ + } \ + ((void)0) /* set/clear/toggle macro, where the flag is negative * - channel - channel with a 'flag' member that we're setting @@ -743,12 +766,15 @@ float ANIM_unit_mapping_get_factor(struct Scene *scene, struct ID *id, struct FC * - sflag - bitflag to set */ #define ACHANNEL_SET_FLAG_NEG(channel, smode, sflag) \ - { \ - if (smode == ACHANNEL_SETFLAG_INVERT) (channel)->flag ^= (sflag); \ - else if (smode == ACHANNEL_SETFLAG_ADD) (channel)->flag &= ~(sflag); \ - else (channel)->flag |= (sflag); \ - } ((void)0) - + { \ + if (smode == ACHANNEL_SETFLAG_INVERT) \ + (channel)->flag ^= (sflag); \ + else if (smode == ACHANNEL_SETFLAG_ADD) \ + (channel)->flag &= ~(sflag); \ + else \ + (channel)->flag |= (sflag); \ + } \ + ((void)0) /* --------- anim_deps.c, animation updates -------- */ @@ -782,10 +808,12 @@ void ED_operatormacros_action(void); /* Action Editor - Action Management */ struct AnimData *ED_actedit_animdata_from_context(struct bContext *C); -void ED_animedit_unlink_action(struct bContext *C, struct ID *id, - struct AnimData *adt, struct bAction *act, - struct ReportList *reports, bool force_delete); - +void ED_animedit_unlink_action(struct bContext *C, + struct ID *id, + struct AnimData *adt, + struct bAction *act, + struct ReportList *reports, + bool force_delete); /* Drivers Editor - Utility to set up UI correctly */ void ED_drivers_editor_init(struct bContext *C, struct ScrArea *sa); diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index d469c0ea8a0..9fb8f1b1b04 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -51,98 +51,97 @@ struct wmKeyConfig; struct wmOperator; typedef struct EditBone { - struct EditBone *next, *prev; - /** User-Defined Properties on this Bone */ - struct IDProperty *prop; - /** Editbones have a one-way link (i.e. children refer - * to parents. This is converted to a two-way link for - * normal bones when leaving editmode. */ - struct EditBone *parent; - /** (64 == MAXBONENAME) */ - char name[64]; - /** Roll along axis. We'll ultimately use the axis/angle method - * for determining the transformation matrix of the bone. The axis - * is tail-head while roll provides the angle. Refer to Graphics - * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/ - float roll; - - /** Orientation and length is implicit during editing */ - float head[3]; - float tail[3]; - /** All joints are considered to have zero rotation with respect to - * their parents. Therefore any rotations specified during the - * animation are automatically relative to the bones' rest positions*/ - int flag; - int layer; - - float dist, weight; - /** put them in order! transform uses this as scale */ - float xwidth, length, zwidth; - float rad_head, rad_tail; - - /* Bendy-Bone parameters */ - float roll1, roll2; - float curveOutX, curveOutY; - float curveInX, curveInY; - float ease1, ease2; - float scaleIn, scaleOut; - - /** for envelope scaling */ - float oldlength; - - short segments; - - /** Type of next/prev bone handles */ - char bbone_prev_type; - char bbone_next_type; - /** Next/prev bones to use as handle references when calculating bbones (optional) */ - struct EditBone *bbone_prev; - struct EditBone *bbone_next; - - /* Used for display */ - /** in Armature space, rest pos matrix */ - 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]; - - /** connected child temporary during drawing */ - struct EditBone *bbone_child; - - /* Used to store temporary data */ - union { - struct EditBone *ebone; - struct Bone *bone; - void *p; - int i; - } temp; + struct EditBone *next, *prev; + /** User-Defined Properties on this Bone */ + struct IDProperty *prop; + /** Editbones have a one-way link (i.e. children refer + * to parents. This is converted to a two-way link for + * normal bones when leaving editmode. */ + struct EditBone *parent; + /** (64 == MAXBONENAME) */ + char name[64]; + /** Roll along axis. We'll ultimately use the axis/angle method + * for determining the transformation matrix of the bone. The axis + * is tail-head while roll provides the angle. Refer to Graphics + * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/ + float roll; + + /** Orientation and length is implicit during editing */ + float head[3]; + float tail[3]; + /** All joints are considered to have zero rotation with respect to + * their parents. Therefore any rotations specified during the + * animation are automatically relative to the bones' rest positions*/ + int flag; + int layer; + + float dist, weight; + /** put them in order! transform uses this as scale */ + float xwidth, length, zwidth; + float rad_head, rad_tail; + + /* Bendy-Bone parameters */ + float roll1, roll2; + float curveOutX, curveOutY; + float curveInX, curveInY; + float ease1, ease2; + float scaleIn, scaleOut; + + /** for envelope scaling */ + float oldlength; + + short segments; + + /** Type of next/prev bone handles */ + char bbone_prev_type; + char bbone_next_type; + /** Next/prev bones to use as handle references when calculating bbones (optional) */ + struct EditBone *bbone_prev; + struct EditBone *bbone_next; + + /* Used for display */ + /** in Armature space, rest pos matrix */ + 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]; + + /** connected child temporary during drawing */ + struct EditBone *bbone_child; + + /* Used to store temporary data */ + union { + struct EditBone *ebone; + struct Bone *bone; + void *p; + int i; + } temp; } EditBone; -#define BONESEL_ROOT (1 << 28) -#define BONESEL_TIP (1 << 29) -#define BONESEL_BONE (1 << 30) -#define BONESEL_ANY (BONESEL_TIP | BONESEL_ROOT | BONESEL_BONE) +#define BONESEL_ROOT (1 << 28) +#define BONESEL_TIP (1 << 29) +#define BONESEL_BONE (1 << 30) +#define BONESEL_ANY (BONESEL_TIP | BONESEL_ROOT | BONESEL_BONE) -#define BONESEL_NOSEL (1u << 31u) +#define BONESEL_NOSEL (1u << 31u) /* useful macros */ -#define EBONE_VISIBLE(arm, ebone) ( \ - CHECK_TYPE_INLINE(arm, bArmature *), \ - CHECK_TYPE_INLINE(ebone, EditBone *), \ - (((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A)) \ - ) +#define EBONE_VISIBLE(arm, ebone) \ + (CHECK_TYPE_INLINE(arm, bArmature *), \ + CHECK_TYPE_INLINE(ebone, EditBone *), \ + (((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A))) -#define EBONE_SELECTABLE(arm, ebone) (EBONE_VISIBLE(arm, ebone) && !(ebone->flag & BONE_UNSELECTABLE)) +#define EBONE_SELECTABLE(arm, ebone) \ + (EBONE_VISIBLE(arm, ebone) && !(ebone->flag & BONE_UNSELECTABLE)) -#define EBONE_EDITABLE(ebone) ( \ - CHECK_TYPE_INLINE(ebone, EditBone *), \ - (((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED)) \ - ) +#define EBONE_EDITABLE(ebone) \ + (CHECK_TYPE_INLINE(ebone, EditBone *), \ + (((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED))) /* used in armature_select_hierarchy_exec() */ -#define BONE_SELECT_PARENT 0 -#define BONE_SELECT_CHILD 1 +#define BONE_SELECT_PARENT 0 +#define BONE_SELECT_CHILD 1 /* armature_ops.c */ void ED_operatortypes_armature(void); @@ -161,38 +160,54 @@ bool ED_armature_edit_deselect_all_multi_ex(struct Base **bases, uint bases_len) bool ED_armature_edit_deselect_all_visible_multi_ex(struct Base **bases, uint bases_len); bool ED_armature_edit_deselect_all_visible_multi(struct bContext *C); -bool ED_armature_pose_select_pick_with_buffer( - struct ViewLayer *view_layer, struct View3D *v3d, struct Base *base, const unsigned int *buffer, short hits, - bool extend, bool deselect, bool toggle, bool do_nearest); +bool ED_armature_pose_select_pick_with_buffer(struct ViewLayer *view_layer, + struct View3D *v3d, + 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); + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); -bool ED_armature_edit_select_op_from_tagged( - struct bArmature *arm, const int sel_op); +bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, const int sel_op); int join_armature_exec(struct bContext *C, struct wmOperator *op); -float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float new_up_axis[3], const bool axis_only); +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); +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); void ED_armature_ebone_remove_ex(struct bArmature *arm, EditBone *exBone, bool clear_connected); void ED_armature_ebone_remove(struct bArmature *arm, EditBone *exBone); bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child); -EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot); +EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], + const unsigned int ebone_child_tot); void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]); void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]); @@ -201,27 +216,44 @@ 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 Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around); +void ED_armature_origin_set( + struct Main *bmain, struct Object *ob, const 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 Main *bmain, struct Object *ob, float mat[4][4], const bool do_props); -void ED_armature_transform(struct Main *bmain, struct bArmature *arm, float mat[4][4], const bool do_props); - -#define ARM_GROUPS_NAME 1 +void ED_armature_transform_apply(struct Main *bmain, + struct Object *ob, + float mat[4][4], + const bool do_props); +void ED_armature_transform(struct Main *bmain, + struct bArmature *arm, + float mat[4][4], + const bool do_props); + +#define ARM_GROUPS_NAME 1 #define ARM_GROUPS_ENVELOPE 2 -#define ARM_GROUPS_AUTO 3 +#define ARM_GROUPS_AUTO 3 -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); +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); -void ED_armature_bone_rename(struct Main *bmain, struct bArmature *arm, const char *oldnamep, const char *newnamep); -void ED_armature_bones_flip_names(struct Main *bmain, struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers); +void ED_armature_bone_rename(struct Main *bmain, + struct bArmature *arm, + const char *oldnamep, + const char *newnamep); +void ED_armature_bones_flip_names(struct Main *bmain, + struct bArmature *arm, + struct ListBase *bones_names, + const bool do_strip_numbers); /* low level selection functions which handle */ -int ED_armature_ebone_selectflag_get(const EditBone *ebone); +int ED_armature_ebone_selectflag_get(const EditBone *ebone); void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag); void ED_armature_ebone_select_set(EditBone *ebone, bool select); void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag); @@ -240,19 +272,26 @@ 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 Main *bmain, struct Object *ob); bool ED_object_posemode_enter(struct bContext *C, struct Object *ob); -bool ED_pose_deselect_all_multi_ex(struct Base **bases, uint bases_len, int select_mode, const bool ignore_visibility); +bool ED_pose_deselect_all_multi_ex(struct Base **bases, + uint bases_len, + int select_mode, + const bool ignore_visibility); bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, const bool ignore_visibility); bool ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility); void ED_pose_bone_select_tag_update(struct Object *ob); void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select); -void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob, bool current_frame_only); +void ED_pose_recalculate_paths(struct bContext *C, + struct Scene *scene, + struct Object *ob, + bool current_frame_only); struct Object *ED_pose_object_from_context(struct bContext *C); /* meshlaplacian.c */ -void ED_mesh_deform_bind_callback( - struct MeshDeformModifierData *mmd, - struct Mesh *cagemesh, - float *vertexcos, int totvert, float cagemat[4][4]); +void ED_mesh_deform_bind_callback(struct MeshDeformModifierData *mmd, + struct Mesh *cagemesh, + float *vertexcos, + int totvert, + float cagemat[4][4]); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index a146bbeb0af..1d9e99eeaf9 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -54,9 +54,15 @@ void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc); struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc); -struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle); +struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, + float loc[2], + float *scale, + float *angle); -bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_clip_color_sample(struct SpaceClip *sc, + struct ARegion *ar, + int mval[2], + float r_col[3]); void ED_clip_update_frame(const struct Main *mainp, int cfra); bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool fit); @@ -64,15 +70,22 @@ bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool f void ED_clip_select_all(struct SpaceClip *sc, int action, bool *r_has_selection); void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]); -void ED_clip_point_stable_pos(struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr); -void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, struct ARegion *ar, const float co[2], float r_co[2]); +void ED_clip_point_stable_pos( + struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr); +void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, + struct ARegion *ar, + const float co[2], + float r_co[2]); void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, const int mval[2], float co[2]); bool ED_space_clip_check_show_trackedit(struct SpaceClip *sc); bool ED_space_clip_check_show_maskedit(struct SpaceClip *sc); struct MovieClip *ED_space_clip_get_clip(struct SpaceClip *sc); -void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip); +void ED_space_clip_set_clip(struct bContext *C, + struct bScreen *screen, + struct SpaceClip *sc, + struct MovieClip *clip); struct Mask *ED_space_clip_get_mask(struct SpaceClip *sc); void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask); diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 3e8821efbd0..d6d5ae299b7 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -40,27 +40,29 @@ struct wmKeyConfig; struct wmOperator; /* curve_ops.c */ -void ED_operatortypes_curve(void); -void ED_operatormacros_curve(void); -void ED_keymap_curve(struct wmKeyConfig *keyconf); +void ED_operatortypes_curve(void); +void ED_operatormacros_curve(void); +void ED_keymap_curve(struct wmKeyConfig *keyconf); /* editcurve.c */ struct ListBase *object_editcurve_get(struct Object *ob); -void ED_curve_editnurb_load(struct Main *bmain, struct Object *obedit); -void ED_curve_editnurb_make(struct Object *obedit); -void ED_curve_editnurb_free(struct Object *obedit); +void ED_curve_editnurb_load(struct Main *bmain, struct Object *obedit); +void ED_curve_editnurb_make(struct Object *obedit); +void ED_curve_editnurb_free(struct Object *obedit); -bool ED_curve_editnurb_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +bool ED_curve_editnurb_select_pick( + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); -struct Nurb *ED_curve_add_nurbs_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob); +struct Nurb *ED_curve_add_nurbs_primitive( + struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob); -bool ED_curve_nurb_select_check(struct View3D *v3d, struct Nurb *nu); -int ED_curve_nurb_select_count(struct View3D *v3d, struct Nurb *nu); -bool ED_curve_nurb_select_all(const struct Nurb *nu); -bool ED_curve_nurb_deselect_all(const struct Nurb *nu); +bool ED_curve_nurb_select_check(struct View3D *v3d, struct Nurb *nu); +int ED_curve_nurb_select_count(struct View3D *v3d, struct Nurb *nu); +bool ED_curve_nurb_select_all(const struct Nurb *nu); +bool ED_curve_nurb_deselect_all(const struct Nurb *nu); -int join_curve_exec(struct bContext *C, struct wmOperator *op); +int join_curve_exec(struct bContext *C, struct wmOperator *op); /* editcurve_select.c */ bool ED_curve_select_check(struct View3D *v3d, struct EditNurb *editnurb); @@ -75,25 +77,28 @@ int ED_curve_select_count(struct View3D *v3d, struct EditNurb *editnurb); void ED_curve_undosys_type(struct UndoType *ut); /* editfont.c */ -void ED_curve_editfont_load(struct Object *obedit); -void ED_curve_editfont_make(struct Object *obedit); -void ED_curve_editfont_free(struct Object *obedit); +void ED_curve_editfont_load(struct Object *obedit); +void ED_curve_editfont_make(struct Object *obedit); +void ED_curve_editfont_free(struct Object *obedit); -void ED_text_to_object(struct bContext *C, struct Text *text, const bool split_lines); +void ED_text_to_object(struct bContext *C, struct Text *text, const bool split_lines); -void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count); +void ED_curve_beztcpy(struct EditNurb *editnurb, + struct BezTriple *dst, + struct BezTriple *src, + int count); void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count); int ED_curve_updateAnimPaths(struct Main *bmain, struct Curve *cu); bool ED_curve_active_center(struct Curve *cu, float center[3]); -bool ED_curve_editfont_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +bool ED_curve_editfont_select_pick( + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); /* editfont_undo.c */ void ED_font_undosys_type(struct UndoType *ut); - #if 0 /* debug only */ void printknots(struct Object *obedit); diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 48c38396e98..7273f857a41 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -37,38 +37,38 @@ struct wmWindowManager; #define MAX_FILE_COLUMN 4 typedef enum FileListColumns { - COLUMN_NAME = 0, - COLUMN_DATE, - COLUMN_TIME, - COLUMN_SIZE, + COLUMN_NAME = 0, + COLUMN_DATE, + COLUMN_TIME, + COLUMN_SIZE, } FileListColumns; typedef struct FileLayout { - /* view settings - XXX - move into own struct */ - int prv_w; - int prv_h; - int tile_w; - int tile_h; - int tile_border_x; - int tile_border_y; - int prv_border_x; - int prv_border_y; - int rows; - int columns; - int width; - int height; - int flag; - int dirty; - int textheight; - float column_widths[MAX_FILE_COLUMN]; - - /* When we change display size, we may have to update static strings like size of files... */ - short curr_size; + /* view settings - XXX - move into own struct */ + int prv_w; + int prv_h; + int tile_w; + int tile_h; + int tile_border_x; + int tile_border_y; + int prv_border_x; + int prv_border_y; + int rows; + int columns; + int width; + int height; + int flag; + int dirty; + int textheight; + float column_widths[MAX_FILE_COLUMN]; + + /* When we change display size, we may have to update static strings like size of files... */ + short curr_size; } FileLayout; typedef struct FileSelection { - int first; - int last; + int first; + int last; } FileSelection; struct rcti; @@ -79,10 +79,8 @@ short ED_fileselect_set_params(struct SpaceFile *sfile); void ED_fileselect_reset_params(struct SpaceFile *sfile); - void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar); - FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar); int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *ar); @@ -108,29 +106,29 @@ void ED_file_change_dir(struct bContext *C); /* FSMenuEntry's without paths indicate separators */ typedef struct FSMenuEntry { - struct FSMenuEntry *next; + struct FSMenuEntry *next; - char *path; - char name[256]; /* FILE_MAXFILE */ - short save; - short valid; - short pad[2]; + 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, - FS_CATEGORY_BOOKMARKS, - FS_CATEGORY_RECENT, + FS_CATEGORY_SYSTEM, + FS_CATEGORY_SYSTEM_BOOKMARKS, + FS_CATEGORY_BOOKMARKS, + FS_CATEGORY_RECENT, } FSMenuCategory; typedef enum FSMenuInsert { - FS_INSERT_SORTED = (1 << 0), - FS_INSERT_SAVE = (1 << 1), - /** moves the item to the front of the list when its not already there */ - FS_INSERT_FIRST = (1 << 2), - /** just append to preseve delivered order */ - FS_INSERT_LAST = (1 << 3), + FS_INSERT_SORTED = (1 << 0), + FS_INSERT_SAVE = (1 << 1), + /** moves the item to the front of the list when its not already there */ + FS_INSERT_FIRST = (1 << 2), + /** just append to preseve delivered order */ + FS_INSERT_LAST = (1 << 3), } FSMenuInsert; struct FSMenu; @@ -138,7 +136,9 @@ struct FSMenuEntry; struct FSMenu *ED_fsmenu_get(void); struct FSMenuEntry *ED_fsmenu_get_category(struct FSMenu *fsmenu, FSMenuCategory category); -void ED_fsmenu_set_category(struct FSMenu *fsmenu, FSMenuCategory category, struct FSMenuEntry *fsm_head); +void ED_fsmenu_set_category(struct FSMenu *fsmenu, + FSMenuCategory category, + struct FSMenuEntry *fsm_head); int ED_fsmenu_get_nentries(struct FSMenu *fsmenu, FSMenuCategory category); diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index 48effda37ef..f14648bc026 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -22,7 +22,6 @@ * This is exposes pre-defined gizmos for re-use. */ - #ifndef __ED_GIZMO_LIBRARY_H__ #define __ED_GIZMO_LIBRARY_H__ @@ -49,7 +48,6 @@ struct bContext; struct wmGizmo; struct wmGizmoGroup; - /* -------------------------------------------------------------------- */ /* Shape Presets * @@ -57,39 +55,43 @@ struct wmGizmoGroup; */ /* gizmo_library_presets.c */ -void ED_gizmo_draw_preset_box( - const struct wmGizmo *gz, float mat[4][4], int select_id); -void ED_gizmo_draw_preset_arrow( - const struct wmGizmo *gz, float mat[4][4], int axis, int select_id); -void ED_gizmo_draw_preset_circle( - const struct wmGizmo *gz, float mat[4][4], int axis, int select_id); -void ED_gizmo_draw_preset_facemap( - const struct bContext *C, const struct wmGizmo *gz, - struct Object *ob, const int facemap, int select_id); - +void ED_gizmo_draw_preset_box(const struct wmGizmo *gz, float mat[4][4], int select_id); +void ED_gizmo_draw_preset_arrow(const struct wmGizmo *gz, + float mat[4][4], + int axis, + int select_id); +void ED_gizmo_draw_preset_circle(const struct wmGizmo *gz, + float mat[4][4], + int axis, + int select_id); +void ED_gizmo_draw_preset_facemap(const struct bContext *C, + const struct wmGizmo *gz, + struct Object *ob, + const int facemap, + int select_id); /* -------------------------------------------------------------------- */ /* 3D Arrow Gizmo */ enum { - ED_GIZMO_ARROW_STYLE_NORMAL = 0, - ED_GIZMO_ARROW_STYLE_CROSS = 1, - ED_GIZMO_ARROW_STYLE_BOX = 2, - ED_GIZMO_ARROW_STYLE_CONE = 3, + ED_GIZMO_ARROW_STYLE_NORMAL = 0, + ED_GIZMO_ARROW_STYLE_CROSS = 1, + ED_GIZMO_ARROW_STYLE_BOX = 2, + ED_GIZMO_ARROW_STYLE_CONE = 3, }; /* transform */ enum { - /* inverted offset during interaction - if set it also sets constrained below */ - ED_GIZMO_ARROW_XFORM_FLAG_INVERTED = (1 << 3), - /* clamp arrow interaction to property width */ - ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED = (1 << 4), + /* inverted offset during interaction - if set it also sets constrained below */ + ED_GIZMO_ARROW_XFORM_FLAG_INVERTED = (1 << 3), + /* clamp arrow interaction to property width */ + ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED = (1 << 4), }; /* draw_options */ enum { - /* Show arrow stem. */ - ED_GIZMO_ARROW_DRAW_FLAG_STEM = (1 << 0), + /* Show arrow stem. */ + ED_GIZMO_ARROW_DRAW_FLAG_STEM = (1 << 0), }; void ED_gizmo_arrow3d_set_ui_range(struct wmGizmo *gz, const float min, const float max); @@ -104,76 +106,76 @@ void ED_gizmo_arrow3d_set_range_fac(struct wmGizmo *gz, const float range_fac); /* Cage Gizmo */ enum { - ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE = (1 << 0), /* Translates */ - ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE = (1 << 1), /* Rotates */ - ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE = (1 << 2), /* Scales */ - ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM = (1 << 3), /* Scales uniformly */ - ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED = (1 << 4), /* Negative scale allowed */ + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE = (1 << 0), /* Translates */ + ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE = (1 << 1), /* Rotates */ + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE = (1 << 2), /* Scales */ + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM = (1 << 3), /* Scales uniformly */ + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED = (1 << 4), /* Negative scale allowed */ }; /* draw_style */ enum { - ED_GIZMO_CAGE2D_STYLE_BOX = 0, - ED_GIZMO_CAGE2D_STYLE_CIRCLE = 1, + ED_GIZMO_CAGE2D_STYLE_BOX = 0, + ED_GIZMO_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_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE = (1 << 0), + /** 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_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE = (1 << 0), }; /** #wmGizmo.highlight_part */ enum { - ED_GIZMO_CAGE2D_PART_TRANSLATE = 0, - ED_GIZMO_CAGE2D_PART_SCALE_MIN_X = 1, - ED_GIZMO_CAGE2D_PART_SCALE_MAX_X = 2, - ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y = 3, - ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y = 4, - /* Corners */ - ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y = 5, - ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y = 6, - ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y = 7, - ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y = 8, - - ED_GIZMO_CAGE2D_PART_ROTATE = 9, + ED_GIZMO_CAGE2D_PART_TRANSLATE = 0, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X = 1, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X = 2, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y = 3, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y = 4, + /* Corners */ + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y = 5, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y = 6, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y = 7, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y = 8, + + ED_GIZMO_CAGE2D_PART_ROTATE = 9, }; /** #wmGizmo.highlight_part */ enum { - /* ordered min/mid/max so we can loop over values (MIN/MID/MAX) on each axis. */ - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z = 0, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MAX_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MIN_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MID_Z, - ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, - - ED_GIZMO_CAGE3D_PART_TRANSLATE, - - ED_GIZMO_CAGE3D_PART_ROTATE, + /* ordered min/mid/max so we can loop over values (MIN/MID/MAX) on each axis. */ + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z = 0, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, + + ED_GIZMO_CAGE3D_PART_TRANSLATE, + + ED_GIZMO_CAGE3D_PART_ROTATE, }; /* -------------------------------------------------------------------- */ @@ -181,14 +183,14 @@ enum { /* draw_options */ enum { - ED_GIZMO_DIAL_DRAW_FLAG_NOP = 0, - ED_GIZMO_DIAL_DRAW_FLAG_CLIP = (1 << 0), - ED_GIZMO_DIAL_DRAW_FLAG_FILL = (1 << 1), - ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT = (1 << 2), - ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR = (1 << 3), - ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y = (1 << 4), - /* Always show the angle value as an arc in the dial. */ - ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE = (1 << 5), + ED_GIZMO_DIAL_DRAW_FLAG_NOP = 0, + ED_GIZMO_DIAL_DRAW_FLAG_CLIP = (1 << 0), + ED_GIZMO_DIAL_DRAW_FLAG_FILL = (1 << 1), + ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT = (1 << 2), + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR = (1 << 3), + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y = (1 << 4), + /* Always show the angle value as an arc in the dial. */ + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE = (1 << 5), }; /* -------------------------------------------------------------------- */ @@ -196,58 +198,55 @@ enum { /* draw_options */ enum { - ED_GIZMO_MOVE_DRAW_FLAG_NOP = 0, - /* only for solid shapes */ - ED_GIZMO_MOVE_DRAW_FLAG_FILL = (1 << 0), - ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT = (1 << 1), - ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW = (1 << 2), + ED_GIZMO_MOVE_DRAW_FLAG_NOP = 0, + /* only for solid shapes */ + ED_GIZMO_MOVE_DRAW_FLAG_FILL = (1 << 0), + ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT = (1 << 1), + ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW = (1 << 2), }; enum { - ED_GIZMO_MOVE_STYLE_RING_2D = 0, - ED_GIZMO_MOVE_STYLE_CROSS_2D = 1, + ED_GIZMO_MOVE_STYLE_RING_2D = 0, + ED_GIZMO_MOVE_STYLE_CROSS_2D = 1, }; /* -------------------------------------------------------------------- */ /* Button Gizmo */ enum { - ED_GIZMO_BUTTON_SHOW_OUTLINE = (1 << 0), - ED_GIZMO_BUTTON_SHOW_BACKDROP = (1 << 1), - /** - * Draw a line from the origin to the offset (similar to an arrow) - * sometimes needed to show what the button edits. - */ - ED_GIZMO_BUTTON_SHOW_HELPLINE = (1 << 2), + ED_GIZMO_BUTTON_SHOW_OUTLINE = (1 << 0), + ED_GIZMO_BUTTON_SHOW_BACKDROP = (1 << 1), + /** + * Draw a line from the origin to the offset (similar to an arrow) + * sometimes needed to show what the button edits. + */ + ED_GIZMO_BUTTON_SHOW_HELPLINE = (1 << 2), }; - /* -------------------------------------------------------------------- */ /* Primitive Gizmo */ enum { - ED_GIZMO_PRIMITIVE_STYLE_PLANE = 0, + ED_GIZMO_PRIMITIVE_STYLE_PLANE = 0, }; - /* -------------------------------------------------------------------- */ /* Gizmo Drawing Functions */ struct Dial3dParams { - int draw_options; - float angle_ofs; - float angle_delta; - float angle_increment; - float arc_partial_angle; - float arc_inner_factor; - float *clip_plane; + int draw_options; + float angle_ofs; + float angle_delta; + float angle_increment; + float arc_partial_angle; + float arc_inner_factor; + float *clip_plane; }; -void ED_gizmotypes_dial_3d_draw_util( - const float matrix_basis[4][4], - const float matrix_final[4][4], - const float line_width, - const float color[4], - const bool select, - struct Dial3dParams *params); - -#endif /* __ED_GIZMO_LIBRARY_H__ */ +void ED_gizmotypes_dial_3d_draw_util(const float matrix_basis[4][4], + const float matrix_final[4][4], + const float line_width, + const float color[4], + const bool select, + struct Dial3dParams *params); + +#endif /* __ED_GIZMO_LIBRARY_H__ */ diff --git a/source/blender/editors/include/ED_gizmo_utils.h b/source/blender/editors/include/ED_gizmo_utils.h index e81dcb34cd2..8c494bdf18c 100644 --- a/source/blender/editors/include/ED_gizmo_utils.h +++ b/source/blender/editors/include/ED_gizmo_utils.h @@ -27,16 +27,16 @@ struct bContext; struct wmGizmoGroupType; /** Wrapper function (operator name can't be guessed). */ -bool ED_gizmo_poll_or_unlink_delayed_from_operator( - const struct bContext *C, struct wmGizmoGroupType *gzgt, - const char *idname); +bool ED_gizmo_poll_or_unlink_delayed_from_operator(const struct bContext *C, + struct wmGizmoGroupType *gzgt, + const char *idname); -bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex( - const struct bContext *C, struct wmGizmoGroupType *gzgt, - const char *gzgt_idname); +bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const struct bContext *C, + struct wmGizmoGroupType *gzgt, + const char *gzgt_idname); /** Use this as poll function directly for: #wmGizmoGroupType.poll */ -bool ED_gizmo_poll_or_unlink_delayed_from_tool( - const struct bContext *C, struct wmGizmoGroupType *gzgt); +bool ED_gizmo_poll_or_unlink_delayed_from_tool(const struct bContext *C, + struct wmGizmoGroupType *gzgt); -#endif /* __ED_GIZMO_UTILS_H__ */ +#endif /* __ED_GIZMO_UTILS_H__ */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 1f86a8c7f46..ac998cbcb71 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -67,22 +67,22 @@ struct wmWindowManager; * Used as part of the 'stroke cache' used during drawing of new strokes */ typedef struct tGPspoint { - float x, y; /* x and y coordinates of cursor (in relative to area) */ - float pressure; /* pressure of tablet at this point */ - float strength; /* pressure of tablet at this point for alpha factor */ - float time; /* Time relative to stroke start (used when converting to path) */ - float uv_fac; /* factor of uv along the stroke */ - float uv_rot; /* uv rotation for dor mode */ - float rnd[3]; /* rnd value */ - bool rnd_dirty; /* rnd flag */ + float x, y; /* x and y coordinates of cursor (in relative to area) */ + float pressure; /* pressure of tablet at this point */ + float strength; /* pressure of tablet at this point for alpha factor */ + float time; /* Time relative to stroke start (used when converting to path) */ + float uv_fac; /* factor of uv along the stroke */ + float uv_rot; /* uv rotation for dor mode */ + float rnd[3]; /* rnd value */ + bool rnd_dirty; /* rnd flag */ } tGPspoint; /* used to sort by zdepth gpencil objects in viewport */ /* TODO: this could be a system parameter in userprefs screen */ #define GP_CACHE_BLOCK_SIZE 16 typedef struct tGPencilSort { - struct Base *base; - float zdepth; + struct Base *base; + float zdepth; } tGPencilSort; /* ----------- Grease Pencil Tools/Context ------------- */ @@ -90,26 +90,24 @@ typedef struct tGPencilSort { /* Context-dependent */ struct bGPdata **ED_gpencil_data_get_pointers(const struct bContext *C, struct PointerRNA *r_ptr); -struct bGPdata *ED_gpencil_data_get_active(const struct bContext *C); -struct bGPdata *ED_gpencil_data_get_active_evaluated(const struct bContext *C); +struct bGPdata *ED_gpencil_data_get_active(const struct bContext *C); +struct bGPdata *ED_gpencil_data_get_active_evaluated(const struct bContext *C); /* Context independent (i.e. each required part is passed in instead) */ -struct bGPdata **ED_gpencil_data_get_pointers_direct( - struct ID *screen_id, - struct ScrArea *sa, - struct Scene *scene, - struct Object *ob, - struct PointerRNA *r_ptr); -struct bGPdata *ED_gpencil_data_get_active_direct( - struct ID *screen_id, - struct ScrArea *sa, - struct Scene *scene, - struct Object *ob); +struct bGPdata **ED_gpencil_data_get_pointers_direct(struct ID *screen_id, + struct ScrArea *sa, + struct Scene *scene, + struct Object *ob, + struct PointerRNA *r_ptr); +struct bGPdata *ED_gpencil_data_get_active_direct(struct ID *screen_id, + struct ScrArea *sa, + struct Scene *scene, + struct Object *ob); bool ED_gpencil_data_owner_is_annotation(struct PointerRNA *owner_ptr); /* 3D View */ -struct bGPdata *ED_gpencil_data_get_active_v3d(struct ViewLayer *view_layer, struct View3D *v3d); +struct bGPdata *ED_gpencil_data_get_active_v3d(struct ViewLayer *view_layer, struct View3D *v3d); bool ED_gpencil_has_keyframe_v3d(struct Scene *scene, struct Object *ob, int cfra); @@ -117,7 +115,9 @@ bool ED_gpencil_has_keyframe_v3d(struct Scene *scene, struct Object *ob, int cfr bool ED_gpencil_stroke_can_use_direct(const struct ScrArea *sa, const struct bGPDstroke *gps); bool ED_gpencil_stroke_can_use(const struct bContext *C, const struct bGPDstroke *gps); -bool ED_gpencil_stroke_color_use(struct Object *ob, const struct bGPDlayer *gpl, const struct bGPDstroke *gps); +bool ED_gpencil_stroke_color_use(struct Object *ob, + const struct bGPDlayer *gpl, + const struct bGPDstroke *gps); /* ----------- Grease Pencil Operators ----------------- */ @@ -131,67 +131,78 @@ void ED_operatormacros_gpencil(void); /* Strokes copybuf */ void ED_gpencil_strokes_copybuf_free(void); - /* ------------ Grease-Pencil Drawing API ------------------ */ /* drawgpencil.c */ void ED_annotation_draw_2dimage(const struct bContext *C); void ED_annotation_draw_view2d(const struct bContext *C, bool onlyv2d); -void ED_annotation_draw_view3d( - struct Scene *scene, struct Depsgraph *depsgraph, - struct View3D *v3d, struct ARegion *ar, - bool only3d); -void ED_annotation_draw_ex( - struct Scene *scene, - struct bGPdata *gpd, int winx, int winy, - const int cfra, const char spacetype); +void ED_annotation_draw_view3d(struct Scene *scene, + struct Depsgraph *depsgraph, + struct View3D *v3d, + struct ARegion *ar, + bool only3d); +void ED_annotation_draw_ex(struct Scene *scene, + struct bGPdata *gpd, + int winx, + int winy, + const int cfra, + const char spacetype); /* ----------- Grease-Pencil AnimEdit API ------------------ */ -bool ED_gplayer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene, - short (*gpf_cb)(struct bGPDframe *, struct Scene *)); +bool ED_gplayer_frames_looper(struct bGPDlayer *gpl, + struct Scene *scene, + short (*gpf_cb)(struct bGPDframe *, struct Scene *)); void ED_gplayer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel); -bool ED_gplayer_frame_select_check(struct bGPDlayer *gpl); -void ED_gplayer_frame_select_set(struct bGPDlayer *gpl, short mode); -void ED_gplayer_frames_select_box(struct bGPDlayer *gpl, float min, float max, short select_mode); -void ED_gplayer_frames_select_region(struct KeyframeEditData *ked, struct bGPDlayer *gpl, short tool, short select_mode); -void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode); -void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode); +bool ED_gplayer_frame_select_check(struct bGPDlayer *gpl); +void ED_gplayer_frame_select_set(struct bGPDlayer *gpl, short mode); +void ED_gplayer_frames_select_box(struct bGPDlayer *gpl, float min, float max, short select_mode); +void ED_gplayer_frames_select_region(struct KeyframeEditData *ked, + struct bGPDlayer *gpl, + short tool, + short select_mode); +void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode); +void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode); -bool ED_gplayer_frames_delete(struct bGPDlayer *gpl); -void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl); +bool ED_gplayer_frames_delete(struct bGPDlayer *gpl); +void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl); void ED_gplayer_frames_keytype_set(struct bGPDlayer *gpl, short type); -void ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); -void ED_gplayer_mirror_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); +void ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); +void ED_gplayer_mirror_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); void ED_gpencil_anim_copybuf_free(void); bool ED_gpencil_anim_copybuf_copy(struct bAnimContext *ac); bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mode); - /* ------------ Grease-Pencil Undo System ------------------ */ int ED_gpencil_session_active(void); int ED_undo_gpencil_step(struct bContext *C, int step, const char *name); /* ------------ Grease-Pencil Armature weights ------------------ */ -bool ED_gpencil_add_armature_weights( - const struct bContext *C, struct ReportList *reports, - struct Object *ob, struct Object *ob_arm, int mode); +bool ED_gpencil_add_armature_weights(const struct bContext *C, + struct ReportList *reports, + struct Object *ob, + struct Object *ob_arm, + int mode); /* keep this aligned with gpencil_armature enum */ -#define GP_PAR_ARMATURE_NAME 0 -#define GP_PAR_ARMATURE_AUTO 1 +#define GP_PAR_ARMATURE_NAME 0 +#define GP_PAR_ARMATURE_AUTO 1 /* ------------ Transformation Utilities ------------ */ /* get difference matrix */ -void ED_gpencil_parent_location( - const struct Depsgraph *depsgraph, struct Object *obact, struct bGPdata *gpd, - struct bGPDlayer *gpl, float diff_mat[4][4]); +void ED_gpencil_parent_location(const struct Depsgraph *depsgraph, + struct Object *obact, + struct bGPdata *gpd, + struct bGPDlayer *gpl, + float diff_mat[4][4]); /* reset parent matrix for all layers */ -void ED_gpencil_reset_layers_parent(struct Depsgraph *depsgraph, struct Object *obact, struct bGPdata *gpd); +void ED_gpencil_reset_layers_parent(struct Depsgraph *depsgraph, + struct Object *obact, + struct bGPdata *gpd); /* cursor utilities */ void ED_gpencil_brush_draw_eraser(struct Brush *brush, int x, int y); @@ -202,25 +213,34 @@ void ED_gpencil_create_monkey(struct bContext *C, struct Object *ob, float mat[4 void ED_gpencil_create_stroke(struct bContext *C, struct Object *ob, float mat[4][4]); /* ------------ Object Utilities ------------ */ -struct Object *ED_gpencil_add_object( - struct bContext *C, struct Scene *scene, const float loc[3], unsigned short local_view_bits); +struct Object *ED_gpencil_add_object(struct bContext *C, + struct Scene *scene, + const float loc[3], + unsigned short local_view_bits); void ED_gpencil_add_defaults(struct bContext *C, struct Object *ob); /* set object modes */ void ED_gpencil_setup_modes(struct bContext *C, struct bGPdata *gpd, int newmode); -void ED_gp_project_stroke_to_plane( - const struct Scene *scene, - const struct Object *ob, const struct RegionView3D *rv3d, - struct bGPDstroke *gps, const float origin[3], const int axis); -void ED_gp_project_point_to_plane( - const struct Scene *scene, - const struct Object *ob, const struct RegionView3D *rv3d, - const float origin[3], const int axis, struct bGPDspoint *pt); -void ED_gp_get_drawing_reference( - const struct Scene *scene, const struct Object *ob, - struct bGPDlayer *gpl, char align_flag, float vec[3]); -void ED_gpencil_project_stroke_to_view( - struct bContext *C, struct bGPDlayer *gpl, struct bGPDstroke *gps); +void ED_gp_project_stroke_to_plane(const struct Scene *scene, + const struct Object *ob, + const struct RegionView3D *rv3d, + struct bGPDstroke *gps, + const float origin[3], + const int axis); +void ED_gp_project_point_to_plane(const struct Scene *scene, + const struct Object *ob, + const struct RegionView3D *rv3d, + const float origin[3], + const int axis, + struct bGPDspoint *pt); +void ED_gp_get_drawing_reference(const struct Scene *scene, + const struct Object *ob, + struct bGPDlayer *gpl, + char align_flag, + float vec[3]); +void ED_gpencil_project_stroke_to_view(struct bContext *C, + struct bGPDlayer *gpl, + struct bGPDstroke *gps); /* set sculpt cursor */ void ED_gpencil_toggle_brush_cursor(struct bContext *C, bool enable, void *customdata); @@ -235,7 +255,10 @@ void ED_gpencil_vgroup_deselect(struct bContext *C, struct Object *ob); int ED_gpencil_join_objects_exec(struct bContext *C, struct wmOperator *op); /* texture coordinate utilities */ -void ED_gpencil_tpoint_to_point(struct ARegion *ar, float origin[3], const struct tGPspoint *tpt, struct bGPDspoint *pt); +void ED_gpencil_tpoint_to_point(struct ARegion *ar, + float origin[3], + const struct tGPspoint *tpt, + struct bGPDspoint *pt); void ED_gpencil_calc_stroke_uv(struct Object *ob, struct bGPDstroke *gps); void ED_gpencil_update_color_uv(struct Main *bmain, struct Material *mat); @@ -246,11 +269,14 @@ void ED_gpencil_update_color_uv(struct Main *bmain, struct Material *mat); * 2 - Hit in point B * 3 - Hit in point A and B */ -int ED_gpencil_select_stroke_segment( - struct bGPDlayer *gpl, - struct bGPDstroke *gps, struct bGPDspoint *pt, - bool select, bool insert, const float scale, - float r_hita[3], float r_hitb[3]); +int ED_gpencil_select_stroke_segment(struct bGPDlayer *gpl, + struct bGPDstroke *gps, + struct bGPDspoint *pt, + bool select, + bool insert, + const float scale, + float r_hita[3], + float r_hitb[3]); void ED_gpencil_select_toggle_all(struct bContext *C, int action); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index bc5e21e4e08..ba5a6a8a339 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -37,12 +37,19 @@ struct wmWindowManager; /* 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 Object *obedit, struct Image *ima, bool automatic); -void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage *sima); -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); +void ED_space_image_set(struct Main *bmain, + struct SpaceImage *sima, + struct Object *obedit, + struct Image *ima, + bool automatic); +void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage *sima); +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); -bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_image_color_sample(struct SpaceImage *sima, + struct ARegion *ar, + int mval[2], + float r_col[3]); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock); void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock); bool ED_space_image_has_buffer(struct SpaceImage *sima); @@ -50,18 +57,35 @@ bool ED_space_image_has_buffer(struct SpaceImage *sima); void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height); void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]); void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy); -void ED_space_image_get_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy); +void ED_space_image_get_zoom(struct SpaceImage *sima, + struct ARegion *ar, + float *zoomx, + float *zoomy); void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy); -void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *sima, struct ImBuf *ibuf, bool use_view_settings); +void ED_space_image_scopes_update(const struct bContext *C, + struct SpaceImage *sima, + struct ImBuf *ibuf, + bool use_view_settings); -void ED_space_image_paint_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene); -void ED_space_image_uv_sculpt_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene); +void ED_space_image_paint_update(struct Main *bmain, + struct wmWindowManager *wm, + struct Scene *scene); +void ED_space_image_uv_sculpt_update(struct Main *bmain, + struct wmWindowManager *wm, + struct Scene *scene); void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy); -void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, const int mval[2], float co[2]); -void ED_image_point_pos(struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr); -void ED_image_point_pos__reverse(struct SpaceImage *sima, struct ARegion *ar, const float co[2], float r_co[2]); +void ED_image_mouse_pos(struct SpaceImage *sima, + struct ARegion *ar, + const int mval[2], + float co[2]); +void ED_image_point_pos( + struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr); +void ED_image_point_pos__reverse(struct SpaceImage *sima, + struct ARegion *ar, + const float co[2], + float r_co[2]); bool ED_image_slot_cycle(struct Image *image, int direction); bool ED_space_image_show_render(struct SpaceImage *sima); @@ -74,8 +98,18 @@ bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLaye bool ED_space_image_maskedit_poll(struct bContext *C); bool ED_space_image_maskedit_mask_poll(struct bContext *C); -void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y, - const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf); +void ED_image_draw_info(struct Scene *scene, + struct ARegion *ar, + bool color_manage, + bool use_default_view, + int channels, + int x, + int y, + const unsigned char cp[4], + const float fp[4], + const float linearcol[4], + int *zp, + float *zpf); bool ED_space_image_show_cache(struct SpaceImage *sima); diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h index 118295a80e0..8a84d3646f8 100644 --- a/source/blender/editors/include/ED_info.h +++ b/source/blender/editors/include/ED_info.h @@ -27,6 +27,8 @@ struct Main; /* info_stats.c */ void ED_info_stats_clear(struct ViewLayer *view_layer); -const char *ED_info_stats_string(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer); +const char *ED_info_stats_string(struct Main *bmain, + 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 5c97dc835d1..9fa8996c384 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -44,143 +44,218 @@ struct bGPDlayer; /* Information about the stretch of time from current to the next column */ typedef struct ActKeyBlockInfo { - /* Combination of flags from all curves. */ - short flag; - /* Mask of flags that differ between curves. */ - short conflict; + /* Combination of flags from all curves. */ + short flag; + /* Mask of flags that differ between curves. */ + short conflict; - /* Selection flag. */ - char sel; + /* Selection flag. */ + char sel; } ActKeyBlockInfo; /* Keyframe Column Struct */ typedef struct ActKeyColumn { - /* ListBase linkage */ - struct ActKeyColumn *next, *prev; - - /* sorting-tree linkage */ - /** 'children' of this node, less than and greater than it (respectively) */ - struct ActKeyColumn *left, *right; - /** parent of this node in the tree */ - struct ActKeyColumn *parent; - /** DLRB_BLACK or DLRB_RED */ - char tree_col; - - /* keyframe info */ - /** eBezTripe_KeyframeType */ - char key_type; - /** eKeyframeHandleDrawOpts */ - char handle_type; - /** eKeyframeExtremeDrawOpts */ - char extreme_type; - short sel; - float cfra; - - /* key-block info */ - ActKeyBlockInfo block; - - /* number of curves and keys in this column */ - short totcurve, totkey, totblock; + /* ListBase linkage */ + struct ActKeyColumn *next, *prev; + + /* sorting-tree linkage */ + /** 'children' of this node, less than and greater than it (respectively) */ + struct ActKeyColumn *left, *right; + /** parent of this node in the tree */ + struct ActKeyColumn *parent; + /** DLRB_BLACK or DLRB_RED */ + char tree_col; + + /* keyframe info */ + /** eBezTripe_KeyframeType */ + char key_type; + /** eKeyframeHandleDrawOpts */ + char handle_type; + /** eKeyframeExtremeDrawOpts */ + char extreme_type; + short sel; + float cfra; + + /* key-block info */ + ActKeyBlockInfo block; + + /* number of curves and keys in this column */ + short totcurve, totkey, totblock; } ActKeyColumn; /* ActKeyBlockInfo - Flag */ typedef enum eActKeyBlock_Hold { - /* Key block represents a moving hold */ - ACTKEYBLOCK_FLAG_MOVING_HOLD = (1 << 0), - /* Key block represents a static hold */ - ACTKEYBLOCK_FLAG_STATIC_HOLD = (1 << 1), - /* Key block represents any kind of hold */ - ACTKEYBLOCK_FLAG_ANY_HOLD = (1 << 2), - /* The curve segment uses non-bezier interpolation */ - ACTKEYBLOCK_FLAG_NON_BEZIER = (1 << 3), + /* Key block represents a moving hold */ + ACTKEYBLOCK_FLAG_MOVING_HOLD = (1 << 0), + /* Key block represents a static hold */ + ACTKEYBLOCK_FLAG_STATIC_HOLD = (1 << 1), + /* Key block represents any kind of hold */ + ACTKEYBLOCK_FLAG_ANY_HOLD = (1 << 2), + /* The curve segment uses non-bezier interpolation */ + ACTKEYBLOCK_FLAG_NON_BEZIER = (1 << 3), } eActKeyBlock_Flag; /* *********************** Keyframe Drawing ****************************** */ /* options for keyframe shape drawing */ typedef enum eKeyframeShapeDrawOpts { - /* only the border */ - KEYFRAME_SHAPE_FRAME = 0, - /* only the inside filling */ - KEYFRAME_SHAPE_INSIDE, - /* the whole thing */ - KEYFRAME_SHAPE_BOTH, + /* only the border */ + KEYFRAME_SHAPE_FRAME = 0, + /* only the inside filling */ + KEYFRAME_SHAPE_INSIDE, + /* the whole thing */ + KEYFRAME_SHAPE_BOTH, } eKeyframeShapeDrawOpts; /* Handle type. */ typedef enum eKeyframeHandleDrawOpts { - /* Don't draw */ - KEYFRAME_HANDLE_NONE = 0, - /* Various marks in order of increasing display priority. */ - KEYFRAME_HANDLE_AUTO_CLAMP, - KEYFRAME_HANDLE_AUTO, - KEYFRAME_HANDLE_VECTOR, - KEYFRAME_HANDLE_ALIGNED, - KEYFRAME_HANDLE_FREE, + /* Don't draw */ + KEYFRAME_HANDLE_NONE = 0, + /* Various marks in order of increasing display priority. */ + KEYFRAME_HANDLE_AUTO_CLAMP, + KEYFRAME_HANDLE_AUTO, + KEYFRAME_HANDLE_VECTOR, + KEYFRAME_HANDLE_ALIGNED, + KEYFRAME_HANDLE_FREE, } eKeyframeHandleDrawOpts; /* Extreme type. */ typedef enum eKeyframeExtremeDrawOpts { - KEYFRAME_EXTREME_NONE = 0, - /* Minimum/maximum present. */ - KEYFRAME_EXTREME_MIN = (1 << 0), - KEYFRAME_EXTREME_MAX = (1 << 1), - /* Grouped keys have different states. */ - KEYFRAME_EXTREME_MIXED = (1 << 2), - /* Both neigbors are equal to this key. */ - KEYFRAME_EXTREME_FLAT = (1 << 3), + KEYFRAME_EXTREME_NONE = 0, + /* Minimum/maximum present. */ + KEYFRAME_EXTREME_MIN = (1 << 0), + KEYFRAME_EXTREME_MAX = (1 << 1), + /* Grouped keys have different states. */ + KEYFRAME_EXTREME_MIXED = (1 << 2), + /* Both neigbors are equal to this key. */ + KEYFRAME_EXTREME_FLAT = (1 << 3), } eKeyframeExtremeDrawOpts; /* draw simple diamond-shape keyframe */ /* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, * immBegin(GPU_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, - unsigned int linemask_id, short ipo_type, short extreme_type); +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, + unsigned int linemask_id, + short ipo_type, + short extreme_type); /* ******************************* Methods ****************************** */ /* Channel Drawing ------------------ */ /* F-Curve */ -void draw_fcurve_channel(struct View2D *v2d, struct AnimData *adt, struct FCurve *fcu, float ypos, float yscale_fac, int saction_flag); +void draw_fcurve_channel(struct View2D *v2d, + struct AnimData *adt, + struct FCurve *fcu, + float ypos, + float yscale_fac, + int saction_flag); /* Action Group Summary */ -void draw_agroup_channel(struct View2D *v2d, struct AnimData *adt, struct bActionGroup *agrp, float ypos, float yscale_fac, int saction_flag); +void draw_agroup_channel(struct View2D *v2d, + struct AnimData *adt, + struct bActionGroup *agrp, + float ypos, + float yscale_fac, + int saction_flag); /* Action Summary */ -void draw_action_channel(struct View2D *v2d, struct AnimData *adt, struct bAction *act, float ypos, float yscale_fac, int saction_flag); +void draw_action_channel(struct View2D *v2d, + struct AnimData *adt, + struct bAction *act, + float ypos, + float yscale_fac, + int saction_flag); /* Object Summary */ -void draw_object_channel(struct View2D *v2d, struct bDopeSheet *ads, struct Object *ob, float ypos, float yscale_fac, int saction_flag); +void draw_object_channel(struct View2D *v2d, + struct bDopeSheet *ads, + struct Object *ob, + float ypos, + float yscale_fac, + int saction_flag); /* Scene Summary */ -void draw_scene_channel(struct View2D *v2d, struct bDopeSheet *ads, struct Scene *sce, float ypos, float yscale_fac, int saction_flag); +void draw_scene_channel(struct View2D *v2d, + struct bDopeSheet *ads, + struct Scene *sce, + float ypos, + float yscale_fac, + int saction_flag); /* DopeSheet Summary */ -void draw_summary_channel(struct View2D *v2d, struct bAnimContext *ac, float ypos, float yscale_fac, int saction_flag); +void draw_summary_channel( + struct View2D *v2d, struct bAnimContext *ac, float ypos, float yscale_fac, int saction_flag); /* Grease Pencil datablock summary */ -void draw_gpencil_channel(struct View2D *v2d, struct bDopeSheet *ads, struct bGPdata *gpd, float ypos, float yscale_fac, int saction_flag); +void draw_gpencil_channel(struct View2D *v2d, + struct bDopeSheet *ads, + struct bGPdata *gpd, + float ypos, + float yscale_fac, + int saction_flag); /* Grease Pencil Layer */ -void draw_gpl_channel(struct View2D *v2d, struct bDopeSheet *ads, struct bGPDlayer *gpl, float ypos, float yscale_fac, int saction_flag); +void draw_gpl_channel(struct View2D *v2d, + struct bDopeSheet *ads, + struct bGPDlayer *gpl, + float ypos, + float yscale_fac, + int saction_flag); /* Mask Layer */ -void draw_masklay_channel(struct View2D *v2d, struct bDopeSheet *ads, struct MaskLayer *masklay, float ypos, float yscale_fac, int saction_flag); +void draw_masklay_channel(struct View2D *v2d, + struct bDopeSheet *ads, + struct MaskLayer *masklay, + float ypos, + float yscale_fac, + int saction_flag); /* Keydata Generation --------------- */ /* F-Curve */ -void fcurve_to_keylist(struct AnimData *adt, struct FCurve *fcu, struct DLRBT_Tree *keys, int saction_flag); +void fcurve_to_keylist(struct AnimData *adt, + struct FCurve *fcu, + struct DLRBT_Tree *keys, + int saction_flag); /* Action Group */ -void agroup_to_keylist(struct AnimData *adt, struct bActionGroup *agrp, struct DLRBT_Tree *keys, int saction_flag); +void agroup_to_keylist(struct AnimData *adt, + struct bActionGroup *agrp, + struct DLRBT_Tree *keys, + int saction_flag); /* Action */ -void action_to_keylist(struct AnimData *adt, struct bAction *act, struct DLRBT_Tree *keys, int saction_flag); +void action_to_keylist(struct AnimData *adt, + struct bAction *act, + struct DLRBT_Tree *keys, + int saction_flag); /* Object */ -void ob_to_keylist(struct bDopeSheet *ads, struct Object *ob, struct DLRBT_Tree *keys, int saction_flag); +void ob_to_keylist(struct bDopeSheet *ads, + struct Object *ob, + struct DLRBT_Tree *keys, + int saction_flag); /* Cache File */ -void cachefile_to_keylist(struct bDopeSheet *ads, struct CacheFile *cache_file, struct DLRBT_Tree *keys, int saction_flag); +void cachefile_to_keylist(struct bDopeSheet *ads, + struct CacheFile *cache_file, + struct DLRBT_Tree *keys, + int saction_flag); /* Scene */ -void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tree *keys, int saction_flag); +void scene_to_keylist(struct bDopeSheet *ads, + struct Scene *sce, + struct DLRBT_Tree *keys, + int saction_flag); /* DopeSheet Summary */ void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, int saction_flag); /* Grease Pencil datablock summary */ -void gpencil_to_keylist(struct bDopeSheet *ads, struct bGPdata *gpd, struct DLRBT_Tree *keys, const bool active); +void gpencil_to_keylist(struct bDopeSheet *ads, + struct bGPdata *gpd, + struct DLRBT_Tree *keys, + const bool active); /* Grease Pencil Layer */ void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys); /* Mask */ -void mask_to_keylist(struct bDopeSheet *UNUSED(ads), struct MaskLayer *masklay, struct DLRBT_Tree *keys); +void mask_to_keylist(struct bDopeSheet *UNUSED(ads), + struct MaskLayer *masklay, + struct DLRBT_Tree *keys); /* ActKeyColumn API ---------------- */ /* Comparator callback used for ActKeyColumns and cframe float-value pointer */ @@ -192,4 +267,4 @@ bool actkeyblock_is_valid(ActKeyColumn *ab); /* Checks if ActKeyColumn can be used as a block (i.e. drawn/used to detect "holds") */ int actkeyblock_get_valid_hold(ActKeyColumn *ab); -#endif /* __ED_KEYFRAMES_DRAW_H__ */ +#endif /* __ED_KEYFRAMES_DRAW_H__ */ diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 266eb3850b3..99a13dc6a87 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -38,81 +38,80 @@ struct bDopeSheet; /* bezt validation */ typedef enum eEditKeyframes_Validate { - /* Frame range */ - BEZT_OK_FRAME = 1, - BEZT_OK_FRAMERANGE, - /* Selection status */ - BEZT_OK_SELECTED, - /* Values (y-val) only */ - BEZT_OK_VALUE, - BEZT_OK_VALUERANGE, - /* For graph editor keyframes (2D tests) */ - BEZT_OK_REGION, - BEZT_OK_REGION_LASSO, - BEZT_OK_REGION_CIRCLE, - /* Only for keyframes a certain Dopesheet channel */ - BEZT_OK_CHANNEL_LASSO, - BEZT_OK_CHANNEL_CIRCLE, + /* Frame range */ + BEZT_OK_FRAME = 1, + BEZT_OK_FRAMERANGE, + /* Selection status */ + BEZT_OK_SELECTED, + /* Values (y-val) only */ + BEZT_OK_VALUE, + BEZT_OK_VALUERANGE, + /* For graph editor keyframes (2D tests) */ + BEZT_OK_REGION, + BEZT_OK_REGION_LASSO, + BEZT_OK_REGION_CIRCLE, + /* Only for keyframes a certain Dopesheet channel */ + BEZT_OK_CHANNEL_LASSO, + BEZT_OK_CHANNEL_CIRCLE, } eEditKeyframes_Validate; /* ------------ */ /* select modes */ typedef enum eEditKeyframes_Select { - /* SELECT_SUBTRACT for all, followed by SELECT_ADD for some */ - SELECT_REPLACE = (1 << 0), - /* add ok keyframes to selection */ - SELECT_ADD = (1 << 1), - /* remove ok keyframes from selection */ - SELECT_SUBTRACT = (1 << 2), - /* flip ok status of keyframes based on key status */ - SELECT_INVERT = (1 << 3), + /* SELECT_SUBTRACT for all, followed by SELECT_ADD for some */ + SELECT_REPLACE = (1 << 0), + /* add ok keyframes to selection */ + SELECT_ADD = (1 << 1), + /* remove ok keyframes from selection */ + SELECT_SUBTRACT = (1 << 2), + /* flip ok status of keyframes based on key status */ + SELECT_INVERT = (1 << 3), } eEditKeyframes_Select; /* "selection map" building modes */ typedef enum eEditKeyframes_SelMap { - SELMAP_MORE = 0, - SELMAP_LESS, + SELMAP_MORE = 0, + SELMAP_LESS, } eEditKeyframes_SelMap; /* snapping tools */ typedef enum eEditKeyframes_Snap { - SNAP_KEYS_CURFRAME = 1, - SNAP_KEYS_NEARFRAME, - SNAP_KEYS_NEARSEC, - SNAP_KEYS_NEARMARKER, - SNAP_KEYS_HORIZONTAL, - SNAP_KEYS_VALUE, - SNAP_KEYS_TIME, + SNAP_KEYS_CURFRAME = 1, + SNAP_KEYS_NEARFRAME, + SNAP_KEYS_NEARSEC, + SNAP_KEYS_NEARMARKER, + SNAP_KEYS_HORIZONTAL, + SNAP_KEYS_VALUE, + SNAP_KEYS_TIME, } eEditKeyframes_Snap; /* mirroring tools */ typedef enum eEditKeyframes_Mirror { - MIRROR_KEYS_CURFRAME = 1, - MIRROR_KEYS_YAXIS, - MIRROR_KEYS_XAXIS, - MIRROR_KEYS_MARKER, - MIRROR_KEYS_VALUE, - MIRROR_KEYS_TIME, + MIRROR_KEYS_CURFRAME = 1, + MIRROR_KEYS_YAXIS, + MIRROR_KEYS_XAXIS, + MIRROR_KEYS_MARKER, + MIRROR_KEYS_VALUE, + MIRROR_KEYS_TIME, } eEditKeyframes_Mirror; /* use with BEZT_OK_REGION_LASSO */ typedef struct KeyframeEdit_LassoData { - rctf *rectf_scaled; - const rctf *rectf_view; - const int (*mcords)[2]; - int mcords_tot; + rctf *rectf_scaled; + const rctf *rectf_view; + const int (*mcords)[2]; + int mcords_tot; } KeyframeEdit_LassoData; /* use with BEZT_OK_REGION_CIRCLE */ typedef struct KeyframeEdit_CircleData { - rctf *rectf_scaled; - const rctf *rectf_view; - float mval[2]; - float radius_squared; + rctf *rectf_scaled; + const rctf *rectf_view; + float mval[2]; + float radius_squared; } KeyframeEdit_CircleData; - /* ************************************************ */ /* Non-Destuctive Editing API (keyframes_edit.c) */ @@ -120,58 +119,58 @@ typedef struct KeyframeEdit_CircleData { /* which verts of a keyframe is active (after polling) */ typedef enum eKeyframeVertOk { - /* 'key' itself is ok */ - KEYFRAME_OK_KEY = (1 << 0), - /* 'handle 1' is ok */ - KEYFRAME_OK_H1 = (1 << 1), - /* 'handle 2' is ok */ - KEYFRAME_OK_H2 = (1 << 2), - /* all flags */ - KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2), + /* 'key' itself is ok */ + KEYFRAME_OK_KEY = (1 << 0), + /* 'handle 1' is ok */ + KEYFRAME_OK_H1 = (1 << 1), + /* 'handle 2' is ok */ + KEYFRAME_OK_H2 = (1 << 2), + /* all flags */ + KEYFRAME_OK_ALL = (KEYFRAME_OK_KEY | KEYFRAME_OK_H1 | KEYFRAME_OK_H2), } eKeyframeVertOk; /* Flags for use during iteration */ typedef enum eKeyframeIterFlags { - /* consider handles in addition to key itself */ - KEYFRAME_ITER_INCL_HANDLES = (1 << 0), + /* consider handles in addition to key itself */ + KEYFRAME_ITER_INCL_HANDLES = (1 << 0), - /* Perform NLA time remapping (global -> strip) for the "f1" parameter - * (e.g. used for selection tools on summary tracks) - */ - KED_F1_NLA_UNMAP = (1 << 1), + /* Perform NLA time remapping (global -> strip) for the "f1" parameter + * (e.g. used for selection tools on summary tracks) + */ + KED_F1_NLA_UNMAP = (1 << 1), - /* Perform NLA time remapping (global -> strip) for the "f2" parameter */ - KED_F2_NLA_UNMAP = (1 << 2), + /* Perform NLA time remapping (global -> strip) for the "f2" parameter */ + KED_F2_NLA_UNMAP = (1 << 2), } eKeyframeIterFlags; /* --- Generic Properties for Keyframe Edit Tools ----- */ typedef struct KeyframeEditData { - /* generic properties/data access */ - /** temp list for storing custom list of data to check */ - ListBase list; - /** pointer to current scene - many tools need access to cfra/etc. */ - struct Scene *scene; - /** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */ - void *data; - /** storage of times/values as 'decimals' */ - float f1, f2; - /** storage of times/values/flags as 'whole' numbers */ - int i1, i2; - - /* current iteration data */ - /** F-Curve that is being iterated over */ - struct FCurve *fcu; - /** index of current keyframe being iterated over */ - int curIndex; - /** y-position of midpoint of the channel (for the dopesheet) */ - float channel_y; - - /* flags */ - /** current flags for the keyframe we're reached in the iteration process */ - eKeyframeVertOk curflags; - /** settings for iteration process */ - eKeyframeIterFlags iterflags; + /* generic properties/data access */ + /** temp list for storing custom list of data to check */ + ListBase list; + /** pointer to current scene - many tools need access to cfra/etc. */ + struct Scene *scene; + /** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */ + void *data; + /** storage of times/values as 'decimals' */ + float f1, f2; + /** storage of times/values/flags as 'whole' numbers */ + int i1, i2; + + /* current iteration data */ + /** F-Curve that is being iterated over */ + struct FCurve *fcu; + /** index of current keyframe being iterated over */ + int curIndex; + /** y-position of midpoint of the channel (for the dopesheet) */ + float channel_y; + + /* flags */ + /** current flags for the keyframe we're reached in the iteration process */ + eKeyframeVertOk curflags; + /** settings for iteration process */ + eKeyframeIterFlags iterflags; } KeyframeEditData; /* ------- Function Pointer Typedefs ---------------- */ @@ -181,36 +180,35 @@ typedef void (*FcuEditFunc)(struct FCurve *fcu); /* callback function that operates on the given BezTriple */ typedef short (*KeyframeEditFunc)(KeyframeEditData *ked, struct BezTriple *bezt); - /* ------- Custom Data Type Defines ------------------ */ /* Custom data for remapping one range to another in a fixed way */ typedef struct KeyframeEditCD_Remap { - float oldMin, oldMax; /* old range */ - float newMin, newMax; /* new range */ + float oldMin, oldMax; /* old range */ + float newMin, newMax; /* new range */ } KeyframeEditCD_Remap; /* Paste options */ typedef enum eKeyPasteOffset { - /* paste keys starting at current frame */ - KEYFRAME_PASTE_OFFSET_CFRA_START, - /* paste keys ending at current frame */ - KEYFRAME_PASTE_OFFSET_CFRA_END, - /* paste keys relative to the current frame when copying */ - KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE, - /* paste keys from original time */ - KEYFRAME_PASTE_OFFSET_NONE, + /* paste keys starting at current frame */ + KEYFRAME_PASTE_OFFSET_CFRA_START, + /* paste keys ending at current frame */ + KEYFRAME_PASTE_OFFSET_CFRA_END, + /* paste keys relative to the current frame when copying */ + KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE, + /* paste keys from original time */ + KEYFRAME_PASTE_OFFSET_NONE, } eKeyPasteOffset; typedef enum eKeyMergeMode { - /* overlay existing with new keys */ - KEYFRAME_PASTE_MERGE_MIX, - /* replace entire fcurve */ - KEYFRAME_PASTE_MERGE_OVER, - /* overwrite keys in pasted range */ - KEYFRAME_PASTE_MERGE_OVER_RANGE, - /* overwrite keys in pasted range (use all keyframe start & end for range) */ - KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL, + /* overlay existing with new keys */ + KEYFRAME_PASTE_MERGE_MIX, + /* replace entire fcurve */ + KEYFRAME_PASTE_MERGE_OVER, + /* overwrite keys in pasted range */ + KEYFRAME_PASTE_MERGE_OVER_RANGE, + /* overwrite keys in pasted range (use all keyframe start & end for range) */ + KEYFRAME_PASTE_MERGE_OVER_RANGE_ALL, } eKeyMergeMode; /* ---------------- Looping API --------------------- */ @@ -218,15 +216,30 @@ typedef enum eKeyMergeMode { /* functions for looping over keyframes */ /* function for working with F-Curve data only * (i.e. when filters have been chosen to explicitly use this) */ -short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, struct FCurve *fcu, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb); +short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, + struct FCurve *fcu, + KeyframeEditFunc key_ok, + KeyframeEditFunc key_cb, + FcuEditFunc fcu_cb); /* function for working with any type (i.e. one of the known types) of animation channel * - filterflag is bDopeSheet->flag (DOPESHEET_FILTERFLAG) */ -short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, struct bDopeSheet *ads, struct bAnimListElem *ale, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb); +short ANIM_animchannel_keyframes_loop(KeyframeEditData *ked, + struct bDopeSheet *ads, + struct bAnimListElem *ale, + KeyframeEditFunc key_ok, + KeyframeEditFunc key_cb, + FcuEditFunc fcu_cb); /* same as above, except bAnimListElem wrapper is not needed... * - keytype is eAnim_KeyType */ -short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, struct bDopeSheet *ads, void *data, int keytype, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb); +short ANIM_animchanneldata_keyframes_loop(KeyframeEditData *ked, + struct bDopeSheet *ads, + void *data, + int keytype, + KeyframeEditFunc key_ok, + KeyframeEditFunc key_cb, + FcuEditFunc fcu_cb); /* functions for making sure all keyframes are in good order */ void ANIM_editkeyframes_refresh(struct bAnimContext *ac); @@ -274,14 +287,9 @@ void bezt_remap_times(KeyframeEditData *ked, struct BezTriple *bezt); /* XXX: These are temporary, * until we can unify GP/Mask Keyframe handling and standard FCurve Keyframe handling */ -bool keyframe_region_lasso_test( - const KeyframeEdit_LassoData *data_lasso, - const float xy[2]); - -bool keyframe_region_circle_test( - const KeyframeEdit_CircleData *data_circle, - const float xy[2]); +bool keyframe_region_lasso_test(const KeyframeEdit_LassoData *data_lasso, const float xy[2]); +bool keyframe_region_circle_test(const KeyframeEdit_CircleData *data_circle, const float xy[2]); /* ************************************************ */ /* Destructive Editing API (keyframes_general.c) */ @@ -291,7 +299,10 @@ bool delete_fcurve_keys(struct FCurve *fcu); void clear_fcurve_keys(struct FCurve *fcu); void duplicate_fcurve_keys(struct FCurve *fcu); -void clean_fcurve(struct bAnimContext *ac, struct bAnimListElem *ale, float thresh, bool cleardefault); +void clean_fcurve(struct bAnimContext *ac, + struct bAnimListElem *ale, + float thresh, + bool cleardefault); void smooth_fcurve(struct FCurve *fcu); void sample_fcurve(struct FCurve *fcu); @@ -299,8 +310,11 @@ void sample_fcurve(struct FCurve *fcu); void ANIM_fcurves_copybuf_free(void); short copy_animedit_keys(struct bAnimContext *ac, ListBase *anim_data); -short paste_animedit_keys(struct bAnimContext *ac, ListBase *anim_data, - const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode, bool flip); +short paste_animedit_keys(struct bAnimContext *ac, + ListBase *anim_data, + const eKeyPasteOffset offset_mode, + const eKeyMergeMode merge_mode, + bool flip); /* ************************************************ */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 5191978c529..54570938de1 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -72,8 +72,13 @@ struct bAction *verify_adt_action(struct Main *bmain, struct ID *id, short add); /* Get (or add relevant data to be able to do so) F-Curve from the given Action. * This assumes that all the destinations are valid. */ -struct FCurve *verify_fcurve(struct Main *bmain, struct bAction *act, const char group[], struct PointerRNA *ptr, - const char rna_path[], const int array_index, short add); +struct FCurve *verify_fcurve(struct Main *bmain, + struct bAction *act, + const char group[], + struct PointerRNA *ptr, + const char rna_path[], + const int array_index, + short add); /* -------- */ @@ -81,7 +86,9 @@ struct FCurve *verify_fcurve(struct Main *bmain, struct bAction *act, const char * Update integer/discrete flags of the FCurve (used when creating/inserting keyframes, * but also through RNA when editing an ID prop, see T37103). */ -void update_autoflags_fcurve(struct FCurve *fcu, struct bContext *C, struct ReportList *reports, +void update_autoflags_fcurve(struct FCurve *fcu, + struct bContext *C, + struct ReportList *reports, struct PointerRNA *ptr); /* -------- */ @@ -97,7 +104,8 @@ int insert_bezt_fcurve(struct FCurve *fcu, const struct BezTriple *bezt, eInsert * already exists. It will insert a keyframe using the current value being keyframed. * Returns the index at which a keyframe was added (or -1 if failed) */ -int insert_vert_fcurve(struct FCurve *fcu, float x, float y, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); +int insert_vert_fcurve( + struct FCurve *fcu, float x, float y, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); /* -------- */ @@ -105,7 +113,15 @@ 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 Depsgraph *depsgraph, struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, struct NlaKeyframingContext *nla, 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, + struct NlaKeyframingContext *nla, + eInsertKeyFlags flag); /* -------- */ @@ -113,16 +129,31 @@ bool insert_keyframe_direct(struct Depsgraph *depsgraph, struct ReportList *repo * 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 Main *bmain, 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, struct ListBase *nla_cache, eInsertKeyFlags flag); +short insert_keyframe(struct Main *bmain, + 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, + struct ListBase *nla_cache, + eInsertKeyFlags flag); /* Main Keyframing API call: * Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case. */ -short delete_keyframe( - struct Main *bmain, struct ReportList *reports, struct ID *id, struct bAction *act, - const char group[], const char rna_path[], int array_index, float cfra, eInsertKeyFlags flag); +short delete_keyframe(struct Main *bmain, + struct ReportList *reports, + struct ID *id, + struct bAction *act, + const char group[], + const char rna_path[], + int array_index, + float cfra, + eInsertKeyFlags flag); /* ************ Keying Sets ********************** */ @@ -133,60 +164,66 @@ struct KeyingSetInfo; /* Polling Callback for KeyingSets */ typedef bool (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C); /* Context Iterator Callback for KeyingSets */ -typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks); +typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi, + struct bContext *C, + struct KeyingSet *ks); /* Property Specifier Callback for KeyingSets (called from iterators) */ -typedef void (*cbKeyingSet_Generate)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks, struct PointerRNA *ptr); - +typedef void (*cbKeyingSet_Generate)(struct KeyingSetInfo *ksi, + struct bContext *C, + struct KeyingSet *ks, + struct PointerRNA *ptr); /* Callback info for 'Procedural' KeyingSets to use */ typedef struct KeyingSetInfo { - struct KeyingSetInfo *next, *prev; - - /* info */ - /* identifier used for class name, which KeyingSet instances reference as "Typeinfo Name" */ - char idname[64]; - /* identifier so that user can hook this up to a KeyingSet (used as label). */ - char name[64]; - /* short help/description. */ - char description[240]; /* RNA_DYN_DESCR_MAX */ - /* keying settings */ - short keyingflag; - - /* polling callbacks */ - /* callback for polling the context for whether the right data is available */ - cbKeyingSet_Poll poll; - - /* generate callbacks */ - /* iterator to use to go through collections of data in context - * - this callback is separate from the 'adding' stage, allowing - * BuiltIn KeyingSets to be manually specified to use - */ - cbKeyingSet_Iterator iter; - /* generator to use to add properties based on the data found by iterator */ - cbKeyingSet_Generate generate; - - /* RNA integration */ - struct ExtensionRNA ext; + struct KeyingSetInfo *next, *prev; + + /* info */ + /* identifier used for class name, which KeyingSet instances reference as "Typeinfo Name" */ + char idname[64]; + /* identifier so that user can hook this up to a KeyingSet (used as label). */ + char name[64]; + /* short help/description. */ + char description[240]; /* RNA_DYN_DESCR_MAX */ + /* keying settings */ + short keyingflag; + + /* polling callbacks */ + /* callback for polling the context for whether the right data is available */ + cbKeyingSet_Poll poll; + + /* generate callbacks */ + /* iterator to use to go through collections of data in context + * - this callback is separate from the 'adding' stage, allowing + * BuiltIn KeyingSets to be manually specified to use + */ + cbKeyingSet_Iterator iter; + /* generator to use to add properties based on the data found by iterator */ + cbKeyingSet_Generate generate; + + /* RNA integration */ + struct ExtensionRNA ext; } KeyingSetInfo; /* -------- */ /* Add another data source for Relative Keying Sets to be evaluated with */ -void ANIM_relative_keyingset_add_source(ListBase *dsources, struct ID *id, struct StructRNA *srna, void *data); - +void ANIM_relative_keyingset_add_source(ListBase *dsources, + struct ID *id, + struct StructRNA *srna, + void *data); /* mode for modify_keyframes */ typedef enum eModifyKey_Modes { - MODIFYKEY_MODE_INSERT = 0, - MODIFYKEY_MODE_DELETE, + MODIFYKEY_MODE_INSERT = 0, + MODIFYKEY_MODE_DELETE, } eModifyKey_Modes; /* return codes for errors (with Relative KeyingSets) */ typedef enum eModifyKey_Returns { - /* context info was invalid for using the Keying Set */ - MODIFYKEY_INVALID_CONTEXT = -1, - /* there isn't any typeinfo for generating paths from context */ - MODIFYKEY_MISSING_TYPEINFO = -2, + /* context info was invalid for using the Keying Set */ + MODIFYKEY_INVALID_CONTEXT = -1, + /* there isn't any typeinfo for generating paths from context */ + MODIFYKEY_MISSING_TYPEINFO = -2, } eModifyKey_Returns; /* poll the current KeyingSet, updating it's set of paths @@ -194,7 +231,12 @@ typedef enum eModifyKey_Returns { short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks); /* use the specified KeyingSet to add/remove various Keyframes on the specified frame */ -int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction *act, struct KeyingSet *ks, short mode, float cfra); +int ANIM_apply_keyingset(struct bContext *C, + ListBase *dsources, + struct bAction *act, + struct KeyingSet *ks, + short mode, + float cfra); /* -------- */ @@ -224,10 +266,14 @@ struct KeyingSet *ANIM_scene_get_active_keyingset(struct Scene *scene); int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks); /* Get Keying Set to use for Auto-Keyframing some transforms */ -struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const char *tranformKSName); +struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, + const char *tranformKSName); /* Dynamically populate an enum of Keying Sets */ -const struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + bool *r_free); /* Use to get the keying set from the int value used by enums. */ KeyingSet *ANIM_keyingset_get_from_enum_type(struct Scene *scene, int type); @@ -240,27 +286,27 @@ bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks); /* Flags for use by driver creation calls */ typedef enum eCreateDriverFlags { - /** create drivers with a default variable for nicer UI */ - CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0), - /** create drivers with Generator FModifier (for backwards compat) */ - CREATEDRIVER_WITH_FMODIFIER = (1 << 1), + /** create drivers with a default variable for nicer UI */ + CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0), + /** create drivers with Generator FModifier (for backwards compat) */ + CREATEDRIVER_WITH_FMODIFIER = (1 << 1), } eCreateDriverFlags; /* Heuristic to use for connecting target properties to driven ones */ typedef enum eCreateDriver_MappingTypes { - /** 1 to Many - Use the specified index, and drive all elements with it */ - CREATEDRIVER_MAPPING_1_N = 0, - /** 1 to 1 - Only for the specified index on each side */ - CREATEDRIVER_MAPPING_1_1 = 1, - /** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */ - CREATEDRIVER_MAPPING_N_N = 2, - - /** None (Single Prop): - * Do not create driver with any targets; these will get added later instead */ - CREATEDRIVER_MAPPING_NONE = 3, - /** None (All Properties): - * Do not create driver with any targets; these will get added later instead */ - CREATEDRIVER_MAPPING_NONE_ALL = 4, + /** 1 to Many - Use the specified index, and drive all elements with it */ + CREATEDRIVER_MAPPING_1_N = 0, + /** 1 to 1 - Only for the specified index on each side */ + CREATEDRIVER_MAPPING_1_1 = 1, + /** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */ + CREATEDRIVER_MAPPING_N_N = 2, + + /** None (Single Prop): + * Do not create driver with any targets; these will get added later instead */ + CREATEDRIVER_MAPPING_NONE = 3, + /** None (All Properties): + * Do not create driver with any targets; these will get added later instead */ + CREATEDRIVER_MAPPING_NONE_ALL = 4, } eCreateDriver_MappingTypes; /* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */ @@ -271,7 +317,10 @@ extern EnumPropertyItem prop_driver_create_mapping_types[]; /* Low-level call to add a new driver F-Curve. This shouldn't be used directly for most tools, * although there are special cases where this approach is preferable. */ -struct FCurve *verify_driver_fcurve(struct ID *id, const char rna_path[], const int array_index, short add); +struct FCurve *verify_driver_fcurve(struct ID *id, + const char rna_path[], + const int array_index, + short add); /* -------- */ @@ -286,23 +335,34 @@ struct FCurve *verify_driver_fcurve(struct ID *id, const char rna_path[], const * - driver_type: eDriver_Types * - mapping_type: eCreateDriver_MappingTypes */ -int ANIM_add_driver_with_target( - struct ReportList *reports, - struct ID *dst_id, const char dst_path[], int dst_index, - struct ID *src_id, const char src_path[], int src_index, - short flag, int driver_type, short mapping_type); +int ANIM_add_driver_with_target(struct ReportList *reports, + struct ID *dst_id, + const char dst_path[], + int dst_index, + struct ID *src_id, + const char src_path[], + int src_index, + short flag, + int driver_type, + short mapping_type); /* -------- */ /* Main Driver Management API calls: * Add a new driver for the specified property on the given ID block */ -int ANIM_add_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag, int type); +int ANIM_add_driver(struct ReportList *reports, + struct ID *id, + const char rna_path[], + int array_index, + short flag, + int type); /* Main Driver Management API calls: * Remove the driver for the specified property on the given ID block (if available) */ -bool ANIM_remove_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag); +bool ANIM_remove_driver( + struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag); /* -------- */ @@ -320,13 +380,15 @@ bool ANIM_driver_can_paste(void); /* Main Driver Management API calls: * Make a copy of the driver for the specified property on the given ID block */ -bool ANIM_copy_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag); +bool ANIM_copy_driver( + struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag); /* Main Driver Management API calls: * Add a new driver for the specified property on the given ID block or replace an existing one * with the driver + driver-curve data from the buffer */ -bool ANIM_paste_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag); +bool ANIM_paste_driver( + struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag); /* -------- */ @@ -351,15 +413,17 @@ bool ANIM_driver_vars_paste(struct ReportList *reports, struct FCurve *fcu, bool /* Auto-Keying macros for use by various tools */ /* check if auto-keyframing is enabled (per scene takes precedence) */ -#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) +#define IS_AUTOKEY_ON(scene) \ + ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) /* check the mode for auto-keyframing (per scene takes precedence) */ -#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode)) +#define IS_AUTOKEY_MODE(scene, mode) \ + ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : \ + (U.autokey_mode == AUTOKEY_MODE_##mode)) /* check if a flag is set for auto-keyframing (per scene takes precedence) */ #define IS_AUTOKEY_FLAG(scene, flag) \ - ((scene) ? \ - ((scene->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || (U.autokey_flag & AUTOKEY_FLAG_##flag)) \ - : \ - (U.autokey_flag & AUTOKEY_FLAG_##flag)) + ((scene) ? ((scene->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || \ + (U.autokey_flag & AUTOKEY_FLAG_##flag)) : \ + (U.autokey_flag & AUTOKEY_FLAG_##flag)) /* auto-keyframing feature - checks for whether anything should be done for the current frame */ bool autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id); @@ -375,7 +439,10 @@ bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter); * - Returns whether the current value of a given property differs from the interpolated value. * - Used for button drawing. */ -bool fcurve_is_changed(struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float frame); +bool fcurve_is_changed(struct PointerRNA ptr, + struct PropertyRNA *prop, + struct FCurve *fcu, + float frame); /** * Main Keyframe Checking API call: @@ -392,29 +459,36 @@ bool id_frame_has_keyframe(struct ID *id, float frame, short filter); * (for v3d->keyflags) */ typedef enum eAnimFilterFlags { - /* general */ - ANIMFILTER_KEYS_LOCAL = (1 << 0), /* only include locally available anim data */ - ANIMFILTER_KEYS_MUTED = (1 << 1), /* include muted elements */ - ANIMFILTER_KEYS_ACTIVE = (1 << 2), /* only include active-subelements */ - - /* object specific */ - ANIMFILTER_KEYS_NOMAT = (1 << 9), /* don't include material keyframes */ - ANIMFILTER_KEYS_NOSKEY = (1 << 10), /* don't include shape keys (for geometry) */ + /* general */ + ANIMFILTER_KEYS_LOCAL = (1 << 0), /* only include locally available anim data */ + ANIMFILTER_KEYS_MUTED = (1 << 1), /* include muted elements */ + ANIMFILTER_KEYS_ACTIVE = (1 << 2), /* only include active-subelements */ + + /* object specific */ + ANIMFILTER_KEYS_NOMAT = (1 << 9), /* don't include material keyframes */ + ANIMFILTER_KEYS_NOSKEY = (1 << 10), /* don't include shape keys (for geometry) */ } eAnimFilterFlags; /* utility funcs for auto keyframe */ -bool ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks); -bool ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks); +bool ED_autokeyframe_object(struct bContext *C, + struct Scene *scene, + struct Object *ob, + struct KeyingSet *ks); +bool ED_autokeyframe_pchan(struct bContext *C, + struct Scene *scene, + struct Object *ob, + struct bPoseChannel *pchan, + struct KeyingSet *ks); /* Names for builtin keying sets so we don't confuse these with labels/text, * defined in python script: keyingsets_builtins.py */ -#define ANIM_KS_LOCATION_ID "Location" -#define ANIM_KS_ROTATION_ID "Rotation" -#define ANIM_KS_SCALING_ID "Scaling" -#define ANIM_KS_LOC_ROT_SCALE_ID "LocRotScale" -#define ANIM_KS_AVAILABLE_ID "Available" -#define ANIM_KS_WHOLE_CHARACTER_ID "WholeCharacter" -#define ANIM_KS_WHOLE_CHARACTER_SELECTED_ID "WholeCharacterSelected" +#define ANIM_KS_LOCATION_ID "Location" +#define ANIM_KS_ROTATION_ID "Rotation" +#define ANIM_KS_SCALING_ID "Scaling" +#define ANIM_KS_LOC_ROT_SCALE_ID "LocRotScale" +#define ANIM_KS_AVAILABLE_ID "Available" +#define ANIM_KS_WHOLE_CHARACTER_ID "WholeCharacter" +#define ANIM_KS_WHOLE_CHARACTER_SELECTED_ID "WholeCharacterSelected" #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h index f65f47c40ad..5c3c3555d56 100644 --- a/source/blender/editors/include/ED_lattice.h +++ b/source/blender/editors/include/ED_lattice.h @@ -35,7 +35,8 @@ void ED_keymap_lattice(struct wmKeyConfig *keyconf); /* editlattice_select.c */ bool ED_lattice_flags_set(struct Object *obedit, int flag); -bool ED_lattice_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +bool ED_lattice_select_pick( + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); bool ED_lattice_deselect_all_multi_ex(struct Base **bases, const uint bases_len); bool ED_lattice_deselect_all_multi(struct bContext *C); @@ -43,4 +44,4 @@ bool ED_lattice_deselect_all_multi(struct bContext *C); /* editlattice_undo.c */ void ED_lattice_undosys_type(struct UndoType *ut); -#endif /* __ED_LATTICE_H__ */ +#endif /* __ED_LATTICE_H__ */ diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h index f3ca7135e40..a883187327f 100644 --- a/source/blender/editors/include/ED_markers.h +++ b/source/blender/editors/include/ED_markers.h @@ -35,9 +35,9 @@ struct wmKeyMap; /* flags for drawing markers */ enum { - DRAW_MARKERS_LINES = (1 << 0), - DRAW_MARKERS_LOCAL = (1 << 1), - DRAW_MARKERS_MARGIN = (1 << 2), + DRAW_MARKERS_LINES = (1 << 0), + DRAW_MARKERS_LOCAL = (1 << 1), + DRAW_MARKERS_MARGIN = (1 << 2), }; void ED_markers_draw(const struct bContext *C, int flag); @@ -47,7 +47,8 @@ void ED_markers_draw(const struct bContext *C, int flag); ListBase *ED_context_get_markers(const struct bContext *C); ListBase *ED_animcontext_get_markers(const struct bAnimContext *ac); -int ED_markers_post_apply_transform(ListBase *markers, struct Scene *scene, int mode, float value, char side); +int ED_markers_post_apply_transform( + ListBase *markers, struct Scene *scene, int mode, float value, char side); struct TimeMarker *ED_markers_find_nearest_marker(ListBase *markers, float x); int ED_markers_find_nearest_marker_time(ListBase *markers, float x); diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index d555a17c0b1..c3883de0722 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -35,12 +35,16 @@ void ED_mask_get_size(struct ScrArea *sa, int *width, int *height); void ED_mask_zoom(struct ScrArea *sa, struct ARegion *ar, float *zoomx, float *zoomy); void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *ar, float *aspx, float *aspy); -void ED_mask_pixelspace_factor(struct ScrArea *sa, struct ARegion *ar, float *scalex, float *scaley); +void ED_mask_pixelspace_factor(struct ScrArea *sa, + struct ARegion *ar, + float *scalex, + float *scaley); void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, const int mval[2], float co[2]); -void ED_mask_point_pos(struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr); -void ED_mask_point_pos__reverse(struct ScrArea *sa, struct ARegion *ar, - float x, float y, float *xr, float *yr); +void ED_mask_point_pos( + struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr); +void ED_mask_point_pos__reverse( + struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr); void ED_mask_cursor_location_get(struct ScrArea *sa, float cursor[2]); bool ED_mask_selected_minmax(const struct bContext *C, float min[2], float max[2]); @@ -51,15 +55,22 @@ void ED_operatormacros_mask(void); /* mask_draw.c */ void ED_mask_draw(const struct bContext *C, const char draw_flag, const char draw_type); -void ED_mask_draw_region(struct Mask *mask, struct ARegion *ar, - const char draw_flag, const char draw_type, const char overlay_mode, - const int width_i, const int height_i, - const float aspx, const float aspy, - const bool do_scale_applied, const bool do_draw_cb, +void ED_mask_draw_region(struct Mask *mask, + struct ARegion *ar, + const char draw_flag, + const char draw_type, + const char overlay_mode, + const int width_i, + const int height_i, + const float aspx, + const float aspy, + const bool do_scale_applied, + const bool do_draw_cb, float stabmat[4][4], const struct bContext *C); -void ED_mask_draw_frames(struct Mask *mask, struct ARegion *ar, const int cfra, const int sfra, const int efra); +void ED_mask_draw_frames( + struct Mask *mask, struct ARegion *ar, const int cfra, const int sfra, const int efra); /* mask_shapekey.c */ void ED_mask_layer_shape_auto_key(struct MaskLayer *masklay, const int frame); @@ -67,16 +78,24 @@ bool ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame); bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame); /* ----------- Mask AnimEdit API ------------------ */ -bool ED_masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene, - short (*masklay_shape_cb)(struct MaskLayerShape *, struct Scene *)); +bool ED_masklayer_frames_looper(struct MaskLayer *masklay, + struct Scene *scene, + short (*masklay_shape_cb)(struct MaskLayerShape *, + struct Scene *)); void ED_masklayer_make_cfra_list(struct MaskLayer *masklay, ListBase *elems, bool onlysel); -bool ED_masklayer_frame_select_check(struct MaskLayer *masklay); -void ED_masklayer_frame_select_set(struct MaskLayer *masklay, short mode); -void ED_masklayer_frames_select_box(struct MaskLayer *masklay, float min, float max, short select_mode); -void ED_masklayer_frames_select_region(struct KeyframeEditData *ked, struct MaskLayer *masklay, short tool, short select_mode); -void ED_mask_select_frames(struct MaskLayer *masklay, short select_mode); -void ED_mask_select_frame(struct MaskLayer *masklay, int selx, short select_mode); +bool ED_masklayer_frame_select_check(struct MaskLayer *masklay); +void ED_masklayer_frame_select_set(struct MaskLayer *masklay, short mode); +void ED_masklayer_frames_select_box(struct MaskLayer *masklay, + float min, + float max, + short select_mode); +void ED_masklayer_frames_select_region(struct KeyframeEditData *ked, + struct MaskLayer *masklay, + short tool, + short select_mode); +void ED_mask_select_frames(struct MaskLayer *masklay, short select_mode); +void ED_mask_select_frame(struct MaskLayer *masklay, int selx, short select_mode); bool ED_masklayer_frames_delete(struct MaskLayer *masklay); void ED_masklayer_frames_duplicate(struct MaskLayer *masklay); diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h index 2683631e85f..8ffae0f2b66 100644 --- a/source/blender/editors/include/ED_mball.h +++ b/source/blender/editors/include/ED_mball.h @@ -34,9 +34,11 @@ void ED_operatortypes_metaball(void); void ED_operatormacros_metaball(void); void ED_keymap_metaball(struct wmKeyConfig *keyconf); -struct MetaElem *ED_mball_add_primitive(struct bContext *C, struct Object *obedit, float mat[4][4], float dia, int type); +struct MetaElem *ED_mball_add_primitive( + struct bContext *C, struct Object *obedit, float mat[4][4], float dia, int type); -bool ED_mball_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +bool ED_mball_select_pick( + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); bool ED_mball_deselect_all_multi_ex(struct Base **bases, uint bases_len); bool ED_mball_deselect_all_multi(struct bContext *C); @@ -48,11 +50,10 @@ void ED_mball_editmball_load(struct Object *obedit); /* editmball_undo.c */ void ED_mball_undosys_type(struct UndoType *ut); +#define MBALLSEL_STIFF (1 << 29) +#define MBALLSEL_RADIUS (1 << 30) +#define MBALLSEL_ANY (MBALLSEL_STIFF | MBALLSEL_RADIUS) -#define MBALLSEL_STIFF (1 << 29) -#define MBALLSEL_RADIUS (1 << 30) -#define MBALLSEL_ANY (MBALLSEL_STIFF | MBALLSEL_RADIUS) +#define MBALL_NOSEL (1u << 31u) -#define MBALL_NOSEL (1u << 31u) - -#endif /* __ED_MBALL_H__ */ +#endif /* __ED_MBALL_H__ */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 9e68c4a03ae..dcac5301da5 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -60,17 +60,24 @@ struct wmKeyConfig; struct wmOperator; /* editmesh_utils.c */ -void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis, - const bool use_self, const bool use_select, - const bool use_topology, float maxdist, int *r_index); -void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const int axis, - const bool use_self, const bool use_select, const bool use_toplogy); -void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to); +void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, + const int axis, + const bool use_self, + const bool use_select, + const bool use_topology, + float maxdist, + int *r_index); +void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, + const int axis, + const bool use_self, + const bool use_select, + const bool use_toplogy); +void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to); struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v); struct BMEdge *EDBM_verts_mirror_get_edge(struct BMEditMesh *em, struct BMEdge *e); struct BMFace *EDBM_verts_mirror_get_face(struct BMEditMesh *em, struct BMFace *f); -void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v); -void EDBM_verts_mirror_cache_end(struct BMEditMesh *em); +void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v); +void EDBM_verts_mirror_cache_end(struct BMEditMesh *em); void EDBM_mesh_normals_update(struct BMEditMesh *em); void EDBM_mesh_clear(struct BMEditMesh *em); @@ -100,98 +107,115 @@ bool EDBM_mesh_reveal(struct BMEditMesh *em, bool select); void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive); -struct UvElementMap *BM_uv_element_map_create( - struct BMesh *bm, - const bool selected, const bool use_winding, const bool do_islands); -void BM_uv_element_map_free(struct UvElementMap *vmap); -struct UvElement *BM_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l); - -bool EDBM_uv_check(struct BMEditMesh *em); -struct BMFace *EDBM_uv_active_face_get( - struct BMEditMesh *em, const bool sloppy, const bool selected); - -void BM_uv_vert_map_free(struct UvVertMap *vmap); +struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, + const bool selected, + const bool use_winding, + const bool do_islands); +void BM_uv_element_map_free(struct UvElementMap *vmap); +struct UvElement *BM_uv_element_get(struct UvElementMap *map, + struct BMFace *efa, + struct BMLoop *l); + +bool EDBM_uv_check(struct BMEditMesh *em); +struct BMFace *EDBM_uv_active_face_get(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); -struct UvVertMap *BM_uv_vert_map_create( - struct BMesh *bm, - const float limit[2], const bool use_select, const bool use_winding); +struct UvVertMap *BM_uv_vert_map_create(struct BMesh *bm, + const float limit[2], + const bool use_select, + const bool use_winding); 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, +bool BMBVH_EdgeVisible(struct BMBVHTree *tree, + struct BMEdge *e, struct Depsgraph *depsgraph, - struct ARegion *ar, struct View3D *v3d, struct Object *obedit); + struct ARegion *ar, + struct View3D *v3d, + struct Object *obedit); /* editmesh_undo.c */ void ED_mesh_undosys_type(struct UndoType *ut); /* editmesh_select.c */ void EDBM_select_mirrored( - struct BMEditMesh *em, const int axis, const bool extend, - int *r_totmirr, int *r_totfail); + struct BMEditMesh *em, const int axis, const bool extend, int *r_totmirr, int *r_totfail); void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag); -bool EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); +bool EDBM_backbuf_border_init( + struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); bool EDBM_backbuf_check(unsigned int index); void EDBM_backbuf_free(void); -bool EDBM_backbuf_border_mask_init( - struct ViewContext *vc, const int mcords[][2], short tot, - short xmin, short ymin, short xmax, short ymax); +bool EDBM_backbuf_border_mask_init(struct ViewContext *vc, + const int mcords[][2], + short tot, + short xmin, + short ymin, + short xmax, + short ymax); bool EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads); -struct BMVert *EDBM_vert_find_nearest_ex( - struct ViewContext *vc, float *r_dist, - const bool use_select_bias, bool use_cycle); -struct BMVert *EDBM_vert_find_nearest( - struct ViewContext *vc, float *r_dist); - -struct BMEdge *EDBM_edge_find_nearest_ex( - struct ViewContext *vc, float *r_dist, - float *r_dist_center, - const bool use_select_bias, const bool use_cycle, - struct BMEdge **r_eed_zbuf); -struct BMEdge *EDBM_edge_find_nearest( - struct ViewContext *vc, float *r_dist); - -struct BMFace *EDBM_face_find_nearest_ex( - struct ViewContext *vc, float *r_dist, - float *r_dist_center, - const bool use_select_bias, const bool use_cycle, - struct BMFace **r_efa_zbuf); -struct BMFace *EDBM_face_find_nearest( - struct ViewContext *vc, float *r_dist); - -bool EDBM_unified_findnearest( - struct ViewContext *vc, - struct Base **bases, - const uint bases_len, - int *r_base_index, - struct BMVert **r_eve, - struct BMEdge **r_eed, - struct BMFace **r_efa); - -bool EDBM_unified_findnearest_from_raycast( - struct ViewContext *vc, - struct Base **bases, - const uint bases_len, - bool use_boundary, - int *r_base_index, - struct BMVert **r_eve, - struct BMEdge **r_eed, - struct BMFace **r_efa); - -bool EDBM_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +struct BMVert *EDBM_vert_find_nearest_ex(struct ViewContext *vc, + float *r_dist, + const bool use_select_bias, + bool use_cycle); +struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, float *r_dist); + +struct BMEdge *EDBM_edge_find_nearest_ex(struct ViewContext *vc, + float *r_dist, + float *r_dist_center, + const bool use_select_bias, + const bool use_cycle, + struct BMEdge **r_eed_zbuf); +struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, float *r_dist); + +struct BMFace *EDBM_face_find_nearest_ex(struct ViewContext *vc, + float *r_dist, + float *r_dist_center, + const bool use_select_bias, + const bool use_cycle, + struct BMFace **r_efa_zbuf); +struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, float *r_dist); + +bool EDBM_unified_findnearest(struct ViewContext *vc, + struct Base **bases, + const uint bases_len, + int *r_base_index, + struct BMVert **r_eve, + struct BMEdge **r_eed, + struct BMFace **r_efa); + +bool EDBM_unified_findnearest_from_raycast(struct ViewContext *vc, + struct Base **bases, + const uint bases_len, + bool use_boundary, + int *r_base_index, + struct BMVert **r_eve, + struct BMEdge **r_eed, + struct BMFace **r_efa); + +bool EDBM_select_pick( + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); void EDBM_selectmode_set(struct BMEditMesh *em); -void EDBM_selectmode_convert(struct BMEditMesh *em, const short selectmode_old, const short selectmode_new); +void EDBM_selectmode_convert(struct BMEditMesh *em, + const short selectmode_old, + const short selectmode_new); /* user access this */ -bool EDBM_selectmode_toggle(struct bContext *C, const short selectmode_new, - const int action, const bool use_extend, const bool use_expand); - -bool EDBM_selectmode_disable(struct Scene *scene, struct BMEditMesh *em, +bool EDBM_selectmode_toggle(struct bContext *C, + const short selectmode_new, + const int action, + const bool use_extend, + const bool use_expand); + +bool EDBM_selectmode_disable(struct Scene *scene, + struct BMEditMesh *em, const short selectmode_disable, const short selectmode_fallback); @@ -201,7 +225,7 @@ void EDBM_select_toggle_all(struct BMEditMesh *em); void EDBM_select_swap(struct BMEditMesh *em); /* exported for UV */ bool EDBM_select_interior_faces(struct BMEditMesh *em); -void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); /* rename? */ +void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); /* rename? */ bool EDBM_mesh_deselect_all_multi_ex(struct Base **bases, const uint bases_len); bool EDBM_mesh_deselect_all_multi(struct bContext *C); @@ -214,9 +238,11 @@ struct EditMesh_PreSelEdgeRing *EDBM_preselect_edgering_create(void); void EDBM_preselect_edgering_destroy(struct EditMesh_PreSelEdgeRing *psel); void EDBM_preselect_edgering_clear(struct EditMesh_PreSelEdgeRing *psel); void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const float matrix[4][4]); -void EDBM_preselect_edgering_update_from_edge( - struct EditMesh_PreSelEdgeRing *psel, - struct BMesh *bm, struct BMEdge *eed_start, int previewlines, const float (*coords)[3]); +void EDBM_preselect_edgering_update_from_edge(struct EditMesh_PreSelEdgeRing *psel, + struct BMesh *bm, + struct BMEdge *eed_start, + int previewlines, + const float (*coords)[3]); /* editmesh_preselect_elem.c */ struct EditMesh_PreSelElem; @@ -224,25 +250,36 @@ struct EditMesh_PreSelElem *EDBM_preselect_elem_create(void); void EDBM_preselect_elem_destroy(struct EditMesh_PreSelElem *psel); void EDBM_preselect_elem_clear(struct EditMesh_PreSelElem *psel); void EDBM_preselect_elem_draw(struct EditMesh_PreSelElem *psel, const float matrix[4][4]); -void EDBM_preselect_elem_update_from_single( - struct EditMesh_PreSelElem *psel, - struct BMesh *bm, struct BMElem *ele, const float (*coords)[3]); +void EDBM_preselect_elem_update_from_single(struct EditMesh_PreSelElem *psel, + struct BMesh *bm, + struct BMElem *ele, + const float (*coords)[3]); /* mesh_ops.c */ -void ED_operatortypes_mesh(void); -void ED_operatormacros_mesh(void); -void ED_keymap_mesh(struct wmKeyConfig *keyconf); +void ED_operatortypes_mesh(void); +void ED_operatormacros_mesh(void); +void ED_keymap_mesh(struct wmKeyConfig *keyconf); /* editmesh_tools.c (could be moved) */ void EDBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEditMesh *em); - /* editface.c */ void paintface_flush_flags(struct bContext *C, struct Object *ob, short flag); -bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle); +bool paintface_mouse_select(struct bContext *C, + struct Object *ob, + const int mval[2], + bool extend, + bool deselect, + bool toggle); bool do_paintface_box_select(struct ViewContext *vc, const struct rcti *rect, int sel_op); -bool paintface_deselect_all_visible(struct bContext *C, struct Object *ob, int action, bool flush_flags); -void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], const bool select); +bool paintface_deselect_all_visible(struct bContext *C, + struct Object *ob, + int action, + bool flush_flags); +void paintface_select_linked(struct bContext *C, + struct Object *ob, + const int mval[2], + const bool select); bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]); void paintface_hide(struct bContext *C, struct Object *ob, const bool unselected); @@ -255,53 +292,70 @@ void paintvert_tag_select_update(struct bContext *C, struct Object *ob); /* mirrtopo */ typedef struct MirrTopoStore_t { - intptr_t *index_lookup; - int prev_vert_tot; - int prev_edge_tot; - bool prev_is_editmode; + intptr_t *index_lookup; + int prev_vert_tot; + int prev_edge_tot; + bool prev_is_editmode; } MirrTopoStore_t; -bool ED_mesh_mirrtopo_recalc_check( - struct Mesh *me, struct Mesh *me_eval, MirrTopoStore_t *mesh_topo_store); -void ED_mesh_mirrtopo_init( - struct Mesh *me, struct Mesh *me_eval, MirrTopoStore_t *mesh_topo_store, - const bool skip_em_vert_array_init); +bool ED_mesh_mirrtopo_recalc_check(struct Mesh *me, + struct Mesh *me_eval, + MirrTopoStore_t *mesh_topo_store); +void ED_mesh_mirrtopo_init(struct Mesh *me, + struct Mesh *me_eval, + MirrTopoStore_t *mesh_topo_store, + const bool skip_em_vert_array_init); void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store); - /* object_vgroup.c */ #define WEIGHT_REPLACE 1 #define WEIGHT_ADD 2 #define WEIGHT_SUBTRACT 3 -bool ED_vgroup_sync_from_pose(struct Object *ob); -void ED_vgroup_select_by_name(struct Object *ob, const char *name); -void ED_vgroup_data_clamp_range(struct ID *id, const int total); -bool ED_vgroup_array_copy(struct Object *ob, struct Object *ob_from); -bool ED_vgroup_parray_alloc(struct ID *id, struct MDeformVert ***dvert_arr, int *dvert_tot, - const bool use_vert_sel); -void ED_vgroup_parray_mirror_sync(struct Object *ob, - struct MDeformVert **dvert_array, const int dvert_tot, - const bool *vgroup_validmap, const int vgroup_tot); -void ED_vgroup_parray_mirror_assign(struct Object *ob, - struct MDeformVert **dvert_array, const int dvert_tot); -void ED_vgroup_parray_remove_zero(struct MDeformVert **dvert_array, const int dvert_tot, - const bool *vgroup_validmap, const int vgroup_tot, - const float epsilon, const bool keep_single); -void ED_vgroup_parray_to_weight_array(const struct MDeformVert **dvert_array, const int dvert_tot, - float *dvert_weights, const int def_nr); -void ED_vgroup_parray_from_weight_array(struct MDeformVert **dvert_array, const int dvert_tot, - const float *dvert_weights, const int def_nr, - const bool remove_zero); -void ED_vgroup_mirror(struct Object *ob, - const bool mirror_weights, const bool flip_vgroups, - const bool all_vgroups, const bool use_topology, - int *r_totmirr, int *r_totfail); - -void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode); -void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum); -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); +bool ED_vgroup_sync_from_pose(struct Object *ob); +void ED_vgroup_select_by_name(struct Object *ob, const char *name); +void ED_vgroup_data_clamp_range(struct ID *id, const int total); +bool ED_vgroup_array_copy(struct Object *ob, struct Object *ob_from); +bool ED_vgroup_parray_alloc(struct ID *id, + struct MDeformVert ***dvert_arr, + int *dvert_tot, + const bool use_vert_sel); +void ED_vgroup_parray_mirror_sync(struct Object *ob, + struct MDeformVert **dvert_array, + const int dvert_tot, + const bool *vgroup_validmap, + const int vgroup_tot); +void ED_vgroup_parray_mirror_assign(struct Object *ob, + struct MDeformVert **dvert_array, + const int dvert_tot); +void ED_vgroup_parray_remove_zero(struct MDeformVert **dvert_array, + const int dvert_tot, + const bool *vgroup_validmap, + const int vgroup_tot, + const float epsilon, + const bool keep_single); +void ED_vgroup_parray_to_weight_array(const struct MDeformVert **dvert_array, + const int dvert_tot, + float *dvert_weights, + const int def_nr); +void ED_vgroup_parray_from_weight_array(struct MDeformVert **dvert_array, + const int dvert_tot, + const float *dvert_weights, + const int def_nr, + const bool remove_zero); +void ED_vgroup_mirror(struct Object *ob, + const bool mirror_weights, + const bool flip_vgroups, + const bool all_vgroups, + const bool use_topology, + int *r_totmirr, + int *r_totfail); + +void ED_vgroup_vert_add( + struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode); +void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum); +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); @@ -316,28 +370,37 @@ void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int cou void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count); void ED_mesh_calc_tessface(struct Mesh *mesh, bool free_mpoly); -void ED_mesh_update(struct Mesh *mesh, struct bContext *C, bool calc_edges, bool calc_edges_loose, bool calc_tessface); +void ED_mesh_update(struct Mesh *mesh, + struct bContext *C, + bool calc_edges, + bool calc_edges_loose, + bool calc_tessface); void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name); -int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set, const bool do_init); +int ED_mesh_uv_texture_add(struct Mesh *me, + const char *name, + const bool active_set, + const bool do_init); bool ED_mesh_uv_texture_remove_index(struct Mesh *me, const int n); bool ED_mesh_uv_texture_remove_active(struct Mesh *me); bool ED_mesh_uv_texture_remove_named(struct Mesh *me, const char *name); void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me); void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum); bool ED_mesh_color_ensure(struct Mesh *me, const char *name); -int ED_mesh_color_add(struct Mesh *me, const char *name, const bool active_set, const bool do_init); +int ED_mesh_color_add(struct Mesh *me, + const char *name, + const bool active_set, + const bool do_init); bool ED_mesh_color_remove_index(struct Mesh *me, const int n); bool ED_mesh_color_remove_active(struct Mesh *me); bool ED_mesh_color_remove_named(struct Mesh *me, const char *name); void ED_mesh_report_mirror(struct wmOperator *op, int totmirr, int totfail); -void ED_mesh_report_mirror_ex(struct wmOperator *op, int totmirr, int totfail, - char selectmode); +void ED_mesh_report_mirror_ex(struct wmOperator *op, int totmirr, int totfail, char selectmode); /* mesh backup */ typedef struct BMBackup { - struct BMesh *bmcopy; + struct BMesh *bmcopy; } BMBackup; /* save a copy of the bmesh for restoring later */ @@ -347,44 +410,54 @@ void EDBM_redo_state_restore(struct BMBackup, struct BMEditMesh *em, int recalct /* delete the backup, optionally flushing it to an editmesh */ void EDBM_redo_state_free(struct BMBackup *, struct BMEditMesh *em, int recalctess); - /* *** meshtools.c *** */ -int join_mesh_exec(struct bContext *C, struct wmOperator *op); -int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op); +int join_mesh_exec(struct bContext *C, struct wmOperator *op); +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 Mesh *me_eval, const float co[3], char mode); -int ED_mesh_mirror_topo_table(struct Object *ob, struct Mesh *me_eval, char mode); + struct Object *ob, struct BMEditMesh *em, struct Mesh *me_eval, const float co[3], char mode); +int ED_mesh_mirror_topo_table(struct Object *ob, struct Mesh *me_eval, 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 Mesh *me_eval, 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_vert(struct Object *ob, + struct Mesh *me_eval, + 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 Mesh *me_eval); int ED_mesh_mirror_get_vert(struct Object *ob, int index); -bool ED_mesh_pick_vert( - struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, bool use_zbuf, - uint *r_index); +bool ED_mesh_pick_vert(struct bContext *C, + struct Object *ob, + const int mval[2], + uint dist_px, + bool use_zbuf, + uint *r_index); bool ED_mesh_pick_face( - struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, - uint *r_index); + struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, uint *r_index); bool ED_mesh_pick_face_vert( - struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, - uint *r_index); - + struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, uint *r_index); struct MDeformVert *ED_mesh_active_dvert_get_em(struct Object *ob, struct BMVert **r_eve); 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); +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_DIST 25 #define ED_MESH_PICK_DEFAULT_FACE_DIST 1 diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 09449687e6e..d2d8972c245 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -40,20 +40,23 @@ struct bNodeTreeType; struct bNodeType; typedef enum { - NODE_TOP = 1, - NODE_BOTTOM = 2, - NODE_LEFT = 4, - NODE_RIGHT = 8, + NODE_TOP = 1, + NODE_BOTTOM = 2, + NODE_LEFT = 4, + NODE_RIGHT = 8, } NodeBorder; -#define NODE_GRID_STEPS 5 +#define NODE_GRID_STEPS 5 /* space_node.c */ int ED_node_tree_path_length(struct SpaceNode *snode); void ED_node_tree_path_get(struct SpaceNode *snode, char *value); void ED_node_tree_path_get_fixedbuf(struct SpaceNode *snode, char *value, int max_length); -void ED_node_tree_start(struct SpaceNode *snode, struct bNodeTree *ntree, struct ID *id, struct ID *from); +void ED_node_tree_start(struct SpaceNode *snode, + struct bNodeTree *ntree, + struct ID *id, + struct ID *from); void ED_node_tree_push(struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *gnode); void ED_node_tree_pop(struct SpaceNode *snode); int ED_node_tree_depth(struct SpaceNode *snode); @@ -68,7 +71,8 @@ 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, unsigned pos); +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); @@ -95,12 +99,15 @@ void ED_node_select_all(ListBase *lb, int action); void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree); void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); -void ED_node_composite_job(const struct bContext *C, struct bNodeTree *nodetree, struct Scene *scene_owner); +void ED_node_composite_job(const struct bContext *C, + struct bNodeTree *nodetree, + struct Scene *scene_owner); /* node_ops.c */ void ED_operatormacros_node(void); /* node_view.c */ -bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_node_color_sample( + struct Main *bmain, struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]); #endif /* __ED_NODE_H__ */ diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h index d4cb2110c2c..697a236341f 100644 --- a/source/blender/editors/include/ED_numinput.h +++ b/source/blender/editors/include/ED_numinput.h @@ -27,47 +27,47 @@ struct wmEvent; typedef struct NumInput { - /** idx_max < NUM_MAX_ELEMENTS */ - short idx_max; - int unit_sys; - /** Each value can have a different type */ - int unit_type[NUM_MAX_ELEMENTS]; - bool unit_use_radians; - - /** Flags affecting all values' behavior */ - short flag; - /** Per-value flags */ - short val_flag[NUM_MAX_ELEMENTS]; - /** Direct value of the input */ - float val[NUM_MAX_ELEMENTS]; - /** Original value of the input, for reset */ - float val_org[NUM_MAX_ELEMENTS]; - /** Increment steps */ - float val_inc[NUM_MAX_ELEMENTS]; - - /** Active element/value */ - short idx; - /** String as typed by user for edited value (we assume ASCII world!) */ - char str[NUM_STR_REP_LEN]; - /** Current position of cursor in edited value str - * (first byte of "current" letter, so 0 for an empty str) */ - int str_cur; + /** idx_max < NUM_MAX_ELEMENTS */ + short idx_max; + int unit_sys; + /** Each value can have a different type */ + int unit_type[NUM_MAX_ELEMENTS]; + bool unit_use_radians; + + /** Flags affecting all values' behavior */ + short flag; + /** Per-value flags */ + short val_flag[NUM_MAX_ELEMENTS]; + /** Direct value of the input */ + float val[NUM_MAX_ELEMENTS]; + /** Original value of the input, for reset */ + float val_org[NUM_MAX_ELEMENTS]; + /** Increment steps */ + float val_inc[NUM_MAX_ELEMENTS]; + + /** Active element/value */ + short idx; + /** String as typed by user for edited value (we assume ASCII world!) */ + char str[NUM_STR_REP_LEN]; + /** Current position of cursor in edited value str + * (first byte of "current" letter, so 0 for an empty str) */ + int str_cur; } NumInput; /* NumInput.flag */ enum { - NUM_AFFECT_ALL = (1 << 0), - /* (1 << 9) and above are reserved for internal flags! */ + NUM_AFFECT_ALL = (1 << 0), + /* (1 << 9) and above are reserved for internal flags! */ }; /* NumInput.val_flag[] */ enum { - /* Public! */ - NUM_NULL_ONE = (1 << 0), - NUM_NO_NEGATIVE = (1 << 1), - NUM_NO_ZERO = (1 << 2), - NUM_NO_FRACTION = (1 << 3), - /* (1 << 9) and above are reserved for internal flags! */ + /* Public! */ + NUM_NULL_ONE = (1 << 0), + NUM_NO_NEGATIVE = (1 << 1), + NUM_NO_ZERO = (1 << 2), + NUM_NO_FRACTION = (1 << 3), + /* (1 << 9) and above are reserved for internal flags! */ }; struct UnitSettings; @@ -92,11 +92,12 @@ bool hasNumInput(const NumInput *n); bool applyNumInput(NumInput *n, float *vec); bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event); -#define NUM_MODAL_INCREMENT_UP 18 +#define NUM_MODAL_INCREMENT_UP 18 #define NUM_MODAL_INCREMENT_DOWN 19 -bool user_string_to_number(bContext *C, const char *str, const struct UnitSettings *unit, int type, double *r_value); +bool user_string_to_number( + bContext *C, const char *str, const struct UnitSettings *unit, int type, double *r_value); /** \} */ -#endif /* __ED_NUMINPUT_H__ */ +#endif /* __ED_NUMINPUT_H__ */ diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index cb0a390cbc2..ed0298cce1f 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -67,12 +67,13 @@ struct Object *ED_object_active_context(struct bContext *C); void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout); /* object_utils.c */ -bool ED_object_calc_active_center_for_editmode( - struct Object *obedit, const bool select_only, float r_center[3]); -bool ED_object_calc_active_center_for_posemode( - struct Object *ob, const bool select_only, float r_center[3]); -bool ED_object_calc_active_center( - struct Object *ob, const bool select_only, float r_center[3]); +bool ED_object_calc_active_center_for_editmode(struct Object *obedit, + const bool select_only, + float r_center[3]); +bool ED_object_calc_active_center_for_posemode(struct Object *ob, + const bool select_only, + float r_center[3]); +bool ED_object_calc_active_center(struct Object *ob, const bool select_only, float r_center[3]); /* object_ops.c */ void ED_operatortypes_object(void); @@ -81,25 +82,25 @@ void ED_keymap_object(struct wmKeyConfig *keyconf); /* object_relations.c */ typedef enum eParentType { - PAR_OBJECT, - PAR_ARMATURE, - PAR_ARMATURE_NAME, - PAR_ARMATURE_ENVELOPE, - PAR_ARMATURE_AUTO, - PAR_BONE, - PAR_BONE_RELATIVE, - PAR_CURVE, - PAR_FOLLOW, - PAR_PATH_CONST, - PAR_LATTICE, - PAR_VERTEX, - PAR_VERTEX_TRI, + PAR_OBJECT, + PAR_ARMATURE, + PAR_ARMATURE_NAME, + PAR_ARMATURE_ENVELOPE, + PAR_ARMATURE_AUTO, + PAR_BONE, + PAR_BONE_RELATIVE, + PAR_CURVE, + PAR_FOLLOW, + PAR_PATH_CONST, + PAR_LATTICE, + PAR_VERTEX, + PAR_VERTEX_TRI, } eParentType; typedef enum eObjectSelect_Mode { - BA_DESELECT = 0, - BA_SELECT = 1, - BA_INVERT = 2, + BA_DESELECT = 0, + BA_SELECT = 1, + BA_INVERT = 2, } eObjectSelect_Mode; #ifdef __RNA_TYPES_H__ @@ -107,42 +108,67 @@ extern struct EnumPropertyItem prop_clear_parent_types[]; extern struct EnumPropertyItem prop_make_parent_types[]; #endif -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, +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); 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); -bool ED_object_base_deselect_all_ex(struct ViewLayer *view_layer, struct View3D *v3d, int action, bool *r_any_visible); +bool ED_object_base_deselect_all_ex(struct ViewLayer *view_layer, + struct View3D *v3d, + int action, + bool *r_any_visible); bool ED_object_base_deselect_all(struct ViewLayer *view_layer, struct View3D *v3d, int action); /* 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 ViewLayer *view_layer, 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); +void ED_object_parent(struct Object *ob, + struct Object *parent, + const int type, + const char *substr); /* bitflags for enter/exit editmode */ enum { - EM_FREEDATA = (1 << 0), - EM_NO_CONTEXT = (1 << 1), + EM_FREEDATA = (1 << 0), + EM_NO_CONTEXT = (1 << 1), }; -bool ED_object_editmode_exit_ex( - struct Main *bmain, struct Scene *scene, struct Object *obedit, int flag); +bool ED_object_editmode_exit_ex(struct Main *bmain, + 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_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); -void ED_object_vpaintmode_enter_ex( - struct Main *bmain, struct Depsgraph *depsgraph, struct wmWindowManager *wm, - struct Scene *scene, struct Object *ob); +void ED_object_vpaintmode_enter_ex(struct Main *bmain, + 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 Main *bmain, struct Depsgraph *depsgraph, struct wmWindowManager *wm, - struct Scene *scene, struct Object *ob); +void ED_object_wpaintmode_enter_ex(struct Main *bmain, + struct Depsgraph *depsgraph, + struct wmWindowManager *wm, + struct Scene *scene, + struct Object *ob); void ED_object_wpaintmode_enter(struct bContext *C); void ED_object_vpaintmode_exit_ex(struct Object *ob); @@ -150,24 +176,30 @@ void ED_object_vpaintmode_exit(struct bContext *C); void ED_object_wpaintmode_exit_ex(struct Object *ob); void ED_object_wpaintmode_exit(struct bContext *C); -void ED_object_sculptmode_enter_ex( - struct Main *bmain, struct Depsgraph *depsgraph, - struct Scene *scene, struct Object *ob, const bool force_dyntopo, - struct ReportList *reports); +void ED_object_sculptmode_enter_ex(struct Main *bmain, + struct Depsgraph *depsgraph, + struct Scene *scene, + struct Object *ob, + const bool force_dyntopo, + 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_ex(struct Depsgraph *depsgraph, + struct Scene *scene, + struct Object *ob); void ED_object_sculptmode_exit(struct bContext *C); void ED_object_location_from_view(struct bContext *C, float loc[3]); void ED_object_rotation_from_quat(float rot[3], const float quat[4], const char align_axis); void ED_object_rotation_from_view(struct bContext *C, float rot[3], const char align_axis); -void ED_object_base_init_transform(struct bContext *C, struct Base *base, const float loc[3], const float rot[3]); -float ED_object_new_primitive_matrix( - struct bContext *C, struct Object *editob, - const float loc[3], const float rot[3], float primmat[4][4]); - +void ED_object_base_init_transform(struct bContext *C, + struct Base *base, + const float loc[3], + const float rot[3]); +float ED_object_new_primitive_matrix(struct bContext *C, + struct Object *editob, + const float loc[3], + const float rot[3], + float primmat[4][4]); /* Avoid allowing too much insane values even by typing * (typos can hang/crash Blender otherwise). */ @@ -177,27 +209,41 @@ void ED_object_add_unit_props_size(struct wmOperatorType *ot); void ED_object_add_unit_props_radius(struct wmOperatorType *ot); void ED_object_add_generic_props(struct wmOperatorType *ot, bool do_editmode); void ED_object_add_mesh_props(struct wmOperatorType *ot); -bool ED_object_add_generic_get_opts( - struct bContext *C, struct wmOperator *op, const char view_align_axis, - float loc[3], float rot[3], - bool *enter_editmode, unsigned short *local_view_bits, bool *is_view_aligned); - -struct Object *ED_object_add_type( - struct bContext *C, - int type, const char *name, const float loc[3], const float rot[3], - bool enter_editmode, unsigned short local_view_bits) - ATTR_NONNULL(1) ATTR_RETURNS_NONNULL; - -void ED_object_single_users(struct Main *bmain, struct Scene *scene, const bool full, const bool copy_groups); +bool ED_object_add_generic_get_opts(struct bContext *C, + struct wmOperator *op, + const char view_align_axis, + float loc[3], + float rot[3], + bool *enter_editmode, + unsigned short *local_view_bits, + bool *is_view_aligned); + +struct Object *ED_object_add_type(struct bContext *C, + int type, + const char *name, + const float loc[3], + const float rot[3], + bool enter_editmode, + unsigned short local_view_bits) + ATTR_NONNULL(1) ATTR_RETURNS_NONNULL; + +void ED_object_single_users(struct Main *bmain, + struct Scene *scene, + const bool full, + const bool copy_groups); void ED_object_single_user(struct Main *bmain, struct Scene *scene, struct Object *ob); /* object motion paths */ void ED_objects_clear_paths(struct bContext *C, bool only_selected); -void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene, bool current_frame_only); +void ED_objects_recalculate_paths(struct bContext *C, + struct Scene *scene, + bool current_frame_only); /* constraints */ struct ListBase *get_active_constraints(struct Object *ob); -struct ListBase *get_constraint_lb(struct Object *ob, struct bConstraint *con, struct bPoseChannel **r_pchan); +struct ListBase *get_constraint_lb(struct Object *ob, + struct bConstraint *con, + struct bPoseChannel **r_pchan); struct bConstraint *get_active_constraint(struct Object *ob); void object_test_constraints(struct Main *bmain, struct Object *ob); @@ -206,111 +252,147 @@ void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con) void ED_object_constraint_update(struct Main *bmain, struct Object *ob); void ED_object_constraint_dependency_update(struct Main *bmain, struct Object *ob); -void ED_object_constraint_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con); -void ED_object_constraint_dependency_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con); +void ED_object_constraint_tag_update(struct Main *bmain, + struct Object *ob, + struct bConstraint *con); +void ED_object_constraint_dependency_tag_update(struct Main *bmain, + struct Object *ob, + struct bConstraint *con); /* object_modes.c */ bool ED_object_mode_compat_test(const struct Object *ob, eObjectMode mode); -bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, eObjectMode mode, struct ReportList *reports); +bool ED_object_mode_compat_set(struct bContext *C, + struct Object *ob, + eObjectMode mode, + struct ReportList *reports); void ED_object_mode_toggle(struct bContext *C, eObjectMode mode); void ED_object_mode_set(struct bContext *C, eObjectMode mode); void ED_object_mode_exit(struct bContext *C); -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_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); /* object_modifier.c */ enum { - MODIFIER_APPLY_DATA = 1, - MODIFIER_APPLY_SHAPE, + MODIFIER_APPLY_DATA = 1, + MODIFIER_APPLY_SHAPE, }; -struct ModifierData *ED_object_modifier_add( - struct ReportList *reports, struct Main *bmain, struct Scene *scene, - struct Object *ob, const char *name, int type); -bool ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, - struct Object *ob, struct ModifierData *md); +struct ModifierData *ED_object_modifier_add(struct ReportList *reports, + struct Main *bmain, + struct Scene *scene, + struct Object *ob, + const char *name, + int type); +bool ED_object_modifier_remove(struct ReportList *reports, + struct Main *bmain, + struct Object *ob, + struct ModifierData *md); void ED_object_modifier_clear(struct Main *bmain, struct Object *ob); -int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md); -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 Depsgraph *depsgraph, struct Scene *scene, - struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md); -int ED_object_modifier_apply( - struct Main *bmain, 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( - struct Main *bmain, struct Object *orig_ob, const bool include_orig, - bool (*callback)(struct Object *ob, void *callback_data), - void *callback_data); +int ED_object_modifier_move_down(struct ReportList *reports, + struct Object *ob, + struct ModifierData *md); +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 Depsgraph *depsgraph, + struct Scene *scene, + struct ViewLayer *view_layer, + struct Object *ob, + struct ModifierData *md); +int ED_object_modifier_apply(struct Main *bmain, + 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(struct Main *bmain, + struct Object *orig_ob, + const bool include_orig, + bool (*callback)(struct Object *ob, void *callback_data), + void *callback_data); bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v); - /* object_greasepencil_modifier.c */ -struct GpencilModifierData *ED_object_gpencil_modifier_add( - struct ReportList *reports, struct Main *bmain, struct Scene *scene, - struct Object *ob, const char *name, int type); -bool ED_object_gpencil_modifier_remove( - struct ReportList *reports, struct Main *bmain, - struct Object *ob, struct GpencilModifierData *md); -void ED_object_gpencil_modifier_clear( - struct Main *bmain, struct Object *ob); -int ED_object_gpencil_modifier_move_down( - struct ReportList *reports, struct Object *ob, struct GpencilModifierData *md); -int ED_object_gpencil_modifier_move_up( - struct ReportList *reports, struct Object *ob, struct GpencilModifierData *md); -int ED_object_gpencil_modifier_apply( - struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph, - struct Object *ob, struct GpencilModifierData *md, int mode); -int ED_object_gpencil_modifier_copy( - struct ReportList *reports, struct Object *ob, struct GpencilModifierData *md); +struct GpencilModifierData *ED_object_gpencil_modifier_add(struct ReportList *reports, + struct Main *bmain, + struct Scene *scene, + struct Object *ob, + const char *name, + int type); +bool ED_object_gpencil_modifier_remove(struct ReportList *reports, + struct Main *bmain, + struct Object *ob, + struct GpencilModifierData *md); +void ED_object_gpencil_modifier_clear(struct Main *bmain, struct Object *ob); +int ED_object_gpencil_modifier_move_down(struct ReportList *reports, + struct Object *ob, + struct GpencilModifierData *md); +int ED_object_gpencil_modifier_move_up(struct ReportList *reports, + struct Object *ob, + struct GpencilModifierData *md); +int ED_object_gpencil_modifier_apply(struct Main *bmain, + struct ReportList *reports, + struct Depsgraph *depsgraph, + struct Object *ob, + struct GpencilModifierData *md, + int mode); +int ED_object_gpencil_modifier_copy(struct ReportList *reports, + struct Object *ob, + struct GpencilModifierData *md); /* object_shader_fx.c */ -struct ShaderFxData *ED_object_shaderfx_add( - struct ReportList *reports, struct Main *bmain, struct Scene *scene, - struct Object *ob, const char *name, int type); -bool ED_object_shaderfx_remove( - struct ReportList *reports, struct Main *bmain, - struct Object *ob, struct ShaderFxData *fx); -void ED_object_shaderfx_clear( - struct Main *bmain, struct Object *ob); -int ED_object_shaderfx_move_down( - struct ReportList *reports, struct Object *ob, struct ShaderFxData *fx); -int ED_object_shaderfx_move_up( - struct ReportList *reports, struct Object *ob, struct ShaderFxData *fx); +struct ShaderFxData *ED_object_shaderfx_add(struct ReportList *reports, + struct Main *bmain, + struct Scene *scene, + struct Object *ob, + const char *name, + int type); +bool ED_object_shaderfx_remove(struct ReportList *reports, + struct Main *bmain, + struct Object *ob, + struct ShaderFxData *fx); +void ED_object_shaderfx_clear(struct Main *bmain, struct Object *ob); +int ED_object_shaderfx_move_down(struct ReportList *reports, + struct Object *ob, + struct ShaderFxData *fx); +int ED_object_shaderfx_move_up(struct ReportList *reports, + struct Object *ob, + struct ShaderFxData *fx); /* object_select.c */ void ED_object_select_linked_by_id(struct bContext *C, struct ID *id); const struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( - const struct bContext *C, - struct PointerRNA *ptr, - struct PropertyRNA *prop, - bool *r_free, - const unsigned int selection_mask); + const struct bContext *C, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + bool *r_free, + const unsigned int selection_mask); -void ED_object_check_force_modifiers( - struct Main *bmain, struct Scene *scene, struct Object *object); +void ED_object_check_force_modifiers(struct Main *bmain, + struct Scene *scene, + struct Object *object); struct Base *ED_object_find_first_by_data_id(struct ViewLayer *view_layer, struct ID *id); -bool ED_object_jump_to_object( - struct bContext *C, struct Object *ob, - const bool reveal_hidden); -bool ED_object_jump_to_bone( - struct bContext *C, struct Object *ob, const char *bone_name, - const bool reveal_hidden); +bool ED_object_jump_to_object(struct bContext *C, struct Object *ob, const bool reveal_hidden); +bool ED_object_jump_to_bone(struct bContext *C, + struct Object *ob, + const char *bone_name, + const bool reveal_hidden); /* object_facemap_ops.c */ void ED_object_facemap_face_add(struct Object *ob, struct bFaceMap *fmap, int facenum); diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h index c59f1b9e927..88cc8a85897 100644 --- a/source/blender/editors/include/ED_paint.h +++ b/source/blender/editors/include/ED_paint.h @@ -36,7 +36,8 @@ void ED_keymap_paint(struct wmKeyConfig *keyconf); /* paint_image.c */ void ED_imapaint_clear_partial_redraw(void); -void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h, bool find_old); +void ED_imapaint_dirty_region( + struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h, bool find_old); void ED_imapaint_bucket_fill(struct bContext *C, float color[3], struct wmOperator *op); /* paint_image_undo.c */ diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 9cb0eb870ab..3ef3c0ba937 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -41,22 +41,29 @@ 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 Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); +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 Depsgraph *depsgraph, 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 */ -bool PE_mouse_particles(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +bool PE_mouse_particles( + struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); bool PE_box_select(struct bContext *C, const struct rcti *rect, const int sel_op); bool PE_circle_select(struct bContext *C, const int sel_op, const int mval[2], float rad); -int PE_lasso_select(struct bContext *C, const int mcords[][2], const short moves, const int sel_op); +int PE_lasso_select(struct bContext *C, + const int mcords[][2], + const short moves, + const int sel_op); bool PE_deselect_all_visible_ex(struct PTCacheEdit *edit); bool PE_deselect_all_visible(struct bContext *C); diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h index f37a5eeb666..1006a9d4f47 100644 --- a/source/blender/editors/include/ED_physics.h +++ b/source/blender/editors/include/ED_physics.h @@ -37,11 +37,19 @@ bool PE_hair_poll(struct bContext *C); bool PE_poll_view3d(struct bContext *C); /* rigidbody_object.c */ -bool ED_rigidbody_object_add(struct Main *bmain, struct Scene *scene, struct Object *ob, int type, struct ReportList *reports); +bool ED_rigidbody_object_add(struct Main *bmain, + struct Scene *scene, + struct Object *ob, + int type, + struct ReportList *reports); void ED_rigidbody_object_remove(struct Main *bmain, struct Scene *scene, struct Object *ob); /* rigidbody_constraint.c */ -bool ED_rigidbody_constraint_add(struct Main *bmain, struct Scene *scene, struct Object *ob, int type, struct ReportList *reports); +bool ED_rigidbody_constraint_add(struct Main *bmain, + struct Scene *scene, + struct Object *ob, + int type, + struct ReportList *reports); void ED_rigidbody_constraint_remove(struct Main *bmain, struct Scene *scene, struct Object *ob); /* operators */ diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index fd6818d6717..7689a9f97cd 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -65,18 +65,35 @@ struct Scene *ED_render_job_get_current_scene(const struct bContext *C); */ enum { - PR_BUTS_RENDER = 0, - PR_ICON_RENDER = 1, - PR_NODE_RENDER = 2, - PR_ICON_DEFERRED = 3, + PR_BUTS_RENDER = 0, + PR_ICON_RENDER = 1, + PR_NODE_RENDER = 2, + PR_ICON_DEFERRED = 3, }; void ED_preview_ensure_dbase(void); void ED_preview_free_dbase(void); -void ED_preview_shader_job(const struct bContext *C, void *owner, struct ID *id, struct ID *parent, struct MTex *slot, int sizex, int sizey, int method); -void ED_preview_icon_render(struct Main *bmain, struct Scene *scene, struct ID *id, unsigned int *rect, int sizex, int sizey); -void ED_preview_icon_job(const struct bContext *C, void *owner, struct ID *id, unsigned int *rect, int sizex, int sizey); +void ED_preview_shader_job(const struct bContext *C, + void *owner, + struct ID *id, + struct ID *parent, + struct MTex *slot, + int sizex, + int sizey, + int method); +void ED_preview_icon_render(struct Main *bmain, + struct Scene *scene, + struct ID *id, + unsigned int *rect, + int sizex, + int sizey); +void ED_preview_icon_job(const struct bContext *C, + void *owner, + struct ID *id, + unsigned int *rect, + int sizex, + int sizey); void ED_preview_kill_jobs(struct wmWindowManager *wm, struct Main *bmain); void ED_preview_draw(const struct bContext *C, void *idp, void *parentp, void *slot, rcti *rect); diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h index 08ead58fce6..99a9693ad19 100644 --- a/source/blender/editors/include/ED_scene.h +++ b/source/blender/editors/include/ED_scene.h @@ -25,12 +25,20 @@ 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 Scene *scene, struct ViewLayer *layer) 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); +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 Scene *scene, struct ViewLayer *layer) + 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); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 10a1eab265a..bcf9cb3fcc0 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -61,101 +61,117 @@ struct wmWindow; struct wmWindowManager; /* regions */ -void ED_region_do_listen( - struct wmWindow *win, 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_update_rect(struct ARegion *ar); -void ED_region_init(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_do_listen(struct wmWindow *win, + 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_update_rect(struct ARegion *ar); +void ED_region_init(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_ex( - const struct bContext *C, struct ARegion *ar, - const char *contexts[], int contextnr, const bool vertical); -void ED_region_panels( - const struct bContext *C, struct ARegion *ar); -void ED_region_panels_layout_ex( - const struct bContext *C, struct ARegion *ar, - const char *contexts[], int contextnr, const bool vertical); -void ED_region_panels_layout( - const struct bContext *C, struct ARegion *ar); -void ED_region_panels_draw( - const struct bContext *C, struct ARegion *ar); +void ED_region_panels_ex(const struct bContext *C, + struct ARegion *ar, + const char *contexts[], + int contextnr, + const bool vertical); +void ED_region_panels(const struct bContext *C, struct ARegion *ar); +void ED_region_panels_layout_ex(const struct bContext *C, + struct ARegion *ar, + const char *contexts[], + int contextnr, + const bool vertical); +void ED_region_panels_layout(const struct bContext *C, struct ARegion *ar); +void ED_region_panels_draw(const struct bContext *C, struct ARegion *ar); 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_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout); -void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy); -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); +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_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout); +void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy); +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); +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); +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); -int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); +void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); +int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); /* areas */ -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_screen_global_areas_refresh(struct wmWindow *win); -void ED_screen_global_areas_sync(struct wmWindow *win); -void ED_area_do_listen(struct wmWindow *win, ScrArea *sa, struct wmNotifier *note, Scene *scene); -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); +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_screen_global_areas_refresh(struct wmWindow *win); +void ED_screen_global_areas_sync(struct wmWindow *win); +void ED_area_do_listen(struct wmWindow *win, ScrArea *sa, struct wmNotifier *note, Scene *scene); +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); struct AZone *ED_area_azones_update(ScrArea *sa, const int mouse_xy[]); -void ED_area_status_text(ScrArea *sa, const char *str); -void ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool skip_ar_exit); -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_or_fallback(const ScrArea *area, int fallback); -int ED_area_header_alignment(const ScrArea *area); -int ED_area_footersize(void); -int ED_area_footer_alignment_or_fallback(const ScrArea *area, int fallback); -int ED_area_footer_alignment(const ScrArea *area); -int ED_area_global_size_y(const ScrArea *area); -int ED_area_global_min_size_y(const ScrArea *area); -int ED_area_global_max_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); +void ED_area_status_text(ScrArea *sa, const char *str); +void ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool skip_ar_exit); +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_or_fallback(const ScrArea *area, int fallback); +int ED_area_header_alignment(const ScrArea *area); +int ED_area_footersize(void); +int ED_area_footer_alignment_or_fallback(const ScrArea *area, int fallback); +int ED_area_footer_alignment(const ScrArea *area); +int ED_area_global_size_y(const ScrArea *area); +int ED_area_global_min_size_y(const ScrArea *area); +int ED_area_global_max_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); @@ -164,94 +180,105 @@ ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area); * 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) +#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 Main *bmain, struct wmWindowManager *wm); -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); -bool ED_screen_change(struct bContext *C, struct bScreen *sc); -void ED_screen_scene_change(struct bContext *C, struct wmWindow *win, struct Scene *scene); -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); -void ED_screen_restore_temp_type(struct bContext *C, ScrArea *sa); +void ED_screens_initialize(struct Main *bmain, struct wmWindowManager *wm); +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); +bool ED_screen_change(struct bContext *C, struct bScreen *sc); +void ED_screen_scene_change(struct bContext *C, struct wmWindow *win, struct Scene *scene); +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); +void ED_screen_restore_temp_type(struct bContext *C, ScrArea *sa); ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type); -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); -void ED_screens_footer_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); -void ED_screens_navigation_bar_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); -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); -ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, const struct SpaceLink *sl, const bool only_visible); -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(); +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); +void ED_screens_footer_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); +void ED_screens_navigation_bar_tools_menu_create(struct bContext *C, + struct uiLayout *layout, + void *arg); +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); +ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, + const struct SpaceLink *sl, + const bool only_visible); +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) 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(); -struct WorkSpaceLayout *ED_workspace_layout_add( - struct Main *bmain, - struct WorkSpace *workspace, - struct wmWindow *win, - const char *name) ATTR_NONNULL(); -struct WorkSpaceLayout *ED_workspace_layout_duplicate( - struct Main *bmain, - 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_status_text(struct bContext *C, const char *str); +struct WorkSpace *ED_workspace_add(struct Main *bmain, const char *name) 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(); +struct WorkSpaceLayout *ED_workspace_layout_add(struct Main *bmain, + struct WorkSpace *workspace, + struct wmWindow *win, + const char *name) ATTR_NONNULL(); +struct WorkSpaceLayout *ED_workspace_layout_duplicate(struct Main *bmain, + 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_status_text(struct bContext *C, const char *str); /* anim */ -void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph); +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); -bScreen *ED_screen_animation_playing(const struct wmWindowManager *wm); +void ED_refresh_viewport_fps(struct bContext *C); +int ED_screen_animation_play(struct bContext *C, int sync, int mode); +bScreen *ED_screen_animation_playing(const struct wmWindowManager *wm); bScreen *ED_screen_animation_no_scrub(const struct wmWindowManager *wm); /* screen keymaps */ -void ED_operatortypes_screen(void); -void ED_keymap_screen(struct wmKeyConfig *keyconf); +void ED_operatortypes_screen(void); +void ED_keymap_screen(struct wmKeyConfig *keyconf); /* workspace keymaps */ -void ED_operatortypes_workspace(void); +void ED_operatortypes_workspace(void); /* operators; context poll callbacks */ bool ED_operator_screenactive(struct bContext *C); @@ -281,7 +308,6 @@ bool ED_operator_nla_active(struct bContext *C); bool ED_operator_info_active(struct bContext *C); bool ED_operator_console_active(struct bContext *C); - bool ED_operator_object_active(struct bContext *C); bool ED_operator_object_active_editable(struct bContext *C); bool ED_operator_object_active_editable_mesh(struct bContext *C); @@ -314,43 +340,52 @@ bool ED_operator_camera(struct bContext *C); bUserMenu **ED_screen_user_menus_find(const struct bContext *C, uint *r_len); struct bUserMenu *ED_screen_user_menu_ensure(struct bContext *C); - -struct bUserMenuItem_Op *ED_screen_user_menu_item_find_operator( - struct ListBase *lb, - const struct wmOperatorType *ot, struct IDProperty *prop, short opcontext); -struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu( - struct ListBase *lb, - const struct MenuType *mt); -struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop( - struct ListBase *lb, - const char *context_data_path, const char *prop_id, int prop_index); - -void ED_screen_user_menu_item_add_operator( - struct ListBase *lb, const char *ui_name, - const struct wmOperatorType *ot, const struct IDProperty *prop, short opcontext); -void ED_screen_user_menu_item_add_menu( - struct ListBase *lb, const char *ui_name, - const struct MenuType *mt); -void ED_screen_user_menu_item_add_prop( - ListBase *lb, const char *ui_name, - const char *context_data_path, const char *prop_id, int prop_index); - -void ED_screen_user_menu_item_remove( - struct ListBase *lb, struct bUserMenuItem *umi); +struct bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(struct ListBase *lb, + const struct wmOperatorType *ot, + struct IDProperty *prop, + short opcontext); +struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu(struct ListBase *lb, + const struct MenuType *mt); +struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop(struct ListBase *lb, + const char *context_data_path, + const char *prop_id, + int prop_index); + +void ED_screen_user_menu_item_add_operator(struct ListBase *lb, + const char *ui_name, + const struct wmOperatorType *ot, + const struct IDProperty *prop, + short opcontext); +void ED_screen_user_menu_item_add_menu(struct ListBase *lb, + const char *ui_name, + const struct MenuType *mt); +void ED_screen_user_menu_item_add_prop(ListBase *lb, + const char *ui_name, + const char *context_data_path, + const char *prop_id, + int prop_index); + +void ED_screen_user_menu_item_remove(struct ListBase *lb, struct bUserMenuItem *umi); void ED_screen_user_menu_register(void); /* Cache display helpers */ void ED_region_cache_draw_background(const struct ARegion *ar); void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y); -void ED_region_cache_draw_cached_segments(const struct ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra); +void ED_region_cache_draw_cached_segments(const struct ARegion *ar, + const int num_segments, + const int *points, + const int sfra, + const int efra); /* area_utils.c */ -void ED_region_generic_tools_region_message_subscribe( - const struct bContext *C, - struct WorkSpace *workspace, struct Scene *scene, - struct bScreen *screen, struct ScrArea *sa, struct ARegion *ar, - struct wmMsgBus *mbus); +void ED_region_generic_tools_region_message_subscribe(const struct bContext *C, + struct WorkSpace *workspace, + struct Scene *scene, + struct bScreen *screen, + struct ScrArea *sa, + struct ARegion *ar, + struct wmMsgBus *mbus); int ED_region_generic_tools_region_snap_size(const struct ARegion *ar, int size, int axis); /* interface_region_hud.c */ @@ -360,22 +395,22 @@ void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *sa); /* default keymaps, bitflags (matches order of evaluation). */ enum { - ED_KEYMAP_UI = (1 << 1), - ED_KEYMAP_GIZMO = (1 << 2), - ED_KEYMAP_TOOL = (1 << 3), - ED_KEYMAP_VIEW2D = (1 << 4), - ED_KEYMAP_MARKERS = (1 << 5), - ED_KEYMAP_ANIMATION = (1 << 6), - ED_KEYMAP_FRAMES = (1 << 7), - ED_KEYMAP_HEADER = (1 << 8), - ED_KEYMAP_GPENCIL = (1 << 9), - ED_KEYMAP_FOOTER = (1 << 10), + ED_KEYMAP_UI = (1 << 1), + ED_KEYMAP_GIZMO = (1 << 2), + ED_KEYMAP_TOOL = (1 << 3), + ED_KEYMAP_VIEW2D = (1 << 4), + ED_KEYMAP_MARKERS = (1 << 5), + ED_KEYMAP_ANIMATION = (1 << 6), + ED_KEYMAP_FRAMES = (1 << 7), + ED_KEYMAP_HEADER = (1 << 8), + ED_KEYMAP_GPENCIL = (1 << 9), + ED_KEYMAP_FOOTER = (1 << 10), }; /* SCREEN_OT_space_context_cycle direction */ enum { - SPACE_CONTEXT_CYCLE_PREV, - SPACE_CONTEXT_CYCLE_NEXT, + SPACE_CONTEXT_CYCLE_PREV, + SPACE_CONTEXT_CYCLE_NEXT, }; #endif /* __ED_SCREEN_H__ */ diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 46b8a9b34de..3cbeab247ef 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -28,28 +28,28 @@ /* for animplayer */ typedef struct ScreenAnimData { - ARegion *ar; /* do not read from this, only for comparing if region exists */ - short redraws; - short refresh; - short flag; /* flags for playback */ - int sfra; /* frame that playback was started from */ - int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */ - double last_duration; /* used for frame dropping */ - bool from_anim_edit; /* playback was invoked from animation editor */ + ARegion *ar; /* do not read from this, only for comparing if region exists */ + short redraws; + short refresh; + short flag; /* flags for playback */ + int sfra; /* frame that playback was started from */ + int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */ + double last_duration; /* used for frame dropping */ + bool from_anim_edit; /* playback was invoked from animation editor */ } ScreenAnimData; /* for animplayer */ enum { - /* user-setting - frame range is played backwards */ - ANIMPLAY_FLAG_REVERSE = (1 << 0), - /* temporary - playback just jumped to the start/end */ - ANIMPLAY_FLAG_JUMPED = (1 << 1), - /* drop frames as needed to maintain framerate */ - ANIMPLAY_FLAG_SYNC = (1 << 2), - /* don't drop frames (and ignore SCE_FRAME_DROP flag) */ - ANIMPLAY_FLAG_NO_SYNC = (1 << 3), - /* use nextfra at next timer update */ - ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4), + /* user-setting - frame range is played backwards */ + ANIMPLAY_FLAG_REVERSE = (1 << 0), + /* temporary - playback just jumped to the start/end */ + ANIMPLAY_FLAG_JUMPED = (1 << 1), + /* drop frames as needed to maintain framerate */ + ANIMPLAY_FLAG_SYNC = (1 << 2), + /* don't drop frames (and ignore SCE_FRAME_DROP flag) */ + ANIMPLAY_FLAG_NO_SYNC = (1 << 3), + /* use nextfra at next timer update */ + ANIMPLAY_FLAG_USE_NEXT_FRAME = (1 << 4), }; /* ----------------------------------------------------- */ @@ -60,64 +60,64 @@ enum { * stored during runtime as scene->fps_info */ typedef struct ScreenFrameRateInfo { - double redrawtime; - double lredrawtime; - float redrawtimes_fps[REDRAW_FRAME_AVERAGE]; - short redrawtime_index; + double redrawtime; + double lredrawtime; + float redrawtimes_fps[REDRAW_FRAME_AVERAGE]; + short redrawtime_index; } ScreenFrameRateInfo; /* ----------------------------------------------------- */ /* Enum for Action Zone Edges. Which edge of area is action zone. */ typedef enum { - /** Region located on the left, _right_ edge is action zone. - * Region minimized to the top left */ - AE_RIGHT_TO_TOPLEFT, - /** Region located on the right, _left_ edge is action zone. - * Region minimized to the top right */ - AE_LEFT_TO_TOPRIGHT, - /** Region located at the bottom, _top_ edge is action zone. - * Region minimized to the bottom right */ - AE_TOP_TO_BOTTOMRIGHT, - /** Region located at the top, _bottom_ edge is action zone. - * Region minimized to the top left */ - AE_BOTTOM_TO_TOPLEFT, + /** Region located on the left, _right_ edge is action zone. + * Region minimized to the top left */ + AE_RIGHT_TO_TOPLEFT, + /** Region located on the right, _left_ edge is action zone. + * Region minimized to the top right */ + AE_LEFT_TO_TOPRIGHT, + /** Region located at the bottom, _top_ edge is action zone. + * Region minimized to the bottom right */ + AE_TOP_TO_BOTTOMRIGHT, + /** Region located at the top, _bottom_ edge is action zone. + * Region minimized to the top left */ + AE_BOTTOM_TO_TOPLEFT, } AZEdge; typedef enum { - AZ_SCROLL_VERT, - AZ_SCROLL_HOR, + AZ_SCROLL_VERT, + AZ_SCROLL_HOR, } AZScrollDirection; /* for editing areas/regions */ typedef struct AZone { - struct AZone *next, *prev; - ARegion *ar; - int type; + struct AZone *next, *prev; + ARegion *ar; + int type; - union { - /* region-azone, which of the edges (only for AZONE_REGION) */ - AZEdge edge; - AZScrollDirection direction; - }; - /* for draw */ - short x1, y1, x2, y2; - /* for clip */ - rcti rect; - /* for fade in/out */ - float alpha; + union { + /* region-azone, which of the edges (only for AZONE_REGION) */ + AZEdge edge; + AZScrollDirection direction; + }; + /* for draw */ + short x1, y1, x2, y2; + /* for clip */ + rcti rect; + /* for fade in/out */ + float alpha; } AZone; /* actionzone type */ 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, + /* 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 31b642165cd..86e108a26c6 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -37,7 +37,10 @@ struct rcti; /* sculpt.c */ void ED_operatortypes_sculpt(void); void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, struct Object *ob); -bool ED_sculpt_mask_box_select(struct bContext *C, struct ViewContext *vc, const struct rcti *rect, bool select); +bool ED_sculpt_mask_box_select(struct bContext *C, + struct ViewContext *vc, + const struct rcti *rect, + bool select); /* sculpt_undo.c */ void ED_sculpt_undosys_type(struct UndoType *ut); diff --git a/source/blender/editors/include/ED_select_utils.h b/source/blender/editors/include/ED_select_utils.h index 04ea1769c09..954e4335608 100644 --- a/source/blender/editors/include/ED_select_utils.h +++ b/source/blender/editors/include/ED_select_utils.h @@ -24,26 +24,26 @@ struct KDTree_1d; enum { - SEL_TOGGLE = 0, - SEL_SELECT = 1, - SEL_DESELECT = 2, - SEL_INVERT = 3, + SEL_TOGGLE = 0, + SEL_SELECT = 1, + SEL_DESELECT = 2, + SEL_INVERT = 3, }; /** See #WM_operator_properties_select_operation */ typedef enum { - SEL_OP_ADD = 1, - SEL_OP_SUB, - SEL_OP_SET, - SEL_OP_AND, - SEL_OP_XOR, + SEL_OP_ADD = 1, + SEL_OP_SUB, + SEL_OP_SET, + SEL_OP_AND, + SEL_OP_XOR, } eSelectOp; /* Select Similar */ enum { - SIM_CMP_EQ = 0, - SIM_CMP_GT, - SIM_CMP_LT, + SIM_CMP_EQ = 0, + SIM_CMP_GT, + SIM_CMP_LT, }; #define SEL_OP_USE_OUTSIDE(sel_op) (ELEM(sel_op, SEL_OP_AND)) @@ -52,11 +52,16 @@ enum { /* Use when we've de-selected all first for 'SEL_OP_SET' */ int ED_select_op_action(const eSelectOp sel_op, const bool is_select, const bool is_inside); -int ED_select_op_action_deselected(const eSelectOp sel_op, const bool is_select, const bool is_inside); +int ED_select_op_action_deselected(const eSelectOp sel_op, + const bool is_select, + const bool is_inside); int ED_select_similar_compare_float(const float delta, const float thresh, const int compare); -bool ED_select_similar_compare_float_tree(const struct KDTree_1d *tree, const float length, const float thresh, const int compare); +bool ED_select_similar_compare_float_tree(const struct KDTree_1d *tree, + const float length, + const float thresh, + const int compare); eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first); -#endif /* __ED_SELECT_UTILS_H__ */ +#endif /* __ED_SELECT_UTILS_H__ */ diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index 38f07e83572..2e89af4bb3f 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -28,7 +28,9 @@ struct Sequence; struct SpaceSeq; struct bContext; -void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, bool deselect_all); +void ED_sequencer_select_sequence_single(struct Scene *scene, + struct Sequence *seq, + bool deselect_all); void ED_sequencer_deselect_all(struct Scene *scene); bool ED_space_sequencer_maskedit_mask_poll(struct bContext *C); @@ -41,7 +43,7 @@ bool ED_space_sequencer_check_show_strip(struct SpaceSeq *sseq); void ED_operatormacros_sequencer(void); Sequence *ED_sequencer_special_preview_get(void); -void ED_sequencer_special_preview_set(struct bContext *C, const int mval[2]); -void ED_sequencer_special_preview_clear(void); +void ED_sequencer_special_preview_set(struct bContext *C, const int mval[2]); +void ED_sequencer_special_preview_clear(void); #endif /* __ED_SEQUENCER_H__ */ diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index 8495af9b36a..01de5fd8441 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -59,13 +59,14 @@ void ED_spacetype_topbar(void); void ED_file_init(void); void ED_file_exit(void); -#define REGION_DRAW_POST_VIEW 0 -#define REGION_DRAW_POST_PIXEL 1 -#define REGION_DRAW_PRE_VIEW 2 +#define REGION_DRAW_POST_VIEW 0 +#define REGION_DRAW_POST_PIXEL 1 +#define REGION_DRAW_PRE_VIEW 2 void *ED_region_draw_cb_activate(struct ARegionType *, void (*draw)(const struct bContext *, struct ARegion *, void *), - void *custumdata, int type); + void *custumdata, + int type); void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int); void ED_region_draw_cb_exit(struct ARegionType *, void *); /* generic callbacks */ diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h index 1260c531f54..7638249d49a 100644 --- a/source/blender/editors/include/ED_text.h +++ b/source/blender/editors/include/ED_text.h @@ -29,7 +29,10 @@ struct SpaceText; struct TextUndoBuf; struct UndoType; -bool ED_text_region_location_from_cursor(struct SpaceText *st, struct ARegion *ar, const int cursor_co[2], int r_pixel_co[2]); +bool ED_text_region_location_from_cursor(struct SpaceText *st, + struct ARegion *ar, + const int cursor_co[2], + int r_pixel_co[2]); /* text_undo.c */ void ED_text_undosys_type(struct UndoType *ut); diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 18573e92926..3605a245187 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -47,62 +47,65 @@ void transform_operatortypes(void); /* MODE AND NUMINPUT FLAGS */ enum TfmMode { - TFM_INIT = -1, - TFM_DUMMY, - TFM_TRANSLATION, - TFM_ROTATION, - TFM_RESIZE, - TFM_SKIN_RESIZE, - TFM_TOSPHERE, - TFM_SHEAR, - TFM_BEND, - TFM_SHRINKFATTEN, - TFM_TILT, - TFM_TRACKBALL, - TFM_PUSHPULL, - TFM_CREASE, - TFM_MIRROR, - TFM_BONESIZE, - TFM_BONE_ENVELOPE, - TFM_CURVE_SHRINKFATTEN, - TFM_MASK_SHRINKFATTEN, - TFM_GPENCIL_SHRINKFATTEN, - TFM_BONE_ROLL, - TFM_TIME_TRANSLATE, - TFM_TIME_SLIDE, - TFM_TIME_SCALE, - TFM_TIME_EXTEND, - TFM_TIME_DUPLICATE, - TFM_BAKE_TIME, - TFM_DEPRECATED, /* was BEVEL */ - TFM_BWEIGHT, - TFM_ALIGN, - TFM_EDGE_SLIDE, - TFM_VERT_SLIDE, - TFM_SEQ_SLIDE, - TFM_BONE_ENVELOPE_DIST, - TFM_NORMAL_ROTATION, - TFM_GPENCIL_OPACITY, + TFM_INIT = -1, + TFM_DUMMY, + TFM_TRANSLATION, + TFM_ROTATION, + TFM_RESIZE, + TFM_SKIN_RESIZE, + TFM_TOSPHERE, + TFM_SHEAR, + TFM_BEND, + TFM_SHRINKFATTEN, + TFM_TILT, + TFM_TRACKBALL, + TFM_PUSHPULL, + TFM_CREASE, + TFM_MIRROR, + TFM_BONESIZE, + TFM_BONE_ENVELOPE, + TFM_CURVE_SHRINKFATTEN, + TFM_MASK_SHRINKFATTEN, + TFM_GPENCIL_SHRINKFATTEN, + TFM_BONE_ROLL, + TFM_TIME_TRANSLATE, + TFM_TIME_SLIDE, + TFM_TIME_SCALE, + TFM_TIME_EXTEND, + TFM_TIME_DUPLICATE, + TFM_BAKE_TIME, + TFM_DEPRECATED, /* was BEVEL */ + TFM_BWEIGHT, + TFM_ALIGN, + TFM_EDGE_SLIDE, + TFM_VERT_SLIDE, + TFM_SEQ_SLIDE, + TFM_BONE_ENVELOPE_DIST, + TFM_NORMAL_ROTATION, + TFM_GPENCIL_OPACITY, }; /* TRANSFORM CONTEXTS */ -#define CTX_NONE 0 -#define CTX_TEXTURE (1 << 0) -#define CTX_EDGE (1 << 1) -#define CTX_NO_PET (1 << 2) -#define CTX_NO_MIRROR (1 << 3) -#define CTX_AUTOCONFIRM (1 << 4) -#define CTX_MOVIECLIP (1 << 6) -#define CTX_MASK (1 << 7) -#define CTX_PAINT_CURVE (1 << 8) +#define CTX_NONE 0 +#define CTX_TEXTURE (1 << 0) +#define CTX_EDGE (1 << 1) +#define CTX_NO_PET (1 << 2) +#define CTX_NO_MIRROR (1 << 3) +#define CTX_AUTOCONFIRM (1 << 4) +#define CTX_MOVIECLIP (1 << 6) +#define CTX_MASK (1 << 7) +#define CTX_PAINT_CURVE (1 << 8) #define CTX_GPENCIL_STROKES (1 << 9) -#define CTX_CURSOR (1 << 10) +#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) * (if 0 is returns, *vec is unmodified) * */ -bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]); +bool calculateTransformCenter(struct bContext *C, + int centerMode, + float cent3d[3], + float cent2d[2]); struct Object; struct Scene; @@ -121,34 +124,39 @@ struct bContext; void BIF_clearTransformOrientation(struct bContext *C); void BIF_removeTransformOrientation(struct bContext *C, struct TransformOrientation *ts); void BIF_removeTransformOrientationIndex(struct bContext *C, int index); -void BIF_createTransformOrientation(struct bContext *C, struct ReportList *reports, - const char *name, const bool use_view, - const bool activate, const bool overwrite); +void BIF_createTransformOrientation(struct bContext *C, + struct ReportList *reports, + const char *name, + const bool use_view, + const bool activate, + const bool overwrite); void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts); -void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const short around); +void ED_getTransformOrientationMatrix(const struct bContext *C, + float orientation_mat[3][3], + const short around); int BIF_countTransformOrientation(const struct bContext *C); /* to be able to add operator properties to other operators */ -#define P_MIRROR (1 << 0) -#define P_MIRROR_DUMMY (P_MIRROR | (1 << 9)) -#define P_PROPORTIONAL (1 << 1) +#define P_MIRROR (1 << 0) +#define P_MIRROR_DUMMY (P_MIRROR | (1 << 9)) +#define P_PROPORTIONAL (1 << 1) #define P_ORIENT_AXIS (1 << 2) #define P_ORIENT_AXIS_ORTHO (1 << 16) #define P_ORIENT_MATRIX (1 << 17) -#define P_SNAP (1 << 3) -#define P_GEO_SNAP (P_SNAP | (1 << 4)) -#define P_ALIGN_SNAP (P_GEO_SNAP | (1 << 5)) -#define P_CONSTRAINT (1 << 6) -#define P_OPTIONS (1 << 7) -#define P_CORRECT_UV (1 << 8) -#define P_NO_DEFAULTS (1 << 10) -#define P_NO_TEXSPACE (1 << 11) -#define P_CENTER (1 << 12) -#define P_GPENCIL_EDIT (1 << 13) -#define P_CURSOR_EDIT (1 << 14) +#define P_SNAP (1 << 3) +#define P_GEO_SNAP (P_SNAP | (1 << 4)) +#define P_ALIGN_SNAP (P_GEO_SNAP | (1 << 5)) +#define P_CONSTRAINT (1 << 6) +#define P_OPTIONS (1 << 7) +#define P_CORRECT_UV (1 << 8) +#define P_NO_DEFAULTS (1 << 10) +#define P_NO_TEXSPACE (1 << 11) +#define P_CENTER (1 << 12) +#define P_GPENCIL_EDIT (1 << 13) +#define P_CURSOR_EDIT (1 << 14) #define P_CLNOR_INVALIDATE (1 << 15) void Transform_Properties(struct wmOperatorType *ot, int flags); @@ -168,64 +176,70 @@ void ED_widgetgroup_gizmo2d_setup(const struct bContext *C, struct wmGizmoGroup void ED_widgetgroup_gizmo2d_refresh(const struct bContext *C, struct wmGizmoGroup *gzgroup); void ED_widgetgroup_gizmo2d_draw_prepare(const struct bContext *C, struct wmGizmoGroup *gzgroup); - /* Snapping */ #define SNAP_MIN_DISTANCE 30 #define SNAP_INCREMENTAL_ANGLE DEG2RAD(5.0) -bool peelObjectsTransform( - struct TransInfo *t, - const float mval[2], - const bool use_peel_object, - /* return args */ - float r_loc[3], float r_no[3], float *r_thickness); -bool peelObjectsSnapContext( - struct SnapObjectContext *sctx, - const float mval[2], - const struct SnapObjectParams *params, - const bool use_peel_object, - /* return args */ - float r_loc[3], float r_no[3], float *r_thickness); - -bool snapObjectsTransform( - struct TransInfo *t, const float mval[2], - float *dist_px, - /* return args */ - float r_loc[3], float r_no[3]); -bool snapNodesTransform( - struct TransInfo *t, const int mval[2], - /* return args */ - float r_loc[2], float *r_dist_px, char *r_node_border); - -void ED_transform_calc_orientation_from_type( - const struct bContext *C, float r_mat[3][3]); - void ED_transform_calc_orientation_from_type_ex( - const struct bContext *C, float r_mat[3][3], - /* extra args */ - struct Scene *scene, struct RegionView3D *rv3d, struct Object *ob, struct Object *obedit, - const short orientation_type, int orientation_index_custom, - const int pivot_point); +bool peelObjectsTransform(struct TransInfo *t, + const float mval[2], + const bool use_peel_object, + /* return args */ + float r_loc[3], + float r_no[3], + float *r_thickness); +bool peelObjectsSnapContext(struct SnapObjectContext *sctx, + const float mval[2], + const struct SnapObjectParams *params, + const bool use_peel_object, + /* return args */ + float r_loc[3], + float r_no[3], + float *r_thickness); + +bool snapObjectsTransform(struct TransInfo *t, + const float mval[2], + float *dist_px, + /* return args */ + float r_loc[3], + float r_no[3]); +bool snapNodesTransform(struct TransInfo *t, + const int mval[2], + /* return args */ + float r_loc[2], + float *r_dist_px, + char *r_node_border); + +void ED_transform_calc_orientation_from_type(const struct bContext *C, float r_mat[3][3]); +void ED_transform_calc_orientation_from_type_ex(const struct bContext *C, + float r_mat[3][3], + /* extra args */ + struct Scene *scene, + struct RegionView3D *rv3d, + struct Object *ob, + struct Object *obedit, + const short orientation_type, + int orientation_index_custom, + const int pivot_point); struct TransformBounds { - float center[3]; /* Center for transform widget. */ - float min[3], max[3]; /* Boundbox of selection for transform widget. */ + 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]; + /* 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; - ushort orientation_index_custom; + uint use_only_center : 1; + uint use_local_axis : 1; + /* Use 'Scene.orientation_type' when zero, otherwise subtract one and use. */ + ushort orientation_type; + ushort orientation_index_custom; }; -int ED_transform_calc_gizmo_stats( - const struct bContext *C, - const struct TransformCalcParams *params, - struct TransformBounds *tbounds); +int ED_transform_calc_gizmo_stats(const struct bContext *C, + const struct TransformCalcParams *params, + struct TransformBounds *tbounds); -#endif /* __ED_TRANSFORM_H__ */ +#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 688d01f7846..75564ddd947 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -40,95 +40,111 @@ struct bContext; /* ED_transform_snap_object_*** API */ typedef enum eSnapSelect { - SNAP_ALL = 0, - SNAP_NOT_SELECTED = 1, - SNAP_NOT_ACTIVE = 2, + SNAP_ALL = 0, + SNAP_NOT_SELECTED = 1, + SNAP_NOT_ACTIVE = 2, } eSnapSelect; /** used for storing multiple hits */ struct SnapObjectHitDepth { - struct SnapObjectHitDepth *next, *prev; + struct SnapObjectHitDepth *next, *prev; - float depth; - float co[3]; - float no[3]; - int index; + float depth; + float co[3]; + float no[3]; + int index; - struct Object *ob; - float obmat[4][4]; + struct Object *ob; + float obmat[4][4]; - /* needed to tell which ray-cast this was part of, - * the same object may be part of many ray-casts when dupli's are used. */ - unsigned int ob_uuid; + /* needed to tell which ray-cast this was part of, + * the same object may be part of many ray-casts when dupli's are used. */ + unsigned int ob_uuid; }; /** parameters that define which objects will be used to snap. */ struct SnapObjectParams { - /* special context sensitive handling for the active or selected object */ - 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; + /* special context sensitive handling for the active or selected object */ + 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, struct Depsgraph *depsgraph, int flag); -SnapObjectContext *ED_transform_snap_object_context_create_view3d( - struct Main *bmain, struct Scene *scene, struct Depsgraph *depsgraph, int flag, - /* extra args for view3d */ - const struct ARegion *ar, const struct View3D *v3d); +SnapObjectContext *ED_transform_snap_object_context_create(struct Main *bmain, + struct Scene *scene, + struct Depsgraph *depsgraph, + int flag); +SnapObjectContext *ED_transform_snap_object_context_create_view3d(struct Main *bmain, + 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); /* callbacks to filter how snap works */ void ED_transform_snap_object_context_set_editmesh_callbacks( - SnapObjectContext *sctx, - bool (*test_vert_fn)(struct BMVert *, void *user_data), - bool (*test_edge_fn)(struct BMEdge *, void *user_data), - bool (*test_face_fn)(struct BMFace *, void *user_data), - void *user_data); - -bool ED_transform_snap_object_project_ray_ex( - struct SnapObjectContext *sctx, - const struct SnapObjectParams *params, - const float ray_start[3], const float ray_normal[3], float *ray_depth, - /* return args */ - 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_ray( - SnapObjectContext *sctx, - const struct SnapObjectParams *params, - const float ray_origin[3], const float ray_direction[3], float *ray_depth, - float r_co[3], float r_no[3]); - -bool ED_transform_snap_object_project_ray_all( - SnapObjectContext *sctx, - const struct SnapObjectParams *params, - const float ray_start[3], const float ray_normal[3], - float ray_depth, bool sort, - struct ListBase *r_hit_list); - -bool ED_transform_snap_object_project_view3d_ex( - struct SnapObjectContext *sctx, - const unsigned short snap_to, - const struct SnapObjectParams *params, - const float mval[2], float *dist_px, - 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( - struct SnapObjectContext *sctx, - const unsigned short snap_to, - const struct SnapObjectParams *params, - const float mval[2], float *dist_px, - /* return args */ - float r_loc[3], float r_no[3]); - -bool ED_transform_snap_object_project_all_view3d_ex( - SnapObjectContext *sctx, - const struct SnapObjectParams *params, - const float mval[2], - float ray_depth, bool sort, - ListBase *r_hit_list); - -#endif /* __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__ */ + SnapObjectContext *sctx, + bool (*test_vert_fn)(struct BMVert *, void *user_data), + bool (*test_edge_fn)(struct BMEdge *, void *user_data), + bool (*test_face_fn)(struct BMFace *, void *user_data), + void *user_data); + +bool ED_transform_snap_object_project_ray_ex(struct SnapObjectContext *sctx, + const struct SnapObjectParams *params, + const float ray_start[3], + const float ray_normal[3], + float *ray_depth, + /* return args */ + 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_ray(SnapObjectContext *sctx, + const struct SnapObjectParams *params, + const float ray_origin[3], + const float ray_direction[3], + float *ray_depth, + float r_co[3], + float r_no[3]); + +bool ED_transform_snap_object_project_ray_all(SnapObjectContext *sctx, + const struct SnapObjectParams *params, + const float ray_start[3], + const float ray_normal[3], + float ray_depth, + bool sort, + struct ListBase *r_hit_list); + +bool ED_transform_snap_object_project_view3d_ex(struct SnapObjectContext *sctx, + const unsigned short snap_to, + const struct SnapObjectParams *params, + const float mval[2], + float *dist_px, + 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(struct SnapObjectContext *sctx, + const unsigned short snap_to, + const struct SnapObjectParams *params, + const float mval[2], + float *dist_px, + /* return args */ + float r_loc[3], + float r_no[3]); + +bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, + const struct SnapObjectParams *params, + const float mval[2], + float ray_depth, + bool sort, + ListBase *r_hit_list); + +#endif /* __ED_TRANSFORM_SNAP_OBJECT_CONTEXT_H__ */ diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h index d03cd0151a6..3460aae32c0 100644 --- a/source/blender/editors/include/ED_transverts.h +++ b/source/blender/editors/include/ED_transverts.h @@ -27,16 +27,16 @@ struct Object; typedef struct TransVert { - float *loc; - float oldloc[3], maploc[3]; - float normal[3]; - int flag; + float *loc; + float oldloc[3], maploc[3]; + float normal[3]; + int flag; } TransVert; typedef struct TransVertStore { - struct TransVert *transverts; - int transverts_tot; - int mode; + struct TransVert *transverts; + int transverts_tot; + int mode; } TransVertStore; void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit, const int mode); @@ -47,25 +47,25 @@ bool ED_transverts_poll(struct bContext *C); /* currently only used for bmesh index values */ enum { - TM_INDEX_ON = 1, /* tag to make trans verts */ - TM_INDEX_OFF = 0, /* don't make verts */ - TM_INDEX_SKIP = -1, /* dont make verts (when the index values point to trans-verts) */ + TM_INDEX_ON = 1, /* tag to make trans verts */ + TM_INDEX_OFF = 0, /* don't make verts */ + TM_INDEX_SKIP = -1, /* dont make verts (when the index values point to trans-verts) */ }; /* mode flags: */ enum { - /** all joints (for bones only) */ - TM_ALL_JOINTS = (1 << 0), - /** skip handles when control point is selected (for curves only) */ - TM_SKIP_HANDLES = (1 << 1), - /** fill in normals when available */ - TM_CALC_NORMALS = (1 << 2), + /** all joints (for bones only) */ + TM_ALL_JOINTS = (1 << 0), + /** skip handles when control point is selected (for curves only) */ + TM_SKIP_HANDLES = (1 << 1), + /** fill in normals when available */ + TM_CALC_NORMALS = (1 << 2), }; enum { - /* SELECT == (1 << 0) */ - TX_VERT_USE_MAPLOC = (1 << 1), - TX_VERT_USE_NORMAL = (1 << 2), /* avoid nonzero check */ + /* SELECT == (1 << 0) */ + TX_VERT_USE_MAPLOC = (1 << 1), + TX_VERT_USE_NORMAL = (1 << 2), /* avoid nonzero check */ }; -#endif /* __ED_TRANSVERTS_H__ */ +#endif /* __ED_TRANSVERTS_H__ */ diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 7040a2ef6c1..4b18bb699a9 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -28,13 +28,11 @@ /* old blender defines... should be deprecated? */ #define DESELECT 0 -#define SELECT 1 -#define ACTIVE 2 +#define SELECT 1 +#define ACTIVE 2 /* proposal = put scene pointers on function calls? */ // #define BASACT (scene->basact) // #define OBACT (BASACT ? BASACT->object : NULL) - - #endif /* __ED_TYPES_H__ */ diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h index 12839e36a12..ebc50e186a2 100644 --- a/source/blender/editors/include/ED_undo.h +++ b/source/blender/editors/include/ED_undo.h @@ -32,37 +32,40 @@ struct wmOperator; struct wmOperatorType; /* undo.c */ -void ED_undo_push(struct bContext *C, const char *str); -void ED_undo_push_op(struct bContext *C, struct wmOperator *op); -void ED_undo_grouped_push(struct bContext *C, const char *str); -void ED_undo_grouped_push_op(struct bContext *C, struct wmOperator *op); -void ED_undo_pop_op(struct bContext *C, struct wmOperator *op); -void ED_undo_pop(struct bContext *C); -void ED_undo_redo(struct bContext *C); -void ED_OT_undo(struct wmOperatorType *ot); -void ED_OT_undo_push(struct wmOperatorType *ot); -void ED_OT_redo(struct wmOperatorType *ot); -void ED_OT_undo_redo(struct wmOperatorType *ot); -void ED_OT_undo_history(struct wmOperatorType *ot); +void ED_undo_push(struct bContext *C, const char *str); +void ED_undo_push_op(struct bContext *C, struct wmOperator *op); +void ED_undo_grouped_push(struct bContext *C, const char *str); +void ED_undo_grouped_push_op(struct bContext *C, struct wmOperator *op); +void ED_undo_pop_op(struct bContext *C, struct wmOperator *op); +void ED_undo_pop(struct bContext *C); +void ED_undo_redo(struct bContext *C); +void ED_OT_undo(struct wmOperatorType *ot); +void ED_OT_undo_push(struct wmOperatorType *ot); +void ED_OT_redo(struct wmOperatorType *ot); +void ED_OT_undo_redo(struct wmOperatorType *ot); +void ED_OT_undo_history(struct wmOperatorType *ot); -int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); +int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); /* convenience since UI callbacks use this mostly*/ -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); +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); -bool ED_undo_is_valid(const struct bContext *C, const char *undoname); +bool ED_undo_is_valid(const struct bContext *C, const char *undoname); -bool ED_undo_is_memfile_compatible(const struct bContext *C); +bool ED_undo_is_memfile_compatible(const struct bContext *C); -void ED_undo_object_editmode_restore_helper( - struct bContext *C, - struct Object **object_array, uint object_array_len, uint object_array_stride); +void ED_undo_object_editmode_restore_helper(struct bContext *C, + struct Object **object_array, + uint object_array_len, + uint object_array_stride); 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); +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); diff --git a/source/blender/editors/include/ED_userpref.h b/source/blender/editors/include/ED_userpref.h index 29470608933..686b8a689f0 100644 --- a/source/blender/editors/include/ED_userpref.h +++ b/source/blender/editors/include/ED_userpref.h @@ -23,4 +23,4 @@ void ED_operatortypes_userpref(void); -#endif /* __ED_USERPREF_H__ */ +#endif /* __ED_USERPREF_H__ */ diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index b275b776ddd..87f57b4e144 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -36,15 +36,24 @@ void ED_editors_init(struct bContext *C); void ED_editors_exit(struct Main *bmain, bool do_undo_system); bool ED_editors_flush_edits(struct Main *bmain, bool for_render); -void ED_spacedata_id_remap(struct ScrArea *sa, struct SpaceLink *sl, struct ID *old_id, struct ID *new_id); +void ED_spacedata_id_remap(struct ScrArea *sa, + struct SpaceLink *sl, + struct ID *old_id, + struct ID *new_id); void ED_OT_flush_edits(struct wmOperatorType *ot); /* ************** XXX OLD CRUFT WARNING ************* */ -void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert); +void apply_keyb_grid( + int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert); /* where else to go ? */ -void unpack_menu(struct bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf); +void unpack_menu(struct bContext *C, + const char *opname, + const char *id_name, + const char *abs_name, + const char *folder, + struct PackedFile *pf); #endif /* __ED_UTIL_H__ */ diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index b0d1f7a014a..9259afd1d5f 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -46,90 +46,126 @@ struct wmKeyConfig; void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); -bool ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]); +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); -void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima); +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); +void ED_object_assign_active_image(struct Main *bmain, + struct Object *ob, + int mat_nr, + struct Image *ima); bool ED_uvedit_test(struct Object *obedit); /* visibility and selection */ -bool uvedit_face_visible_nolocal_ex( - const struct ToolSettings *ts, struct BMFace *efa); -bool uvedit_face_visible_test_ex( - const struct ToolSettings *ts, struct Object *obedit, struct Image *ima, struct BMFace *efa); -bool uvedit_face_select_test_ex( - const struct ToolSettings *ts, struct BMFace *efa, - const int cd_loop_uv_offset); -bool uvedit_edge_select_test_ex( - const struct ToolSettings *ts, struct BMLoop *l, - const int cd_loop_uv_offset); -bool uvedit_uv_select_test_ex( - const struct ToolSettings *ts, struct BMLoop *l, - const int cd_loop_uv_offset); - -bool uvedit_face_visible_nolocal( - struct Scene *scene, struct BMFace *efa); -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); -bool uvedit_edge_select_test( - struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); -bool uvedit_uv_select_test( - struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); +bool uvedit_face_visible_nolocal_ex(const struct ToolSettings *ts, struct BMFace *efa); +bool uvedit_face_visible_test_ex(const struct ToolSettings *ts, + struct Object *obedit, + struct Image *ima, + struct BMFace *efa); +bool uvedit_face_select_test_ex(const struct ToolSettings *ts, + struct BMFace *efa, + const int cd_loop_uv_offset); +bool uvedit_edge_select_test_ex(const struct ToolSettings *ts, + struct BMLoop *l, + const int cd_loop_uv_offset); +bool uvedit_uv_select_test_ex(const struct ToolSettings *ts, + struct BMLoop *l, + const int cd_loop_uv_offset); + +bool uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa); +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); +bool uvedit_edge_select_test(struct Scene *scene, struct BMLoop *l, const int cd_loop_uv_offset); +bool uvedit_uv_select_test(struct Scene *scene, struct BMLoop *l, const int cd_loop_uv_offset); /* uv face */ -bool uvedit_face_select_set( - struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, - const bool do_history, const int cd_loop_uv_offset); -bool uvedit_face_select_enable( - struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const bool do_history, const int cd_loop_uv_offset); -bool uvedit_face_select_disable( - struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const int cd_loop_uv_offset); +bool uvedit_face_select_set(struct Scene *scene, + struct BMEditMesh *em, + struct BMFace *efa, + const bool select, + const bool do_history, + const int cd_loop_uv_offset); +bool uvedit_face_select_enable(struct Scene *scene, + struct BMEditMesh *em, + struct BMFace *efa, + const bool do_history, + const int cd_loop_uv_offset); +bool uvedit_face_select_disable(struct Scene *scene, + struct BMEditMesh *em, + struct BMFace *efa, + const int cd_loop_uv_offset); /* uv edge */ -void uvedit_edge_select_set( - struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const bool select, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_edge_select_enable( - struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_edge_select_disable( - struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); +void uvedit_edge_select_set(struct BMEditMesh *em, + struct Scene *scene, + struct BMLoop *l, + const bool select, + const bool do_history, + const int cd_loop_uv_offset); +void uvedit_edge_select_enable(struct BMEditMesh *em, + struct Scene *scene, + struct BMLoop *l, + const bool do_history, + const int cd_loop_uv_offset); +void uvedit_edge_select_disable(struct BMEditMesh *em, + struct Scene *scene, + struct BMLoop *l, + const int cd_loop_uv_offset); /* uv vert */ -void uvedit_uv_select_set( - struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const bool select, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_uv_select_enable( - struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const bool do_history, const int cd_loop_uv_offset); -void uvedit_uv_select_disable( - struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, - const int cd_loop_uv_offset); - -bool ED_uvedit_nearest_uv( - struct Scene *scene, struct Object *obedit, struct Image *ima, const float co[2], - float *dist_sq, float r_uv[2]); -bool ED_uvedit_nearest_uv_multi( - struct Scene *scene, struct Image *ima, - struct Object **objects, const uint objects_len, const float co[2], - float *dist_sq, float r_uv[2]); - -void ED_uvedit_get_aspect(struct Scene *scene, struct Object *ob, struct BMesh *em, float *aspx, float *aspy); +void uvedit_uv_select_set(struct BMEditMesh *em, + struct Scene *scene, + struct BMLoop *l, + const bool select, + const bool do_history, + const int cd_loop_uv_offset); +void uvedit_uv_select_enable(struct BMEditMesh *em, + struct Scene *scene, + struct BMLoop *l, + const bool do_history, + const int cd_loop_uv_offset); +void uvedit_uv_select_disable(struct BMEditMesh *em, + struct Scene *scene, + struct BMLoop *l, + const int cd_loop_uv_offset); + +bool ED_uvedit_nearest_uv(struct Scene *scene, + struct Object *obedit, + struct Image *ima, + const float co[2], + float *dist_sq, + float r_uv[2]); +bool ED_uvedit_nearest_uv_multi(struct Scene *scene, + struct Image *ima, + struct Object **objects, + const uint objects_len, + const float co[2], + float *dist_sq, + float r_uv[2]); + +void ED_uvedit_get_aspect( + struct Scene *scene, struct Object *ob, struct BMesh *em, float *aspx, float *aspy); /* uvedit_unwrap_ops.c */ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit); @@ -139,14 +175,15 @@ void ED_uvedit_live_unwrap_end(short cancel); void ED_uvedit_live_unwrap(struct Scene *scene, struct Object **objects, int objects_len); void ED_uvedit_add_simple_uvs(struct Main *bmain, struct Scene *scene, struct Object *ob); - /* uvedit_draw.c */ -void ED_image_draw_cursor( - struct ARegion *ar, const float cursor[2]); -void ED_uvedit_draw_main( - struct SpaceImage *sima, - struct ARegion *ar, struct Scene *scene, struct ViewLayer *view_layer, - struct Object *obedit, struct Object *obact, struct Depsgraph *depsgraph); +void ED_image_draw_cursor(struct ARegion *ar, const float cursor[2]); +void ED_uvedit_draw_main(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 4c03be3bd5a..e747dda95d4 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -72,53 +72,57 @@ enum eGPUFXFlags; /* for derivedmesh drawing callbacks, for view3d_select, .... */ typedef struct ViewContext { - struct bContext *C; - struct Main *bmain; - struct Depsgraph *depsgraph; - struct Scene *scene; - struct ViewLayer *view_layer; - struct Object *obact; - struct Object *obedit; - struct ARegion *ar; - struct View3D *v3d; - struct wmWindow *win; - struct RegionView3D *rv3d; - struct BMEditMesh *em; - int mval[2]; + struct bContext *C; + struct Main *bmain; + struct Depsgraph *depsgraph; + struct Scene *scene; + struct ViewLayer *view_layer; + struct Object *obact; + struct Object *obedit; + struct ARegion *ar; + struct View3D *v3d; + struct wmWindow *win; + struct RegionView3D *rv3d; + struct BMEditMesh *em; + int mval[2]; } ViewContext; typedef struct ViewDepths { - unsigned short w, h; - short x, y; /* only for temp use for sub-rects, added to ar->winx/y */ - float *depths; - double depth_range[2]; + unsigned short w, h; + short x, y; /* only for temp use for sub-rects, added to ar->winx/y */ + float *depths; + double depth_range[2]; - bool damaged; + bool damaged; } ViewDepths; - /* Rotate 3D cursor on placement. */ enum eV3DCursorOrient { - V3D_CURSOR_ORIENT_NONE = 0, - V3D_CURSOR_ORIENT_VIEW, - V3D_CURSOR_ORIENT_XFORM, - V3D_CURSOR_ORIENT_GEOM, + V3D_CURSOR_ORIENT_NONE = 0, + V3D_CURSOR_ORIENT_VIEW, + V3D_CURSOR_ORIENT_XFORM, + V3D_CURSOR_ORIENT_GEOM, }; -void ED_view3d_background_color_get(const struct Scene *scene, const struct View3D *v3d, float r_color[3]); +void ED_view3d_background_color_get(const struct Scene *scene, + const struct View3D *v3d, + float r_color[3]); void ED_view3d_cursor3d_calc_mat3(const struct Scene *scene, float mat[3][3]); void ED_view3d_cursor3d_calc_mat4(const struct Scene *scene, float mat[4][4]); -void ED_view3d_cursor3d_position( - struct bContext *C, const int mval[2], - const bool use_depth, - float cursor_co[3]); -void ED_view3d_cursor3d_position_rotation( - struct bContext *C, const int mval[2], - const bool use_depth, enum eV3DCursorOrient orientation, - float cursor_co[3], float cursor_quat[4]); -void ED_view3d_cursor3d_update( - struct bContext *C, const int mval[2], - const bool use_depth, enum eV3DCursorOrient orientation); +void ED_view3d_cursor3d_position(struct bContext *C, + const int mval[2], + const bool use_depth, + float cursor_co[3]); +void ED_view3d_cursor3d_position_rotation(struct bContext *C, + const int mval[2], + const bool use_depth, + enum eV3DCursorOrient orientation, + float cursor_co[3], + float cursor_quat[4]); +void ED_view3d_cursor3d_update(struct bContext *C, + const int mval[2], + const bool use_depth, + enum eV3DCursorOrient orientation); struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d); @@ -126,289 +130,393 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], 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); + 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); /* Depth buffer */ -void ED_view3d_depth_update(struct ARegion *ar); +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 int mval[2], - float r_normal[3]); -bool ED_view3d_depth_unproject( - 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); +bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, + const int mval[2], + float r_normal[3]); +bool ED_view3d_depth_unproject(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); /* Projection */ -#define IS_CLIPPED 12000 +#define IS_CLIPPED 12000 /* return values for ED_view3d_project_...() */ typedef enum { - V3D_PROJ_RET_OK = 0, - /** can't avoid this when in perspective mode, (can't avoid) */ - V3D_PROJ_RET_CLIP_NEAR = 1, - /** so close to zero we can't apply a perspective matrix usefully */ - V3D_PROJ_RET_CLIP_ZERO = 2, - /** bounding box clip - RV3D_CLIPPING */ - V3D_PROJ_RET_CLIP_BB = 3, - /** outside window bounds */ - V3D_PROJ_RET_CLIP_WIN = 4, - /** outside range (mainly for short), (can't avoid) */ - V3D_PROJ_RET_OVERFLOW = 5, + V3D_PROJ_RET_OK = 0, + /** can't avoid this when in perspective mode, (can't avoid) */ + V3D_PROJ_RET_CLIP_NEAR = 1, + /** so close to zero we can't apply a perspective matrix usefully */ + V3D_PROJ_RET_CLIP_ZERO = 2, + /** bounding box clip - RV3D_CLIPPING */ + V3D_PROJ_RET_CLIP_BB = 3, + /** outside window bounds */ + V3D_PROJ_RET_CLIP_WIN = 4, + /** outside range (mainly for short), (can't avoid) */ + V3D_PROJ_RET_OVERFLOW = 5, } eV3DProjStatus; /* some clipping tests are optional */ typedef enum { - V3D_PROJ_TEST_NOP = 0, - V3D_PROJ_TEST_CLIP_BB = (1 << 0), - V3D_PROJ_TEST_CLIP_WIN = (1 << 1), - V3D_PROJ_TEST_CLIP_NEAR = (1 << 2), - V3D_PROJ_TEST_CLIP_ZERO = (1 << 3), + V3D_PROJ_TEST_NOP = 0, + V3D_PROJ_TEST_CLIP_BB = (1 << 0), + V3D_PROJ_TEST_CLIP_WIN = (1 << 1), + V3D_PROJ_TEST_CLIP_NEAR = (1 << 2), + V3D_PROJ_TEST_CLIP_ZERO = (1 << 3), } eV3DProjTest; #define V3D_PROJ_TEST_CLIP_DEFAULT \ - (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) + (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) #define V3D_PROJ_TEST_ALL \ - (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR | V3D_PROJ_TEST_CLIP_ZERO) - + (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR | \ + V3D_PROJ_TEST_CLIP_ZERO) /* view3d_iterators.c */ /* foreach iterators */ void meshobject_foreachScreenVert( - struct ViewContext *vc, - void (*func)(void *userData, struct MVert *eve, const float screen_co[2], int index), - void *userData, const eV3DProjTest clip_flag); + struct ViewContext *vc, + void (*func)(void *userData, struct MVert *eve, const float screen_co[2], int index), + void *userData, + const eV3DProjTest clip_flag); void mesh_foreachScreenVert( - struct ViewContext *vc, - void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index), - void *userData, const eV3DProjTest clip_flag); -void mesh_foreachScreenEdge( - struct ViewContext *vc, - void (*func)(void *userData, struct BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], - int index), - void *userData, const eV3DProjTest clip_flag); + struct ViewContext *vc, + void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index), + void *userData, + const eV3DProjTest clip_flag); +void mesh_foreachScreenEdge(struct ViewContext *vc, + void (*func)(void *userData, + struct BMEdge *eed, + const float screen_co_a[2], + const float screen_co_b[2], + int index), + void *userData, + const eV3DProjTest clip_flag); void mesh_foreachScreenFace( - struct ViewContext *vc, - void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index), - void *userData, const eV3DProjTest clip_flag); -void nurbs_foreachScreenVert( - struct ViewContext *vc, - void (*func)(void *userData, struct Nurb *nu, struct BPoint *bp, struct BezTriple *bezt, - int beztindex, const float screen_co[2]), - void *userData, const eV3DProjTest clip_flag); -void mball_foreachScreenElem( - struct ViewContext *vc, - void (*func)(void *userData, struct MetaElem *ml, const float screen_co[2]), - void *userData, const eV3DProjTest clip_flag); -void lattice_foreachScreenVert( - struct ViewContext *vc, - void (*func)(void *userData, struct BPoint *bp, - const float screen_co[2]), - void *userData, const eV3DProjTest clip_flag); -void armature_foreachScreenBone( - struct ViewContext *vc, - void (*func)(void *userData, struct EditBone *ebone, - const float screen_co_a[2], const float screen_co_b[2]), - void *userData, const eV3DProjTest clip_flag); -void pose_foreachScreenBone( - struct ViewContext *vc, - void (*func)(void *userData, struct bPoseChannel *pchan, - const float screen_co_a[2], const float screen_co_b[2]), - void *userData, const eV3DProjTest clip_flag); + struct ViewContext *vc, + void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index), + void *userData, + const eV3DProjTest clip_flag); +void nurbs_foreachScreenVert(struct ViewContext *vc, + void (*func)(void *userData, + struct Nurb *nu, + struct BPoint *bp, + struct BezTriple *bezt, + int beztindex, + const float screen_co[2]), + void *userData, + const eV3DProjTest clip_flag); +void mball_foreachScreenElem(struct ViewContext *vc, + void (*func)(void *userData, + struct MetaElem *ml, + const float screen_co[2]), + void *userData, + const eV3DProjTest clip_flag); +void lattice_foreachScreenVert(struct ViewContext *vc, + void (*func)(void *userData, + struct BPoint *bp, + const float screen_co[2]), + void *userData, + const eV3DProjTest clip_flag); +void armature_foreachScreenBone(struct ViewContext *vc, + void (*func)(void *userData, + struct EditBone *ebone, + const float screen_co_a[2], + const float screen_co_b[2]), + void *userData, + const eV3DProjTest clip_flag); +void pose_foreachScreenBone(struct ViewContext *vc, + void (*func)(void *userData, + struct bPoseChannel *pchan, + const float screen_co_a[2], + const float screen_co_b[2]), + void *userData, + const eV3DProjTest clip_flag); /* *** end iterators *** */ - /* view3d_project.c */ -void ED_view3d_project_float_v2_m4(const struct ARegion *ar, const float co[3], float r_co[2], float mat[4][4]); -void ED_view3d_project_float_v3_m4(const struct ARegion *ar, const float co[3], float r_co[3], float mat[4][4]); +void ED_view3d_project_float_v2_m4(const struct ARegion *ar, + const float co[3], + float r_co[2], + float mat[4][4]); +void ED_view3d_project_float_v3_m4(const struct ARegion *ar, + const float co[3], + float r_co[3], + float mat[4][4]); eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *base); /* *** short *** */ -eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local, - const float co[3], short r_co[2], const eV3DProjTest flag); -eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag); -eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *ar, const float co[3], short r_co[2], const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar, + float perspmat[4][4], + const bool is_local, + const float co[3], + short r_co[2], + const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *ar, + const float co[3], + short r_co[2], + const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *ar, + const float co[3], + short r_co[2], + const eV3DProjTest flag); /* *** int *** */ -eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local, - const float co[3], int r_co[2], const eV3DProjTest flag); -eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag); -eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *ar, const float co[3], int r_co[2], const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *ar, + float perspmat[4][4], + const bool is_local, + const float co[3], + int r_co[2], + const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *ar, + const float co[3], + int r_co[2], + const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *ar, + const float co[3], + int r_co[2], + const eV3DProjTest flag); /* *** float *** */ -eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *ar, float perspmat[4][4], const bool is_local, - const float co[3], float r_co[2], const eV3DProjTest flag); -eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag); -eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar, const float co[3], float r_co[2], const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *ar, + float perspmat[4][4], + const bool is_local, + const float co[3], + float r_co[2], + const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *ar, + const float co[3], + float r_co[2], + const eV3DProjTest flag); +eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar, + const float co[3], + float r_co[2], + const eV3DProjTest flag); float ED_view3d_pixel_size(const struct RegionView3D *rv3d, const float co[3]); float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const float co[3]); 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_clipped( - 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_clipped_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_win_to_ray( - const struct ARegion *ar, const float mval[2], - float r_ray_start[3], float r_ray_normal[3]); -void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]); -void ED_view3d_win_to_3d( - const struct View3D *v3d, const struct ARegion *ar, - const float depth_pt[3], const float mval[2], - float r_out[3]); -void ED_view3d_win_to_3d_int( - const struct View3D *v3d, const struct ARegion *ar, - const float depth_pt[3], const int mval[2], - float r_out[3]); -bool ED_view3d_win_to_3d_on_plane( - const struct ARegion *ar, - const float plane[4], const float mval[2], const bool do_clip, - float r_out[3]); -bool ED_view3d_win_to_3d_on_plane_int( - const struct ARegion *ar, - const float plane[4], const int mval[2], const bool do_clip, - float r_out[3]); -void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac); +bool ED_view3d_win_to_ray_clipped(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_clipped_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_win_to_ray(const struct ARegion *ar, + const float mval[2], + float r_ray_start[3], + float r_ray_normal[3]); +void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, + const float coord[3], + float vec[3]); +void ED_view3d_win_to_3d(const struct View3D *v3d, + const struct ARegion *ar, + const float depth_pt[3], + const float mval[2], + float r_out[3]); +void ED_view3d_win_to_3d_int(const struct View3D *v3d, + const struct ARegion *ar, + const float depth_pt[3], + const int mval[2], + float r_out[3]); +bool ED_view3d_win_to_3d_on_plane(const struct ARegion *ar, + const float plane[4], + const float mval[2], + const bool do_clip, + float r_out[3]); +bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *ar, + const float plane[4], + const int mval[2], + const bool do_clip, + float r_out[3]); +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_clipped( - 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]); +bool ED_view3d_win_to_segment_clipped(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_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]); +bool ED_view3d_unproject( + const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]); /* end */ - -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_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, 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, 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, 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], - const struct ARegion *ar, const struct Object *ob, const struct rcti *rect); +void ED_view3d_calc_camera_border(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, + 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, + 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], + 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); +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); void ED_view3d_clipping_enable(void); void ED_view3d_clipping_disable(void); 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); +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 imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos); /* backbuffer select and draw support */ -void ED_view3d_backbuf_depth_validate(struct ViewContext *vc); -int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist); +void ED_view3d_backbuf_depth_validate(struct ViewContext *vc); +int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist); -void ED_view3d_select_id_validate(struct ViewContext *vc); -void ED_view3d_select_id_validate_with_select_mode( - struct ViewContext *vc, short select_mode); +void ED_view3d_select_id_validate(struct ViewContext *vc); +void ED_view3d_select_id_validate_with_select_mode(struct ViewContext *vc, short select_mode); -uint ED_view3d_select_id_sample( - struct ViewContext *vc, int x, int y); +uint ED_view3d_select_id_sample(struct ViewContext *vc, int x, int y); uint *ED_view3d_select_id_read( - struct ViewContext *vc, - int xmin, int ymin, int xmax, int ymax, - uint *r_buf_len); -uint *ED_view3d_select_id_read_rect( - struct ViewContext *vc, const struct rcti *rect, uint *r_buf_len); + struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax, uint *r_buf_len); +uint *ED_view3d_select_id_read_rect(struct ViewContext *vc, + const struct rcti *rect, + uint *r_buf_len); uint ED_view3d_select_id_read_nearest( - struct ViewContext *vc, const int mval[2], - const uint min, const uint max, uint *r_dist); + struct ViewContext *vc, const int mval[2], const uint min, const uint max, uint *r_dist); -bool ED_view3d_autodist( - 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]); +bool ED_view3d_autodist(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 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); +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); +bool ED_view3d_autodist_depth_seg( + struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth); /* select */ -#define MAXPICKELEMS 2500 -#define MAXPICKBUF (4 * MAXPICKELEMS) +#define MAXPICKELEMS 2500 +#define MAXPICKBUF (4 * MAXPICKELEMS) typedef enum { - /* all elements in the region, ignore depth */ - VIEW3D_SELECT_ALL = 0, - /* pick also depth sorts (only for small regions!) */ - VIEW3D_SELECT_PICK_ALL = 1, - /* sorts and only returns visible objects (only for small regions!) */ - VIEW3D_SELECT_PICK_NEAREST = 2, + /* all elements in the region, ignore depth */ + VIEW3D_SELECT_ALL = 0, + /* pick also depth sorts (only for small regions!) */ + VIEW3D_SELECT_PICK_ALL = 1, + /* sorts and only returns visible objects (only for small regions!) */ + VIEW3D_SELECT_PICK_NEAREST = 2, } eV3DSelectMode; typedef enum { - /** Don't exclude anything. */ - VIEW3D_SELECT_FILTER_NOP = 0, - /** Don't select objects outside the current mode. */ - VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK = 1, - /** A version of #VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK that allows pose-bone selection. */ - VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK = 2, + /** Don't exclude anything. */ + VIEW3D_SELECT_FILTER_NOP = 0, + /** Don't select objects outside the current mode. */ + VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK = 1, + /** A version of #VIEW3D_SELECT_FILTER_OBJECT_MODE_LOCK that allows pose-bone selection. */ + VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK = 2, } eV3DSelectObjectFilter; -eV3DSelectObjectFilter ED_view3d_select_filter_from_mode(const struct Scene *scene, const struct Object *obact); +eV3DSelectObjectFilter ED_view3d_select_filter_from_mode(const struct Scene *scene, + const struct Object *obact); void view3d_opengl_select_cache_begin(void); void view3d_opengl_select_cache_end(void); -int view3d_opengl_select( - struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, const struct rcti *input, - eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter); +int view3d_opengl_select(struct ViewContext *vc, + unsigned int *buffer, + unsigned int bufsize, + const struct rcti *input, + eV3DSelectMode select_mode, + eV3DSelectObjectFilter select_filter); /* view3d_select.c */ float ED_view3d_select_dist_px(void); @@ -416,14 +524,20 @@ 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_opengl_read_pixels( + struct ARegion *ar, int x, int y, int w, int h, int format, int type, void *data); /* 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]); +bool edge_inside_circle(const float cent[2], + float radius, + const float screen_co_a[2], + const float screen_co_b[2]); /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); -bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar); +bool ED_view3d_context_user_region(struct bContext *C, + struct View3D **r_v3d, + struct ARegion **r_ar); bool ED_operator_rv3d_user_region_poll(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); @@ -437,97 +551,139 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d); #endif struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d); -void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat); +void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat); -void ED_draw_object_facemap( - struct Depsgraph *depsgraph, struct Object *ob, const float col[4], const int facemap); +void ED_draw_object_facemap(struct Depsgraph *depsgraph, + 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( - 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, const bool do_color_managment, - struct GPUOffScreen *ofs, struct GPUViewport *viewport); -void ED_view3d_draw_setup_view( - 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); +void ED_view3d_draw_offscreen(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, + const bool do_color_managment, + struct GPUOffScreen *ofs, + struct GPUViewport *viewport); +void ED_view3d_draw_setup_view(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_NONE = (0), - V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 0), + V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 0), - /* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */ - V3D_OFSDRAW_USE_GPENCIL = (1 << 1), - V3D_OFSDRAW_USE_CAMERA_DOF = (1 << 2), + /* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */ + V3D_OFSDRAW_USE_GPENCIL = (1 << 1), + V3D_OFSDRAW_USE_CAMERA_DOF = (1 << 2), }; -struct ImBuf *ED_view3d_draw_offscreen_imbuf( - 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 GPUOffScreen *ofs, char err_out[256]); -struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - 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 GPUOffScreen *ofs, char err_out[256]); +struct ImBuf *ED_view3d_draw_offscreen_imbuf(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 GPUOffScreen *ofs, + char err_out[256]); +struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(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 GPUOffScreen *ofs, + char err_out[256]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); struct Object *ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2]); bool ED_view3d_is_object_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 Depsgraph *depsgraph, struct Scene *scene, struct View3D *v3d, struct ARegion *ar, - float viewmat[4][4], float winmat[4][4], const struct rcti *rect); +void ED_view3d_update_viewmat(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); char ED_view3d_lock_view_from_index(int index); char ED_view3d_axis_view_opposite(char view); bool ED_view3d_lock(struct RegionView3D *rv3d); -void ED_view3d_datamask( - const struct bContext *C, const struct Scene *scene, const struct View3D *v3d, - struct CustomData_MeshMasks *r_cddata_masks); -void ED_view3d_screen_datamask( - const struct bContext *C, const struct Scene *scene, const struct bScreen *screen, - struct CustomData_MeshMasks *r_cddata_masks); +void ED_view3d_datamask(const struct bContext *C, + const struct Scene *scene, + const struct View3D *v3d, + struct CustomData_MeshMasks *r_cddata_masks); +void ED_view3d_screen_datamask(const struct bContext *C, + const struct Scene *scene, + const struct bScreen *screen, + struct CustomData_MeshMasks *r_cddata_masks); bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d); -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); - +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( - 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); +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( - const struct Depsgraph *depsgraph, - struct View3D *v3d, struct RegionView3D *rv3d); - -bool ED_view3d_camera_autokey( - struct Scene *scene, struct ID *id_key, - struct bContext *C, const bool do_rotate, const bool do_translate); -bool ED_view3d_camera_lock_autokey( - struct View3D *v3d, struct RegionView3D *rv3d, - struct bContext *C, const bool do_rotate, const bool do_translate); +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, + struct bContext *C, + const bool do_rotate, + const bool do_translate); +bool ED_view3d_camera_lock_autokey(struct View3D *v3d, + struct RegionView3D *rv3d, + struct bContext *C, + const bool do_rotate, + const bool do_translate); void ED_view3d_lock_clear(struct View3D *v3d); @@ -535,12 +691,14 @@ void ED_view3d_lock_clear(struct View3D *v3d); #define VIEW3D_DIST_FALLBACK 1.0f float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float dist_fallback); -void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist); +void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist); float ED_scene_grid_scale(struct Scene *scene, const char **grid_unit); float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit); -float ED_view3d_grid_view_scale( - struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d, const char **grid_unit); +float ED_view3d_grid_view_scale(struct Scene *scene, + struct View3D *v3d, + struct RegionView3D *rv3d, + const char **grid_unit); void ED_scene_draw_fps(struct Scene *scene, int xoffset, int *yoffset); @@ -556,22 +714,27 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx, void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar); void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa); -#define XRAY_ALPHA(v3d) (((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : (v3d)->shading.xray_alpha) -#define XRAY_FLAG(v3d) (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY) +#define XRAY_ALPHA(v3d) \ + (((v3d)->shading.type == OB_WIRE) ? (v3d)->shading.xray_alpha_wire : (v3d)->shading.xray_alpha) +#define XRAY_FLAG(v3d) \ + (((v3d)->shading.type == OB_WIRE) ? V3D_SHADING_XRAY_BONE : V3D_SHADING_XRAY) #define XRAY_FLAG_ENABLED(v3d) (((v3d)->shading.flag & XRAY_FLAG(v3d)) != 0) -#define XRAY_ENABLED(v3d) (XRAY_FLAG_ENABLED(v3d) && (XRAY_ALPHA(v3d) < 1.0f)) -#define XRAY_ACTIVE(v3d) (XRAY_ENABLED(v3d) && ((v3d)->shading.type < OB_MATERIAL)) +#define XRAY_ENABLED(v3d) (XRAY_FLAG_ENABLED(v3d) && (XRAY_ALPHA(v3d) < 1.0f)) +#define XRAY_ACTIVE(v3d) (XRAY_ENABLED(v3d) && ((v3d)->shading.type < OB_MATERIAL)) /* 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); +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); /* view3d_gizmo_preselect_type.c */ -void ED_view3d_gizmo_mesh_preselect_get_active( - struct bContext *C, struct wmGizmo *gz, - struct Base **r_base, struct BMElem **r_ele); +void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C, + struct wmGizmo *gz, + struct Base **r_base, + struct BMElem **r_ele); #endif /* __ED_VIEW3D_H__ */ diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 419fe961cec..2f624007c98 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -71,7 +71,7 @@ DEF_ICON_BLANK(77) DEF_ICON(NODE) DEF_ICON(NODE_SEL) - /* ui */ +/* ui */ DEF_ICON(WINDOW) DEF_ICON(WORKSPACE) DEF_ICON(RIGHTARROW_THIN) @@ -85,7 +85,7 @@ DEF_ICON(EYEDROPPER) DEF_ICON_BLANK(92) DEF_ICON(AUTO) DEF_ICON(CHECKBOX_DEHLT) /* de-Hilight - Checkbox OFF */ -DEF_ICON(CHECKBOX_HLT) /* Hilight - Checkbox ON */ +DEF_ICON(CHECKBOX_HLT) /* Hilight - Checkbox ON */ DEF_ICON(UNLOCKED) DEF_ICON(LOCKED) DEF_ICON(UNPINNED) @@ -99,10 +99,10 @@ DEF_ICON_BLANK(105) DEF_ICON_BLANK(106) DEF_ICON(PLUGIN) - /* various ui */ +/* various ui */ DEF_ICON(HELP) DEF_ICON(GHOST_ENABLED) -DEF_ICON(COLOR) /* see COLOR_RED/GREEN/BLUE */ +DEF_ICON(COLOR) /* see COLOR_RED/GREEN/BLUE */ DEF_ICON(UNLINKED) DEF_ICON(LINKED) DEF_ICON(HAND) @@ -127,7 +127,7 @@ DEF_ICON(FULLSCREEN_ENTER) DEF_ICON(FULLSCREEN_EXIT) DEF_ICON_BLANK(135) - /* BUTTONS */ +/* BUTTONS */ DEF_ICON_SHADING(LIGHT) DEF_ICON_SHADING(MATERIAL) DEF_ICON_SHADING(TEXTURE) @@ -151,10 +151,10 @@ DEF_ICON_BLANK(157) DEF_ICON_BLANK(158) DEF_ICON_BLANK(159) DEF_ICON_BLANK(160) -DEF_ICON(BLANK1) // Not actually blank - this is used all over the place +DEF_ICON(BLANK1) // Not actually blank - this is used all over the place DEF_ICON(FAKE_USER_OFF) DEF_ICON(FAKE_USER_ON) - /* EDITORS */ +/* EDITORS */ DEF_ICON(VIEW3D) DEF_ICON(GRAPH) DEF_ICON(OUTLINER) @@ -182,8 +182,8 @@ DEF_ICON(NODE_MATERIAL) DEF_ICON(UV) DEF_ICON_BLANK(190) - /* MODES */ -DEF_ICON(OBJECT_DATAMODE) // XXX fix this up +/* MODES */ +DEF_ICON(OBJECT_DATAMODE) // XXX fix this up DEF_ICON(EDITMODE_HLT) DEF_ICON(UV_DATA) DEF_ICON(VPAINT_HLT) @@ -210,7 +210,7 @@ DEF_ICON(TRACKING_REFINE_BACKWARDS) DEF_ICON(TRACKING_REFINE_FORWARDS) DEF_ICON_BLANK(77b) - /* DATA */ +/* DATA */ DEF_ICON(SCENE_DATA) DEF_ICON(RENDERLAYERS) DEF_ICON_SHADING(WORLD_DATA) @@ -238,7 +238,7 @@ DEF_ICON(PACKAGE) DEF_ICON(UGLYPACKAGE) DEF_ICON(EXPERIMENTAL) - /* DATA */ +/* DATA */ DEF_ICON_SHADING(BRUSH_DATA) DEF_ICON_SHADING(IMAGE_DATA) DEF_ICON(FILE) @@ -266,7 +266,7 @@ DEF_ICON_BLANK(272) DEF_ICON(RNA) DEF_ICON(RNA_ADD) - /* INPUT + DECORATOR */ +/* INPUT + DECORATOR */ DEF_ICON(MOUSE_LMB) DEF_ICON(MOUSE_MMB) DEF_ICON(MOUSE_RMB) @@ -294,7 +294,7 @@ DEF_ICON(USER) DEF_ICON(SYSTEM) DEF_ICON(SETTINGS) - /* OUTLINER */ +/* OUTLINER */ DEF_ICON_OBJECT(OUTLINER_OB_EMPTY) DEF_ICON_OBJECT(OUTLINER_OB_MESH) DEF_ICON_OBJECT(OUTLINER_OB_CURVE) @@ -322,7 +322,7 @@ DEF_ICON(RESTRICT_RENDER_ON) DEF_ICON(RESTRICT_RENDER_OFF) DEF_ICON_BLANK(330) - /* OUTLINER */ +/* OUTLINER */ DEF_ICON_OBJECT_DATA(OUTLINER_DATA_EMPTY) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_MESH) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_CURVE) @@ -350,7 +350,7 @@ DEF_ICON(RESTRICT_VIEW_ON) DEF_ICON(RESTRICT_VIEW_OFF) DEF_ICON_BLANK(353) - /* PRIMITIVES */ +/* PRIMITIVES */ DEF_ICON(MESH_PLANE) DEF_ICON(MESH_CUBE) DEF_ICON(MESH_CIRCLE) @@ -378,7 +378,7 @@ DEF_ICON(META_ELLIPSOID) DEF_ICON(META_CAPSULE) DEF_ICON_BLANK(625) - /* PRIMITIVES */ +/* PRIMITIVES */ DEF_ICON(SURFACE_NCURVE) DEF_ICON(SURFACE_NCIRCLE) DEF_ICON(SURFACE_NSURFACE) @@ -406,7 +406,7 @@ DEF_ICON(TRIA_DOWN_BAR) DEF_ICON(TRIA_LEFT_BAR) DEF_ICON(TRIA_UP_BAR) - /* EMPTY */ +/* EMPTY */ DEF_ICON(FORCE_FORCE) DEF_ICON(FORCE_WIND) DEF_ICON(FORCE_VORTEX) @@ -434,7 +434,7 @@ DEF_ICON(IMAGE_PLANE) DEF_ICON(IMAGE_BACKGROUND) DEF_ICON(IMAGE_REFERENCE) - /* EMPTY */ +/* EMPTY */ DEF_ICON_BLANK(445) DEF_ICON_BLANK(446) DEF_ICON_BLANK(447) @@ -462,7 +462,7 @@ DEF_ICON_BLANK(713) DEF_ICON_BLANK(714) DEF_ICON_BLANK(715) - /* EMPTY */ +/* EMPTY */ DEF_ICON(ALIGN_LEFT) DEF_ICON(ALIGN_CENTER) DEF_ICON(ALIGN_RIGHT) @@ -490,7 +490,7 @@ DEF_ICON_BLANK(753) DEF_ICON_BLANK(754) DEF_ICON_BLANK(755) - /* EMPTY */ +/* EMPTY */ DEF_ICON_BLANK(501) DEF_ICON_BLANK(502) DEF_ICON_BLANK(503) @@ -518,7 +518,7 @@ DEF_ICON_BLANK(524) DEF_ICON_BLANK(525) DEF_ICON_BLANK(526) - /* MODIFIERS */ +/* MODIFIERS */ DEF_ICON_MODIFIER(MODIFIER_DATA) DEF_ICON_MODIFIER(MOD_WAVE) DEF_ICON_MODIFIER(MOD_BUILD) @@ -546,7 +546,7 @@ DEF_ICON_MODIFIER(MOD_SMOOTH) DEF_ICON_MODIFIER(MOD_SIMPLEDEFORM) DEF_ICON_MODIFIER(MOD_MASK) - /* MODIFIERS */ +/* MODIFIERS */ DEF_ICON_MODIFIER(MOD_CLOTH) DEF_ICON_MODIFIER(MOD_EXPLODE) DEF_ICON_MODIFIER(MOD_FLUIDSIM) @@ -574,7 +574,7 @@ DEF_ICON_MODIFIER(MOD_INSTANCE) DEF_ICON_MODIFIER(MOD_TIME) DEF_ICON_MODIFIER(MOD_OPACITY) - /* ANIMATION */ +/* ANIMATION */ DEF_ICON(REC) DEF_ICON(PLAY) DEF_ICON(FF) @@ -602,7 +602,7 @@ DEF_ICON(VISIBLE_IPO_OFF) DEF_ICON(VISIBLE_IPO_ON) DEF_ICON(DRIVER) - /* ANIMATION */ +/* ANIMATION */ DEF_ICON(SOLO_OFF) DEF_ICON(SOLO_ON) DEF_ICON(FRAME_PREV) @@ -630,7 +630,7 @@ DEF_ICON_BLANK(636) DEF_ICON_BLANK(637) DEF_ICON_BLANK(638) - /* EDITING */ +/* EDITING */ DEF_ICON(VERTEXSEL) DEF_ICON(EDGESEL) DEF_ICON(FACESEL) @@ -658,7 +658,7 @@ DEF_ICON(PARTICLE_POINT) DEF_ICON(PARTICLE_TIP) DEF_ICON(PARTICLE_PATH) - /* EDITING */ +/* EDITING */ DEF_ICON_BLANK(669) DEF_ICON_BLANK(670) DEF_ICON_BLANK(671) @@ -686,7 +686,7 @@ DEF_ICON(ORIENTATION_LOCAL) DEF_ICON(ORIENTATION_NORMAL) DEF_ICON(ORIENTATION_VIEW) - /* EDITING */ +/* EDITING */ DEF_ICON(COPYDOWN) DEF_ICON(PASTEDOWN) DEF_ICON(PASTEFLIPUP) @@ -714,7 +714,7 @@ DEF_ICON(NORMALS_VERTEX) DEF_ICON(NORMALS_FACE) DEF_ICON(NORMALS_VERTEX_FACE) - /* 3D VIEW */ +/* 3D VIEW */ DEF_ICON(SHADING_BBOX) DEF_ICON(SHADING_WIRE) DEF_ICON(SHADING_SOLID) @@ -736,7 +736,7 @@ DEF_ICON(NDOF_FLY) DEF_ICON(NDOF_TRANS) DEF_ICON(LAYER_USED) DEF_ICON(LAYER_ACTIVE) - /* available */ +/* available */ DEF_ICON_BLANK(254) DEF_ICON_BLANK(255) DEF_ICON_BLANK(256) @@ -769,7 +769,7 @@ DEF_ICON_BLANK(775) DEF_ICON_BLANK(776) DEF_ICON_BLANK(777) - /* FILE SELECT */ +/* FILE SELECT */ DEF_ICON(SORTALPHA) DEF_ICON(SORTBYEXT) DEF_ICON(SORTTIME) @@ -797,7 +797,7 @@ DEF_ICON(FILE_SOUND) DEF_ICON(FILE_FONT) DEF_ICON(FILE_TEXT) - /* FILE SELECT */ +/* FILE SELECT */ DEF_ICON(SORT_DESC) DEF_ICON(SORT_ASC) DEF_ICON(LINK_BLEND) @@ -825,7 +825,7 @@ DEF_ICON(FILE_HIDDEN) DEF_ICON(FILE_BACKUP) DEF_ICON(DISK_DRIVE) - /* SHADING / TEXT */ +/* SHADING / TEXT */ DEF_ICON(MATPLANE) DEF_ICON(MATSPHERE) DEF_ICON(MATCUBE) @@ -853,7 +853,7 @@ DEF_ICON_BLANK(859) DEF_ICON_BLANK(860) DEF_ICON_BLANK(861) - /* SEQUENCE / IMAGE EDITOR */ +/* SEQUENCE / IMAGE EDITOR */ DEF_ICON(SEQ_SEQUENCER) DEF_ICON(SEQ_PREVIEW) DEF_ICON(SEQ_LUMA_WAVEFORM) @@ -863,7 +863,7 @@ DEF_ICON(SEQ_SPLITVIEW) DEF_ICON_BLANK(870) DEF_ICON_BLANK(871) DEF_ICON_BLANK(872) -DEF_ICON(IMAGE_RGB) // XXX CHANGE TO STRAIGHT ALPHA, Z ETC +DEF_ICON(IMAGE_RGB) // XXX CHANGE TO STRAIGHT ALPHA, Z ETC DEF_ICON(IMAGE_RGB_ALPHA) DEF_ICON(IMAGE_ALPHA) DEF_ICON(IMAGE_ZDEPTH) @@ -881,7 +881,7 @@ DEF_ICON(VIEW_CAMERA) DEF_ICON(VIEW_PAN) DEF_ICON(VIEW_ZOOM) - /* brush icons */ +/* brush icons */ DEF_ICON_COLOR(BRUSH_BLOB) DEF_ICON_COLOR(BRUSH_BLUR) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index b862f36337c..d3cce4a5dde 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -78,7 +78,7 @@ typedef struct uiPopupBlockHandle uiPopupBlockHandle; /* Defines */ /* char for splitting strings, aligning shortcuts in menus, users never see */ -#define UI_SEP_CHAR '|' +#define UI_SEP_CHAR '|' #define UI_SEP_CHAR_S "|" /* names */ @@ -91,135 +91,135 @@ typedef struct uiPopupBlockHandle uiPopupBlockHandle; /* uiBlock->dt and uiBut->dt */ enum { - UI_EMBOSS = 0, /* use widget style for drawing */ - 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 = 0, /* use widget style for drawing */ + 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. */ + UI_EMBOSS_UNDEFINED = 255, /* For layout engine, use emboss from block. */ }; /* uiBlock->direction */ enum { - UI_DIR_UP = 1 << 0, - UI_DIR_DOWN = 1 << 1, - UI_DIR_LEFT = 1 << 2, - UI_DIR_RIGHT = 1 << 3, - 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, + UI_DIR_UP = 1 << 0, + UI_DIR_DOWN = 1 << 1, + UI_DIR_LEFT = 1 << 2, + UI_DIR_RIGHT = 1 << 3, + 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, }; #if 0 /* uiBlock->autofill (not yet used) */ -#define UI_BLOCK_COLLUMNS 1 -#define UI_BLOCK_ROWS 2 +# define UI_BLOCK_COLLUMNS 1 +# define UI_BLOCK_ROWS 2 #endif /** #uiBlock.flag (controls) */ enum { - UI_BLOCK_LOOP = 1 << 0, - UI_BLOCK_IS_FLIP = 1 << 1, - UI_BLOCK_NO_FLIP = 1 << 2, - UI_BLOCK_NUMSELECT = 1 << 3, - /** Don't apply window clipping. */ - UI_BLOCK_NO_WIN_CLIP = 1 << 4, - UI_BLOCK_CLIPBOTTOM = 1 << 5, - UI_BLOCK_CLIPTOP = 1 << 6, - UI_BLOCK_MOVEMOUSE_QUIT = 1 << 7, - UI_BLOCK_KEEP_OPEN = 1 << 8, - UI_BLOCK_POPUP = 1 << 9, - UI_BLOCK_OUT_1 = 1 << 10, - UI_BLOCK_SEARCH_MENU = 1 << 11, - UI_BLOCK_POPUP_MEMORY = 1 << 12, - /* Stop handling mouse events. */ - UI_BLOCK_CLIP_EVENTS = 1 << 13, - - /* block->flag bits 14-17 are identical to but->drawflag bits */ - - UI_BLOCK_POPUP_HOLD = 1 << 18, - UI_BLOCK_LIST_ITEM = 1 << 19, - UI_BLOCK_RADIAL = 1 << 20, - UI_BLOCK_POPOVER = 1 << 21, - UI_BLOCK_POPOVER_ONCE = 1 << 22, - /** Always show keymaps, even for non-menus. */ - UI_BLOCK_SHOW_SHORTCUT_ALWAYS = 1 << 23, + UI_BLOCK_LOOP = 1 << 0, + UI_BLOCK_IS_FLIP = 1 << 1, + UI_BLOCK_NO_FLIP = 1 << 2, + UI_BLOCK_NUMSELECT = 1 << 3, + /** Don't apply window clipping. */ + UI_BLOCK_NO_WIN_CLIP = 1 << 4, + UI_BLOCK_CLIPBOTTOM = 1 << 5, + UI_BLOCK_CLIPTOP = 1 << 6, + UI_BLOCK_MOVEMOUSE_QUIT = 1 << 7, + UI_BLOCK_KEEP_OPEN = 1 << 8, + UI_BLOCK_POPUP = 1 << 9, + UI_BLOCK_OUT_1 = 1 << 10, + UI_BLOCK_SEARCH_MENU = 1 << 11, + UI_BLOCK_POPUP_MEMORY = 1 << 12, + /* Stop handling mouse events. */ + UI_BLOCK_CLIP_EVENTS = 1 << 13, + + /* block->flag bits 14-17 are identical to but->drawflag bits */ + + UI_BLOCK_POPUP_HOLD = 1 << 18, + UI_BLOCK_LIST_ITEM = 1 << 19, + UI_BLOCK_RADIAL = 1 << 20, + UI_BLOCK_POPOVER = 1 << 21, + UI_BLOCK_POPOVER_ONCE = 1 << 22, + /** Always show keymaps, even for non-menus. */ + UI_BLOCK_SHOW_SHORTCUT_ALWAYS = 1 << 23, }; /** #uiPopupBlockHandle.menuretval */ enum { - /** Cancel all menus cascading. */ - UI_RETURN_CANCEL = 1 << 0, - /** Choice made. */ - UI_RETURN_OK = 1 << 1, - /** Left the menu. */ - UI_RETURN_OUT = 1 << 2, - /** Let the parent handle this event. */ - UI_RETURN_OUT_PARENT = 1 << 3, - /** Update the button that opened. */ - UI_RETURN_UPDATE = 1 << 4, - /** Popup is ok to be handled. */ - UI_RETURN_POPUP_OK = 1 << 5, + /** Cancel all menus cascading. */ + UI_RETURN_CANCEL = 1 << 0, + /** Choice made. */ + UI_RETURN_OK = 1 << 1, + /** Left the menu. */ + UI_RETURN_OUT = 1 << 2, + /** Let the parent handle this event. */ + UI_RETURN_OUT_PARENT = 1 << 3, + /** Update the button that opened. */ + UI_RETURN_UPDATE = 1 << 4, + /** Popup is ok to be handled. */ + UI_RETURN_POPUP_OK = 1 << 5, }; /* panel controls */ enum { - UI_PNL_SOLID = 1 << 1, - UI_PNL_CLOSE = 1 << 5, - UI_PNL_SCALE = 1 << 9, + UI_PNL_SOLID = 1 << 1, + UI_PNL_CLOSE = 1 << 5, + UI_PNL_SCALE = 1 << 9, }; /* but->flag - general state flags. */ enum { - /** Warning, the first 6 flags are internal. */ - UI_BUT_ICON_SUBMENU = 1 << 6, - UI_BUT_ICON_PREVIEW = 1 << 7, - - UI_BUT_NODE_LINK = 1 << 8, - UI_BUT_NODE_ACTIVE = 1 << 9, - UI_BUT_DRAG_LOCK = 1 << 10, - /** Grayed out and un-editable. */ - UI_BUT_DISABLED = 1 << 11, - - UI_BUT_ANIMATED = 1 << 13, - UI_BUT_ANIMATED_KEY = 1 << 14, - UI_BUT_DRIVEN = 1 << 15, - UI_BUT_REDALERT = 1 << 16, - /** Grayed out but still editable. */ - UI_BUT_INACTIVE = 1 << 17, - UI_BUT_LAST_ACTIVE = 1 << 18, - UI_BUT_UNDO = 1 << 19, - UI_BUT_IMMEDIATE = 1 << 20, - UI_BUT_NO_UTF8 = 1 << 21, - - /** For popups, pressing return activates this button, overriding the highlighted button. - * For non-popups this is just used as a display hint for the user to let them - * know the action which is activated when pressing return (file selector for eg). */ - UI_BUT_ACTIVE_DEFAULT = 1 << 23, - - /** This but is "inside" a list item (currently used to change theme colors). */ - UI_BUT_LIST_ITEM = 1 << 24, - /** edit this button as well as the active button (not just dragging) */ - UI_BUT_DRAG_MULTI = 1 << 25, - /** Use for popups to start editing the button on initialization. */ - UI_BUT_ACTIVATE_ON_INIT = 1 << 26, - - /** #uiBut.str contains #UI_SEP_CHAR, used for key shortcuts */ - UI_BUT_HAS_SEP_CHAR = 1 << 27, - /** Don't run updates while dragging (needed in rare cases). */ - UI_BUT_UPDATE_DELAY = 1 << 28, - /** When widget is in textedit mode, update value on each char stroke */ - UI_BUT_TEXTEDIT_UPDATE = 1 << 29, - /** Show 'x' icon to clear/unlink value of text or search button. */ - UI_BUT_VALUE_CLEAR = 1 << 30, - - /** RNA property of the button is overridden from linked reference data. */ - UI_BUT_OVERRIDEN = 1u << 31u, + /** Warning, the first 6 flags are internal. */ + UI_BUT_ICON_SUBMENU = 1 << 6, + UI_BUT_ICON_PREVIEW = 1 << 7, + + UI_BUT_NODE_LINK = 1 << 8, + UI_BUT_NODE_ACTIVE = 1 << 9, + UI_BUT_DRAG_LOCK = 1 << 10, + /** Grayed out and un-editable. */ + UI_BUT_DISABLED = 1 << 11, + + UI_BUT_ANIMATED = 1 << 13, + UI_BUT_ANIMATED_KEY = 1 << 14, + UI_BUT_DRIVEN = 1 << 15, + UI_BUT_REDALERT = 1 << 16, + /** Grayed out but still editable. */ + UI_BUT_INACTIVE = 1 << 17, + UI_BUT_LAST_ACTIVE = 1 << 18, + UI_BUT_UNDO = 1 << 19, + UI_BUT_IMMEDIATE = 1 << 20, + UI_BUT_NO_UTF8 = 1 << 21, + + /** For popups, pressing return activates this button, overriding the highlighted button. + * For non-popups this is just used as a display hint for the user to let them + * know the action which is activated when pressing return (file selector for eg). */ + UI_BUT_ACTIVE_DEFAULT = 1 << 23, + + /** This but is "inside" a list item (currently used to change theme colors). */ + UI_BUT_LIST_ITEM = 1 << 24, + /** edit this button as well as the active button (not just dragging) */ + UI_BUT_DRAG_MULTI = 1 << 25, + /** Use for popups to start editing the button on initialization. */ + UI_BUT_ACTIVATE_ON_INIT = 1 << 26, + + /** #uiBut.str contains #UI_SEP_CHAR, used for key shortcuts */ + UI_BUT_HAS_SEP_CHAR = 1 << 27, + /** Don't run updates while dragging (needed in rare cases). */ + UI_BUT_UPDATE_DELAY = 1 << 28, + /** When widget is in textedit mode, update value on each char stroke */ + UI_BUT_TEXTEDIT_UPDATE = 1 << 29, + /** Show 'x' icon to clear/unlink value of text or search button. */ + UI_BUT_VALUE_CLEAR = 1 << 30, + + /** RNA property of the button is overridden from linked reference data. */ + UI_BUT_OVERRIDEN = 1u << 31u, }; -#define UI_PANEL_WIDTH 340 -#define UI_COMPACT_PANEL_WIDTH 160 +#define UI_PANEL_WIDTH 340 +#define UI_COMPACT_PANEL_WIDTH 160 #define UI_NAVIGATION_REGION_WIDTH UI_COMPACT_PANEL_WIDTH #define UI_NARROW_NAVIGATION_REGION_WIDTH 100 @@ -230,48 +230,48 @@ enum { * (except for the 'align' ones)! */ enum { - /** Text and icon alignment (by default, they are centered). */ - UI_BUT_TEXT_LEFT = 1 << 1, - UI_BUT_ICON_LEFT = 1 << 2, - UI_BUT_TEXT_RIGHT = 1 << 3, - /** Prevent the button to show any tooltip. */ - UI_BUT_NO_TOOLTIP = 1 << 4, - - /* Button align flag, for drawing groups together. - * Used in 'uiBlock.flag', take care! */ - UI_BUT_ALIGN_TOP = 1 << 14, - UI_BUT_ALIGN_LEFT = 1 << 15, - UI_BUT_ALIGN_RIGHT = 1 << 16, - UI_BUT_ALIGN_DOWN = 1 << 17, - UI_BUT_ALIGN = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN, - /* end bits shared with 'uiBlock.flag' */ - - /** - * Warning - HACK! - * Needed for buttons which are not TOP/LEFT aligned, - * but have some top/left corner stitched to some other TOP/LEFT-aligned button, - * because of 'corrective' hack in widget_roundbox_set()... */ - UI_BUT_ALIGN_STITCH_TOP = 1 << 18, - UI_BUT_ALIGN_STITCH_LEFT = 1 << 19, - UI_BUT_ALIGN_ALL = UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT, - - /** This but is "inside" a box item (currently used to change theme colors). */ - UI_BUT_BOX_ITEM = 1 << 20, - - /** Active left part of number button */ - UI_BUT_ACTIVE_LEFT = 1 << 21, - /** Active right part of number button */ - UI_BUT_ACTIVE_RIGHT = 1 << 22, - - /* (also used by search buttons to enforce shortcut display for their items). */ - /** Button has shortcut text. */ - UI_BUT_HAS_SHORTCUT = 1 << 23, - - /** Reverse order of consecutive off/on icons */ - UI_BUT_ICON_REVERSE = 1 << 24, - - /** Value is animated, but the current value differs from the animated one. */ - UI_BUT_ANIMATED_CHANGED = 1 << 25, + /** Text and icon alignment (by default, they are centered). */ + UI_BUT_TEXT_LEFT = 1 << 1, + UI_BUT_ICON_LEFT = 1 << 2, + UI_BUT_TEXT_RIGHT = 1 << 3, + /** Prevent the button to show any tooltip. */ + UI_BUT_NO_TOOLTIP = 1 << 4, + + /* Button align flag, for drawing groups together. + * Used in 'uiBlock.flag', take care! */ + UI_BUT_ALIGN_TOP = 1 << 14, + UI_BUT_ALIGN_LEFT = 1 << 15, + UI_BUT_ALIGN_RIGHT = 1 << 16, + UI_BUT_ALIGN_DOWN = 1 << 17, + UI_BUT_ALIGN = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN, + /* end bits shared with 'uiBlock.flag' */ + + /** + * Warning - HACK! + * Needed for buttons which are not TOP/LEFT aligned, + * but have some top/left corner stitched to some other TOP/LEFT-aligned button, + * because of 'corrective' hack in widget_roundbox_set()... */ + UI_BUT_ALIGN_STITCH_TOP = 1 << 18, + UI_BUT_ALIGN_STITCH_LEFT = 1 << 19, + UI_BUT_ALIGN_ALL = UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT, + + /** This but is "inside" a box item (currently used to change theme colors). */ + UI_BUT_BOX_ITEM = 1 << 20, + + /** Active left part of number button */ + UI_BUT_ACTIVE_LEFT = 1 << 21, + /** Active right part of number button */ + UI_BUT_ACTIVE_RIGHT = 1 << 22, + + /* (also used by search buttons to enforce shortcut display for their items). */ + /** Button has shortcut text. */ + UI_BUT_HAS_SHORTCUT = 1 << 23, + + /** Reverse order of consecutive off/on icons */ + UI_BUT_ICON_REVERSE = 1 << 24, + + /** Value is animated, but the current value differs from the animated one. */ + UI_BUT_ANIMATED_CHANGED = 1 << 25, }; /* scale fixed button widths by this to account for DPI */ @@ -287,12 +287,12 @@ enum { * - bit 9-15: button type (now 6 bits, 64 types) * */ typedef enum { - UI_BUT_POIN_CHAR = 32, - UI_BUT_POIN_SHORT = 64, - UI_BUT_POIN_INT = 96, - UI_BUT_POIN_FLOAT = 128, -/* UI_BUT_POIN_FUNCTION = 192, */ /*UNUSED*/ - UI_BUT_POIN_BIT = 256, /* OR'd with a bit index*/ + UI_BUT_POIN_CHAR = 32, + UI_BUT_POIN_SHORT = 64, + UI_BUT_POIN_INT = 96, + UI_BUT_POIN_FLOAT = 128, + /* UI_BUT_POIN_FUNCTION = 192, */ /*UNUSED*/ + UI_BUT_POIN_BIT = 256, /* OR'd with a bit index*/ } eButPointerType; /* requires (but->poin != NULL) */ @@ -300,77 +300,77 @@ typedef enum { /* assigned to but->type, OR'd with the flags above when passing args */ typedef enum { - UI_BTYPE_BUT = 1 << 9, - UI_BTYPE_ROW = 2 << 9, - UI_BTYPE_TEXT = 3 << 9, - /** dropdown list */ - UI_BTYPE_MENU = 4 << 9, - UI_BTYPE_BUT_MENU = 5 << 9, - /** number button */ - UI_BTYPE_NUM = 6 << 9, - /** number slider */ - UI_BTYPE_NUM_SLIDER = 7 << 9, - UI_BTYPE_TOGGLE = 8 << 9, - UI_BTYPE_TOGGLE_N = 9 << 9, - UI_BTYPE_ICON_TOGGLE = 10 << 9, - UI_BTYPE_ICON_TOGGLE_N = 11 << 9, - /** same as regular toggle, but no on/off state displayed */ - UI_BTYPE_BUT_TOGGLE = 12 << 9, - /** similar to toggle, display a 'tick' */ - UI_BTYPE_CHECKBOX = 13 << 9, - 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_KEY_EVENT = 24 << 9, - UI_BTYPE_HSVCUBE = 26 << 9, - /** menu (often used in headers), **_MENU /w different draw-type */ - UI_BTYPE_PULLDOWN = 27 << 9, - UI_BTYPE_ROUNDBOX = 28 << 9, - UI_BTYPE_COLORBAND = 30 << 9, - /** sphere widget (used to input a unit-vector, aka normal) */ - UI_BTYPE_UNITVEC = 31 << 9, - UI_BTYPE_CURVE = 32 << 9, - UI_BTYPE_LISTBOX = 36 << 9, - UI_BTYPE_LISTROW = 37 << 9, - UI_BTYPE_HSVCIRCLE = 38 << 9, - UI_BTYPE_TRACK_PREVIEW = 40 << 9, - - /** Buttons with value >= #UI_BTYPE_SEARCH_MENU don't get undo pushes. */ - UI_BTYPE_SEARCH_MENU = 41 << 9, - UI_BTYPE_EXTRA = 42 << 9, - UI_BTYPE_HOTKEY_EVENT = 46 << 9, - /** Non-interactive image, used for splash screen */ - UI_BTYPE_IMAGE = 47 << 9, - UI_BTYPE_HISTOGRAM = 48 << 9, - UI_BTYPE_WAVEFORM = 49 << 9, - UI_BTYPE_VECTORSCOPE = 50 << 9, - UI_BTYPE_PROGRESS_BAR = 51 << 9, - UI_BTYPE_NODE_SOCKET = 53 << 9, - UI_BTYPE_SEPR = 54 << 9, - UI_BTYPE_SEPR_LINE = 55 << 9, - /** Dynamically fill available space. */ - UI_BTYPE_SEPR_SPACER = 56 << 9, - /** Resize handle (resize uilist). */ - UI_BTYPE_GRIP = 57 << 9, + UI_BTYPE_BUT = 1 << 9, + UI_BTYPE_ROW = 2 << 9, + UI_BTYPE_TEXT = 3 << 9, + /** dropdown list */ + UI_BTYPE_MENU = 4 << 9, + UI_BTYPE_BUT_MENU = 5 << 9, + /** number button */ + UI_BTYPE_NUM = 6 << 9, + /** number slider */ + UI_BTYPE_NUM_SLIDER = 7 << 9, + UI_BTYPE_TOGGLE = 8 << 9, + UI_BTYPE_TOGGLE_N = 9 << 9, + UI_BTYPE_ICON_TOGGLE = 10 << 9, + UI_BTYPE_ICON_TOGGLE_N = 11 << 9, + /** same as regular toggle, but no on/off state displayed */ + UI_BTYPE_BUT_TOGGLE = 12 << 9, + /** similar to toggle, display a 'tick' */ + UI_BTYPE_CHECKBOX = 13 << 9, + 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_KEY_EVENT = 24 << 9, + UI_BTYPE_HSVCUBE = 26 << 9, + /** menu (often used in headers), **_MENU /w different draw-type */ + UI_BTYPE_PULLDOWN = 27 << 9, + UI_BTYPE_ROUNDBOX = 28 << 9, + UI_BTYPE_COLORBAND = 30 << 9, + /** sphere widget (used to input a unit-vector, aka normal) */ + UI_BTYPE_UNITVEC = 31 << 9, + UI_BTYPE_CURVE = 32 << 9, + UI_BTYPE_LISTBOX = 36 << 9, + UI_BTYPE_LISTROW = 37 << 9, + UI_BTYPE_HSVCIRCLE = 38 << 9, + UI_BTYPE_TRACK_PREVIEW = 40 << 9, + + /** Buttons with value >= #UI_BTYPE_SEARCH_MENU don't get undo pushes. */ + UI_BTYPE_SEARCH_MENU = 41 << 9, + UI_BTYPE_EXTRA = 42 << 9, + UI_BTYPE_HOTKEY_EVENT = 46 << 9, + /** Non-interactive image, used for splash screen */ + UI_BTYPE_IMAGE = 47 << 9, + UI_BTYPE_HISTOGRAM = 48 << 9, + UI_BTYPE_WAVEFORM = 49 << 9, + UI_BTYPE_VECTORSCOPE = 50 << 9, + UI_BTYPE_PROGRESS_BAR = 51 << 9, + UI_BTYPE_NODE_SOCKET = 53 << 9, + UI_BTYPE_SEPR = 54 << 9, + UI_BTYPE_SEPR_LINE = 55 << 9, + /** Dynamically fill available space. */ + UI_BTYPE_SEPR_SPACER = 56 << 9, + /** Resize handle (resize uilist). */ + UI_BTYPE_GRIP = 57 << 9, } eButType; -#define BUTTYPE (63 << 9) +#define BUTTYPE (63 << 9) /** Gradient types, for color picker #UI_BTYPE_HSVCUBE etc. */ enum { - UI_GRAD_SV = 0, - UI_GRAD_HV = 1, - UI_GRAD_HS = 2, - UI_GRAD_H = 3, - UI_GRAD_S = 4, - UI_GRAD_V = 5, - - UI_GRAD_V_ALT = 9, - UI_GRAD_L_ALT = 10, + UI_GRAD_SV = 0, + UI_GRAD_HV = 1, + UI_GRAD_HS = 2, + UI_GRAD_H = 3, + UI_GRAD_S = 4, + UI_GRAD_V = 5, + + UI_GRAD_V_ALT = 9, + UI_GRAD_L_ALT = 10, }; #define UI_PALETTE_COLOR 20 @@ -380,15 +380,40 @@ enum { * Functions to draw various shapes, taking theme settings into account. * Used for code that draws its own UI style elements. */ -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_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]); +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); @@ -398,21 +423,32 @@ void UI_draw_roundbox_shade_y(bool filled, float minx, float miny, float maxx, f void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy); void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4]); -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]); +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. */ enum { - UI_SCROLL_PRESSED = 1 << 0, - UI_SCROLL_ARROWS = 1 << 1, - UI_SCROLL_NO_OUTLINE = 1 << 2, + UI_SCROLL_PRESSED = 1 << 0, + UI_SCROLL_ARROWS = 1 << 1, + UI_SCROLL_NO_OUTLINE = 1 << 2, }; -void UI_draw_widget_scroll(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state); +void UI_draw_widget_scroll(struct uiWidgetColors *wcol, + const struct rcti *rect, + const struct rcti *slider, + int state); /* Shortening string helper. */ -float UI_text_clip_middle_ex( - const struct uiFontStyle *fstyle, char *str, float okwidth, const float minwidth, - const size_t max_len, const char rpart_sep); +float UI_text_clip_middle_ex(const struct uiFontStyle *fstyle, + char *str, + float okwidth, + const float minwidth, + const size_t max_len, + const char rpart_sep); /** * Callbacks @@ -437,8 +473,13 @@ typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origs typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); typedef void (*uiButHandleHoldFunc)(struct bContext *C, struct ARegion *butregion, uiBut *but); typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); -typedef struct ARegion *(*uiButSearchCreateFunc)(struct bContext *C, struct ARegion *butregion, uiBut *but); -typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items); +typedef struct ARegion *(*uiButSearchCreateFunc)(struct bContext *C, + struct ARegion *butregion, + uiBut *but); +typedef void (*uiButSearchFunc)(const struct bContext *C, + void *arg, + const char *str, + uiSearchItems *items); /* Must return allocated string. */ typedef char *(*uiButToolTipFunc)(struct bContext *C, void *argN, const char *tip); typedef int (*uiButPushedStateFunc)(struct bContext *C, void *arg); @@ -457,16 +498,13 @@ typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event); */ typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1); - /* interface_query.c */ bool UI_but_has_tooltip_label(const uiBut *but); bool UI_but_is_tool(const uiBut *but); -#define UI_but_is_decorator(but) \ - ((but)->func == ui_but_anim_decorate_cb) +#define UI_but_is_decorator(but) ((but)->func == ui_but_anim_decorate_cb) bool UI_block_is_empty(const uiBlock *block); - /* interface_region_menu_popup.c */ /** * Popup Menus @@ -478,17 +516,18 @@ bool UI_block_is_empty(const uiBlock *block); */ typedef struct uiPopupMenu uiPopupMenu; -uiPopupMenu *UI_popup_menu_begin( - struct bContext *C, const char *title, int icon) ATTR_NONNULL(); -uiPopupMenu *UI_popup_menu_begin_ex( - struct bContext *C, const char *title, const char *block_name, - int icon) ATTR_NONNULL(); +uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL(); +uiPopupMenu *UI_popup_menu_begin_ex(struct bContext *C, + const char *title, + const char *block_name, + int icon) ATTR_NONNULL(); void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *head); bool UI_popup_menu_end_or_cancel(struct bContext *C, struct uiPopupMenu *head); struct uiLayout *UI_popup_menu_layout(uiPopupMenu *head); void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL(); -int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) ATTR_NONNULL(1, 2); +int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) + ATTR_NONNULL(1, 2); 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); @@ -497,9 +536,10 @@ void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *b typedef struct uiPopover uiPopover; -int UI_popover_panel_invoke( - struct bContext *C, const char *idname, - bool keep_open, struct ReportList *reports); +int UI_popover_panel_invoke(struct bContext *C, + const char *idname, + bool keep_open, + struct ReportList *reports); uiPopover *UI_popover_begin(struct bContext *C, int menu_width) ATTR_NONNULL(1); void UI_popover_end(struct bContext *C, struct uiPopover *head, struct wmKeyMap *keymap); @@ -511,16 +551,20 @@ void UI_popover_once_clear(uiPopover *pup); typedef struct uiPieMenu uiPieMenu; int UI_pie_menu_invoke(struct bContext *C, const char *idname, const struct wmEvent *event); -int UI_pie_menu_invoke_from_operator_enum( - struct bContext *C, const char *title, const char *opname, - const char *propname, const struct wmEvent *event); -int UI_pie_menu_invoke_from_rna_enum( - struct bContext *C, const char *title, - const char *path, const struct wmEvent *event); - -struct uiPieMenu *UI_pie_menu_begin( - struct bContext *C, const char *title, int icon, - const struct wmEvent *event) ATTR_NONNULL(); +int UI_pie_menu_invoke_from_operator_enum(struct bContext *C, + const char *title, + const char *opname, + const char *propname, + const struct wmEvent *event); +int UI_pie_menu_invoke_from_rna_enum(struct bContext *C, + const char *title, + const char *path, + const struct wmEvent *event); + +struct uiPieMenu *UI_pie_menu_begin(struct bContext *C, + const char *title, + int icon, + const struct wmEvent *event) ATTR_NONNULL(); void UI_pie_menu_end(struct bContext *C, uiPieMenu *pie); struct uiLayout *UI_pie_menu_layout(struct uiPieMenu *pie); @@ -530,13 +574,19 @@ struct uiLayout *UI_pie_menu_layout(struct uiPieMenu *pie); * * Functions used to create popup blocks. These are like popup menus * but allow using all button types and creating an own layout. */ -typedef uiBlock * (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1); +typedef uiBlock *(*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1); typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1); void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg); -void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); -void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, struct wmOperator *op); -#if 0 /* UNUSED */ +void UI_popup_block_invoke_ex( + struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); +void UI_popup_block_ex(struct bContext *C, + uiBlockCreateFunc func, + uiBlockHandleFunc popup_func, + uiBlockCancelFunc cancel_func, + void *arg, + struct wmOperator *op); +#if 0 /* UNUSED */ void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); #endif @@ -555,7 +605,10 @@ bool UI_popup_block_name_exists(struct bContext *C, const char *name); * * */ -uiBlock *UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, short dt); +uiBlock *UI_block_begin(const struct bContext *C, + struct ARegion *region, + const char *name, + short dt); 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); @@ -564,8 +617,8 @@ 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); enum { - UI_BLOCK_THEME_STYLE_REGULAR = 0, - UI_BLOCK_THEME_STYLE_POPUP = 1, + UI_BLOCK_THEME_STYLE_REGULAR = 0, + UI_BLOCK_THEME_STYLE_POPUP = 1, }; void UI_block_theme_style_set(uiBlock *block, char theme_style); void UI_block_emboss_set(uiBlock *block, char dt); @@ -586,13 +639,13 @@ void UI_block_align_end(uiBlock *block); /* block bounds/position calculation */ typedef enum { - UI_BLOCK_BOUNDS_NONE = 0, - UI_BLOCK_BOUNDS = 1, - UI_BLOCK_BOUNDS_TEXT, - UI_BLOCK_BOUNDS_POPUP_MOUSE, - UI_BLOCK_BOUNDS_POPUP_MENU, - UI_BLOCK_BOUNDS_POPUP_CENTER, - UI_BLOCK_BOUNDS_PIE_CENTER, + UI_BLOCK_BOUNDS_NONE = 0, + UI_BLOCK_BOUNDS = 1, + UI_BLOCK_BOUNDS_TEXT, + UI_BLOCK_BOUNDS_POPUP_MOUSE, + UI_BLOCK_BOUNDS_POPUP_MENU, + UI_BLOCK_BOUNDS_POPUP_CENTER, + UI_BLOCK_BOUNDS_PIE_CENTER, } eBlockBoundsCalc; void UI_block_bounds_set_normal(struct uiBlock *block, int addval); @@ -602,50 +655,50 @@ void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offse void UI_block_bounds_set_centered(uiBlock *block, int addval); void UI_block_bounds_set_explicit(uiBlock *block, int minx, int miny, int maxx, int maxy); -int UI_blocklist_min_y_get(struct ListBase *lb); +int UI_blocklist_min_y_get(struct ListBase *lb); -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); +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); +int UI_but_return_value_get(uiBut *but); -void UI_but_drag_set_id(uiBut *but, struct ID *id); -void UI_but_drag_set_rna(uiBut *but, struct PointerRNA *ptr); -void UI_but_drag_set_path(uiBut *but, const char *path, const bool use_free); -void UI_but_drag_set_name(uiBut *but, const char *name); -void UI_but_drag_set_value(uiBut *but); -void UI_but_drag_set_image( - uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale, const bool use_free); +void UI_but_drag_set_id(uiBut *but, struct ID *id); +void UI_but_drag_set_rna(uiBut *but, struct PointerRNA *ptr); +void UI_but_drag_set_path(uiBut *but, const char *path, const bool use_free); +void UI_but_drag_set_name(uiBut *but, const char *name); +void UI_but_drag_set_value(uiBut *but); +void UI_but_drag_set_image( + uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale, const bool use_free); -bool UI_but_active_drop_name(struct bContext *C); -bool UI_but_active_drop_color(struct bContext *C); +bool UI_but_active_drop_name(struct bContext *C); +bool UI_but_active_drop_color(struct bContext *C); -void UI_but_flag_enable(uiBut *but, int flag); -void UI_but_flag_disable(uiBut *but, int flag); -bool UI_but_flag_is_set(uiBut *but, int flag); +void UI_but_flag_enable(uiBut *but, int flag); +void UI_but_flag_disable(uiBut *but, int flag); +bool UI_but_flag_is_set(uiBut *but, int flag); -void UI_but_drawflag_enable(uiBut *but, int flag); -void UI_but_drawflag_disable(uiBut *but, int flag); +void UI_but_drawflag_enable(uiBut *but, int flag); +void UI_but_drawflag_disable(uiBut *but, int flag); -void UI_but_type_set_menu_from_pulldown(uiBut *but); +void UI_but_type_set_menu_from_pulldown(uiBut *but); /* special button case, only draw it when used actively, for outliner etc */ -bool UI_but_active_only(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); -bool UI_block_active_only_flagged_buttons(const struct bContext *C, struct ARegion *ar, struct uiBlock *block); +bool UI_but_active_only(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); +bool UI_block_active_only_flagged_buttons(const struct bContext *C, + struct ARegion *ar, + struct uiBlock *block); -void UI_but_execute(const struct bContext *C, uiBut *but); +void UI_but_execute(const struct bContext *C, uiBut *but); -bool UI_but_online_manual_id( - const uiBut *but, - char *r_str, size_t maxlength) - ATTR_WARN_UNUSED_RESULT; -bool UI_but_online_manual_id_from_active( - const struct bContext *C, - char *r_str, size_t maxlength) - ATTR_WARN_UNUSED_RESULT; +bool UI_but_online_manual_id(const uiBut *but, + char *r_str, + size_t maxlength) ATTR_WARN_UNUSED_RESULT; +bool UI_but_online_manual_id_from_active(const struct bContext *C, + char *r_str, + size_t maxlength) ATTR_WARN_UNUSED_RESULT; /* Buttons * @@ -657,68 +710,567 @@ bool UI_but_online_manual_id_from_active( * - R: RNA * - O: operator */ -uiBut *uiDefBut( - uiBlock *block, - int type, int retval, const char *str, - int x1, int y1, - short x2, short y2, - void *poin, - float min, float max, - float a1, float a2, const char *tip); -uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip); - -uiBut *uiDefIconBut( - uiBlock *block, - int type, int retval, int icon, - int x1, int y1, - short x2, short y2, - void *poin, - float min, float max, - float a1, float a2, const char *tip); -uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, int x, int y, short width, short height, const char *tip); - -uiBut *uiDefIconTextBut( - uiBlock *block, - int type, int retval, int icon, const char *str, - int x1, int y1, - short x2, short y2, - void *poin, - float min, float max, - float a1, float a2, const char *tip); -uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip); -uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip); +uiBut *uiDefBut(uiBlock *block, + int type, + int retval, + const char *str, + int x1, + int y1, + short x2, + short y2, + void *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButF(uiBlock *block, + int type, + int retval, + const char *str, + int x, + int y, + short width, + short height, + float *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButBitF(uiBlock *block, + int type, + int bit, + int retval, + const char *str, + int x, + int y, + short width, + short height, + float *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButI(uiBlock *block, + int type, + int retval, + const char *str, + int x, + int y, + short width, + short height, + int *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButBitI(uiBlock *block, + int type, + int bit, + int retval, + const char *str, + int x, + int y, + short width, + short height, + int *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButS(uiBlock *block, + int type, + int retval, + const char *str, + int x, + int y, + short width, + short height, + short *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButBitS(uiBlock *block, + int type, + int bit, + int retval, + const char *str, + int x, + int y, + short width, + short height, + short *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButC(uiBlock *block, + int type, + int retval, + const char *str, + int x, + int y, + short width, + short height, + char *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButBitC(uiBlock *block, + int type, + int bit, + int retval, + const char *str, + int x, + int y, + short width, + short height, + char *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButR(uiBlock *block, + int type, + int retval, + const char *str, + int x, + int y, + short width, + short height, + struct PointerRNA *ptr, + const char *propname, + int index, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButR_prop(uiBlock *block, + int type, + int retval, + const char *str, + int x, + int y, + short width, + short height, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + int index, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefButO(uiBlock *block, + int type, + const char *opname, + int opcontext, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefButO_ptr(uiBlock *block, + int type, + struct wmOperatorType *ot, + int opcontext, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); + +uiBut *uiDefIconBut(uiBlock *block, + int type, + int retval, + int icon, + int x1, + int y1, + short x2, + short y2, + void *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButF(uiBlock *block, + int type, + int retval, + int icon, + int x, + int y, + short width, + short height, + float *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButBitF(uiBlock *block, + int type, + int bit, + int retval, + int icon, + int x, + int y, + short width, + short height, + float *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButI(uiBlock *block, + int type, + int retval, + int icon, + int x, + int y, + short width, + short height, + int *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButBitI(uiBlock *block, + int type, + int bit, + int retval, + int icon, + int x, + int y, + short width, + short height, + int *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButS(uiBlock *block, + int type, + int retval, + int icon, + int x, + int y, + short width, + short height, + short *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButBitS(uiBlock *block, + int type, + int bit, + int retval, + int icon, + int x, + int y, + short width, + short height, + short *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButC(uiBlock *block, + int type, + int retval, + int icon, + int x, + int y, + short width, + short height, + char *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButBitC(uiBlock *block, + int type, + int bit, + int retval, + int icon, + int x, + int y, + short width, + short height, + char *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButR(uiBlock *block, + int type, + int retval, + int icon, + int x, + int y, + short width, + short height, + struct PointerRNA *ptr, + const char *propname, + int index, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButR_prop(uiBlock *block, + int type, + int retval, + int icon, + int x, + int y, + short width, + short height, + struct PointerRNA *ptr, + PropertyRNA *prop, + int index, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconButO(uiBlock *block, + int type, + const char *opname, + int opcontext, + int icon, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefIconButO_ptr(uiBlock *block, + int type, + struct wmOperatorType *ot, + int opcontext, + int icon, + int x, + int y, + short width, + short height, + const char *tip); + +uiBut *uiDefIconTextBut(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x1, + int y1, + short x2, + short y2, + void *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButF(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + float *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButBitF(uiBlock *block, + int type, + int bit, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + float *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButI(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + int *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButBitI(uiBlock *block, + int type, + int bit, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + int *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButS(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + short *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButBitS(uiBlock *block, + int type, + int bit, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + short *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButC(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + char *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButBitC(uiBlock *block, + int type, + int bit, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + char *poin, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButR(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + struct PointerRNA *ptr, + const char *propname, + int index, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButR_prop(uiBlock *block, + int type, + int retval, + int icon, + const char *str, + int x, + int y, + short width, + short height, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + int index, + float min, + float max, + float a1, + float a2, + const char *tip); +uiBut *uiDefIconTextButO(uiBlock *block, + int type, + const char *opname, + int opcontext, + int icon, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefIconTextButO_ptr(uiBlock *block, + int type, + struct wmOperatorType *ot, + int opcontext, + int icon, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); /* for passing inputs to ButO buttons */ struct PointerRNA *UI_but_operator_ptr_get(uiBut *but); @@ -727,23 +1279,23 @@ void UI_but_unit_type_set(uiBut *but, const int unit_type); int UI_but_unit_type_get(const uiBut *but); enum { - BUT_GET_RNAPROP_IDENTIFIER = 1, - BUT_GET_RNASTRUCT_IDENTIFIER, - BUT_GET_RNAENUM_IDENTIFIER, - BUT_GET_LABEL, - BUT_GET_RNA_LABEL, - BUT_GET_RNAENUM_LABEL, - BUT_GET_RNA_LABEL_CONTEXT, /* Context specified in CTX_XXX_ macros are just unreachable! */ - BUT_GET_TIP, - BUT_GET_RNA_TIP, - BUT_GET_RNAENUM_TIP, - BUT_GET_OP_KEYMAP, - BUT_GET_PROP_KEYMAP, + BUT_GET_RNAPROP_IDENTIFIER = 1, + BUT_GET_RNASTRUCT_IDENTIFIER, + BUT_GET_RNAENUM_IDENTIFIER, + BUT_GET_LABEL, + BUT_GET_RNA_LABEL, + BUT_GET_RNAENUM_LABEL, + BUT_GET_RNA_LABEL_CONTEXT, /* Context specified in CTX_XXX_ macros are just unreachable! */ + BUT_GET_TIP, + BUT_GET_RNA_TIP, + BUT_GET_RNAENUM_TIP, + BUT_GET_OP_KEYMAP, + BUT_GET_PROP_KEYMAP, }; typedef struct uiStringInfo { - int type; - char *strinfo; + int type; + char *strinfo; } uiStringInfo; /* Note: Expects pointers to uiStringInfo structs as parameters. @@ -767,19 +1319,20 @@ void UI_but_string_info_get(struct bContext *C, uiBut *but, ...) ATTR_SENTINEL(0 * - AutoButR: RNA property button with type automatically defined. */ enum { - UI_ID_RENAME = 1 << 0, - UI_ID_BROWSE = 1 << 1, - UI_ID_ADD_NEW = 1 << 2, - UI_ID_ALONE = 1 << 4, - UI_ID_OPEN = 1 << 3, - UI_ID_DELETE = 1 << 5, - UI_ID_LOCAL = 1 << 6, - UI_ID_AUTO_NAME = 1 << 7, - UI_ID_FAKE_USER = 1 << 8, - UI_ID_PIN = 1 << 9, - UI_ID_PREVIEWS = 1 << 10, - UI_ID_OVERRIDE = 1 << 11, - 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, + UI_ID_RENAME = 1 << 0, + UI_ID_BROWSE = 1 << 1, + UI_ID_ADD_NEW = 1 << 2, + UI_ID_ALONE = 1 << 4, + UI_ID_OPEN = 1 << 3, + UI_ID_DELETE = 1 << 5, + UI_ID_LOCAL = 1 << 6, + UI_ID_AUTO_NAME = 1 << 7, + UI_ID_FAKE_USER = 1 << 8, + UI_ID_PIN = 1 << 9, + UI_ID_PREVIEWS = 1 << 10, + UI_ID_OVERRIDE = 1 << 11, + 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, }; /** @@ -787,8 +1340,8 @@ enum { * \note We may want to add LOCAL, LIBRARY ... as needed. */ enum { - UI_TEMPLATE_ID_FILTER_ALL = 0, - UI_TEMPLATE_ID_FILTER_AVAILABLE = 1, + UI_TEMPLATE_ID_FILTER_ALL = 0, + UI_TEMPLATE_ID_FILTER_AVAILABLE = 1, }; int UI_icon_from_id(struct ID *id); @@ -797,89 +1350,212 @@ int UI_icon_from_report_type(int type); int UI_icon_from_event_type(short event_type, short event_value); int UI_icon_from_keymap_item(const struct wmKeyMapItem *kmi, int r_icon_mod[4]); -uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip); - -uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, const char *str, int x, int y, short width, short height, const char *tip); -uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x, int y, short width, short height, const char *tip); - -uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip); -uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip); - -uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *spoin, const char *tip); -uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip); - -uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip); -uiBut *uiDefSearchButO_ptr( - uiBlock *block, struct wmOperatorType *ot, struct IDProperty *properties, - void *arg, int retval, int icon, int maxlen, int x, int y, - short width, short height, float a1, float a2, const char *tip); - +uiBut *uiDefPulldownBut(uiBlock *block, + uiBlockCreateFunc func, + void *arg, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefMenuBut(uiBlock *block, + uiMenuCreateFunc func, + void *arg, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefIconTextMenuBut(uiBlock *block, + uiMenuCreateFunc func, + void *arg, + int icon, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefIconMenuBut(uiBlock *block, + uiMenuCreateFunc func, + void *arg, + int icon, + int x, + int y, + short width, + short height, + const char *tip); + +uiBut *uiDefBlockBut(uiBlock *block, + uiBlockCreateFunc func, + void *func_arg1, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefBlockButN(uiBlock *block, + uiBlockCreateFunc func, + void *argN, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); + +uiBut *uiDefIconBlockBut(uiBlock *block, + uiBlockCreateFunc func, + void *arg, + int retval, + int icon, + int x, + int y, + short width, + short height, + const char *tip); +uiBut *uiDefIconTextBlockBut(uiBlock *block, + uiBlockCreateFunc func, + void *arg, + int icon, + const char *str, + int x, + int y, + short width, + short height, + const char *tip); + +uiBut *uiDefKeyevtButS(uiBlock *block, + int retval, + const char *str, + int x, + int y, + short width, + short height, + short *spoin, + const char *tip); +uiBut *uiDefHotKeyevtButS(uiBlock *block, + int retval, + const char *str, + int x, + int y, + short width, + short height, + short *keypoin, + short *modkeypoin, + const char *tip); + +uiBut *uiDefSearchBut(uiBlock *block, + void *arg, + int retval, + int icon, + int maxlen, + int x, + int y, + short width, + short height, + float a1, + float a2, + const char *tip); +uiBut *uiDefSearchButO_ptr(uiBlock *block, + struct wmOperatorType *ot, + struct IDProperty *properties, + void *arg, + int retval, + int icon, + int maxlen, + int x, + int y, + short width, + short height, + float a1, + float a2, + const char *tip); /* 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, + /* 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, + /* 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; -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 *ptr, struct PropertyRNA *prop, void *user_data), void *user_data, - struct PropertyRNA *prop_activate_init, - eButLabelAlign label_align, const bool compact); +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 *ptr, + struct PropertyRNA *prop, + void *user_data), + void *user_data, + struct PropertyRNA *prop_activate_init, + 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); +bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid); /* bfunc gets search item *poin as arg2, or if NULL the old string */ -void UI_but_func_search_set( - uiBut *but, uiButSearchCreateFunc cfunc, uiButSearchFunc sfunc, - void *arg, bool free_arg, uiButHandleFunc bfunc, void *active); +void UI_but_func_search_set(uiBut *but, + uiButSearchCreateFunc cfunc, + uiButSearchFunc sfunc, + void *arg, + bool free_arg, + uiButHandleFunc bfunc, + void *active); /* height in pixels, it's using hardcoded values still */ -int UI_searchbox_size_y(void); -int UI_searchbox_size_x(void); +int UI_searchbox_size_y(void); +int UI_searchbox_size_x(void); /* check if a string is in an existing search box */ -int UI_search_items_find_index(uiSearchItems *items, const char *name); +int UI_search_items_find_index(uiSearchItems *items, const char *name); -void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg); -void UI_block_func_butmenu_set(uiBlock *block, uiMenuHandleFunc func, void *arg); -void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2); -void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2); +void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg); +void UI_block_func_butmenu_set(uiBlock *block, uiMenuHandleFunc func, void *arg); +void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2); +void UI_block_funcN_set(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2); -void UI_but_func_rename_set(uiBut *but, uiButHandleRenameFunc func, void *arg1); -void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2); -void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2); +void UI_but_func_rename_set(uiBut *but, uiButHandleRenameFunc func, void *arg1); +void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2); +void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2); -void UI_but_func_complete_set(uiBut *but, uiButCompleteFunc func, void *arg); +void UI_but_func_complete_set(uiBut *but, uiButCompleteFunc func, void *arg); -void UI_but_func_drawextra_set( - uiBlock *block, - void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), - void *arg1, void *arg2); +void UI_but_func_drawextra_set( + uiBlock *block, + void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), + void *arg1, + void *arg2); -void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func); +void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func); -void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN); -void UI_but_tooltip_refresh(struct bContext *C, uiBut *but); -void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but); +void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN); +void UI_but_tooltip_refresh(struct bContext *C, uiBut *but); +void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but); -bool UI_textbutton_activate_rna( - const struct bContext *C, struct ARegion *ar, - const void *rna_poin_data, const char *rna_prop_id); +bool UI_textbutton_activate_rna(const struct bContext *C, + struct ARegion *ar, + const void *rna_poin_data, + const char *rna_prop_id); bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); @@ -915,25 +1591,31 @@ void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *r_x, int * void UI_panels_draw(const struct bContext *C, struct ARegion *ar); struct Panel *UI_panel_find_by_type(struct ListBase *lb, struct PanelType *pt); -struct Panel *UI_panel_begin( - struct ScrArea *sa, struct ARegion *ar, struct ListBase *lb, - uiBlock *block, struct PanelType *pt, struct Panel *pa, - bool *r_open); +struct Panel *UI_panel_begin(struct ScrArea *sa, + struct ARegion *ar, + struct ListBase *lb, + uiBlock *block, + struct PanelType *pt, + struct Panel *pa, + bool *r_open); void UI_panel_end(uiBlock *block, int width, int height); void UI_panels_scale(struct ARegion *ar, float new_width); void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y); int UI_panel_size_y(const struct Panel *pa); -bool UI_panel_category_is_visible(struct ARegion *ar); -void UI_panel_category_add(struct ARegion *ar, const char *name); -struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *ar, const char *idname); +bool UI_panel_category_is_visible(struct ARegion *ar); +void UI_panel_category_add(struct ARegion *ar, const char *name); +struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *ar, const char *idname); struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *ar, const char *idname); -const char *UI_panel_category_active_get(struct ARegion *ar, bool set_fallback); -void UI_panel_category_active_set(struct ARegion *ar, const char *idname); -struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *ar, const int x, const int y); -struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *ar, const struct wmEvent *event); -void UI_panel_category_clear_all(struct ARegion *ar); -void UI_panel_category_draw_all(struct ARegion *ar, const char *category_id_active); +const char *UI_panel_category_active_get(struct ARegion *ar, bool set_fallback); +void UI_panel_category_active_set(struct ARegion *ar, const char *idname); +struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *ar, + const int x, + const int y); +struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *ar, + const struct wmEvent *event); +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); @@ -944,7 +1626,10 @@ struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idn * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */ void UI_region_handlers_add(struct ListBase *handlers); -void UI_popup_handlers_add(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup, const char flag); +void UI_popup_handlers_add(struct bContext *C, + struct ListBase *handlers, + uiPopupBlockHandle *popup, + const char flag); void UI_popup_handlers_remove(struct ListBase *handlers, uiPopupBlockHandle *popup); void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers); @@ -970,51 +1655,51 @@ void UI_exit(void); /* layout */ enum { - UI_LAYOUT_HORIZONTAL = 0, - UI_LAYOUT_VERTICAL = 1, + UI_LAYOUT_HORIZONTAL = 0, + UI_LAYOUT_VERTICAL = 1, }; enum { - UI_LAYOUT_PANEL = 0, - UI_LAYOUT_HEADER = 1, - UI_LAYOUT_MENU = 2, - UI_LAYOUT_TOOLBAR = 3, - UI_LAYOUT_PIEMENU = 4, - UI_LAYOUT_VERT_BAR = 5, + UI_LAYOUT_PANEL = 0, + UI_LAYOUT_HEADER = 1, + UI_LAYOUT_MENU = 2, + UI_LAYOUT_TOOLBAR = 3, + UI_LAYOUT_PIEMENU = 4, + UI_LAYOUT_VERT_BAR = 5, }; -#define UI_UNIT_X ((void)0, U.widget_unit) -#define UI_UNIT_Y ((void)0, U.widget_unit) +#define UI_UNIT_X ((void)0, U.widget_unit) +#define UI_UNIT_Y ((void)0, U.widget_unit) enum { - UI_LAYOUT_ALIGN_EXPAND = 0, - UI_LAYOUT_ALIGN_LEFT = 1, - UI_LAYOUT_ALIGN_CENTER = 2, - UI_LAYOUT_ALIGN_RIGHT = 3, + UI_LAYOUT_ALIGN_EXPAND = 0, + UI_LAYOUT_ALIGN_LEFT = 1, + UI_LAYOUT_ALIGN_CENTER = 2, + UI_LAYOUT_ALIGN_RIGHT = 3, }; enum { - UI_ITEM_O_RETURN_PROPS = 1 << 0, - UI_ITEM_R_EXPAND = 1 << 1, - UI_ITEM_R_SLIDER = 1 << 2, - UI_ITEM_R_TOGGLE = 1 << 3, - UI_ITEM_R_ICON_ONLY = 1 << 4, - UI_ITEM_R_EVENT = 1 << 5, - UI_ITEM_R_FULL_EVENT = 1 << 6, - UI_ITEM_R_NO_BG = 1 << 7, - UI_ITEM_R_IMMEDIATE = 1 << 8, - UI_ITEM_O_DEPRESS = 1 << 9, - UI_ITEM_R_COMPACT = 1 << 10, + UI_ITEM_O_RETURN_PROPS = 1 << 0, + UI_ITEM_R_EXPAND = 1 << 1, + UI_ITEM_R_SLIDER = 1 << 2, + UI_ITEM_R_TOGGLE = 1 << 3, + UI_ITEM_R_ICON_ONLY = 1 << 4, + UI_ITEM_R_EVENT = 1 << 5, + UI_ITEM_R_FULL_EVENT = 1 << 6, + UI_ITEM_R_NO_BG = 1 << 7, + UI_ITEM_R_IMMEDIATE = 1 << 8, + UI_ITEM_O_DEPRESS = 1 << 9, + UI_ITEM_R_COMPACT = 1 << 10, }; #define UI_HEADER_OFFSET ((void)0, 0.4f * UI_UNIT_X) /* 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, - UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = 1 << 3, + UI_TEMPLATE_OP_PROPS_SHOW_TITLE = 1 << 0, + UI_TEMPLATE_OP_PROPS_SHOW_EMPTY = 1 << 1, + UI_TEMPLATE_OP_PROPS_COMPACT = 1 << 2, + UI_TEMPLATE_OP_PROPS_HIDE_ADVANCED = 1 << 3, }; /* used for transp checkers */ @@ -1028,16 +1713,24 @@ enum { * 8------4 */ enum { - UI_CNR_TOP_LEFT = 1 << 0, - UI_CNR_TOP_RIGHT = 1 << 1, - UI_CNR_BOTTOM_RIGHT = 1 << 2, - UI_CNR_BOTTOM_LEFT = 1 << 3, - /* just for convenience */ - UI_CNR_NONE = 0, - UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), + UI_CNR_TOP_LEFT = 1 << 0, + UI_CNR_TOP_RIGHT = 1 << 1, + UI_CNR_BOTTOM_RIGHT = 1 << 2, + UI_CNR_BOTTOM_LEFT = 1 << 3, + /* just for convenience */ + UI_CNR_NONE = 0, + UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), }; -uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, struct uiStyle *style); +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 *r_x, int *r_y); @@ -1094,12 +1787,19 @@ bool uiLayoutGetPropDecorate(uiLayout *layout); uiLayout *uiLayoutRow(uiLayout *layout, bool align); uiLayout *uiLayoutColumn(uiLayout *layout, bool align); uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align); -uiLayout *uiLayoutGridFlow( - uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align); +uiLayout *uiLayoutGridFlow(uiLayout *layout, + bool row_major, + int columns_len, + bool even_columns, + bool even_rows, + bool align); uiLayout *uiLayoutBox(uiLayout *layout); -uiLayout *uiLayoutListBox( - uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop, - struct PointerRNA *actptr, struct PropertyRNA *actprop); +uiLayout *uiLayoutListBox(uiLayout *layout, + struct uiList *ui_list, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + struct PointerRNA *actptr, + struct PropertyRNA *actprop); uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align); uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align); uiLayout *uiLayoutOverlap(uiLayout *layout); @@ -1108,169 +1808,397 @@ uiLayout *uiLayoutRadial(uiLayout *layout); /* templates */ void uiTemplateHeader(uiLayout *layout, struct bContext *C); -void uiTemplateID( - uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, - const char *newop, const char *openop, const char *unlinkop, - int filter, const bool live_icon); -void uiTemplateIDBrowse( - uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, - const char *newop, const char *openop, const char *unlinkop, int filter); -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, const bool hide_buttons); -void uiTemplateIDTabs( - uiLayout *layout, struct bContext *C, - PointerRNA *ptr, const char *propname, - const char *newop, const char *menu, - 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); +void uiTemplateID(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname, + const char *newop, + const char *openop, + const char *unlinkop, + int filter, + const bool live_icon); +void uiTemplateIDBrowse(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname, + const char *newop, + const char *openop, + const char *unlinkop, + int filter); +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, + const bool hide_buttons); +void uiTemplateIDTabs(uiLayout *layout, + struct bContext *C, + PointerRNA *ptr, + const char *propname, + const char *newop, + const char *menu, + 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); uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); -void uiTemplateGpencilColorPreview( - uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, - int rows, int cols, float scale, int filter); +void uiTemplateGpencilColorPreview(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname, + int rows, + int cols, + float scale, + int filter); uiLayout *uiTemplateShaderFx(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); void uiTemplateOperatorRedoProperties(uiLayout *layout, const struct bContext *C); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); -void uiTemplatePreview( - uiLayout *layout, struct bContext *C, struct ID *id, bool show_buttons, struct ID *parent, - struct MTex *slot, const char *preview_id); -void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand); +void uiTemplatePreview(uiLayout *layout, + struct bContext *C, + struct ID *id, + bool show_buttons, + struct ID *parent, + struct MTex *slot, + const char *preview_id); +void uiTemplateColorRamp(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + bool expand); void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); -void uiTemplateIconView( - uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, - float icon_scale, float icon_scale_popup); +void uiTemplateIconView(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + bool show_labels, + float icon_scale, + float icon_scale_popup); void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateCurveMapping( - uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, - bool levels, bool brush, bool neg_slope, bool tone); -void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic); +void uiTemplateCurveMapping(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + int type, + bool levels, + bool brush, + bool neg_slope, + bool tone); +void uiTemplateColorPicker(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + bool value_slider, + bool lock, + bool lock_luminosity, + bool cubic); void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool color); void uiTemplateCryptoPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateLayers( - uiLayout *layout, struct PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_layer); -void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, bool compact, bool multiview); +void uiTemplateLayers(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + PointerRNA *used_ptr, + const char *used_propname, + int active_layer); +void uiTemplateImage(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname, + struct PointerRNA *userptr, + bool compact, + bool multiview); void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, bool color_management); void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr); void uiTemplateImageViews(uiLayout *layout, struct PointerRNA *imaptr); void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA *ptr); -void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); -void uiTemplateImageInfo(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); +void uiTemplateImageLayers(uiLayout *layout, + struct bContext *C, + struct Image *ima, + struct ImageUser *iuser); +void uiTemplateImageInfo(uiLayout *layout, + struct bContext *C, + struct Image *ima, + struct ImageUser *iuser); void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); void UI_but_func_operator_search(uiBut *but); void uiTemplateOperatorSearch(uiLayout *layout); -eAutoPropButsReturn uiTemplateOperatorPropertyButs( - const struct bContext *C, uiLayout *layout, struct wmOperator *op, - const eButLabelAlign label_align, const short flag); +eAutoPropButsReturn uiTemplateOperatorPropertyButs(const struct bContext *C, + uiLayout *layout, + struct wmOperator *op, + 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); void uiTemplateInputStatus(uiLayout *layout, struct bContext *C); void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr); -void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name); +void uiTemplateComponentMenu(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + const char *name); void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color); -void uiTemplateCacheFile(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname); +void uiTemplateCacheFile(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname); struct ColorBand *UI_block_get_colorband_from_template_menu(struct uiBlock *block); /* Default UIList class name, keep in sync with its declaration in bl_ui/__init__.py */ #define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list" -void uiTemplateList( - uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id, - struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr, - const char *active_propname, const char *item_dyntip_propname, - int rows, int maxrows, int layout_type, int columns, bool sort_reverse, bool sort_lock); -void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); -void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); +void uiTemplateList(uiLayout *layout, + struct bContext *C, + const char *listtype_name, + const char *list_id, + struct PointerRNA *dataptr, + const char *propname, + struct PointerRNA *active_dataptr, + const char *active_propname, + const char *item_dyntip_propname, + int rows, + int maxrows, + int layout_type, + int columns, + bool sort_reverse, + bool sort_lock); +void uiTemplateNodeLink(uiLayout *layout, + struct bNodeTree *ntree, + struct bNode *node, + struct bNodeSocket *input); +void uiTemplateNodeView(uiLayout *layout, + struct bContext *C, + struct bNodeTree *ntree, + struct bNode *node, + struct bNodeSocket *input); void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); -void uiTemplateTextureShow(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); - -void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, bool compact); +void uiTemplateTextureShow(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + struct PropertyRNA *prop); + +void uiTemplateMovieClip(struct uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname, + bool compact); void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, bool compact); -void uiTemplateMovieclipInformation(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr); - -void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateColormanagedViewSettings(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname); +void uiTemplateMarker(struct uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + PointerRNA *userptr, + PointerRNA *trackptr, + bool compact); +void uiTemplateMovieclipInformation(struct uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + struct PointerRNA *userptr); + +void uiTemplateColorspaceSettings(struct uiLayout *layout, + struct PointerRNA *ptr, + const char *propname); +void uiTemplateColormanagedViewSettings(struct uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + const char *propname); int uiTemplateRecentFiles(struct uiLayout *layout, int rows); /* items */ void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname); -void uiItemEnumO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, const char *propname, int value); -void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int icon, const char *propname, int value); -void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value); -void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, const char *value); +void uiItemEnumO_ptr(uiLayout *layout, + struct wmOperatorType *ot, + const char *name, + int icon, + const char *propname, + int value); +void uiItemEnumO(uiLayout *layout, + const char *opname, + const char *name, + int icon, + const char *propname, + int value); +void uiItemEnumO_value(uiLayout *layout, + const char *name, + int icon, + const char *opname, + const char *propname, + int value); +void uiItemEnumO_string(uiLayout *layout, + const char *name, + int icon, + const char *opname, + const char *propname, + const char *value); void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname); -void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value); -void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value); -void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, float value); -void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, const char *value); - -void uiItemFullO_ptr( - uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, - struct IDProperty *properties, int context, int flag, - PointerRNA *r_opptr); -void uiItemFullO( - uiLayout *layout, const char *idname, const char *name, int icon, - struct IDProperty *properties, int context, int flag, - PointerRNA *r_opptr); -void uiItemFullOMenuHold_ptr( - uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, - struct IDProperty *properties, int context, int flag, - const char *menu_id, /* extra menu arg. */ - PointerRNA *r_opptr); - -void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon); -void uiItemFullR( - uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, - const char *name, int icon); -void uiItemFullR_with_popover( - uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, - const char *name, int icon, - const char *panel_type); -void uiItemFullR_with_menu( - uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, - const char *name, int icon, - const char *menu_type); -void uiItemEnumR_prop(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, PropertyRNA *prop, int value); -void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value); -void uiItemEnumR_string_prop(uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, const char *value, const char *name, int icon); -void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon); +void uiItemBooleanO(uiLayout *layout, + const char *name, + int icon, + const char *opname, + const char *propname, + int value); +void uiItemIntO(uiLayout *layout, + const char *name, + int icon, + const char *opname, + const char *propname, + int value); +void uiItemFloatO(uiLayout *layout, + const char *name, + int icon, + const char *opname, + const char *propname, + float value); +void uiItemStringO(uiLayout *layout, + const char *name, + int icon, + const char *opname, + const char *propname, + const char *value); + +void uiItemFullO_ptr(uiLayout *layout, + struct wmOperatorType *ot, + const char *name, + int icon, + struct IDProperty *properties, + int context, + int flag, + PointerRNA *r_opptr); +void uiItemFullO(uiLayout *layout, + const char *idname, + const char *name, + int icon, + struct IDProperty *properties, + int context, + int flag, + PointerRNA *r_opptr); +void uiItemFullOMenuHold_ptr(uiLayout *layout, + struct wmOperatorType *ot, + const char *name, + int icon, + struct IDProperty *properties, + int context, + int flag, + const char *menu_id, /* extra menu arg. */ + PointerRNA *r_opptr); + +void uiItemR(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + int flag, + const char *name, + int icon); +void uiItemFullR(uiLayout *layout, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + int index, + int value, + int flag, + const char *name, + int icon); +void uiItemFullR_with_popover(uiLayout *layout, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + int index, + int value, + int flag, + const char *name, + int icon, + const char *panel_type); +void uiItemFullR_with_menu(uiLayout *layout, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + int index, + int value, + int flag, + const char *name, + int icon, + const char *menu_type); +void uiItemEnumR_prop(uiLayout *layout, + const char *name, + int icon, + struct PointerRNA *ptr, + PropertyRNA *prop, + int value); +void uiItemEnumR(uiLayout *layout, + const char *name, + int icon, + struct PointerRNA *ptr, + const char *propname, + int value); +void uiItemEnumR_string_prop(uiLayout *layout, + struct PointerRNA *ptr, + PropertyRNA *prop, + const char *value, + const char *name, + int icon); +void uiItemEnumR_string(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + const char *value, + const char *name, + int icon); void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiItemPointerR_prop(uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, struct PointerRNA *searchptr, PropertyRNA *searchprop, const char *name, int icon); -void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon); -void uiItemsFullEnumO( - uiLayout *layout, const char *opname, const char *propname, - struct IDProperty *properties, int context, int flag); -void uiItemsFullEnumO_items( - uiLayout *layout, struct wmOperatorType *ot, PointerRNA ptr, PropertyRNA *prop, - struct IDProperty *properties, int context, int flag, - const EnumPropertyItem *item_array, int totitem); +void uiItemPointerR_prop(uiLayout *layout, + struct PointerRNA *ptr, + PropertyRNA *prop, + struct PointerRNA *searchptr, + PropertyRNA *searchprop, + const char *name, + int icon); +void uiItemPointerR(uiLayout *layout, + struct PointerRNA *ptr, + const char *propname, + struct PointerRNA *searchptr, + const char *searchpropname, + const char *name, + int icon); +void uiItemsFullEnumO(uiLayout *layout, + const char *opname, + const char *propname, + struct IDProperty *properties, + int context, + int flag); +void uiItemsFullEnumO_items(uiLayout *layout, + struct wmOperatorType *ot, + PointerRNA ptr, + PropertyRNA *prop, + struct IDProperty *properties, + int context, + int flag, + const EnumPropertyItem *item_array, + int totitem); void uiItemL(uiLayout *layout, const char *name, int icon); /* label */ /* label icon for dragging */ @@ -1288,98 +2216,129 @@ void uiItemS_ex(uiLayout *layout, float factor); void uiItemSpacer(uiLayout *layout); void uiItemPopoverPanel_ptr( - uiLayout *layout, struct bContext *C, - struct PanelType *pt, - const char *name, int icon); + uiLayout *layout, struct bContext *C, struct PanelType *pt, const char *name, int icon); void uiItemPopoverPanel( - uiLayout *layout, struct bContext *C, - 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); + uiLayout *layout, struct bContext *C, 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 uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN); -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); -void uiItemMenuEnumR_prop(uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, const char *name, int icon); -void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, int icon); -void uiItemTabsEnumR_prop(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, PropertyRNA *prop, bool icon_only); +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); +void uiItemMenuEnumR_prop( + uiLayout *layout, struct PointerRNA *ptr, PropertyRNA *prop, const char *name, int icon); +void uiItemMenuEnumR( + uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, int icon); +void uiItemTabsEnumR_prop(uiLayout *layout, + struct bContext *C, + struct PointerRNA *ptr, + PropertyRNA *prop, + bool icon_only); /* UI Operators */ typedef struct uiDragColorHandle { - float color[3]; - bool gamma_corrected; + float color[3]; + bool gamma_corrected; } uiDragColorHandle; void ED_operatortypes_ui(void); void ED_keymap_ui(struct wmKeyConfig *keyconf); void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); -bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event, const char **tooltip); - -bool UI_context_copy_to_selected_list( - struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, - struct ListBase *r_lb, bool *r_use_path_from_id, char **r_path); +bool UI_drop_color_poll(struct bContext *C, + struct wmDrag *drag, + const struct wmEvent *event, + const char **tooltip); + +bool UI_context_copy_to_selected_list(struct bContext *C, + struct PointerRNA *ptr, + struct PropertyRNA *prop, + struct ListBase *r_lb, + bool *r_use_path_from_id, + char **r_path); /* Helpers for Operators */ uiBut *UI_context_active_but_get(const struct bContext *C); -uiBut *UI_context_active_but_prop_get( - const struct bContext *C, - struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index); +uiBut *UI_context_active_but_prop_get(const struct bContext *C, + struct PointerRNA *r_ptr, + struct PropertyRNA **r_prop, + int *r_index); void UI_context_active_but_prop_handle(struct bContext *C); struct wmOperator *UI_context_active_operator_get(const struct bContext *C); void UI_context_update_anim_flag(const struct bContext *C); -void UI_context_active_but_prop_get_filebrowser( - const struct bContext *C, - struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, bool *r_is_undo); -void UI_context_active_but_prop_get_templateID( - struct bContext *C, - struct PointerRNA *r_ptr, struct PropertyRNA **r_prop); +void UI_context_active_but_prop_get_filebrowser(const struct bContext *C, + struct PointerRNA *r_ptr, + struct PropertyRNA **r_prop, + bool *r_is_undo); +void UI_context_active_but_prop_get_templateID(struct bContext *C, + struct PointerRNA *r_ptr, + struct PropertyRNA **r_prop); struct ID *UI_context_active_but_get_tab_ID(struct bContext *C); uiBut *UI_region_active_but_get(struct ARegion *ar); /* uiFontStyle.align */ typedef enum eFontStyle_Align { - UI_STYLE_TEXT_LEFT = 0, - UI_STYLE_TEXT_CENTER = 1, - UI_STYLE_TEXT_RIGHT = 2, + UI_STYLE_TEXT_LEFT = 0, + UI_STYLE_TEXT_CENTER = 1, + UI_STYLE_TEXT_RIGHT = 2, } eFontStyle_Align; struct uiFontStyleDraw_Params { - eFontStyle_Align align; - uint word_wrap : 1; + eFontStyle_Align align; + uint word_wrap : 1; }; /* Styled text draw */ void UI_fontstyle_set(const struct uiFontStyle *fs); -void UI_fontstyle_draw_ex( - const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - const uchar col[4], const struct uiFontStyleDraw_Params *fs_params, - 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 uchar col[4], const struct uiFontStyleDraw_Params *fs_params); -void UI_fontstyle_draw_rotated( - const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - const uchar col[4]); +void UI_fontstyle_draw_ex(const struct uiFontStyle *fs, + const struct rcti *rect, + const char *str, + const uchar col[4], + const struct uiFontStyleDraw_Params *fs_params, + 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 uchar col[4], + const struct uiFontStyleDraw_Params *fs_params); +void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, + const struct rcti *rect, + const char *str, + const uchar col[4]); void UI_fontstyle_draw_simple( - const struct uiFontStyle *fs, float x, float y, const char *str, - const uchar col[4]); -void UI_fontstyle_draw_simple_backdrop( - const struct uiFontStyle *fs, float x, float y, const char *str, - const float col_fg[4], const float col_bg[4]); + const struct uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]); +void UI_fontstyle_draw_simple_backdrop(const struct uiFontStyle *fs, + float x, + float y, + const char *str, + const float col_fg[4], + const float col_bg[4]); 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, 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 */ +struct uiStyle *UI_style_get(void); /* use for fonts etc */ +struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ /* linker workaround ack! */ void UI_template_fix_linking(void); @@ -1403,7 +2362,10 @@ bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *bu 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, bool is_label); +struct ARegion *UI_tooltip_create_from_button(struct bContext *C, + struct ARegion *butregion, + uiBut *but, + bool is_label); struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz); void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar); @@ -1436,4 +2398,4 @@ void UI_style_init_default(void); /* Support click-drag motion which presses the button and closes a popover (like a menu). */ #define USE_UI_POPOVER_ONCE -#endif /* __UI_INTERFACE_H__ */ +#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 bd1f04ebcff..5666421c27f 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -33,18 +33,18 @@ struct bContext; enum eIconSizes; typedef struct IconFile { - struct IconFile *next, *prev; - char filename[256]; /* FILE_MAXFILE size */ - int index; + struct IconFile *next, *prev; + char filename[256]; /* FILE_MAXFILE size */ + int index; } IconFile; #define ICON_DEFAULT_HEIGHT 16 -#define ICON_DEFAULT_WIDTH 16 +#define ICON_DEFAULT_WIDTH 16 #define ICON_DEFAULT_HEIGHT_TOOLBAR 32 #define ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f)) -#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f)) +#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f)) #define PREVIEW_DEFAULT_HEIGHT 128 @@ -55,20 +55,32 @@ void UI_icons_init(void); int UI_icon_get_width(int icon_id); int UI_icon_get_height(int icon_id); -void UI_id_icon_render( - const struct bContext *C, struct Scene *scene, struct ID *id, const bool big, const bool use_job); +void UI_id_icon_render(const struct bContext *C, + struct Scene *scene, + struct ID *id, + const bool big, + const bool use_job); 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); +void UI_icon_draw_preview_aspect_size( + float x, float y, int icon_id, float aspect, float alpha, int size); -void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha, const char mono_color[4]); -void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3], const char mono_color[4]); +void UI_icon_draw_aspect( + float x, float y, int icon_id, float aspect, float alpha, const char mono_color[4]); +void UI_icon_draw_aspect_color( + float x, float y, int icon_id, float aspect, const float rgb[3], const char mono_color[4]); 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, const char mono_color[4]); +void UI_icon_draw_desaturate(float x, + float y, + int icon_id, + float aspect, + float alpha, + float desaturate, + const char mono_color[4]); void UI_icons_free(void); void UI_icons_free_drawinfo(void *drawinfo); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 61fc09b751b..1fc1fba4b4a 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -33,284 +33,284 @@ #define DEF_ICON_BLANK(name) ICON_BLANK_##name, typedef enum { - /* ui */ +/* ui */ #include "UI_icons.h" - BIFICONID_LAST, + BIFICONID_LAST, } BIFIconID; -#define BIFICONID_FIRST (ICON_NONE) +#define BIFICONID_FIRST (ICON_NONE) /* use to denote intentionally unset theme color */ #define TH_UNDEFINED -1 typedef enum ThemeColorID { - TH_REDALERT, - - TH_THEMEUI, -// common colors among spaces - - TH_BACK, - /** Use when 'TH_SHOW_BACK_GRAD' is set (the lower, darker color). */ - TH_BACK_GRAD, - TH_TEXT, - TH_TEXT_HI, - TH_TITLE, - TH_TAB_ACTIVE, - TH_TAB_INACTIVE, - TH_TAB_BACK, - TH_TAB_OUTLINE, - - TH_HEADER, - TH_HEADERDESEL, - TH_HEADER_TEXT, - TH_HEADER_TEXT_HI, - - /* panels */ - TH_PANEL_HEADER, - TH_PANEL_BACK, - TH_PANEL_SUB_BACK, - - TH_BUTBACK, - TH_BUTBACK_TEXT, - TH_BUTBACK_TEXT_HI, - - TH_SHADE1, - TH_SHADE2, - TH_HILITE, - - TH_GRID, - TH_WIRE, - TH_WIRE_INNER, - TH_WIRE_EDIT, - TH_SELECT, - TH_ACTIVE, - TH_GROUP, - TH_GROUP_ACTIVE, - TH_TRANSFORM, - TH_VERTEX, - TH_VERTEX_SELECT, - TH_VERTEX_UNREFERENCED, - TH_VERTEX_SIZE, - TH_OUTLINE_WIDTH, - TH_EDGE, - TH_EDGE_SELECT, - TH_EDGE_SEAM, - TH_EDGE_FACESEL, - TH_FACE, - TH_FACE_SELECT, - TH_NORMAL, - TH_VNORMAL, - TH_LNORMAL, - TH_FACE_DOT, - TH_FACEDOT_SIZE, - TH_CFRAME, - TH_TIME_KEYFRAME, - TH_TIME_GP_KEYFRAME, - TH_NURB_ULINE, - TH_NURB_VLINE, - TH_NURB_SEL_ULINE, - TH_NURB_SEL_VLINE, - - /* this eight colors should be in one block */ - TH_HANDLE_FREE, - TH_HANDLE_AUTO, - TH_HANDLE_VECT, - TH_HANDLE_ALIGN, - TH_HANDLE_AUTOCLAMP, - TH_HANDLE_SEL_FREE, - TH_HANDLE_SEL_AUTO, - TH_HANDLE_SEL_VECT, - TH_HANDLE_SEL_ALIGN, - TH_HANDLE_SEL_AUTOCLAMP, - - TH_ACTIVE_SPLINE, - TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */ - - TH_SYNTAX_B, - TH_SYNTAX_V, - TH_SYNTAX_R, - TH_SYNTAX_C, - TH_SYNTAX_L, - TH_SYNTAX_D, - TH_SYNTAX_N, - TH_SYNTAX_S, - - TH_BONE_SOLID, - TH_BONE_POSE, - TH_BONE_POSE_ACTIVE, - - TH_STRIP, - TH_STRIP_SELECT, - - TH_KEYTYPE_KEYFRAME, /* KEYTYPES */ - TH_KEYTYPE_KEYFRAME_SELECT, - TH_KEYTYPE_EXTREME, - TH_KEYTYPE_EXTREME_SELECT, - TH_KEYTYPE_BREAKDOWN, - TH_KEYTYPE_BREAKDOWN_SELECT, - TH_KEYTYPE_JITTER, - TH_KEYTYPE_JITTER_SELECT, - TH_KEYTYPE_MOVEHOLD, - TH_KEYTYPE_MOVEHOLD_SELECT, - - TH_KEYBORDER, - TH_KEYBORDER_SELECT, - - TH_LIGHT, - TH_SPEAKER, - TH_CAMERA, - TH_EMPTY, - - TH_NODE, - TH_NODE_INPUT, - TH_NODE_OUTPUT, - TH_NODE_COLOR, - TH_NODE_FILTER, - TH_NODE_VECTOR, - TH_NODE_TEXTURE, - TH_NODE_PATTERN, - TH_NODE_SCRIPT, - TH_NODE_LAYOUT, - TH_NODE_SHADER, - TH_NODE_INTERFACE, - TH_NODE_CONVERTOR, - TH_NODE_GROUP, - TH_NODE_FRAME, - TH_NODE_MATTE, - TH_NODE_DISTORT, - - TH_CONSOLE_OUTPUT, - TH_CONSOLE_INPUT, - TH_CONSOLE_INFO, - TH_CONSOLE_ERROR, - TH_CONSOLE_CURSOR, - TH_CONSOLE_SELECT, - - TH_SEQ_MOVIE, - TH_SEQ_MOVIECLIP, - TH_SEQ_MASK, - TH_SEQ_IMAGE, - TH_SEQ_SCENE, - TH_SEQ_AUDIO, - TH_SEQ_EFFECT, - TH_SEQ_TRANSITION, - TH_SEQ_META, - TH_SEQ_TEXT, - TH_SEQ_PREVIEW, - - TH_EDGE_SHARP, - TH_EDITMESH_ACTIVE, - - TH_HANDLE_VERTEX, - TH_HANDLE_VERTEX_SELECT, - TH_HANDLE_VERTEX_SIZE, - - TH_GP_VERTEX, - TH_GP_VERTEX_SELECT, - TH_GP_VERTEX_SIZE, - - TH_DOPESHEET_CHANNELOB, - TH_DOPESHEET_CHANNELSUBOB, - TH_DOPESHEET_IPOLINE, - - TH_PREVIEW_BACK, - - TH_EDGE_CREASE, - - TH_DRAWEXTRA_EDGELEN, - TH_DRAWEXTRA_EDGEANG, - TH_DRAWEXTRA_FACEAREA, - TH_DRAWEXTRA_FACEANG, - - TH_NODE_CURVING, - - TH_MARKER_OUTLINE, - TH_MARKER, - TH_ACT_MARKER, - TH_SEL_MARKER, - TH_BUNDLE_SOLID, - TH_DIS_MARKER, - TH_PATH_BEFORE, - TH_PATH_AFTER, - TH_CAMERA_PATH, - TH_LOCK_MARKER, - - TH_STITCH_PREVIEW_FACE, - TH_STITCH_PREVIEW_EDGE, - TH_STITCH_PREVIEW_VERT, - TH_STITCH_PREVIEW_STITCHABLE, - TH_STITCH_PREVIEW_UNSTITCHABLE, - TH_STITCH_PREVIEW_ACTIVE, - - TH_PAINT_CURVE_HANDLE, - TH_PAINT_CURVE_PIVOT, - - TH_UV_SHADOW, - TH_UV_OTHERS, - - TH_FREESTYLE_EDGE_MARK, - TH_FREESTYLE_FACE_MARK, - - TH_MATCH, /* highlight color for search matches */ - TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */ - - TH_SKIN_ROOT, - - TH_ANIM_ACTIVE, /* active action */ - TH_ANIM_INACTIVE, /* no active action */ - TH_ANIM_PREVIEW_RANGE,/* preview range overlay */ - - TH_ICON_COLLECTION, - TH_ICON_OBJECT, - TH_ICON_OBJECT_DATA, - TH_ICON_MODIFIER, - TH_ICON_SHADING, - - TH_NLA_TWEAK, /* 'tweaking' track in NLA */ - TH_NLA_TWEAK_DUPLI, /* error/warning flag for other strips referencing dupli strip */ - - TH_NLA_TRANSITION, - TH_NLA_TRANSITION_SEL, - TH_NLA_META, - TH_NLA_META_SEL, - TH_NLA_SOUND, - TH_NLA_SOUND_SEL, - - TH_WIDGET_EMBOSS, - - TH_EDITOR_OUTLINE, - - TH_AXIS_X, /* X/Y/Z Axis */ - TH_AXIS_Y, - TH_AXIS_Z, - - TH_GIZMO_HI, - TH_GIZMO_PRIMARY, - TH_GIZMO_SECONDARY, - TH_GIZMO_A, - TH_GIZMO_B, - - TH_SHOW_BACK_GRAD, - - TH_INFO_SELECTED, - TH_INFO_SELECTED_TEXT, - TH_INFO_ERROR, - TH_INFO_ERROR_TEXT, - TH_INFO_WARNING, - TH_INFO_WARNING_TEXT, - TH_INFO_INFO, - TH_INFO_INFO_TEXT, - TH_INFO_DEBUG, - TH_INFO_DEBUG_TEXT, - TH_VIEW_OVERLAY, - - TH_V3D_CLIPPING_BORDER, - - TH_METADATA_BG, - TH_METADATA_TEXT, + TH_REDALERT, + + TH_THEMEUI, + // common colors among spaces + + TH_BACK, + /** Use when 'TH_SHOW_BACK_GRAD' is set (the lower, darker color). */ + TH_BACK_GRAD, + TH_TEXT, + TH_TEXT_HI, + TH_TITLE, + TH_TAB_ACTIVE, + TH_TAB_INACTIVE, + TH_TAB_BACK, + TH_TAB_OUTLINE, + + TH_HEADER, + TH_HEADERDESEL, + TH_HEADER_TEXT, + TH_HEADER_TEXT_HI, + + /* panels */ + TH_PANEL_HEADER, + TH_PANEL_BACK, + TH_PANEL_SUB_BACK, + + TH_BUTBACK, + TH_BUTBACK_TEXT, + TH_BUTBACK_TEXT_HI, + + TH_SHADE1, + TH_SHADE2, + TH_HILITE, + + TH_GRID, + TH_WIRE, + TH_WIRE_INNER, + TH_WIRE_EDIT, + TH_SELECT, + TH_ACTIVE, + TH_GROUP, + TH_GROUP_ACTIVE, + TH_TRANSFORM, + TH_VERTEX, + TH_VERTEX_SELECT, + TH_VERTEX_UNREFERENCED, + TH_VERTEX_SIZE, + TH_OUTLINE_WIDTH, + TH_EDGE, + TH_EDGE_SELECT, + TH_EDGE_SEAM, + TH_EDGE_FACESEL, + TH_FACE, + TH_FACE_SELECT, + TH_NORMAL, + TH_VNORMAL, + TH_LNORMAL, + TH_FACE_DOT, + TH_FACEDOT_SIZE, + TH_CFRAME, + TH_TIME_KEYFRAME, + TH_TIME_GP_KEYFRAME, + TH_NURB_ULINE, + TH_NURB_VLINE, + TH_NURB_SEL_ULINE, + TH_NURB_SEL_VLINE, + + /* this eight colors should be in one block */ + TH_HANDLE_FREE, + TH_HANDLE_AUTO, + TH_HANDLE_VECT, + TH_HANDLE_ALIGN, + TH_HANDLE_AUTOCLAMP, + TH_HANDLE_SEL_FREE, + TH_HANDLE_SEL_AUTO, + TH_HANDLE_SEL_VECT, + TH_HANDLE_SEL_ALIGN, + TH_HANDLE_SEL_AUTOCLAMP, + + TH_ACTIVE_SPLINE, + TH_ACTIVE_VERT, /* equivalent of TH_EDITMESH_ACTIVE for splines */ + + TH_SYNTAX_B, + TH_SYNTAX_V, + TH_SYNTAX_R, + TH_SYNTAX_C, + TH_SYNTAX_L, + TH_SYNTAX_D, + TH_SYNTAX_N, + TH_SYNTAX_S, + + TH_BONE_SOLID, + TH_BONE_POSE, + TH_BONE_POSE_ACTIVE, + + TH_STRIP, + TH_STRIP_SELECT, + + TH_KEYTYPE_KEYFRAME, /* KEYTYPES */ + TH_KEYTYPE_KEYFRAME_SELECT, + TH_KEYTYPE_EXTREME, + TH_KEYTYPE_EXTREME_SELECT, + TH_KEYTYPE_BREAKDOWN, + TH_KEYTYPE_BREAKDOWN_SELECT, + TH_KEYTYPE_JITTER, + TH_KEYTYPE_JITTER_SELECT, + TH_KEYTYPE_MOVEHOLD, + TH_KEYTYPE_MOVEHOLD_SELECT, + + TH_KEYBORDER, + TH_KEYBORDER_SELECT, + + TH_LIGHT, + TH_SPEAKER, + TH_CAMERA, + TH_EMPTY, + + TH_NODE, + TH_NODE_INPUT, + TH_NODE_OUTPUT, + TH_NODE_COLOR, + TH_NODE_FILTER, + TH_NODE_VECTOR, + TH_NODE_TEXTURE, + TH_NODE_PATTERN, + TH_NODE_SCRIPT, + TH_NODE_LAYOUT, + TH_NODE_SHADER, + TH_NODE_INTERFACE, + TH_NODE_CONVERTOR, + TH_NODE_GROUP, + TH_NODE_FRAME, + TH_NODE_MATTE, + TH_NODE_DISTORT, + + TH_CONSOLE_OUTPUT, + TH_CONSOLE_INPUT, + TH_CONSOLE_INFO, + TH_CONSOLE_ERROR, + TH_CONSOLE_CURSOR, + TH_CONSOLE_SELECT, + + TH_SEQ_MOVIE, + TH_SEQ_MOVIECLIP, + TH_SEQ_MASK, + TH_SEQ_IMAGE, + TH_SEQ_SCENE, + TH_SEQ_AUDIO, + TH_SEQ_EFFECT, + TH_SEQ_TRANSITION, + TH_SEQ_META, + TH_SEQ_TEXT, + TH_SEQ_PREVIEW, + + TH_EDGE_SHARP, + TH_EDITMESH_ACTIVE, + + TH_HANDLE_VERTEX, + TH_HANDLE_VERTEX_SELECT, + TH_HANDLE_VERTEX_SIZE, + + TH_GP_VERTEX, + TH_GP_VERTEX_SELECT, + TH_GP_VERTEX_SIZE, + + TH_DOPESHEET_CHANNELOB, + TH_DOPESHEET_CHANNELSUBOB, + TH_DOPESHEET_IPOLINE, + + TH_PREVIEW_BACK, + + TH_EDGE_CREASE, + + TH_DRAWEXTRA_EDGELEN, + TH_DRAWEXTRA_EDGEANG, + TH_DRAWEXTRA_FACEAREA, + TH_DRAWEXTRA_FACEANG, + + TH_NODE_CURVING, + + TH_MARKER_OUTLINE, + TH_MARKER, + TH_ACT_MARKER, + TH_SEL_MARKER, + TH_BUNDLE_SOLID, + TH_DIS_MARKER, + TH_PATH_BEFORE, + TH_PATH_AFTER, + TH_CAMERA_PATH, + TH_LOCK_MARKER, + + TH_STITCH_PREVIEW_FACE, + TH_STITCH_PREVIEW_EDGE, + TH_STITCH_PREVIEW_VERT, + TH_STITCH_PREVIEW_STITCHABLE, + TH_STITCH_PREVIEW_UNSTITCHABLE, + TH_STITCH_PREVIEW_ACTIVE, + + TH_PAINT_CURVE_HANDLE, + TH_PAINT_CURVE_PIVOT, + + TH_UV_SHADOW, + TH_UV_OTHERS, + + TH_FREESTYLE_EDGE_MARK, + TH_FREESTYLE_FACE_MARK, + + TH_MATCH, /* highlight color for search matches */ + TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */ + + TH_SKIN_ROOT, + + TH_ANIM_ACTIVE, /* active action */ + TH_ANIM_INACTIVE, /* no active action */ + TH_ANIM_PREVIEW_RANGE, /* preview range overlay */ + + TH_ICON_COLLECTION, + TH_ICON_OBJECT, + TH_ICON_OBJECT_DATA, + TH_ICON_MODIFIER, + TH_ICON_SHADING, + + TH_NLA_TWEAK, /* 'tweaking' track in NLA */ + TH_NLA_TWEAK_DUPLI, /* error/warning flag for other strips referencing dupli strip */ + + TH_NLA_TRANSITION, + TH_NLA_TRANSITION_SEL, + TH_NLA_META, + TH_NLA_META_SEL, + TH_NLA_SOUND, + TH_NLA_SOUND_SEL, + + TH_WIDGET_EMBOSS, + + TH_EDITOR_OUTLINE, + + TH_AXIS_X, /* X/Y/Z Axis */ + TH_AXIS_Y, + TH_AXIS_Z, + + TH_GIZMO_HI, + TH_GIZMO_PRIMARY, + TH_GIZMO_SECONDARY, + TH_GIZMO_A, + TH_GIZMO_B, + + TH_SHOW_BACK_GRAD, + + TH_INFO_SELECTED, + TH_INFO_SELECTED_TEXT, + TH_INFO_ERROR, + TH_INFO_ERROR_TEXT, + TH_INFO_WARNING, + TH_INFO_WARNING_TEXT, + TH_INFO_INFO, + TH_INFO_INFO_TEXT, + TH_INFO_DEBUG, + TH_INFO_DEBUG_TEXT, + TH_VIEW_OVERLAY, + + TH_V3D_CLIPPING_BORDER, + + TH_METADATA_BG, + TH_METADATA_TEXT, - TH_EDGE_BEVEL, - TH_VERTEX_BEVEL, + TH_EDGE_BEVEL, + TH_VERTEX_BEVEL, } ThemeColorID; /* specific defines per space should have higher define values */ @@ -318,48 +318,54 @@ typedef enum ThemeColorID { struct bTheme; struct bThemeState { - struct bTheme *theme; - int spacetype, regionid; + struct bTheme *theme; + int spacetype, regionid; }; // THE CODERS API FOR THEMES: // returns one value, not scaled -float UI_GetThemeValuef(int colorid); -int UI_GetThemeValue(int colorid); +float UI_GetThemeValuef(int colorid); +int UI_GetThemeValue(int colorid); -float UI_GetThemeValueTypef(int colorid, int spacetype); -int UI_GetThemeValueType(int colorid, int spacetype); +float UI_GetThemeValueTypef(int colorid, int spacetype); +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]); -void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]); +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]); +void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]); // 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]); +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]); +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]); +void UI_GetThemeColor4fv(int colorid, float col[4]); /* get four color values from specified space type, scaled to 0.0-1.0 range */ -void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4]); +void UI_GetThemeColorType4fv(int colorid, int spacetype, 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]); +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]); +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]); +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]); @@ -371,26 +377,30 @@ void UI_GetThemeColorType3ubv(int colorid, int spacetype, unsigned char col[3]); void UI_GetThemeColorType4ubv(int colorid, int spacetype, unsigned char col[4]); // get theme color for coloring monochrome icons -bool UI_GetIconThemeColor4fv(int colorid, float col[4]); +bool UI_GetIconThemeColor4fv(int colorid, float col[4]); // shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor) -void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset); +void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3], int offset); // 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); +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); +void UI_ThemeClearColor(int colorid); // clear the openGL ClearColor using the input colorid using optional transparency -void UI_ThemeClearColorAlpha(int colorid, float alpha); +void UI_ThemeClearColorAlpha(int colorid, float alpha); // internal (blender) usage only, for init and set active -void UI_SetTheme(int spacetype, int regionid); +void UI_SetTheme(int spacetype, int regionid); // get current theme struct bTheme *UI_GetTheme(void); @@ -406,4 +416,4 @@ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, i void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis); -#endif /* __UI_RESOURCES_H__ */ +#endif /* __UI_RESOURCES_H__ */ diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 6efbcf09e97..fde865d4bba 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -34,7 +34,7 @@ /* ---- General Defines ---- */ /* generic value to use when coordinate lies out of view when converting */ -#define V2D_IS_CLIPPED 12000 +#define V2D_IS_CLIPPED 12000 /* Common View2D view types * NOTE: only define a type here if it completely sets all (+/- a few) of the relevant flags @@ -42,80 +42,80 @@ * than one specific place */ enum eView2D_CommonViewTypes { - /* custom view type (region has defined all necessary flags already) */ - V2D_COMMONVIEW_CUSTOM = -1, - /* standard (only use this when setting up a new view, as a sensible base for most settings) */ - V2D_COMMONVIEW_STANDARD, - /* listview (i.e. Outliner) */ - V2D_COMMONVIEW_LIST, - /* stackview (this is basically a list where new items are added at the top) */ - V2D_COMMONVIEW_STACK, - /* headers (this is basically the same as listview, but no y-panning) */ - V2D_COMMONVIEW_HEADER, - /* ui region containing panels */ - V2D_COMMONVIEW_PANELS_UI, + /* custom view type (region has defined all necessary flags already) */ + V2D_COMMONVIEW_CUSTOM = -1, + /* standard (only use this when setting up a new view, as a sensible base for most settings) */ + V2D_COMMONVIEW_STANDARD, + /* listview (i.e. Outliner) */ + V2D_COMMONVIEW_LIST, + /* stackview (this is basically a list where new items are added at the top) */ + V2D_COMMONVIEW_STACK, + /* headers (this is basically the same as listview, but no y-panning) */ + V2D_COMMONVIEW_HEADER, + /* ui region containing panels */ + V2D_COMMONVIEW_PANELS_UI, }; /* ---- Defines for Scroller/Grid Arguments ----- */ /* 'dummy' argument to pass when argument is irrelevant */ -#define V2D_ARG_DUMMY -1 +#define V2D_ARG_DUMMY -1 /* Grid units */ enum eView2D_Units { - /* for drawing time */ - V2D_UNIT_SECONDS = 0, - V2D_UNIT_FRAMES, - V2D_UNIT_FRAMESCALE, + /* for drawing time */ + V2D_UNIT_SECONDS = 0, + V2D_UNIT_FRAMES, + V2D_UNIT_FRAMESCALE, - /* for drawing values */ - V2D_UNIT_VALUES, + /* for drawing values */ + V2D_UNIT_VALUES, }; /* clamping of grid values to whole numbers */ enum eView2D_Clamp { - V2D_GRID_NOCLAMP = 0, - V2D_GRID_CLAMP, + V2D_GRID_NOCLAMP = 0, + V2D_GRID_CLAMP, }; /* flags for grid-lines to draw */ enum eView2D_Gridlines { - V2D_HORIZONTAL_LINES = (1 << 0), - V2D_VERTICAL_LINES = (1 << 1), - V2D_HORIZONTAL_AXIS = (1 << 2), - V2D_VERTICAL_AXIS = (1 << 3), - V2D_HORIZONTAL_FINELINES = (1 << 4), - - V2D_GRIDLINES_MAJOR = (V2D_VERTICAL_LINES | V2D_VERTICAL_AXIS | V2D_HORIZONTAL_LINES | V2D_HORIZONTAL_AXIS), - V2D_GRIDLINES_ALL = (V2D_GRIDLINES_MAJOR | V2D_HORIZONTAL_FINELINES), + V2D_HORIZONTAL_LINES = (1 << 0), + V2D_VERTICAL_LINES = (1 << 1), + V2D_HORIZONTAL_AXIS = (1 << 2), + V2D_VERTICAL_AXIS = (1 << 3), + V2D_HORIZONTAL_FINELINES = (1 << 4), + + V2D_GRIDLINES_MAJOR = (V2D_VERTICAL_LINES | V2D_VERTICAL_AXIS | V2D_HORIZONTAL_LINES | + V2D_HORIZONTAL_AXIS), + V2D_GRIDLINES_ALL = (V2D_GRIDLINES_MAJOR | V2D_HORIZONTAL_FINELINES), }; /* ------ Defines for Scrollers ----- */ /* scroller area */ -#define V2D_SCROLL_HEIGHT (0.45f * U.widget_unit) -#define V2D_SCROLL_WIDTH (0.45f * 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) +#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) +#define V2D_SCROLLER_HANDLE_SIZE (0.6f * U.widget_unit) /* ------ Define for UI_view2d_sync ----- */ /* means copy it from another v2d */ -#define V2D_LOCK_SET 0 +#define V2D_LOCK_SET 0 /* means copy it to the other v2ds */ -#define V2D_LOCK_COPY 1 - +#define V2D_LOCK_COPY 1 /* ------------------------------------------ */ /* Macros: */ /* test if mouse in a scrollbar (assume that scroller availability has been tested) */ -#define IN_2D_VERT_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->vert, co)) -#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->hor, co)) +#define IN_2D_VERT_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->vert, co)) +#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->hor, co)) /* ------------------------------------------ */ /* Type definitions: */ @@ -161,53 +161,99 @@ void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, const b void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ -View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, - short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); +View2DGrid *UI_view2d_grid_calc(struct Scene *scene, + struct View2D *v2d, + short xunits, + short xclamp, + short yunits, + short yclamp, + int winx, + int winy); void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag); void UI_view2d_constant_grid_draw(struct View2D *v2d, float step); -void UI_view2d_multi_grid_draw(struct View2D *v2d, int colorid, float step, int level_size, int totlevels); +void UI_view2d_multi_grid_draw( + struct View2D *v2d, int colorid, float step, int level_size, int totlevels); void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy); -void UI_view2d_grid_draw_numbers_horizontal(const struct Scene *scene, const struct View2D *v2d, - const View2DGrid *grid, const struct rcti *rect, - int unit, bool whole_numbers_only); -void UI_view2d_grid_draw_numbers_vertical(const struct Scene *scene, const struct View2D *v2d, - const View2DGrid *grid, const struct rcti *rect, - int unit, float text_offset); +void UI_view2d_grid_draw_numbers_horizontal(const struct Scene *scene, + const struct View2D *v2d, + const View2DGrid *grid, + const struct rcti *rect, + int unit, + bool whole_numbers_only); +void UI_view2d_grid_draw_numbers_vertical(const struct Scene *scene, + const struct View2D *v2d, + const View2DGrid *grid, + const struct rcti *rect, + int unit, + float text_offset); void UI_view2d_grid_free(View2DGrid *grid); /* scrollbar drawing */ -View2DScrollers *UI_view2d_scrollers_calc( - const struct bContext *C, struct View2D *v2d, const struct rcti *mask_custom, - short xunits, short xclamp, short yunits, short yclamp); -void UI_view2d_scrollers_draw(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers); +View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C, + struct View2D *v2d, + const struct rcti *mask_custom, + short xunits, + short xclamp, + short yunits, + short yclamp); +void UI_view2d_scrollers_draw(const struct bContext *C, + struct View2D *v2d, + View2DScrollers *scrollers); void UI_view2d_scrollers_free(View2DScrollers *scrollers); /* list view tools */ -void UI_view2d_listview_cell_to_view(struct View2D *v2d, float columnwidth, float rowheight, - float startx, float starty, int column, int row, +void UI_view2d_listview_cell_to_view(struct View2D *v2d, + float columnwidth, + float rowheight, + float startx, + float starty, + int column, + int row, struct rctf *rect); -void UI_view2d_listview_view_to_cell(struct View2D *v2d, float columnwidth, float rowheight, - float startx, float starty, float viewx, float viewy, - int *column, int *row); -void UI_view2d_listview_visible_cells(struct View2D *v2d, float columnwidth, float rowheight, - float startx, float starty, int *column_min, int *column_max, - int *row_min, int *row_max); +void UI_view2d_listview_view_to_cell(struct View2D *v2d, + float columnwidth, + float rowheight, + float startx, + float starty, + float viewx, + float viewy, + int *column, + int *row); +void UI_view2d_listview_visible_cells(struct View2D *v2d, + float columnwidth, + float rowheight, + float startx, + float starty, + int *column_min, + int *column_max, + int *row_min, + int *row_max); /* coordinate conversion */ float UI_view2d_region_to_view_x(const struct View2D *v2d, float x); float UI_view2d_region_to_view_y(const struct View2D *v2d, float y); -void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL(); -void UI_view2d_region_to_view_rctf(const struct View2D *v2d, const struct rctf *rect_src, struct rctf *rect_dst) ATTR_NONNULL(); +void UI_view2d_region_to_view( + const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL(); +void UI_view2d_region_to_view_rctf(const struct View2D *v2d, + const struct rctf *rect_src, + struct rctf *rect_dst) ATTR_NONNULL(); float UI_view2d_view_to_region_x(const struct View2D *v2d, float x); float UI_view2d_view_to_region_y(const struct View2D *v2d, float y); -bool UI_view2d_view_to_region_clip(const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL(); - -void UI_view2d_view_to_region(struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL(); -void UI_view2d_view_to_region_fl(struct View2D *v2d, float x, float y, float *r_region_x, float *r_region_y) ATTR_NONNULL(); -void UI_view2d_view_to_region_m4(struct View2D *v2d, float matrix[4][4]) ATTR_NONNULL(); -void UI_view2d_view_to_region_rcti(struct View2D *v2d, const struct rctf *rect_src, struct rcti *rect_dst) ATTR_NONNULL(); -bool UI_view2d_view_to_region_rcti_clip(struct View2D *v2d, const struct rctf *rect_src, struct rcti *rect_dst) ATTR_NONNULL(); +bool UI_view2d_view_to_region_clip( + const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL(); + +void UI_view2d_view_to_region( + struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL(); +void UI_view2d_view_to_region_fl( + struct View2D *v2d, float x, float y, float *r_region_x, float *r_region_y) ATTR_NONNULL(); +void UI_view2d_view_to_region_m4(struct View2D *v2d, float matrix[4][4]) ATTR_NONNULL(); +void UI_view2d_view_to_region_rcti(struct View2D *v2d, + const struct rctf *rect_src, + struct rcti *rect_dst) ATTR_NONNULL(); +bool UI_view2d_view_to_region_rcti_clip(struct View2D *v2d, + const struct rctf *rect_src, + struct rcti *rect_dst) ATTR_NONNULL(); /* utilities */ struct View2D *UI_view2d_fromcontext(const struct bContext *C); @@ -224,24 +270,30 @@ void UI_view2d_center_set(struct View2D *v2d, float x, float y); void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac); char UI_view2d_mouse_in_scrollers_ex( - const struct ARegion *ar, const struct View2D *v2d, int x, int y, - int *r_scroll); -char UI_view2d_mouse_in_scrollers( - const struct ARegion *ar, const struct View2D *v2d, int x, int y); + const struct ARegion *ar, const struct View2D *v2d, int x, int y, int *r_scroll); +char UI_view2d_mouse_in_scrollers(const struct ARegion *ar, + const 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, - const char *str, size_t str_len, const char col[4]); -void UI_view2d_text_cache_add_rectf(struct View2D *v2d, const struct rctf *rect_view, - const char *str, size_t str_len, const char col[4]); +void UI_view2d_text_cache_add( + struct View2D *v2d, float x, float y, const char *str, size_t str_len, const char col[4]); +void UI_view2d_text_cache_add_rectf(struct View2D *v2d, + const struct rctf *rect_view, + const char *str, + size_t str_len, + const char col[4]); void UI_view2d_text_cache_draw(struct ARegion *ar); /* operators */ void ED_operatortypes_view2d(void); void ED_keymap_view2d(struct wmKeyConfig *keyconf); -void UI_view2d_smooth_view(struct bContext *C, struct ARegion *ar, - const struct rctf *cur, const int smooth_viewtx); +void UI_view2d_smooth_view(struct bContext *C, + struct ARegion *ar, + const struct rctf *cur, + const int smooth_viewtx); #define UI_MARKER_MARGIN_Y (42 * UI_DPI_FAC) #endif /* __UI_VIEW2D_H__ */ |