diff options
Diffstat (limited to 'source/blender/editors')
338 files changed, 4499 insertions, 3316 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 8e0452de8ea..2eaa42ee578 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4158,7 +4158,6 @@ static void ANIM_init_channel_typeinfo_data(void) } } -/* Get type info from given channel type */ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale) { /* Sanity checks. */ @@ -4179,7 +4178,6 @@ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale) /* --------------------------- */ -/* Print debug info string for the given channel */ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); @@ -4212,7 +4210,6 @@ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level) } } -/* Retrieves the Action associated with this animation channel. */ bAction *ANIM_channel_action_get(const bAnimListElem *ale) { if (ale->datatype == ALE_ACT) { @@ -4232,9 +4229,6 @@ bAction *ANIM_channel_action_get(const bAnimListElem *ale) /* --------------------------- */ -/* Check if some setting for a channel is enabled - * Returns: 1 = On, 0 = Off, -1 = Invalid - */ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting) { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); @@ -4317,10 +4311,6 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne } \ (void)0 -/* 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, @@ -4394,7 +4384,6 @@ static bool achannel_is_being_renamed(const bAnimContext *ac, return false; } -/* Draw the given channel */ void ANIM_channel_draw( bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index) { @@ -5150,7 +5139,6 @@ static void draw_setting_widget(bAnimContext *ac, } } -/* Draw UI widgets the given channel */ void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListElem *ale, diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 69fabd004cc..b97837a76b9 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -74,8 +74,6 @@ /* -------------------------- Selection ------------------------------------- */ -/* Set the given animation-channel as the active one for the active context */ -/* TODO: extend for animdata types... */ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, @@ -83,6 +81,8 @@ void ANIM_set_active_channel(bAnimContext *ac, void *channel_data, eAnim_ChannelType channel_type) { + /* TODO: extend for animdata types. */ + ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -460,7 +460,6 @@ static void anim_channels_select_set(bAnimContext *ac, } } -/* Set selection state of all animation channels in the context. */ void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel) { ListBase anim_data = anim_channels_for_selection(ac); @@ -468,7 +467,6 @@ void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel) ANIM_animdata_freelist(&anim_data); } -/* Toggle selection state of all animation channels in the context. */ void ANIM_anim_channels_select_toggle(bAnimContext *ac) { ListBase anim_data = anim_channels_for_selection(ac); @@ -588,15 +586,6 @@ static void anim_flush_channel_setting_down(bAnimContext *ac, } } -/* 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 - * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... - * - ale_setting: the anim channel (not in the anim_data list directly, though occurring there) - * with the new state of the setting that we want flushed up/down the hierarchy - * - 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, @@ -652,7 +641,6 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, /* -------------------------- F-Curves ------------------------------------- */ -/* Delete the given F-Curve from its AnimData block */ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *fcu) { /* - if no AnimData, we've got nowhere to remove the F-Curve from @@ -708,8 +696,6 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f BKE_fcurve_free(fcu); } -/* If the action has no F-Curves, unlink it from AnimData if it did not - * come from a NLA Strip being tweaked. */ bool ANIM_remove_empty_action_from_animdata(struct AnimData *adt) { if (adt->action != NULL) { diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 088de80bb65..7a34d8b542a 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -56,9 +56,6 @@ /* **************************** depsgraph tagging ******************************** */ -/* tags the given anim list element for refreshes (if applicable) - * due to Animation Editor editing - */ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) { ID *id; @@ -114,8 +111,6 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) } } -/* tags the given ID block for refreshes (if applicable) due to - * Animation Editor editing */ void ANIM_id_update(Main *bmain, ID *id) { if (id) { @@ -276,7 +271,6 @@ static void animchan_sync_gplayer(bAnimListElem *ale) /* ---------------- */ -/* Main call to be exported to animation editors */ void ANIM_sync_animchannels_to_data(const bContext *C) { bAnimContext ac; diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index f5a5609aa2e..6589756c526 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -63,7 +63,6 @@ /* *************************************************** */ /* CURRENT FRAME DRAWING */ -/* General call for drawing current frame indicator in animation editor */ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) { Scene *scene = CTX_data_scene(C); @@ -92,7 +91,6 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) /* PREVIEW RANGE 'CURTAINS' */ /* NOTE: 'Preview Range' tools are defined in `anim_ops.c`. */ -/* Draw preview range 'curtains' for highlighting where the animation data is */ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) { Scene *scene = CTX_data_scene(C); @@ -127,11 +125,6 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) /* *************************************************** */ /* SCENE FRAME RANGE */ -/** - * Draw frame range guides (for scene frame range) in background. - * - * TODO: Should we still show these when preview range is enabled? - */ void ANIM_draw_framerange(Scene *scene, View2D *v2d) { /* draw darkened area outside of active timeline frame range */ @@ -168,10 +161,6 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) immUnbindProgram(); } -/** - * Draw manually set intended playback frame range guides for the action in the background. - * Allows specifying a subset of the Y range of the view. - */ void ANIM_draw_action_framerange( AnimData *adt, bAction *action, View2D *v2d, float ymin, float ymax) { @@ -239,11 +228,6 @@ void ANIM_draw_action_framerange( /* *************************************************** */ /* NLA-MAPPING UTILITIES (required for drawing and also editing keyframes). */ -/** - * Obtain the AnimData block providing NLA-mapping for the given channel (if applicable). - * - * TODO: do not supply return this if the animdata tells us that there is no mapping to perform. - */ AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale) { /* sanity checks */ @@ -319,10 +303,6 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt) return 0; } -/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve - * - restore = whether to map points back to non-mapped time - * - only_keys = whether to only adjust the location of the center point of beztriples - */ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys) { KeyframeEditData ked = {{NULL}}; @@ -350,7 +330,6 @@ void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, boo /* *************************************************** */ /* UNITS CONVERSION MAPPING (required for drawing and editing keyframes) */ -/* Get flags used for normalization in ANIM_unit_mapping_get_factor. */ short ANIM_get_normalization_flags(bAnimContext *ac) { if (ac->sl->spacetype == SPACE_GRAPH) { @@ -518,7 +497,6 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo return factor; } -/* Get unit conversion factor for given ID + F-Curve */ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag, float *r_offset) { if (flag & ANIM_UNITCONV_NORMALIZE) { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index da5d5543136..c1a09b9d21f 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -362,11 +362,6 @@ static bool nlaedit_get_context(bAnimContext *ac, SpaceNla *snla) /* ----------- Public API --------------- */ -/* Obtain current anim-data context, - * given that context info from Blender context has already been set: - * - AnimContext to write to is provided as pointer to var on stack so that we don't have - * allocation/freeing costs (which are not that avoidable with channels). - */ bool ANIM_animdata_context_getdata(bAnimContext *ac) { SpaceLink *sl = ac->sl; @@ -397,11 +392,6 @@ bool ANIM_animdata_context_getdata(bAnimContext *ac) return (ok && ac->data); } -/* Obtain current anim-data context from Blender Context info - * - AnimContext to write to is provided as pointer to var on stack so that we don't have - * allocation/freeing costs (which are not that avoidable with channels). - * - Clears data and sets the information from Blender Context which is useful - */ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) { Main *bmain = CTX_data_main(C); @@ -3460,14 +3450,6 @@ static size_t animdata_filter_remove_duplis(ListBase *anim_data) /* ----------- Public API --------------- */ -/** - * This function filters the active data source to leave only animation channels suitable for - * usage by the caller. It will return the length of the list - * - * \param anim_data: Is a pointer to a #ListBase, - * to which the filtered animation channels will be placed for use. - * \param filter_mode: how should the data be filtered - bit-mapping accessed flags. - */ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, eAnimFilter_Flags filter_mode, diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 05837ed17b9..0315b93508b 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -43,14 +43,6 @@ /* ----------------------- Getter functions ----------------------- */ -/** - * Write into "name" buffer, the name of the property - * (retrieved using RNA from the curve's settings), - * and return the icon used for the struct that this property refers to - * - * \warning name buffer we're writing to cannot exceed 256 chars - * (check anim_channels_defines.c for details). - */ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) { int icon = 0; diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index 335034fef6e..d4a8e7921d6 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -99,12 +99,10 @@ Depsgraph *animviz_depsgraph_build(Main *bmain, return depsgraph; } -/* get list of motion paths to be baked for the given object - * - assumes the given list is ready to be used - */ -/* TODO: it would be nice in future to be able to update objects dependent on these bones too? */ void animviz_get_object_motionpaths(Object *ob, ListBase *targets) { + /* TODO: it would be nice in future to be able to update objects dependent on these bones too? */ + MPathTarget *mpt; /* object itself first */ @@ -356,12 +354,6 @@ static void motionpath_free_free_tree_data(ListBase *targets) } } -/* Perform baking of the given object's and/or its bones' transforms to motion paths - * - scene: current scene - * - ob: object whose flagged motion-paths should get calculated - * - recalc: whether we need to - */ -/* TODO: include reports pointer? */ void animviz_calc_motionpaths(Depsgraph *depsgraph, Main *bmain, Scene *scene, @@ -369,6 +361,8 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, eAnimvizCalcRange range, bool restore) { + /* TODO: include reports pointer? */ + /* Sanity check. */ if (ELEM(NULL, targets, targets->first)) { return; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index b94ee68e276..c4d8484e6a8 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -891,9 +891,6 @@ static void panel_register_stepped(ARegionType *region_type, /** \name Panel Creation * \{ */ -/** - * Checks if the panels match the active strip / curve, rebuilds them if they don't. - */ void ANIM_fmodifier_panels(const bContext *C, ID *owner_id, ListBase *fmodifiers, @@ -969,17 +966,12 @@ static ListBase fmodifier_copypaste_buf = {NULL, NULL}; /* ---------- */ -/* free the copy/paste buffer */ void ANIM_fmodifiers_copybuf_free(void) { /* just free the whole buffer */ free_fmodifiers(&fmodifier_copypaste_buf); } -/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not - * assuming that the buffer has been cleared already with ANIM_fmodifiers_copybuf_free() - * - active: only copy the active modifier - */ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) { bool ok = true; @@ -1009,9 +1001,6 @@ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) return ok; } -/* 'Paste' the F-Modifier(s) from the buffer to the specified list - * - replace: free all the existing modifiers to leave only the pasted ones - */ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, FCurve *curve) { FModifier *fcm; diff --git a/source/blender/editors/asset/ED_asset_filter.h b/source/blender/editors/asset/ED_asset_filter.h index 340c4c9dbe7..de18b5fff1e 100644 --- a/source/blender/editors/asset/ED_asset_filter.h +++ b/source/blender/editors/asset/ED_asset_filter.h @@ -27,6 +27,18 @@ extern "C" { struct AssetFilterSettings; struct AssetHandle; +/** + * Compare \a asset against the settings of \a filter. + * + * Individual filter parameters are ORed with the asset properties. That means: + * * The asset type must be one of the ID types filtered by, and + * * The asset must contain at least one of the tags filtered by. + * However for an asset to be matching it must have one match in each of the parameters. I.e. one + * matching type __and__ at least one matching tag. + * + * \returns True if the asset should be visible with these filter settings (parameters match). + * Otherwise returns false (mismatch). + */ bool ED_asset_filter_matches_asset(const struct AssetFilterSettings *filter, const struct AssetHandle *asset); diff --git a/source/blender/editors/asset/ED_asset_library.h b/source/blender/editors/asset/ED_asset_library.h index cb055584364..62a7d6ffa9b 100644 --- a/source/blender/editors/asset/ED_asset_library.h +++ b/source/blender/editors/asset/ED_asset_library.h @@ -26,8 +26,25 @@ extern "C" { #endif +/** + * Return an index that can be used to uniquely identify \a library, assuming + * that all relevant indices were created with this function. + */ int ED_asset_library_reference_to_enum_value(const AssetLibraryReference *library); +/** + * Return an asset library reference matching the index returned by + * #ED_asset_library_reference_to_enum_value(). + */ AssetLibraryReference ED_asset_library_reference_from_enum_value(int value); +/** + * Translate all available asset libraries to an RNA enum, whereby the enum values match the result + * of #ED_asset_library_reference_to_enum_value() for any given library. + * + * Since this is meant for UI display, skips non-displayable libraries, that is, libraries with an + * empty name or path. + * + * \param include_local_library: Whether to include the "Current File" library or not. + */ const struct EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf( bool include_local_library); diff --git a/source/blender/editors/asset/ED_asset_list.h b/source/blender/editors/asset/ED_asset_list.h index 61d7729b651..669bb6dbe36 100644 --- a/source/blender/editors/asset/ED_asset_list.h +++ b/source/blender/editors/asset/ED_asset_list.h @@ -31,21 +31,47 @@ struct ID; struct bContext; struct wmNotifier; +/** + * Invoke asset list reading, potentially in a parallel job. Won't wait until the job is done, + * and may return earlier. + */ void ED_assetlist_storage_fetch(const struct AssetLibraryReference *library_reference, const struct bContext *C); void ED_assetlist_ensure_previews_job(const struct AssetLibraryReference *library_reference, struct bContext *C); void ED_assetlist_clear(const struct AssetLibraryReference *library_reference, struct bContext *C); bool ED_assetlist_storage_has_list_for_library(const AssetLibraryReference *library_reference); +/** + * Tag all asset lists in the storage that show main data as needing an update (re-fetch). + * + * This only tags the data. If the asset list is visible on screen, the space is still responsible + * for ensuring the necessary redraw. It can use #ED_assetlist_listen() to check if the asset-list + * needs a redraw for a given notifier. + */ void ED_assetlist_storage_tag_main_data_dirty(void); +/** + * Remapping of ID pointers within the asset lists. Typically called when an ID is deleted to clear + * all references to it (\a id_new is null then). + */ void ED_assetlist_storage_id_remap(struct ID *id_old, struct ID *id_new); +/** + * Can't wait for static deallocation to run. There's nested data allocated with our guarded + * allocator, it will complain about unfreed memory on exit. + */ void ED_assetlist_storage_exit(void); struct ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle); const char *ED_assetlist_library_path(const struct AssetLibraryReference *library_reference); +/** + * \return True if the region needs a UI redraw. + */ bool ED_assetlist_listen(const struct AssetLibraryReference *library_reference, const struct wmNotifier *notifier); +/** + * \return The number of assets stored in the asset list for \a library_reference, or -1 if there + * is no list fetched for it. + */ int ED_assetlist_size(const struct AssetLibraryReference *library_reference); #ifdef __cplusplus diff --git a/source/blender/editors/asset/intern/asset_filter.cc b/source/blender/editors/asset/intern/asset_filter.cc index c22bbc923eb..70e3e2f55ea 100644 --- a/source/blender/editors/asset/intern/asset_filter.cc +++ b/source/blender/editors/asset/intern/asset_filter.cc @@ -27,18 +27,6 @@ #include "ED_asset_filter.h" #include "ED_asset_handle.h" -/** - * Compare \a asset against the settings of \a filter. - * - * Individual filter parameters are ORed with the asset properties. That means: - * * The asset type must be one of the ID types filtered by, and - * * The asset must contain at least one of the tags filtered by. - * However for an asset to be matching it must have one match in each of the parameters. I.e. one - * matching type __and__ at least one matching tag. - * - * \returns True if the asset should be visible with these filter settings (parameters match). - * Otherwise returns false (mismatch). - */ bool ED_asset_filter_matches_asset(const AssetFilterSettings *filter, const AssetHandle *asset) { ID_Type asset_type = ED_asset_handle_get_id_type(asset); diff --git a/source/blender/editors/asset/intern/asset_library_reference_enum.cc b/source/blender/editors/asset/intern/asset_library_reference_enum.cc index 2ea01ecd343..05526f222a5 100644 --- a/source/blender/editors/asset/intern/asset_library_reference_enum.cc +++ b/source/blender/editors/asset/intern/asset_library_reference_enum.cc @@ -35,10 +35,6 @@ #include "ED_asset_library.h" -/** - * Return an index that can be used to uniquely identify \a library, assuming - * that all relevant indices were created with this function. - */ int ED_asset_library_reference_to_enum_value(const AssetLibraryReference *library) { /* Simple case: Predefined repository, just set the value. */ @@ -57,10 +53,6 @@ int ED_asset_library_reference_to_enum_value(const AssetLibraryReference *librar return ASSET_LIBRARY_LOCAL; } -/** - * Return an asset library reference matching the index returned by - * #ED_asset_library_reference_to_enum_value(). - */ AssetLibraryReference ED_asset_library_reference_from_enum_value(int value) { AssetLibraryReference library; @@ -92,15 +84,6 @@ AssetLibraryReference ED_asset_library_reference_from_enum_value(int value) return library; } -/** - * Translate all available asset libraries to an RNA enum, whereby the enum values match the result - * of #ED_asset_library_reference_to_enum_value() for any given library. - * - * Since this is meant for UI display, skips non-displayable libraries, that is, libraries with an - * empty name or path. - * - * \param include_local_library: Whether to include the "Current File" library or not. - */ const EnumPropertyItem *ED_asset_library_reference_to_rna_enum_itemf( const bool include_local_library) { diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc index 1a15d314c1f..af6dbf24209 100644 --- a/source/blender/editors/asset/intern/asset_list.cc +++ b/source/blender/editors/asset/intern/asset_list.cc @@ -434,10 +434,6 @@ AssetListStorage::AssetListMap &AssetListStorage::global_storage() using namespace blender::ed::asset; -/** - * Invoke asset list reading, potentially in a parallel job. Won't wait until the job is done, - * and may return earlier. - */ void ED_assetlist_storage_fetch(const AssetLibraryReference *library_reference, const bContext *C) { AssetListStorage::fetch_library(*library_reference, *C); @@ -532,9 +528,6 @@ const char *ED_assetlist_library_path(const AssetLibraryReference *library_refer return nullptr; } -/** - * \return True if the region needs a UI redraw. - */ bool ED_assetlist_listen(const AssetLibraryReference *library_reference, const wmNotifier *notifier) { @@ -545,10 +538,6 @@ bool ED_assetlist_listen(const AssetLibraryReference *library_reference, return false; } -/** - * \return The number of assets stored in the asset list for \a library_reference, or -1 if there - * is no list fetched for it. - */ int ED_assetlist_size(const AssetLibraryReference *library_reference) { AssetList *list = AssetListStorage::lookup_list(*library_reference); @@ -558,31 +547,16 @@ int ED_assetlist_size(const AssetLibraryReference *library_reference) return -1; } -/** - * Tag all asset lists in the storage that show main data as needing an update (re-fetch). - * - * This only tags the data. If the asset list is visible on screen, the space is still responsible - * for ensuring the necessary redraw. It can use #ED_assetlist_listen() to check if the asset-list - * needs a redraw for a given notifier. - */ void ED_assetlist_storage_tag_main_data_dirty() { AssetListStorage::tagMainDataDirty(); } -/** - * Remapping of ID pointers within the asset lists. Typically called when an ID is deleted to clear - * all references to it (\a id_new is null then). - */ void ED_assetlist_storage_id_remap(ID *id_old, ID *id_new) { AssetListStorage::remapID(id_old, id_new); } -/** - * Can't wait for static deallocation to run. There's nested data allocated with our guarded - * allocator, it will complain about unfreed memory on exit. - */ void ED_assetlist_storage_exit() { AssetListStorage::destruct(); diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 8ecf41162e9..03ddeebde42 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -71,7 +71,13 @@ typedef enum eCurveElem_Types { } eCurveElem_Types; /* internal select utils */ +/** + * Returns 1 in case (de)selection was successful. + */ bool select_beztriple(BezTriple *bezt, bool selstatus, uint8_t flag, eVisible_Types hidden); +/** + * Returns 1 in case (de)selection was successful. + */ bool select_bpoint(BPoint *bp, bool selstatus, uint8_t flag, bool hidden); void FONT_OT_text_insert(struct wmOperatorType *ot); @@ -146,7 +152,14 @@ void ed_editnurb_translate_flag(struct ListBase *editnurb, uint8_t flag, const float vec[3], bool is_2d); +/** + * Only for #OB_SURF. + */ bool ed_editnurb_extrude_flag(struct EditNurb *editnurb, const uint8_t flag); +/** + * \param axis: is in world-space. + * \param cent: is in object-space. + */ bool ed_editnurb_spin(float viewmat[4][4], struct View3D *v3d, struct Object *obedit, diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index f8977b835b3..743b971de61 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1074,7 +1074,6 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves) } } -/* return 0 if animation data wasn't changed, 1 otherwise */ int ED_curve_updateAnimPaths(Main *bmain, Curve *cu) { AnimData *adt = BKE_animdata_from_id(&cu->id); @@ -1247,7 +1246,6 @@ static void remap_hooks_and_vertex_parents(Main *bmain, Object *obedit) } } -/* load editNurb in object */ void ED_curve_editnurb_load(Main *bmain, Object *obedit) { ListBase *editnurb = object_editcurve_get(obedit); @@ -1285,7 +1283,6 @@ void ED_curve_editnurb_load(Main *bmain, Object *obedit) } } -/* make copy in cu->editnurb */ void ED_curve_editnurb_make(Object *obedit) { Curve *cu = (Curve *)obedit->data; @@ -1991,7 +1988,6 @@ static void ed_curve_delete_selected(Object *obedit, View3D *v3d) } } -/* only for OB_SURF */ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const uint8_t flag) { BPoint *bp, *bpn, *newbp; @@ -4909,10 +4905,6 @@ bool ED_curve_editnurb_select_pick( /** \name Spin Operator * \{ */ -/** - * \param axis: is in world-space. - * \param cent: is in object-space. - */ bool ed_editnurb_spin( float viewmat[4][4], View3D *v3d, Object *obedit, const float axis[3], const float cent[3]) { @@ -6804,10 +6796,6 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) /** \name Join Operator * \{ */ -/** - * This is used externally, by #OBJECT_OT_join. - * TODO: shape keys - as with meshes. - */ int ED_curve_join_objects_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index a76e73d3cf1..1229b7eacc8 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -60,7 +60,6 @@ /** \name Utilities * \{ */ -/* returns 1 in case (de)selection was successful */ bool select_beztriple(BezTriple *bezt, bool selstatus, uint8_t flag, eVisible_Types hidden) { if ((bezt->hide == 0) || (hidden == HIDDEN)) { @@ -80,7 +79,6 @@ bool select_beztriple(BezTriple *bezt, bool selstatus, uint8_t flag, eVisible_Ty return false; } -/* returns 1 in case (de)selection was successful */ bool select_bpoint(BPoint *bp, bool selstatus, uint8_t flag, bool hidden) { if ((bp->hide == 0) || (hidden == 1)) { diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c index 210411c6eb5..5619e2efc36 100644 --- a/source/blender/editors/curve/editcurve_undo.c +++ b/source/blender/editors/curve/editcurve_undo.c @@ -305,7 +305,6 @@ static void curve_undosys_foreach_ID_ref(UndoStep *us_p, } } -/* Export for ED_undo_sys. */ void ED_curve_undosys_type(UndoType *ut) { ut->name = "Edit Curve"; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 6f18798bd2a..e2005795970 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -2199,9 +2199,6 @@ void FONT_OT_unlink(wmOperatorType *ot) ot->exec = font_unlink_exec; } -/** - * TextBox selection - */ bool ED_curve_editfont_select_pick( bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) { diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c index 21a6564edf4..45448f18675 100644 --- a/source/blender/editors/curve/editfont_undo.c +++ b/source/blender/editors/curve/editfont_undo.c @@ -405,7 +405,6 @@ static void font_undosys_foreach_ID_ref(UndoStep *us_p, foreach_ID_ref_fn(user_data, ((UndoRefID *)&us->obedit_ref)); } -/* Export for ED_undo_sys. */ void ED_font_undosys_type(UndoType *ut) { ut->name = "Edit Font"; diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c index 2ec287a62e9..1179c9140e2 100644 --- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c @@ -44,9 +44,6 @@ /* own includes */ #include "gizmo_library_intern.h" -/** - * Main draw call for GizmoGeomInfo data - */ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4]) diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h index f3670708543..a75a6b9a6ef 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_intern.h +++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h @@ -78,6 +78,10 @@ void gizmo_property_value_reset(bContext *C, void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4]); +/** + * Takes mouse coordinates and returns them in relation to the gizmo. + * Both 2D & 3D supported, use so we can use 2D gizmos in the 3D view. + */ bool gizmo_window_project_2d(bContext *C, const struct wmGizmo *gz, const float mval[2], @@ -93,6 +97,9 @@ bool gizmo_window_project_3d( #include "gizmo_geometry.h" +/** + * Main draw call for #GizmoGeomInfo data + */ void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, const bool select, const float color[4]); diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c index a0db2a8e627..0237c6062d1 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c @@ -175,10 +175,6 @@ void gizmo_color_get(const wmGizmo *gz, const bool highlight, float r_col[4]) /* -------------------------------------------------------------------- */ -/** - * Takes mouse coordinates and returns them in relation to the gizmo. - * Both 2D & 3D supported, use so we can use 2D gizmos in the 3D view. - */ bool gizmo_window_project_2d(bContext *C, const struct wmGizmo *gz, const float mval[2], diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c index d506af4450a..3362cf9732e 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -448,11 +448,6 @@ static void gizmo_arrow_exit(bContext *C, wmGizmo *gz, const bool cancel) /** \name Arrow Gizmo API * \{ */ -/** - * Define a custom property UI range - * - * \note Needs to be called before WM_gizmo_target_property_def_rna! - */ void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max) { ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz; @@ -467,11 +462,6 @@ void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max arrow->data.is_custom_range_set = true; } -/** - * Define a custom factor for arrow min/max distance - * - * \note Needs to be called before WM_gizmo_target_property_def_rna! - */ void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac) { ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz; diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index 7795eed7c21..3705ea38e11 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -788,7 +788,6 @@ static void annotation_draw_data_all(Scene *scene, /* ----- Annotation Sketches Drawing API ------ */ -/* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */ void ED_annotation_draw_2dimage(const bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); @@ -857,13 +856,6 @@ void ED_annotation_draw_2dimage(const bContext *C) annotation_draw_data_all(scene, gpd, offsx, offsy, sizex, sizey, CFRA, dflag, area->spacetype); } -/** - * Draw grease-pencil sketches to specified 2d-view - * assuming that matrices are already set correctly. - * - * \note This gets called twice - first time with onlyv2d=true to draw 'canvas' strokes, - * second time with onlyv2d=false for screen-aligned strokes. - */ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d) { wmWindowManager *wm = CTX_wm_manager(C); @@ -900,9 +892,6 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d) scene, gpd, 0, 0, region->winx, region->winy, CFRA, dflag, area->spacetype); } -/* draw annotations sketches to specified 3d-view assuming that matrices are already set - * correctly NOTE: this gets called twice - first time with only3d=true to draw 3d-strokes, - * second time with only3d=false for screen-aligned strokes */ void ED_annotation_draw_view3d( Scene *scene, struct Depsgraph *depsgraph, View3D *v3d, ARegion *region, bool only3d) { diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 2160aaf705f..6f63529298c 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -412,7 +412,6 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw) /* ----- General Drawing ------ */ -/* wrapper to draw strokes for filling operator */ void ED_gpencil_draw_fill(tGPDdraw *tgpw) { gpencil_draw_strokes(tgpw); diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index fbdb7c8e520..046b3088360 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -55,7 +55,6 @@ /* ***************************************** */ /* Generics - Loopers */ -/* Loops over the gp-frames for a gp-layer, and applies the given callback */ bool ED_gpencil_layer_frames_looper(bGPDlayer *gpl, Scene *scene, bool (*gpf_cb)(bGPDframe *, Scene *)) @@ -80,7 +79,6 @@ bool ED_gpencil_layer_frames_looper(bGPDlayer *gpl, /* ****************************************** */ /* Data Conversion Tools */ -/* make a listing all the gp-frames in a layer as cfraelems */ void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlysel) { CfraElem *ce; @@ -106,7 +104,6 @@ void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlys /* ***************************************** */ /* Selection Tools */ -/* check if one of the frames in this layer is selected */ bool ED_gpencil_layer_frame_select_check(const bGPDlayer *gpl) { /* error checking */ @@ -145,7 +142,6 @@ static void gpencil_frame_select(bGPDframe *gpf, short select_mode) } } -/* set all/none/invert select (like above, but with SELECT_* modes) */ void ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode) { /* error checking */ @@ -159,7 +155,6 @@ void ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode) } } -/* set all/none/invert select */ void ED_gpencil_layer_frame_select_set(bGPDlayer *gpl, short mode) { /* error checking */ @@ -171,7 +166,6 @@ void ED_gpencil_layer_frame_select_set(bGPDlayer *gpl, short mode) ED_gpencil_select_frames(gpl, mode); } -/* select the frame in this layer that occurs on this frame (there should only be one at most) */ void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode) { bGPDframe *gpf; @@ -187,7 +181,6 @@ void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode) } } -/* select the frames in this layer that occur within the bounds specified */ void ED_gpencil_layer_frames_select_box(bGPDlayer *gpl, float min, float max, short select_mode) { if (gpl == NULL) { @@ -202,7 +195,6 @@ void ED_gpencil_layer_frames_select_box(bGPDlayer *gpl, float min, float max, sh } } -/* select the frames in this layer that occur within the lasso/circle region specified */ void ED_gpencil_layer_frames_select_region(KeyframeEditData *ked, bGPDlayer *gpl, short tool, @@ -239,7 +231,6 @@ void ED_gpencil_layer_frames_select_region(KeyframeEditData *ked, /* ***************************************** */ /* Frame Editing Tools */ -/* Delete selected frames */ bool ED_gpencil_layer_frames_delete(bGPDlayer *gpl) { bool changed = false; @@ -260,7 +251,6 @@ bool ED_gpencil_layer_frames_delete(bGPDlayer *gpl) return changed; } -/* Duplicate selected frames from given gp-layer */ void ED_gpencil_layer_frames_duplicate(bGPDlayer *gpl) { /* error checking */ @@ -284,11 +274,6 @@ void ED_gpencil_layer_frames_duplicate(bGPDlayer *gpl) } } -/** - * Set keyframe type for selected frames from given gp-layer - * - * \param type: The type of keyframe (#eBezTriple_KeyframeType) to set selected frames to. - */ void ED_gpencil_layer_frames_keytype_set(bGPDlayer *gpl, short type) { if (gpl == NULL) { @@ -320,7 +305,6 @@ static int gpencil_anim_copy_firstframe = 999999999; static int gpencil_anim_copy_lastframe = -999999999; static int gpencil_anim_copy_cfra = 0; -/* This function frees any MEM_calloc'ed copy/paste buffer data */ void ED_gpencil_anim_copybuf_free(void) { BKE_gpencil_free_layers(&gpencil_anim_copybuf); @@ -331,11 +315,6 @@ void ED_gpencil_anim_copybuf_free(void) gpencil_anim_copy_cfra = 0; } -/* This function adds data to the copy/paste buffer, freeing existing data first - * Only the selected GP-layers get their selected keyframes copied. - * - * Returns whether the copy operation was successful or not - */ bool ED_gpencil_anim_copybuf_copy(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; @@ -404,7 +383,6 @@ bool ED_gpencil_anim_copybuf_copy(bAnimContext *ac) return true; } -/* Pastes keyframes from buffer, and reports success */ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) { ListBase anim_data = {NULL, NULL}; @@ -547,7 +525,6 @@ static bool gpencil_frame_snap_nearmarker(bGPDframe *gpf, Scene *scene) return false; } -/* snap selected frames to ... */ void ED_gpencil_layer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { @@ -648,8 +625,6 @@ static bool gpencil_frame_mirror_marker(bGPDframe *gpf, Scene *scene) return false; } -/* mirror selected gp-frames on... */ -/* TODO: mirror over a specific time */ void ED_gpencil_layer_mirror_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { diff --git a/source/blender/editors/gpencil/gpencil_add_blank.c b/source/blender/editors/gpencil/gpencil_add_blank.c index 3aa16e54597..4e4650e575c 100644 --- a/source/blender/editors/gpencil/gpencil_add_blank.c +++ b/source/blender/editors/gpencil/gpencil_add_blank.c @@ -76,7 +76,6 @@ static const ColorTemplate gp_stroke_material_black = { /* ***************************************************************** */ /* Blank API */ -/* Add a Simple empty object with one layer and one color. */ void ED_gpencil_create_blank(bContext *C, Object *ob, float UNUSED(mat[4][4])) { Main *bmain = CTX_data_main(C); diff --git a/source/blender/editors/gpencil/gpencil_add_lineart.c b/source/blender/editors/gpencil/gpencil_add_lineart.c index ac0da0ad1db..aad2d978bfb 100644 --- a/source/blender/editors/gpencil/gpencil_add_lineart.c +++ b/source/blender/editors/gpencil/gpencil_add_lineart.c @@ -83,7 +83,6 @@ static const ColorTemplate gp_stroke_material_black = { /* ***************************************************************** */ /* LineArt API */ -/* Add a Simple LineArt setup. */ void ED_gpencil_create_lineart(bContext *C, Object *ob) { Main *bmain = CTX_data_main(C); diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c index 8d60ef3ed12..3b952dbe7da 100644 --- a/source/blender/editors/gpencil/gpencil_add_monkey.c +++ b/source/blender/editors/gpencil/gpencil_add_monkey.c @@ -39,13 +39,6 @@ #include "ED_gpencil.h" -/** - * Populate stroke with point data from data buffers. - * \param gps: Grease pencil stroke - * \param array: Flat array of point data values. Each entry has #GP_PRIM_DATABUF_SIZE values. - * \param totpoints: Total of points - * \param mat: 4x4 transform matrix to transform points into the right coordinate space. - */ void ED_gpencil_stroke_init_data(bGPDstroke *gps, const float *array, const int totpoints, @@ -842,7 +835,6 @@ static const ColorTemplate gp_monkey_pct_pupils = { /* ***************************************************************** */ /* Monkey API */ -/* add a 2D Suzanne (original model created by Matias Mendiola) */ void ED_gpencil_create_monkey(bContext *C, Object *ob, float mat[4][4]) { Main *bmain = CTX_data_main(C); diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c index 73c4e64dd9a..d9e652392b4 100644 --- a/source/blender/editors/gpencil/gpencil_add_stroke.c +++ b/source/blender/editors/gpencil/gpencil_add_stroke.c @@ -204,8 +204,6 @@ static const ColorTemplate gp_stroke_material_grey = { /* ***************************************************************** */ /* Stroke API */ -/* Add a Simple stroke with colors - * (original design created by Daniel M. Lara and Matias Mendiola). */ void ED_gpencil_create_stroke(bContext *C, Object *ob, float mat[4][4]) { Main *bmain = CTX_data_main(C); diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index db2104dfdf9..bea8126cfcc 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -2809,7 +2809,6 @@ static void gpencil_joined_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data) } } -/* join objects called from OBJECT_OT_join */ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); @@ -3697,7 +3696,6 @@ void GPENCIL_OT_materials_copy_to_object(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); } -/* Parent GPencil object to Lattice */ bool ED_gpencil_add_lattice_modifier(const bContext *C, ReportList *reports, Object *ob, diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 3fc08096ab5..a4931ed6007 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1381,11 +1381,6 @@ void GPENCIL_OT_extrude(wmOperatorType *ot) * from several different layers into a single layer. * \{ */ -/** - * list of #bGPDstroke instances - * - * \note is exposed within the editors/gpencil module so that other tools can use it too. - */ ListBase gpencil_strokes_copypastebuf = {NULL, NULL}; /* Hash for hanging on to all the colors used by strokes in the buffer @@ -1429,7 +1424,6 @@ static void gpencil_strokes_copypastebuf_colors_name_to_material_free(GHash *nam BLI_ghash_free(name_to_ma, MEM_freeN, NULL); } -/* Free copy/paste buffer data */ void ED_gpencil_strokes_copybuf_free(void) { bGPDstroke *gps, *gpsn; @@ -1462,10 +1456,6 @@ void ED_gpencil_strokes_copybuf_free(void) gpencil_strokes_copypastebuf.first = gpencil_strokes_copypastebuf.last = NULL; } -/** - * Ensure that destination datablock has all the colors the pasted strokes need. - * Helper function for copy-pasting strokes - */ GHash *gpencil_copybuf_validate_colormap(bContext *C) { Main *bmain = CTX_data_main(C); @@ -2654,7 +2644,6 @@ static int gpencil_delete_selected_points(bContext *C) return OPERATOR_CANCELLED; } -/* simple wrapper to external call */ int gpencil_delete_selected_point_wrap(bContext *C) { return gpencil_delete_selected_points(C); @@ -3319,10 +3308,6 @@ static bool gpencil_cyclical_set_curve_edit_poll_property(const bContext *C, return true; } -/** - * Similar to #CURVE_OT_cyclic_toggle or #MASK_OT_cyclic_toggle, but with - * option to force opened/closed strokes instead of just toggle behavior. - */ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot) { PropertyRNA *prop; @@ -3434,9 +3419,6 @@ static int gpencil_stroke_caps_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/** - * Change Stroke caps mode Rounded or Flat - */ void GPENCIL_OT_stroke_caps_set(wmOperatorType *ot) { static const EnumPropertyItem toggle_type[] = { diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index cfc1257204b..c1ebf72dd55 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -106,6 +106,10 @@ typedef struct tGPDdraw { } tGPDdraw; /* Modal Operator Drawing Callbacks ------------------------ */ + +/** + * Wrapper to draw strokes for filling operator. + */ void ED_gpencil_draw_fill(struct tGPDdraw *tgpw); /* ***************************************************** */ @@ -231,28 +235,74 @@ typedef struct tGPDprimitive { } tGPDprimitive; +/** + * Check whether a given stroke segment is inside a circular brush + * + * \param mval: The current screen-space coordinates (midpoint) of the brush + * \param rad: The radius of the brush + * + * \param x0, y0: The screen-space x and y coordinates of the start of the stroke segment + * \param x1, y1: The screen-space x and y coordinates of the end of the stroke segment + */ bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1); +/** + * Init settings for stroke point space conversions + * + * \param r_gsc: [out] The space conversion settings struct, populated with necessary params + */ void gpencil_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc); +/** + * Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screen-space (2D) + * + * \param[out] r_x: The screen-space x-coordinate of the point + * \param[out] r_y: The screen-space y-coordinate of the point + * + * \warning This assumes that the caller has already checked + * whether the stroke in question can be drawn. + */ void gpencil_point_to_xy(const GP_SpaceConversion *gsc, const struct bGPDstroke *gps, const struct bGPDspoint *pt, int *r_x, int *r_y); +/** + * Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screen-space (2D). + * + * Just like #gpencil_point_to_xy(), except the resulting coordinates are floats not ints. + * Use this version to solve "stair-step" artifacts which may arise when + * round-tripping the calculations. + * + * \param r_x: The screen-space x-coordinate of the point. + * \param r_y: The screen-space y-coordinate of the point. + * + * \warning This assumes that the caller has already checked + * whether the stroke in question can be drawn. + */ void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, float *r_x, float *r_y); +/** + * Convert point to parent space + * + * \param pt: Original point + * \param diff_mat: Matrix with the difference between original parent matrix + * \param[out] r_pt: Pointer to new point after apply matrix + */ void gpencil_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt); /** * Change points position relative to parent object */ +/** + * Change position relative to parent object + */ void gpencil_apply_parent(struct Depsgraph *depsgraph, struct Object *obact, bGPDlayer *gpl, @@ -260,22 +310,52 @@ void gpencil_apply_parent(struct Depsgraph *depsgraph, /** * Change point position relative to parent object */ +/** + * Change point position relative to parent object + */ void gpencil_apply_parent_point(struct Depsgraph *depsgraph, struct Object *obact, bGPDlayer *gpl, bGPDspoint *pt); +/** + * generic based on gpencil_point_to_xy_fl + */ void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc, const short flag, const float pt[3], float xy[2]); +/** + * Project screen-space coordinates to 3D-space + * + * For use with editing tools where it is easier to perform the operations in 2D, + * and then later convert the transformed points back to 3D. + * + * \param screen_co: The screen-space 2D coordinates to convert to + * \param r_out: The resulting 3D coordinates of the input point + * + * \note We include this as a utility function, since the standard method + * involves quite a few steps, which are invariably always the same + * for all GPencil operations. So, it's nicer to just centralize these. + * + * \warning Assumes that it is getting called in a 3D view only. + */ bool gpencil_point_xy_to_3d(const GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]); /* helper to convert 2d to 3d */ + +/** + * Convert #tGPspoint (temporary 2D/screen-space point data used by GP modal operators) + * to 3D coordinates. + * + * \param point2D: The screen-space 2D point data to convert. + * \param depth: Depth array (via #ED_view3d_depth_read_cached()). + * \param r_out: The resulting 2D point data. + */ void gpencil_stroke_convertcoords_tpoint(struct Scene *scene, struct ARegion *region, struct Object *ob, @@ -286,35 +366,71 @@ void gpencil_stroke_convertcoords_tpoint(struct Scene *scene, /* Poll Callbacks ------------------------------------ */ /* gpencil_utils.c */ +/** + * Poll callback for adding data/layers - special. + */ bool gpencil_add_poll(struct bContext *C); +/** + * Poll callback for checking if there is an active layer. + */ bool gpencil_active_layer_poll(struct bContext *C); +/** + * Poll callback for checking if there is an active brush. + */ bool gpencil_active_brush_poll(struct bContext *C); bool gpencil_brush_create_presets_poll(bContext *C); /* Copy/Paste Buffer --------------------------------- */ /* gpencil_edit.c */ +/** + * list of #bGPDstroke instances + * + * \note is exposed within the editors/gpencil module so that other tools can use it too. + */ extern ListBase gpencil_strokes_copypastebuf; /* Build a map for converting between old color-names and destination-color-refs. */ +/** + * Ensure that destination datablock has all the colors the pasted strokes need. + * Helper function for copy-pasting strokes + */ struct GHash *gpencil_copybuf_validate_colormap(struct bContext *C); /* Stroke Editing ------------------------------------ */ +/** + * Simple wrapper to external call. + */ int gpencil_delete_selected_point_wrap(bContext *C); +/** + * Subdivide a stroke once, by adding a point half way between each pair of existing points + * \param gpd: Datablock + * \param gps: Stroke data + * \param subdivide: Number of times to subdivide + */ void gpencil_subdivide_stroke(bGPdata *gpd, bGPDstroke *gps, const int subdivide); /* Layers Enums -------------------------------------- */ +/** + * Just existing layers. + */ const struct EnumPropertyItem *ED_gpencil_layers_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +/** + * Existing + Option to add/use new layer. + */ const struct EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +/** + * Just existing Materials. + */ const struct EnumPropertyItem *ED_gpencil_material_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, @@ -407,6 +523,9 @@ void GPENCIL_OT_stroke_editcurve_set_handle_type(struct wmOperatorType *ot); /* stroke sculpting -- */ +/** + * Also used for weight paint. + */ void GPENCIL_OT_sculpt_paint(struct wmOperatorType *ot); void GPENCIL_OT_weight_paint(struct wmOperatorType *ot); @@ -476,7 +595,14 @@ enum { void GPENCIL_OT_stroke_arrange(struct wmOperatorType *ot); void GPENCIL_OT_stroke_change_color(struct wmOperatorType *ot); void GPENCIL_OT_stroke_apply_thickness(struct wmOperatorType *ot); +/** + * Similar to #CURVE_OT_cyclic_toggle or #MASK_OT_cyclic_toggle, but with + * option to force opened/closed strokes instead of just toggle behavior. + */ void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot); +/** + * Change Stroke caps mode Rounded or Flat + */ void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot); void GPENCIL_OT_stroke_join(struct wmOperatorType *ot); void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot); diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index e9a6beab798..32ad8c98950 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -2134,7 +2134,6 @@ static int gpencil_sculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent return OPERATOR_RUNNING_MODAL; } -/* Also used for weight paint. */ void GPENCIL_OT_sculpt_paint(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/gpencil/gpencil_trace.h b/source/blender/editors/gpencil/gpencil_trace.h index 25d8dac2734..7c62288f65d 100644 --- a/source/blender/editors/gpencil/gpencil_trace.h +++ b/source/blender/editors/gpencil/gpencil_trace.h @@ -59,16 +59,48 @@ struct bGPDframe; #define GPENCIL_TRACE_MODE_SINGLE 0 #define GPENCIL_TRACE_MODE_SEQUENCE 1 +/** + * Print trace bitmap for debugging. + * \param f: Output handle. Use `stderr` for printing + * \param bm: Trace bitmap + */ void ED_gpencil_trace_bitmap_print(FILE *f, const potrace_bitmap_t *bm); +/** + * Return new un-initialized trace bitmap + * \param w: Width in pixels + * \param h: Height in pixels + * \return Trace bitmap + */ potrace_bitmap_t *ED_gpencil_trace_bitmap_new(int32_t w, int32_t h); +/** + * Free a trace bitmap + * \param bm: Trace bitmap + */ void ED_gpencil_trace_bitmap_free(const potrace_bitmap_t *bm); +/** + * Invert the given bitmap (Black to White) + * \param bm: Trace bitmap + */ void ED_gpencil_trace_bitmap_invert(const potrace_bitmap_t *bm); +/** + * Convert image to BW bitmap for tracing + * \param ibuf: ImBuf of the image + * \param bm: Trace bitmap + */ void ED_gpencil_trace_image_to_bitmap(struct ImBuf *ibuf, const potrace_bitmap_t *bm, const float threshold); +/** + * Convert Potrace Bitmap to Grease Pencil strokes + * \param st: Data with traced data + * \param ob: Target grease pencil object + * \param offset: Offset to center + * \param scale: Scale of the output + * \param sample: Sample distance to distribute points + */ void ED_gpencil_trace_data_to_strokes(struct Main *bmain, potrace_state_t *st, struct Object *ob, diff --git a/source/blender/editors/gpencil/gpencil_trace_utils.c b/source/blender/editors/gpencil/gpencil_trace_utils.c index 970afc3ff6b..f5690904fcf 100644 --- a/source/blender/editors/gpencil/gpencil_trace_utils.c +++ b/source/blender/editors/gpencil/gpencil_trace_utils.c @@ -46,11 +46,6 @@ #include "gpencil_trace.h" -/** - * Print trace bitmap for debugging. - * \param f: Output handle. Use `stderr` for printing - * \param bm: Trace bitmap - */ void ED_gpencil_trace_bitmap_print(FILE *f, const potrace_bitmap_t *bm) { int32_t x, y; @@ -77,12 +72,6 @@ void ED_gpencil_trace_bitmap_print(FILE *f, const potrace_bitmap_t *bm) } } -/** - * Return new un-initialized trace bitmap - * \param w: Width in pixels - * \param h: Height in pixels - * \return Trace bitmap - */ potrace_bitmap_t *ED_gpencil_trace_bitmap_new(int32_t w, int32_t h) { potrace_bitmap_t *bm; @@ -104,10 +93,6 @@ potrace_bitmap_t *ED_gpencil_trace_bitmap_new(int32_t w, int32_t h) return bm; } -/** - * Free a trace bitmap - * \param bm: Trace bitmap - */ void ED_gpencil_trace_bitmap_free(const potrace_bitmap_t *bm) { if (bm != NULL) { @@ -116,10 +101,6 @@ void ED_gpencil_trace_bitmap_free(const potrace_bitmap_t *bm) MEM_SAFE_FREE(bm); } -/** - * Invert the given bitmap (Black to White) - * \param bm: Trace bitmap - */ void ED_gpencil_trace_bitmap_invert(const potrace_bitmap_t *bm) { int32_t dy = bm->dy; @@ -162,11 +143,6 @@ static void pixel_at_index(const ImBuf *ibuf, const int32_t idx, float r_col[4]) } } -/** - * Convert image to BW bitmap for tracing - * \param ibuf: ImBuf of the image - * \param bm: Trace bitmap - */ void ED_gpencil_trace_image_to_bitmap(ImBuf *ibuf, const potrace_bitmap_t *bm, const float threshold) @@ -231,14 +207,6 @@ static void add_bezier(bGPDstroke *gps, } } -/** - * Convert Potrace Bitmap to Grease Pencil strokes - * \param st: Data with traced data - * \param ob: Target grease pencil object - * \param offset: Offset to center - * \param scale: Scale of the output - * \param sample: Sample distance to distribute points - */ void ED_gpencil_trace_data_to_strokes(Main *bmain, potrace_state_t *st, Object *ob, diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 99b8b672327..ec70febc80c 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -62,9 +62,6 @@ int ED_gpencil_session_active(void) return (BLI_listbase_is_empty(&undo_nodes) == false); } -/** - * \param step: eUndoStepDir. - */ int ED_undo_gpencil_step(bContext *C, const int step) { bGPdata **gpd_ptr = NULL, *new_gpd = NULL; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 99cf2b52df7..f082af979a1 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -96,11 +96,6 @@ /* ******************************************************** */ /* Context Wrangling... */ -/** - * Get pointer to active Grease Pencil data-block, - * and an RNA-pointer to trace back to whatever owns it, - * when context info is not available. - */ bGPdata **ED_gpencil_data_get_pointers_direct(ScrArea *area, Object *ob, PointerRNA *r_ptr) { /* if there's an active area, check if the particular editor may @@ -130,11 +125,6 @@ bGPdata **ED_gpencil_data_get_pointers_direct(ScrArea *area, Object *ob, Pointer return NULL; } -/** - * Get pointer to active Grease Pencil data-block for annotations, - * and an RNA-pointer to trace back to whatever owns it, - * when context info is not available. - */ bGPdata **ED_annotation_data_get_pointers_direct(ID *screen_id, ScrArea *area, Scene *scene, @@ -233,10 +223,6 @@ bGPdata **ED_annotation_data_get_pointers_direct(ID *screen_id, return NULL; } -/** - * Get pointer to active Grease Pencil data-block, - * and an RNA-pointer to trace back to whatever owns it. - */ bGPdata **ED_gpencil_data_get_pointers(const bContext *C, PointerRNA *r_ptr) { ScrArea *area = CTX_wm_area(C); @@ -245,10 +231,6 @@ bGPdata **ED_gpencil_data_get_pointers(const bContext *C, PointerRNA *r_ptr) return ED_gpencil_data_get_pointers_direct(area, ob, r_ptr); } -/** - * Get pointer to active Grease Pencil data-block, - * and an RNA-pointer to trace back to whatever owns it. - */ bGPdata **ED_annotation_data_get_pointers(const bContext *C, PointerRNA *r_ptr) { ID *screen_id = (ID *)CTX_wm_screen(C); @@ -259,23 +241,18 @@ bGPdata **ED_annotation_data_get_pointers(const bContext *C, PointerRNA *r_ptr) } /* -------------------------------------------------------- */ -/* Get the active Grease Pencil data-block, when context is not available */ bGPdata *ED_gpencil_data_get_active_direct(ScrArea *area, Object *ob) { bGPdata **gpd_ptr = ED_gpencil_data_get_pointers_direct(area, ob, NULL); return (gpd_ptr) ? *(gpd_ptr) : NULL; } -/* Get the active Grease Pencil data-block, when context is not available */ bGPdata *ED_annotation_data_get_active_direct(ID *screen_id, ScrArea *area, Scene *scene) { bGPdata **gpd_ptr = ED_annotation_data_get_pointers_direct(screen_id, area, scene, NULL); return (gpd_ptr) ? *(gpd_ptr) : NULL; } -/** - * Get the active Grease Pencil data-block - */ bGPdata *ED_gpencil_data_get_active(const bContext *C) { Object *ob = CTX_data_active_object(C); @@ -285,24 +262,12 @@ bGPdata *ED_gpencil_data_get_active(const bContext *C) return ob->data; } -/** - * Get the active Grease Pencil data-block - * \note This is the original (#G.main) copy of the data-block, stored in files. - * Do not use for reading evaluated copies of GP Objects data. - */ bGPdata *ED_annotation_data_get_active(const bContext *C) { bGPdata **gpd_ptr = ED_annotation_data_get_pointers(C, NULL); return (gpd_ptr) ? *(gpd_ptr) : NULL; } -/** - * Get the evaluated copy of the active Grease Pencil data-block (where applicable) - * - For the 3D View (i.e. "GP Objects"), this gives the evaluated copy of the GP data-block - * (i.e. a copy of the active GP data-block for the active object, where modifiers have been - * applied). This is needed to correctly work with "Copy-on-Write". - * - For all other editors (i.e. "GP Annotations"), this just gives the active data-block - * like for #ED_gpencil_data_get_active() - */ + bGPdata *ED_gpencil_data_get_active_evaluated(const bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -316,10 +281,6 @@ bGPdata *ED_gpencil_data_get_active_evaluated(const bContext *C) /* -------------------------------------------------------- */ -/** - * Utility to check whether the r_ptr output of ED_gpencil_data_get_pointers() - * is for annotation usage. - */ bool ED_gpencil_data_owner_is_annotation(PointerRNA *owner_ptr) { /* Key Assumption: If the pointer is an object, we're dealing with a GP Object's data. @@ -330,7 +291,6 @@ bool ED_gpencil_data_owner_is_annotation(PointerRNA *owner_ptr) /* ******************************************************** */ /* Keyframe Indicator Checks */ -/* Check whether there's an active GP keyframe on the current frame */ bool ED_gpencil_has_keyframe_v3d(Scene *UNUSED(scene), Object *ob, int cfra) { if (ob && ob->data && (ob->type == OB_GPENCIL)) { @@ -351,7 +311,6 @@ bool ED_gpencil_has_keyframe_v3d(Scene *UNUSED(scene), Object *ob, int cfra) /* ******************************************************** */ /* Poll Callbacks */ -/* poll callback for adding data/layers - special */ bool gpencil_add_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -363,7 +322,6 @@ bool gpencil_add_poll(bContext *C) return (gpd != NULL); } -/* poll callback for checking if there is an active layer */ bool gpencil_active_layer_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -376,7 +334,6 @@ bool gpencil_active_layer_poll(bContext *C) return (gpl != NULL); } -/* poll callback for checking if there is an active brush */ bool gpencil_active_brush_poll(bContext *C) { ToolSettings *ts = CTX_data_tool_settings(C); @@ -391,7 +348,6 @@ bool gpencil_active_brush_poll(bContext *C) /* Dynamic Enums of GP Layers */ /* NOTE: These include an option to create a new layer and use that... */ -/* Just existing layers */ const EnumPropertyItem *ED_gpencil_layers_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), @@ -429,7 +385,6 @@ const EnumPropertyItem *ED_gpencil_layers_enum_itemf(bContext *C, return item; } -/* Existing + Option to add/use new layer */ const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), @@ -482,7 +437,6 @@ const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, return item; } -/* Just existing Materials */ const EnumPropertyItem *ED_gpencil_material_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), @@ -519,15 +473,6 @@ const EnumPropertyItem *ED_gpencil_material_enum_itemf(bContext *C, /* ******************************************************** */ /* Brush Tool Core */ -/** - * Check whether a given stroke segment is inside a circular brush - * - * \param mval: The current screen-space coordinates (midpoint) of the brush - * \param rad: The radius of the brush - * - * \param x0, y0: The screen-space x and y coordinates of the start of the stroke segment - * \param x1, y1: The screen-space x and y coordinates of the end of the stroke segment - */ bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1) { /* simple within-radius check for now */ @@ -577,8 +522,6 @@ bool ED_gpencil_layer_has_selected_stroke(const bGPDlayer *gpl, const bool is_mu /* ******************************************************** */ /* Stroke Validity Testing */ -/* Check whether given stroke can be edited given the supplied context */ -/* TODO: do we need additional flags for screenspace vs dataspace? */ bool ED_gpencil_stroke_can_use_direct(const ScrArea *area, const bGPDstroke *gps) { /* sanity check */ @@ -603,14 +546,12 @@ bool ED_gpencil_stroke_can_use_direct(const ScrArea *area, const bGPDstroke *gps return true; } -/* Check whether given stroke can be edited in the current context */ bool ED_gpencil_stroke_can_use(const bContext *C, const bGPDstroke *gps) { ScrArea *area = CTX_wm_area(C); return ED_gpencil_stroke_can_use_direct(area, gps); } -/* Check whether given stroke can be edited for the current color */ bool ED_gpencil_stroke_material_editable(Object *ob, const bGPDlayer *gpl, const bGPDstroke *gps) { /* check if the color is editable */ @@ -628,7 +569,6 @@ bool ED_gpencil_stroke_material_editable(Object *ob, const bGPDlayer *gpl, const return true; } -/* Check whether given stroke is visible for the current material. */ bool ED_gpencil_stroke_material_visible(Object *ob, const bGPDstroke *gps) { /* check if the color is editable */ @@ -646,11 +586,6 @@ bool ED_gpencil_stroke_material_visible(Object *ob, const bGPDstroke *gps) /* ******************************************************** */ /* Space Conversion */ -/** - * Init settings for stroke point space conversions - * - * \param r_gsc: [out] The space conversion settings struct, populated with necessary params - */ void gpencil_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) { ScrArea *area = CTX_wm_area(C); @@ -691,13 +626,6 @@ void gpencil_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) } } -/** - * Convert point to parent space - * - * \param pt: Original point - * \param diff_mat: Matrix with the difference between original parent matrix - * \param[out] r_pt: Pointer to new point after apply matrix - */ void gpencil_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt) @@ -708,9 +636,6 @@ void gpencil_point_to_parent_space(const bGPDspoint *pt, copy_v3_v3(&r_pt->x, fpt); } -/** - * Change position relative to parent object - */ void gpencil_apply_parent(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, bGPDstroke *gps) { bGPDspoint *pt; @@ -731,9 +656,6 @@ void gpencil_apply_parent(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, b } } -/** - * Change point position relative to parent object - */ void gpencil_apply_parent_point(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, @@ -752,15 +674,6 @@ void gpencil_apply_parent_point(Depsgraph *depsgraph, copy_v3_v3(&pt->x, fpt); } -/** - * Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screenspace (2D) - * - * \param[out] r_x: The screen-space x-coordinate of the point - * \param[out] r_y: The screen-space y-coordinate of the point - * - * \warning This assumes that the caller has already checked - * whether the stroke in question can be drawn. - */ void gpencil_point_to_xy( const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, int *r_x, int *r_y) { @@ -803,19 +716,6 @@ void gpencil_point_to_xy( } } -/** - * Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screenspace (2D). - * - * Just like #gpencil_point_to_xy(), except the resulting coordinates are floats not ints. - * Use this version to solve "stair-step" artifacts which may arise when - * roundtripping the calculations. - * - * \param r_x: The screen-space x-coordinate of the point. - * \param r_y: The screen-space y-coordinate of the point. - * - * \warning This assumes that the caller has already checked - * whether the stroke in question can be drawn. - */ void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, @@ -873,9 +773,6 @@ void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc, } } -/** - * generic based on gpencil_point_to_xy_fl - */ void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc, const short flag, const float pt[3], @@ -930,21 +827,6 @@ void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc, } } -/** - * Project screenspace coordinates to 3D-space - * - * For use with editing tools where it is easier to perform the operations in 2D, - * and then later convert the transformed points back to 3D. - * - * \param screen_co: The screenspace 2D coordinates to convert to - * \param r_out: The resulting 3D coordinates of the input point - * - * \note We include this as a utility function, since the standard method - * involves quite a few steps, which are invariably always the same - * for all GPencil operations. So, it's nicer to just centralize these. - * - * \warning Assumes that it is getting called in a 3D view only. - */ bool gpencil_point_xy_to_3d(const GP_SpaceConversion *gsc, Scene *scene, const float screen_co[2], @@ -974,14 +856,6 @@ bool gpencil_point_xy_to_3d(const GP_SpaceConversion *gsc, return false; } -/** - * Convert tGPspoint (temporary 2D/screenspace point data used by GP modal operators) - * to 3D coordinates. - * - * \param point2D: The screen-space 2D point data to convert. - * \param depth: Depth array (via #ED_view3d_depth_read_cached()). - * \param r_out: The resulting 2D point data. - */ void gpencil_stroke_convertcoords_tpoint(Scene *scene, ARegion *region, Object *ob, @@ -1027,10 +901,6 @@ void gpencil_stroke_convertcoords_tpoint(Scene *scene, } } -/** - * Get drawing reference point for conversion or projection of the stroke - * \param r_vec: Reference point found - */ void ED_gpencil_drawing_reference_get(const Scene *scene, const Object *ob, char align_flag, @@ -1098,9 +968,6 @@ void ED_gpencil_project_stroke_to_view(bContext *C, bGPDlayer *gpl, bGPDstroke * } } -/** - * Reproject all points of the stroke to a plane locked to axis to avoid stroke offset - */ void ED_gpencil_project_stroke_to_plane(const Scene *scene, const Object *ob, const RegionView3D *rv3d, @@ -1179,7 +1046,6 @@ void ED_gpencil_project_stroke_to_plane(const Scene *scene, } } -/* Reproject selected strokes */ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, const GP_SpaceConversion *gsc, SnapObjectContext *sctx, @@ -1320,10 +1186,6 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, } } -/** - * Reproject given point to a plane locked to axis to avoid stroke offset - * \param pt: Point to affect (used for input & output). - */ void ED_gpencil_project_point_to_plane(const Scene *scene, const Object *ob, bGPDlayer *gpl, @@ -1406,12 +1268,6 @@ void ED_gpencil_project_point_to_plane(const Scene *scene, /* XXX: Check if these functions duplicate stuff in blenkernel, * and/or whether we should just deduplicate. */ -/** - * Subdivide a stroke once, by adding a point half way between each pair of existing points - * \param gpd: Datablock - * \param gps: Stroke data - * \param subdivide: Number of times to subdivide - */ void gpencil_subdivide_stroke(bGPdata *gpd, bGPDstroke *gps, const int subdivide) { bGPDspoint *temp_points; @@ -1505,7 +1361,6 @@ void gpencil_subdivide_stroke(bGPdata *gpd, bGPDstroke *gps, const int subdivide BKE_gpencil_stroke_geometry_update(gpd, gps); } -/* Reset parent matrix for all layers. */ void ED_gpencil_reset_layers_parent(Depsgraph *depsgraph, Object *obact, bGPdata *gpd) { bGPDspoint *pt; @@ -1555,7 +1410,6 @@ void ED_gpencil_reset_layers_parent(Depsgraph *depsgraph, Object *obact, bGPdata /* ******************************************************** */ /* GP Object Stuff */ -/* Helper function to create new OB_GPENCIL Object */ Object *ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view_bits) { const float rot[3] = {0.0f}; @@ -1568,7 +1422,6 @@ Object *ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view return ob; } -/* Helper function to create default colors and drawing brushes */ void ED_gpencil_add_defaults(bContext *C, Object *ob) { Main *bmain = CTX_data_main(C); @@ -1600,7 +1453,6 @@ void ED_gpencil_add_defaults(bContext *C, Object *ob) /* ******************************************************** */ /* Vertex Groups */ -/* assign points to vertex group */ void ED_gpencil_vgroup_assign(bContext *C, Object *ob, float weight) { bGPdata *gpd = (bGPdata *)ob->data; @@ -1654,7 +1506,6 @@ void ED_gpencil_vgroup_assign(bContext *C, Object *ob, float weight) CTX_DATA_END; } -/* remove points from vertex group */ void ED_gpencil_vgroup_remove(bContext *C, Object *ob) { bGPdata *gpd = (bGPdata *)ob->data; @@ -1707,7 +1558,6 @@ void ED_gpencil_vgroup_remove(bContext *C, Object *ob) CTX_DATA_END; } -/* select points of vertex group */ void ED_gpencil_vgroup_select(bContext *C, Object *ob) { bGPdata *gpd = (bGPdata *)ob->data; @@ -1762,7 +1612,6 @@ void ED_gpencil_vgroup_select(bContext *C, Object *ob) CTX_DATA_END; } -/* unselect points of vertex group */ void ED_gpencil_vgroup_deselect(bContext *C, Object *ob) { bGPdata *gpd = (bGPdata *)ob->data; @@ -1843,7 +1692,6 @@ static bool gpencil_check_cursor_region(bContext *C, const int mval_i[2]) return false; } -/* draw eraser cursor */ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y) { short radius = (short)brush->size; @@ -2079,7 +1927,6 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat immUnbindProgram(); } -/* Turn brush cursor in on/off */ void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata) { Scene *scene = CTX_data_scene(C); @@ -2107,7 +1954,6 @@ void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata) } } -/* set object modes */ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode) { if (!gpd) { @@ -2194,9 +2040,6 @@ static void gpencil_stroke_convertcoords(ARegion *region, } } -/** - * Convert 2d #tGPspoint to 3d #bGPDspoint. - */ void ED_gpencil_tpoint_to_point(ARegion *region, float origin[3], const tGPspoint *tpt, @@ -2214,9 +2057,6 @@ void ED_gpencil_tpoint_to_point(ARegion *region, pt->uv_rot = tpt->uv_rot; } -/** - * Recalculate UV for any stroke using the material. - */ void ED_gpencil_update_color_uv(Main *bmain, Material *mat) { Material *gps_ma = NULL; @@ -2424,7 +2264,6 @@ static float gpencil_calc_factor(const float p2d_a1[2], return f; } -/* extend selection to stroke intersections */ int ED_gpencil_select_stroke_segment(bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, @@ -2805,10 +2644,6 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action) } } -/** - * Ensure the #tGPspoint buffer (while drawing stroke) - * size is enough to save all points of the stroke. - */ tGPspoint *ED_gpencil_sbuffer_ensure(tGPspoint *buffer_array, int *buffer_size, int *buffer_used, @@ -2859,9 +2694,6 @@ void ED_gpencil_sbuffer_update_eval(bGPdata *gpd, Object *ob_eval) gpd_eval->runtime.cp_points = gpd->runtime.cp_points; } -/** - * Tag all scene grease pencil object to update. - */ void ED_gpencil_tag_scene_gpencil(Scene *scene) { /* Mark all grease pencil data-blocks of the scene. */ @@ -3110,7 +2942,6 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph, } } -/* Get the bigger 2D bound box points. */ void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc, const bGPDstroke *gps, const float diff_mat[4][4], @@ -3144,7 +2975,6 @@ void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc, } } -/* Check if the stroke collides with brush. */ bool ED_gpencil_stroke_check_collision(const GP_SpaceConversion *gsc, bGPDstroke *gps, const float mouse[2], @@ -3171,15 +3001,6 @@ bool ED_gpencil_stroke_check_collision(const GP_SpaceConversion *gsc, return BLI_rcti_isect(&rect_stroke, &rect_mouse, NULL); } -/** - * Check if a point is inside of the stroke. - * - * \param gps: Stroke to check. - * \param gsc: Space conversion data. - * \param mouse: Mouse position. - * \param diff_mat: View matrix. - * \return True if the point is inside. - */ bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps, const GP_SpaceConversion *gsc, const int mouse[2], @@ -3218,7 +3039,6 @@ bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps, return hit; } -/* Get extremes of stroke in 2D using current view. */ void ED_gpencil_stroke_extremes_to2d(const GP_SpaceConversion *gsc, const float diff_mat[4][4], bGPDstroke *gps, @@ -3333,7 +3153,6 @@ bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C, return gps_rtn; } -/* Join two stroke using a contact point index and trimming the rest. */ bGPDstroke *ED_gpencil_stroke_join_and_trim( bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *gps_dst, const int pt_index) { @@ -3403,7 +3222,6 @@ bGPDstroke *ED_gpencil_stroke_join_and_trim( return gps_final; } -/* Close if the distance between extremes is below threshold. */ void ED_gpencil_stroke_close_by_distance(bGPDstroke *gps, const float threshold) { if (gps == NULL) { @@ -3420,7 +3238,6 @@ void ED_gpencil_stroke_close_by_distance(bGPDstroke *gps, const float threshold) } } -/* Merge two layers. */ void ED_gpencil_layer_merge(bGPdata *gpd, bGPDlayer *gpl_src, bGPDlayer *gpl_dst, diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 0a1cf643f37..8f2a189e35e 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -46,6 +46,12 @@ typedef struct IMMDrawPixelsTexState { /* To be used before calling immDrawPixelsTex * Default shader is GPU_SHADER_2D_IMAGE_COLOR * Returns a shader to be able to set uniforms */ +/** + * To be used before calling #immDrawPixelsTex + * Default shader is #GPU_SHADER_2D_IMAGE_COLOR + * You can still set uniforms with: + * `GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);` + */ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin); /** @@ -101,6 +107,20 @@ void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state, float xzoom, float yzoom, const float color[4]); +/** + * Use the currently bound shader. + * + * Use #immDrawPixelsTexSetup to bind the shader you + * want before calling #immDrawPixelsTex. + * + * If using a special shader double check it uses the same + * attributes "pos" "texCoord" and uniform "image". + * + * If color is NULL then use white by default + * + * Be also aware that this function unbinds the shader when + * it's finished. + */ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, float x, float y, @@ -135,6 +155,9 @@ void ED_draw_imbuf(struct ImBuf *ibuf, struct ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y); +/** + * Draw given image buffer on a screen using GLSL for display transform. + */ void ED_draw_imbuf_clipping(struct ImBuf *ibuf, float x, float y, @@ -169,6 +192,9 @@ void ED_draw_imbuf_ctx_clipping(const struct bContext *C, int ED_draw_imbuf_method(struct ImBuf *ibuf); +/** + * Don't move to `GPU_immediate_util.h` because this uses user-prefs and isn't very low level. + */ void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index cab4c18211d..3294316f880 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -63,7 +63,9 @@ struct PropertyRNA; /* ANIMATION CHANNEL FILTERING */ /* anim_filter.c */ -/* --------------- Context --------------------- */ +/* -------------------------------------------------------------------- */ +/** \name Context + * \{ */ /* This struct defines a structure used for animation-specific * 'context' information @@ -126,7 +128,11 @@ typedef enum eAnimCont_Types { ANIMCONT_TIMELINE = 10, /* "timeline" editor (bDopeSheet) */ } eAnimCont_Types; -/* --------------- Channels -------------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Channels + * \{ */ /* This struct defines a structure used for quick and uniform access for * channels of animation data @@ -281,7 +287,11 @@ typedef enum eAnim_Update_Flags { #define ANIM_UPDATE_DEFAULT (ANIM_UPDATE_DEPS | ANIM_UPDATE_ORDER | ANIM_UPDATE_HANDLES) #define ANIM_UPDATE_DEFAULT_NOHANDLES (ANIM_UPDATE_DEFAULT & ~ANIM_UPDATE_HANDLES) -/* ----------------- Filtering -------------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Filtering + * \{ */ /* filtering flags - under what circumstances should a channel be returned */ typedef enum eAnimFilter_Flags { @@ -334,7 +344,12 @@ typedef enum eAnimFilter_Flags { ANIMFILTER_TMP_IGNORE_ONLYSEL = (1u << 31), } eAnimFilter_Flags; -/* ---------- Flag Checking Macros ------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Flag Checking Macros + * \{ */ + /* XXX check on all of these flags again. */ /* Dopesheet only */ @@ -421,7 +436,11 @@ typedef enum eAnimFilter_Flags { /* AnimData - NLA mostly... */ #define SEL_ANIMDATA(adt) (adt->flag & ADT_UI_SELECTED) -/* -------------- Channel Defines -------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Channel Defines + * \{ */ /* channel heights */ #define ACHANNEL_FIRST_TOP(ac) \ @@ -439,7 +458,11 @@ typedef enum eAnimFilter_Flags { /* channel toggle-buttons */ #define ACHANNEL_BUTTON_WIDTH (0.8f * U.widget_unit) -/* -------------- NLA Channel Defines -------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name NLA Channel Defines + * \{ */ /* NLA channel heights */ #define NLACHANNEL_FIRST_TOP(ac) \ @@ -459,10 +482,19 @@ typedef enum eAnimFilter_Flags { /* channel toggle-buttons */ #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 +/* -------------------------------------------------------------------- */ +/** \name Public API + * \{ */ + +/** + * This function filters the active data source to leave only animation channels suitable for + * usage by the caller. It will return the length of the list + * + * \param anim_data: Is a pointer to a #ListBase, + * to which the filtered animation channels will be placed for use. + * \param filter_mode: how should the data be filtered - bit-mapping accessed flags. */ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, @@ -470,18 +502,27 @@ size_t ANIM_animdata_filter(bAnimContext *ac, void *data, eAnimCont_Types datatype); -/* Obtain current anim-data context from Blender Context info. - * Returns whether the operation was successful. +/** + * Obtain current anim-data context from Blender Context info + * - AnimContext to write to is provided as pointer to var on stack so that we don't have + * allocation/freeing costs (which are not that avoidable with channels). + * - Clears data and sets the information from Blender Context which is useful + * \return whether the operation was successful. */ bool ANIM_animdata_get_context(const struct bContext *C, bAnimContext *ac); -/* Obtain current anim-data context (from Animation Editor) given - * that Blender Context info has already been set. - * Returns whether the operation was successful. +/** + * Obtain current anim-data context, + * given that context info from Blender context has already been set: + * - AnimContext to write to is provided as pointer to var on stack so that we don't have + * allocation/freeing costs (which are not that avoidable with channels). + * \return whether the operation was successful. */ bool ANIM_animdata_context_getdata(bAnimContext *ac); -/* Acts on bAnimListElem eAnim_Update_Flags */ +/** + * Acts on bAnimListElem eAnim_Update_Flags. + */ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data); void ANIM_animdata_freelist(ListBase *anim_data); @@ -490,7 +531,11 @@ void ANIM_animdata_freelist(ListBase *anim_data); /* ANIMATION CHANNELS LIST */ /* anim_channels_*.c */ -/* ------------------------ Drawing TypeInfo -------------------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Drawing TypeInfo + * \{ */ /* role or level of animchannel in the hierarchy */ typedef enum eAnimChannel_Role { @@ -569,21 +614,35 @@ typedef struct bAnimChannelType { void *(*setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *type); } bAnimChannelType; -/* ------------------------ Drawing API -------------------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Drawing API + * \{ */ -/* Get typeinfo for the given channel */ +/** + * Get type info from given channel type. + */ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale); -/* Print debugging info about a given channel */ +/** + * Print debug info string for the given channel. + */ void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level); -/* Retrieves the Action associated with this animation channel. */ +/** + * Retrieves the Action associated with this animation channel. + */ bAction *ANIM_channel_action_get(const bAnimListElem *ale); -/* Draw the given channel */ +/** + * Draw the given channel. + */ void ANIM_channel_draw( bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index); -/* Draw the widgets for the given channel */ +/** + * Draw UI widgets the given channel. + */ void ANIM_channel_draw_widgets(const struct bContext *C, bAnimContext *ac, bAnimListElem *ale, @@ -591,27 +650,30 @@ void ANIM_channel_draw_widgets(const struct bContext *C, rctf *rect, size_t channel_index); -/* ------------------------ Editing API -------------------------- */ +/** \} */ -/* Check if some setting for a channel is enabled - * Returns: 1 = On, 0 = Off, -1 = Invalid - * - * - setting: eAnimChannel_Settings +/* -------------------------------------------------------------------- */ +/** \name Editing API + * \{ */ + +/** + * Check if some setting for a channel is enabled + * Returns: 1 = On, 0 = Off, -1 = Invalid. */ 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 +/** + * Change value of some setting for a channel. */ 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 +/** + * 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 * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, * then the channels under closed expanders get ignored... @@ -626,13 +688,19 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode); -/* Select or deselect animation channels */ +/** + * Set selection state of all animation channels in the context. + */ void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel); -/* Toggle selection of animation channels */ +/** + * Toggle selection state of all animation channels in the context. + */ void ANIM_anim_channels_select_toggle(bAnimContext *ac); -/* Set the 'active' channel of type channel_type, in the given action */ +/** + * Set the given animation-channel as the active one for the active context. + */ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, @@ -640,18 +708,31 @@ void ANIM_set_active_channel(bAnimContext *ac, void *channel_data, eAnim_ChannelType channel_type); -/* Delete the F-Curve from the given AnimData block (if possible), - * as appropriate according to animation context */ +/** + * Delete the F-Curve from the given AnimData block (if possible), + * as appropriate according to animation context. + */ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, struct FCurve *fcu); -/* Unlink the action from animdata if it's empty. */ +/** + * Unlink the action from animdata if it's empty. + * + * If the action has no F-Curves, unlink it from AnimData if it did not + * come from a NLA Strip being tweaked. + */ bool ANIM_remove_empty_action_from_animdata(struct AnimData *adt); /* ************************************************ */ /* DRAWING API */ /* anim_draw.c */ -/* ---------- Current Frame Drawing ---------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Current Frame Drawing + * + * Main call to draw current-frame indicator in an Animation Editor. + * \{ */ /* flags for Current Frame Drawing */ typedef enum eAnimEditDraw_CurrentFrame { @@ -663,27 +744,54 @@ typedef enum eAnimEditDraw_CurrentFrame { DRAWCFRA_WIDE = (1 << 1), } eAnimEditDraw_CurrentFrame; -/* main call to draw current-frame indicator in an Animation Editor */ +/** + * General call for drawing current frame indicator in animation editor. + */ void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag); -/* ------------- Preview Range Drawing -------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Preview Range Drawing + * + * Main call to draw preview range curtains. + * \{ */ -/* main call to draw preview range curtains */ +/** + * Draw preview range 'curtains' for highlighting where the animation data is. + */ void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d, int end_frame_width); -/* -------------- Frame Range Drawing --------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Frame Range Drawing + * + * Main call to draw normal frame range indicators. + * \{ */ -/* main call to draw normal frame range indicators */ +/** + * Draw frame range guides (for scene frame range) in background. + * + * TODO: Should we still show these when preview range is enabled? + */ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d); -/* Draw manually set intended playback frame range indicators for the action. */ +/** + * Draw manually set intended playback frame range guides for the action in the background. + * Allows specifying a subset of the Y range of the view. + */ void ANIM_draw_action_framerange( struct AnimData *adt, struct bAction *action, struct View2D *v2d, float ymin, float ymax); /* ************************************************* */ /* F-MODIFIER TOOLS */ -/* ------------- UI Panel Drawing -------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name UI Panel Drawing + * \{ */ bool ANIM_nla_context_track_ptr(const struct bContext *C, struct PointerRNA *r_ptr); bool ANIM_nla_context_strip_ptr(const struct bContext *C, struct PointerRNA *r_ptr); @@ -697,6 +805,9 @@ typedef bool (*PanelTypePollFn)(const struct bContext *C, struct PanelType *pt); /* Avoid including "UI_interface.h" here. */ typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname); +/** + * Checks if the panels match the active strip / curve, rebuilds them if they don't. + */ void ANIM_fmodifier_panels(const struct bContext *C, struct ID *owner_id, struct ListBase *fmodifiers, @@ -709,49 +820,93 @@ void ANIM_modifier_panels_register_graph_only(struct ARegionType *region_type, const char *modifier_panel_prefix, PanelTypePollFn poll_function); -/* ------------- Copy/Paste Buffer -------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Copy/Paste Buffer + * \{ */ -/* free the copy/paste buffer */ +/** + * Free the copy/paste buffer. + */ void ANIM_fmodifiers_copybuf_free(void); -/* copy the given F-Modifiers to the buffer, returning whether anything was copied or not - * assuming that the buffer has been cleared already with ANIM_fmodifiers_copybuf_free() - * - active: only copy the active modifier +/** + * Copy the given F-Modifiers to the buffer, returning whether anything was copied or not + * assuming that the buffer has been cleared already with #ANIM_fmodifiers_copybuf_free() + * \param active: Only copy the active modifier. */ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active); -/* 'Paste' the F-Modifier(s) from the buffer to the specified list - * - replace: free all the existing modifiers to leave only the pasted ones +/** + * 'Paste' the F-Modifier(s) from the buffer to the specified list + * \param replace: Free all the existing modifiers to leave only the pasted ones. */ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, struct FCurve *curve); /* ************************************************* */ /* ASSORTED TOOLS */ -/* ------------ Animation F-Curves <-> Icons/Names Mapping ------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Animation F-Curves <-> Icons/Names Mapping + * \{ */ + /* anim_ipo_utils.c */ -/* Get icon + name for channel-list displays for F-Curve */ +/** + * Get icon + name for channel-list displays for F-Curve. + * + * Write into "name" buffer, the name of the property + * (retrieved using RNA from the curve's settings), + * and return the icon used for the struct that this property refers to + * + * \warning name buffer we're writing to cannot exceed 256 chars + * (check anim_channels_defines.c for details). + */ int getname_anim_fcurve(char *name, struct ID *id, struct FCurve *fcu); -/* Automatically determine a color for the nth F-Curve */ +/** + * Automatically determine a color for the nth F-Curve. + */ void getcolor_fcurve_rainbow(int cur, int tot, float out[3]); -/* ----------------- NLA Drawing ----------------------- */ -/* NOTE: Technically, this is not in the animation module (it's in space_nla) +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name NLA Drawing + * + * \note Technically, this is not in the animation module (it's in space_nla) * but these are sometimes needed by various animation API's. - */ + * \{ */ -/* Get color to use for NLA Action channel's background */ +/** + * Get color to use for NLA Action channel's background. + * \note color returned includes fine-tuned alpha! + */ void nla_action_get_color(struct AnimData *adt, struct bAction *act, float color[4]); -/* ----------------- NLA-Mapping ----------------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name NLA-Mapping + * \{ */ + /* anim_draw.c */ -/* Obtain the AnimData block providing NLA-scaling for the given channel if applicable */ +/** + * Obtain the AnimData block providing NLA-mapping for the given channel (if applicable). + * + * TODO: do not supply return this if the animdata tells us that there is no mapping to perform. + */ struct AnimData *ANIM_nla_mapping_get(bAnimContext *ac, bAnimListElem *ale); -/* Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve */ +/** + * Apply/Unapply NLA mapping to all keyframes in the nominated F-Curve + * \param restore: Whether to map points back to non-mapped time. + * \param only_keys: Whether to only adjust the location of the center point of beztriples. + */ void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, struct FCurve *fcu, bool restore, @@ -759,11 +914,18 @@ void ANIM_nla_mapping_apply_fcurve(struct AnimData *adt, /* ..... */ -/* Perform auto-blending/extend refreshes after some operations */ -/* NOTE: defined in space_nla/nla_edit.c, not in animation/ */ +/** + * Perform validation & auto-blending/extend refreshes after some operations + * \note defined in space_nla/nla_edit.c, not in animation/ + */ void ED_nla_postop_refresh(bAnimContext *ac); -/* ------------- Unit Conversion Mappings ------------- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Unit Conversion Mappings + * \{ */ + /* anim_draw.c */ /* flags for conversion mapping */ @@ -785,16 +947,24 @@ typedef enum eAnimUnitConv_Flags { ANIM_UNITCONV_NORMALIZE_FREEZE = (1 << 6), } eAnimUnitConv_Flags; -/* Normalization flags from Space Graph passing to ANIM_unit_mapping_get_factor */ +/** + * Get flags used for normalization in ANIM_unit_mapping_get_factor. + */ short ANIM_get_normalization_flags(bAnimContext *ac); - -/* Get unit conversion factor for given ID + F-Curve */ +/** + * 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); -/* ------------- Utility macros ----------------------- */ +/** \} */ -/* provide access to Keyframe Type info in BezTriple +/* -------------------------------------------------------------------- */ +/** \name Utility macros + * \{ */ + +/** + * Provide access to Keyframe Type info in #BezTriple. * NOTE: this is so that we can change it from being stored in 'hide' */ #define BEZKEYTYPE(bezt) ((bezt)->hide) @@ -837,18 +1007,37 @@ float ANIM_unit_mapping_get_factor( } \ ((void)0) -/* --------- anim_deps.c, animation updates -------- */ +/** \} */ +/* anim_deps.c */ + +/* -------------------------------------------------------------------- */ +/** \name Animation Updates + * \{ */ + +/** + * Tags the given ID block for refreshes (if applicable) due to Animation Editor editing. + */ void ANIM_id_update(struct Main *bmain, struct ID *id); +/** + * Tags the given anim list element for refreshes (if applicable) due to Animation Editor editing. + */ void ANIM_list_elem_update(struct Main *bmain, struct Scene *scene, bAnimListElem *ale); /* data -> channels syncing */ + +/** + * Main call to be exported to animation editors. + */ void ANIM_sync_animchannels_to_data(const struct bContext *C); void ANIM_center_frame(struct bContext *C, int smooth_viewtx); -/* ************************************************* */ -/* OPERATORS */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Operators + * \{ */ /* generic animation channels */ void ED_operatortypes_animchannels(void); @@ -863,11 +1052,18 @@ void ED_operatormacros_graph(void); /* space_action */ void ED_operatormacros_action(void); -/* ************************************************ */ -/* Animation Editor Exports */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Animation Editor Exports + * \{ */ + /* XXX: Should we be doing these here, or at all? */ -/* Action Editor - Action Management */ +/** + * Action Editor - Action Management. + * Helper function to find the active AnimData block from the Action Editor context. + */ struct AnimData *ED_actedit_animdata_from_context(const struct bContext *C, struct ID **r_adt_id_owner); void ED_animedit_unlink_action(struct bContext *C, @@ -877,7 +1073,11 @@ void ED_animedit_unlink_action(struct bContext *C, struct ReportList *reports, bool force_delete); -/* Drivers Editor - Utility to set up UI correctly */ +/** + * Set up UI configuration for Drivers Editor + * (drivers editor window) and RNA (mode switching). + * \note Currently called from window-manager. + */ void ED_drivers_editor_init(struct bContext *C, struct ScrArea *area); /* ************************************************ */ @@ -905,8 +1105,14 @@ void animviz_calc_motionpaths(struct Depsgraph *depsgraph, eAnimvizCalcRange range, bool restore); +/** + * Get list of motion paths to be baked for the given object. + * - assumes the given list is ready to be used. + */ void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); +/** \} */ + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h index af0643f0d64..79404aada41 100644 --- a/source/blender/editors/include/ED_buttons.h +++ b/source/blender/editors/include/ED_buttons.h @@ -30,6 +30,11 @@ struct ScrArea; struct SpaceProperties; struct bContext; +/** + * Fills an array with the tab context values for the properties editor. -1 signals a separator. + * + * \return The total number of items in the array returned. + */ int ED_buttons_tabs_list(struct SpaceProperties *sbuts, short *context_tabs_array); bool ED_buttons_tab_has_search_result(struct SpaceProperties *sbuts, const int index); diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 4fa78eddec4..6167ae3aee6 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -56,6 +56,9 @@ void ED_space_clip_get_zoom(struct SpaceClip *sc, void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy); void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy); +/** + * Return current frame number in clip space. + */ int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc); struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc); @@ -68,6 +71,9 @@ bool ED_space_clip_get_position(struct SpaceClip *sc, struct ARegion *region, int mval[2], float fpos[2]); +/** + * Returns color in linear space, matching #ED_space_image_color_sample(). + */ bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *region, int mval[2], @@ -82,10 +88,17 @@ bool ED_clip_can_select(struct bContext *C); 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 *region, float x, float y, float *xr, float *yr); +/** + * \brief the reverse of #ED_clip_point_stable_pos(), gets the marker region coords. + * better name here? view_to_track / track_to_view or so? + */ void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, struct ARegion *region, const float co[2], float r_co[2]); +/** + * Takes `event->mval`. + */ void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *region, const int mval[2], diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 44c5897d3a3..805d42b6fbc 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -43,14 +43,22 @@ struct wmKeyConfig; struct wmOperator; /* curve_ops.c */ + 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); +/** + * Load editNurb in object. + */ void ED_curve_editnurb_load(struct Main *bmain, struct Object *obedit); +/** + * Make copy in `cu->editnurb`. + */ void ED_curve_editnurb_make(struct Object *obedit); void ED_curve_editnurb_free(struct Object *obedit); @@ -65,9 +73,14 @@ int ED_curve_nurb_select_count(const struct View3D *v3d, const struct Nurb *nu); bool ED_curve_nurb_select_all(const struct Nurb *nu); bool ED_curve_nurb_deselect_all(const struct Nurb *nu); +/** + * This is used externally, by #OBJECT_OT_join. + * TODO: shape keys - as with meshes. + */ int ED_curve_join_objects_exec(struct bContext *C, struct wmOperator *op); /* editcurve_select.c */ + bool ED_curve_select_check(const struct View3D *v3d, const struct EditNurb *editnurb); bool ED_curve_deselect_all(struct EditNurb *editnurb); bool ED_curve_deselect_all_multi_ex(struct Base **bases, int bases_len); @@ -77,9 +90,12 @@ bool ED_curve_select_swap(struct EditNurb *editnurb, bool hide_handles); int ED_curve_select_count(const struct View3D *v3d, const struct EditNurb *editnurb); /* editcurve_undo.c */ + +/** Export for ED_undo_sys */ 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); @@ -92,14 +108,22 @@ void ED_curve_beztcpy(struct EditNurb *editnurb, int count); void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count); +/** + * Return 0 if animation data wasn't changed, 1 otherwise. + */ int ED_curve_updateAnimPaths(struct Main *bmain, struct Curve *cu); bool ED_curve_active_center(struct Curve *cu, float center[3]); +/** + * TextBox selection + */ bool ED_curve_editfont_select_pick( struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); /* editfont_undo.c */ + +/** Export for ED_undo_sys. */ void ED_font_undosys_type(struct UndoType *ut); #if 0 diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index c1936b2fde5..460de58bdb2 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -105,13 +105,26 @@ typedef struct FileSelection { struct View2D; struct rcti; +/** + * If needed, create and return the file select parameters for the active browse mode. + */ struct FileSelectParams *ED_fileselect_ensure_active_params(struct SpaceFile *sfile); +/** + * Get the file select parameters for the active browse mode. + */ struct FileSelectParams *ED_fileselect_get_active_params(const struct SpaceFile *sfile); struct FileSelectParams *ED_fileselect_get_file_params(const struct SpaceFile *sfile); struct FileAssetSelectParams *ED_fileselect_get_asset_params(const struct SpaceFile *sfile); bool ED_fileselect_is_local_asset_library(const struct SpaceFile *sfile); void ED_fileselect_set_params_from_userdef(struct SpaceFile *sfile); +/** + * Update the user-preference data for the file space. In fact, this also contains some + * non-FileSelectParams data, but we can safely ignore this. + * + * \param temp_win_size: If the browser was opened in a temporary window, + * pass its size here so we can store that in the preferences. Otherwise NULL. + */ void ED_fileselect_params_to_userdef(struct SpaceFile *sfile, const int temp_win_size[2], const bool is_maximized); @@ -124,6 +137,10 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *region); int ED_fileselect_layout_offset(FileLayout *layout, int x, int y); FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const struct rcti *rect); +/** + * Get the currently visible bounds of the layout in screen space. Matches View2D.mask minus the + * top column-header row. + */ void ED_fileselect_layout_maskrect(const FileLayout *layout, const struct View2D *v2d, struct rcti *r_rect); @@ -150,8 +167,10 @@ struct ID *ED_fileselect_active_asset_get(const struct SpaceFile *sfile); void ED_fileselect_activate_asset_catalog(const struct SpaceFile *sfile, bUUID catalog_id); -/* Activate and select the file that corresponds to the given ID. - * Pass deferred=true to wait for the next refresh before activating. */ +/** + * Activate and select the file that corresponds to the given ID. + * Pass deferred=true to wait for the next refresh before activating. + */ void ED_fileselect_activate_by_id(struct SpaceFile *sfile, struct ID *asset_id, const bool deferred); @@ -166,12 +185,18 @@ void ED_fileselect_window_params_get(const struct wmWindow *win, struct ScrArea *ED_fileselect_handler_area_find(const struct wmWindow *win, const struct wmOperator *file_operator); +/* TODO: Maybe we should move this to BLI? + * On the other hand, it's using defines from space-file area, so not sure... */ int ED_path_extension_type(const char *path); int ED_file_extension_icon(const char *path); int ED_file_icon(const struct FileDirEntry *file); void ED_file_read_bookmarks(void); +/** + * Support updating the directory even when this isn't the active space + * needed so RNA properties update function isn't context sensitive, see T70255. + */ void ED_file_change_dir_ex(struct bContext *C, struct ScrArea *area); void ED_file_change_dir(struct bContext *C); diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index 4d922162ee9..55beff40177 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -92,7 +92,17 @@ enum { ED_GIZMO_ARROW_DRAW_FLAG_STEM = (1 << 0), }; +/** + * Define a custom property UI range. + * + * \note Needs to be called before #WM_gizmo_target_property_def_rna! + */ void ED_gizmo_arrow3d_set_ui_range(struct wmGizmo *gz, const float min, const float max); +/** + * Define a custom factor for arrow min/max distance. + * + * \note Needs to be called before #WM_gizmo_target_property_def_rna! + */ void ED_gizmo_arrow3d_set_range_fac(struct wmGizmo *gz, const float range_fac); /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 1cf15ce3a48..53c55a7668f 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -116,42 +116,97 @@ typedef struct tGPspoint { /* ----------- Grease Pencil Tools/Context ------------- */ /* Context-dependent */ + +/** + * Get pointer to active Grease Pencil data-block, + * and an RNA-pointer to trace back to whatever owns it. + */ struct bGPdata **ED_gpencil_data_get_pointers(const struct bContext *C, struct PointerRNA *r_ptr); +/** + * Get the active Grease Pencil data-block + */ struct bGPdata *ED_gpencil_data_get_active(const struct bContext *C); +/** + * Get the evaluated copy of the active Grease Pencil data-block (where applicable) + * - For the 3D View (i.e. "GP Objects"), this gives the evaluated copy of the GP data-block + * (i.e. a copy of the active GP data-block for the active object, where modifiers have been + * applied). This is needed to correctly work with "Copy-on-Write". + * - For all other editors (i.e. "GP Annotations"), this just gives the active data-block + * like for #ED_gpencil_data_get_active() + */ struct bGPdata *ED_gpencil_data_get_active_evaluated(const struct bContext *C); -/* Context independent (i.e. each required part is passed in instead) */ +/** + * Context independent (i.e. each required part is passed in instead). + * + * Get pointer to active Grease Pencil data-block, + * and an RNA-pointer to trace back to whatever owns it, + * when context info is not available. + */ struct bGPdata **ED_gpencil_data_get_pointers_direct(struct ScrArea *area, struct Object *ob, struct PointerRNA *r_ptr); +/* Get the active Grease Pencil data-block, when context is not available */ struct bGPdata *ED_gpencil_data_get_active_direct(struct ScrArea *area, struct Object *ob); +/** + * Get the active Grease Pencil data-block + * \note This is the original (#G.main) copy of the data-block, stored in files. + * Do not use for reading evaluated copies of GP Objects data. + */ struct bGPdata *ED_annotation_data_get_active(const struct bContext *C); +/** + * Get pointer to active Grease Pencil data-block, + * and an RNA-pointer to trace back to whatever owns it. + */ struct bGPdata **ED_annotation_data_get_pointers(const struct bContext *C, struct PointerRNA *r_ptr); +/** + * Get pointer to active Grease Pencil data-block for annotations, + * and an RNA-pointer to trace back to whatever owns it, + * when context info is not available. + */ struct bGPdata **ED_annotation_data_get_pointers_direct(struct ID *screen_id, struct ScrArea *area, struct Scene *scene, struct PointerRNA *r_ptr); +/** + * Get the active Grease Pencil data-block, when context is not available. + */ struct bGPdata *ED_annotation_data_get_active_direct(struct ID *screen_id, struct ScrArea *area, struct Scene *scene); +/** + * Utility to check whether the r_ptr output of ED_gpencil_data_get_pointers() + * is for annotation usage. + */ bool ED_gpencil_data_owner_is_annotation(struct PointerRNA *owner_ptr); /* 3D View */ + +/** + * Check whether there's an active GP keyframe on the current frame. + */ bool ED_gpencil_has_keyframe_v3d(struct Scene *scene, struct Object *ob, int cfra); /* ----------- Stroke Editing Utilities ---------------- */ bool ED_gpencil_frame_has_selected_stroke(const struct bGPDframe *gpf); bool ED_gpencil_layer_has_selected_stroke(const struct bGPDlayer *gpl, const bool is_multiedit); +/** + * Check whether given stroke can be edited given the supplied context. + * TODO: do we need additional flags for screen-space vs data-space?. + */ bool ED_gpencil_stroke_can_use_direct(const struct ScrArea *area, const struct bGPDstroke *gps); +/* Check whether given stroke can be edited in the current context */ bool ED_gpencil_stroke_can_use(const struct bContext *C, const struct bGPDstroke *gps); +/* Check whether given stroke can be edited for the current color */ bool ED_gpencil_stroke_material_editable(struct Object *ob, const struct bGPDlayer *gpl, const struct bGPDstroke *gps); +/* Check whether given stroke is visible for the current material. */ bool ED_gpencil_stroke_material_visible(struct Object *ob, const struct bGPDstroke *gps); /* ----------- Grease Pencil Operators ----------------- */ @@ -164,13 +219,32 @@ void ED_operatormacros_gpencil(void); /* ------------- Copy-Paste Buffers -------------------- */ /* Strokes copybuf */ + +/** + * Free copy/paste buffer data. + */ void ED_gpencil_strokes_copybuf_free(void); /* ------------ Grease-Pencil Drawing API ------------------ */ /* drawgpencil.c */ +/** + * Draw grease-pencil sketches to specified 2d-view that uses ibuf corrections. + */ void ED_annotation_draw_2dimage(const struct bContext *C); +/** + * Draw grease-pencil sketches to specified 2d-view + * assuming that matrices are already set correctly. + * + * \note This gets called twice - first time with onlyv2d=true to draw 'canvas' strokes, + * second time with onlyv2d=false for screen-aligned strokes. + */ void ED_annotation_draw_view2d(const struct bContext *C, bool onlyv2d); +/** + * Draw annotations sketches to specified 3d-view assuming that matrices are already set correctly. + * NOTE: this gets called twice - first time with only3d=true to draw 3d-strokes, + * second time with only3d=false for screen-aligned strokes. + */ void ED_annotation_draw_view3d(struct Scene *scene, struct Depsgraph *depsgraph, struct View3D *v3d, @@ -184,43 +258,103 @@ void ED_annotation_draw_ex(struct Scene *scene, const char spacetype); /* ----------- Grease-Pencil AnimEdit API ------------------ */ +/** + * Loops over the gp-frames for a gp-layer, and applies the given callback. + */ bool ED_gpencil_layer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene, bool (*gpf_cb)(struct bGPDframe *, struct Scene *)); +/** + * Make a listing all the gp-frames in a layer as cfraelems. + */ void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel); +/** + * Check if one of the frames in this layer is selected. + */ bool ED_gpencil_layer_frame_select_check(const struct bGPDlayer *gpl); +/** + * Set all/none/invert select. + */ void ED_gpencil_layer_frame_select_set(struct bGPDlayer *gpl, short mode); +/** + * Select the frames in this layer that occur within the bounds specified. + */ void ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl, float min, float max, short select_mode); +/** + * Select the frames in this layer that occur within the lasso/circle region specified. + */ void ED_gpencil_layer_frames_select_region(struct KeyframeEditData *ked, struct bGPDlayer *gpl, short tool, short select_mode); +/** + * Set all/none/invert select (like above, but with SELECT_* modes). + */ void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode); +/** + * Select the frame in this layer that occurs on this frame (there should only be one at most). + */ void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode); +/** + * Delete selected frames. + */ bool ED_gpencil_layer_frames_delete(struct bGPDlayer *gpl); +/** + * Duplicate selected frames from given gp-layer. + */ void ED_gpencil_layer_frames_duplicate(struct bGPDlayer *gpl); +/** + * Merge two layers. + */ void ED_gpencil_layer_merge(struct bGPdata *gpd, struct bGPDlayer *gpl_src, struct bGPDlayer *gpl_dst, const bool reverse); +/** + * Set keyframe type for selected frames from given gp-layer + * + * \param type: The type of keyframe (#eBezTriple_KeyframeType) to set selected frames to. + */ void ED_gpencil_layer_frames_keytype_set(struct bGPDlayer *gpl, short type); - +/** + * Snap selected frames to .... + */ void ED_gpencil_layer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); + +/** + * Mirror selected gp-frames on... + * TODO: mirror over a specific time. + */ void ED_gpencil_layer_mirror_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); +/** + * This function frees any MEM_calloc'ed copy/paste buffer data. + */ void ED_gpencil_anim_copybuf_free(void); +/** + * This function adds data to the copy/paste buffer, freeing existing data first + * Only the selected GP-layers get their selected keyframes copied. + * + * Returns whether the copy operation was successful or not. + */ bool ED_gpencil_anim_copybuf_copy(struct bAnimContext *ac); +/** + * Pastes keyframes from buffer, and reports success. + */ bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mode); /* ------------ Grease-Pencil Undo System ------------------ */ int ED_gpencil_session_active(void); +/** + * \param step: eUndoStepDir. + */ int ED_undo_gpencil_step(struct bContext *C, const int step); /* eUndoStepDir. */ /* ------------ Grease-Pencil Armature ------------------ */ @@ -234,7 +368,10 @@ bool ED_gpencil_add_armature_weights(const struct bContext *C, struct Object *ob_arm, int mode); -/* Add Lattice modifier using Parent operator */ +/** + * Add Lattice modifier using Parent operator. + * Parent GPencil object to Lattice. + */ bool ED_gpencil_add_lattice_modifier(const struct bContext *C, struct ReportList *reports, struct Object *ob, @@ -246,37 +383,74 @@ bool ED_gpencil_add_lattice_modifier(const struct bContext *C, /* ------------ Transformation Utilities ------------ */ -/* reset parent matrix for all layers */ +/** + * Reset parent matrix for all layers. + */ void ED_gpencil_reset_layers_parent(struct Depsgraph *depsgraph, struct Object *obact, struct bGPdata *gpd); -/* cursor utilities */ +/* Cursor utilities. */ + +/** + * Draw eraser cursor. + */ void ED_gpencil_brush_draw_eraser(struct Brush *brush, int x, int y); /* ----------- Add Primitive Utilities -------------- */ -/* Number of values defining each point in the built-in data buffers for primitives. */ +/** Number of values defining each point in the built-in data buffers for primitives. */ #define GP_PRIM_DATABUF_SIZE 5 +/** + * Populate stroke with point data from data buffers. + * \param gps: Grease pencil stroke + * \param array: Flat array of point data values. Each entry has #GP_PRIM_DATABUF_SIZE values. + * \param totpoints: Total of points + * \param mat: 4x4 transform matrix to transform points into the right coordinate space. + */ void ED_gpencil_stroke_init_data(struct bGPDstroke *gps, const float *array, const int totpoints, const float mat[4][4]); +/** + * Add a Simple empty object with one layer and one color. + */ void ED_gpencil_create_blank(struct bContext *C, struct Object *ob, float mat[4][4]); +/** + * Add a 2D Suzanne (original model created by Matias Mendiola). + */ void ED_gpencil_create_monkey(struct bContext *C, struct Object *ob, float mat[4][4]); +/** + * Add a Simple stroke with colors + * (original design created by Daniel M. Lara and Matias Mendiola). + */ void ED_gpencil_create_stroke(struct bContext *C, struct Object *ob, float mat[4][4]); +/** + * Add a Simple LineArt setup. + */ void ED_gpencil_create_lineart(struct bContext *C, struct Object *ob); /* ------------ Object Utilities ------------ */ +/** + * Helper function to create new #OB_GPENCIL Object. + */ struct Object *ED_gpencil_add_object(struct bContext *C, const float loc[3], unsigned short local_view_bits); +/** + * Helper function to create default colors and drawing brushes. + */ void ED_gpencil_add_defaults(struct bContext *C, struct Object *ob); -/* set object modes */ +/** + * Set object modes. + */ void ED_gpencil_setup_modes(struct bContext *C, struct bGPdata *gpd, int newmode); bool ED_object_gpencil_exit(struct Main *bmain, struct Object *ob); +/** + * Reproject all points of the stroke to a plane locked to axis to avoid stroke offset + */ void ED_gpencil_project_stroke_to_plane(const struct Scene *scene, const struct Object *ob, const struct RegionView3D *rv3d, @@ -284,6 +458,10 @@ void ED_gpencil_project_stroke_to_plane(const struct Scene *scene, struct bGPDstroke *gps, const float origin[3], const int axis); +/** + * Reproject given point to a plane locked to axis to avoid stroke offset + * \param pt: Point to affect (used for input & output). + */ void ED_gpencil_project_point_to_plane(const struct Scene *scene, const struct Object *ob, struct bGPDlayer *gpl, @@ -291,6 +469,10 @@ void ED_gpencil_project_point_to_plane(const struct Scene *scene, const float origin[3], const int axis, struct bGPDspoint *pt); +/** + * Get drawing reference point for conversion or projection of the stroke + * \param r_vec: Reference point found + */ void ED_gpencil_drawing_reference_get(const struct Scene *scene, const struct Object *ob, char align_flag, @@ -299,6 +481,9 @@ void ED_gpencil_project_stroke_to_view(struct bContext *C, struct bGPDlayer *gpl, struct bGPDstroke *gps); +/** + * Reproject selected strokes. + */ void ED_gpencil_stroke_reproject(struct Depsgraph *depsgraph, const struct GP_SpaceConversion *gsc, struct SnapObjectContext *sctx, @@ -308,27 +493,54 @@ void ED_gpencil_stroke_reproject(struct Depsgraph *depsgraph, const eGP_ReprojectModes mode, const bool keep_original); -/* set sculpt cursor */ +/** + * Turn brush cursor in on/off. + */ void ED_gpencil_toggle_brush_cursor(struct bContext *C, bool enable, void *customdata); /* vertex groups */ + +/** + * Assign points to vertex group. + */ void ED_gpencil_vgroup_assign(struct bContext *C, struct Object *ob, float weight); +/** + * Remove points from vertex group. + */ void ED_gpencil_vgroup_remove(struct bContext *C, struct Object *ob); +/** + * Select points of vertex group. + */ void ED_gpencil_vgroup_select(struct bContext *C, struct Object *ob); +/** + * Unselect points of vertex group. + */ void ED_gpencil_vgroup_deselect(struct bContext *C, struct Object *ob); /* join objects */ + +/** + * Join objects called from OBJECT_OT_join. + */ int ED_gpencil_join_objects_exec(struct bContext *C, struct wmOperator *op); /* texture coordinate utilities */ + +/** + * Convert 2d #tGPspoint to 3d #bGPDspoint. + */ void ED_gpencil_tpoint_to_point(struct ARegion *region, float origin[3], const struct tGPspoint *tpt, struct bGPDspoint *pt); +/** + * Recalculate UV for any stroke using the material. + */ void ED_gpencil_update_color_uv(struct Main *bmain, struct Material *mat); -/* extend selection to stroke intersections - * returns: +/** + * Extend selection to stroke intersections: + * \returns: * 0 - No hit * 1 - Hit in point A * 2 - Hit in point B @@ -347,17 +559,23 @@ int ED_gpencil_select_stroke_segment(struct bGPdata *gpd, void ED_gpencil_select_toggle_all(struct bContext *C, int action); void ED_gpencil_select_curve_toggle_all(struct bContext *C, int action); -/* Ensure stroke sbuffer size is enough */ +/** + * Ensure the #tGPspoint buffer (while drawing stroke) + * size is enough to save all points of the stroke. + */ struct tGPspoint *ED_gpencil_sbuffer_ensure(struct tGPspoint *buffer_array, int *buffer_size, int *buffer_used, const bool clear); void ED_gpencil_sbuffer_update_eval(struct bGPdata *gpd, struct Object *ob_eval); -/* Tag all scene grease pencil object to update. */ +/** + * Tag all scene grease pencil object to update. + */ void ED_gpencil_tag_scene_gpencil(struct Scene *scene); /* Vertex color set. */ + void ED_gpencil_fill_vertex_color_set(struct ToolSettings *ts, struct Brush *brush, struct bGPDstroke *gps); @@ -376,15 +594,30 @@ void ED_gpencil_init_random_settings(struct Brush *brush, const int mval[2], struct GpRandomSettings *random_settings); +/** + * Check if the stroke collides with brush. + */ bool ED_gpencil_stroke_check_collision(const struct GP_SpaceConversion *gsc, struct bGPDstroke *gps, const float mouse[2], const int radius, const float diff_mat[4][4]); +/** + * Check if a point is inside of the stroke. + * + * \param gps: Stroke to check. + * \param gsc: Space conversion data. + * \param mouse: Mouse position. + * \param diff_mat: View matrix. + * \return True if the point is inside. + */ bool ED_gpencil_stroke_point_is_inside(const struct bGPDstroke *gps, const struct GP_SpaceConversion *gsc, const int mouse[2], const float diff_mat[4][4]); +/** + * Get the bigger 2D bound box points. + */ void ED_gpencil_projected_2d_bound_box(const struct GP_SpaceConversion *gsc, const struct bGPDstroke *gps, const float diff_mat[4][4], @@ -400,18 +633,27 @@ struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C, const float ctrl2[2], const float radius, int *r_index); +/** + * Get extremes of stroke in 2D using current view. + */ void ED_gpencil_stroke_extremes_to2d(const struct GP_SpaceConversion *gsc, const float diff_mat[4][4], struct bGPDstroke *gps, float r_ctrl1[2], float r_ctrl2[2]); +/** + * Join two stroke using a contact point index and trimming the rest. + */ struct bGPDstroke *ED_gpencil_stroke_join_and_trim(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *gps_dst, const int pt_index); +/** + * Close if the distance between extremes is below threshold. + */ void ED_gpencil_stroke_close_by_distance(struct bGPDstroke *gps, const float threshold); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 1400bcf5ee3..3308ae2c178 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -48,11 +48,17 @@ float ED_space_image_zoom_level(const struct View2D *v2d, const int grid_dimensi void ED_space_image_grid_steps(struct SpaceImage *sima, float grid_steps[SI_GRID_STEPS_LEN], const int grid_dimension); +/** + * Calculate the increment snapping value for UV/image editor based on the zoom factor + * The code in here (except the offset part) is used in `grid_frag.glsl` (see `grid_res`) for + * drawing the grid overlay for the UV/Image editor. + */ float ED_space_image_increment_snap_value(const int grid_dimesnions, const float grid_steps[SI_GRID_STEPS_LEN], const float zoom_factor); -/* image_edit.c, exported for transform */ +/* image_edit.c, exported for transform. */ + struct Image *ED_space_image(const struct SpaceImage *sima); void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, @@ -62,13 +68,22 @@ void ED_space_image_auto_set(const struct bContext *C, struct SpaceImage *sima); struct Mask *ED_space_image_get_mask(const struct SpaceImage *sima); void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask); +/** + * Returns mouse position in image space. + */ bool ED_space_image_get_position(struct SpaceImage *sima, struct ARegion *region, int mval[2], float fpos[2]); +/** + * Returns color in linear space, matching #ED_space_node_color_sample(). + */ bool ED_space_image_color_sample( struct SpaceImage *sima, struct ARegion *region, int mval[2], float r_col[3], bool *r_is_data); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile); +/** + * Get the #SpaceImage flag that is valid for the given ibuf. + */ int ED_space_image_get_display_channel_mask(struct ImBuf *ibuf); void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock); bool ED_space_image_has_buffer(struct SpaceImage *sima); @@ -87,6 +102,12 @@ void ED_space_image_scopes_update(const struct bContext *C, struct ImBuf *ibuf, bool use_view_settings); +/** + * Enable the paint cursor if it isn't already. + * + * purpose is to make sure the paint cursor is shown if paint mode is enabled in the image editor. + * The paint poll will ensure that the cursor is hidden when not in paint mode. + */ void ED_space_image_paint_update(struct Main *bmain, struct wmWindowManager *wm, struct Scene *scene); @@ -95,6 +116,7 @@ void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *r_aspx, float *r_aspy); +/** Takes `event->mval`. */ void ED_image_mouse_pos(struct SpaceImage *sima, const struct ARegion *region, const int mval[2], @@ -110,6 +132,10 @@ void ED_image_point_pos__reverse(struct SpaceImage *sima, const struct ARegion *region, const float co[2], float r_co[2]); +/** + * This is more a user-level functionality, for going to `next/prev` used slot, + * Stepping onto the last unused slot too. + */ bool ED_image_slot_cycle(struct Image *image, int direction); bool ED_space_image_show_render(const struct SpaceImage *sima); @@ -118,11 +144,17 @@ bool ED_space_image_show_uvedit(const struct SpaceImage *sima, struct Object *ob bool ED_space_image_paint_curve(const struct bContext *C); +/** + * Matches clip function. + */ bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct Object *obedit); bool ED_space_image_maskedit_poll(struct bContext *C); bool ED_space_image_maskedit_mask_poll(struct bContext *C); bool ED_space_image_cursor_poll(struct bContext *C); +/** + * Used by node view too. + */ void ED_image_draw_info(struct Scene *scene, struct ARegion *region, bool color_manage, @@ -161,6 +193,9 @@ typedef struct ImageFrameRange { ListBase frames; } ImageFrameRange; +/** + * Used for both images and volume file loading. + */ ListBase ED_image_filesel_detect_sequences(struct Main *bmain, struct wmOperator *op, const bool detect_udim); diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h index dde26c072d0..caf76841bcd 100644 --- a/source/blender/editors/include/ED_info.h +++ b/source/blender/editors/include/ED_info.h @@ -39,6 +39,11 @@ const char *ED_info_statistics_string(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer); +/** + * \param v3d_local: Pass this argument to calculate view-port local statistics. + * Note that this must only be used for local-view, otherwise report specific statistics + * will be written into the global scene statistics giving incorrect results. + */ void ED_info_draw_stats(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h index 6982ad20f07..dc800d78007 100644 --- a/source/blender/editors/include/ED_lattice.h +++ b/source/blender/editors/include/ED_lattice.h @@ -33,10 +33,12 @@ struct UndoType; struct wmKeyConfig; /* lattice_ops.c */ + void ED_operatortypes_lattice(void); 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); @@ -45,6 +47,8 @@ bool ED_lattice_deselect_all_multi_ex(struct Base **bases, const uint bases_len) bool ED_lattice_deselect_all_multi(struct bContext *C); /* editlattice_undo.c */ + +/** Export for ED_undo_sys. */ void ED_lattice_undosys_type(struct UndoType *ut); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index c2fdbc160de..3aab6882dc2 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -37,6 +37,7 @@ struct bContext; struct wmKeyConfig; /* mask_edit.c */ + void ED_mask_deselect_all(const struct bContext *C); void ED_operatortypes_mask(void); @@ -44,6 +45,7 @@ void ED_keymap_mask(struct wmKeyConfig *keyconf); void ED_operatormacros_mask(void); /* mask_query.c */ + void ED_mask_get_size(struct ScrArea *area, int *width, int *height); void ED_mask_zoom(struct ScrArea *area, struct ARegion *region, float *zoomx, float *zoomy); void ED_mask_get_aspect(struct ScrArea *area, struct ARegion *region, float *aspx, float *aspy); @@ -52,11 +54,18 @@ void ED_mask_pixelspace_factor(struct ScrArea *area, struct ARegion *region, float *scalex, float *scaley); +/** + * Takes `event->mval`. + */ void ED_mask_mouse_pos(struct ScrArea *area, struct ARegion *region, const int mval[2], float co[2]); +/** + * \param x/y: input, mval space. + * \param xr/yr: output, mask point space. + */ void ED_mask_point_pos( struct ScrArea *area, struct ARegion *region, float x, float y, float *xr, float *yr); void ED_mask_point_pos__reverse( @@ -69,7 +78,12 @@ bool ED_mask_selected_minmax(const struct bContext *C, bool handles_as_control_point); /* mask_draw.c */ + void ED_mask_draw(const struct bContext *C, const char draw_flag, const char draw_type); +/** + * Sets up the opengl context. + * width, height are to match the values from #ED_mask_get_size(). + */ void ED_mask_draw_region(struct Depsgraph *depsgraph, struct Mask *mask, struct ARegion *region, @@ -89,33 +103,68 @@ void ED_mask_draw_frames( struct Mask *mask, struct ARegion *region, const int cfra, const int sfra, const int efra); /* mask_shapekey.c */ + void ED_mask_layer_shape_auto_key(struct MaskLayer *mask_layer, const int frame); 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 ------------------ */ + +/** + * Loops over the mask-frames for a mask-layer, and applies the given callback. + */ bool ED_masklayer_frames_looper(struct MaskLayer *mask_layer, struct Scene *scene, bool (*mask_layer_shape_cb)(struct MaskLayerShape *, struct Scene *)); +/** + * Make a listing all the mask-frames in a layer as cfraelems. + */ void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems, bool onlysel); +/** + * Check if one of the frames in this layer is selected. + */ bool ED_masklayer_frame_select_check(const struct MaskLayer *mask_layer); +/** + * Set all/none/invert select. + */ void ED_masklayer_frame_select_set(struct MaskLayer *mask_layer, short mode); +/** + * Select the frames in this layer that occur within the bounds specified. + */ void ED_masklayer_frames_select_box(struct MaskLayer *mask_layer, float min, float max, short select_mode); +/** + * Select the frames in this layer that occur within the lasso/circle region specified. + */ void ED_masklayer_frames_select_region(struct KeyframeEditData *ked, struct MaskLayer *mask_layer, short tool, short select_mode); +/** + * Set all/none/invert select (like above, but with SELECT_* modes). + */ void ED_mask_select_frames(struct MaskLayer *mask_layer, short select_mode); +/** + * Select the frame in this layer that occurs on this frame (there should only be one at most). + */ void ED_mask_select_frame(struct MaskLayer *mask_layer, int selx, short select_mode); +/** + * Delete selected frames. + */ bool ED_masklayer_frames_delete(struct MaskLayer *mask_layer); +/** + * Duplicate selected frames from given mask-layer. + */ void ED_masklayer_frames_duplicate(struct MaskLayer *mask_layer); +/** + * Snap selected frames to ... + */ void ED_masklayer_snap_frames(struct MaskLayer *mask_layer, struct Scene *scene, short mode); #if 0 diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h index 7648af159c9..1afd7f06a5a 100644 --- a/source/blender/editors/include/ED_mball.h +++ b/source/blender/editors/include/ED_mball.h @@ -37,6 +37,9 @@ void ED_operatortypes_metaball(void); void ED_operatormacros_metaball(void); void ED_keymap_metaball(struct wmKeyConfig *keyconf); +/** + * Add meta-element primitive to meta-ball object (which is in edit mode). + */ struct MetaElem *ED_mball_add_primitive(struct bContext *C, struct Object *obedit, bool obedit_is_new, @@ -44,17 +47,32 @@ struct MetaElem *ED_mball_add_primitive(struct bContext *C, float dia, int type); +/** + * Select MetaElement with mouse click (user can select radius circle or stiffness circle). + */ 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); +/** + * This function is used to free all MetaElems from MetaBall. + */ void ED_mball_editmball_free(struct Object *obedit); +/** + * This function is called, when MetaBall Object is switched from object mode to edit mode. + */ void ED_mball_editmball_make(struct Object *obedit); +/** + * This function is called, when MetaBall Object switched from edit mode to object mode. + * List of MetaElements is copied from object->data->edit_elems to object->data->elems. + */ void ED_mball_editmball_load(struct Object *obedit); /* editmball_undo.c */ + +/** Export for ED_undo_sys. */ void ED_mball_undosys_type(struct UndoType *ut); #define MBALLSEL_STIFF (1u << 30) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 22de6ca15bf..e6a064a3f51 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -58,6 +58,17 @@ struct wmKeyConfig; struct wmOperator; /* editmesh_utils.c */ + +/** + * \param em: Editmesh. + * \param use_self: Allow a vertex to point to its self (middle verts). + * \param use_select: Restrict to selected verts. + * \param respecthide: Skip hidden vertices. + * \param use_topology: Use topology mirror. + * \param maxdist: Distance for close point test. + * \param r_index: Optional array to write into, as an alternative to a customdata layer + * (length of total verts). + */ void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, const int axis, const bool use_self, @@ -86,14 +97,24 @@ void EDBM_mesh_clear(struct BMEditMesh *em); void EDBM_selectmode_to_scene(struct bContext *C); void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool add_key_index); +/** + * Should only be called on the active edit-mesh, otherwise call #BKE_editmesh_free_data. + */ void EDBM_mesh_free_data(struct BMEditMesh *em); +/** + * \warning This can invalidate the #Mesh runtime cache of other objects (for linked duplicates). + * Most callers should run #DEG_id_tag_update on `ob->data`, see: T46738, T46913. + * This ensures #BKE_object_free_derived_caches runs on all objects that use this mesh. + */ void EDBM_mesh_load_ex(struct Main *bmain, struct Object *ob, bool free_data); void EDBM_mesh_load(struct Main *bmain, struct Object *ob); -/* flushes based on the current select mode. if in vertex select mode, +/** + * flushes based on the current select mode. If in vertex select mode, * verts select/deselect edges and faces, if in edge select mode, * edges select/deselect faces and vertices, and in face select mode faces select/deselect - * edges and vertices. */ + * edges and vertices. + */ void EDBM_select_more(struct BMEditMesh *em, const bool use_face_step); void EDBM_select_less(struct BMEditMesh *em, const bool use_face_step); @@ -105,6 +126,9 @@ void EDBM_select_flush(struct BMEditMesh *em); bool EDBM_vert_color_check(struct BMEditMesh *em); +/** + * Swap is 0 or 1, if 1 it hides not selected. + */ bool EDBM_mesh_hide(struct BMEditMesh *em, bool swap); bool EDBM_mesh_reveal(struct BMEditMesh *em, bool select); @@ -114,9 +138,18 @@ struct EDBMUpdate_Params { uint is_destructive : 1; }; +/** + * So many tools call these that we better make it a generic function. + */ void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params); +/** + * Bad level call from Python API. + */ void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool is_destructive); +/** + * A specialized vert map used by stitch operator. + */ struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, const struct Scene *scene, const bool face_selected, @@ -128,13 +161,23 @@ struct UvElement *BM_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l); +/** + * Can we edit UV's for this mesh? + */ bool EDBM_uv_check(struct BMEditMesh *em); +/** + * last_sel, use em->act_face otherwise get the last selected face in the editselections + * at the moment, last_sel is mainly useful for making sure the space image doesn't flicker. + */ 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); +/** + * Return a new #UvVertMap from the edit-mesh. + */ struct UvVertMap *BM_uv_vert_map_create(struct BMesh *bm, const bool use_select, const bool use_winding); @@ -156,6 +199,7 @@ void EDBM_project_snap_verts(struct bContext *C, struct BMEditMesh *em); /* editmesh_automerge.c */ + void EDBM_automerge(struct Object *ob, bool update, const char hflag, const float dist); void EDBM_automerge_and_split(struct Object *ob, const bool split_edges, @@ -165,9 +209,12 @@ void EDBM_automerge_and_split(struct Object *ob, const float dist); /* editmesh_undo.c */ + +/** Export for ED_undo_sys. */ void ED_mesh_undosys_type(struct UndoType *ut); /* editmesh_select.c */ + void EDBM_select_mirrored(struct BMEditMesh *em, const struct Mesh *me, const int axis, @@ -175,6 +222,17 @@ void EDBM_select_mirrored(struct BMEditMesh *em, int *r_totmirr, int *r_totfail); +/** + * Nearest vertex under the cursor. + * + * \param dist_px_manhattan_p: (in/out), minimal distance to the nearest and at the end, + * actual distance. + * \param use_select_bias: + * - When true, selected vertices are given a 5 pixel bias + * to make them further than unselect verts. + * - When false, unselected vertices are given the bias. + * \param use_cycle: Cycle over elements within #FIND_NEAR_CYCLE_THRESHOLD_MIN in order of index. + */ struct BMVert *EDBM_vert_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan_p, const bool use_select_bias, @@ -195,6 +253,13 @@ struct BMEdge *EDBM_edge_find_nearest_ex(struct ViewContext *vc, uint *r_base_index); struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, float *dist_px_manhattan_p); +/** + * \param use_zbuf_single_px: Special case, when using the back-buffer selection, + * only use the pixel at `vc->mval` instead of using `dist_px_manhattan_p` to search over a larger + * region. This is needed because historically selection worked this way for a long time, however + * it's reasonable that some callers might want to expand the region too. So add an argument to do + * this, + */ struct BMFace *EDBM_face_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, @@ -230,19 +295,48 @@ bool EDBM_unified_findnearest_from_raycast(struct ViewContext *vc, bool EDBM_select_pick( struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); +/** + * When switching select mode, makes sure selection is consistent for editing + * also for paranoia checks to make sure edge or face mode works. + */ void EDBM_selectmode_set(struct BMEditMesh *em); +/** + * Expand & Contract the Selection + * (used when changing modes and Ctrl key held) + * + * Flush the selection up: + * - vert -> edge + * - vert -> face + * - edge -> face + * + * Flush the selection down: + * - face -> edge + * - face -> vert + * - edge -> vert + */ void EDBM_selectmode_convert(struct BMEditMesh *em, const short selectmode_old, const short selectmode_new); -/* user access this */ +/** + * User access this. + */ bool EDBM_selectmode_set_multi(struct bContext *C, const short selectmode); +/** + * User facing function, does notification. + */ bool EDBM_selectmode_toggle_multi(struct bContext *C, const short selectmode_new, const int action, const bool use_extend, const bool use_expand); +/** + * Use to disable a select-mode if its enabled, Using another mode as a fallback + * if the disabled mode is the only mode set. + * + * \return true if the mode is changed. + */ bool EDBM_selectmode_disable(struct Scene *scene, struct BMEditMesh *em, const short selectmode_disable, @@ -305,12 +399,22 @@ void EDBM_preselect_elem_update_preview(struct EditMesh_PreSelElem *psel, void EDBM_preselect_action_set(struct EditMesh_PreSelElem *psel, eEditMesh_PreSelPreviewAction action); eEditMesh_PreSelPreviewAction EDBM_preselect_action_get(struct EditMesh_PreSelElem *psel); + /* mesh_ops.c */ + void ED_operatortypes_mesh(void); void ED_operatormacros_mesh(void); +/** + * Note mesh keymap also for other space? + */ void ED_keymap_mesh(struct wmKeyConfig *keyconf); /* editface.c */ + +/** + * Copy the face flags, most importantly selection from the mesh to the final derived mesh, + * use in object mode when selecting faces (while painting). + */ void paintface_flush_flags(struct bContext *C, struct Object *ob, short flag); bool paintface_mouse_select(struct bContext *C, struct Object *ob, @@ -331,8 +435,17 @@ 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); void paintface_reveal(struct bContext *C, struct Object *ob, const bool select); +/** + * \note if the caller passes false to flush_flags, + * then they will need to run #paintvert_flush_flags(ob) themselves. + */ bool paintvert_deselect_all_visible(struct Object *ob, int action, bool flush_flags); void paintvert_select_ungrouped(struct Object *ob, bool extend, bool flush_flags); +/** + * (similar to void `paintface_flush_flags(Object *ob)`) + * copy the vertex flags, most importantly selection from the mesh to the final derived mesh, + * use in object mode when selecting vertices (while painting). + */ void paintvert_flush_flags(struct Object *ob); void paintvert_tag_select_update(struct bContext *C, struct Object *ob); @@ -360,17 +473,35 @@ void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store); bool ED_vgroup_sync_from_pose(struct Object *ob); void ED_vgroup_select_by_name(struct Object *ob, const char *name); +/** + * Removes out of range #MDeformWeights + */ void ED_vgroup_data_clamp_range(struct ID *id, const int total); +/** + * Matching index only. + */ 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); +/** + * For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true. + * This finds the unselected mirror deform verts and copies the weights to them from the selected. + * + * \note \a dvert_array has mirrored weights filled in, + * in case cleanup operations are needed on both. + */ 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); +/** + * Fill in the pointers for mirror verts (as if all mirror verts were selected too). + * + * similar to #ED_vgroup_parray_mirror_sync but only fill in mirror points. + */ void ED_vgroup_parray_mirror_assign(struct Object *ob, struct MDeformVert **dvert_array, const int dvert_tot); @@ -397,13 +528,23 @@ void ED_vgroup_mirror(struct Object *ob, int *r_totmirr, int *r_totfail); +/** + * Called while not in editmode. + */ void ED_vgroup_vert_add( struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode); +/** + * Mesh object mode, lattice can be in edit-mode. + */ 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); +/** + * Use when adjusting the active vertex weight and apply to mirror vertices. + */ void ED_vgroup_vert_active_mirror(struct Object *ob, int def_nr); /* mesh_data.c */ + void ED_mesh_verts_add(struct Mesh *mesh, struct ReportList *reports, int count); void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count); void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count); @@ -428,6 +569,9 @@ 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); +/** + * Without bContext, called in uvedit. + */ 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, @@ -452,7 +596,9 @@ bool ED_mesh_sculpt_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); -/* Returns the pinned mesh, the mesh from the pinned object, or the mesh from the active object. */ +/** + * Returns the pinned mesh, the mesh from the pinned object, or the mesh from the active object. + */ struct Mesh *ED_mesh_context(struct bContext *C); /* mesh backup */ @@ -460,20 +606,30 @@ typedef struct BMBackup { struct BMesh *bmcopy; } BMBackup; +/** + * Save a copy of the #BMesh for restoring later. + */ struct BMBackup EDBM_redo_state_store(struct BMEditMesh *em); -/* restore a bmesh from backup */ +/** + * Restore a BMesh from backup. + */ void EDBM_redo_state_restore(struct BMBackup *backup, struct BMEditMesh *em, bool recalc_looptri) ATTR_NONNULL(1, 2); +/** + * Delete the backup, flushing it to an edit-mesh. + */ void EDBM_redo_state_restore_and_free(struct BMBackup *backup, struct BMEditMesh *em, bool recalc_looptri) ATTR_NONNULL(1, 2); void EDBM_redo_state_free(struct BMBackup *backup) ATTR_NONNULL(1); /* *** meshtools.c *** */ + int ED_mesh_join_objects_exec(struct bContext *C, struct wmOperator *op); int ED_mesh_shapes_join_objects_exec(struct bContext *C, struct wmOperator *op); /* mirror lookup api */ + /* Spatial Mirror */ void ED_mesh_mirror_spatial_table_begin(struct Object *ob, struct BMEditMesh *em, @@ -485,11 +641,19 @@ int ED_mesh_mirror_spatial_table_lookup(struct Object *ob, const float co[3]); /* Topology Mirror */ + +/** + * Mode is 's' start, or 'e' end, or 'u' use if end, ob can be NULL. + * \note This is supposed return -1 on error, + * which callers are currently checking for, but is not used so far. + */ void ED_mesh_mirror_topo_table_begin(struct Object *ob, struct Mesh *me_eval); void ED_mesh_mirror_topo_table_end(struct Object *ob); -/* Retrieves mirrored cache vert, or NULL if there isn't one. - * NOTE: calling this without ensuring the mirror cache state is bad. */ +/** + * 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, @@ -500,8 +664,16 @@ struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, const float co[3], int index, const bool use_topology); +/** + * This is a Mesh-based copy of #mesh_get_x_mirror_faces(). + */ int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em, struct Mesh *me_eval); +/** + * Wrapper for object-mode/edit-mode. + * + * call #BM_mesh_elem_table_ensure first for editmesh. + */ int ED_mesh_mirror_get_vert(struct Object *ob, int index); bool ED_mesh_pick_vert(struct bContext *C, @@ -510,8 +682,18 @@ bool ED_mesh_pick_vert(struct bContext *C, uint dist_px, bool use_zbuf, uint *r_index); +/** + * Face selection in object mode, + * currently only weight-paint and vertex-paint use this. + * + * \return boolean true == Found + */ bool ED_mesh_pick_face( struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, uint *r_index); +/** + * Use when the back buffer stores face index values. but we want a vert. + * This gets the face then finds the closest vertex to mval. + */ bool ED_mesh_pick_face_vert( struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, uint *r_index); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index e68617f7867..5bac452c7c9 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -77,6 +77,7 @@ struct bNodeTree *ED_node_tree_get(struct SpaceNode *snode, int level); void ED_node_set_active_viewer_key(struct SpaceNode *snode); /* drawnode.c */ + void ED_node_init_butfuncs(void); void ED_init_custom_node_type(struct bNodeType *ntype); void ED_init_custom_node_socket_type(struct bNodeSocketType *stype); @@ -87,6 +88,12 @@ void ED_node_draw_snap( struct View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned int pos); /* node_draw.cc */ + +/** + * Draw a single node socket at default size. + * \note this is only called from external code, internally #node_socket_draw_nested() is used for + * optimized drawing of multiple/all sockets of a node. + */ void ED_node_socket_draw(struct bNodeSocket *sock, const struct rcti *rect, const float color[4], @@ -94,22 +101,46 @@ void ED_node_socket_draw(struct bNodeSocket *sock, void ED_node_tree_update(const struct bContext *C); void ED_node_tag_update_id(struct ID *id); void ED_node_tag_update_nodetree(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); +/** + * Sort nodes by selection: unselected nodes first, then selected, + * then the active node at the very end. Relative order is kept intact. + */ void ED_node_sort(struct bNodeTree *ntree); float ED_node_grid_size(void); /* node_relationships.c */ + +/** + * Test == 0, clear all intersect flags. + */ void ED_node_link_intersect_test(struct ScrArea *area, int test); +/** + * Assumes link with #NODE_LINKFLAG_HILITE set. + */ void ED_node_link_insert(struct Main *bmain, struct ScrArea *area); /* node_edit.c */ + void ED_node_set_tree_type(struct SpaceNode *snode, struct bNodeTreeType *typeinfo); bool ED_node_is_compositor(struct SpaceNode *snode); bool ED_node_is_shader(struct SpaceNode *snode); bool ED_node_is_texture(struct SpaceNode *snode); bool ED_node_is_geometry(struct SpaceNode *snode); +/** + * Assumes nothing being done in ntree yet, sets the default in/out node. + * Called from shading buttons or header. + */ void ED_node_shader_default(const struct bContext *C, struct ID *id); +/** + * Assumes nothing being done in ntree yet, sets the default in/out node. + * Called from shading buttons or header. + */ void ED_node_composit_default(const struct bContext *C, struct Scene *scene); +/** + * Assumes nothing being done in ntree yet, sets the default in/out node. + * Called from shading buttons or header. + */ void ED_node_texture_default(const struct bContext *C, struct Tex *tex); bool ED_node_select_check(const ListBase *lb); void ED_node_select_all(ListBase *lb, int action); @@ -120,19 +151,34 @@ void ED_node_set_active(struct Main *bmain, struct bNode *node, bool *r_active_texture_changed); +/** + * \param scene_owner: is the owner of the job, + * we don't use it for anything else currently so could also be a void pointer, + * but for now keep it an 'Scene' for consistency. + * + * \note only call from spaces `refresh` callbacks, not direct! - use with care. + */ 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 */ +/** + * Returns mouse position in image space. + */ bool ED_space_node_get_position(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, const int mval[2], float fpos[2]); +/** + * Returns color in linear space, matching #ED_space_image_color_sample(). + * And here we've got recursion in the comments tips... + */ bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *region, diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h index d5685788ce1..84fa4488374 100644 --- a/source/blender/editors/include/ED_numinput.h +++ b/source/blender/editors/include/ED_numinput.h @@ -94,8 +94,14 @@ struct UnitSettings; */ void initNumInput(NumInput *n); +/** + * \param str: Must be NUM_STR_REP_LEN * (idx_max + 1) length. + */ void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings); bool hasNumInput(const NumInput *n); +/** + * \warning \a vec must be set beforehand otherwise we risk uninitialized vars. + */ bool applyNumInput(NumInput *n, float *vec); bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 2a557f1abd3..576c6f51362 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -56,12 +56,24 @@ struct wmOperator; struct wmOperatorType; /* object_edit.c */ -/* context.object */ + +/** `context.object` */ struct Object *ED_object_context(const struct bContext *C); -/* context.object or context.active_object */ +/** + * Find the correct active object per context (`context.object` or `context.active_object`) + * \note context can be NULL when called from a enum with #PROP_ENUM_NO_CONTEXT. + */ struct Object *ED_object_active_context(const struct bContext *C); void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout); +/** + * Return an array of objects: + * - When in the property space, return the pinned or active object. + * - When in edit-mode/pose-mode, return an array of objects in the mode. + * - Otherwise return selected objects, + * the callers \a filter_fn needs to check of they are editable + * (assuming they need to be modified). + */ Object **ED_object_array_in_mode_or_selected(struct bContext *C, bool (*filter_fn)(const struct Object *ob, void *user_data), @@ -81,6 +93,10 @@ bool ED_object_calc_active_center(struct Object *ob, const bool select_only, flo struct XFormObjectData_Container; struct XFormObjectData_Container *ED_object_data_xform_container_create(void); void ED_object_data_xform_container_destroy(struct XFormObjectData_Container *xds); +/** + * This may be called multiple times with the same data. + * Each time, the original transformations are re-applied, instead of accumulating the changes. + */ void ED_object_data_xform_container_update_all(struct XFormObjectData_Container *xds, struct Main *bmain, struct Depsgraph *depsgraph); @@ -130,6 +146,7 @@ void ED_operatormacros_object(void); void ED_keymap_object(struct wmKeyConfig *keyconf); /* object_relations.c */ + typedef enum eParentType { PAR_OBJECT, PAR_ARMATURE, @@ -163,7 +180,9 @@ extern struct EnumPropertyItem prop_clear_parent_types[]; extern struct EnumPropertyItem prop_make_parent_types[]; #endif -/* Set the object's parent, return true if successful. */ +/** + * Set the object's parent, return true if successful. + */ bool ED_object_parent_set(struct ReportList *reports, const struct bContext *C, struct Scene *scene, @@ -175,13 +194,35 @@ bool ED_object_parent_set(struct ReportList *reports, const int vert_par[3]); void ED_object_parent_clear(struct Object *ob, const int type); +/** + * Simple API for object selection, rather than just using the flag + * this takes into account the 'restrict selection in 3d view' flag. + * deselect works always, the restriction just prevents selection + * + * \note Caller must send a `NC_SCENE | ND_OB_SELECT` notifier + * (or a `NC_SCENE | ND_OB_VISIBLE` in case of visibility toggling). + */ void ED_object_base_select(struct Base *base, eObjectSelect_Mode mode); +/** + * Change active base, it includes the notifier + */ void ED_object_base_activate(struct bContext *C, struct Base *base); void ED_object_base_activate_with_mode_exit_if_needed(struct bContext *C, struct Base *base); +/** + * Call when the active base has changed. + */ void ED_object_base_active_refresh(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer); +/** + * Remove base from a specific scene. + * \note now unlinks constraints as well. + */ void ED_object_base_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Object *ob); +/** + * Remove base from a specific scene. + * `ob` must not be indirectly used. + */ void ED_object_base_free_and_unlink_no_indirect_check(struct Main *bmain, struct Scene *scene, struct Object *ob); @@ -191,7 +232,13 @@ bool ED_object_base_deselect_all_ex(struct ViewLayer *view_layer, 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 */ +/** + * Single object duplicate, if `dupflag == 0`, fully linked, else it uses the flags given. + * Leaves selection of base/object unaltered. + * \note don't call this within a loop since clear_* funcs loop over the entire database. + * \note caller must do `DAG_relations_tag_update(bmain);` + * this is not done automatic since we may duplicate many objects in a batch. + */ struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, @@ -211,12 +258,21 @@ enum { EM_FREEDATA = (1 << 0), EM_NO_CONTEXT = (1 << 1), }; +/** + * \param flag: + * - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly. + */ 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); +/** + * Support freeing edit-mode data without flushing it back to the object. + * + * \return true if data was freed. + */ bool ED_object_editmode_free_ex(struct Main *bmain, struct Object *obedit); bool ED_object_editmode_exit_multi_ex(struct Main *bmain, @@ -284,6 +340,10 @@ void ED_object_rotation_from_view(struct bContext *C, float rot[3], const char a void ED_object_base_init_transform_on_add(struct Object *object, const float loc[3], const float rot[3]); +/** + * Uses context to figure out transform for primitive. + * Returns standard diameter. + */ float ED_object_new_primitive_matrix(struct bContext *C, struct Object *obedit, const float loc[3], @@ -291,8 +351,9 @@ float ED_object_new_primitive_matrix(struct bContext *C, const float scale[3], float primmat[4][4]); -/* Avoid allowing too much insane values even by typing - * (typos can hang/crash Blender otherwise). */ +/** + * Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise). + */ #define OBJECT_ADD_SIZE_MAXF 1.0e12f void ED_object_add_unit_props_size(struct wmOperatorType *ot); @@ -310,6 +371,12 @@ bool ED_object_add_generic_get_opts(struct bContext *C, unsigned short *r_local_view_bits, bool *r_is_view_aligned); +/** + * For object add primitive operators, or for object creation when `obdata != NULL`. + * \param obdata: Assigned to #Object.data, with increased user count. + * + * \note Do not call undo push in this function (users of this function have to). + */ struct Object *ED_object_add_type_with_obdata(struct bContext *C, const int type, const char *name, @@ -327,9 +394,16 @@ struct Object *ED_object_add_type(struct bContext *C, const unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL; +/** + * Not an especially efficient function, only added so the single user button can be functional. + */ void ED_object_single_user(struct Main *bmain, struct Scene *scene, struct Object *ob); /* object motion paths */ + +/** + * Clear motion paths for all objects. + */ void ED_objects_clear_paths(struct bContext *C, bool only_selected); /* Corresponds to eAnimvizCalcRange. */ @@ -339,6 +413,12 @@ typedef enum eObjectPathCalcRange { OBJECT_PATH_CALC_RANGE_FULL, } eObjectPathCalcRange; +/** + * For the objects with animation: update paths for those that have got them + * This should selectively update paths that exist. + * + * To be called from various tools that do incremental updates + */ void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene, eObjectPathCalcRange range, @@ -353,11 +433,26 @@ void ED_objects_recalculate_paths_visible(struct bContext *C, eObjectPathCalcRange range); /* constraints */ +/** + * If object is in pose-mode, return active bone constraints, else object constraints. + * No constraints are returned for a bone on an inactive bone-layer. + */ struct ListBase *ED_object_constraint_active_list(struct Object *ob); +/** + * Get the constraints for the active pose bone. Bone may be on an inactive bone-layer + * (unlike #ED_object_constraint_active_list, such constraints are not excluded here). + */ struct ListBase *ED_object_pose_constraint_list(const struct bContext *C); +/** + * Find the list that a given constraint belongs to, + * and/or also get the posechannel this is from (if applicable). + */ struct ListBase *ED_object_constraint_list_from_constraint(struct Object *ob, struct bConstraint *con, struct bPoseChannel **r_pchan); +/** + * Single constraint. + */ struct bConstraint *ED_object_constraint_active_get(struct Object *ob); void object_test_constraints(struct Main *bmain, struct Object *ob); @@ -389,7 +484,17 @@ void ED_object_constraint_copy_for_pose(struct Main *bmain, struct bConstraint *con); /* object_modes.c */ + +/** + * Checks the mode to be set is compatible with the object + * should be made into a generic function + */ bool ED_object_mode_compat_test(const struct Object *ob, eObjectMode mode); +/** + * Sets the mode to a compatible state (use before entering the mode). + * + * This is so each mode's exec function can call + */ bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, eObjectMode mode, @@ -412,11 +517,18 @@ void ED_object_posemode_set_for_weight_paint(struct bContext *C, const bool is_mode_set); /* object_modifier.c */ + enum { MODIFIER_APPLY_DATA = 1, MODIFIER_APPLY_SHAPE, }; +/** + * Add a modifier to given object, including relevant extra processing needed by some physics types + * (particles, simulations...). + * + * \param scene: is only used to set current frame in some cases, and may be NULL. + */ struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, @@ -465,12 +577,25 @@ void ED_object_modifier_copy_to_object(struct bContext *C, struct Object *ob_src, struct ModifierData *md); +/** + * If the object data of 'orig_ob' has other users, run 'callback' on + * each of them. + * + * If include_orig is true, the callback will run on 'orig_ob' too. + * + * If the callback ever returns true, iteration will stop and the + * function value will be true. Otherwise the function returns false. + */ 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); +/** + * Use with #ED_object_iter_other(). Sets the total number of levels + * for any multi-res modifiers on the object to the int pointed to by callback_data. + */ bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v); /* object_greasepencil_modifier.c */ @@ -546,16 +671,40 @@ void ED_object_check_force_modifiers(struct Main *bmain, struct Scene *scene, struct Object *object); +/** + * If id is not already an Object, try to find an object that uses it as data. + * Prefers active, then selected, then visible/selectable. + */ struct Base *ED_object_find_first_by_data_id(struct ViewLayer *view_layer, struct ID *id); +/** + * Select and make the target object active in the view layer. + * If already selected, selection isn't changed. + * + * \returns false if not found in current view layer + */ bool ED_object_jump_to_object(struct bContext *C, struct Object *ob, const bool reveal_hidden); +/** + * Select and make the target object and bone active. + * Switches to Pose mode if in Object mode so the selection is visible. + * Un-hides the target bone and bone layer if necessary. + * + * \returns false if object not in layer, bone not found, or other error + */ bool ED_object_jump_to_bone(struct bContext *C, struct Object *ob, const char *bone_name, const bool reveal_hidden); /* object_facemap_ops.c */ + +/** + * Called while not in edit-mode. + */ void ED_object_facemap_face_add(struct Object *ob, struct bFaceMap *fmap, int facenum); +/** + * Called while not in edit-mode. + */ void ED_object_facemap_face_remove(struct Object *ob, struct bFaceMap *fmap, int facenum); /* object_data_transform.c */ diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h index 1d1471f0be6..99f65010595 100644 --- a/source/blender/editors/include/ED_outliner.h +++ b/source/blender/editors/include/ED_outliner.h @@ -33,10 +33,21 @@ struct bContext; bool ED_outliner_collections_editor_poll(struct bContext *C); +/** + * Populates the \param objects: ListBase with all the outliner selected objects + * We store it as (Object *)LinkData->data + * \param objects: expected to be empty + */ void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects); +/** + * Get base of object under cursor. Used for eyedropper tool. + */ struct Base *ED_outliner_give_base_under_cursor(struct bContext *C, const int mval[2]); +/** + * Functions for tagging outliner selection syncing is dirty from operators. + */ void ED_outliner_select_sync_from_object_tag(struct bContext *C); void ED_outliner_select_sync_from_edit_bone_tag(struct bContext *C); void ED_outliner_select_sync_from_pose_bone_tag(struct bContext *C); @@ -45,9 +56,15 @@ void ED_outliner_select_sync_from_all_tag(struct bContext *C); bool ED_outliner_select_sync_is_dirty(const struct bContext *C); +/** + * Set clean outliner and mark other outliners for syncing. + */ void ED_outliner_select_sync_from_outliner(struct bContext *C, struct SpaceOutliner *space_outliner); +/** + * Copy sync select dirty flag from window manager to all outliners to be synced lazily on draw. + */ void ED_outliner_select_sync_flag_outliners(const struct bContext *C); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h index 6a28baa4ca1..1d1ba264de5 100644 --- a/source/blender/editors/include/ED_paint.h +++ b/source/blender/editors/include/ED_paint.h @@ -54,11 +54,21 @@ void ED_imapaint_bucket_fill(struct bContext *C, const int mouse[2]); /* paint_image_proj.c */ + void ED_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil); +/** + * Make sure that active object has a material, + * and assign UVs and image layers if they do not exist. + */ bool ED_paint_proj_mesh_data_check( struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil); /* image_undo.c */ + +/** + * The caller is responsible for running #ED_image_undo_push_end, + * failure to do so causes an invalid state for the undo system. + */ void ED_image_undo_push_begin(const char *name, int paint_mode); void ED_image_undo_push_begin_with_image(const char *name, struct Image *image, @@ -66,8 +76,12 @@ void ED_image_undo_push_begin_with_image(const char *name, struct ImageUser *iuser); void ED_image_undo_push_end(void); +/** + * Restore painting image to previous state. Used for anchored and drag-dot style brushes. + */ void ED_image_undo_restore(struct UndoStep *us); +/** Export for ED_undo_sys. */ void ED_image_undosys_type(struct UndoType *ut); void *ED_image_paint_tile_find(struct ListBase *paint_tiles, @@ -100,9 +114,11 @@ struct ListBase *ED_image_paint_tile_list_get(void); (((size) + ED_IMAGE_UNDO_TILE_SIZE - 1) >> ED_IMAGE_UNDO_TILE_BITS) /* paint_curve_undo.c */ + void ED_paintcurve_undo_push_begin(const char *name); void ED_paintcurve_undo_push_end(struct bContext *C); +/** Export for ED_undo_sys. */ void ED_paintcurve_undosys_type(struct UndoType *ut); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 5318c653b6d..ce25943b40a 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -39,10 +39,12 @@ struct rcti; struct wmGenericUserData; /* particle edit mode */ + void PE_free_ptcache_edit(struct PTCacheEdit *edit); int PE_start_edit(struct PTCacheEdit *edit); /* access */ + struct PTCacheEdit *PE_get_current_from_psys(struct ParticleSystem *psys); struct PTCacheEdit *PE_get_current(struct Depsgraph *depsgraph, struct Scene *scene, @@ -59,6 +61,7 @@ int PE_minmax(struct Depsgraph *depsgraph, 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, @@ -66,6 +69,7 @@ void PE_update_object(struct Depsgraph *depsgraph, int useflag); /* selection tools */ + 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); @@ -82,6 +86,8 @@ bool PE_deselect_all_visible_ex(struct PTCacheEdit *edit); bool PE_deselect_all_visible(struct bContext *C); /* particle_edit_undo.c */ + +/** Export for ED_undo_sys. */ void ED_particle_undosys_type(struct UndoType *ut); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index 0e03000efba..50d7bfc3960 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -56,7 +56,14 @@ void ED_render_view_layer_changed(struct Main *bmain, struct bScreen *screen); /* Callbacks handling data update events coming from depsgraph. */ void ED_render_id_flush_update(const struct DEGEditorUpdateContext *update_ctx, struct ID *id); +/** + * Update all 3D viewport render and draw engines on changes to the scene. + * This is called by the dependency graph when it detects changes. + */ void ED_render_scene_update(const struct DEGEditorUpdateContext *update_ctx, const bool updated); +/** + * Update 3D viewport render or draw engine on changes to the scene or view settings. + */ void ED_render_view3d_update(struct Depsgraph *depsgraph, struct wmWindow *window, struct ScrArea *area, @@ -83,6 +90,9 @@ typedef enum ePreviewRenderMethod { void ED_preview_ensure_dbase(void); void ED_preview_free_dbase(void); +/** + * Check if \a id is supported by the automatic preview render. + */ bool ED_preview_id_is_supported(const struct ID *id); void ED_preview_shader_job(const struct bContext *C, diff --git a/source/blender/editors/include/ED_scene.h b/source/blender/editors/include/ED_scene.h index e3abd26a4cd..e4e7a4bdfce 100644 --- a/source/blender/editors/include/ED_scene.h +++ b/source/blender/editors/include/ED_scene.h @@ -32,7 +32,14 @@ struct Scene *ED_scene_add(struct Main *bmain, struct bContext *C, struct wmWindow *win, enum eSceneCopyMethod method) ATTR_NONNULL(); +/** + * \note Only call outside of area/region loops. + * \return true if successful. + */ bool ED_scene_delete(struct bContext *C, struct Main *bmain, struct Scene *scene) ATTR_NONNULL(); +/** + * Depsgraph updates after scene becomes active in a window. + */ 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, diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index eee119c0712..5db49357540 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -65,33 +65,65 @@ struct wmWindow; struct wmWindowManager; /* regions */ +/** Only exported for WM. */ void ED_region_do_listen(struct wmRegionListenerParams *params); +/** Only exported for WM. */ void ED_region_do_layout(struct bContext *C, struct ARegion *region); +/** Only exported for WM. */ void ED_region_do_draw(struct bContext *C, struct ARegion *region); void ED_region_exit(struct bContext *C, struct ARegion *region); +/** + * Utility to exit and free an area-region. Screen level regions (menus/popups) need to be treated + * slightly differently, see #ui_region_temp_remove(). + */ void ED_region_remove(struct bContext *C, struct ScrArea *area, struct ARegion *region); void ED_region_pixelspace(const struct ARegion *region); +/** + * Call to move a popup window (keep OpenGL context free!) + */ void ED_region_update_rect(struct ARegion *region); +/** + * Externally called for floating regions like menus. + */ void ED_region_floating_init(struct ARegion *region); void ED_region_tag_redraw(struct ARegion *region); void ED_region_tag_redraw_partial(struct ARegion *region, const struct rcti *rct, bool rebuild); void ED_region_tag_redraw_cursor(struct ARegion *region); void ED_region_tag_redraw_no_rebuild(struct ARegion *region); void ED_region_tag_refresh_ui(struct ARegion *region); +/** + * Tag editor overlays to be redrawn. If in doubt about which parts need to be redrawn (partial + * clipping rectangle set), redraw everything. + */ void ED_region_tag_redraw_editor_overlays(struct ARegion *region); +/** + * Set the temporary update flag for property search. + */ void ED_region_search_filter_update(const struct ScrArea *area, struct ARegion *region); +/** + * Returns the search string if the space type and region type support property search. + */ const char *ED_area_region_search_filter_get(const struct ScrArea *area, const struct ARegion *region); void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *region); void ED_region_panels_ex(const struct bContext *C, struct ARegion *region, const char *contexts[]); void ED_region_panels(const struct bContext *C, struct ARegion *region); +/** + * \param contexts: A NULL terminated array of context strings to match against. + * Matching against any of these strings will draw the panel. + * Can be NULL to skip context checks. + */ void ED_region_panels_layout_ex(const struct bContext *C, struct ARegion *region, struct ListBase *paneltypes, const char *contexts[], const char *category_override); +/** + * Build the same panel list as #ED_region_panels_layout_ex and checks whether any + * of the panels contain a search result based on the area / region's search filter. + */ bool ED_region_property_search(const struct bContext *C, struct ARegion *region, struct ListBase *paneltypes, @@ -107,11 +139,20 @@ void ED_region_header_layout(const struct bContext *C, struct ARegion *region); void ED_region_header_draw(const struct bContext *C, struct ARegion *region); void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *area, struct ARegion *region); +/** + * Exported to all editors, uses fading default. + */ void ED_region_toggle_hidden(struct bContext *C, struct ARegion *region); +/** + * For use after changing visibility of regions. + */ void ED_region_visibility_change_update(struct bContext *C, struct ScrArea *area, struct ARegion *region); /* screen_ops.c */ +/** + * \note Assumes that \a region itself is not a split version from previous region. + */ void ED_region_visibility_change_update_animated(struct bContext *C, struct ScrArea *area, struct ARegion *region); @@ -129,6 +170,9 @@ void ED_region_grid_draw(struct ARegion *region, float zoomx, float zoomy, float float ED_region_blend_alpha(struct ARegion *region); void ED_region_visible_rect_calc(struct ARegion *region, struct rcti *rect); const rcti *ED_region_visible_rect(ARegion *region); +/** + * Overlapping regions only in the following restricted cases. + */ bool ED_region_is_overlap(int spacetype, int regiontype); int ED_region_snap_size_test(const struct ARegion *region); @@ -142,39 +186,76 @@ void ED_area_do_msg_notify_tag_refresh(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); +/** + * Follow #ARegionType.message_subscribe. + */ void ED_area_do_mgs_subscribe_for_tool_header(const struct wmRegionMessageSubscribeParams *params); void ED_area_do_mgs_subscribe_for_tool_ui(const struct wmRegionMessageSubscribeParams *params); /* message bus */ + +/** + * Generate subscriptions for this region. + */ void ED_region_message_subscribe(struct wmRegionMessageSubscribeParams *params); /* spaces */ + +/** + * \note Keymap definitions are registered only once per WM initialize, + * usually on file read, using the keymap the actual areas/regions add the handlers. + * \note Called in wm.c. */ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); +/** + * Returns offset for next button in header. + */ int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); /* areas */ +/** + * Called in screen_refresh, or screens_init, also area size changes. + */ void ED_area_init(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area); void ED_area_exit(struct bContext *C, struct ScrArea *area); 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); +/** Only exported for WM. */ void ED_area_do_listen(struct wmSpaceTypeListenerParams *params); void ED_area_tag_redraw(ScrArea *area); void ED_area_tag_redraw_no_rebuild(ScrArea *area); void ED_area_tag_redraw_regiontype(ScrArea *area, int type); void ED_area_tag_refresh(ScrArea *area); +/** + * Only exported for WM. + */ void ED_area_do_refresh(struct bContext *C, ScrArea *area); struct AZone *ED_area_azones_update(ScrArea *area, const int mouse_xy[2]); +/** + * Use NULL to disable it. + */ void ED_area_status_text(ScrArea *area, const char *str); +/** + * \param skip_region_exit: Skip calling area exit callback. Set for opening temp spaces. + */ void ED_area_newspace(struct bContext *C, ScrArea *area, int type, const bool skip_region_exit); void ED_area_prevspace(struct bContext *C, ScrArea *area); void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2); int ED_area_headersize(void); int ED_area_footersize(void); +/** + * \return the final height of a global \a area, accounting for DPI. + */ 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); +/** + * For now we just assume all global areas are made up out of horizontal bars + * with the same size. A fixed size could be stored in ARegion instead if needed. + * + * \return the DPI aware height of a single bar/region in global areas. + */ int ED_region_global_size_y(void); void ED_area_update_region_sizes(struct wmWindowManager *wm, struct wmWindow *win, @@ -204,31 +285,90 @@ ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area); vert_name->next) /* screens */ + +/** + * File read, set all screens, .... + */ void ED_screens_init(struct Main *bmain, struct wmWindowManager *wm); +/** + * Only for edge lines between areas. + */ void ED_screen_draw_edges(struct wmWindow *win); + +/** + * Make this screen usable. + * for file read and first use, for scaling window, area moves. + */ 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); +/** + * \brief Change the active screen. + * + * Operator call, WM + Window + screen already existed before + * + * \warning Do NOT call in area/region queues! + * \returns if screen changing was successful. + */ bool ED_screen_change(struct bContext *C, struct bScreen *screen); void ED_screen_scene_change(struct bContext *C, struct wmWindow *win, struct Scene *scene, const bool refresh_toolsystem); +/** + * Called in wm_event_system.c. sets state vars in screen, cursors. + * event type is mouse move. + */ 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); +/** + * redraws: uses defines from `stime->redraws` + * \param enable: 1 - forward on, -1 - backwards on, 0 - off. + */ void ED_screen_animation_timer(struct bContext *C, int redraws, int sync, int enable); void ED_screen_animation_timer_update(struct bScreen *screen, int redraws); void ED_screen_restore_temp_type(struct bContext *C, ScrArea *area); ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *area, int type); +/** + * \a was_prev_temp for the case previous space was a temporary full-screen as well + */ void ED_screen_full_prevspace(struct bContext *C, ScrArea *area); +/** + * Restore a screen / area back to default operation, after temp full-screen modes. + */ void ED_screen_full_restore(struct bContext *C, ScrArea *area); +/** + * Create a new temporary screen with a maximized, empty area. + * This can be closed with #ED_screen_state_toggle(). + * + * Use this to just create a new maximized screen/area, rather than maximizing an existing one. + * Otherwise, maximize with #ED_screen_state_toggle(). + */ bScreen *ED_screen_state_maximized_create(struct bContext *C); +/** + * This function toggles: if area is maximized/full then the parent will be restored. + * + * Use #ED_screen_state_maximized_create() if you do not want the toggle behavior when changing to + * a maximized area. I.e. if you just want to open a new maximized screen/area, not maximize a + * specific area. In the former case, space data of the maximized and non-maximized area should be + * independent, in the latter it should be the same. + * + * \warning \a area may be freed. + */ struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *area, const short state); +/** + * Wrapper to open a temporary space either as fullscreen space, or as separate window, as defined + * by \a display_type. + * + * \param title: Title to set for the window, if a window is spawned. + * \param x, y: Position of the window, if a window is spawned. + * \param sizex, sizey: Dimensions of the window, if a window is spawned. + */ ScrArea *ED_screen_temp_space_open(struct bContext *C, const char *title, int x, @@ -243,6 +383,9 @@ void ED_screens_footer_tools_menu_create(struct bContext *C, struct uiLayout *la void ED_screens_navigation_bar_tools_menu_create(struct bContext *C, struct uiLayout *layout, void *arg); +/** + * \return true if any active area requires to see in 3D. + */ 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, @@ -253,31 +396,64 @@ ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, const bool only_visible); struct wmWindow *ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm); +/** + * Render the preview for a screen layout in \a screen. + */ 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(); +/** + * \brief Change the active workspace. + * + * Operator call, WM + Window + screen already existed before + * Pretty similar to #ED_screen_change since changing workspace also changes screen. + * + * \warning Do NOT call in area/region queues! + * \returns if workspace changing was successful. + */ bool ED_workspace_change(struct WorkSpace *workspace_new, struct bContext *C, struct wmWindowManager *wm, struct wmWindow *win) ATTR_NONNULL(); +/** + * Duplicate a workspace including its layouts. Does not activate the workspace, but + * it stores the screen-layout to be activated (BKE_workspace_temp_layout_store) + */ struct WorkSpace *ED_workspace_duplicate(struct WorkSpace *workspace_old, struct Main *bmain, struct wmWindow *win); +/** + * \return if succeeded. + */ bool ED_workspace_delete(struct WorkSpace *workspace, struct Main *bmain, struct bContext *C, struct wmWindowManager *wm) ATTR_NONNULL(); +/** + * Some editor data may need to be synced with scene data (3D View camera and layers). + * This function ensures data is synced for editors in active layout of \a workspace. + */ void ED_workspace_scene_data_sync(struct WorkSpaceInstanceHook *hook, Scene *scene) ATTR_NONNULL(); +/** + * Make sure there is a non-fullscreen layout to switch to that is not used yet by an other window. + * Needed for workspace or screen switching to ensure valid screens. + * + * \param layout_fallback_base: As last resort, this layout is duplicated and returned. + */ struct WorkSpaceLayout *ED_workspace_screen_change_ensure_unused_layout( struct Main *bmain, struct WorkSpace *workspace, struct WorkSpaceLayout *layout_new, const struct WorkSpaceLayout *layout_fallback_base, struct wmWindow *win) ATTR_NONNULL(); +/** + * Empty screen, with 1 dummy area without space-data. Uses window size. + */ struct WorkSpaceLayout *ED_workspace_layout_add(struct Main *bmain, struct WorkSpace *workspace, struct wmWindow *win, @@ -286,6 +462,10 @@ struct WorkSpaceLayout *ED_workspace_layout_duplicate(struct Main *bmain, struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, struct wmWindow *win) ATTR_NONNULL(); +/** + * \warning Only call outside of area/region loops! + * \return true if succeeded. + */ bool ED_workspace_layout_delete(struct WorkSpace *workspace, struct WorkSpaceLayout *layout_old, struct bContext *C) ATTR_NONNULL(); @@ -296,22 +476,42 @@ bool ED_workspace_layout_cycle(struct WorkSpace *workspace, void ED_workspace_status_text(struct bContext *C, const char *str); /* anim */ +/** + * Results in fully updated anim system. + */ void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph); +/** + * Update frame rate info for viewport drawing. + */ void ED_refresh_viewport_fps(struct bContext *C); +/** + * Toggle operator. + */ int ED_screen_animation_play(struct bContext *C, int sync, int mode); +/** + * Find window that owns the animation timer. + */ bScreen *ED_screen_animation_playing(const struct wmWindowManager *wm); bScreen *ED_screen_animation_no_scrub(const struct wmWindowManager *wm); /* screen keymaps */ +/* called in spacetypes.c */ void ED_operatortypes_screen(void); +/* called in spacetypes.c */ void ED_keymap_screen(struct wmKeyConfig *keyconf); -/* workspace keymaps */ +/** + * Workspace key-maps. + */ void ED_operatortypes_workspace(void); /* operators; context poll callbacks */ + bool ED_operator_screenactive(struct bContext *C); bool ED_operator_screenactive_nobackground(struct bContext *C); +/** + * When mouse is over area-edge. + */ bool ED_operator_screen_mainwinactive(struct bContext *C); bool ED_operator_areaactive(struct bContext *C); bool ED_operator_regionactive(struct bContext *C); @@ -319,14 +519,31 @@ bool ED_operator_regionactive(struct bContext *C); bool ED_operator_scene(struct bContext *C); bool ED_operator_scene_editable(struct bContext *C); bool ED_operator_objectmode(struct bContext *C); +/** + * Same as #ED_operator_objectmode() but additionally sets a "disabled hint". That is, a message + * to be displayed to the user explaining why the operator can't be used in current context. + */ bool ED_operator_objectmode_poll_msg(struct bContext *C); bool ED_operator_view3d_active(struct bContext *C); bool ED_operator_region_view3d_active(struct bContext *C); +/** + * Generic for any view2d which uses anim_ops. + */ bool ED_operator_animview_active(struct bContext *C); bool ED_operator_outliner_active(struct bContext *C); bool ED_operator_outliner_active_no_editobject(struct bContext *C); +/** + * \note Will return true for file spaces in either file or asset browsing mode! See + * #ED_operator_file_browsing_active() (file browsing only) and + * #ED_operator_asset_browsing_active() (asset browsing only). + */ bool ED_operator_file_active(struct bContext *C); +/** + * \note Will only return true if the file space is in file browsing mode, not asset browsing! See + * #ED_operator_file_active() (file or asset browsing) and + * #ED_operator_asset_browsing_active() (asset browsing only). + */ bool ED_operator_file_browsing_active(struct bContext *C); bool ED_operator_asset_browsing_active(struct bContext *C); bool ED_operator_spreadsheet_active(struct bContext *C); @@ -345,6 +562,9 @@ bool ED_operator_console_active(struct bContext *C); bool ED_operator_object_active(struct bContext *C); bool ED_operator_object_active_editable_ex(struct bContext *C, const Object *ob); bool ED_operator_object_active_editable(struct bContext *C); +/** + * Object must be editable and fully local (i.e. not an override). + */ bool ED_operator_object_active_local_editable_ex(struct bContext *C, const Object *ob); bool ED_operator_object_active_local_editable(struct bContext *C); bool ED_operator_object_active_editable_mesh(struct bContext *C); @@ -363,11 +583,21 @@ bool ED_operator_editsurfcurve_region_view3d(struct bContext *C); bool ED_operator_editfont(struct bContext *C); bool ED_operator_editlattice(struct bContext *C); bool ED_operator_editmball(struct bContext *C); +/** + * Wrapper for #ED_space_image_show_uvedit. + */ bool ED_operator_uvedit(struct bContext *C); bool ED_operator_uvedit_space_image(struct bContext *C); bool ED_operator_uvmap(struct bContext *C); bool ED_operator_posemode_exclusive(struct bContext *C); +/** + * Object must be editable, fully local (i.e. not an override), and exclusively in Pose mode. + */ bool ED_operator_object_active_local_editable_posemode_exclusive(struct bContext *C); +/** + * Allows for pinned pose objects to be used in the object buttons + * and the non-active pose object to be used in the 3D view. + */ bool ED_operator_posemode_context(struct bContext *C); bool ED_operator_posemode(struct bContext *C); bool ED_operator_posemode_local(struct bContext *C); @@ -418,8 +648,15 @@ void ED_region_cache_draw_cached_segments(struct ARegion *region, const int efra); /* area_utils.c */ + +/** + * Callback for #ARegionType.message_subscribe + */ void ED_region_generic_tools_region_message_subscribe( const struct wmRegionMessageSubscribeParams *params); +/** + * Callback for #ARegionType.snap_size + */ int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis); /* area_query.c */ @@ -440,15 +677,29 @@ bool ED_region_overlap_isect_xy_with_margin(const ARegion *region, bool ED_region_panel_category_gutter_calc_rect(const ARegion *region, rcti *r_region_gutter); bool ED_region_panel_category_gutter_isect_xy(const ARegion *region, const int event_xy[2]); +/** + * \note: This may return true for multiple overlapping regions. + * If it matters, check overlapped regions first (#ARegion.overlap). + */ bool ED_region_contains_xy(const struct ARegion *region, const int event_xy[2]); +/** + * Similar to #BKE_area_find_region_xy() but when \a event_xy intersects an overlapping region, + * this returns the region that is visually under the cursor. E.g. when over the + * transparent part of the region, it returns the region underneath. + * + * The overlapping region is determined using the #ED_region_contains_xy() query. + */ ARegion *ED_area_find_region_xy_visual(const ScrArea *area, int regiontype, const int event_xy[2]); /* interface_region_hud.c */ + struct ARegionType *ED_area_type_hud(int space_type); void ED_area_type_hud_clear(struct wmWindowManager *wm, ScrArea *area_keep); void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *area); -/* default keymaps, bitflags (matches order of evaluation). */ +/** + * Default key-maps, bit-flags (matches order of evaluation). + */ enum { ED_KEYMAP_UI = (1 << 1), ED_KEYMAP_GIZMO = (1 << 2), @@ -462,7 +713,7 @@ enum { ED_KEYMAP_NAVBAR = (1 << 11), }; -/* SCREEN_OT_space_context_cycle direction */ +/** #SCREEN_OT_space_context_cycle direction. */ typedef enum eScreenCycle { SPACE_CONTEXT_CYCLE_PREV, SPACE_CONTEXT_CYCLE_NEXT, diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 348ea503372..0cdd8873cb2 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -35,6 +35,7 @@ struct bContext; struct rcti; /* sculpt.c */ + void ED_operatortypes_sculpt(void); void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *region, struct Object *ob); bool ED_sculpt_mask_box_select(struct bContext *C, @@ -42,18 +43,22 @@ bool ED_sculpt_mask_box_select(struct bContext *C, const struct rcti *rect, bool select); -/* transform */ +/* sculpt_transform.c */ + void ED_sculpt_update_modal_transform(struct bContext *C, struct Object *ob); void ED_sculpt_init_transform(struct bContext *C, struct Object *ob); void ED_sculpt_end_transform(struct bContext *C, struct Object *ob); /* sculpt_undo.c */ + +/** Export for ED_undo_sys. */ void ED_sculpt_undosys_type(struct UndoType *ut); void ED_sculpt_undo_geometry_begin(struct Object *ob, const char *name); void ED_sculpt_undo_geometry_end(struct Object *ob); /* Face sets. */ + int ED_sculpt_face_sets_find_next_available_id(struct Mesh *mesh); void ED_sculpt_face_sets_initialize_none_to_id(struct Mesh *mesh, const int new_id); @@ -62,7 +67,7 @@ int ED_sculpt_face_sets_active_update_and_get(struct bContext *C, const float mval[2]); /* Undo for changes happening on a base mesh for multires sculpting. - * if there is no multires sculpt active regular undo is used. */ + * if there is no multi-res sculpt active regular undo is used. */ void ED_sculpt_undo_push_multires_mesh_begin(struct bContext *C, const char *str); void ED_sculpt_undo_push_multires_mesh_end(struct bContext *C, const char *str); diff --git a/source/blender/editors/include/ED_select_utils.h b/source/blender/editors/include/ED_select_utils.h index 049ea7a092f..4656099799b 100644 --- a/source/blender/editors/include/ED_select_utils.h +++ b/source/blender/editors/include/ED_select_utils.h @@ -60,8 +60,17 @@ enum { #define SEL_OP_USE_PRE_DESELECT(sel_op) (ELEM(sel_op, SEL_OP_SET)) #define SEL_OP_CAN_DESELECT(sel_op) (!ELEM(sel_op, SEL_OP_ADD)) -/* Use when we've de-selected all first for 'SEL_OP_SET' */ +/** + * Use when we've de-selected all first for 'SEL_OP_SET'. + * 1: select, 0: deselect, -1: pass. + */ int ED_select_op_action(const eSelectOp sel_op, const bool is_select, const bool is_inside); +/** + * Use when we've de-selected all items first (for modes that need it). + * + * \note In some cases changing selection needs to perform other checks, + * so it's more straightforward to deselect all, then select. + */ int ED_select_op_action_deselected(const eSelectOp sel_op, const bool is_select, const bool is_inside); @@ -72,6 +81,9 @@ bool ED_select_similar_compare_float_tree(const struct KDTree_1d *tree, const float thresh, const int compare); +/** + * Utility to use for selection operations that run multiple times (circle select). + */ eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index 606b4c9cad0..843b94cea00 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -40,8 +40,18 @@ bool ED_space_sequencer_maskedit_mask_poll(struct bContext *C); bool ED_space_sequencer_check_show_maskedit(struct SpaceSeq *sseq, struct Scene *scene); bool ED_space_sequencer_maskedit_poll(struct bContext *C); +/** + * Are we displaying the seq output (not channels or histogram). + */ bool ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq); + bool ED_space_sequencer_check_show_strip(struct SpaceSeq *sseq); +/** + * Check if there is animation shown during playback. + * + * - Colors of color strips are displayed on the strip itself. + * - Backdrop is drawn. + */ bool ED_space_sequencer_has_playback_animation(const struct SpaceSeq *sseq, const struct Scene *scene); diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index 958df8f7707..f4a69737da1 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -30,12 +30,18 @@ extern "C" { struct ARegionType; struct bContext; +/* Only called once on startup. storage is global in BKE kernel listbase. */ void ED_spacetypes_init(void); void ED_spacemacros_init(void); /* the pluginnable API for export to editors */ -/* calls for registering default spaces */ +/* -------------------------------------------------------------------- */ +/** \name Calls for registering default spaces + * + * Calls for registering default spaces, only called once, from #ED_spacetypes_init + * \{ */ + void ED_spacetype_outliner(void); void ED_spacetype_view3d(void); void ED_spacetype_ipo(void); @@ -57,12 +63,18 @@ void ED_spacetype_statusbar(void); void ED_spacetype_topbar(void); void ED_spacetype_spreadsheet(void); -/* calls for instancing and freeing spacetype static data - * called in WM_init_exit */ -/* in space_file.c */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Spacetype Static Data + * Calls for instancing and freeing space-type static data called in #WM_init_exit + * \{ */ + 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 diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h index 6e012ec1a91..33ca3ea03a6 100644 --- a/source/blender/editors/include/ED_text.h +++ b/source/blender/editors/include/ED_text.h @@ -36,16 +36,25 @@ struct bContext; bool ED_text_activate_in_screen(struct bContext *C, struct Text *text); +/** + * Moves the view to the cursor location, also used to make sure the view isn't outside the file. + */ void ED_text_scroll_to_cursor(struct SpaceText *st, struct ARegion *region, bool center); +/** + * Takes a cursor (row, character) and returns x,y pixel coords. + */ bool ED_text_region_location_from_cursor(struct SpaceText *st, struct ARegion *region, const int cursor_co[2], int r_pixel_co[2]); /* text_undo.c */ + +/** Export for ED_undo_sys. */ void ED_text_undosys_type(struct UndoType *ut); +/** Use operator system to finish the undo step. */ struct UndoStep *ED_text_undo_push_init(struct bContext *C); /* text_format.c */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index b132e559baa..f0d6072fdbc 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -146,6 +146,15 @@ void Transform_Properties(struct wmOperatorType *ot, int flags); /* *** transform_orientations.c *** */ void ED_transform_calc_orientation_from_type(const struct bContext *C, float r_mat[3][3]); +/** + * \note The resulting matrix may not be orthogonal, + * callers that depend on `r_mat` to be orthogonal should use #orthogonalize_m3. + * + * A non orthogonal matrix may be returned when: + * - #V3D_ORIENT_GIMBAL the result won't be orthogonal unless the object has no rotation. + * - #V3D_ORIENT_LOCAL may contain shear from non-uniform scale in parent/child relationships. + * - #V3D_ORIENT_CUSTOM may have been created from #V3D_ORIENT_LOCAL. + */ short ED_transform_calc_orientation_from_type_ex(const struct Scene *scene, struct ViewLayer *view_layer, const struct View3D *v3d, @@ -159,6 +168,9 @@ short ED_transform_calc_orientation_from_type_ex(const struct Scene *scene, /* transform gizmos */ void VIEW3D_GGT_xform_gizmo(struct wmGizmoGroupType *gzgt); +/** + * Only poll, flag & gzmap_params differ. + */ void VIEW3D_GGT_xform_gizmo_context(struct wmGizmoGroupType *gzgt); void VIEW3D_GGT_xform_cage(struct wmGizmoGroupType *gzgt); void VIEW3D_GGT_xform_shear(struct wmGizmoGroupType *gzgt); @@ -196,6 +208,11 @@ struct TransformCalcParams { /* Use 'Scene.orientation_type' when zero, otherwise subtract one and use. */ ushort orientation_index; }; +/** + * Centroid, bound-box, of selection. + * + * Returns total items selected. + */ int ED_transform_calc_gizmo_stats(const struct bContext *C, const struct TransformCalcParams *params, struct TransformBounds *tbounds); 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 c4da1588117..6f25a63188d 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -117,6 +117,13 @@ bool ED_transform_snap_object_project_ray(SnapObjectContext *sctx, float r_co[3], float r_no[3]); +/** + * Fill in a list of all hits. + * + * \param ray_depth: Only depths in this range are considered, -1.0 for maximum. + * \param sort: Optionally sort the hits by depth. + * \param r_hit_list: List of #SnapObjectHitDepth (caller must free). + */ bool ED_transform_snap_object_project_ray_all(SnapObjectContext *sctx, struct Depsgraph *depsgraph, const View3D *v3d, @@ -142,6 +149,19 @@ short ED_transform_snap_object_project_view3d_ex(struct SnapObjectContext *sctx, struct Object **r_ob, float r_obmat[4][4], float r_face_nor[3]); +/** + * Convenience function for performing snapping. + * + * Given a 2D region value, snap to vert/edge/face. + * + * \param sctx: Snap context. + * \param mval: Screenspace coordinate. + * \param prev_co: Coordinate for perpendicular point calculation (optional). + * \param dist_px: Maximum distance to snap (in pixels). + * \param r_loc: hit location. + * \param r_no: hit normal (optional). + * \return Snap success. + */ short ED_transform_snap_object_project_view3d(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, @@ -155,6 +175,9 @@ short ED_transform_snap_object_project_view3d(struct SnapObjectContext *sctx, float r_loc[3], float r_no[3]); +/** + * see: #ED_transform_snap_object_project_ray_all + */ bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h index 059277e1466..dceecc6aab5 100644 --- a/source/blender/editors/include/ED_undo.h +++ b/source/blender/editors/include/ED_undo.h @@ -36,6 +36,9 @@ struct wmOperator; struct wmOperatorType; /* undo.c */ +/** + * Run from the main event loop, basic checks that undo is left in a correct state. + */ bool ED_undo_is_state_valid(struct bContext *C); void ED_undo_group_begin(struct bContext *C); void ED_undo_group_end(struct bContext *C); @@ -52,18 +55,38 @@ void ED_OT_redo(struct wmOperatorType *ot); void ED_OT_undo_redo(struct wmOperatorType *ot); void ED_OT_undo_history(struct wmOperatorType *ot); +/** + * UI callbacks should call this rather than calling WM_operator_repeat() themselves. + */ int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); -/* Convenience since UI callbacks use this mostly. */ +/** + * 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); +/** + * Name optionally, function used to check for operator redo panel. + */ bool ED_undo_is_valid(const struct bContext *C, const char *undoname); bool ED_undo_is_memfile_compatible(const struct bContext *C); /* Unfortunate workaround for limits mixing undo systems. */ + +/** + * When a property of ID changes, return false. + * + * This is to avoid changes to a property making undo pushes + * which are ignored by the undo-system. + * For example, changing a brush property isn't stored by sculpt-mode undo steps. + * This workaround is needed until the limitation is removed, see: T61948. + */ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, struct ID *id); +/** + * Load all our objects from `object_array` into edit-mode, clear everything else. + */ void ED_undo_object_editmode_restore_helper(struct bContext *C, struct Object **object_array, uint object_array_len, @@ -73,6 +96,13 @@ struct Object **ED_undo_editmode_objects_from_view_layer(struct ViewLayer *view_ uint *r_len); struct Base **ED_undo_editmode_bases_from_view_layer(struct ViewLayer *view_layer, uint *r_len); +/** + * Ideally we won't access the stack directly, + * this is needed for modes which handle undo themselves (bypassing #ED_undo_push). + * + * Using global isn't great, this just avoids doing inline, + * causing 'BKE_global.h' & 'BKE_main.h' includes. + */ struct UndoStack *ED_undo_stack_get(void); /* helpers */ @@ -83,11 +113,28 @@ void ED_undo_object_set_active_or_warn(struct Scene *scene, struct CLG_LogRef *log); /* undo_system_types.c */ + void ED_undosys_type_init(void); void ED_undosys_type_free(void); /* memfile_undo.c */ + struct MemFile *ED_undosys_stack_memfile_get_active(struct UndoStack *ustack); +/** + * If the last undo step is a memfile one, find the first #MemFileChunk matching given ID + * (using its session UUID), and tag it as "changed in the future". + * + * Since non-memfile undo-steps cannot automatically set this flag in the previous step as done + * with memfile ones, this has to be called manually by relevant undo code. + * + * \note Only current known case for this is undoing a switch from Object to Sculpt mode (see + * T82388). + * + * \note Calling this ID by ID is not optimal, as it will loop over all #MemFile.chunks until it + * finds the expected one. If this becomes an issue we'll have to add a mapping from session UUID + * to first #MemFileChunk in #MemFile itself + * (currently we only do that in #MemFileWriteData when writing a new step). + */ void ED_undosys_stack_memfile_id_changed_tag(struct UndoStack *ustack, struct ID *id); #ifdef __cplusplus diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index df132e6ae80..69378d436ab 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -35,8 +35,12 @@ struct Main; struct bContext; /* ed_util.c */ + void ED_editors_init_for_undo(struct Main *bmain); void ED_editors_init(struct bContext *C); +/** + * Frees all edit-mode stuff. + */ void ED_editors_exit(struct Main *bmain, bool do_undo_system); bool ED_editors_flush_edits_for_object_ex(struct Main *bmain, @@ -45,9 +49,17 @@ bool ED_editors_flush_edits_for_object_ex(struct Main *bmain, bool check_needs_flush); bool ED_editors_flush_edits_for_object(struct Main *bmain, struct Object *ob); +/** + * Flush any temp data from object editing to DNA before writing files, rendering, copying, etc. + */ bool ED_editors_flush_edits_ex(struct Main *bmain, bool for_render, bool check_needs_flush); bool ED_editors_flush_edits(struct Main *bmain); +/** + * Use to free ID references within runtime data (stored outside of DNA) + * + * \param new_id: may be NULL to unlink \a old_id. + */ void ED_spacedata_id_remap(struct ScrArea *area, struct SpaceLink *sl, struct ID *old_id, @@ -56,21 +68,38 @@ void ED_spacedata_id_remap(struct ScrArea *area, void ED_operatortypes_edutils(void); /* Drawing */ + +/** + * Callback that draws a line between the mouse and a position given as the initial argument. + */ void ED_region_draw_mouse_line_cb(const struct bContext *C, struct ARegion *region, void *arg_info); +/** + * \note Keep in sync with #BKE_image_stamp_buf. + */ void ED_region_image_metadata_draw( int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy); /* Slider */ + struct tSlider; struct tSlider *ED_slider_create(struct bContext *C); +/** + * For modal operations so the percentage doesn't pop on the first mouse movement. + */ void ED_slider_init(struct tSlider *slider, const struct wmEvent *event); +/** + * Calculate slider factor based on mouse position. + */ bool ED_slider_modal(struct tSlider *slider, const struct wmEvent *event); void ED_slider_destroy(struct bContext *C, struct tSlider *slider); +/** + * Return string based on the current state of the slider. + */ void ED_slider_status_string_get(const struct tSlider *slider, char *status_string, const size_t size_of_status_string); @@ -83,6 +112,11 @@ void ED_slider_allow_overshoot_set(struct tSlider *slider, const bool value); /* ************** XXX OLD CRUFT WARNING ************* */ +/** + * Now only used in 2D spaces, like time, f-curve, NLA, image, etc. + * + * \note Shift/Control are not configurable key-bindings. + */ void apply_keyb_grid( int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert); diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index f3aba12a924..d5303904842 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -46,6 +46,7 @@ struct bNodeTree; struct wmKeyConfig; /* uvedit_ops.c */ + void ED_operatortypes_uvedit(void); void ED_operatormacros_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); @@ -54,6 +55,9 @@ bool ED_uvedit_minmax(const struct Scene *scene, struct Object *obedit, float min[2], float max[2]); +/** + * Be careful when using this, it bypasses all synchronization options. + */ void ED_uvedit_select_all(struct BMesh *bm); bool ED_uvedit_minmax_multi(const struct Scene *scene, @@ -217,12 +221,17 @@ struct BMLoop *ED_uvedit_active_vert_loop_get(struct BMesh *bm); void ED_uvedit_active_edge_loop_set(struct BMesh *bm, struct BMLoop *l); struct BMLoop *ED_uvedit_active_edge_loop_get(struct BMesh *bm); +/** + * Intentionally don't return #UV_SELECT_ISLAND as it's not an element type. + * In this case return #UV_SELECT_VERTEX as a fallback. + */ char ED_uvedit_select_mode_get(const struct Scene *scene); void ED_uvedit_select_sync_flush(const struct ToolSettings *ts, struct BMEditMesh *em, const bool select); /* uvedit_unwrap_ops.c */ + void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit); void ED_uvedit_live_unwrap_re_solve(void); void ED_uvedit_live_unwrap_end(short cancel); @@ -231,9 +240,11 @@ void ED_uvedit_live_unwrap(const struct Scene *scene, struct Object **objects, i void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, struct Object *ob); /* uvedit_draw.c */ + void ED_image_draw_cursor(struct ARegion *region, const float cursor[2]); /* uvedit_buttons.c */ + void ED_uvedit_buttons_register(struct ARegionType *art); /* uvedit_islands.c */ @@ -259,6 +270,9 @@ struct UVPackIsland_Params { uint correct_aspect : 1; }; +/** + * Returns true if UV coordinates lie on a valid tile in UDIM grid or tiled image. + */ bool uv_coords_isect_udim(const struct Image *image, const int udim_grid[2], const float coords[2]); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 008ad5b3203..6300c017c95 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -107,6 +107,9 @@ void ED_view3d_background_color_get(const struct Scene *scene, bool ED_view3d_has_workbench_in_texture_color(const struct Scene *scene, const struct Object *ob, const struct View3D *v3d); +/** + * \note cannot use `event->mval` here, called by #object_add(). + */ void ED_view3d_cursor3d_position(struct bContext *C, const int mval[2], const bool use_depth, @@ -124,11 +127,44 @@ void ED_view3d_cursor3d_update(struct bContext *C, struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d); +/** + * Calculate the view transformation matrix from RegionView3D input. + * The resulting matrix is equivalent to RegionView3D.viewinv + * \param mat: The view 4x4 transformation matrix to calculate. + * \param ofs: The view offset, normally from RegionView3D.ofs. + * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. + * \param dist: The view distance from ofs, normally from RegionView3D.dist. + */ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist); +/** + * Set the view transformation from a 4x4 matrix. + * + * \param mat: The view 4x4 transformation matrix to assign. + * \param ofs: The view offset, normally from RegionView3D.ofs. + * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. + * \param dist: The view distance from ofs, normally from RegionView3D.dist. + */ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const float *dist); +/** + * Set the RegionView3D members from an objects transformation and optionally lens. + * \param ob: The object to set the view to. + * \param ofs: The view offset to be set, normally from RegionView3D.ofs. + * \param quat: The view rotation to be set, quaternion normally from RegionView3D.viewquat. + * \param dist: The view distance from ofs to be set, normally from RegionView3D.dist. + * \param lens: The view lens angle set for cameras and lights, normally from View3D.lens. + */ void ED_view3d_from_object( const struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); +/** + * Set the object transformation from RegionView3D members. + * \param depsgraph: The depsgraph to get the evaluated object parent + * for the transformation calculation. + * \param ob: The object which has the transformation assigned. + * \param ofs: The view offset, normally from RegionView3D.ofs. + * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. + * \param dist: The view distance from ofs, normally from RegionView3D.dist. + */ void ED_view3d_to_object(const struct Depsgraph *depsgraph, struct Object *ob, const float ofs[3], @@ -140,6 +176,9 @@ bool ED_view3d_camera_to_view_selected(struct Main *bmain, const struct Scene *scene, struct Object *camera_ob); +/** + * Use to store the last view, before entering camera view. + */ void ED_view3d_lastview_store(struct RegionView3D *rv3d); /* Depth buffer */ @@ -148,6 +187,14 @@ typedef enum { V3D_DEPTH_GPENCIL_ONLY, V3D_DEPTH_OBJECT_ONLY, } eV3DDepthOverrideMode; +/** + * Redraw the viewport depth buffer. + * + * \param mode: V3D_DEPTH_NO_GPENCIL - Redraw viewport without Grease Pencil and Annotations. + * V3D_DEPTH_GPENCIL_ONLY - Redraw viewport with Grease Pencil and Annotations only. + * V3D_DEPTH_OBJECT_ONLY - Redraw viewport with active object only. + * \param update_cache: If true, store the entire depth buffer in #rv3d->depths. + */ void ED_view3d_depth_override(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, @@ -309,6 +356,7 @@ void ED_view3d_cursor_snap_draw_util(struct RegionView3D *rv3d, /* 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), @@ -328,6 +376,10 @@ void mesh_foreachScreenEdge(struct ViewContext *vc, void *userData, const eV3DProjTest clip_flag); +/** + * A version of #mesh_foreachScreenEdge that clips the segment when + * there is a clipping bounding box. + */ void mesh_foreachScreenEdge_clip_bb_segment(struct ViewContext *vc, void (*func)(void *userData, struct BMEdge *eed, @@ -352,6 +404,9 @@ void nurbs_foreachScreenVert(struct ViewContext *vc, const float screen_co[2]), void *userData, const eV3DProjTest clip_flag); +/** + * #ED_view3d_init_mats_rv3d must be called first. + */ void mball_foreachScreenElem(struct ViewContext *vc, void (*func)(void *userData, struct MetaElem *ml, @@ -364,6 +419,9 @@ void lattice_foreachScreenVert(struct ViewContext *vc, const float screen_co[2]), void *userData, const eV3DProjTest clip_flag); +/** + * #ED_view3d_init_mats_rv3d must be called first. + */ void armature_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct EditBone *ebone, @@ -371,6 +429,10 @@ void armature_foreachScreenBone(struct ViewContext *vc, const float screen_co_b[2]), void *userData, const eV3DProjTest clip_flag); + +/** + * ED_view3d_init_mats_rv3d must be called first. + */ void pose_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct bPoseChannel *pchan, @@ -381,10 +443,17 @@ void pose_foreachScreenBone(struct ViewContext *vc, /* *** end iterators *** */ /* view3d_project.c */ + +/** + * \note use #ED_view3d_ob_project_mat_get to get the projection matrix + */ void ED_view3d_project_float_v2_m4(const struct ARegion *region, const float co[3], float r_co[2], float mat[4][4]); +/** + * \note use #ED_view3d_ob_project_mat_get to get projecting mat + */ void ED_view3d_project_float_v3_m4(const struct ARegion *region, const float co[3], float r_co[3], @@ -399,10 +468,12 @@ eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *region, const float co[3], short r_co[2], const eV3DProjTest flag); +/* --- short --- */ eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *region, const float co[3], short r_co[2], const eV3DProjTest flag); +/* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *region, const float co[3], short r_co[2], @@ -415,10 +486,12 @@ eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *region, const float co[3], int r_co[2], const eV3DProjTest flag); +/* --- int --- */ eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *region, const float co[3], int r_co[2], const eV3DProjTest flag); +/* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *region, const float co[3], int r_co[2], @@ -431,10 +504,14 @@ eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag); +/* --- float --- */ eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag); +/** + * Object space, use #ED_view3d_init_mats_rv3d before calling. + */ eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region, const float co[3], float r_co[2], @@ -443,10 +520,29 @@ eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region, 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]); +/** + * Calculate a depth value from \a co, use with #ED_view3d_win_to_delta + */ float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip); +/** + * Calculate a depth value from `co` (result should only be used for comparison). + */ float ED_view3d_calc_depth_for_comparison(const struct RegionView3D *rv3d, const float co[3]); bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]); +/** + * Calculate a 3d viewpoint and direction vector from 2d window coordinates. + * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. + * ray_start is clipped by the view near limit so points in front of it are always in view. + * In orthographic view the resulting ray_normal will match the view vector. + * \param region: The region (used for the window width and height). + * \param v3d: The 3d viewport (used for near clipping value). + * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). + * \param r_ray_start: The world-space point where the ray intersects the window plane. + * \param r_ray_normal: The normalized world-space direction of towards mval. + * \param do_clip_planes: Optionally clip the start of the ray by the view clipping planes. + * \return success, false if the ray is totally clipped. + */ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph, const struct ARegion *region, const struct View3D *v3d, @@ -454,6 +550,22 @@ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph, float ray_start[3], float ray_normal[3], const bool do_clip); +/** + * Calculate a 3d viewpoint and direction vector from 2d window coordinates. + * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. + * ray_start is clipped by the view near limit so points in front of it are always in view. + * In orthographic view the resulting ray_normal will match the view vector. + * This version also returns the ray_co point of the ray on window plane, useful to fix precision + * issues esp. with ortho view, where default ray_start is set rather far away. + * \param region: The region (used for the window width and height). + * \param v3d: The 3d viewport (used for near clipping value). + * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). + * \param r_ray_co: The world-space point where the ray intersects the window plane. + * \param r_ray_normal: The normalized world-space direction of towards mval. + * \param r_ray_start: The world-space starting point of the ray. + * \param do_clip_planes: Optionally clip the start of the ray by the view clipping planes. + * \return success, false if the ray is totally clipped. + */ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph, const struct ARegion *region, const struct View3D *v3d, @@ -462,13 +574,38 @@ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph, float r_ray_normal[3], float r_ray_start[3], bool do_clip); +/** + * Calculate a 3d viewpoint and direction vector from 2d window coordinates. + * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. + * \param region: The region (used for the window width and height). + * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). + * \param r_ray_start: The world-space point where the ray intersects the window plane. + * \param r_ray_normal: The normalized world-space direction of towards mval. + * + * \note Ignores view near/far clipping, + * to take this into account use #ED_view3d_win_to_ray_clipped. + */ void ED_view3d_win_to_ray(const struct ARegion *region, const float mval[2], float r_ray_start[3], float r_ray_normal[3]); +/** + * Calculate a normalized 3d direction vector from the viewpoint towards a global location. + * In orthographic view the resulting vector will match the view vector. + * \param rv3d: The region (used for the window width and height). + * \param coord: The world-space location. + * \param vec: The resulting normalized vector. + */ void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]); +/** + * Calculate a 3d location from 2d window coordinates. + * \param region: The region (used for the window width and height). + * \param depth_pt: The reference location used to calculate the Z depth. + * \param mval: The area relative location (such as event->mval converted to floats). + * \param r_out: The resulting world-space location. + */ void ED_view3d_win_to_3d(const struct View3D *v3d, const struct ARegion *region, const float depth_pt[3], @@ -484,6 +621,13 @@ bool ED_view3d_win_to_3d_on_plane(const struct ARegion *region, const float mval[2], const bool do_clip, float r_out[3]); +/** + * A wrapper for #ED_view3d_win_to_3d_on_plane that projects onto \a plane_fallback + * then maps this back to \a plane. + * + * This is intended to be used when \a plane is orthogonal to the views Z axis where + * projecting the \a mval doesn't work well (or fail completely when exactly aligned). + */ bool ED_view3d_win_to_3d_on_plane_with_fallback(const struct ARegion *region, const float plane[4], const float mval[2], @@ -495,12 +639,57 @@ bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *region, const int mval[2], const bool do_clip, float r_out[3]); +/** + * Calculate a 3d difference vector from 2d window offset. + * note that #ED_view3d_calc_zfac() must be called first to determine + * the depth used to calculate the delta. + * \param region: The region (used for the window width and height). + * \param mval: The area relative 2d difference (such as event->mval[0] - other_x). + * \param out: The resulting world-space delta. + */ void ED_view3d_win_to_delta(const struct ARegion *region, const float mval[2], float out[3], const float zfac); +/** + * Calculate a 3d origin from 2d window coordinates. + * \note Orthographic views have a less obvious origin, + * Since far clip can be a very large value resulting in numeric precision issues, + * the origin in this case is close to zero coordinate. + * + * \param region: The region (used for the window width and height). + * \param mval: The area relative 2d location (such as event->mval converted to floats). + * \param out: The resulting normalized world-space direction vector. + */ void ED_view3d_win_to_origin(const struct ARegion *region, const float mval[2], float out[3]); +/** + * Calculate a 3d direction vector from 2d window coordinates. + * This direction vector starts and the view in the direction of the 2d window coordinates. + * In orthographic view all window coordinates yield the same vector. + * + * \note doesn't rely on ED_view3d_calc_zfac + * for perspective view, get the vector direction to + * the mouse cursor as a normalized vector. + * + * \param region: The region (used for the window width and height). + * \param mval: The area relative 2d location (such as event->mval converted to floats). + * \param out: The resulting normalized world-space direction vector. + */ void ED_view3d_win_to_vector(const struct ARegion *region, const float mval[2], float out[3]); +/** + * Calculate a 3d segment from 2d window coordinates. + * This ray_start is located at the viewpoint, ray_end is a far point. + * ray_start and ray_end are clipped by the view near and far limits + * so points along this line are always in view. + * In orthographic view all resulting segments will be parallel. + * \param region: The region (used for the window width and height). + * \param v3d: The 3d viewport (used for near and far clipping range). + * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). + * \param r_ray_start: The world-space starting point of the segment. + * \param r_ray_end: The world-space end point of the segment. + * \param do_clip_planes: Optionally clip the ray by the view clipping planes. + * \return success, false if the segment is totally clipped. + */ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, const struct ARegion *region, struct View3D *v3d, @@ -515,6 +704,10 @@ void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, const float obmat[4][4], float r_pmat[4][4]); +/** + * Convert between region relative coordinates (x,y) and depth component z and + * a point in world space. + */ void ED_view3d_project_v3(const struct ARegion *region, const float world[3], float r_region_co[3]); @@ -527,6 +720,9 @@ bool ED_view3d_unproject_v3( /* end */ void ED_view3d_dist_range_get(const struct View3D *v3d, float r_dist_range[2]); +/** + * \note copies logic of #ED_view3d_viewplane_get(), keep in sync. + */ bool ED_view3d_clip_range_get(struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, @@ -543,6 +739,9 @@ bool ED_view3d_viewplane_get(struct Depsgraph *depsgraph, float *r_clipend, float *r_pixsize); +/** + * Use instead of: `GPU_polygon_offset(rv3d->dist, ...)` see bug T37727. + */ void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist); void ED_view3d_calc_camera_border(const struct Scene *scene, @@ -572,15 +771,61 @@ void ED_view3d_clipping_calc(struct BoundBox *bb, const struct ARegion *region, const struct Object *ob, const struct rcti *rect); +/** + * Clamp min/max by the viewport clipping. + * + * \note This is an approximation, with the limitation that the bounding box from the (mix, max) + * calculation might not have any geometry inside the clipped region. + * Performing a clipping test on each vertex would work well enough for most cases, + * although it's not perfect either as edges/faces may intersect the clipping without having any + * of their vertices inside it. + * A more accurate result would be quite involved. + * + * \return True when the arguments were clamped. + */ bool ED_view3d_clipping_clamp_minmax(const struct RegionView3D *rv3d, float min[3], float max[3]); void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4]); +/** + * Return true when `co` is hidden by the 3D views clipping planes. + * + * \param local: When true use local (object-space) #ED_view3d_clipping_local must run first, + * then all comparisons can be done in local-space. + * \return True when `co` is outside all clipping planes. + * + * \note Callers should check #RV3D_CLIPPING_ENABLED first. + */ bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], const bool is_local); 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); +/** + * Return a new RegionView3D.dist value to fit the \a radius. + * + * \note Depth isn't taken into account, this will fit a flat plane exactly, + * but points towards the view (with a perspective projection), + * may be within the radius but outside the view. eg: + * + * <pre> + * + + * pt --> + /^ radius + * / | + * / | + * view + + + * \ | + * \ | + * \| + * + + * </pre> + * + * \param region: Can be NULL if \a use_aspect is false. + * \param persp: Allow the caller to tell what kind of perspective to use (ortho/view/camera) + * \param use_aspect: Increase the distance to account for non 1:1 view aspect. + * \param radius: The radius will be fitted exactly, + * typically pre-scaled by a margin (#VIEW3D_MARGIN). + */ float ED_view3d_radius_to_dist(const struct View3D *v3d, const struct ARegion *region, const struct Depsgraph *depsgraph, @@ -588,12 +833,26 @@ float ED_view3d_radius_to_dist(const struct View3D *v3d, const bool use_aspect, const float radius); -/* Back-buffer select and draw support. */ +/** + * Back-buffer select and draw support. + */ void ED_view3d_backbuf_depth_validate(struct ViewContext *vc); +/** + * allow for small values [0.5 - 2.5], + * and large values, FLT_MAX by clamping by the area size + */ int ED_view3d_backbuf_sample_size_clamp(struct ARegion *region, const float dist); void ED_view3d_select_id_validate(struct ViewContext *vc); +/** + * Get the world-space 3d location from a screen-space 2d point. + * TODO: Implement #alphaoverride. We don't want to zoom into billboards. + * + * \param mval: Input screen-space pixel location. + * \param mouse_worldloc: Output world-space location. + * \param fallback_depth_pt: Use this points depth when no depth can be found. + */ bool ED_view3d_autodist(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, @@ -602,6 +861,9 @@ bool ED_view3d_autodist(struct Depsgraph *depsgraph, const bool alphaoverride, const float fallback_depth_pt[3]); +/** + * No 4x4 sampling, run #ED_view3d_depth_override first. + */ bool ED_view3d_autodist_simple(struct ARegion *region, const int mval[2], float mouse_worldloc[3], @@ -635,9 +897,21 @@ typedef enum { eV3DSelectObjectFilter ED_view3d_select_filter_from_mode(const struct Scene *scene, const struct Object *obact); +/** + * Optionally cache data for multiple calls to #view3d_opengl_select + * + * just avoid GPU_select headers outside this file + */ void view3d_opengl_select_cache_begin(void); void view3d_opengl_select_cache_end(void); +/** + * \warning be sure to account for a negative return value + * This is an error, "Too many objects in select buffer" + * and no action should be taken (can crash blender) if this happens + * + * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. + */ int view3d_opengl_select_ex(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, @@ -665,28 +939,57 @@ void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc, struct Depsgraph *depsgraph); void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact); +/** + * Use this call when executing an operator, + * event system doesn't set for each event the OpenGL drawing context. + */ void view3d_operator_needs_opengl(const struct bContext *C); void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *region); -/* XXX should move to BLI_math */ +/** 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]); -/* get 3d region from context, also if mouse is in header or toolbar */ +/** + * Get 3D region from context, also if mouse is in header or toolbar. + */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); +/** + * Ideally would return an rv3d but in some cases the region is needed too + * so return that, the caller can then access the `region->regiondata`. + */ bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_region); +/** + * Similar to #ED_view3d_context_user_region() but does not use context. Always performs a lookup. + * Also works if \a v3d is not the active space. + */ bool ED_view3d_area_user_region(const struct ScrArea *area, const struct View3D *v3d, struct ARegion **r_region); bool ED_operator_rv3d_user_region_poll(struct bContext *C); +/** + * Most of the time this isn't needed since you could assume the view matrix was + * set while drawing, however when functions like mesh_foreachScreenVert are + * called by selection tools, we can't be sure this object was the last. + * + * for example, transparent objects are drawn after editmode and will cause + * the rv3d mat's to change and break selection. + * + * 'ED_view3d_init_mats_rv3d' should be called before + * view3d_project_short_clip and view3d_project_short_noclip in cases where + * these functions are not used during draw_object + */ void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d); void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *rv3d); #ifdef DEBUG +/** + * Ensure we correctly initialize. + */ void ED_view3d_clear_mats_rv3d(struct RegionView3D *rv3d); void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d); #else @@ -705,6 +1008,9 @@ void ED_draw_object_facemap(struct Depsgraph *depsgraph, struct RenderEngineType *ED_view3d_engine_type(const struct Scene *scene, int drawtype); bool ED_view3d_context_activate(struct bContext *C); +/** + * Set the correct matrices + */ void ED_view3d_draw_setup_view(const struct wmWindowManager *wm, struct wmWindow *win, struct Depsgraph *depsgraph, @@ -715,13 +1021,22 @@ void ED_view3d_draw_setup_view(const struct wmWindowManager *wm, const float winmat[4][4], const struct rcti *rect); +/** + * `mval` comes from event->mval, only use within region handlers. + */ 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]); struct Object *ED_view3d_give_material_slot_under_cursor(struct bContext *C, const int mval[2], int *r_material_slot); bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2]); +/** + * 'clip' is used to know if our clip setting has changed. + */ void ED_view3d_quadview_update(struct ScrArea *area, struct ARegion *region, bool do_clip); +/** + * \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore + */ void ED_view3d_update_viewmat(struct Depsgraph *depsgraph, const struct Scene *scene, struct View3D *v3d, @@ -744,23 +1059,48 @@ void ED_view3d_datamask(const struct bContext *C, const struct Scene *scene, const struct View3D *v3d, struct CustomData_MeshMasks *r_cddata_masks); +/** + * Goes over all modes and view3d settings. + */ 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); +/** + * For viewport operators that exit camera perspective. + * + * \note This differs from simply setting `rv3d->persp = persp` because it + * sets the `ofs` and `dist` values of the viewport so it matches the camera, + * otherwise switching out of camera view may jump to a different part of the scene. + */ void ED_view3d_persp_switch_from_camera(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d, const char persp); +/** + * Action to take when rotating the view, + * handle auto-perspective and logic for switching out of views. + * + * shared with NDOF. + */ bool ED_view3d_persp_ensure(const struct Depsgraph *depsgraph, struct View3D *v3d, struct ARegion *region); -/* camera lock functions */ +/* Camera lock functions */ + +/** + * \return true when the 3D Viewport is locked to its camera. + */ 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 */ +/** + * Copy the camera to the view before starting a view transformation. + * + * Apply the camera object transformation to the 3D Viewport. + * (needed so we can use regular 3D Viewport manipulation operators, that sync back to the camera). + */ void ED_view3d_camera_lock_init_ex(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d, @@ -768,7 +1108,13 @@ void ED_view3d_camera_lock_init_ex(const struct Depsgraph *depsgraph, 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 */ +/** + * Copy the view to the camera, return true if. + * + * Apply the 3D Viewport transformation back to the camera object. + * + * \return true if the camera is moved. + */ bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d); @@ -778,6 +1124,12 @@ bool ED_view3d_camera_autokey(const struct Scene *scene, struct bContext *C, const bool do_rotate, const bool do_translate); +/** + * Call after modifying a locked view. + * + * \note Not every view edit currently auto-keys (num-pad for eg), + * this is complicated because of smooth-view. + */ bool ED_view3d_camera_lock_autokey(struct View3D *v3d, struct RegionView3D *rv3d, struct bContext *C, @@ -789,14 +1141,41 @@ void ED_view3d_lock_clear(struct View3D *v3d); #define VIEW3D_MARGIN 1.4f #define VIEW3D_DIST_FALLBACK 1.0f +/** + * This function solves the problem of having to switch between camera and non-camera views. + * + * When viewing from the perspective of \a mat, and having the view center \a ofs, + * this calculates a distance from \a ofs to the matrix \a mat. + * Using \a fallback_dist when the distance would be too small. + * + * \param mat: A matrix use for the view-point (typically the camera objects matrix). + * \param ofs: Orbit center (negated), matching #RegionView3D.ofs, which is typically passed in. + * \param fallback_dist: The distance to use if the object is too near or in front of \a ofs. + * \returns A newly calculated distance or the fallback. + */ float ED_view3d_offset_distance(const float mat[4][4], const float ofs[3], const float fallback_dist); +/** + * Set the dist without moving the view (compensate with #RegionView3D.ofs) + * + * \note take care that viewinv is up to date, #ED_view3d_update_viewmat first. + */ void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist); +/** + * Change the distance & offset to match the depth of \a dist_co along the view axis. + * + * \param dist_co: A world-space location to use for the new depth. + * \param dist_min: Resulting distances below this will be ignored. + * \return Success if the distance was set. + */ bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d, const float dist_co[3], const float dist_min); +/** + * Could move this elsewhere, but tied into #ED_view3d_grid_scale + */ float ED_scene_grid_scale(const struct Scene *scene, const char **r_grid_unit); float ED_view3d_grid_scale(const struct Scene *scene, struct View3D *v3d, @@ -805,14 +1184,24 @@ void ED_view3d_grid_steps(const struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d, float r_grid_steps[8]); +/** + * Simulates the grid scale that is actually viewed. + * The actual code is seen in `object_grid_frag.glsl` (see `grid_res`). + * Currently the simulation is only done when RV3D_VIEW_IS_AXIS. + */ float ED_view3d_grid_view_scale(struct Scene *scene, struct View3D *v3d, struct ARegion *region, const char **r_grid_unit); +/** + * \note The info that this uses is updated in #ED_refresh_viewport_fps, + * which currently gets called during #SCREEN_OT_animation_step. + */ void ED_scene_draw_fps(const struct Scene *scene, int xoffset, int *yoffset); -/* render */ +/* Render */ + void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *region); void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *area); @@ -825,7 +1214,10 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr #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. */ + +/** + * Try avoid using these more move out of legacy. + */ void ED_view3d_draw_bgpic_test(const struct Scene *scene, struct Depsgraph *depsgraph, struct ARegion *region, @@ -834,6 +1226,7 @@ void ED_view3d_draw_bgpic_test(const struct Scene *scene, 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, @@ -841,11 +1234,17 @@ void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C, void ED_view3d_gizmo_mesh_preselect_clear(struct wmGizmo *gz); /* space_view3d.c */ + void ED_view3d_buttons_region_layout_ex(const struct bContext *C, struct ARegion *region, const char *category_override); /* view3d_view.c */ + +/** + * See if current UUID is valid, otherwise set a valid UUID to v3d, + * Try to keep the same UUID previously used to allow users to quickly toggle back and forth. + */ bool ED_view3d_local_collections_set(struct Main *bmain, struct View3D *v3d); void ED_view3d_local_collections_reset(struct bContext *C, const bool reset_all); diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h index 8b695e61a35..1da0a282697 100644 --- a/source/blender/editors/include/ED_view3d_offscreen.h +++ b/source/blender/editors/include/ED_view3d_offscreen.h @@ -57,6 +57,10 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph, const bool restore_rv3d_mats, struct GPUOffScreen *ofs, struct GPUViewport *viewport); +/** + * Creates own fake 3d views (wrapping #ED_view3d_draw_offscreen). Similar too + * #ED_view_draw_offscreen_imbuf_simple, but takes view/projection matrices as arguments. + */ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph, struct Scene *scene, struct View3DShading *shading_override, @@ -76,6 +80,12 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph, struct GPUOffScreen *ofs, struct GPUViewport *viewport); +/** + * Utility func for ED_view3d_draw_offscreen + * + * \param ofs: Optional off-screen buffer, can be NULL. + * (avoids re-creating when doing multiple GL renders). + */ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, struct Scene *scene, eDrawType drawtype, @@ -89,6 +99,14 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, const bool restore_rv3d_mats, struct GPUOffScreen *ofs, char err_out[256]); +/** + * Creates own fake 3d views (wrapping #ED_view3d_draw_offscreen_imbuf) + * + * \param ofs: Optional off-screen buffer can be NULL. + * (avoids re-creating when doing multiple GL renders). + * + * \note used by the sequencer + */ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph, struct Scene *scene, struct View3DShading *shading_override, diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 023a1a64daf..e29e0d3b150 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -451,6 +451,14 @@ int UI_draw_roundbox_corner_get(void); void UI_draw_box_shadow(const struct rctf *rect, unsigned char alpha); void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4]); +/** + * Draw title and text safe areas. + * + * \note This function is to be used with the 2D dashed shader enabled. + * + * \param pos: is a #PRIM_FLOAT, 2, #GPU_FETCH_FLOAT vertex attribute. + * \param x1, x2, y1, y2: The offsets for the view, not the zones. + */ void UI_draw_safe_areas(uint pos, const struct rctf *rect, const float title_aspect[2], @@ -462,12 +470,27 @@ enum { UI_SCROLL_ARROWS = 1 << 1, UI_SCROLL_NO_OUTLINE = 1 << 2, }; +/** + * Function in use for buttons and for view2d sliders. + */ void UI_draw_widget_scroll(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state); -/* Shortening string helper. */ +/** + * Shortening string helper. + * + * Cut off the middle of the text to fit into the given width. + * + * \note in case this middle clipping would just remove a few chars, + * it rather clips right, which is more readable. + * + * If rpart_sep is not Null, the part of str starting to first occurrence of rpart_sep + * is preserved at all cost. + * Useful for strings with shortcuts + * (like 'AVeryLongFooBarLabelForMenuEntry|Ctrl O' -> 'AVeryLong...MenuEntry|Ctrl O'). + */ float UI_text_clip_middle_ex(const struct uiFontStyle *fstyle, char *str, float okwidth, @@ -503,9 +526,11 @@ typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); typedef struct ARegion *(*uiButSearchCreateFn)(struct bContext *C, struct ARegion *butregion, struct uiButSearch *search_but); -/* `is_first` is typically used to ignore search filtering when the menu is first opened in order +/** + * `is_first` is typically used to ignore search filtering when the menu is first opened in order * to display the full list of options. The value will be false after the button's text is edited - * (for every call except the first). */ + * (for every call except the first). + */ typedef void (*uiButSearchUpdateFn)(const struct bContext *C, void *arg, const char *str, @@ -592,6 +617,7 @@ typedef void (*uiFreeArgFunc)(void *arg); /* interface_query.c */ bool UI_but_has_tooltip_label(const uiBut *but); bool UI_but_is_tool(const uiBut *but); +/* file selectors are exempt from utf-8 checks */ bool UI_but_is_utf8(const uiBut *but); #define UI_but_is_decorator(but) ((but)->type == UI_BTYPE_DECORATOR) @@ -613,10 +639,17 @@ struct uiList *UI_list_find_mouse_over(const struct ARegion *region, const struc typedef struct uiPopupMenu uiPopupMenu; uiPopupMenu *UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL(); +/** + * Only return handler, and set optional title. + * \param block_name: Assigned to uiBlock.name (useful info for debugging). + */ uiPopupMenu *UI_popup_menu_begin_ex(struct bContext *C, const char *title, const char *block_name, int icon) ATTR_NONNULL(); +/** + * Set the whole structure to work. + */ void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup); bool UI_popup_menu_end_or_cancel(struct bContext *C, struct uiPopupMenu *head); struct uiLayout *UI_popup_menu_layout(uiPopupMenu *pup); @@ -625,7 +658,14 @@ void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_ int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) ATTR_NONNULL(1, 2); +/** + * Allow setting menu return value from externals. + * E.g. WM might need to do this for exiting files correctly. + */ void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable); +/** + * Setting the button makes the popup open from the button instead of the cursor. + */ void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but); /* interface_region_popover.c */ @@ -637,8 +677,17 @@ int UI_popover_panel_invoke(struct bContext *C, bool keep_open, struct ReportList *reports); +/** + * Only return handler, and set optional title. + * + * \param from_active_button: Use the active button for positioning, + * use when the popover is activated from an operator instead of directly from the button. + */ uiPopover *UI_popover_begin(struct bContext *C, int menu_width, bool from_active_button) ATTR_NONNULL(1); +/** + * Set the whole structure to work. + */ void UI_popover_end(struct bContext *C, struct uiPopover *pup, struct wmKeyMap *keymap); struct uiLayout *UI_popover_layout(uiPopover *pup); void UI_popover_once_clear(uiPopover *pup); @@ -716,6 +765,9 @@ uiBlock *UI_block_begin(const struct bContext *C, eUIEmbossType emboss); 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); +/** + * Uses local copy of style, to scale things down, and allow widgets to change stuff. + */ void UI_block_draw(const struct bContext *C, struct uiBlock *block); void UI_blocklist_update_window_matrix(const struct bContext *C, const struct ListBase *lb); void UI_blocklist_update_view_for_buttons(const struct bContext *C, const struct ListBase *lb); @@ -730,12 +782,25 @@ void UI_block_theme_style_set(uiBlock *block, char theme_style); eUIEmbossType UI_block_emboss_get(uiBlock *block); void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss); bool UI_block_is_search_only(const uiBlock *block); +/** + * Use when a block must be searched to give accurate results + * for the whole region but shouldn't be displayed. + */ void UI_block_set_search_only(uiBlock *block, bool search_only); +/** + * Can be called with C==NULL. + */ void UI_block_free(const struct bContext *C, uiBlock *block); +/** + * Can be called with C==NULL. + */ void UI_blocklist_free(const struct bContext *C, struct ARegion *region); void UI_blocklist_free_inactive(const struct bContext *C, struct ARegion *region); +/** + * Is called by notifier. + */ void UI_screen_free_active_but_highlight(const struct bContext *C, struct bScreen *screen); void UI_region_free_active_but_all(struct bContext *context, struct ARegion *region); @@ -744,7 +809,9 @@ void UI_block_region_set(uiBlock *block, struct ARegion *region); void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr); void UI_block_lock_clear(uiBlock *block); -/* Automatic aligning, horizontal or vertical. */ +/** + * Automatic aligning, horizontal or vertical. + */ void UI_block_align_begin(uiBlock *block); void UI_block_align_end(uiBlock *block); @@ -759,16 +826,34 @@ typedef enum { UI_BLOCK_BOUNDS_PIE_CENTER, } eBlockBoundsCalc; +/** + * Used for various cases. + */ void UI_block_bounds_set_normal(struct uiBlock *block, int addval); +/** + * Used for pull-downs. + */ void UI_block_bounds_set_text(uiBlock *block, int addval); +/** + * Used for block popups. + */ void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2]); +/** + * Used for menu popups. + */ void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2]); +/** + * Used for centered popups, i.e. splash. + */ 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); void UI_block_direction_set(uiBlock *block, char direction); +/** + * This call escapes if there's alignment flags. + */ 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); @@ -777,7 +862,14 @@ void UI_block_translate(uiBlock *block, int x, int y); int UI_but_return_value_get(uiBut *but); void UI_but_drag_set_id(uiBut *but, struct ID *id); +/** + * Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`). + * Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image. + */ void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale); +/** + * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. + */ void UI_but_drag_set_asset(uiBut *but, const struct AssetHandle *asset, const char *path, @@ -789,11 +881,18 @@ void UI_but_drag_set_asset(uiBut *but, 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); +/** + * Value from button itself. + */ void UI_but_drag_set_value(uiBut *but); void UI_but_drag_set_image( uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, const bool use_free); uiBut *UI_but_active_drop_name_button(const struct bContext *C); +/** + * Returns true if highlighted button allows drop of names. + * called in region context. + */ bool UI_but_active_drop_name(const struct bContext *C); bool UI_but_active_drop_color(struct bContext *C); @@ -808,7 +907,13 @@ void UI_but_disable(uiBut *but, const char *disabled_hint); void UI_but_type_set_menu_from_pulldown(uiBut *but); -/* special button case, only draw it when used actively, for outliner etc */ +/** + * Special button case, only draw it when used actively, for outliner etc. + * + * Needed for temporarily rename buttons, such as in outliner or file-select, + * they should keep calling #uiDefBut to keep them alive. + * \return false when button removed. + */ bool UI_but_active_only_ex(const struct bContext *C, struct ARegion *region, uiBlock *block, @@ -818,10 +923,17 @@ bool UI_but_active_only(const struct bContext *C, struct ARegion *region, uiBlock *block, uiBut *but); +/** + * \warning This must run after other handlers have been added, + * otherwise the handler won't be removed, see: T71112. + */ bool UI_block_active_only_flagged_buttons(const struct bContext *C, struct ARegion *region, struct uiBlock *block); +/** + * Simulate button click. + */ void UI_but_execute(const struct bContext *C, struct ARegion *region, uiBut *but); bool UI_but_online_manual_id(const uiBut *but, @@ -1025,6 +1137,9 @@ uiBut *uiDefButO_ptr(uiBlock *block, short height, const char *tip); +/** + * If a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0). + */ uiBut *uiDefIconBut(uiBlock *block, int type, int retval, @@ -1210,6 +1325,7 @@ uiBut *uiDefIconButO_ptr(uiBlock *block, uiBut *uiDefButImage( uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4]); uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height); +/* Button containing both string label and icon */ uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, @@ -1480,7 +1596,10 @@ enum { UI_TEMPLATE_ID_FILTER_AVAILABLE = 1, }; +/***************************** ID Utilities *******************************/ + int UI_icon_from_id(const struct ID *id); +/** See: #BKE_report_type_str */ int UI_icon_from_report_type(int type); int UI_icon_colorid_from_report_type(int type); int UI_text_colorid_from_report_type(int type); @@ -1545,6 +1664,9 @@ uiBut *uiDefBlockButN(uiBlock *block, short height, const char *tip); +/** + * Block button containing icon. + */ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, @@ -1555,6 +1677,9 @@ uiBut *uiDefIconBlockBut(uiBlock *block, short width, short height, const char *tip); +/** + * Block button containing both string label and icon. + */ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, @@ -1575,6 +1700,11 @@ uiBut *uiDefKeyevtButS(uiBlock *block, short height, short *spoin, const char *tip); + +/** + * Short pointers hard-coded. + * \param modkeypoin: will be set to #KM_SHIFT, #KM_ALT, #KM_CTRL, #KM_OSKEY bits. + */ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, @@ -1586,6 +1716,10 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, const short *modkeypoin, const char *tip); +/** + * \param arg is pointer to string/name, use UI_but_func_search_set() below to make this work. + * here a1 and a2, if set, control thumbnail preview rows/cols. + */ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, @@ -1598,6 +1732,10 @@ uiBut *uiDefSearchBut(uiBlock *block, float a1, float a2, const char *tip); +/** + * Same parameters as for #uiDefSearchBut, with additional operator type and properties, + * used by callback to call again the right op with the right options (properties values). + */ uiBut *uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, struct IDProperty *properties, @@ -1641,6 +1779,12 @@ uiBut *uiDefAutoButR(uiBlock *block, int y, int width, int height); +/** + * \a check_prop callback filters functions to avoid drawing certain properties, + * in cases where PROP_HIDDEN flag can't be used for a property. + * + * \param prop_activate_init: Property to activate on initial popup (#UI_BUT_ACTIVATE_ON_INIT). + */ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop)(struct PointerRNA *ptr, @@ -1651,7 +1795,19 @@ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, eButLabelAlign label_align, const bool compact); -/* use inside searchfunc to add items */ +/** + * Public function exported for functions that use #UI_BTYPE_SEARCH_MENU. + * + * Use inside searchfunc to add items. + * + * \param items: Stores the items. + * \param name: Text to display for the item. + * \param poin: Opaque pointer (for use by the caller). + * \param iconid: The icon, #ICON_NONE for no icon. + * \param state: The buttons state flag, compatible with #uiBut.flag, + * typically #UI_BUT_DISABLED / #UI_BUT_INACTIVE. + * \return false if there is nothing to add. + */ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, @@ -1659,6 +1815,21 @@ bool UI_search_item_add(uiSearchItems *items, int state, const uint8_t name_prefix_offset); +/** + * \note The item-pointer (referred to below) is a per search item user pointer + * passed to #UI_search_item_add (stored in #uiSearchItems.pointers). + * + * \param search_create_fn: Function to create the menu. + * \param search_update_fn: Function to refresh search content after the search text has changed. + * \param arg: user value. + * \param free_arg: Set to true if the argument is newly allocated memory for every redraw and + * should be freed when the button is destroyed. + * \param search_arg_free_fn: When non-null, use this function to free \a arg. + * \param search_exec_fn: Function that executes the action, gets \a arg as the first argument. + * The second argument as the active item-pointer + * \param active: When non-null, this item-pointer item will be visible and selected, + * otherwise the first item will be selected. + */ void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, @@ -1669,15 +1840,26 @@ void UI_but_func_search_set(uiBut *but, void *active); void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn context_menu_fn); void UI_but_func_search_set_tooltip(uiBut *but, uiButSearchTooltipFn tooltip_fn); +/** + * \param search_sep_string: when not NULL, this string is used as a separator, + * showing the icon and highlighted text after the last instance of this string. + */ void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string); void UI_but_func_search_set_results_are_suggestions(uiBut *but, const bool value); -/* height in pixels, it's using hardcoded values still */ +/** + * Height in pixels, it's using hard-coded values still. + */ int UI_searchbox_size_y(void); int UI_searchbox_size_x(void); -/* check if a string is in an existing search box */ +/** + * Check if a string is in an existing search box. + */ int UI_search_items_find_index(uiSearchItems *items, const char *name); +/** + * Adds a hint to the button which draws right aligned, grayed out and never clipped. + */ void UI_but_hint_drawstr_set(uiBut *but, const char *string); void UI_but_treerow_indentation_set(uiBut *but, int indentation); @@ -1707,7 +1889,14 @@ void UI_but_func_drawextra_set( void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func); void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg); +/** + * Recreate tool-tip (use to update dynamic tips) + */ void UI_but_tooltip_refresh(struct bContext *C, uiBut *but); +/** + * Removes tool-tip timer from active but + * (meaning tool-tip is disabled until it's re-enabled again). + */ void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but); bool UI_textbutton_activate_rna(const struct bContext *C, @@ -1716,6 +1905,10 @@ bool UI_textbutton_activate_rna(const struct bContext *C, const char *rna_prop_id); bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); +/** + * push a new event onto event queue to activate the given button + * (usually a text-field) upon entering a popup + */ void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN); @@ -1753,28 +1946,58 @@ int UI_autocomplete_end(AutoComplete *autocpl, char *autoname); void UI_panels_begin(const struct bContext *C, struct ARegion *region); void UI_panels_end(const struct bContext *C, struct ARegion *region, int *r_x, int *r_y); +/** + * Draw panels, selected (panels currently being dragged) on top. + */ void UI_panels_draw(const struct bContext *C, struct ARegion *region); struct Panel *UI_panel_find_by_type(struct ListBase *lb, const struct PanelType *pt); +/** + * \note \a panel should be return value from #UI_panel_find_by_type and can be NULL. + */ struct Panel *UI_panel_begin(struct ARegion *region, struct ListBase *lb, uiBlock *block, struct PanelType *pt, struct Panel *panel, bool *r_open); +/** + * Create the panel header button group, used to mark which buttons are part of + * panel headers for the panel search process that happens later. This Should be + * called before adding buttons for the panel's header layout. + */ void UI_panel_header_buttons_begin(struct Panel *panel); +/** + * Finish the button group for the panel header to avoid putting panel body buttons in it. + */ void UI_panel_header_buttons_end(struct Panel *panel); void UI_panel_end(struct Panel *panel, int width, int height); +/** + * Set a context for this entire panel and its current layout. This should be used whenever panel + * callbacks that are called outside of regular drawing might require context. Currently it affects + * the #PanelType.reorder callback only. + */ void UI_panel_context_pointer_set(struct Panel *panel, const char *name, struct PointerRNA *ptr); +/** + * Get the panel's expansion state, taking into account + * expansion set from property search if it applies. + */ bool UI_panel_is_closed(const struct Panel *panel); bool UI_panel_is_active(const struct Panel *panel); +/** + * For button layout next to label. + */ void UI_panel_label_offset(const struct uiBlock *block, int *r_x, int *r_y); bool UI_panel_should_show_background(const struct ARegion *region, const struct PanelType *panel_type); int UI_panel_size_y(const struct Panel *panel); bool UI_panel_is_dragging(const struct Panel *panel); +/** + * Find whether a panel or any of its sub-panels contain a property that matches the search filter, + * depending on the search process running in #UI_block_apply_search_filter earlier. + */ bool UI_panel_matches_search_filter(const struct Panel *panel); bool UI_panel_can_be_pinned(const struct Panel *panel); @@ -1787,6 +2010,9 @@ const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallba void UI_panel_category_active_set(struct ARegion *region, const char *idname); void UI_panel_category_active_set_default(struct ARegion *region, const char *idname); void UI_panel_category_clear_all(struct ARegion *region); +/** + * Draw vertical tabs on the left side of the region, one tab per category. + */ void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active); /* Panel custom data. */ @@ -1796,17 +2022,40 @@ struct PointerRNA *UI_region_panel_custom_data_under_cursor(const struct bContex void UI_panel_custom_data_set(struct Panel *panel, struct PointerRNA *custom_data); /* Polyinstantiated panels for representing a list of data. */ +/** + * Called in situations where panels need to be added dynamically rather than + * having only one panel corresponding to each #PanelType. + */ struct Panel *UI_panel_add_instanced(const struct bContext *C, struct ARegion *region, struct ListBase *panels, const char *panel_idname, struct PointerRNA *custom_data); +/** + * Remove instanced panels from the region's panel list. + * + * \note Can be called with NULL \a C, but it should be avoided because + * handlers might not be removed. + */ void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region); #define INSTANCED_PANEL_UNIQUE_STR_LEN 16 +/** + * Find a unique key to append to the #PanelType.idname for the lookup to the panel's #uiBlock. + * Needed for instanced panels, where there can be multiple with the same type and identifier. + */ void UI_list_panel_unique_str(struct Panel *panel, char *r_name); typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname); +/** + * Check if the instanced panels in the region's panels correspond to the list of data the panels + * represent. Returns false if the panels have been reordered or if the types from the list data + * don't match in any way. + * + * \param data: The list of data to check against the instanced panels. + * \param panel_idname_func: Function to find the #PanelType.idname for each item in the data list. + * For a readability and generality, this lookup happens separately for each type of panel list. + */ bool UI_panel_list_matches_data(struct ARegion *region, struct ListBase *data, uiListPanelIDFromDataFunc panel_idname_func); @@ -1831,6 +2080,7 @@ void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers) * be used to reinitialize some internal state if user preferences change. */ void UI_init(void); +/* after reading userdef file */ void UI_init_userdef(void); void UI_reinit_font(void); void UI_exit(void); @@ -1946,8 +2196,18 @@ uiLayout *UI_block_layout(uiBlock *block, const 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); +/** + * Used for property search when the layout process needs to be cancelled in order to avoid + * computing the locations for buttons, but the layout items created while adding the buttons + * must still be freed. + */ void UI_block_layout_free(uiBlock *block); +/** + * Apply property search behavior, setting panel flags and deactivating buttons that don't match. + * + * \note Must not be run after #UI_block_layout_resolve. + */ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter); void UI_region_message_subscribe(struct ARegion *region, struct wmMsgBus *mbus); @@ -1958,11 +2218,23 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv); void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr); struct bContextStore *uiLayoutGetContextStore(uiLayout *layout); void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context); +/** + * This is a bit of a hack but best keep it in one place at least. + */ struct wmOperatorType *UI_but_operatortype_get_from_enum_menu(struct uiBut *but, struct PropertyRNA **r_prop); +/** + * This is a bit of a hack but best keep it in one place at least. + */ struct MenuType *UI_but_menutype_get(uiBut *but); +/** + * This is a bit of a hack but best keep it in one place at least. + */ struct PanelType *UI_but_paneltype_get(uiBut *but); void UI_menutype_draw(struct bContext *C, struct MenuType *mt, struct uiLayout *layout); +/** + * Used for popup panels only. + */ void UI_paneltype_draw(struct bContext *C, struct PanelType *pt, struct uiLayout *layout); /* Only for convenience. */ @@ -2004,10 +2276,20 @@ eUIEmbossType uiLayoutGetEmboss(uiLayout *layout); bool uiLayoutGetPropSep(uiLayout *layout); bool uiLayoutGetPropDecorate(uiLayout *layout); -/* layout specifiers */ +/* Layout create functions. */ + uiLayout *uiLayoutRow(uiLayout *layout, bool align); +/** + * See #uiLayoutColumnWithHeading(). + */ uiLayout *uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading); uiLayout *uiLayoutColumn(uiLayout *layout, bool align); +/** + * Variant of #uiLayoutColumn() that sets a heading label for the layout if the first item is + * added through #uiItemFullR(). If split layout is used and the item has no string to add to the + * first split-column, the heading is added there instead. Otherwise the heading inserted with a + * new row. + */ uiLayout *uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading); uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align); uiLayout *uiLayoutGridFlow(uiLayout *layout, @@ -2059,6 +2341,9 @@ void uiTemplateIDPreview(uiLayout *layout, int cols, int filter, const bool hide_buttons); +/** + * Version of #uiTemplateID using tabs. + */ void uiTemplateIDTabs(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, @@ -2066,11 +2351,23 @@ void uiTemplateIDTabs(uiLayout *layout, const char *newop, const char *menu, int filter); +/** + * This is for selecting the type of ID-block to use, + * and then from the relevant type choosing the block to use. + * + * \param propname: property identifier for property that ID-pointer gets stored to. + * \param proptypename: property identifier for property + * used to determine the type of ID-pointer that can be used. + */ void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *proptypename, const char *text); +/** + * Search menu to pick an item from a collection. + * A version of uiTemplateID that works for non-ID types. + */ void uiTemplateSearch(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, @@ -2089,6 +2386,13 @@ void uiTemplateSearchPreview(uiLayout *layout, const char *unlinkop, const int rows, const int cols); +/** + * This is creating/editing RNA-Paths + * + * - ptr: struct which holds the path property + * - propname: property identifier for property that path gets stored to + * - root_ptr: struct that path gets built from + */ void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char *propname, @@ -2096,7 +2400,13 @@ void uiTemplatePathBuilder(uiLayout *layout, const char *text); void uiTemplateModifiers(uiLayout *layout, struct bContext *C); void uiTemplateGpencilModifiers(uiLayout *layout, struct bContext *C); +/** + * Check if the shader effect panels don't match the data and rebuild the panels if so. + */ void uiTemplateShaderFx(uiLayout *layout, struct bContext *C); +/** + * Check if the constraint panels don't match the data and rebuild the panels if so. + */ void uiTemplateConstraints(uiLayout *layout, struct bContext *C, bool use_bone_constraints); uiLayout *uiTemplateGpencilModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); @@ -2123,7 +2433,13 @@ void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand); +/** + * \param icon_scale: Scale of the icon, 1x == button height. + */ void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); +/** + * \param icon_scale: Scale of the icon, 1x == button height. + */ void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, @@ -2141,7 +2457,14 @@ void uiTemplateCurveMapping(uiLayout *layout, bool brush, bool neg_slope, bool tone); +/** + * Template for a path creation widget intended for custom bevel profiles. + * This section is quite similar to #uiTemplateCurveMapping, but with reduced complexity. + */ void uiTemplateCurveProfile(uiLayout *layout, struct PointerRNA *ptr, const char *propname); +/** + * This template now follows User Preference for type - name is not correct anymore. + */ void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, @@ -2157,6 +2480,10 @@ void uiTemplateCryptoPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int icon); +/** + * \todo for now, grouping of layers is determined by dividing up the length of + * the array of layer bitflags + */ void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, @@ -2191,6 +2518,11 @@ void uiTemplateOperatorSearch(uiLayout *layout); void UI_but_func_menu_search(uiBut *but); void uiTemplateMenuSearch(uiLayout *layout); +/** + * Draw Operator property buttons for redoing execution with different settings. + * This function does not initialize the layout, + * functions can be called on the layout before and after. + */ void uiTemplateOperatorPropertyButs(const struct bContext *C, uiLayout *layout, struct wmOperator *op, @@ -2276,6 +2608,9 @@ void uiTemplateNodeView(uiLayout *layout, struct bNode *node, struct bNodeSocket *input); void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); +/** + * Button to quickly show texture in Properties Editor texture tab. + */ void uiTemplateTextureShow(uiLayout *layout, const struct bContext *C, struct PointerRNA *ptr, @@ -2332,9 +2667,15 @@ void uiTemplateAssetView(struct uiLayout *layout, const char *drag_opname, struct PointerRNA *r_drag_op_properties); +/** + * \return: A RNA pointer for the operator properties. + */ struct PointerRNA *UI_list_custom_activate_operator_set(struct uiList *ui_list, const char *opname, bool create_properties); +/** + * \return: A RNA pointer for the operator properties. + */ struct PointerRNA *UI_list_custom_drag_operator_set(struct uiList *ui_list, const char *opname, bool create_properties); @@ -2353,6 +2694,9 @@ void uiItemEnumO(uiLayout *layout, int icon, const char *propname, int value); +/** + * For use in cases where we have. + */ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, @@ -2431,6 +2775,9 @@ void uiItemFullR(uiLayout *layout, int flag, const char *name, int icon); +/** + * Use a wrapper function since re-implementing all the logic in this function would be messy. + */ void uiItemFullR_with_popover(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, @@ -2494,6 +2841,11 @@ void uiItemsFullEnumO(uiLayout *layout, struct IDProperty *properties, wmOperatorCallContext context, int flag); +/** + * Create UI items for enum items in \a item_array. + * + * A version of #uiItemsFullEnumO that takes pre-calculated item array. + */ void uiItemsFullEnumO_items(uiLayout *layout, struct wmOperatorType *ot, struct PointerRNA ptr, @@ -2510,33 +2862,59 @@ typedef struct uiPropertySplitWrapper { uiLayout *decorate_column; } uiPropertySplitWrapper; +/** + * Normally, we handle the split layout in #uiItemFullR(), but there are other cases where the + * logic is needed. Ideally, #uiItemFullR() could just call this, but it currently has too many + * special needs. + */ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout); void uiItemL(uiLayout *layout, const char *name, int icon); /* label */ void uiItemL_ex( uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert); +/** + * Helper to add a label and creates a property split layout if needed. + */ uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon); -/* label icon for dragging */ +/** + * Label icon for dragging. + */ void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); -/* menu */ +/** + * Menu. + */ void uiItemM_ptr(uiLayout *layout, struct MenuType *mt, const char *name, int icon); void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); -/* menu contents */ +/** + * Menu contents. + */ void uiItemMContents(uiLayout *layout, const char *menuname); -/* Decorators */ + +/* Decorators. */ + +/** + * Insert a decorator item for a button with the same property as \a prop. + * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a prop. + */ void uiItemDecoratorR_prop(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index); +/** + * Insert a decorator item for a button with the same property as \a prop. + * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a propname. + */ void uiItemDecoratorR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int index); -/* value */ +/** Value item */ void uiItemV(uiLayout *layout, const char *name, int icon, int argval); -/* separator */ +/** Separator item */ void uiItemS(uiLayout *layout); +/** Separator item */ void uiItemS_ex(uiLayout *layout, float factor); -/* Special separator. */ +/** Flexible spacing. */ void uiItemSpacer(uiLayout *layout); +/* popover */ void uiItemPopoverPanel_ptr( uiLayout *layout, const struct bContext *C, struct PanelType *pt, const char *name, int icon); void uiItemPopoverPanel(uiLayout *layout, @@ -2551,7 +2929,13 @@ void uiItemPopoverPanelFromGroup(uiLayout *layout, const char *context, const char *category); +/** + * Level items. + */ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg); +/** + * Version of #uiItemMenuF that free's `argN`. + */ void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN); void uiItemMenuEnumFullO_ptr(uiLayout *layout, struct bContext *C, @@ -2589,9 +2973,15 @@ void uiItemTabsEnumR_prop(uiLayout *layout, bool icon_only); /* Only for testing, inspecting layouts. */ +/** + * Evaluate layout items as a Python dictionary. + */ const char *UI_layout_introspect(uiLayout *layout); -/* Helper to add a big icon and create a split layout for alert boxes. */ +/** + * Helper to add a big icon and create a split layout for alert popups. + * Returns the layout to place further items into the alert box. + */ uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon); /* UI Operators */ @@ -2601,6 +2991,9 @@ typedef struct uiDragColorHandle { } uiDragColorHandle; void ED_operatortypes_ui(void); +/** + * \brief User Interface Keymap + */ void ED_keymap_ui(struct wmKeyConfig *keyconf); void ED_dropboxes_ui(void); void ED_uilisttypes_ui(void); @@ -2617,7 +3010,18 @@ bool UI_context_copy_to_selected_list(struct bContext *C, /* Helpers for Operators */ uiBut *UI_context_active_but_get(const struct bContext *C); +/** + * Version of #UI_context_active_get() that uses the result of #CTX_wm_menu() + * if set. Does not traverse into parent menus, which may be wanted in some + * cases. + */ uiBut *UI_context_active_but_get_respect_menu(const struct bContext *C); +/** + * Version of #UI_context_active_but_get that also returns RNA property info. + * Helper function for insert keyframe, reset to default, etc operators. + * + * \return active button, NULL if none found or if it doesn't contain valid RNA data. + */ uiBut *UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, @@ -2626,12 +3030,18 @@ void UI_context_active_but_prop_handle(struct bContext *C); void UI_context_active_but_clear(struct bContext *C, struct wmWindow *win, struct ARegion *region); struct wmOperator *UI_context_active_operator_get(const struct bContext *C); +/** + * Helper function for insert keyframe, reset to default, etc operators. + */ 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, bool *r_is_userdef); +/** + * For new/open operators. + */ void UI_context_active_but_prop_get_templateID(struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop); @@ -2642,6 +3052,9 @@ uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct r uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region, const int xy[2], bool only_clip); +/** + * Try to find a search-box region opened from a button in \a button_region. + */ struct ARegion *UI_region_searchbox_region_get(const struct ARegion *button_region); /* uiFontStyle.align */ @@ -2672,12 +3085,24 @@ void UI_fontstyle_draw(const struct uiFontStyle *fs, const char *str, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params); +/** + * Drawn same as above, but at 90 degree angle. + */ void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, const uchar col[4]); +/** + * Similar to #UI_fontstyle_draw + * but ignore alignment, shadow & no clipping rect. + * + * For drawing on-screen labels. + */ void UI_fontstyle_draw_simple( const struct uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]); +/** + * Same as #UI_fontstyle_draw but draw a colored backdrop. + */ void UI_fontstyle_draw_simple_backdrop(const struct uiFontStyle *fs, float x, float y, @@ -2687,15 +3112,30 @@ void UI_fontstyle_draw_simple_backdrop(const struct uiFontStyle *fs, int UI_fontstyle_string_width(const struct uiFontStyle *fs, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); +/** + * Return the width of `str` with the spacing & kerning of `fs` with `aspect` + * (representing #uiBlock.aspect) applied. + * + * When calculating text width, the UI layout logic calculate widths without scale, + * only applying scale when drawing. This causes problems for fonts since kerning at + * smaller sizes often makes them wider than a scaled down version of the larger text. + * Resolve this by calculating the text at the on-screen size, + * returning the result scaled back to 1:1. See T92361. + */ int UI_fontstyle_string_width_with_block_aspect(const struct uiFontStyle *fs, const char *str, const float aspect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); int UI_fontstyle_height_max(const struct uiFontStyle *fs); +/** + * Triangle 'icon' for panel header and other cases. + */ void UI_draw_icon_tri(float x, float y, char dir, const float[4]); -const struct uiStyle *UI_style_get(void); /* use for fonts etc */ +/* XXX: read a style configure */ +const struct uiStyle *UI_style_get(void); /* use for fonts etc */ +/* for drawing, scaled with DPI setting */ const struct uiStyle *UI_style_get_dpi(void); /* DPI scaled settings for drawing */ /* linker workaround ack! */ @@ -2704,25 +3144,56 @@ void UI_template_fix_linking(void); /* UI_OT_editsource helpers */ bool UI_editsource_enable_check(void); void UI_editsource_active_but_test(uiBut *but); +/** + * Remove the editsource data for \a old_but and reinsert it for \a new_but. Use when the button + * was reallocated, e.g. to have a new type (#ui_but_change_type()). + */ void UI_editsource_but_replace(const uiBut *old_but, uiBut *new_but); +/** + * Adjust the view so the rectangle of \a but is in view, with some extra margin. + * + * It's important that this is only executed after buttons received their final #uiBut.rect. E.g. + * #UI_panels_end() modifies them, so if that is executed, this function must not be called before + * it. + * + * \param region: The region the button is placed in. Make sure this is actually the one the button + * is placed in, not just the context region. + */ void UI_but_ensure_in_view(const struct bContext *C, struct ARegion *region, const uiBut *but); /* UI_butstore_ helpers */ typedef struct uiButStore uiButStore; typedef struct uiButStoreElem uiButStoreElem; +/** + * Create a new button store, the caller must manage and run #UI_butstore_free + */ uiButStore *UI_butstore_create(uiBlock *block); +/** + * NULL all pointers, don't free since the owner needs to be able to inspect. + */ void UI_butstore_clear(uiBlock *block); +/** + * Map freed buttons from the old block and update pointers. + */ void UI_butstore_update(uiBlock *block); void UI_butstore_free(uiBlock *block, uiButStore *bs); bool UI_butstore_is_valid(uiButStore *bs); bool UI_butstore_is_registered(uiBlock *block, uiBut *but); void UI_butstore_register(uiButStore *bs_handle, uiBut **but_p); +/** + * Update the pointer for a registered button. + */ bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src); void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); /* ui_interface_region_tooltip.c */ + +/** + * \param is_label: When true, show a small tip that only shows the name, otherwise show the full + * tooltip. + */ struct ARegion *UI_tooltip_create_from_button(struct bContext *C, struct ARegion *butregion, uiBut *but, @@ -2744,6 +3215,13 @@ typedef struct { char hint[UI_MAX_DRAW_STR]; } uiSearchItemTooltipData; +/** + * Create a tooltip from search-item tooltip data \a item_tooltip data. + * To be called from a callback set with #UI_but_func_search_set_tooltip(). + * + * \param item_rect: Rectangle of the search item in search region space (#ui_searchbox_butrect()) + * which is passed to the tooltip callback. + */ struct ARegion *UI_tooltip_create_from_search_item_generic( struct bContext *C, const struct ARegion *searchbox_region, @@ -2762,6 +3240,10 @@ struct ARegion *UI_tooltip_create_from_search_item_generic( /* Typical UI text */ #define UI_FSTYLE_WIDGET (const uiFontStyle *)&(UI_style_get()->widget) +/** + * Returns the best "UI" precision for given floating value, + * so that e.g. 10.000001 rather gets drawn as '10'... + */ int UI_calc_float_precision(int prec, double value); /* widget batched drawing */ @@ -2770,6 +3252,12 @@ void UI_widgetbase_draw_cache_flush(void); void UI_widgetbase_draw_cache_end(void); /* Use for resetting the theme. */ +/** + * Initialize default theme. + * + * \note When you add new colors, created & saved themes need initialized + * use function below, #init_userdef_do_versions. + */ void UI_theme_init_default(void); void UI_style_init_default(void); @@ -2783,14 +3271,28 @@ void UI_interface_tag_script_reload(void); bool UI_tree_view_item_is_active(const uiTreeViewItemHandle *item); bool UI_tree_view_item_matches(const uiTreeViewItemHandle *a, const uiTreeViewItemHandle *b); +/** + * Attempt to start dragging the tree-item \a item_. This will not work if the tree item doesn't + * support dragging, i.e. it won't create a drag-controller upon request. + * \return True if dragging started successfully, otherwise false. + */ bool UI_tree_view_item_drag_start(struct bContext *C, uiTreeViewItemHandle *item_); bool UI_tree_view_item_can_drop(const uiTreeViewItemHandle *item_, const struct wmDrag *drag, const char **r_disabled_hint); char *UI_tree_view_item_drop_tooltip(const uiTreeViewItemHandle *item, const struct wmDrag *drag); +/** + * Let a tree-view item handle a drop event. + * \return True if the drop was handled by the tree-view item. + */ bool UI_tree_view_item_drop_handle(struct bContext *C, uiTreeViewItemHandle *item_, const struct ListBase *drags); +/** + * Can \a item_handle be renamed right now? Not that this isn't just a mere wrapper around + * #AbstractTreeViewItem::can_rename(). This also checks if there is another item being renamed, + * and returns false if so. + */ bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle); void UI_tree_view_item_begin_rename(uiTreeViewItemHandle *item_handle); @@ -2798,6 +3300,9 @@ void UI_tree_view_item_context_menu_build(struct bContext *C, const uiTreeViewItemHandle *item, uiLayout *column); +/** + * \param x, y: Coordinate to find a tree-row item at, in window space. + */ uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2); uiTreeViewItemHandle *UI_block_tree_view_find_active_item(const struct ARegion *region); diff --git a/source/blender/editors/include/UI_interface.hh b/source/blender/editors/include/UI_interface.hh index b14ee6c4a59..d18ec009108 100644 --- a/source/blender/editors/include/UI_interface.hh +++ b/source/blender/editors/include/UI_interface.hh @@ -66,6 +66,9 @@ void attribute_search_add_items( } // namespace blender::ui +/** + * Override this for all available tree types. + */ blender::ui::AbstractTreeView *UI_block_add_view( uiBlock &block, blender::StringRef idname, diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 37cf7229ffb..242b8504ae1 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -64,23 +64,39 @@ typedef enum eAlertIcon { struct ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon); -/* +/** * Resizable Icons for Blender */ void UI_icons_init(void); +/** + * Reload the textures for internal icons. + * This function will release the previous textures. + */ void UI_icons_reload_internal_textures(void); +/** + * NOTE: returns unscaled by DPI. + */ int UI_icon_get_width(int icon_id); int UI_icon_get_height(int icon_id); bool UI_icon_get_theme_color(int icon_id, unsigned char color[4]); +/** + * Note that if an ID doesn't support jobs for preview creation, \a use_job will be ignored. + */ void UI_icon_render_id(const struct bContext *C, struct Scene *scene, struct ID *id, const enum eIconSizes size, const bool use_job); +/** + * Render size for preview images and icons + */ int UI_icon_preview_to_render_size(enum eIconSizes size); +/** + * Draws icon with dpi scale factor. + */ 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, float aspect, float alpha, int size); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 61da496d344..98e141c65b5 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -351,7 +351,7 @@ typedef enum ThemeColorID { TH_VERTEX_BEVEL, } ThemeColorID; -/* specific defines per space should have higher define values */ +/* Specific defines per space should have higher define values. */ struct bTheme; @@ -362,93 +362,144 @@ struct bThemeState { /* THE CODERS API FOR THEMES: */ -/* returns one value, not scaled */ +/** + * Get individual values, not scaled. + */ float UI_GetThemeValuef(int colorid); +/** + * Get individual values, not scaled. + */ int UI_GetThemeValue(int colorid); +/* Versions of #UI_GetThemeValue & #UI_GetThemeValuef, which take a space-type */ + 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 */ +/** + * 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]); -/* get the color, range 0.0-1.0, complete with shading offset */ +/** + * Get the color, range 0.0-1.0, complete with shading offset. + */ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]); void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]); void UI_GetThemeColorShade4ubv(int colorid, int offset, unsigned char col[4]); -/* get three color values, range 0-255, - * complete with shading offset for the RGB components and blending. */ +/** + * Get three color values, range 0-255, + * complete with shading offset for the RGB components and blending. + */ void UI_GetThemeColorBlendShade3ubv( int colorid1, int colorid2, float fac, int offset, unsigned char col[3]); -/* get four color values, scaled to 0.0-1.0 range */ +/** + * Get four color values, scaled to 0.0-1.0 range. + */ void UI_GetThemeColor4fv(int colorid, float col[4]); -/* get four color values from specified space type, scaled to 0.0-1.0 range */ +/** + * 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]); -/* get four color values, range 0.0-1.0, complete with shading offset for the RGB components */ +/** + * Get four color values, range 0.0-1.0, complete with shading offset for the RGB components. + */ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]); void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]); -/* get four color values ranged between 0 and 255; includes the alpha channel */ +/** + * Get four color values ranged between 0 and 255; includes the alpha channel. + */ void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]); -/* get four color values, range 0.0-1.0, - * complete with shading offset for the RGB components and blending. */ +/** + * Get four color values, range 0.0-1.0, + * complete with shading offset for the RGB components and blending. + */ void UI_GetThemeColorBlendShade3fv( int colorid1, int colorid2, float fac, int offset, float col[3]); void UI_GetThemeColorBlendShade4fv( int colorid1, int colorid2, float fac, int offset, float col[4]); -/* get the 3 or 4 byte values */ +/** + * Get the 3 or 4 byte values. + */ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]); +/** + * Get the color, in char pointer. + */ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]); -/* get a theme color from specified space type */ +/** + * Get a theme color from specified space type. + */ void UI_GetThemeColorType3fv(int colorid, int spacetype, float col[3]); 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 */ +/** + * Get theme color for coloring monochrome icons. + */ bool UI_GetIconThemeColor4ubv(int colorid, unsigned char col[4]); -/* shade a 3 byte color (same as UI_GetColorPtrBlendShade3ubv with 0.0 factor) */ +/** + * 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); -/* get a 3 byte color, blended and shaded between two other char color pointers */ +/** + * Get a 3 byte color, blended and shaded between two other char color pointers. + */ void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset); -/* sets the font color - * (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color) */ +/** + * Sets the font color + * (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color). + */ void UI_FontThemeColor(int fontid, int colorid); -/* Clear the frame-buffer using the input colorid. */ +/** + * Clear the frame-buffer using the input colorid. + */ void UI_ThemeClearColor(int colorid); -/* internal (blender) usage only, for init and set active */ +/** + * Internal (blender) usage only, for init and set active. + */ void UI_SetTheme(int spacetype, int regionid); -/* get current theme */ +/** + * Get current theme. + */ struct bTheme *UI_GetTheme(void); +/** + * For the rare case we need to temp swap in a different theme (off-screen render). + */ void UI_Theme_Store(struct bThemeState *theme_state); void UI_Theme_Restore(struct bThemeState *theme_state); -/* return shadow width outside menus and popups */ +/** + * Return shadow width outside menus and popups. + */ int UI_ThemeMenuShadowWidth(void); -/* only for buttons in theme editor! */ +/** + * Only for buttons in theme editor! + */ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis); diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh index 0a054101e81..64c2ddc06a7 100644 --- a/source/blender/editors/include/UI_tree_view.hh +++ b/source/blender/editors/include/UI_tree_view.hh @@ -141,6 +141,12 @@ class TreeViewLayoutBuilder { /* Created through #TreeViewBuilder. */ TreeViewLayoutBuilder(uiBlock &block); + /** + * Moves the button following the last added chevron closer to the list item. + * + * Iterates backwards over buttons until finding the tree-row button, which is assumed to be the + * first button added for the row, and can act as a delimiter that way. + */ static void polish_layout(const uiBlock &block); }; diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 122e5a7d839..c38c4dc1156 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -118,21 +118,46 @@ typedef struct View2DScrollers View2DScrollers; /* ----------------------------------------- */ /* Prototypes: */ -/* refresh and validation (of view rects) */ +/** + * Refresh and validation (of view rects). + * + * Initialize all relevant View2D data (including view rects if first time) + * and/or refresh mask sizes after view resize. + * + * - For some of these presets, it is expected that the region will have defined some + * additional settings necessary for the customization of the 2D viewport to its requirements + * - This function should only be called from region init() callbacks, where it is expected that + * this is called before #UI_view2d_size_update(), + * as this one checks that the rects are properly initialized. + */ void UI_view2d_region_reinit(struct View2D *v2d, short type, int winx, int winy); void UI_view2d_curRect_validate(struct View2D *v2d); +/** + * Restore 'cur' rect to standard orientation (i.e. optimal maximum view of tot). + * This does not take into account if zooming the view on an axis + * will improve the view (if allowed). + */ void UI_view2d_curRect_reset(struct View2D *v2d); bool UI_view2d_area_supports_sync(struct ScrArea *area); +/** + * Called by menus to activate it, or by view2d operators + * to make sure 'related' views stay in synchrony. + */ void UI_view2d_sync(struct bScreen *screen, struct ScrArea *area, struct View2D *v2dcur, int flag); -/* Perform all required updates after `v2d->cur` as been modified. +/** + * Perform all required updates after `v2d->cur` as been modified. * This includes like validation view validation (#UI_view2d_curRect_validate). * - * Current intent is to use it from user code, such as view navigation and zoom operations. */ + * Current intent is to use it from user code, such as view navigation and zoom operations. + */ void UI_view2d_curRect_changed(const struct bContext *C, struct View2D *v2d); void UI_view2d_totRect_set(struct View2D *v2d, int width, int height); +/** + * Change the size of the maximum viewable area (i.e. 'tot' rect). + */ void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, bool resize); void UI_view2d_mask_from_win(const struct View2D *v2d, struct rcti *r_mask); @@ -140,13 +165,37 @@ void UI_view2d_mask_from_win(const struct View2D *v2d, struct rcti *r_mask); void UI_view2d_zoom_cache_reset(void); /* view matrix operations */ +/** + * Set view matrices to use 'cur' rect as viewing frame for View2D drawing. + */ void UI_view2d_view_ortho(const struct View2D *v2d); +/** + * Set view matrices to only use one axis of 'cur' only + * + * \param xaxis: if non-zero, only use cur x-axis, + * otherwise use cur-yaxis (mostly this will be used for x). + */ void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, const bool xaxis); +/** + * Restore view matrices after drawing. + */ void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ + +/** + * Draw a multi-level grid in given 2d-region. + */ void UI_view2d_multi_grid_draw( const struct View2D *v2d, int colorid, float step, int level_size, int totlevels); +/** + * Draw a multi-level grid of dots, with a dynamic number of levels based on the fading. + * + * \param grid_color_id: The theme color used for the points. Faded dynamically based on zoom. + * \param min_step: The base size of the grid. At different zoom levels, the visible grid may have + * a larger step size. + * \param grid_levels: The maximum grid depth. Larger grid levels will subdivide the grid more. + */ void UI_view2d_dot_grid_draw(const struct View2D *v2d, int grid_color_id, float step, @@ -171,7 +220,9 @@ float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d, bool display_seconds); float UI_view2d_grid_resolution_y__values(const struct View2D *v2d); -/* scale indicator text drawing */ +/** + * Scale indicator text drawing. + */ void UI_view2d_draw_scale_y__values(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect, @@ -193,13 +244,33 @@ void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region, bool display_seconds, int colorid); -/* scrollbar drawing */ +/* Scroll-bar drawing. */ + +/** + * Calculate relevant scroller properties. + */ void UI_view2d_scrollers_calc(struct View2D *v2d, const struct rcti *mask_custom, struct View2DScrollers *r_scrollers); +/** + * Draw scroll-bars in the given 2D-region. + */ void UI_view2d_scrollers_draw(struct View2D *v2d, const struct rcti *mask_custom); -/* list view tools */ +/* List view tools. */ + +/** + * Get the 'cell' (row, column) that the given 2D-view coordinates + * (i.e. in 'tot' rect space) lie in. + * + * \param columnwidth, rowheight: size of each 'cell' + * \param startx, starty: coordinates (in 'tot' rect space) that the list starts from. + * This should be (0,0) for most views. However, for those where the starting row was offsetted + * (like for Animation Editor channel lists, to make the first entry more visible), these will be + * the min-coordinates of the first item. + * \param viewx, viewy: 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for + * \param r_column, r_row: the 'coordinates' of the relevant 'cell' + */ void UI_view2d_listview_view_to_cell(float columnwidth, float rowheight, float startx, @@ -209,9 +280,16 @@ void UI_view2d_listview_view_to_cell(float columnwidth, int *column, int *row); -/* coordinate conversion */ +/* 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); +/** + * Convert from screen/region space to 2d-View space + * + * \param x, y: coordinates to convert + * \param r_view_x, r_view_y: resultant coordinates + */ 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, @@ -220,9 +298,24 @@ void UI_view2d_region_to_view_rctf(const struct View2D *v2d, 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); +/** + * Convert from 2d-View space to screen/region space + * \note Coordinates are clamped to lie within bounds of region + * + * \param x, y: Coordinates to convert. + * \param r_region_x, r_region_y: Resultant coordinates. + */ 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(); +/** + * Convert from 2d-view space to screen/region space + * + * \note Coordinates are NOT clamped to lie within bounds of region. + * + * \param x, y: Coordinates to convert. + * \param r_region_x, r_region_y: Resultant coordinates. + */ void UI_view2d_view_to_region( const struct View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL(); void UI_view2d_view_to_region_fl(const struct View2D *v2d, @@ -238,21 +331,64 @@ bool UI_view2d_view_to_region_rcti_clip(const struct View2D *v2d, const struct rctf *rect_src, struct rcti *rect_dst) ATTR_NONNULL(); -/* utilities */ +/* Utilities. */ + +/** + * View2D data by default resides in region, so get from region stored in context. + */ struct View2D *UI_view2d_fromcontext(const struct bContext *C); +/** + * Same as above, but it returns region-window. Utility for pull-downs or buttons. + */ struct View2D *UI_view2d_fromcontext_rwin(const struct bContext *C); +/** + * Get scrollbar sizes of the current 2D view. + * The size will be zero if the view has its scrollbars disabled. + */ void UI_view2d_scroller_size_get(const struct View2D *v2d, float *r_x, float *r_y); +/** + * Calculate the scale per-axis of the drawing-area + * + * Is used to inverse correct drawing of icons, etc. that need to follow view + * but not be affected by scale + * + * \param r_x, r_y: scale on each axis + */ void UI_view2d_scale_get(const struct View2D *v2d, float *r_x, float *r_y); float UI_view2d_scale_get_x(const struct View2D *v2d); float UI_view2d_scale_get_y(const struct View2D *v2d); +/** + * Same as `UI_view2d_scale_get() - 1.0f / x, y`. + */ void UI_view2d_scale_get_inverse(const struct View2D *v2d, float *r_x, float *r_y); +/** + * Simple functions for consistent center offset access. + * Used by node editor to shift view center for each individual node tree. + */ void UI_view2d_center_get(const struct View2D *v2d, float *r_x, float *r_y); void UI_view2d_center_set(struct View2D *v2d, float x, float y); +/** + * Simple pan function + * (0.0, 0.0) bottom left + * (0.5, 0.5) center + * (1.0, 1.0) top right. + */ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac); +/** + * Check if mouse is within scrollers + * + * \param x, y: Mouse coordinates in screen (not region) space. + * \param r_scroll: Mapped view2d scroll flag. + * + * \return appropriate code for match. + * - 'h' = in horizontal scroller. + * - 'v' = in vertical scroller. + * - 0 = not in scroller. + */ char UI_view2d_mouse_in_scrollers_ex(const struct ARegion *region, const struct View2D *v2d, const int xy[2], @@ -268,13 +404,18 @@ char UI_view2d_rect_in_scrollers(const struct ARegion *region, const struct View2D *v2d, const struct rcti *rect) ATTR_NONNULL(1, 2, 3); -/* cached text drawing in v2d, to allow pixel-aligned draw as post process */ +/** + * 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 unsigned char col[4]); +/** + * No clip (yet). + */ void UI_view2d_text_cache_add_rectf(struct View2D *v2d, const struct rctf *rect_view, const char *str, @@ -282,10 +423,15 @@ void UI_view2d_text_cache_add_rectf(struct View2D *v2d, const unsigned char col[4]); void UI_view2d_text_cache_draw(struct ARegion *region); -/* operators */ +/* Operators. */ + void ED_operatortypes_view2d(void); void ED_keymap_view2d(struct wmKeyConfig *keyconf); +/** + * Will start timer if appropriate. + * the arguments are the desired situation. + */ void UI_view2d_smooth_view(struct bContext *C, struct ARegion *region, const struct rctf *cur, @@ -294,13 +440,16 @@ void UI_view2d_smooth_view(struct bContext *C, #define UI_MARKER_MARGIN_Y (42 * UI_DPI_FAC) #define UI_TIME_SCRUB_MARGIN_Y (23 * UI_DPI_FAC) -/* Gizmo Types */ +/* Gizmo Types. */ /* view2d_gizmo_navigate.c */ -/* Caller passes in own idname. */ + +/** + * Caller defines the name for gizmo group. + */ void VIEW2D_GGT_navigate_impl(struct wmGizmoGroupType *gzgt, const char *idname); -/* Edge pan */ +/* Edge pan. */ /** * Custom-data for view panning operators. @@ -361,11 +510,15 @@ void UI_view2d_edge_pan_init(struct bContext *C, void UI_view2d_edge_pan_reset(struct View2DEdgePanData *vpd); -/* Apply transform to view (i.e. adjust 'cur' rect). */ +/** + * Apply transform to view (i.e. adjust 'cur' rect). + */ void UI_view2d_edge_pan_apply(struct bContext *C, struct View2DEdgePanData *vpd, const int xy[2]) ATTR_NONNULL(1, 2, 3); -/* Apply transform to view using mouse events. */ +/** + * Apply transform to view using mouse events. + */ void UI_view2d_edge_pan_apply_event(struct bContext *C, struct View2DEdgePanData *vpd, const struct wmEvent *event); @@ -382,7 +535,9 @@ void UI_view2d_edge_pan_operator_properties_ex(struct wmOperatorType *ot, float delay, float zoom_influence); -/* Initialize panning data with operator settings. */ +/** + * Initialize panning data with operator settings. + */ void UI_view2d_edge_pan_operator_init(struct bContext *C, struct View2DEdgePanData *vpd, struct wmOperator *op); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f1c207d7326..27ec600943b 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -202,7 +202,6 @@ float ui_block_to_window_scale(const ARegion *region, uiBlock *block) return max_y - min_y; } -/* for mouse cursor */ void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *r_x, float *r_y) { const int getsizex = BLI_rcti_size_x(®ion->winrct) + 1; @@ -356,10 +355,6 @@ static void ui_update_window_matrix(const wmWindow *window, const ARegion *regio } } -/** - * Popups will add a margin to #ARegion.winrct for shadow, - * for interactivity (point-inside tests for eg), we want the winrct without the margin added. - */ void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect) { uiBlock *block = region->uiblocks.first; @@ -600,7 +595,6 @@ static void ui_block_bounds_calc_popup( } } -/* used for various cases */ void UI_block_bounds_set_normal(uiBlock *block, int addval) { if (block == NULL) { @@ -611,14 +605,12 @@ void UI_block_bounds_set_normal(uiBlock *block, int addval) block->bounds_type = UI_BLOCK_BOUNDS; } -/* Used for pull-downs. */ void UI_block_bounds_set_text(uiBlock *block, int addval) { block->bounds = addval; block->bounds_type = UI_BLOCK_BOUNDS_TEXT; } -/* used for block popups */ void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2]) { block->bounds = addval; @@ -633,7 +625,6 @@ void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offs } } -/* used for menu popups */ void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2]) { block->bounds = addval; @@ -646,7 +637,6 @@ void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offse } } -/* used for centered popups, i.e. splash */ void UI_block_bounds_set_centered(uiBlock *block, int addval) { block->bounds = addval; @@ -988,11 +978,6 @@ static bool ui_but_update_from_old_block(const bContext *C, return found_active; } -/** - * Needed for temporarily rename buttons, such as in outliner or file-select, - * they should keep calling #uiDefBut to keep them alive. - * \return false when button removed. - */ bool UI_but_active_only_ex( const bContext *C, ARegion *region, uiBlock *block, uiBut *but, const bool remove_on_failure) { @@ -1040,10 +1025,6 @@ bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBu return UI_but_active_only_ex(C, region, block, but, true); } -/** - * \warning This must run after other handlers have been added, - * otherwise the handler won't be removed, see: T71112. - */ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block) { /* Running this command before end-block has run, means buttons that open menus @@ -1074,7 +1055,6 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, ui return done; } -/* simulate button click */ void UI_but_execute(const bContext *C, ARegion *region, uiBut *but) { void *active_back; @@ -1187,9 +1167,6 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) } } -/* XXX, this code will shorten any allocated string to 'UI_MAX_NAME_STR' - * since this is really long its unlikely to be an issue, - * but this could be supported */ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip) { if (do_strip && (but->flag & UI_BUT_HAS_SEP_CHAR)) { @@ -1856,11 +1833,6 @@ static void ui_but_validate(const uiBut *but) } #endif -/** - * Check if the operator \a ot poll is successful with the context given by \a but (optionally). - * \param but: The button that might store context. Can be NULL for convenience (e.g. if there is - * no button to take context from, but we still want to poll the operator). - */ bool ui_but_context_poll_operator_ex(bContext *C, const uiBut *but, const wmOperatorCallParams *optype_params) @@ -2016,7 +1988,6 @@ static bool ui_but_pixelrect_in_view(const ARegion *region, const rcti *rect) return BLI_rcti_isect(®ion->winrct, &rect_winspace, NULL); } -/* uses local copy of style, to scale things down, and allow widgets to change stuff */ void UI_block_draw(const bContext *C, uiBlock *block) { uiStyle style = *UI_style_get_dpi(); /* XXX pass on as arg */ @@ -2138,11 +2109,6 @@ void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus) /* ************* EVENTS ************* */ -/** - * Check if the button is pushed, this is only meaningful for some button types. - * - * \return (0 == UNSELECT), (1 == SELECT), (-1 == DO-NOTHING) - */ int ui_but_is_pushed_ex(uiBut *but, double *value) { int is_push = 0; @@ -2278,7 +2244,6 @@ void UI_block_lock_clear(uiBlock *block) * this either works with the pointed to data, or can work with * an edit override pointer while dragging for example */ -/* for buttons pointing to color for example */ void ui_but_v3_get(uiBut *but, float vec[3]) { if (but->editvec) { @@ -2326,7 +2291,6 @@ void ui_but_v3_get(uiBut *but, float vec[3]) } } -/* for buttons pointing to color for example */ void ui_but_v3_set(uiBut *but, const float vec[3]) { if (but->editvec) { @@ -2438,9 +2402,6 @@ bool ui_but_is_unit(const uiBut *but) return true; } -/** - * Check if this button is similar enough to be grouped with another. - */ bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) { if (but_a->type != but_b->type) { @@ -2476,9 +2437,6 @@ bool ui_but_is_rna_valid(uiBut *but) return false; } -/** - * Checks if the button supports cycling next/previous menu items (ctrl+mouse-wheel). - */ bool ui_but_supports_cycling(const uiBut *but) { return (ELEM(but->type, UI_BTYPE_ROW, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_LISTBOX) || @@ -2685,7 +2643,6 @@ static double ui_get_but_scale_unit(uiBut *but, double value) return BKE_scene_unit_scale(unit, RNA_SUBTYPE_UNIT_VALUE(unit_type), value); } -/* str will be overwritten */ void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) { if (!ui_but_is_unit(but)) { @@ -2777,12 +2734,6 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) return (float)step_final; } -/** - * \param float_precision: For number buttons the precision - * to use or -1 to fallback to the button default. - * \param use_exp_float: Use exponent representation of floats - * when out of reasonable range (outside of 1e3/1e-3). - */ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, @@ -2908,12 +2859,6 @@ void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ui_but_string_get_ex(but, str, maxlen, -1, false, NULL); } -/** - * A version of #ui_but_string_get_ex for dynamic buffer sizes - * (where #ui_but_string_get_max_length returns 0). - * - * \param r_str_size: size of the returned string (including terminator). - */ char *ui_but_string_get_dynamic(uiBut *but, int *r_str_size) { char *str = NULL; @@ -3272,9 +3217,10 @@ void ui_but_range_set_hard(uiBut *but) } } -/* NOTE: this could be split up into functions which handle arrays and not. */ void ui_but_range_set_soft(uiBut *but) { + /* This could be split up into functions which handle arrays and not. */ + /* Ideally we would not limit this, but practically it's more than * enough. Worst case is very long vectors won't use a smart soft-range, * which isn't so bad. */ @@ -3449,7 +3395,6 @@ static void ui_but_free(const bContext *C, uiBut *but) MEM_freeN(but); } -/* can be called with C==NULL */ void UI_block_free(const bContext *C, uiBlock *block) { UI_butstore_clear(block); @@ -3508,7 +3453,6 @@ void UI_blocklist_draw(const bContext *C, const ListBase *lb) } } -/* can be called with C==NULL */ void UI_blocklist_free(const bContext *C, ARegion *region) { ListBase *lb = ®ion->uiblocks; @@ -3638,10 +3582,6 @@ bool UI_block_is_search_only(const uiBlock *block) return block->flag & UI_BLOCK_SEARCH_ONLY; } -/** - * Use when a block must be searched to give accurate results - * for the whole region but shouldn't be displayed. - */ void UI_block_set_search_only(uiBlock *block, bool search_only) { SET_FLAG_FROM_TEST(block->flag, search_only, UI_BLOCK_SEARCH_ONLY); @@ -4013,13 +3953,6 @@ static uiBut *ui_but_alloc(const eButType type) return MEM_callocN(alloc_size, alloc_str); } -/** - * Reallocate the button (new address is returned) for a new button type. - * This should generally be avoided and instead the correct type be created right away. - * - * \note Only the #uiBut data can be kept. If the old button used a derived type (e.g. #uiButTab), - * the data that is not inside #uiBut will be lost. - */ uiBut *ui_but_change_type(uiBut *but, eButType new_type) { if (but->type == new_type) { @@ -4253,9 +4186,6 @@ void ui_def_but_icon(uiBut *but, const int icon, const int flag) } } -/** - * Avoid using this where possible since it's better not to ask for an icon in the first place. - */ void ui_def_but_icon_clear(uiBut *but) { but->icon = ICON_NONE; @@ -5309,7 +5239,6 @@ uiBut *uiDefButO(uiBlock *block, return uiDefButO_ptr(block, type, ot, opcontext, str, x, y, width, height, tip); } -/* if a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0) */ uiBut *uiDefIconBut(uiBlock *block, int type, int retval, @@ -5689,7 +5618,6 @@ uiBut *uiDefIconButO(uiBlock *block, return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x, y, width, height, tip); } -/* Button containing both string label and icon */ uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, @@ -6120,7 +6048,6 @@ void UI_block_direction_set(uiBlock *block, char direction) block->direction = direction; } -/* this call escapes if there's alignment flags */ void UI_block_order_flip(uiBlock *block) { float centy, miny = 10000, maxy = -10000; @@ -6224,19 +6151,12 @@ void UI_but_drag_set_id(uiBut *but, ID *id) but->dragpoin = (void *)id; } -/** - * Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`). - * Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image. - */ void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale) { but->imb = imb; but->imb_scale = scale; } -/** - * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. - */ void UI_but_drag_set_asset(uiBut *but, const AssetHandle *asset, const char *path, @@ -6298,7 +6218,6 @@ void UI_but_drag_set_name(uiBut *but, const char *name) but->dragpoin = (void *)name; } -/* value from button itself */ void UI_but_drag_set_value(uiBut *but) { but->dragtype = WM_DRAG_VALUE; @@ -6561,7 +6480,6 @@ uiBut *uiDefIconMenuBut(uiBlock *block, return but; } -/* Block button containing both string label and icon */ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, @@ -6590,7 +6508,6 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, return but; } -/* Block button containing icon */ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, @@ -6643,8 +6560,6 @@ uiBut *uiDefKeyevtButS(uiBlock *block, return but; } -/* short pointers hardcoded */ -/* modkeypoin will be set to KM_SHIFT, KM_ALT, KM_CTRL, KM_OSKEY bits */ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, @@ -6675,8 +6590,6 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, return but; } -/* arg is pointer to string/name, use UI_but_func_search_set() below to make this work */ -/* here a1 and a2, if set, control thumbnail preview rows/cols */ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, @@ -6702,21 +6615,6 @@ uiBut *uiDefSearchBut(uiBlock *block, return but; } -/** - * \note The item-pointer (referred to below) is a per search item user pointer - * passed to #UI_search_item_add (stored in #uiSearchItems.pointers). - * - * \param search_create_fn: Function to create the menu. - * \param search_update_fn: Function to refresh search content after the search text has changed. - * \param arg: user value. - * \param free_arg: Set to true if the argument is newly allocated memory for every redraw and - * should be freed when the button is destroyed. - * \param search_arg_free_fn: When non-null, use this function to free \a arg. - * \param search_exec_fn: Function that executes the action, gets \a arg as the first argument. - * The second argument as the active item-pointer - * \param active: When non-null, this item-pointer item will be visible and selected, - * otherwise the first item will be selected. - */ void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, @@ -6783,10 +6681,6 @@ void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn co but_search->item_context_menu_fn = context_menu_fn; } -/** - * \param search_sep_string: when not NULL, this string is used as a separator, - * showing the icon and highlighted text after the last instance of this string. - */ void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string) { uiButSearch *but_search = (uiButSearch *)but; @@ -6883,10 +6777,6 @@ static void operator_enum_search_exec_fn(struct bContext *UNUSED(C), void *but, } } -/** - * Same parameters as for uiDefSearchBut, with additional operator type and properties, - * used by callback to call again the right op with the right options (properties values). - */ uiBut *uiDefSearchButO_ptr(uiBlock *block, wmOperatorType *ot, IDProperty *properties, @@ -6933,9 +6823,6 @@ void UI_but_treerow_indentation_set(uiBut *but, int indentation) BLI_assert(indentation >= 0); } -/** - * Adds a hint to the button which draws right aligned, grayed out and never clipped. - */ void UI_but_hint_drawstr_set(uiBut *but, const char *string) { ui_but_add_shortcut(but, string, false); @@ -6967,10 +6854,6 @@ void UI_but_number_precision_set(uiBut *but, float precision) BLI_assert(precision > -2); } -/** - * push a new event onto event queue to activate the given button - * (usually a text-field) upon entering a popup - */ void UI_but_focus_on_enter_event(wmWindow *win, uiBut *but) { wmEvent event; @@ -7273,7 +7156,6 @@ void UI_init(void) ui_resources_init(); } -/* after reading userdef file */ void UI_init_userdef(void) { /* Initialize UI variables from values set in the preferences. */ diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c index 3149675ac04..35af557a560 100644 --- a/source/blender/editors/interface/interface_align.c +++ b/source/blender/editors/interface/interface_align.c @@ -377,13 +377,6 @@ static void ui_block_align_but_to_region(uiBut *but, const ARegion *region) } } -/** - * Compute the alignment of all 'align groups' of buttons in given block. - * - * This is using an order-independent algorithm, - * i.e. alignment of buttons should be OK regardless of order in which - * they are added to the block. - */ void ui_block_align_calc(uiBlock *block, const ARegion *region) { int num_buttons = 0; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 3101b3222c4..1d6623f3490 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -180,10 +180,6 @@ void ui_but_anim_decorate_update_from_flag(uiButDecorator *decorator_but) but->flag = (but->flag & ~flag_copy) | (flag & flag_copy); } -/** - * \a str can be NULL to only perform check if \a but has an expression at all. - * \return if button has an expression. - */ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; @@ -241,7 +237,6 @@ bool ui_but_anim_expression_set(uiBut *but, const char *str) return false; } -/* create new expression for button (i.e. a "scripted driver"), if it can be created... */ bool ui_but_anim_expression_create(uiBut *but, const char *str) { bContext *C = but->block->evil_C; diff --git a/source/blender/editors/interface/interface_button_group.c b/source/blender/editors/interface/interface_button_group.c index 7054498d469..6449e1eb329 100644 --- a/source/blender/editors/interface/interface_button_group.c +++ b/source/blender/editors/interface/interface_button_group.c @@ -28,10 +28,6 @@ /** \name Button Groups * \{ */ -/** - * Every function that adds a set of buttons must create another group, - * then #ui_def_but adds buttons to the current group (the last). - */ void ui_block_new_button_group(uiBlock *block, uiButtonGroupFlag flag) { /* Don't create a new group if there is a "lock" on new groups. */ diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 72e7203c6ea..190b2d12ed9 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -1242,9 +1242,6 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev /** \name Panel Context Menu * \{ */ -/** - * menu to show when right clicking on the panel header - */ void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *panel) { bScreen *screen = CTX_wm_screen(C); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 191eb6b5585..285c82b0fb3 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -194,8 +194,6 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -/* based on UI_draw_roundbox_gl_mode, - * check on making a version which allows us to skip some sides */ void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], @@ -348,14 +346,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), #endif } -/** - * Draw title and text safe areas. - * - * \note This function is to be used with the 2D dashed shader enabled. - * - * \param pos: is a #PRIM_FLOAT, 2, #GPU_FETCH_FLOAT vertex attribute. - * \param x1, x2, y1, y2: The offsets for the view, not the zones. - */ void UI_draw_safe_areas(uint pos, const rctf *rect, const float title_aspect[2], @@ -1753,9 +1743,6 @@ static bool point_draw_handles(CurveProfilePoint *point) ELEM(point->flag, PROF_H1_SELECT, PROF_H2_SELECT); } -/** - * Draws the curve profile widget. Somewhat similar to ui_draw_but_CURVE. - */ void ui_draw_but_CURVEPROFILE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 395ecc77ef4..08ff05e517b 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -141,15 +141,6 @@ void eyedropper_draw_cursor_text_region(const int x, const int y, const char *na eyedropper_draw_cursor_text_ex(x, y, name); } -/** - * Utility to retrieve a button representing a RNA property that is currently under the cursor. - * - * This is to be used by any eyedroppers which fetch properties (e.g. UI_OT_eyedropper_driver). - * Especially during modal operations (e.g. as with the eyedroppers), context cannot be relied - * upon to provide this information, as it is not updated until the operator finishes. - * - * \return A button under the mouse which relates to some RNA Property, or NULL - */ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index e45619d89e8..0ac6ea4021b 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -322,13 +322,6 @@ static bool eyedropper_cryptomatte_sample_fl( return false; } -/** - * \brief get the color from the screen. - * - * Special check for image or nodes where we MAY have HDR pixels which don't display. - * - * \note Exposed by 'interface_eyedropper_intern.h' for use with color band picking. - */ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) { /* we could use some clever */ diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h index f9f3fcfb5d1..17bb78a7861 100644 --- a/source/blender/editors/interface/interface_eyedropper_intern.h +++ b/source/blender/editors/interface/interface_eyedropper_intern.h @@ -23,8 +23,18 @@ #pragma once /* interface_eyedropper.c */ + void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name); void eyedropper_draw_cursor_text_region(const int x, const int y, const char *name); +/** + * Utility to retrieve a button representing a RNA property that is currently under the cursor. + * + * This is to be used by any eyedroppers which fetch properties (e.g. UI_OT_eyedropper_driver). + * Especially during modal operations (e.g. as with the eyedroppers), context cannot be relied + * upon to provide this information, as it is not updated until the operator finishes. + * + * \return A button under the mouse which relates to some RNA Property, or NULL + */ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event); void datadropper_win_area_find(const struct bContext *C, const int mval[2], @@ -33,6 +43,14 @@ void datadropper_win_area_find(const struct bContext *C, struct ScrArea **r_area); /* interface_eyedropper_color.c (expose for color-band picker) */ + +/** + * \brief get the color from the screen. + * + * Special check for image or nodes where we MAY have HDR pixels which don't display. + * + * \note Exposed by 'interface_eyedropper_intern.h' for use with color band picking. + */ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]); /* Used for most eye-dropper operators. */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 14df5ec68ac..637ab822067 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -555,7 +555,6 @@ bool ui_but_is_editing(const uiBut *but) return (data && ELEM(data->state, BUTTON_STATE_TEXT_EDITING, BUTTON_STATE_NUM_EDITING)); } -/* assumes event type is MOUSEPAN */ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val) { static int lastdy = 0; @@ -594,11 +593,6 @@ static bool ui_but_find_select_in_enum__cmp(const uiBut *but_a, const uiBut *but (but_a->rnaprop == but_b->rnaprop)); } -/** - * Finds the pressed button in an aligned row (typically an expanded enum). - * - * \param direction: Use when there may be multiple buttons pressed. - */ uiBut *ui_but_find_select_in_enum(uiBut *but, int direction) { uiBut *but_iter = but; @@ -2992,11 +2986,6 @@ void ui_but_text_password_hide(char password_str[UI_MAX_PASSWORD_STR], /** \name Button Text Selection/Editing * \{ */ -/** - * Use handling code to set a string for the button. Handles the case where the string is set for a - * search button while the search menu is open, so the results are updated accordingly. - * This is basically the same as pasting the string into the button. - */ void ui_but_set_string_interactive(bContext *C, uiBut *but, const char *value) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); @@ -8191,9 +8180,6 @@ static void ui_blocks_set_tooltips(ARegion *region, const bool enable) } } -/** - * Recreate tool-tip (use to update dynamic tips) - */ void UI_but_tooltip_refresh(bContext *C, uiBut *but) { uiHandleButtonData *data = but->active; @@ -8205,10 +8191,6 @@ void UI_but_tooltip_refresh(bContext *C, uiBut *but) } } -/** - * Removes tool-tip timer from active but - * (meaning tool-tip is disabled until it's re-enabled again). - */ void UI_but_tooltip_timer_remove(bContext *C, uiBut *but) { uiHandleButtonData *data = but->active; @@ -8776,11 +8758,6 @@ uiBut *UI_context_active_but_get(const bContext *C) return ui_context_button_active(CTX_wm_region(C), NULL); } -/* - * Version of #UI_context_active_get() that uses the result of #CTX_wm_menu() - * if set. Does not traverse into parent menus, which may be wanted in some - * cases. - */ uiBut *UI_context_active_but_get_respect_menu(const bContext *C) { ARegion *region_menu = CTX_wm_menu(C); @@ -8804,12 +8781,6 @@ uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region, return ui_block_find_mouse_over_ex(region, xy, only_clip); } -/** - * Version of #UI_context_active_but_get that also returns RNA property info. - * Helper function for insert keyframe, reset to default, etc operators. - * - * \return active button, NULL if none found or if it doesn't contain valid RNA data. - */ uiBut *UI_context_active_but_prop_get(const bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, @@ -8885,16 +8856,12 @@ wmOperator *UI_context_active_operator_get(const struct bContext *C) return NULL; } -/** - * Try to find a search-box region opened from a button in \a button_region. - */ ARegion *UI_region_searchbox_region_get(const ARegion *button_region) { uiBut *but = UI_region_active_but_get(button_region); return (but != NULL) ? but->active->searchbox : NULL; } -/* helper function for insert keyframe, reset to default, etc operators */ void UI_context_update_anim_flag(const bContext *C) { Scene *scene = CTX_data_scene(C); @@ -8943,10 +8910,6 @@ void UI_context_update_anim_flag(const bContext *C) } } -/** - * In some cases we may want to update the view (#View2D) in-between layout definition and drawing. - * E.g. to make sure a button is visible while editing. - */ void ui_but_update_view_for_active(const bContext *C, const uiBlock *block) { uiBut *active_but = ui_block_active_but_get(block); @@ -9006,11 +8969,6 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *reg return WM_UI_HANDLER_CONTINUE; } -/** - * Exported to interface.c: #UI_but_active_only() - * \note The region is only for the button. - * The context needs to be set by the caller. - */ void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but) { wmWindow *win = CTX_wm_window(C); @@ -9028,12 +8986,6 @@ void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but) ui_do_button(C, but->block, but, &event); } -/** - * Simulate moving the mouse over a button (or navigating to it with arrow keys). - * - * exported so menus can start with a highlighted button, - * even if the mouse isn't over it - */ void ui_but_activate_over(bContext *C, ARegion *region, uiBut *but) { button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER); @@ -11273,10 +11225,6 @@ static int ui_handle_menus_recursive(bContext *C, return retval; } -/** - * Allow setting menu return value from externals. - * E.g. WM might need to do this for exiting files correctly. - */ void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable) { uiPopupBlockHandle *menu = block->handle; @@ -11686,7 +11634,6 @@ void UI_region_free_active_but_all(bContext *C, ARegion *region) } } -/* is called by notifier */ void UI_screen_free_active_but_highlight(const bContext *C, bScreen *screen) { wmWindow *win = CTX_wm_window(C); @@ -11721,8 +11668,6 @@ uiBut *UI_but_active_drop_name_button(const bContext *C) return NULL; } -/* returns true if highlighted button allows drop of names */ -/* called in region context */ bool UI_but_active_drop_name(const bContext *C) { return UI_but_active_drop_name_button(C) != NULL; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 311965ac502..ca5d08ba40e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -830,8 +830,6 @@ static void free_icons_textures(void) } } -/* Reload the textures for internal icons. - * This function will release the previous textures. */ void UI_icons_reload_internal_textures(void) { bTheme *btheme = UI_GetTheme(); @@ -1182,7 +1180,6 @@ static DrawInfo *icon_ensure_drawinfo(Icon *icon) return di; } -/* NOTE:, returns unscaled by DPI. */ int UI_icon_get_width(int icon_id) { Icon *icon = BKE_icon_get(icon_id); @@ -1242,8 +1239,6 @@ void UI_icons_init() #endif } -/* Render size for preview images and icons - */ int UI_icon_preview_to_render_size(enum eIconSizes size) { switch (size) { @@ -2031,9 +2026,6 @@ static void ui_id_preview_image_render_size( } } -/** - * Note that if an ID doesn't support jobs for preview creation, \a use_job will be ignored. - */ void UI_icon_render_id( const bContext *C, Scene *scene, ID *id, const enum eIconSizes size, const bool use_job) { @@ -2473,7 +2465,6 @@ int UI_icon_color_from_collection(const Collection *collection) return icon; } -/* draws icon with dpi scale factor */ void UI_icon_draw(float x, float y, int icon_id) { UI_icon_draw_ex(x, y, icon_id, U.inv_dpi_fac, 1.0f, 0.0f, NULL, false); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 2d549f6176c..dc8744aaae9 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -620,6 +620,9 @@ extern void ui_block_to_window_rctf(const struct ARegion *region, rctf *rct_dst, const rctf *rct_src); extern float ui_block_to_window_scale(const struct ARegion *region, uiBlock *block); +/** + * For mouse cursor. + */ extern void ui_window_to_block_fl(const struct ARegion *region, uiBlock *block, float *x, @@ -637,23 +640,52 @@ extern void ui_window_to_region_rctf(const struct ARegion *region, rctf *rect_dst, const rctf *rct_src); extern void ui_region_to_window(const struct ARegion *region, int *x, int *y); +/** + * Popups will add a margin to #ARegion.winrct for shadow, + * for interactivity (point-inside tests for eg), we want the winrct without the margin added. + */ extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect); +/** + * Reallocate the button (new address is returned) for a new button type. + * This should generally be avoided and instead the correct type be created right away. + * + * \note Only the #uiBut data can be kept. If the old button used a derived type (e.g. #uiButTab), + * the data that is not inside #uiBut will be lost. + */ uiBut *ui_but_change_type(uiBut *but, eButType new_type); extern double ui_but_value_get(uiBut *but); extern void ui_but_value_set(uiBut *but, double value); +/** + * For picker, while editing HSV. + */ extern void ui_but_hsv_set(uiBut *but); +/** + * For buttons pointing to color for example. + */ extern void ui_but_v3_get(uiBut *but, float vec[3]); +/** + * For buttons pointing to color for example. + */ extern void ui_but_v3_set(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos( const rcti *rect, const float mx, const float my, float *r_val_rad, float *r_val_dist); +/** + * Cursor in HSV circle, in float units -1 to 1, to map on radius. + */ extern void ui_hsvcircle_pos_from_vals( const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *xpos, float *ypos); extern void ui_hsvcube_pos_from_vals( const struct uiButHSVCube *hsv_but, const rcti *rect, const float *hsv, float *xp, float *yp); +/** + * \param float_precision: For number buttons the precision + * to use or -1 to fallback to the button default. + * \param use_exp_float: Use exponent representation of floats + * when out of reasonable range (outside of 1e3/1e-3). + */ extern void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, @@ -661,7 +693,16 @@ extern void ui_but_string_get_ex(uiBut *but, const bool use_exp_float, bool *r_use_exp_float) ATTR_NONNULL(1, 2); extern void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); +/** + * A version of #ui_but_string_get_ex for dynamic buffer sizes + * (where #ui_but_string_get_max_length returns 0). + * + * \param r_str_size: size of the returned string (including terminator). + */ extern char *ui_but_string_get_dynamic(uiBut *but, int *r_str_size); +/** + * \param str: will be overwritten. + */ extern void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); extern bool ui_but_string_set(struct bContext *C, uiBut *but, const char *str) ATTR_NONNULL(); extern bool ui_but_string_eval_number(struct bContext *C, @@ -669,12 +710,22 @@ extern bool ui_but_string_eval_number(struct bContext *C, const char *str, double *value) ATTR_NONNULL(); extern int ui_but_string_get_max_length(uiBut *but); -/* Clear & exit the active button's string. */ +/** + * Clear & exit the active button's string.. + */ extern void ui_but_active_string_clear_and_exit(struct bContext *C, uiBut *but) ATTR_NONNULL(); +/** + * Use handling code to set a string for the button. Handles the case where the string is set for a + * search button while the search menu is open, so the results are updated accordingly. + * This is basically the same as pasting the string into the button. + */ extern void ui_but_set_string_interactive(struct bContext *C, uiBut *but, const char *value); extern uiBut *ui_but_drag_multi_edit_get(uiBut *but); void ui_def_but_icon(uiBut *but, const int icon, const int flag); +/** + * Avoid using this where possible since it's better not to ask for an icon in the first place. + */ void ui_def_but_icon_clear(uiBut *but); void ui_but_extra_operator_icons_free(uiBut *but); @@ -687,6 +738,11 @@ void ui_but_range_set_hard(uiBut *but); void ui_but_range_set_soft(uiBut *but); bool ui_but_context_poll_operator(struct bContext *C, struct wmOperatorType *ot, const uiBut *but); +/** + * Check if the operator \a ot poll is successful with the context given by \a but (optionally). + * \param but: The button that might store context. Can be NULL for convenience (e.g. if there is + * no button to take context from, but we still want to poll the operator). + */ bool ui_but_context_poll_operator_ex(struct bContext *C, const uiBut *but, const struct wmOperatorCallParams *optype_params); @@ -697,10 +753,21 @@ extern PropertyScaleType ui_but_scale_type(const uiBut *but) ATTR_WARN_UNUSED_RE extern bool ui_but_is_float(const uiBut *but) ATTR_WARN_UNUSED_RESULT; extern bool ui_but_is_bool(const uiBut *but) ATTR_WARN_UNUSED_RESULT; extern bool ui_but_is_unit(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Check if this button is similar enough to be grouped with another. + */ extern bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b) ATTR_WARN_UNUSED_RESULT; extern bool ui_but_is_rna_valid(uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Checks if the button supports cycling next/previous menu items (ctrl+mouse-wheel). + */ extern bool ui_but_supports_cycling(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Check if the button is pushed, this is only meaningful for some button types. + * + * \return (0 == UNSELECT), (1 == SELECT), (-1 == DO-NOTHING) + */ extern int ui_but_is_pushed_ex(uiBut *but, double *value) ATTR_WARN_UNUSED_RESULT; extern int ui_but_is_pushed(uiBut *but) ATTR_WARN_UNUSED_RESULT; @@ -795,6 +862,7 @@ struct uiPopupBlockHandle { /* interface_region_*.c */ /* interface_region_tooltip.c */ + /* exposed as public API in UI_interface.h */ /* interface_region_color_picker.c */ @@ -802,6 +870,10 @@ void ui_color_picker_rgb_to_hsv_compat(const float rgb[3], float r_cp[3]); void ui_color_picker_rgb_to_hsv(const float rgb[3], float r_cp[3]); void ui_color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3]); +/** + * Returns true if the button is for a color with gamma baked in, + * or if it's a color picker for such a button. + */ bool ui_but_is_color_gamma(uiBut *but); void ui_scene_linear_to_perceptual_space(uiBut *but, float rgb[3]); @@ -811,7 +883,10 @@ uiBlock *ui_block_func_COLOR(struct bContext *C, uiPopupBlockHandle *handle, voi ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); /* interface_region_search.c */ -/* Search-box for string button. */ + +/** + * Search-box for string button. + */ struct ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, uiButSearch *search_but); @@ -822,8 +897,14 @@ struct ARegion *ui_searchbox_create_menu(struct bContext *C, struct ARegion *butregion, uiButSearch *search_but); +/** + * x and y in screen-coords. + */ bool ui_searchbox_inside(struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2); int ui_searchbox_find_index(struct ARegion *region, const char *name); +/** + * Region is the search box itself. + */ void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, const bool reset); int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *region, uiBut *but, char *str); bool ui_searchbox_event(struct bContext *C, @@ -831,16 +912,26 @@ bool ui_searchbox_event(struct bContext *C, uiBut *but, struct ARegion *butregion, const struct wmEvent *event); +/** + * String validated to be of correct length (but->hardmax). + */ bool ui_searchbox_apply(uiBut *but, struct ARegion *region); void ui_searchbox_free(struct bContext *C, struct ARegion *region); +/** + * XXX weak: search_func adds all partial matches. + */ void ui_but_search_refresh(uiButSearch *but); /* interface_region_menu_popup.c */ + int ui_but_menu_step(uiBut *but, int direction); bool ui_but_menu_step_poll(const uiBut *but); uiBut *ui_popup_menu_memory_get(struct uiBlock *block); void ui_popup_menu_memory_set(uiBlock *block, struct uiBut *but); +/** + * Called for creating new popups and refreshing existing ones. + */ uiBlock *ui_popup_block_refresh(struct bContext *C, uiPopupBlockHandle *handle, struct ARegion *butregion, @@ -860,6 +951,7 @@ uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, void *arg); /* interface_region_popover.c */ + uiPopupBlockHandle *ui_popover_panel_create(struct bContext *C, struct ARegion *butregion, uiBut *but, @@ -867,6 +959,10 @@ uiPopupBlockHandle *ui_popover_panel_create(struct bContext *C, void *arg); /* interface_region_menu_pie.c */ + +/** + * Set up data for defining a new pie menu level and add button that invokes it. + */ void ui_pie_menu_level_create(uiBlock *block, struct wmOperatorType *ot, const char *propname, @@ -877,6 +973,10 @@ void ui_pie_menu_level_create(uiBlock *block, int flag); /* interface_region_popup.c */ + +/** + * Translate any popup regions (so we can drag them). + */ void ui_popup_translate(struct ARegion *region, const int mdiff[2]); void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle); void ui_popup_block_scrolltest(struct uiBlock *block); @@ -884,10 +984,19 @@ void ui_popup_block_scrolltest(struct uiBlock *block); /* end interface_region_*.c */ /* interface_panel.c */ + +/** + * Handle region panel events like opening and closing panels, changing categories, etc. + * + * \note Could become a modal key-map. + */ extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event, struct ARegion *region, const uiBut *active_but); +/** + * Draw a panel integrated in buttons-window, tool/property lists etc. + */ extern void ui_draw_aligned_panel(const struct uiStyle *style, const uiBlock *block, const rcti *rect, @@ -897,14 +1006,20 @@ extern void ui_draw_aligned_panel(const struct uiStyle *style, void ui_panel_tag_search_filter_match(struct Panel *panel); /* interface_draw.c */ + extern void ui_draw_dropshadow( const rctf *rct, float radius, float aspect, float alpha, int select); +/** + * Draws in resolution of 48x4 colors. + */ void ui_draw_gradient(const rcti *rect, const float hsv[3], const eButGradientType type, const float alpha); +/* based on UI_draw_roundbox_gl_mode, + * check on making a version which allows us to skip some sides */ void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], @@ -930,6 +1045,9 @@ void ui_draw_but_CURVE(struct ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect); +/** + * Draws the curve profile widget. Somewhat similar to ui_draw_but_CURVE. + */ void ui_draw_but_CURVEPROFILE(struct ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, @@ -944,8 +1062,19 @@ void ui_draw_but_TRACKPREVIEW(struct ARegion *region, const rcti *rect); /* interface_undo.c */ + +/** + * Start the undo stack. + * + * \note The current state should be pushed immediately after calling this. + */ struct uiUndoStack_Text *ui_textedit_undo_stack_create(void); void ui_textedit_undo_stack_destroy(struct uiUndoStack_Text *undo_stack); +/** + * Push the information in the arguments to a new state in the undo stack. + * + * \note Currently the total length of the undo stack is not limited. + */ void ui_textedit_undo_push(struct uiUndoStack_Text *undo_stack, const char *text, int cursor_index); @@ -954,10 +1083,25 @@ const char *ui_textedit_undo(struct uiUndoStack_Text *undo_stack, int *r_cursor_index); /* interface_handlers.c */ + extern void ui_handle_afterfunc_add_operator(struct wmOperatorType *ot, wmOperatorCallContext opcontext); +/** + * Assumes event type is MOUSEPAN. + */ extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val); +/** + * Exported to interface.c: #UI_but_active_only() + * \note The region is only for the button. + * The context needs to be set by the caller. + */ extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but); +/** + * Simulate moving the mouse over a button (or navigating to it with arrow keys). + * + * exported so menus can start with a highlighted button, + * even if the mouse isn't over it + */ extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but); extern void ui_but_execute_begin(struct bContext *C, struct ARegion *region, @@ -968,13 +1112,25 @@ extern void ui_but_execute_end(struct bContext *C, uiBut *but, void *active_back); extern void ui_but_active_free(const struct bContext *C, uiBut *but); +/** + * In some cases we may want to update the view (#View2D) in-between layout definition and drawing. + * E.g. to make sure a button is visible while editing. + */ extern void ui_but_update_view_for_active(const struct bContext *C, const uiBlock *block); extern int ui_but_menu_direction(uiBut *but); extern void ui_but_text_password_hide(char password_str[128], uiBut *but, const bool restore); +/** + * Finds the pressed button in an aligned row (typically an expanded enum). + * + * \param direction: Use when there may be multiple buttons pressed. + */ extern uiBut *ui_but_find_select_in_enum(uiBut *but, int direction); bool ui_but_is_editing(const uiBut *but); float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]); +/* XXX, this code will shorten any allocated string to 'UI_MAX_NAME_STR' + * since this is really long its unlikely to be an issue, + * but this could be supported */ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip); void ui_but_clipboard_free(void); bool ui_but_rna_equals(const uiBut *a, const uiBut *b); @@ -1039,6 +1195,9 @@ void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const flo void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow); void ui_draw_tooltip_background(const struct uiStyle *style, uiBlock *block, rcti *rect); +/** + * Conversion from old to new buttons, so still messy. + */ extern void ui_draw_but(const struct bContext *C, struct ARegion *region, struct uiStyle *style, @@ -1059,6 +1218,15 @@ typedef enum { * get clipped before the normal text. */ UI_MENU_ITEM_SEPARATOR_HINT, } uiMenuItemSeparatorType; +/** + * Helper call to draw a menu item without a button. + * + * \param state: The state of the button, + * typically #UI_ACTIVE, #UI_BUT_DISABLED, #UI_BUT_INACTIVE. + * \param separator_type: The kind of separator which controls if and how the string is clipped. + * \param r_xmax: The right hand position of the text, this takes into the icon, + * padding and text clipping when there is not enough room to display the full text. + */ void ui_draw_menu_item(const struct uiFontStyle *fstyle, rcti *rect, const char *name, @@ -1072,6 +1240,10 @@ void ui_draw_preview_item(const struct uiFontStyle *fstyle, int iconid, int state, eFontStyle_Align text_align); +/** + * Version of #ui_draw_preview_item() that does not draw the menu background and item text based on + * state. It just draws the preview and text directly. + */ void ui_draw_preview_item_stateless(const struct uiFontStyle *fstyle, rcti *rect, const char *name, @@ -1081,59 +1253,102 @@ void ui_draw_preview_item_stateless(const struct uiFontStyle *fstyle, #define UI_TEXT_MARGIN_X 0.4f #define UI_POPUP_MARGIN (UI_DPI_FAC * 12) -/* Margin at top of screen for popups. Note this value must be sufficient - * to draw a popover arrow to avoid cropping it. */ +/** + * Margin at top of screen for popups. + * Note this value must be sufficient to draw a popover arrow to avoid cropping it. + */ #define UI_POPUP_MENU_TOP (int)(10 * UI_DPI_FAC) #define UI_PIXEL_AA_JITTER 8 extern const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2]; /* interface_style.c */ + +/** + * Called on each startup.blend read, + * reading without #uiFont will create one. + */ void uiStyleInit(void); /* interface_icons.c */ + void ui_icon_ensure_deferred(const struct bContext *C, const int icon_id, const bool big); int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big); /* interface_icons_event.c */ + void icon_draw_rect_input( float x, float y, int w, int h, float alpha, short event_type, short event_value); /* resources.c */ + void ui_resources_init(void); void ui_resources_free(void); /* interface_layout.c */ + void ui_layout_add_but(uiLayout *layout, uiBut *but); void ui_layout_remove_but(uiLayout *layout, const uiBut *but); +/** + * \return true if the button was successfully replaced. + */ bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but); +/** + * \note May reallocate \a but, so the possibly new address is returned. + */ uiBut *ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop); +/** + * Check all buttons defined in this layout, + * and set any button flagged as UI_BUT_LIST_ITEM as active/selected. + * Needed to handle correctly text colors of active (selected) list item. + */ void ui_layout_list_set_labels_active(uiLayout *layout); /* menu callback */ void ui_item_menutype_func(struct bContext *C, struct uiLayout *layout, void *arg_mt); void ui_item_paneltype_func(struct bContext *C, struct uiLayout *layout, void *arg_pt); /* interface_button_group.c */ + +/** + * Every function that adds a set of buttons must create another group, + * then #ui_def_but adds buttons to the current group (the last). + */ void ui_block_new_button_group(uiBlock *block, uiButtonGroupFlag flag); void ui_button_group_add_but(uiBlock *block, uiBut *but); void ui_button_group_replace_but_ptr(uiBlock *block, const void *old_but_ptr, uiBut *new_but); void ui_block_free_button_groups(uiBlock *block); /* interface_align.c */ + bool ui_but_can_align(const uiBut *but) ATTR_WARN_UNUSED_RESULT; int ui_but_align_opposite_to_area_align_get(const struct ARegion *region) ATTR_WARN_UNUSED_RESULT; +/** + * Compute the alignment of all 'align groups' of buttons in given block. + * + * This is using an order-independent algorithm, + * i.e. alignment of buttons should be OK regardless of order in which + * they are added to the block. + */ void ui_block_align_calc(uiBlock *block, const struct ARegion *region); /* interface_anim.c */ + void ui_but_anim_flag(uiBut *but, const struct AnimationEvalContext *anim_eval_context); void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); +/** + * \a str can be NULL to only perform check if \a but has an expression at all. + * \return if button has an expression. + */ bool ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); bool ui_but_anim_expression_set(uiBut *but, const char *str); +/** + * Create new expression for button (i.e. a "scripted driver"), if it can be created. + */ bool ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); @@ -1141,9 +1356,15 @@ void ui_but_anim_decorate_cb(struct bContext *C, void *arg_but, void *arg_dummy) void ui_but_anim_decorate_update_from_flag(uiButDecorator *but); /* interface_query.c */ + bool ui_but_is_editable(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_editable_as_text(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_toggle(const uiBut *but) ATTR_WARN_UNUSED_RESULT; +/** + * Can we mouse over the button or is it hidden/disabled/layout. + * \note ctrl is kind of a hack currently, + * so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. + */ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_popover_once_compat(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_has_array_value(const uiBut *but) ATTR_WARN_UNUSED_RESULT; @@ -1174,6 +1395,9 @@ uiBut *ui_tree_row_find_mouse_over(const struct ARegion *region, const int xy[2] uiBut *ui_tree_row_find_active(const struct ARegion *region); typedef bool (*uiButFindPollFn)(const uiBut *but, const void *customdata); +/** + * x and y are only used in case event is NULL. + */ uiBut *ui_but_find_mouse_over_ex(const struct ARegion *region, const int xy[2], const bool labeledit, @@ -1220,41 +1444,56 @@ bool ui_region_contains_point_px(const struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px); +/** + * Check if the cursor is over any popups. + */ struct ARegion *ui_screen_region_find_mouse_over_ex(struct bScreen *screen, const int xy[2]) ATTR_NONNULL(1, 2); struct ARegion *ui_screen_region_find_mouse_over(struct bScreen *screen, const struct wmEvent *event); /* interface_context_menu.c */ + bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but, const struct wmEvent *event); +/** + * menu to show when right clicking on the panel header + */ void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *region, struct Panel *panel); /* interface_eyedropper.c */ + struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf); struct wmKeyMap *eyedropper_colorband_modal_keymap(struct wmKeyConfig *keyconf); /* interface_eyedropper_color.c */ + void UI_OT_eyedropper_color(struct wmOperatorType *ot); /* interface_eyedropper_colorband.c */ + void UI_OT_eyedropper_colorramp(struct wmOperatorType *ot); void UI_OT_eyedropper_colorramp_point(struct wmOperatorType *ot); /* interface_eyedropper_datablock.c */ + void UI_OT_eyedropper_id(struct wmOperatorType *ot); /* interface_eyedropper_depth.c */ + void UI_OT_eyedropper_depth(struct wmOperatorType *ot); /* interface_eyedropper_driver.c */ + void UI_OT_eyedropper_driver(struct wmOperatorType *ot); /* interface_eyedropper_gpencil_color.c */ + void UI_OT_eyedropper_gpencil_color(struct wmOperatorType *ot); /* interface_template_asset_view.cc */ + struct uiListType *UI_UL_asset_view(void); /** @@ -1280,12 +1519,15 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, const bool is_first); /* interface_ops.c */ + bool ui_jump_to_target_button_poll(struct bContext *C); /* interface_queries.c */ + void ui_interface_tag_script_reload_queries(void); /* interface_view.cc */ + void ui_block_free_views(struct uiBlock *block); uiTreeViewHandle *ui_block_view_find_matching_in_old_block(const uiBlock *new_block, const uiTreeViewHandle *new_view); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b792c59481c..cbdb284c66b 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1464,11 +1464,6 @@ BLI_INLINE bool ui_layout_is_radial(const uiLayout *layout) ((layout->item.type == ITEM_LAYOUT_ROOT) && (layout->root->type == UI_LAYOUT_PIEMENU)); } -/** - * Create UI items for enum items in \a item_array. - * - * A version of #uiItemsFullEnumO that takes pre-calculated item array. - */ void uiItemsFullEnumO_items(uiLayout *layout, wmOperatorType *ot, PointerRNA ptr, @@ -1691,7 +1686,6 @@ void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname) uiItemsFullEnumO(layout, opname, propname, NULL, layout->root->opcontext, 0); } -/* for use in cases where we have */ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, @@ -2466,9 +2460,6 @@ void uiItemR( uiItemFullR(layout, ptr, prop, RNA_NO_INDEX, 0, flag, name, icon); } -/** - * Use a wrapper function since re-implementing all the logic in this function would be messy. - */ void uiItemFullR_with_popover(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, @@ -2722,9 +2713,6 @@ static void ui_rna_collection_search_arg_free_fn(void *ptr) MEM_freeN(ptr); } -/** - * \note May reallocate \a but, so the possibly new address is returned. - */ uiBut *ui_but_add_search( uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop) { @@ -2869,7 +2857,6 @@ void uiItemPointerR(uiLayout *layout, uiItemPointerR_prop(layout, ptr, prop, searchptr, searchprop, name, icon); } -/* menu item */ void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) { MenuType *mt = (MenuType *)arg_mt; @@ -3015,10 +3002,6 @@ void uiItemMContents(uiLayout *layout, const char *menuname) UI_menutype_draw(C, mt, layout); } -/** - * Insert a decorator item for a button with the same property as \a prop. - * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a prop. - */ void uiItemDecoratorR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index) { uiBlock *block = layout->root->block; @@ -3077,10 +3060,6 @@ void uiItemDecoratorR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, } } -/** - * Insert a decorator item for a button with the same property as \a prop. - * To force inserting a blank dummy element, NULL can be passed for \a ptr and \a propname. - */ void uiItemDecoratorR(uiLayout *layout, PointerRNA *ptr, const char *propname, int index) { PropertyRNA *prop = NULL; @@ -3099,7 +3078,6 @@ void uiItemDecoratorR(uiLayout *layout, PointerRNA *ptr, const char *propname, i uiItemDecoratorR_prop(layout, ptr, prop, index); } -/* popover */ void uiItemPopoverPanel_ptr( uiLayout *layout, const bContext *C, PanelType *pt, const char *name, int icon) { @@ -3241,11 +3219,6 @@ void uiItemL(uiLayout *layout, const char *name, int icon) uiItemL_(layout, name, icon); } -/** - * Normally, we handle the split layout in #uiItemFullR(), but there are other cases where the - * logic is needed. Ideally, #uiItemFullR() could just call this, but it currently has too many - * special needs. - */ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout) { uiPropertySplitWrapper split_wrapper = {NULL}; @@ -3261,9 +3234,6 @@ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout) return split_wrapper; } -/* - * Helper to add a label and creates a property split layout if needed. - */ uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon) { if (layout->item.flag & UI_ITEM_PROP_SEP) { @@ -3297,7 +3267,6 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon) } } -/* value item */ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) { /* label */ @@ -3342,7 +3311,6 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval) } } -/* separator item */ void uiItemS_ex(uiLayout *layout, float factor) { uiBlock *block = layout->root->block; @@ -3370,13 +3338,11 @@ void uiItemS_ex(uiLayout *layout, float factor) ""); } -/* separator item */ void uiItemS(uiLayout *layout) { uiItemS_ex(layout, 1.0f); } -/* Flexible spacing. */ void uiItemSpacer(uiLayout *layout) { uiBlock *block = layout->root->block; @@ -3409,7 +3375,6 @@ void uiItemSpacer(uiLayout *layout) ""); } -/* level items */ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg) { if (!func) { @@ -3419,9 +3384,6 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc ui_item_menu(layout, name, icon, func, arg, NULL, "", false); } -/** - * Version of #uiItemMenuF that free's `argN`. - */ void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN) { if (!func) { @@ -4730,7 +4692,6 @@ static void ui_layout_heading_set(uiLayout *layout, const char *heading) } } -/* layout create functions */ uiLayout *uiLayoutRow(uiLayout *layout, bool align) { uiLayout *litem = MEM_callocN(sizeof(uiLayout), "uiLayoutRow"); @@ -4744,9 +4705,6 @@ uiLayout *uiLayoutRow(uiLayout *layout, bool align) return litem; } -/** - * See #uiLayoutColumnWithHeading(). - */ uiLayout *uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading) { uiLayout *litem = uiLayoutRow(layout, align); @@ -4767,12 +4725,6 @@ uiLayout *uiLayoutColumn(uiLayout *layout, bool align) return litem; } -/** - * Variant of #uiLayoutColumn() that sets a heading label for the layout if the first item is - * added through #uiItemFullR(). If split layout is used and the item has no string to add to the - * first split-column, the heading is added there instead. Otherwise the heading inserted with a - * new row. - */ uiLayout *uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading) { uiLayout *litem = uiLayoutColumn(layout, align); @@ -4862,11 +4814,6 @@ uiLayout *uiLayoutBox(uiLayout *layout) return (uiLayout *)ui_layout_box(layout, UI_BTYPE_ROUNDBOX); } -/** - * Check all buttons defined in this layout, - * and set any button flagged as UI_BUT_LIST_ITEM as active/selected. - * Needed to handle correctly text colors of active (selected) list item. - */ void ui_layout_list_set_labels_active(uiLayout *layout) { LISTBASE_FOREACH (uiButtonItem *, bitem, &layout->items) { @@ -5214,11 +5161,6 @@ static bool block_search_filter_tag_buttons(uiBlock *block, const char *search_f return has_result; } -/** - * Apply property search behavior, setting panel flags and deactivating buttons that don't match. - * - * \note Must not be run after #UI_block_layout_resolve. - */ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter) { if (search_filter == NULL || search_filter[0] == '\0') { @@ -5643,9 +5585,6 @@ void ui_layout_remove_but(uiLayout *layout, const uiBut *but) BLI_freelinkN(&layout->items, bitem); } -/** - * \return true if the button was successfully replaced. - */ bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but) { uiButtonItem *bitem = ui_layout_find_button_item(layout, old_but_ptr); @@ -5683,11 +5622,6 @@ void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv) layout->root->argv = argv; } -/** - * Used for property search when the layout process needs to be cancelled in order to avoid - * computing the locations for buttons, but the layout items created while adding the buttons - * must still be freed. - */ void UI_block_layout_free(uiBlock *block) { LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { @@ -5759,7 +5693,6 @@ void uiLayoutSetContextFromBut(uiLayout *layout, uiBut *but) } } -/* this is a bit of a hack but best keep it in one place at least */ wmOperatorType *UI_but_operatortype_get_from_enum_menu(uiBut *but, PropertyRNA **r_prop) { if (r_prop != NULL) { @@ -5777,7 +5710,6 @@ wmOperatorType *UI_but_operatortype_get_from_enum_menu(uiBut *but, PropertyRNA * return NULL; } -/* this is a bit of a hack but best keep it in one place at least */ MenuType *UI_but_menutype_get(uiBut *but) { if (but->menu_create_func == ui_item_menutype_func) { @@ -5786,7 +5718,6 @@ MenuType *UI_but_menutype_get(uiBut *but) return NULL; } -/* this is a bit of a hack but best keep it in one place at least */ PanelType *UI_but_paneltype_get(uiBut *but) { if (but->menu_create_func == ui_item_paneltype_func) { @@ -5886,9 +5817,6 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout, } } -/** - * Used for popup panels only. - */ void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout) { if (layout->context) { @@ -6009,9 +5937,6 @@ static void ui_layout_introspect_items(DynStr *ds, ListBase *lb) BLI_dynstr_append(ds, "]"); } -/** - * Evaluate layout items as a Python dictionary. - */ const char *UI_layout_introspect(uiLayout *layout) { DynStr *ds = BLI_dynstr_new(); @@ -6031,10 +5956,6 @@ const char *UI_layout_introspect(uiLayout *layout) /** \name Alert Box with Big Icon * \{ */ -/** - * Helper to add a big icon and create a split layout for alert popups. - * Returns the layout to place further items into the alert box. - */ uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon) { const uiStyle *style = UI_style_get_dpi(); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 03422e8f520..0000c850a10 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1343,10 +1343,6 @@ void UI_editsource_active_but_test(uiBut *but) BLI_ghash_insert(ui_editsource_info->hash, but, but_store); } -/** - * Remove the editsource data for \a old_but and reinsert it for \a new_but. Use when the button - * was reallocated, e.g. to have a new type (#ui_but_change_type()). - */ void UI_editsource_but_replace(const uiBut *old_but, uiBut *new_but) { uiEditSourceButStore *but_store = BLI_ghash_lookup(ui_editsource_info->hash, old_but); @@ -2085,9 +2081,6 @@ void ED_operatortypes_ui(void) WM_operatortype_append(UI_OT_eyedropper_gpencil_color); } -/** - * \brief User Interface Keymap - */ void ED_keymap_ui(wmKeyConfig *keyconf) { WM_keymap_ensure(keyconf, "User Interface", 0, 0); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3d18489c0c9..bc1d3387ad7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -273,10 +273,6 @@ static Panel *panel_add_instanced(ARegion *region, return panel; } -/** - * Called in situations where panels need to be added dynamically rather than - * having only one panel corresponding to each #PanelType. - */ Panel *UI_panel_add_instanced(const bContext *C, ARegion *region, ListBase *panels, @@ -301,10 +297,6 @@ Panel *UI_panel_add_instanced(const bContext *C, return new_panel; } -/** - * Find a unique key to append to the #PanelType.idname for the lookup to the panel's #uiBlock. - * Needed for instanced panels, where there can be multiple with the same type and identifier. - */ void UI_list_panel_unique_str(Panel *panel, char *r_name) { /* The panel sort-order will be unique for a specific panel type because the instanced @@ -334,12 +326,6 @@ static void panel_delete(const bContext *C, ARegion *region, ListBase *panels, P MEM_freeN(panel); } -/** - * Remove instanced panels from the region's panel list. - * - * \note Can be called with NULL \a C, but it should be avoided because - * handlers might not be removed. - */ void UI_panels_free_instanced(const bContext *C, ARegion *region) { /* Delete panels with the instanced flag. */ @@ -361,15 +347,6 @@ void UI_panels_free_instanced(const bContext *C, ARegion *region) } } -/** - * Check if the instanced panels in the region's panels correspond to the list of data the panels - * represent. Returns false if the panels have been reordered or if the types from the list data - * don't match in any way. - * - * \param data: The list of data to check against the instanced panels. - * \param panel_idname_func: Function to find the #PanelType.idname for each item in the data list. - * For a readability and generality, this lookup happens separately for each type of panel list. - */ bool UI_panel_list_matches_data(ARegion *region, ListBase *data, uiListPanelIDFromDataFunc panel_idname_func) @@ -701,9 +678,6 @@ Panel *UI_panel_find_by_type(ListBase *lb, const PanelType *pt) return NULL; } -/** - * \note \a panel should be return value from #UI_panel_find_by_type and can be NULL. - */ Panel *UI_panel_begin( ARegion *region, ListBase *lb, uiBlock *block, PanelType *pt, Panel *panel, bool *r_open) { @@ -783,11 +757,6 @@ Panel *UI_panel_begin( return panel; } -/** - * Create the panel header button group, used to mark which buttons are part of - * panel headers for the panel search process that happens later. This Should be - * called before adding buttons for the panel's header layout. - */ void UI_panel_header_buttons_begin(Panel *panel) { uiBlock *block = panel->runtime.block; @@ -795,9 +764,6 @@ void UI_panel_header_buttons_begin(Panel *panel) ui_block_new_button_group(block, UI_BUTTON_GROUP_LOCK | UI_BUTTON_GROUP_PANEL_HEADER); } -/** - * Finish the button group for the panel header to avoid putting panel body buttons in it. - */ void UI_panel_header_buttons_end(Panel *panel) { uiBlock *block = panel->runtime.block; @@ -927,10 +893,6 @@ static void panel_matches_search_filter_recursive(const Panel *panel, bool *filt } } -/** - * Find whether a panel or any of its sub-panels contain a property that matches the search filter, - * depending on the search process running in #UI_block_apply_search_filter earlier. - */ bool UI_panel_matches_search_filter(const Panel *panel) { bool search_filter_matches = false; @@ -1022,10 +984,6 @@ static void region_panels_remove_invisible_layouts(ARegion *region) } } -/** - * Get the panel's expansion state, taking into account - * expansion set from property search if it applies. - */ bool UI_panel_is_closed(const Panel *panel) { /* Header-less panels can never be closed, otherwise they could disappear. */ @@ -1051,9 +1009,6 @@ bool UI_panel_is_active(const Panel *panel) /** \name Drawing * \{ */ -/** - * Draw panels, selected (panels currently being dragged) on top. - */ void UI_panels_draw(const bContext *C, ARegion *region) { /* Draw in reverse order, because #uiBlocks are added in reverse order @@ -1075,7 +1030,6 @@ void UI_panels_draw(const bContext *C, ARegion *region) #define PNL_ICON UI_UNIT_X /* Could be UI_UNIT_Y too. */ -/* For button layout next to label. */ void UI_panel_label_offset(const uiBlock *block, int *r_x, int *r_y) { Panel *panel = block->panel; @@ -1294,9 +1248,6 @@ static void panel_draw_aligned_backdrop(const Panel *panel, immUnbindProgram(); } -/** - * Draw a panel integrated in buttons-window, tool/property lists etc. - */ void ui_draw_aligned_panel(const uiStyle *style, const uiBlock *block, const rcti *rect, @@ -1361,9 +1312,6 @@ bool UI_panel_should_show_background(const ARegion *region, const PanelType *pan #define TABS_PADDING_BETWEEN_FACTOR 4.0f #define TABS_PADDING_TEXT_FACTOR 6.0f -/** - * Draw vertical tabs on the left side of the region, one tab per category. - */ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) { // #define USE_FLAT_INACTIVE @@ -2380,11 +2328,6 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, return WM_UI_HANDLER_CONTINUE; } -/** - * Handle region panel events like opening and closing panels, changing categories, etc. - * - * \note Could become a modal key-map. - */ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *region, @@ -2496,11 +2439,6 @@ static void ui_panel_custom_data_set_recursive(Panel *panel, PointerRNA *custom_ } } -/** - * Set a context for this entire panel and its current layout. This should be used whenever panel - * callbacks that are called outside of regular drawing might require context. Currently it affects - * the #PanelType.reorder callback only. - */ void UI_panel_context_pointer_set(Panel *panel, const char *name, PointerRNA *ptr) { uiLayoutSetContextPointer(panel->layout, name, ptr); diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index a07222854d2..b486ceb8dca 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -72,11 +72,6 @@ bool ui_but_is_toggle(const uiBut *but) UI_BTYPE_TREEROW); } -/** - * Can we mouse over the button or is it hidden/disabled/layout. - * \note ctrl is kind of a hack currently, - * so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. - */ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) { /* NOTE: #UI_BTYPE_LABEL is included for highlights, this allows drags. */ @@ -103,7 +98,6 @@ bool ui_but_is_interactive(const uiBut *but, const bool labeledit) return true; } -/* file selectors are exempt from utf-8 checks */ bool UI_but_is_utf8(const uiBut *but) { if (but->rnaprop) { @@ -283,7 +277,6 @@ static uiBut *ui_but_find(const ARegion *region, return NULL; } -/* x and y are only used in case event is NULL... */ uiBut *ui_but_find_mouse_over_ex(const ARegion *region, const int xy[2], const bool labeledit, @@ -797,7 +790,6 @@ bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px) /** \name Screen (#bScreen) Spatial * \{ */ -/** Check if the cursor is over any popups. */ ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2]) { LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { diff --git a/source/blender/editors/interface/interface_region_color_picker.c b/source/blender/editors/interface/interface_region_color_picker.c index 48952c4f121..2b167c56186 100644 --- a/source/blender/editors/interface/interface_region_color_picker.c +++ b/source/blender/editors/interface/interface_region_color_picker.c @@ -115,8 +115,6 @@ void ui_color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3]) } } -/* Returns true if the button is for a color with gamma baked in, - * or if it's a color picker for such a button. */ bool ui_but_is_color_gamma(uiBut *but) { if (but->rnaprop) { @@ -183,7 +181,6 @@ static void ui_color_picker_update_hsv(ColorPicker *cpicker, cpicker->is_init = true; } -/* for picker, while editing hsv */ void ui_but_hsv_set(uiBut *but) { float rgb_perceptual[3]; diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index 0ffbdd6911c..788d04a8271 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -372,9 +372,6 @@ static void ui_pie_menu_level_invoke(bContext *C, void *argN, void *arg2) UI_pie_menu_end(C, pie); } -/** - * Set up data for defining a new pie menu level and add button that invokes it. - */ void ui_pie_menu_level_create(uiBlock *block, wmOperatorType *ot, const char *propname, diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 408953f8d0e..a8980b8b122 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -384,10 +384,6 @@ uiPopupBlockHandle *ui_popup_menu_create( /** \name Popup Menu API with begin & end * \{ */ -/** - * Only return handler, and set optional title. - * \param block_name: Assigned to uiBlock.name (useful info for debugging). - */ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *title, const char *block_name, @@ -450,16 +446,12 @@ uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon) return UI_popup_menu_begin_ex(C, title, __func__, icon); } -/** - * Setting the button makes the popup open from the button instead of the cursor. - */ void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but) { pup->but = but; pup->butregion = butregion; } -/* set the whole structure to work */ void UI_popup_menu_end(bContext *C, uiPopupMenu *pup) { wmWindow *window = CTX_wm_window(C); diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 5e7e0bfe9b5..1bb589d99fb 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -340,12 +340,6 @@ int UI_popover_panel_invoke(bContext *C, const char *idname, bool keep_open, Rep /** \name Popup Menu API with begin & end * \{ */ -/** - * Only return handler, and set optional title. - * - * \param from_active_button: Use the active button for positioning, - * use when the popover is activated from an operator instead of directly from the button. - */ uiPopover *UI_popover_begin(bContext *C, int ui_menu_width, bool from_active_button) { uiPopover *pup = MEM_callocN(sizeof(uiPopover), "popover menu"); @@ -383,7 +377,6 @@ static void popover_keymap_fn(wmKeyMap *UNUSED(keymap), wmKeyMapItem *UNUSED(kmi pup->block->handle->menuretval = UI_RETURN_OK; } -/* set the whole structure to work */ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) { wmWindow *window = CTX_wm_window(C); diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c index 0f903bd4af9..33ce47b281b 100644 --- a/source/blender/editors/interface/interface_region_popup.c +++ b/source/blender/editors/interface/interface_region_popup.c @@ -53,9 +53,6 @@ /** \name Utility Functions * \{ */ -/** - * Translate any popup regions (so we can drag them). - */ void ui_popup_translate(ARegion *region, const int mdiff[2]) { BLI_rcti_translate(®ion->winrct, UNPACK2(mdiff)); @@ -554,9 +551,6 @@ static void ui_popup_block_remove(bContext *C, uiPopupBlockHandle *handle) } } -/** - * Called for creating new popups and refreshing existing ones. - */ uiBlock *ui_popup_block_refresh(bContext *C, uiPopupBlockHandle *handle, ARegion *butregion, diff --git a/source/blender/editors/interface/interface_region_search.cc b/source/blender/editors/interface/interface_region_search.cc index 93063b1b1c9..5b30e922a67 100644 --- a/source/blender/editors/interface/interface_region_search.cc +++ b/source/blender/editors/interface/interface_region_search.cc @@ -106,17 +106,6 @@ struct uiSearchboxData { #define SEARCH_ITEMS 10 -/** - * Public function exported for functions that use #UI_BTYPE_SEARCH_MENU. - * - * \param items: Stores the items. - * \param name: Text to display for the item. - * \param poin: Opaque pointer (for use by the caller). - * \param iconid: The icon, #ICON_NONE for no icon. - * \param state: The buttons state flag, compatible with #uiBut.flag, - * typically #UI_BUT_DISABLED / #UI_BUT_INACTIVE. - * \return false if there is nothing to add. - */ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, @@ -289,7 +278,6 @@ int ui_searchbox_find_index(ARegion *region, const char *name) return UI_search_items_find_index(&data->items, name); } -/* x and y in screen-coords. */ bool ui_searchbox_inside(ARegion *region, const int xy[2]) { uiSearchboxData *data = static_cast<uiSearchboxData *>(region->regiondata); @@ -297,7 +285,6 @@ bool ui_searchbox_inside(ARegion *region, const int xy[2]) return BLI_rcti_isect_pt(&data->bbox, xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin); } -/* string validated to be of correct length (but->hardmax) */ bool ui_searchbox_apply(uiBut *but, ARegion *region) { uiSearchboxData *data = static_cast<uiSearchboxData *>(region->regiondata); @@ -477,7 +464,6 @@ static void ui_searchbox_update_fn(bContext *C, search_but->items_update_fn(C, search_but->arg, str, items, is_first_search); } -/* region is the search box itself */ void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool reset) { uiButSearch *search_but = (uiButSearch *)but; @@ -1032,8 +1018,6 @@ ARegion *ui_searchbox_create_menu(bContext *C, ARegion *butregion, uiButSearch * return region; } -/* sets red alert if button holds a string it can't find */ -/* XXX weak: search_func adds all partial matches... */ void ui_but_search_refresh(uiButSearch *search_but) { uiBut *but = &search_but->but; diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index 0d8bdfc5817..e146443faaa 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -1466,10 +1466,6 @@ ARegion *UI_tooltip_create_from_button_or_extra_icon( return region; } -/** - * \param is_label: When true, show a small tip that only shows the name, otherwise show the full - * tooltip. - */ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *but, bool is_label) { return UI_tooltip_create_from_button_or_extra_icon(C, butregion, but, NULL, is_label); @@ -1542,13 +1538,6 @@ static uiTooltipData *ui_tooltip_data_from_search_item_tooltip_data( return data; } -/** - * Create a tooltip from search-item tooltip data \a item_tooltip data. - * To be called from a callback set with #UI_but_func_search_set_tooltip(). - * - * \param item_rect: Rectangle of the search item in search region space (#ui_searchbox_butrect()) - * which is passed to the tooltip callback. - */ ARegion *UI_tooltip_create_from_search_item_generic( bContext *C, const ARegion *searchbox_region, diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 8bb1e477506..643fa128d08 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -219,7 +219,6 @@ void UI_fontstyle_draw(const uiFontStyle *fs, UI_fontstyle_draw_ex(fs, rect, str, col, fs_params, BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs, NULL); } -/* drawn same as above, but at 90 degree angle */ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str, @@ -279,12 +278,6 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, } } -/** - * Similar to #UI_fontstyle_draw - * but ignore alignment, shadow & no clipping rect. - * - * For drawing on-screen labels. - */ void UI_fontstyle_draw_simple( const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4]) { @@ -294,9 +287,6 @@ void UI_fontstyle_draw_simple( BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); } -/** - * Same as #UI_fontstyle_draw but draw a colored backdrop. - */ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, float x, float y, @@ -331,7 +321,7 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, } /* ************** helpers ************************ */ -/* XXX: read a style configure */ + const uiStyle *UI_style_get(void) { #if 0 @@ -344,7 +334,6 @@ const uiStyle *UI_style_get(void) #endif } -/* for drawing, scaled with DPI setting */ const uiStyle *UI_style_get_dpi(void) { const uiStyle *style = UI_style_get(); @@ -376,16 +365,6 @@ int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str) return (int)BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); } -/** - * Return the width of `str` with the spacing & kerning of `fs` with `aspect` - * (representing #uiBlock.aspect) applied. - * - * When calculating text width, the UI layout logic calculate widths without scale, - * only applying scale when drawing. This causes problems for fonts since kerning at - * smaller sizes often makes them wider than a scaled down version of the larger text. - * Resolve this by calculating the text at the on-screen size, - * returning the result scaled back to 1:1. See T92361. - */ int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs, const char *str, const float aspect) @@ -415,8 +394,6 @@ int UI_fontstyle_height_max(const uiFontStyle *fs) /* ************** init exit ************************ */ -/* called on each startup.blend read */ -/* reading without uifont will create one */ void uiStyleInit(void) { const uiStyle *style = U.uistyles.first; diff --git a/source/blender/editors/interface/interface_template_list.cc b/source/blender/editors/interface/interface_template_list.cc index d24b2ba4c59..13e539b5095 100644 --- a/source/blender/editors/interface/interface_template_list.cc +++ b/source/blender/editors/interface/interface_template_list.cc @@ -1276,9 +1276,6 @@ void uiTemplateList(uiLayout *layout, nullptr); } -/** - * \return: A RNA pointer for the operator properties. - */ PointerRNA *UI_list_custom_activate_operator_set(uiList *ui_list, const char *opname, bool create_properties) @@ -1298,9 +1295,6 @@ PointerRNA *UI_list_custom_activate_operator_set(uiList *ui_list, return dyn_data->custom_activate_opptr; } -/** - * \return: A RNA pointer for the operator properties. - */ PointerRNA *UI_list_custom_drag_operator_set(uiList *ui_list, const char *opname, bool create_properties) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index cbd57176a31..7f00db26da9 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -585,7 +585,6 @@ static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem) /* This is for browsing and editing the ID-blocks used */ -/* for new/open operators */ void UI_context_active_but_prop_get_templateID(bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop) @@ -1556,9 +1555,6 @@ void uiTemplateGpencilColorPreview(uiLayout *layout, false); } -/** - * Version of #uiTemplateID using tabs. - */ void uiTemplateIDTabs(uiLayout *layout, bContext *C, PointerRNA *ptr, @@ -1592,14 +1588,6 @@ void uiTemplateIDTabs(uiLayout *layout, /** \name ID Chooser Template * \{ */ -/** - * This is for selecting the type of ID-block to use, - * and then from the relevant type choosing the block to use. - * - * \param propname: property identifier for property that ID-pointer gets stored to. - * \param proptypename: property identifier for property - * used to determine the type of ID-pointer that can be used. - */ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -1855,10 +1843,6 @@ static TemplateSearch *template_search_setup(PointerRNA *ptr, return template_search; } -/** - * Search menu to pick an item from a collection. - * A version of uiTemplateID that works for non-ID types. - */ void uiTemplateSearch(uiLayout *layout, bContext *C, PointerRNA *ptr, @@ -1909,13 +1893,6 @@ void uiTemplateSearchPreview(uiLayout *layout, /* ---------- */ -/** - * This is creating/editing RNA-Paths - * - * - ptr: struct which holds the path property - * - propname: property identifier for property that path gets stored to - * - root_ptr: struct that path gets built from - */ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -2102,9 +2079,6 @@ static void bone_constraint_panel_id(void *md_link, char *r_name) strcat(r_name, cti->structName); } -/** - * Check if the constraint panels don't match the data and rebuild the panels if so. - */ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_constraints) { ARegion *region = CTX_wm_region(C); @@ -2280,9 +2254,6 @@ static void shaderfx_panel_id(void *fx_v, char *r_idname) BKE_shaderfxType_panel_id(fx->type, r_idname); } -/** - * Check if the shader effect panels don't match the data and rebuild the panels if so. - */ void uiTemplateShaderFx(uiLayout *UNUSED(layout), bContext *C) { ARegion *region = CTX_wm_region(C); @@ -2564,11 +2535,6 @@ static bool ui_layout_operator_properties_only_booleans(const bContext *C, return true; } -/** - * Draw Operator property buttons for redoing execution with different settings. - * This function does not initialize the layout, - * functions can be called on the layout before and after. - */ void uiTemplateOperatorPropertyButs( const bContext *C, uiLayout *layout, wmOperator *op, eButLabelAlign label_align, short flag) { @@ -3537,9 +3503,6 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname /** \name Icon Template * \{ */ -/** - * \param icon_scale: Scale of the icon, 1x == button height. - */ void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale) { uiBlock *block = uiLayoutAbsoluteBlock(layout); @@ -3648,9 +3611,6 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_lit return block; } -/** - * \param icon_scale: Scale of the icon, 1x == button height. - */ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -5218,10 +5178,6 @@ static void CurveProfile_buttons_layout(uiLayout *layout, PointerRNA *ptr, RNAUp UI_block_funcN_set(block, NULL, NULL, NULL); } -/** - * Template for a path creation widget intended for custom bevel profiles. - * This section is quite similar to #uiTemplateCurveMapping, but with reduced complexity. - */ void uiTemplateCurveProfile(uiLayout *layout, PointerRNA *ptr, const char *propname) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -5268,7 +5224,6 @@ void uiTemplateCurveProfile(uiLayout *layout, PointerRNA *ptr, const char *propn #define WHEEL_SIZE (5 * U.widget_unit) -/* This template now follows User Preference for type - name is not correct anymore... */ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propname, @@ -5659,10 +5614,6 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) /* see view3d_header.c */ } -/** - * \todo for now, grouping of layers is determined by dividing up the length of - * the array of layer bitflags - */ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, diff --git a/source/blender/editors/interface/interface_undo.c b/source/blender/editors/interface/interface_undo.c index 40f196d9b45..6916e1080b6 100644 --- a/source/blender/editors/interface/interface_undo.c +++ b/source/blender/editors/interface/interface_undo.c @@ -91,11 +91,6 @@ const char *ui_textedit_undo(uiUndoStack_Text *stack, int direction, int *r_curs return ui_textedit_redo_impl(stack, r_cursor_index); } -/** - * Push the information in the arguments to a new state in the undo stack. - * - * \note Currently the total length of the undo stack is not limited. - */ void ui_textedit_undo_push(uiUndoStack_Text *stack, const char *text, int cursor_index) { /* Clear all redo actions from the current state. */ @@ -114,11 +109,7 @@ void ui_textedit_undo_push(uiUndoStack_Text *stack, const char *text, int cursor memcpy(stack->current->text, text, text_size); BLI_addtail(&stack->states, stack->current); } -/** - * Start the undo stack. - * - * \note The current state should be pushed immediately after calling this. - */ + uiUndoStack_Text *ui_textedit_undo_stack_create(void) { uiUndoStack_Text *stack = MEM_mallocN(sizeof(uiUndoStack_Text), __func__); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 1a41dc8e9fb..30436c52c38 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -354,12 +354,6 @@ uiBut *uiDefAutoButR(uiBlock *block, return but; } -/** - * \a check_prop callback filters functions to avoid drawing certain properties, - * in cases where PROP_HIDDEN flag can't be used for a property. - * - * \param prop_activate_init: Property to activate on initial popup (#UI_BUT_ACTIVATE_ON_INIT). - */ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, bool (*check_prop)(PointerRNA *ptr, @@ -593,7 +587,6 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, MEM_freeN(items_list); } -/***************************** ID Utilities *******************************/ int UI_icon_from_id(const ID *id) { if (id == NULL) { @@ -618,7 +611,6 @@ int UI_icon_from_id(const ID *id) return (ptr.type) ? RNA_struct_ui_icon(ptr.type) : ICON_NONE; } -/* see: report_type_str */ int UI_icon_from_report_type(int type) { if (type & RPT_ERROR_ALL) { @@ -690,10 +682,6 @@ int UI_text_colorid_from_report_type(int type) /********************************** Misc **************************************/ -/** - * Returns the best "UI" precision for given floating value, - * so that e.g. 10.000001 rather gets drawn as '10'... - */ int UI_calc_float_precision(int prec, double value) { static const double pow10_neg[UI_PRECISION_FLOAT_MAX + 1] = { @@ -839,16 +827,6 @@ static bool ui_view2d_cur_ensure_rect_in_view(View2D *v2d, const rctf *rect) return changed; } -/** - * Adjust the view so the rectangle of \a but is in view, with some extra margin. - * - * It's important that this is only executed after buttons received their final #uiBut.rect. E.g. - * #UI_panels_end() modifies them, so if that is executed, this function must not be called before - * it. - * - * \param region: The region the button is placed in. Make sure this is actually the one the button - * is placed in, not just the context region. - */ void UI_but_ensure_in_view(const bContext *C, ARegion *region, const uiBut *but) { View2D *v2d = ®ion->v2d; @@ -892,9 +870,6 @@ struct uiButStoreElem { uiBut **but_p; }; -/** - * Create a new button store, the caller must manage and run #UI_butstore_free - */ uiButStore *UI_butstore_create(uiBlock *block) { uiButStore *bs_handle = MEM_callocN(sizeof(uiButStore), __func__); @@ -966,9 +941,6 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p) BLI_assert(0); } -/** - * Update the pointer for a registered button. - */ bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src) { bool found = false; @@ -985,9 +957,6 @@ bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *bu return found; } -/** - * NULL all pointers, don't free since the owner needs to be able to inspect. - */ void UI_butstore_clear(uiBlock *block) { LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) { @@ -998,9 +967,6 @@ void UI_butstore_clear(uiBlock *block) } } -/** - * Map freed buttons from the old block and update pointers. - */ void UI_butstore_update(uiBlock *block) { /* move this list to the new block */ diff --git a/source/blender/editors/interface/interface_view.cc b/source/blender/editors/interface/interface_view.cc index 0f0d1b1308e..500834f4434 100644 --- a/source/blender/editors/interface/interface_view.cc +++ b/source/blender/editors/interface/interface_view.cc @@ -56,9 +56,6 @@ template<class T> T *get_view_from_link(ViewLink &link) return t_uptr ? t_uptr->get() : nullptr; } -/** - * Override this for all available tree types. - */ AbstractTreeView *UI_block_add_view(uiBlock &block, StringRef idname, std::unique_ptr<AbstractTreeView> tree_view) @@ -79,9 +76,6 @@ void ui_block_free_views(uiBlock *block) } } -/** - * \param x, y: Coordinate to find a tree-row item at, in window space. - */ uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const ARegion *region, const int xy[2]) { uiButTreeRow *tree_row_but = (uiButTreeRow *)ui_tree_row_find_mouse_over(region, xy); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d2d71c920fe..d5cbb271c8d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -557,7 +557,6 @@ static void draw_anti_tria( GPU_blend(GPU_BLEND_NONE); } -/* Triangle 'icon' for panel header and other cases. */ void UI_draw_icon_tri(float x, float y, char dir, const float color[4]) { const float f3 = 0.05 * U.widget_unit; @@ -1520,17 +1519,6 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle, } } -/** - * Cut off the middle of the text to fit into the given width. - * - * \note in case this middle clipping would just remove a few chars, - * it rather clips right, which is more readable. - * - * If rpart_sep is not Null, the part of str starting to first occurrence of rpart_sep - * is preserved at all cost. - * Useful for strings with shortcuts - * (like 'AVeryLongFooBarLabelForMenuEntry|Ctrl O' -> 'AVeryLong...MenuEntry|Ctrl O'). - */ float UI_text_clip_middle_ex(const uiFontStyle *fstyle, char *str, float okwidth, @@ -2881,7 +2869,6 @@ void ui_hsvcircle_vals_from_pos( *r_val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f; } -/* cursor in hsv circle, in float units -1 to 1, to map on radius */ void ui_hsvcircle_pos_from_vals( const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *r_xpos, float *r_ypos) { @@ -3018,7 +3005,6 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const /** \name Draw Custom Buttons * \{ */ -/* draws in resolution of 48x4 colors */ void ui_draw_gradient(const rcti *rect, const float hsv[3], const eButGradientType type, @@ -3511,7 +3497,6 @@ static void widget_numbut_embossn(const uiBut *UNUSED(but), widget_numbut_draw(wcol, rect, zoom, state, roundboxalign, true); } -/* function in use for buttons and for view2d sliders */ void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) { uiWidgetBase wtb; @@ -4666,7 +4651,6 @@ static int widget_roundbox_set(uiBut *but, rcti *rect) /** \name Public API * \{ */ -/* conversion from old to new buttons, so still messy */ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBut *but, rcti *rect) { bTheme *btheme = UI_GetTheme(); @@ -5353,15 +5337,6 @@ void ui_draw_tooltip_background(const uiStyle *UNUSED(style), uiBlock *UNUSED(bl wt->draw(&wt->wcol, rect, 0, 0, 1.0f); } -/** - * Helper call to draw a menu item without a button. - * - * \param state: The state of the button, - * typically #UI_ACTIVE, #UI_BUT_DISABLED, #UI_BUT_INACTIVE. - * \param separator_type: The kind of separator which controls if and how the string is clipped. - * \param r_xmax: The right hand position of the text, this takes into the icon, - * padding and text clipping when there is not enough room to display the full text. - */ void ui_draw_menu_item(const uiFontStyle *fstyle, rcti *rect, const char *name, @@ -5500,10 +5475,6 @@ void ui_draw_menu_item(const uiFontStyle *fstyle, } } -/** - * Version of #ui_draw_preview_item() that does not draw the menu background and item text based on - * state. It just draws the preview and text directly. - */ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle, rcti *rect, const char *name, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index d960f5e6b1d..3b511e23384 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1035,12 +1035,6 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) return (const uchar *)cp; } -/** - * Initialize default theme. - * - * \note When you add new colors, created & saved themes need initialized - * use function below, #init_userdef_do_versions. - */ void UI_theme_init_default(void) { /* we search for the theme with name Default */ @@ -1091,9 +1085,6 @@ bTheme *UI_GetTheme(void) return U.themes.first; } -/** - * For the rare case we need to temp swap in a different theme (off-screen render). - */ void UI_Theme_Store(struct bThemeState *theme_state) { *theme_state = g_theme_state; @@ -1163,21 +1154,18 @@ void UI_FontThemeColor(int fontid, int colorid) BLF_color4ubv(fontid, color); } -/* get individual values, not scaled */ float UI_GetThemeValuef(int colorid) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((float)cp[0]); } -/* get individual values, not scaled */ int UI_GetThemeValue(int colorid) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((int)cp[0]); } -/* versions of the function above, which take a space-type */ float UI_GetThemeValueTypef(int colorid, int spacetype) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid); @@ -1190,7 +1178,6 @@ int UI_GetThemeValueType(int colorid, int spacetype) return ((int)cp[0]); } -/* get the color, range 0.0-1.0 */ void UI_GetThemeColor3fv(int colorid, float col[3]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1217,7 +1204,6 @@ void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4]) col[3] = ((float)cp[3]) / 255.0f; } -/* get the color, range 0.0-1.0, complete with shading offset */ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1350,7 +1336,6 @@ void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int of col[3] = ((float)a) / 255.0f; } -/* get the color, in char pointer */ void UI_GetThemeColor3ubv(int colorid, uchar col[3]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1359,7 +1344,6 @@ void UI_GetThemeColor3ubv(int colorid, uchar col[3]) col[2] = cp[2]; } -/* get the color, range 0.0-1.0, complete with shading offset */ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1381,7 +1365,6 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) col[3] = ((float)a) / 255.0f; } -/* get the color, in char pointer */ void UI_GetThemeColor4ubv(int colorid, uchar col[4]) { const uchar *cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -1459,7 +1442,6 @@ void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset) col[2] = b; } -/* get a 3 byte color, blended and shaded between two other char color pointers */ void UI_GetColorPtrBlendShade3ubv( const uchar cp1[3], const uchar cp2[3], uchar col[3], float fac, int offset) { diff --git a/source/blender/editors/interface/tree_view.cc b/source/blender/editors/interface/tree_view.cc index 58d76b7d3de..65cc699ee17 100644 --- a/source/blender/editors/interface/tree_view.cc +++ b/source/blender/editors/interface/tree_view.cc @@ -39,8 +39,8 @@ namespace blender::ui { /* ---------------------------------------------------------------------- */ /** - * Add a tree-item to the container. This is the only place where items should be added, it handles - * important invariants! + * Add a tree-item to the container. This is the only place where items should be added, it + * handles important invariants! */ AbstractTreeViewItem &TreeViewItemContainer::add_tree_item( std::unique_ptr<AbstractTreeViewItem> item) @@ -605,12 +605,6 @@ TreeViewLayoutBuilder::TreeViewLayoutBuilder(uiBlock &block) : block_(block) { } -/** - * Moves the button following the last added chevron closer to the list item. - * - * Iterates backwards over buttons until finding the tree-row button, which is assumed to be the - * first button added for the row, and can act as a delimiter that way. - */ void TreeViewLayoutBuilder::polish_layout(const uiBlock &block) { LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block.buttons) { @@ -735,11 +729,6 @@ bool UI_tree_view_item_matches(const uiTreeViewItemHandle *a_handle, return a.matches_including_parents(b); } -/** - * Attempt to start dragging the tree-item \a item_. This will not work if the tree item doesn't - * support dragging, i.e. it won't create a drag-controller upon request. - * \return True if dragging started successfully, otherwise false. - */ bool UI_tree_view_item_drag_start(bContext *C, uiTreeViewItemHandle *item_) { const AbstractTreeViewItem &item = reinterpret_cast<const AbstractTreeViewItem &>(*item_); @@ -786,10 +775,6 @@ char *UI_tree_view_item_drop_tooltip(const uiTreeViewItemHandle *item_, const wm return BLI_strdup(drop_controller->drop_tooltip(*drag).c_str()); } -/** - * Let a tree-view item handle a drop event. - * \return True if the drop was handled by the tree-view item. - */ bool UI_tree_view_item_drop_handle(struct bContext *C, uiTreeViewItemHandle *item_, const ListBase *drags) @@ -808,11 +793,6 @@ bool UI_tree_view_item_drop_handle(struct bContext *C, return false; } -/** - * Can \a item_handle be renamed right now? Not that this isn't just a mere wrapper around - * #AbstractTreeViewItem::can_rename(). This also checks if there is another item being renamed, - * and returns false if so. - */ bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle) { const AbstractTreeViewItem &item = reinterpret_cast<const AbstractTreeViewItem &>(*item_handle); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 9a6fbbf4016..a4c3f622ad5 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -228,16 +228,6 @@ static void view2d_masks(View2D *v2d, const rcti *mask_scroll) /** \name View2D Refresh and Validation (Spatial) * \{ */ -/** - * Initialize all relevant View2D data (including view rects if first time) - * and/or refresh mask sizes after view resize. - * - * - For some of these presets, it is expected that the region will have defined some - * additional settings necessary for the customization of the 2D viewport to its requirements - * - This function should only be called from region init() callbacks, where it is expected that - * this is called before #UI_view2d_size_update(), - * as this one checks that the rects are properly initialized. - */ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) { bool tot_changed = false, do_init; @@ -872,8 +862,6 @@ bool UI_view2d_area_supports_sync(ScrArea *area) return ELEM(area->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_SEQ, SPACE_CLIP, SPACE_GRAPH); } -/* Called by menus to activate it, or by view2d operators - * to make sure 'related' views stay in synchrony */ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) { /* don't continue if no view syncing to be done */ @@ -937,11 +925,6 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag) } } -/** - * Restore 'cur' rect to standard orientation (i.e. optimal maximum view of tot). - * This does not take into account if zooming the view on an axis - * will improve the view (if allowed). - */ void UI_view2d_curRect_reset(View2D *v2d) { float width, height; @@ -991,7 +974,6 @@ void UI_view2d_curRect_reset(View2D *v2d) /* ------------------ */ -/* Change the size of the maximum viewable area (i.e. 'tot' rect) */ void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resize) { /* don't do anything if either value is 0 */ @@ -1110,7 +1092,6 @@ static void view2d_map_cur_using_mask(const View2D *v2d, rctf *r_curmasked) } } -/* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */ void UI_view2d_view_ortho(const View2D *v2d) { rctf curmasked; @@ -1152,12 +1133,6 @@ void UI_view2d_view_ortho(const View2D *v2d) wmOrtho2(curmasked.xmin, curmasked.xmax, curmasked.ymin, curmasked.ymax); } -/** - * Set view matrices to only use one axis of 'cur' only - * - * \param xaxis: if non-zero, only use cur x-axis, - * otherwise use cur-yaxis (mostly this will be used for x). - */ void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis) { rctf curmasked; @@ -1184,7 +1159,6 @@ void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis) } } -/* Restore view matrices after drawing */ void UI_view2d_view_restore(const bContext *C) { ARegion *region = CTX_wm_region(C); @@ -1203,7 +1177,6 @@ void UI_view2d_view_restore(const bContext *C) /** \name Grid-Line Drawing * \{ */ -/* Draw a multi-level grid in given 2d-region */ void UI_view2d_multi_grid_draw( const View2D *v2d, int colorid, float step, int level_size, int totlevels) { @@ -1335,14 +1308,6 @@ static const DotGridLevelInfo level_info[9] = { {0.025f, 0.6f, 0.9f}, }; -/** - * Draw a multi-level grid of dots, with a dynamic number of levels based on the fading. - * - * \param grid_color_id: The theme color used for the points. Faded dynamically based on zoom. - * \param min_step: The base size of the grid. At different zoom levels, the visible grid may have - * a larger step size. - * \param grid_levels: The maximum grid depth. Larger grid levels will subdivide the grid more. - */ void UI_view2d_dot_grid_draw(const View2D *v2d, const int grid_color_id, const float min_step, @@ -1414,6 +1379,8 @@ void UI_view2d_dot_grid_draw(const View2D *v2d, */ struct View2DScrollers { /* focus bubbles */ + /* focus bubbles */ + /* focus bubbles */ int vert_min, vert_max; /* vertical scrollbar */ int hor_min, hor_max; /* horizontal scrollbar */ @@ -1423,7 +1390,6 @@ struct View2DScrollers { /* int horfull, vertfull; */ /* UNUSED */ }; -/* Calculate relevant scroller properties */ void UI_view2d_scrollers_calc(View2D *v2d, const rcti *mask_custom, struct View2DScrollers *r_scrollers) @@ -1550,7 +1516,6 @@ void UI_view2d_scrollers_calc(View2D *v2d, } } -/* Draw scrollbars in the given 2d-region */ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) { View2DScrollers scrollers; @@ -1646,18 +1611,6 @@ void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) /** \name List View Utilities * \{ */ -/** - * Get the 'cell' (row, column) that the given 2D-view coordinates - * (i.e. in 'tot' rect space) lie in. - * - * \param columnwidth, rowheight: size of each 'cell' - * \param startx, starty: coordinates (in 'tot' rect space) that the list starts from. - * This should be (0,0) for most views. However, for those where the starting row was offsetted - * (like for Animation Editor channel lists, to make the first entry more visible), these will be - * the min-coordinates of the first item. - * \param viewx, viewy: 2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for - * \param r_column, r_row: the 'coordinates' of the relevant 'cell' - */ void UI_view2d_listview_view_to_cell(float columnwidth, float rowheight, float startx, @@ -1705,12 +1658,6 @@ float UI_view2d_region_to_view_y(const struct View2D *v2d, float y) (BLI_rctf_size_y(&v2d->cur) * (y - v2d->mask.ymin) / BLI_rcti_size_y(&v2d->mask))); } -/** - * Convert from screen/region space to 2d-View space - * - * \param x, y: coordinates to convert - * \param r_view_x, r_view_y: resultant coordinates - */ void UI_view2d_region_to_view( const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) { @@ -1744,13 +1691,6 @@ float UI_view2d_view_to_region_y(const View2D *v2d, float y) (((y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur)) * BLI_rcti_size_y(&v2d->mask))); } -/** - * Convert from 2d-View space to screen/region space - * \note Coordinates are clamped to lie within bounds of region - * - * \param x, y: Coordinates to convert. - * \param r_region_x, r_region_y: Resultant coordinates. - */ bool UI_view2d_view_to_region_clip( const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { @@ -1772,14 +1712,6 @@ bool UI_view2d_view_to_region_clip( return false; } -/** - * Convert from 2d-view space to screen/region space - * - * \note Coordinates are NOT clamped to lie within bounds of region. - * - * \param x, y: Coordinates to convert. - * \param r_region_x, r_region_y: Resultant coordinates. - */ void UI_view2d_view_to_region( const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { @@ -1874,7 +1806,6 @@ bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, /** \name Utilities * \{ */ -/* View2D data by default resides in region, so get from region stored in context */ View2D *UI_view2d_fromcontext(const bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -1889,7 +1820,6 @@ View2D *UI_view2d_fromcontext(const bContext *C) return &(region->v2d); } -/* Same as above, but it returns region-window. Utility for pull-downs or buttons. */ View2D *UI_view2d_fromcontext_rwin(const bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -1908,8 +1838,6 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C) return &(region->v2d); } -/* Get scrollbar sizes of the current 2D view. The size will be zero if the view has its scrollbars - * disabled. */ void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y) { const int scroll = view2d_scroll_mapped(v2d->scroll); @@ -1933,14 +1861,6 @@ void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y) } } -/** - * Calculate the scale per-axis of the drawing-area - * - * Is used to inverse correct drawing of icons, etc. that need to follow view - * but not be affected by scale - * - * \param r_x, r_y: scale on each axis - */ void UI_view2d_scale_get(const View2D *v2d, float *r_x, float *r_y) { if (r_x) { @@ -1958,9 +1878,6 @@ float UI_view2d_scale_get_y(const View2D *v2d) { return BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur); } -/** - * Same as `UI_view2d_scale_get() - 1.0f / x, y`. - */ void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y) { if (r_x) { @@ -1971,10 +1888,6 @@ void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y) } } -/** - * Simple functions for consistent center offset access. - * Used by node editor to shift view center for each individual node tree. - */ void UI_view2d_center_get(const struct View2D *v2d, float *r_x, float *r_y) { /* get center */ @@ -1993,12 +1906,6 @@ void UI_view2d_center_set(struct View2D *v2d, float x, float y) UI_view2d_curRect_validate(v2d); } -/** - * Simple pan function - * (0.0, 0.0) bottom left - * (0.5, 0.5) center - * (1.0, 1.0) top right. - */ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) { if (xfac != -1.0f) { @@ -2022,17 +1929,6 @@ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) UI_view2d_curRect_validate(v2d); } -/** - * Check if mouse is within scrollers - * - * \param x, y: Mouse coordinates in screen (not region) space. - * \param r_scroll: Mapped view2d scroll flag. - * - * \return appropriate code for match. - * - 'h' = in horizontal scroller. - * - 'v' = in vertical scroller. - * - 0 = not in scroller. - */ char UI_view2d_mouse_in_scrollers_ex(const ARegion *region, const View2D *v2d, const int xy[2], @@ -2154,7 +2050,6 @@ void UI_view2d_text_cache_add( } } -/* no clip (yet) */ void UI_view2d_text_cache_add_rectf( View2D *v2d, const rctf *rect_view, const char *str, size_t str_len, const uchar col[4]) { diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c index 3ff5b471731..2497081b412 100644 --- a/source/blender/editors/interface/view2d_gizmo_navigate.c +++ b/source/blender/editors/interface/view2d_gizmo_navigate.c @@ -251,7 +251,6 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false); } -/* Caller defines the name for gizmo group. */ void VIEW2D_GGT_navigate_impl(wmGizmoGroupType *gzgt, const char *idname) { gzgt->name = "View2D Navigate"; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 0bca4e327cc..0d3c427bf39 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1570,8 +1570,6 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) return min_ff(fac_max, 1.0f); } -/* will start timer if appropriate */ -/* the arguments are the desired situation */ void UI_view2d_smooth_view(bContext *C, ARegion *region, const rctf *cur, const int smooth_viewtx) { wmWindowManager *wm = CTX_wm_manager(C); @@ -1761,7 +1759,6 @@ typedef struct v2dScrollerMove { * For now, we don't need to have a separate (internal) header for structs like this... */ struct View2DScrollers { - /* focus bubbles */ int vert_min, vert_max; /* vertical scrollbar */ int hor_min, hor_max; /* horizontal scrollbar */ diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c index 23eaf991fd3..6d79d063a2f 100644 --- a/source/blender/editors/lattice/editlattice_undo.c +++ b/source/blender/editors/lattice/editlattice_undo.c @@ -278,7 +278,6 @@ static void lattice_undosys_foreach_ID_ref(UndoStep *us_p, } } -/* Export for ED_undo_sys. */ void ED_lattice_undosys_type(UndoType *ut) { ut->name = "Edit Lattice"; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 92e774bfe86..9504a8783a0 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -686,8 +686,6 @@ static float *mask_rasterize(Mask *mask, const int width, const int height) return buffer; } -/* sets up the opengl context. - * width, height are to match the values from ED_mask_get_size() */ void ED_mask_draw_region( Depsgraph *depsgraph, Mask *mask_, diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index d9efbef4b42..3668f3bb34e 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -52,7 +52,6 @@ /* ***************************************** */ /* Generics - Loopers */ -/* Loops over the mask-frames for a mask-layer, and applies the given callback */ bool ED_masklayer_frames_looper(MaskLayer *mask_layer, Scene *scene, bool (*mask_layer_shape_cb)(MaskLayerShape *, Scene *)) @@ -80,7 +79,6 @@ bool ED_masklayer_frames_looper(MaskLayer *mask_layer, /* ****************************************** */ /* Data Conversion Tools */ -/* make a listing all the mask-frames in a layer as cfraelems */ void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool onlysel) { MaskLayerShape *mask_layer_shape; @@ -108,7 +106,6 @@ void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool on /* ***************************************** */ /* Selection Tools */ -/* check if one of the frames in this layer is selected */ bool ED_masklayer_frame_select_check(const MaskLayer *mask_layer) { MaskLayerShape *mask_layer_shape; @@ -150,7 +147,6 @@ static void mask_layer_shape_select(MaskLayerShape *mask_layer_shape, short sele } } -/* set all/none/invert select (like above, but with SELECT_* modes) */ void ED_mask_select_frames(MaskLayer *mask_layer, short select_mode) { MaskLayerShape *mask_layer_shape; @@ -167,7 +163,6 @@ void ED_mask_select_frames(MaskLayer *mask_layer, short select_mode) } } -/* set all/none/invert select */ void ED_masklayer_frame_select_set(MaskLayer *mask_layer, short mode) { /* error checking */ @@ -179,7 +174,6 @@ void ED_masklayer_frame_select_set(MaskLayer *mask_layer, short mode) ED_mask_select_frames(mask_layer, mode); } -/* select the frame in this layer that occurs on this frame (there should only be one at most) */ void ED_mask_select_frame(MaskLayer *mask_layer, int selx, short select_mode) { MaskLayerShape *mask_layer_shape; @@ -195,7 +189,6 @@ void ED_mask_select_frame(MaskLayer *mask_layer, int selx, short select_mode) } } -/* select the frames in this layer that occur within the bounds specified */ void ED_masklayer_frames_select_box(MaskLayer *mask_layer, float min, float max, short select_mode) { MaskLayerShape *mask_layer_shape; @@ -213,7 +206,6 @@ void ED_masklayer_frames_select_box(MaskLayer *mask_layer, float min, float max, } } -/* select the frames in this layer that occur within the lasso/circle region specified */ void ED_masklayer_frames_select_region(KeyframeEditData *ked, MaskLayer *mask_layer, short tool, @@ -253,7 +245,6 @@ void ED_masklayer_frames_select_region(KeyframeEditData *ked, /* ***************************************** */ /* Frame Editing Tools */ -/* Delete selected frames */ bool ED_masklayer_frames_delete(MaskLayer *mask_layer) { MaskLayerShape *mask_layer_shape, *mask_layer_shape_next; @@ -278,7 +269,6 @@ bool ED_masklayer_frames_delete(MaskLayer *mask_layer) return changed; } -/* Duplicate selected frames from given mask-layer */ void ED_masklayer_frames_duplicate(MaskLayer *mask_layer) { MaskLayerShape *mask_layer_shape, *gpfn; @@ -344,7 +334,6 @@ static bool snap_mask_layer_nearmarker(MaskLayerShape *mask_layer_shape, Scene * return false; } -/* snap selected frames to ... */ void ED_masklayer_snap_frames(MaskLayer *mask_layer, Scene *scene, short mode) { switch (mode) { diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index ee1784011ea..41ff14dcd5f 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -32,13 +32,18 @@ struct wmOperatorType; /* internal exports only */ /* mask_add.c */ + void MASK_OT_add_vertex(struct wmOperatorType *ot); void MASK_OT_add_feather_vertex(struct wmOperatorType *ot); void MASK_OT_primitive_circle_add(struct wmOperatorType *ot); void MASK_OT_primitive_square_add(struct wmOperatorType *ot); /* mask_ops.c */ + struct Mask *ED_mask_new(struct bContext *C, const char *name); +/** + * Get active layer. Will create mask/layer to be sure there's an active layer. + */ struct MaskLayer *ED_mask_layer_ensure(struct bContext *C, bool *r_added_mask); void MASK_OT_new(struct wmOperatorType *ot); @@ -55,6 +60,7 @@ void MASK_OT_hide_view_clear(struct wmOperatorType *ot); void MASK_OT_hide_view_set(struct wmOperatorType *ot); void MASK_OT_feather_weight_clear(struct wmOperatorType *ot); void MASK_OT_switch_direction(struct wmOperatorType *ot); +/* Named to match mesh recalculate normals. */ void MASK_OT_normals_make_consistent(struct wmOperatorType *ot); void MASK_OT_handle_type_set(struct wmOperatorType *ot); @@ -66,10 +72,13 @@ void MASK_OT_copy_splines(struct wmOperatorType *ot); void MASK_OT_paste_splines(struct wmOperatorType *ot); /* mask_relationships.c */ + +/** based on #OBJECT_OT_parent_set */ void MASK_OT_parent_set(struct wmOperatorType *ot); void MASK_OT_parent_clear(struct wmOperatorType *ot); /* mask_select.c */ + void MASK_OT_select(struct wmOperatorType *ot); void MASK_OT_select_all(struct wmOperatorType *ot); @@ -81,6 +90,7 @@ void MASK_OT_select_linked(struct wmOperatorType *ot); void MASK_OT_select_more(struct wmOperatorType *ot); void MASK_OT_select_less(struct wmOperatorType *ot); +/* 'check' select */ bool ED_mask_spline_select_check(const struct MaskSpline *spline); bool ED_mask_layer_select_check(const struct MaskLayer *mask_layer); bool ED_mask_select_check(const struct Mask *mask); @@ -91,6 +101,7 @@ void ED_mask_select_toggle_all(struct Mask *mask, int action); void ED_mask_select_flush_all(struct Mask *mask); /* mask_editor.c */ + bool ED_maskedit_poll(struct bContext *C); bool ED_maskedit_mask_poll(struct bContext *C); @@ -108,6 +119,7 @@ void ED_mask_view_lock_state_restore_no_jump(const struct bContext *C, const MaskViewLockState *state); /* mask_query.c */ + bool ED_mask_find_nearest_diff_point(const struct bContext *C, struct Mask *mask, const float normal_co[2], diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index fd5925bbd0c..8feb526c8d5 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -83,9 +83,6 @@ Mask *ED_mask_new(bContext *C, const char *name) return mask; } -/** - * Get active layer. Will create mask/layer to be sure there's an active layer. - */ MaskLayer *ED_mask_layer_ensure(bContext *C, bool *r_added_mask) { Mask *mask = CTX_data_edit_mask(C); @@ -1616,7 +1613,6 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op) return OPERATOR_CANCELLED; } -/* Named to match mesh recalculate normals. */ void MASK_OT_normals_make_consistent(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/mask/mask_query.c b/source/blender/editors/mask/mask_query.c index e66c4e45e27..de80d9f04bd 100644 --- a/source/blender/editors/mask/mask_query.c +++ b/source/blender/editors/mask/mask_query.c @@ -489,7 +489,6 @@ bool ED_mask_feather_find_nearest(const bContext *C, return false; } -/* takes event->mval */ void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float co[2]) { if (area) { @@ -523,8 +522,6 @@ void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float } } -/* input: x/y - mval space - * output: xr/yr - mask point space */ void ED_mask_point_pos(ScrArea *area, ARegion *region, float x, float y, float *xr, float *yr) { float co[2]; diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index 9c4740b3087..259402efbf1 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -168,7 +168,6 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -/** based on #OBJECT_OT_parent_set */ void MASK_OT_parent_set(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index fe6acac7d29..dd4a557f449 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -52,7 +52,6 @@ /** \name Public Mask Selection API * \{ */ -/* 'check' select */ bool ED_mask_spline_select_check(const MaskSpline *spline) { for (int i = 0; i < spline->tot_point; i++) { diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 6cdc622183f..06547c94992 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -50,8 +50,6 @@ /* own include */ -/* copy the face flags, most importantly selection from the mesh to the final derived mesh, - * use in object mode when selecting faces (while painting) */ void paintface_flush_flags(struct bContext *C, Object *ob, short flag) { Mesh *me = BKE_mesh_from_object(ob); @@ -437,9 +435,6 @@ bool paintface_mouse_select( return true; } -/* (similar to void paintface_flush_flags(Object *ob)) - * copy the vertex flags, most importantly selection from the mesh to the final derived mesh, - * use in object mode when selecting vertices (while painting) */ void paintvert_flush_flags(Object *ob) { Mesh *me = BKE_mesh_from_object(ob); @@ -492,10 +487,6 @@ void paintvert_tag_select_update(struct bContext *C, struct Object *ob) WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); } -/** - * \note if the caller passes false to flush_flags, - * then they will need to run #paintvert_flush_flags(ob) themselves. - */ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags) { Mesh *me; diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 912399c25b3..913be7d69bb 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -144,7 +144,6 @@ static bool edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const ch return true; } -/* extrudes individual edges */ bool edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag, diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 0a22d87c0bc..3772a37ac44 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -4866,9 +4866,6 @@ static bool edbm_mesh_knife_point_isect(LinkNode *polys, const float cent_ss[2]) return false; } -/** - * \param use_tag: When set, tag all faces inside the polylines. - */ void EDBM_mesh_knife(bContext *C, ViewContext *vc, LinkNode *polys, bool use_tag, bool cut_through) { KnifeTool_OpData *kcd; diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index e0768bcff24..7e05209f79e 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -267,17 +267,6 @@ static void findnearestvert__doClosest(void *userData, } } -/** - * Nearest vertex under the cursor. - * - * \param dist_px_manhattan_p: (in/out), minimal distance to the nearest and at the end, - * actual distance. - * \param use_select_bias: - * - When true, selected vertices are given a 5 pixel bias - * to make them further than unselect verts. - * - When false, unselected vertices are given the bias. - * \param use_cycle: Cycle over elements within #FIND_NEAR_CYCLE_THRESHOLD_MIN in order of index. - */ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc, float *dist_px_manhattan_p, const bool use_select_bias, @@ -713,13 +702,6 @@ static void findnearestface__doClosest(void *userData, } } -/** - * \param use_zbuf_single_px: Special case, when using the back-buffer selection, - * only use the pixel at `vc->mval` instead of using `dist_px_manhattan_p` to search over a larger - * region. This is needed because historically selection worked this way for a long time, however - * it's reasonable that some callers might want to expand the region too. So add an argument to do - * this, - */ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc, float *dist_px_manhattan_p, float *r_dist_center, @@ -2217,8 +2199,6 @@ static void edbm_strip_selections(BMEditMesh *em) } } -/* when switching select mode, makes sure selection is consistent for editing */ -/* also for paranoia checks to make sure edge or face mode works */ void EDBM_selectmode_set(BMEditMesh *em) { BMVert *eve; @@ -2273,20 +2253,6 @@ void EDBM_selectmode_set(BMEditMesh *em) } } -/** - * Expand & Contract the Selection - * (used when changing modes and Ctrl key held) - * - * Flush the selection up: - * - vert -> edge - * - vert -> face - * - edge -> face - * - * Flush the selection down: - * - face -> edge - * - face -> vert - * - edge -> vert - */ void EDBM_selectmode_convert(BMEditMesh *em, const short selectmode_old, const short selectmode_new) @@ -2393,7 +2359,6 @@ void EDBM_selectmode_convert(BMEditMesh *em, } } -/* user facing function, does notification */ bool EDBM_selectmode_toggle_multi(bContext *C, const short selectmode_new, const int action, @@ -2569,12 +2534,6 @@ bool EDBM_selectmode_set_multi(bContext *C, const short selectmode) return changed; } -/** - * Use to disable a selectmode if its enabled, Using another mode as a fallback - * if the disabled mode is the only mode set. - * - * \return true if the mode is changed. - */ bool EDBM_selectmode_disable(Scene *scene, BMEditMesh *em, const short selectmode_disable, diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 6cd7d912820..633e8183eb3 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -8226,7 +8226,6 @@ enum { EDBM_CLNOR_MODAL_POINTTO_SET_USE_SELECTED = 114, }; -/* Called in transform_ops.c, on each regeneration of key-maps. */ wmKeyMap *point_normals_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c index f52cd94b8dc..f22d4bbe580 100644 --- a/source/blender/editors/mesh/editmesh_undo.c +++ b/source/blender/editors/mesh/editmesh_undo.c @@ -915,7 +915,6 @@ static void mesh_undosys_foreach_ID_ref(UndoStep *us_p, } } -/* Export for ED_undo_sys. */ void ED_mesh_undosys_type(UndoType *ut) { ut->name = "Edit Mesh"; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 3ba8f601937..013d5e5a661 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -68,9 +68,6 @@ * just as the undo stack would. * So leaving this as an interface for further work */ -/** - * Save a copy of the #BMesh for restoring later. - */ BMBackup EDBM_redo_state_store(BMEditMesh *em) { BMBackup backup; @@ -93,9 +90,6 @@ void EDBM_redo_state_restore(BMBackup *backup, BMEditMesh *em, bool recalc_loopt } } -/** - * Delete the backup, flushing it to an edit-mesh. - */ void EDBM_redo_state_restore_and_free(BMBackup *backup, BMEditMesh *em, bool recalc_looptri) { BM_mesh_data_free(em->bm); @@ -139,11 +133,6 @@ bool EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char * return true; } -/** - * The return value: - * - False on error (the mesh must not be changed). - * - True on success, executes and finishes a #BMesh operator. - */ bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool do_report) { const char *errmsg; @@ -320,11 +309,6 @@ void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index) EDBM_selectmode_flush(me->edit_mesh); } -/** - * \warning This can invalidate the #Mesh runtime cache of other objects (for linked duplicates). - * Most callers should run #DEG_id_tag_update on `ob->data`, see: T46738, T46913. - * This ensures #BKE_object_free_derived_caches runs on all objects that use this mesh. - */ void EDBM_mesh_load_ex(Main *bmain, Object *ob, bool free_data) { Mesh *me = ob->data; @@ -363,9 +347,6 @@ void EDBM_mesh_load(Main *bmain, Object *ob) EDBM_mesh_load_ex(bmain, ob, true); } -/** - * Should only be called on the active edit-mesh, otherwise call #BKE_editmesh_free_data. - */ void EDBM_mesh_free_data(BMEditMesh *em) { /* These tables aren't used yet, so it's not strictly necessary @@ -486,9 +467,6 @@ void EDBM_flag_enable_all(BMEditMesh *em, const char hflag) /** \name UV Vertex Map API * \{ */ -/** - * Return a new #UvVertMap from the edit-mesh. - */ UvVertMap *BM_uv_vert_map_create(BMesh *bm, const bool use_select, const bool use_winding) { BMVert *ev; @@ -632,7 +610,6 @@ UvMapVert *BM_uv_vert_map_at_index(UvVertMap *vmap, uint v) return vmap->vert[v]; } -/* A specialized vert map used by stitch operator */ UvElementMap *BM_uv_element_map_create(BMesh *bm, const Scene *scene, const bool face_selected, @@ -953,10 +930,6 @@ UvElement *BM_uv_element_get(UvElementMap *map, BMFace *efa, BMLoop *l) /** \name Data Layer Checks * \{ */ -/** - * last_sel, use em->act_face otherwise get the last selected face in the editselections - * at the moment, last_sel is mainly useful for making sure the space image doesn't flicker. - */ BMFace *EDBM_uv_active_face_get(BMEditMesh *em, const bool sloppy, const bool selected) { BMFace *efa = NULL; @@ -974,7 +947,6 @@ BMFace *EDBM_uv_active_face_get(BMEditMesh *em, const bool sloppy, const bool se return NULL; } -/* Can we edit UV's for this mesh? */ bool EDBM_uv_check(BMEditMesh *em) { /* some of these checks could be a touch overkill */ @@ -1015,20 +987,10 @@ static BMVert *cache_mirr_intptr_as_bmvert(const intptr_t *index_lookup, int ind * \endcode */ -/* BM_SEARCH_MAXDIST is too big, copied from 2.6x MOC_THRESH, should become a - * preference */ +/* BM_SEARCH_MAXDIST is too big, copied from 2.6x MOC_THRESH, should become a preference. */ #define BM_SEARCH_MAXDIST_MIRR 0.00002f #define BM_CD_LAYER_ID "__mirror_index" -/** - * \param em: Editmesh. - * \param use_self: Allow a vertex to point to its self (middle verts). - * \param use_select: Restrict to selected verts. - * \param respecthide: Skip hidden vertices. - * \param use_topology: Use topology mirror. - * \param maxdist: Distance for close point test. - * \param r_index: Optional array to write into, as an alternative to a customdata layer - * (length of total verts). - */ + void EDBM_verts_mirror_cache_begin_ex(BMEditMesh *em, const int axis, const bool use_self, @@ -1255,7 +1217,6 @@ void EDBM_verts_mirror_apply(BMEditMesh *em, const int sel_from, const int sel_t /** \name Hide/Reveal API * \{ */ -/* swap is 0 or 1, if 1 it hides not selected */ bool EDBM_mesh_hide(BMEditMesh *em, bool swap) { BMIter iter; @@ -1410,9 +1371,6 @@ void EDBM_stats_update(BMEditMesh *em) } } -/** - * So many tools call these that we better make it a generic function. - */ void EDBM_update(Mesh *mesh, const struct EDBMUpdate_Params *params) { BMEditMesh *em = mesh->edit_mesh; @@ -1459,7 +1417,6 @@ void EDBM_update(Mesh *mesh, const struct EDBMUpdate_Params *params) #endif } -/* Bad level call from Python API. */ void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool is_destructive) { EDBM_update(me, @@ -1476,7 +1433,6 @@ void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool /** \name Operator Helpers * \{ */ -/* poll call for mesh operators requiring a view3d context */ bool EDBM_view3d_poll(bContext *C) { if (ED_operator_editmesh(C) && ED_operator_view3d_active(C)) { @@ -1509,11 +1465,6 @@ BMElem *EDBM_elem_from_selectmode(BMEditMesh *em, BMVert *eve, BMEdge *eed, BMFa return ele; } -/** - * Used when we want to store a single index for any vert/edge/face. - * - * Intended for use with operators. - */ int EDBM_elem_to_index_any(BMEditMesh *em, BMElem *ele) { BMesh *bm = em->bm; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 7ce408b571f..d7d1dc7dcae 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -208,7 +208,6 @@ static void mesh_uv_reset_mface(MPoly *mp, MLoopUV *mloopuv) mesh_uv_reset_array(fuv, mp->totloop); } -/* without bContext, called in uvedit */ void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum) { BMEditMesh *em = me->edit_mesh; @@ -253,10 +252,11 @@ void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me) WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); } -/* NOTE: keep in sync with #ED_mesh_color_add. */ int ED_mesh_uv_texture_add( Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) { + /* NOTE: keep in sync with #ED_mesh_color_add. */ + BMEditMesh *em; int layernum_dst; @@ -381,10 +381,11 @@ bool ED_mesh_uv_texture_remove_named(Mesh *me, const char *name) return false; } -/* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ int ED_mesh_color_add( Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) { + /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ + BMEditMesh *em; int layernum; @@ -516,10 +517,11 @@ static bool sculpt_vertex_color_remove_poll(bContext *C) return false; } -/* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ int ED_mesh_sculpt_color_add( Mesh *me, const char *name, const bool active_set, const bool do_init, ReportList *reports) { + /* NOTE: keep in sync with #ED_mesh_uv_texture_add. */ + BMEditMesh *em; int layernum; @@ -905,6 +907,7 @@ static int mesh_customdata_mask_clear_exec(bContext *C, wmOperator *UNUSED(op)) void MESH_OT_customdata_mask_clear(wmOperatorType *ot) { + /* NOTE: no create_mask yet */ /* identifiers */ ot->name = "Clear Sculpt Mask Data"; diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index abff3c70e67..bba142133a6 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -43,7 +43,7 @@ struct wmOperatorType; * BMEdit module is for code shared with blenkernel that concerns * the BMEditMesh structure. */ -/* Calls a bmesh op, reporting errors to the user, etc */ +/** Calls a bmesh op, reporting errors to the user, etc. */ bool EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...); bool EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op, @@ -51,17 +51,26 @@ bool EDBM_op_call_and_selectf(struct BMEditMesh *em, const bool select_replace, const char *fmt, ...); -/* Same as above, but doesn't report errors. */ +/** + * Same as above, but doesn't report errors. + */ bool EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...); -/* these next two functions are the split version of EDBM_op_callf, so you can - * do stuff with a bmesh operator, after initializing it but before executing - * it. +/** + * These next two functions are the split version of EDBM_op_callf, so you can + * do stuff with a bmesh operator, after initializing it but before executing it. * * execute the operator with BM_Exec_Op */ bool EDBM_op_init( struct BMEditMesh *em, struct BMOperator *bmop, struct wmOperator *op, const char *fmt, ...); -/* Cleans up after a bmesh operator */ + +/** + * Cleans up after a bmesh operator. + * + * The return value: + * - False on error (the mesh must not be changed). + * - True on success, executes and finishes a #BMesh operator. + */ bool EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop, struct wmOperator *op, @@ -69,6 +78,9 @@ bool EDBM_op_finish(struct BMEditMesh *em, void EDBM_stats_update(struct BMEditMesh *em); +/** + * Poll call for mesh operators requiring a view3d context. + */ bool EDBM_view3d_poll(struct bContext *C); struct BMElem *EDBM_elem_from_selectmode(struct BMEditMesh *em, @@ -76,6 +88,11 @@ struct BMElem *EDBM_elem_from_selectmode(struct BMEditMesh *em, struct BMEdge *eed, struct BMFace *efa); +/** + * Used when we want to store a single index for any vert/edge/face. + * + * Intended for use with operators. + */ int EDBM_elem_to_index_any(struct BMEditMesh *em, struct BMElem *ele); struct BMElem *EDBM_elem_from_index_any(struct BMEditMesh *em, uint index); @@ -88,12 +105,16 @@ struct BMElem *EDBM_elem_from_index_any_multi(struct ViewLayer *view_layer, uint elem_index, struct Object **r_obedit); +/** + * Extrudes individual edges. + */ bool edbm_extrude_edges_indiv(struct BMEditMesh *em, struct wmOperator *op, const char hflag, const bool use_normal_flip); /* *** editmesh_add.c *** */ + void MESH_OT_primitive_plane_add(struct wmOperatorType *ot); void MESH_OT_primitive_cube_add(struct wmOperatorType *ot); void MESH_OT_primitive_circle_add(struct wmOperatorType *ot); @@ -105,16 +126,20 @@ void MESH_OT_primitive_uv_sphere_add(struct wmOperatorType *ot); void MESH_OT_primitive_ico_sphere_add(struct wmOperatorType *ot); /* *** editmesh_add_gizmo.c *** */ + void MESH_OT_primitive_cube_add_gizmo(struct wmOperatorType *ot); /* *** editmesh_bevel.c *** */ + void MESH_OT_bevel(struct wmOperatorType *ot); struct wmKeyMap *bevel_modal_keymap(struct wmKeyConfig *keyconf); /* *** editmesh_bisect.c *** */ + void MESH_OT_bisect(struct wmOperatorType *ot); /* *** editmesh_extrude.c *** */ + void MESH_OT_extrude_repeat(struct wmOperatorType *ot); void MESH_OT_extrude_region(struct wmOperatorType *ot); void MESH_OT_extrude_context(struct wmOperatorType *ot); @@ -124,15 +149,20 @@ void MESH_OT_extrude_faces_indiv(struct wmOperatorType *ot); void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot); /* *** editmesh_extrude_screw.c *** */ + void MESH_OT_screw(struct wmOperatorType *ot); /* *** editmesh_extrude_spin.c *** */ + void MESH_OT_spin(struct wmOperatorType *ot); + /* *** editmesh_extrude_spin_gizmo.c *** */ + void MESH_GGT_spin(struct wmGizmoGroupType *gzgt); void MESH_GGT_spin_redo(struct wmGizmoGroupType *gzgt); /* *** editmesh_polybuild.c *** */ + void MESH_OT_polybuild_face_at_cursor(struct wmOperatorType *ot); void MESH_OT_polybuild_split_at_cursor(struct wmOperatorType *ot); void MESH_OT_polybuild_dissolve_at_cursor(struct wmOperatorType *ot); @@ -140,16 +170,22 @@ void MESH_OT_polybuild_transform_at_cursor(struct wmOperatorType *ot); void MESH_OT_polybuild_delete_at_cursor(struct wmOperatorType *ot); /* *** editmesh_inset.c *** */ + void MESH_OT_inset(struct wmOperatorType *ot); /* *** editmesh_intersect.c *** */ + void MESH_OT_intersect(struct wmOperatorType *ot); void MESH_OT_intersect_boolean(struct wmOperatorType *ot); void MESH_OT_face_split_by_edges(struct wmOperatorType *ot); /* *** editmesh_knife.c *** */ + void MESH_OT_knife_tool(struct wmOperatorType *ot); void MESH_OT_knife_project(struct wmOperatorType *ot); +/** + * \param use_tag: When set, tag all faces inside the polylines. + */ void EDBM_mesh_knife(struct bContext *C, struct ViewContext *vc, struct LinkNode *polys, @@ -159,13 +195,16 @@ void EDBM_mesh_knife(struct bContext *C, struct wmKeyMap *knifetool_modal_keymap(struct wmKeyConfig *keyconf); /* *** editmesh_loopcut.c *** */ + void MESH_OT_loopcut(struct wmOperatorType *ot); /* *** editmesh_rip.c *** */ + void MESH_OT_rip(struct wmOperatorType *ot); void MESH_OT_rip_edge(struct wmOperatorType *ot); /* *** editmesh_select.c *** */ + void MESH_OT_select_similar(struct wmOperatorType *ot); void MESH_OT_select_similar_region(struct wmOperatorType *ot); void MESH_OT_select_mode(struct wmOperatorType *ot); @@ -265,10 +304,12 @@ void MESH_OT_smooth_normals(struct wmOperatorType *ot); void MESH_OT_mod_weighted_strength(struct wmOperatorType *ot); /* *** editmesh_mask_extract.c *** */ + void MESH_OT_paint_mask_extract(struct wmOperatorType *ot); void MESH_OT_face_set_extract(struct wmOperatorType *ot); void MESH_OT_paint_mask_slice(struct wmOperatorType *ot); +/** Called in transform_ops.c, on each regeneration of key-maps. */ struct wmKeyMap *point_normals_modal_keymap(wmKeyConfig *keyconf); #if defined(WITH_FREESTYLE) @@ -277,13 +318,13 @@ void MESH_OT_mark_freestyle_face(struct wmOperatorType *ot); #endif /* *** mesh_data.c *** */ + void MESH_OT_uv_texture_add(struct wmOperatorType *ot); void MESH_OT_uv_texture_remove(struct wmOperatorType *ot); void MESH_OT_vertex_color_add(struct wmOperatorType *ot); void MESH_OT_vertex_color_remove(struct wmOperatorType *ot); void MESH_OT_sculpt_vertex_color_add(struct wmOperatorType *ot); void MESH_OT_sculpt_vertex_color_remove(struct wmOperatorType *ot); -/* no create_mask yet */ void MESH_OT_customdata_mask_clear(struct wmOperatorType *ot); void MESH_OT_customdata_skin_add(struct wmOperatorType *ot); void MESH_OT_customdata_skin_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 94823b92c44..d616dd3bb63 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -372,7 +372,6 @@ void ED_operatormacros_mesh(void) RNA_boolean_set(otmacro->ptr, "mirror", false); } -/* note mesh keymap also for other space? */ void ED_keymap_mesh(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Mesh", 0, 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 1b720f2c14d..7295d33acb6 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -876,12 +876,6 @@ BLI_INLINE void mesh_mirror_topo_table_get_meshes(Object *ob, *r_em_mirror = em_mirror; } -/** - * Mode is 's' start, or 'e' end, or 'u' use - * if end, ob can be NULL. - * \note This is supposed return -1 on error, - * which callers are currently checking for, but is not used so far. - */ void ED_mesh_mirror_topo_table_begin(Object *ob, Mesh *me_eval) { Mesh *me_mirror; @@ -1012,11 +1006,6 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob, return editbmesh_get_x_mirror_vert_spatial(ob, em, co); } -/** - * Wrapper for object-mode/edit-mode. - * - * call #BM_mesh_elem_table_ensure first for editmesh. - */ int ED_mesh_mirror_get_vert(Object *ob, int index) { Mesh *me = ob->data; @@ -1146,7 +1135,6 @@ static bool mirror_facecmp(const void *a, const void *b) return (mirror_facerotation((MFace *)a, (MFace *)b) == -1); } -/* This is a Mesh-based copy of mesh_get_x_mirror_faces() */ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval) { Mesh *me = ob->data; @@ -1212,12 +1200,6 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval) /* selection, vertex and face */ /* returns 0 if not found, otherwise 1 */ -/** - * Face selection in object mode, - * currently only weight-paint and vertex-paint use this. - * - * \return boolean true == Found - */ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index) { ViewContext vc; @@ -1280,10 +1262,6 @@ static void ed_mesh_pick_face_vert__mpoly_find( } } } -/** - * Use when the back buffer stores face index values. but we want a vert. - * This gets the face then finds the closest vertex to mval. - */ bool ED_mesh_pick_face_vert( bContext *C, Object *ob, const int mval[2], uint dist_px, uint *r_index) { diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c index f7b53b5513f..5c724ac2d01 100644 --- a/source/blender/editors/metaball/editmball_undo.c +++ b/source/blender/editors/metaball/editmball_undo.c @@ -253,7 +253,6 @@ static void mball_undosys_foreach_ID_ref(UndoStep *us_p, } } -/* Export for ED_undo_sys. */ void ED_mball_undosys_type(UndoType *ut) { ut->name = "Edit MBall"; diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 292052b778a..bedb9d4f4f4 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -62,7 +62,6 @@ /** \name Edit Mode Functions * \{ */ -/* This function is used to free all MetaElems from MetaBall */ void ED_mball_editmball_free(Object *obedit) { MetaBall *mb = (MetaBall *)obedit->data; @@ -71,8 +70,6 @@ void ED_mball_editmball_free(Object *obedit) mb->lastelem = NULL; } -/* This function is called, when MetaBall Object is - * switched from object mode to edit mode */ void ED_mball_editmball_make(Object *obedit) { MetaBall *mb = (MetaBall *)obedit->data; @@ -90,9 +87,6 @@ void ED_mball_editmball_make(Object *obedit) mb->editelems = &mb->elems; } -/* This function is called, when MetaBall Object switched from - * edit mode to object mode. List of MetaElements is copied - * from object->data->edit_elems to object->data->elems. */ void ED_mball_editmball_load(Object *UNUSED(obedit)) { } @@ -122,9 +116,6 @@ bool ED_mball_deselect_all_multi(bContext *C) /** \name Add Meta Primitive Utility * \{ */ -/** - * Add meta-element primitive to meta-ball object (which is in edit mode). - */ MetaElem *ED_mball_add_primitive( bContext *UNUSED(C), Object *obedit, bool obedit_is_new, float mat[4][4], float dia, int type) { @@ -759,8 +750,6 @@ void MBALL_OT_reveal_metaelems(wmOperatorType *ot) /** \name Select Pick Utility * \{ */ -/* Select MetaElement with mouse click (user can select radius circle or - * stiffness circle) */ bool ED_mball_select_pick(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index c77db10d74b..d1789c9601c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -130,7 +130,7 @@ /** \name Local Enum Declarations * \{ */ -/* this is an exact copy of the define in rna_light.c +/* This is an exact copy of the define in `rna_light.c` * kept here because of linking order. * Icons are only defined here */ const EnumPropertyItem rna_enum_light_type_items[] = { @@ -331,8 +331,6 @@ void ED_object_base_init_transform_on_add(Object *object, const float loc[3], co BKE_object_to_mat4(object, object->obmat); } -/* Uses context to figure out transform for primitive. - * Returns standard diameter. */ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, const float loc[3], @@ -603,12 +601,6 @@ bool ED_object_add_generic_get_opts(bContext *C, return true; } -/** - * For object add primitive operators, or for object creation when `obdata != NULL`. - * \param obdata: Assigned to #Object.data, with increased user count. - * - * \note Do not call undo push in this function (users of this function have to). - */ Object *ED_object_add_type_with_obdata(bContext *C, const int type, const char *name, @@ -1724,7 +1716,6 @@ static int object_instance_add_invoke(bContext *C, wmOperator *op, const wmEvent return op->type->exec(C, op); } -/* only used as menu */ void OBJECT_OT_collection_instance_add(wmOperatorType *ot) { PropertyRNA *prop; @@ -1994,8 +1985,7 @@ void OBJECT_OT_pointcloud_add(wmOperatorType *ot) /* -------------------------------------------------------------------- */ /** \name Delete Object Operator * \{ */ -/* remove base from a specific scene */ -/* NOTE: now unlinks constraints as well. */ + void ED_object_base_free_and_unlink(Main *bmain, Scene *scene, Object *ob) { if (ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0 && @@ -2013,10 +2003,6 @@ void ED_object_base_free_and_unlink(Main *bmain, Scene *scene, Object *ob) BKE_scene_collections_object_remove(bmain, scene, ob, true); } -/** - * Remove base from a specific scene. - * `ob` must not be indirectly used. - */ void ED_object_base_free_and_unlink_no_indirect_check(Main *bmain, Scene *scene, Object *ob) { BLI_assert(!BKE_library_ID_is_indirectly_used(bmain, ob)); @@ -3372,10 +3358,6 @@ static Base *object_add_duplicate_internal(Main *bmain, } /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ -/* leaves selection of base/object unaltered. - * NOTE: don't call this within a loop since clear_* funcs loop over the entire database. - * NOTE: caller must do DAG_relations_tag_update(bmain); - * this is not done automatic since we may duplicate many objects in a batch */ Base *ED_object_add_duplicate( Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base, const eDupli_ID_Flags dupflag) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 47c2998ed3d..5c3a8fc2277 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -80,10 +80,6 @@ /** \name Constraint Data Accessors * \{ */ -/** - * If object is in pose-mode, return active bone constraints, else object constraints. - * No constraints are returned for a bone on an inactive bone-layer. - */ ListBase *ED_object_constraint_active_list(Object *ob) { if (ob == NULL) { @@ -105,10 +101,6 @@ ListBase *ED_object_constraint_active_list(Object *ob) return NULL; } -/** - * Get the constraints for the active pose bone. Bone may be on an inactive bone-layer - * (unlike #ED_object_constraint_active_list, such constraints are not excluded here). - */ ListBase *ED_object_pose_constraint_list(const bContext *C) { bPoseChannel *pose_bone = CTX_data_pointer_get(C, "pose_bone").data; @@ -122,8 +114,6 @@ ListBase *ED_object_pose_constraint_list(const bContext *C) return &pose_bone->constraints; } -/* Find the list that a given constraint belongs to, - * and/or also get the posechannel this is from (if applicable) */ ListBase *ED_object_constraint_list_from_constraint(Object *ob, bConstraint *con, bPoseChannel **r_pchan) @@ -164,7 +154,6 @@ ListBase *ED_object_constraint_list_from_constraint(Object *ob, return NULL; } -/* single constraint */ bConstraint *ED_object_constraint_active_get(Object *ob) { return BKE_constraints_active_get(ED_object_constraint_active_list(ob)); diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 6251fb799c5..49149a5152f 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -603,7 +603,6 @@ static bool data_transfer_poll_property(const bContext *UNUSED(C), return true; } -/* Transfer mesh data from active to selected objects. */ void OBJECT_OT_data_transfer(wmOperatorType *ot) { PropertyRNA *prop; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 78440f52160..f06744068d5 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -134,8 +134,6 @@ Object *ED_object_context(const bContext *C) return CTX_data_pointer_get_type(C, "object", &RNA_Object).data; } -/* Find the correct active object per context. - * NOTE: context can be NULL when called from a enum with #PROP_ENUM_NO_CONTEXT. */ Object *ED_object_active_context(const bContext *C) { Object *ob = NULL; @@ -148,14 +146,6 @@ Object *ED_object_active_context(const bContext *C) return ob; } -/** - * Return an array of objects: - * - When in the property space, return the pinned or active object. - * - When in edit-mode/pose-mode, return an array of objects in the mode. - * - Otherwise return selected objects, - * the callers \a filter_fn needs to check of they are editable - * (assuming they need to be modified). - */ Object **ED_object_array_in_mode_or_selected(bContext *C, bool (*filter_fn)(const Object *ob, void *user_data), void *filter_user_data, @@ -669,10 +659,6 @@ bool ED_object_editmode_load(Main *bmain, Object *obedit) return ED_object_editmode_load_free_ex(bmain, obedit, true, false); } -/** - * \param flag: - * - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly. - */ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag) { const bool free_data = (flag & EM_FREEDATA) != 0; @@ -723,11 +709,6 @@ bool ED_object_editmode_exit(bContext *C, int flag) return ED_object_editmode_exit_ex(bmain, scene, obedit, flag); } -/** - * Support freeing edit-mode data without flushing it back to the object. - * - * \return true if data was freed. - */ bool ED_object_editmode_free_ex(Main *bmain, Object *obedit) { return ED_object_editmode_load_free_ex(bmain, obedit, false, true); @@ -1161,11 +1142,6 @@ static bool has_pose_motion_paths(Object *ob) return ob->pose && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) != 0; } -/* For the objects with animation: update paths for those that have got them - * This should selectively update paths that exist... - * - * To be called from various tools that do incremental updates - */ void ED_objects_recalculate_paths(bContext *C, Scene *scene, eObjectPathCalcRange range, @@ -1428,7 +1404,6 @@ static void object_clear_mpath(Object *ob) } } -/* Clear motion paths for all objects */ void ED_objects_clear_paths(bContext *C, bool only_selected) { if (only_selected) { diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c index 92f3d28878c..f5127bd5228 100644 --- a/source/blender/editors/object/object_facemap_ops.c +++ b/source/blender/editors/object/object_facemap_ops.c @@ -53,7 +53,6 @@ #include "object_intern.h" -/* called while not in editmode */ void ED_object_facemap_face_add(Object *ob, bFaceMap *fmap, int facenum) { int fmap_nr; @@ -77,7 +76,6 @@ void ED_object_facemap_face_add(Object *ob, bFaceMap *fmap, int facenum) } } -/* called while not in editmode */ void ED_object_facemap_face_remove(Object *ob, bFaceMap *fmap, int facenum) { int fmap_nr; diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index fe07ecef438..9a1b4b48464 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -45,6 +45,7 @@ enum eObject_Hook_Add_Mode { /* internal exports only */ /* object_transform.c */ + void OBJECT_OT_location_clear(struct wmOperatorType *ot); void OBJECT_OT_rotation_clear(struct wmOperatorType *ot); void OBJECT_OT_scale_clear(struct wmOperatorType *ot); @@ -55,6 +56,7 @@ void OBJECT_OT_transform_axis_target(struct wmOperatorType *ot); void OBJECT_OT_origin_set(struct wmOperatorType *ot); /* object_relations.c */ + void OBJECT_OT_parent_set(struct wmOperatorType *ot); void OBJECT_OT_parent_no_inverse_set(struct wmOperatorType *ot); void OBJECT_OT_parent_clear(struct wmOperatorType *ot); @@ -67,10 +69,18 @@ void OBJECT_OT_convert_proxy_to_override(struct wmOperatorType *ot); void OBJECT_OT_make_single_user(struct wmOperatorType *ot); void OBJECT_OT_make_links_scene(struct wmOperatorType *ot); void OBJECT_OT_make_links_data(struct wmOperatorType *ot); +/** + * Used for drop-box. + * Assigns to object under cursor, only first material slot. + */ void OBJECT_OT_drop_named_material(struct wmOperatorType *ot); +/** + * \note Only for empty-image objects, this operator is needed + */ void OBJECT_OT_unlink_data(struct wmOperatorType *ot); /* object_edit.c */ + void OBJECT_OT_hide_view_set(struct wmOperatorType *ot); void OBJECT_OT_hide_view_clear(struct wmOperatorType *ot); void OBJECT_OT_hide_collection(struct wmOperatorType *ot); @@ -93,6 +103,7 @@ void OBJECT_OT_link_to_collection(struct wmOperatorType *ot); void OBJECT_OT_transfer_mode(struct wmOperatorType *ot); /* object_select.c */ + void OBJECT_OT_select_all(struct wmOperatorType *ot); void OBJECT_OT_select_random(struct wmOperatorType *ot); void OBJECT_OT_select_by_type(struct wmOperatorType *ot); @@ -104,6 +115,7 @@ void OBJECT_OT_select_less(struct wmOperatorType *ot); void OBJECT_OT_select_same_collection(struct wmOperatorType *ot); /* object_add.c */ + void OBJECT_OT_add(struct wmOperatorType *ot); void OBJECT_OT_add_named(struct wmOperatorType *ot); void OBJECT_OT_transform_to_mouse(struct wmOperatorType *ot); @@ -120,6 +132,9 @@ void OBJECT_OT_camera_add(struct wmOperatorType *ot); void OBJECT_OT_speaker_add(struct wmOperatorType *ot); void OBJECT_OT_hair_add(struct wmOperatorType *ot); void OBJECT_OT_pointcloud_add(struct wmOperatorType *ot); +/** + * Only used as menu. + */ void OBJECT_OT_collection_instance_add(struct wmOperatorType *ot); void OBJECT_OT_data_instance_add(struct wmOperatorType *ot); @@ -131,10 +146,15 @@ void OBJECT_OT_join_shapes(struct wmOperatorType *ot); void OBJECT_OT_convert(struct wmOperatorType *ot); /* object_volume.c */ + void OBJECT_OT_volume_add(struct wmOperatorType *ot); +/** + * Called by other space types too. + */ void OBJECT_OT_volume_import(struct wmOperatorType *ot); /* object_hook.c */ + void OBJECT_OT_hook_add_selob(struct wmOperatorType *ot); void OBJECT_OT_hook_add_newob(struct wmOperatorType *ot); void OBJECT_OT_hook_remove(struct wmOperatorType *ot); @@ -144,6 +164,7 @@ void OBJECT_OT_hook_reset(struct wmOperatorType *ot); void OBJECT_OT_hook_recenter(struct wmOperatorType *ot); /* object_collection.c */ + void COLLECTION_OT_create(struct wmOperatorType *ot); void COLLECTION_OT_objects_remove_all(struct wmOperatorType *ot); void COLLECTION_OT_objects_remove(struct wmOperatorType *ot); @@ -151,6 +172,7 @@ void COLLECTION_OT_objects_add_active(struct wmOperatorType *ot); void COLLECTION_OT_objects_remove_active(struct wmOperatorType *ot); /* object_modifier.c */ + bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag, @@ -249,6 +271,7 @@ void CONSTRAINT_OT_objectsolver_clear_inverse(struct wmOperatorType *ot); void CONSTRAINT_OT_followpath_path_animate(struct wmOperatorType *ot); /* object_vgroup.c */ + void OBJECT_OT_vertex_group_add(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_remove(struct wmOperatorType *ot); void OBJECT_OT_vertex_group_assign(struct wmOperatorType *ot); @@ -279,6 +302,7 @@ void OBJECT_OT_vertex_weight_normalize_active_vertex(struct wmOperatorType *ot); void OBJECT_OT_vertex_weight_copy(struct wmOperatorType *ot); /* object_facemap_ops.c */ + void OBJECT_OT_face_map_add(struct wmOperatorType *ot); void OBJECT_OT_face_map_remove(struct wmOperatorType *ot); void OBJECT_OT_face_map_assign(struct wmOperatorType *ot); @@ -288,9 +312,11 @@ void OBJECT_OT_face_map_deselect(struct wmOperatorType *ot); void OBJECT_OT_face_map_move(struct wmOperatorType *ot); /* object_warp.c */ + void TRANSFORM_OT_vertex_warp(struct wmOperatorType *ot); /* object_shapekey.c */ + void OBJECT_OT_shape_key_add(struct wmOperatorType *ot); void OBJECT_OT_shape_key_remove(struct wmOperatorType *ot); void OBJECT_OT_shape_key_clear(struct wmOperatorType *ot); @@ -299,6 +325,7 @@ void OBJECT_OT_shape_key_mirror(struct wmOperatorType *ot); void OBJECT_OT_shape_key_move(struct wmOperatorType *ot); /* object_collection.c */ + void OBJECT_OT_collection_add(struct wmOperatorType *ot); void OBJECT_OT_collection_link(struct wmOperatorType *ot); void OBJECT_OT_collection_remove(struct wmOperatorType *ot); @@ -306,18 +333,25 @@ void OBJECT_OT_collection_unlink(struct wmOperatorType *ot); void OBJECT_OT_collection_objects_select(struct wmOperatorType *ot); /* object_bake.c */ + void OBJECT_OT_bake_image(wmOperatorType *ot); void OBJECT_OT_bake(wmOperatorType *ot); /* object_random.c */ + void TRANSFORM_OT_vertex_random(struct wmOperatorType *ot); /* object_remesh.cc */ + void OBJECT_OT_voxel_remesh(struct wmOperatorType *ot); void OBJECT_OT_voxel_size_edit(struct wmOperatorType *ot); void OBJECT_OT_quadriflow_remesh(struct wmOperatorType *ot); /* object_transfer_data.c */ + +/** + * Transfer mesh data from active to selected objects. + */ void OBJECT_OT_data_transfer(struct wmOperatorType *ot); void OBJECT_OT_datalayout_transfer(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index 0c1b394a916..d3f72b91366 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -111,10 +111,6 @@ static const char *object_mode_op_string(eObjectMode mode) return NULL; } -/** - * Checks the mode to be set is compatible with the object - * should be made into a generic function - */ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode) { if (mode == OB_MODE_OBJECT) { @@ -162,11 +158,6 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode) return false; } -/** - * Sets the mode to a compatible state (use before entering the mode). - * - * This is so each mode's exec function can call - */ bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports) { bool ok; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 21b978268d9..fde7e34cdb5 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -152,12 +152,6 @@ static void object_force_modifier_bind_simple_options(Depsgraph *depsgraph, md_eval->mode = mode; } -/** - * Add a modifier to given object, including relevant extra processing needed by some physics types - * (particles, simulations...). - * - * \param scene: is only used to set current frame in some cases, and may be NULL. - */ ModifierData *ED_object_modifier_add( ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type) { @@ -264,14 +258,6 @@ static bool object_has_modifier(const Object *ob, const ModifierData *exclude, M return false; } -/* If the object data of 'orig_ob' has other users, run 'callback' on - * each of them. - * - * If include_orig is true, the callback will run on 'orig_ob' too. - * - * If the callback ever returns true, iteration will stop and the - * function value will be true. Otherwise the function returns false. - */ bool ED_object_iter_other(Main *bmain, Object *orig_ob, const bool include_orig, @@ -314,9 +300,6 @@ static bool object_has_modifier_cb(Object *ob, void *data) return object_has_modifier(ob, NULL, type); } -/* Use with ED_object_iter_other(). Sets the total number of levels - * for any multires modifiers on the object to the int pointed to by - * callback_data. */ bool ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v) { int totlevel = *((char *)totlevel_v); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b51644eebf3..811f20e82be 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1783,8 +1783,6 @@ static void single_object_users( BKE_main_collection_sync_remap(bmain); } -/* not an especially efficient function, only added so the single user - * button can be functional. */ void ED_object_single_user(Main *bmain, Scene *scene, Object *ob) { FOREACH_SCENE_OBJECT_BEGIN (scene, ob_iter) { @@ -2644,10 +2642,6 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_FINISHED; } -/** - * Used for drop-box. - * Assigns to object under cursor, only first material slot. - */ void OBJECT_OT_drop_named_material(wmOperatorType *ot) { /* identifiers */ @@ -2706,9 +2700,6 @@ static int object_unlink_data_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/** - * \note Only for empty-image objects, this operator is needed - */ void OBJECT_OT_unlink_data(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index eb37aebcff2..a86dba15469 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -89,14 +89,6 @@ /** \name Public Object Selection API * \{ */ -/** - * Simple API for object selection, rather than just using the flag - * this takes into account the 'restrict selection in 3d view' flag. - * deselect works always, the restriction just prevents selection - * - * \note Caller must send a `NC_SCENE | ND_OB_SELECT` notifier - * (or a `NC_SCENE | ND_OB_VISIBLE` in case of visibility toggling). - */ void ED_object_base_select(Base *base, eObjectSelect_Mode mode) { if (mode == BA_INVERT) { @@ -121,9 +113,6 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode) } } -/** - * Call when the active base has changed. - */ void ED_object_base_active_refresh(Main *bmain, Scene *scene, ViewLayer *view_layer) { WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, scene); @@ -134,9 +123,6 @@ void ED_object_base_active_refresh(Main *bmain, Scene *scene, ViewLayer *view_la } } -/** - * Change active base, it includes the notifier - */ void ED_object_base_activate(bContext *C, Base *base) { Scene *scene = CTX_data_scene(C); @@ -242,10 +228,6 @@ static int get_base_select_priority(Base *base) return 1; } -/** - * If id is not already an Object, try to find an object that uses it as data. - * Prefers active, then selected, then visible/selectable. - */ Base *ED_object_find_first_by_data_id(ViewLayer *view_layer, ID *id) { BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name))); @@ -279,12 +261,6 @@ Base *ED_object_find_first_by_data_id(ViewLayer *view_layer, ID *id) return base_best; } -/** - * Select and make the target object active in the view layer. - * If already selected, selection isn't changed. - * - * \returns false if not found in current view layer - */ bool ED_object_jump_to_object(bContext *C, Object *ob, const bool UNUSED(reveal_hidden)) { ViewLayer *view_layer = CTX_data_view_layer(C); @@ -316,13 +292,6 @@ bool ED_object_jump_to_object(bContext *C, Object *ob, const bool UNUSED(reveal_ return true; } -/** - * Select and make the target object and bone active. - * Switches to Pose mode if in Object mode so the selection is visible. - * Un-hides the target bone and bone layer if necessary. - * - * \returns false if object not in layer, bone not found, or other error - */ bool ED_object_jump_to_bone(bContext *C, Object *ob, const char *bone_name, diff --git a/source/blender/editors/object/object_utils.c b/source/blender/editors/object/object_utils.c index c7dfe911ce7..5f85f6ea0eb 100644 --- a/source/blender/editors/object/object_utils.c +++ b/source/blender/editors/object/object_utils.c @@ -369,10 +369,6 @@ void ED_object_data_xform_container_item_ensure(struct XFormObjectData_Container } } -/** - * This may be called multiple times with the same data. - * Each time, the original transformations are re-applied, instead of accumulating the changes. - */ void ED_object_data_xform_container_update_all(struct XFormObjectData_Container *xds, struct Main *bmain, Depsgraph *depsgraph) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index f0ab082cd9c..3e74aaeeb10 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -140,9 +140,6 @@ bool ED_vgroup_sync_from_pose(Object *ob) return false; } -/** - * Removes out of range MDeformWeights - */ void ED_vgroup_data_clamp_range(ID *id, const int total) { MDeformVert **dvert_arr; @@ -264,13 +261,6 @@ bool ED_vgroup_parray_alloc(ID *id, return false; } -/** - * For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true. - * This finds the unselected mirror deform verts and copies the weights to them from the selected. - * - * \note \a dvert_array has mirrored weights filled in, - * in case cleanup operations are needed on both. - */ void ED_vgroup_parray_mirror_sync(Object *ob, MDeformVert **dvert_array, const int dvert_tot, @@ -314,11 +304,6 @@ void ED_vgroup_parray_mirror_sync(Object *ob, MEM_freeN(dvert_array_all); } -/** - * Fill in the pointers for mirror verts (as if all mirror verts were selected too). - * - * similar to #ED_vgroup_parray_mirror_sync but only fill in mirror points. - */ void ED_vgroup_parray_mirror_assign(Object *ob, MDeformVert **dvert_array, const int dvert_tot) { BMEditMesh *em = BKE_editmesh_from_object(ob); @@ -383,7 +368,6 @@ void ED_vgroup_parray_remove_zero(MDeformVert **dvert_array, } } -/* matching index only */ bool ED_vgroup_array_copy(Object *ob, Object *ob_from) { MDeformVert **dvert_array_from = NULL, **dvf; @@ -575,9 +559,6 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx) } } -/** - * Use when adjusting the active vertex weight and apply to mirror vertices. - */ void ED_vgroup_vert_active_mirror(Object *ob, int def_nr) { Mesh *me = ob->data; @@ -883,7 +864,6 @@ static void ED_vgroup_nr_vert_add( } } -/* called while not in editmode */ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode) { /* add the vert to the deform group with the @@ -912,7 +892,6 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, } } -/* mesh object mode, lattice can be in editmode */ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum) { /* This routine removes the vertex from the specified @@ -2369,8 +2348,6 @@ static void dvert_mirror_op(MDeformVert *dvert, } } -/* TODO: vgroup locking. */ -/* TODO: face masking. */ void ED_vgroup_mirror(Object *ob, const bool mirror_weights, const bool flip_vgroups, @@ -2379,6 +2356,8 @@ void ED_vgroup_mirror(Object *ob, int *r_totmirr, int *r_totfail) { + /* TODO: vgroup locking. + * TODO: face masking. */ #define VGROUP_MIRR_OP \ dvert_mirror_op(dvert, \ diff --git a/source/blender/editors/object/object_volume.c b/source/blender/editors/object/object_volume.c index fbdee00c29c..6c92814abc0 100644 --- a/source/blender/editors/object/object_volume.c +++ b/source/blender/editors/object/object_volume.c @@ -158,7 +158,6 @@ static int volume_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS return OPERATOR_RUNNING_MODAL; } -/* called by other space types too */ void OBJECT_OT_volume_import(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index be6b44f87bf..80e3f934c80 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -92,7 +92,6 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -/* add surface slot */ void DPAINT_OT_surface_slot_add(wmOperatorType *ot) { /* identifiers */ @@ -141,7 +140,6 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -/* remove surface slot */ void DPAINT_OT_surface_slot_remove(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index fc80767be9e..f1e6f02cb39 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1419,7 +1419,6 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit) BLI_task_parallel_range(0, edit->totpoint, &iter_data, iterate_lengths_iter, &settings); } -/* set current distances to be kept between neighboring keys */ void recalc_lengths(PTCacheEdit *edit) { POINT_P; @@ -1437,7 +1436,6 @@ void recalc_lengths(PTCacheEdit *edit) } } -/* calculate a tree for finding nearest emitter's vertice */ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), ParticleSystem *psys) { PTCacheEdit *edit = psys->edit; @@ -5261,7 +5259,6 @@ void PARTICLE_OT_shape_cut(wmOperatorType *ot) /** \name Particle Edit Toggle Operator * \{ */ -/* initialize needed data for bake edit */ void PE_create_particle_edit( Depsgraph *depsgraph, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys) { diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c index 601a8385a24..804ab614c09 100644 --- a/source/blender/editors/physics/particle_edit_undo.c +++ b/source/blender/editors/physics/particle_edit_undo.c @@ -298,7 +298,6 @@ static void particle_undosys_foreach_ID_ref(UndoStep *us_p, foreach_ID_ref_fn(user_data, ((UndoRefID *)&us->object_ref)); } -/* Export for ED_undo_sys. */ void ED_particle_undosys_type(UndoType *ut) { ut->name = "Edit Particle"; diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index ef07d73826a..e8270c7a4aa 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -32,6 +32,7 @@ struct Scene; struct wmOperatorType; /* particle_edit.c */ + void PARTICLE_OT_select_all(struct wmOperatorType *ot); void PARTICLE_OT_select_roots(struct wmOperatorType *ot); void PARTICLE_OT_select_tips(struct wmOperatorType *ot); @@ -60,18 +61,28 @@ void PARTICLE_OT_edited_clear(struct wmOperatorType *ot); void PARTICLE_OT_unify_length(struct wmOperatorType *ot); +/** + * Initialize needed data for bake edit. + */ void PE_create_particle_edit(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PointCache *cache, struct ParticleSystem *psys); +/** + * Set current distances to be kept between neighboring keys. + */ void recalc_lengths(struct PTCacheEdit *edit); +/** + * Calculate a tree for finding nearest emitter's vertice. + */ void recalc_emitter_field(struct Depsgraph *depsgraph, struct Object *ob, struct ParticleSystem *psys); void update_world_cos(struct Object *ob, struct PTCacheEdit *edit); /* particle_object.c */ + void OBJECT_OT_particle_system_add(struct wmOperatorType *ot); void OBJECT_OT_particle_system_remove(struct wmOperatorType *ot); @@ -92,6 +103,7 @@ void PARTICLE_OT_dupliob_move_down(struct wmOperatorType *ot); void PARTICLE_OT_dupliob_refresh(struct wmOperatorType *ot); /* particle_boids.c */ + void BOID_OT_rule_add(struct wmOperatorType *ot); void BOID_OT_rule_del(struct wmOperatorType *ot); void BOID_OT_rule_move_up(struct wmOperatorType *ot); @@ -103,6 +115,7 @@ void BOID_OT_state_move_up(struct wmOperatorType *ot); void BOID_OT_state_move_down(struct wmOperatorType *ot); /* physics_fluid.c */ + void FLUID_OT_bake_all(struct wmOperatorType *ot); void FLUID_OT_free_all(struct wmOperatorType *ot); void FLUID_OT_bake_data(struct wmOperatorType *ot); @@ -118,13 +131,21 @@ void FLUID_OT_free_guides(struct wmOperatorType *ot); void FLUID_OT_pause_bake(struct wmOperatorType *ot); /* dynamicpaint.c */ + void DPAINT_OT_bake(struct wmOperatorType *ot); +/** + * Add surface slot. + */ void DPAINT_OT_surface_slot_add(struct wmOperatorType *ot); +/** + * Remove surface slot. + */ void DPAINT_OT_surface_slot_remove(struct wmOperatorType *ot); void DPAINT_OT_type_toggle(struct wmOperatorType *ot); void DPAINT_OT_output_toggle(struct wmOperatorType *ot); /* physics_pointcache.c */ + void PTCACHE_OT_bake_all(struct wmOperatorType *ot); void PTCACHE_OT_free_bake_all(struct wmOperatorType *ot); void PTCACHE_OT_bake(struct wmOperatorType *ot); @@ -134,6 +155,7 @@ void PTCACHE_OT_add(struct wmOperatorType *ot); void PTCACHE_OT_remove(struct wmOperatorType *ot); /* rigidbody_object.c */ + void RIGIDBODY_OT_object_add(struct wmOperatorType *ot); void RIGIDBODY_OT_object_remove(struct wmOperatorType *ot); @@ -144,10 +166,12 @@ void RIGIDBODY_OT_shape_change(struct wmOperatorType *ot); void RIGIDBODY_OT_mass_calculate(struct wmOperatorType *ot); /* rigidbody_constraint.c */ + void RIGIDBODY_OT_constraint_add(struct wmOperatorType *ot); void RIGIDBODY_OT_constraint_remove(struct wmOperatorType *ot); /* rigidbody_world.c */ + void RIGIDBODY_OT_world_add(struct wmOperatorType *ot); void RIGIDBODY_OT_world_remove(struct wmOperatorType *ot); void RIGIDBODY_OT_world_export(struct wmOperatorType *ot); diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h index e1d03e6f3be..d374717664b 100644 --- a/source/blender/editors/render/render_intern.h +++ b/source/blender/editors/render/render_intern.h @@ -28,6 +28,7 @@ struct bContext; struct wmOperatorType; /* render_shading.c */ + void OBJECT_OT_material_slot_add(struct wmOperatorType *ot); void OBJECT_OT_material_slot_remove(struct wmOperatorType *ot); void OBJECT_OT_material_slot_assign(struct wmOperatorType *ot); @@ -80,10 +81,18 @@ void TEXTURE_OT_slot_paste(struct wmOperatorType *ot); void TEXTURE_OT_slot_move(struct wmOperatorType *ot); /* render_internal.c */ + +/** + * Contextual render, using current scene, view3d? + */ void RENDER_OT_render(struct wmOperatorType *ot); void RENDER_OT_shutter_curve_preset(struct wmOperatorType *ot); /* render_view.c */ + +/** + * New window uses x,y to set position. + */ struct ScrArea *render_view_open(struct bContext *C, int mx, int my, struct ReportList *reports); void RENDER_OT_view_show(struct wmOperatorType *ot); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 49e7ebf6340..29d829dc131 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1076,7 +1076,6 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even return OPERATOR_RUNNING_MODAL; } -/* contextual render, using current scene, view3d? */ void RENDER_OT_render(wmOperatorType *ot) { PropertyRNA *prop; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 16b8cb74ee4..c37d7131347 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -1759,9 +1759,6 @@ static void icon_preview_free(void *customdata) MEM_freeN(ip); } -/** - * Check if \a id is supported by the automatic preview render. - */ bool ED_preview_id_is_supported(const ID *id) { if (id == NULL) { diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 8bc2281db73..e975eab4736 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -68,7 +68,6 @@ /** \name Render Engines * \{ */ -/* Update 3D viewport render or draw engine on changes to the scene or view settings. */ void ED_render_view3d_update(Depsgraph *depsgraph, wmWindow *window, ScrArea *area, @@ -126,8 +125,6 @@ void ED_render_view3d_update(Depsgraph *depsgraph, } } -/* Update all 3D viewport render and draw engines on changes to the scene. - * This is called by the dependency graph when it detects changes. */ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, const bool updated) { Main *bmain = update_ctx->bmain; diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 7f27b6f585a..9163718ffad 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -132,7 +132,6 @@ static ScrArea *find_area_image_empty(bContext *C) /********************** open image editor for render *************************/ -/* new window uses x,y to set position */ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports) { Main *bmain = CTX_data_main(C); diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c index 5195bc8303a..555ffbfd5e7 100644 --- a/source/blender/editors/scene/scene_edit.c +++ b/source/blender/editors/scene/scene_edit.c @@ -77,10 +77,6 @@ Scene *ED_scene_add(Main *bmain, bContext *C, wmWindow *win, eSceneCopyMethod me return scene_new; } -/** - * \note Only call outside of area/region loops - * \return true if successful - */ bool ED_scene_delete(bContext *C, Main *bmain, Scene *scene) { Scene *scene_new; @@ -113,7 +109,6 @@ bool ED_scene_delete(bContext *C, Main *bmain, Scene *scene) return true; } -/* Depsgraph updates after scene becomes active in a window. */ void ED_scene_change_update(Main *bmain, Scene *scene, ViewLayer *layer) { Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, layer); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index dc7cbb96e96..5dc6fe88663 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -140,7 +140,6 @@ void ED_region_pixelspace(const ARegion *region) GPU_matrix_identity_set(); } -/* only exported for WM */ void ED_region_do_listen(wmRegionListenerParams *params) { ARegion *region = params->region; @@ -169,7 +168,6 @@ void ED_region_do_listen(wmRegionListenerParams *params) } } -/* only exported for WM */ void ED_area_do_listen(wmSpaceTypeListenerParams *params) { /* no generic notes? */ @@ -178,7 +176,6 @@ void ED_area_do_listen(wmSpaceTypeListenerParams *params) } } -/* only exported for WM */ void ED_area_do_refresh(bContext *C, ScrArea *area) { /* no generic notes? */ @@ -443,7 +440,6 @@ void ED_area_do_msg_notify_tag_refresh( ED_area_tag_refresh(area); } -/* Follow ARegionType.message_subscribe */ void ED_area_do_mgs_subscribe_for_tool_header(const wmRegionMessageSubscribeParams *params) { struct wmMsgBus *mbus = params->message_bus; @@ -507,7 +503,6 @@ static bool area_is_pseudo_minimized(const ScrArea *area) return (area->winx < 3) || (area->winy < 3); } -/* only exported for WM */ void ED_region_do_layout(bContext *C, ARegion *region) { /* This is optional, only needed for dynamically sized regions. */ @@ -531,7 +526,6 @@ void ED_region_do_layout(bContext *C, ARegion *region) region->flag &= ~RGN_FLAG_SEARCH_FILTER_UPDATE; } -/* only exported for WM */ void ED_region_do_draw(bContext *C, ARegion *region) { wmWindow *win = CTX_wm_window(C); @@ -705,10 +699,6 @@ void ED_region_tag_refresh_ui(ARegion *region) } } -/** - * Tag editor overlays to be redrawn. If in doubt about which parts need to be redrawn (partial - * clipping rectangle set), redraw everything. - */ void ED_region_tag_redraw_editor_overlays(struct ARegion *region) { if (region && !(region->do_draw & (RGN_DRAWING | RGN_DRAW))) { @@ -786,9 +776,6 @@ void ED_area_tag_refresh(ScrArea *area) /* *************************************************************** */ -/** - * Returns the search string if the space type and region type support property search. - */ const char *ED_area_region_search_filter_get(const ScrArea *area, const ARegion *region) { /* Only the properties editor has a search string for now. */ @@ -802,9 +789,6 @@ const char *ED_area_region_search_filter_get(const ScrArea *area, const ARegion return NULL; } -/** - * Set the temporary update flag for property search. - */ void ED_region_search_filter_update(const ScrArea *area, ARegion *region) { region->flag |= RGN_FLAG_SEARCH_FILTER_UPDATE; @@ -817,7 +801,6 @@ void ED_region_search_filter_update(const ScrArea *area, ARegion *region) /* *************************************************************** */ -/* use NULL to disable it */ void ED_area_status_text(ScrArea *area, const char *str) { /* happens when running transform operators in background mode */ @@ -1271,7 +1254,6 @@ static void region_overlap_fix(ScrArea *area, ARegion *region) } } -/* overlapping regions only in the following restricted cases */ bool ED_region_is_overlap(int spacetype, int regiontype) { if (regiontype == RGN_TYPE_HUD) { @@ -1926,7 +1908,6 @@ bool ED_area_has_shared_border(struct ScrArea *a, struct ScrArea *b) return area_getorientation(a, b) != -1; } -/* called in screen_refresh, or screens_init, also area size changes */ void ED_area_init(wmWindowManager *wm, wmWindow *win, ScrArea *area) { WorkSpace *workspace = WM_window_get_active_workspace(win); @@ -2076,15 +2057,11 @@ static void region_update_rect(ARegion *region) BLI_rcti_init(®ion->v2d.mask, 0, region->winx - 1, 0, region->winy - 1); } -/** - * Call to move a popup window (keep OpenGL context free!) - */ void ED_region_update_rect(ARegion *region) { region_update_rect(region); } -/* externally called for floating regions like menus */ void ED_region_floating_init(ARegion *region) { BLI_assert(region->alignment == RGN_ALIGN_FLOAT); @@ -2114,7 +2091,6 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *area, ARegion *region) WM_cursor_set(win, WM_CURSOR_DEFAULT); } -/* for use after changing visibility of regions */ void ED_region_visibility_change_update(bContext *C, ScrArea *area, ARegion *region) { if (region->flag & RGN_FLAG_HIDDEN) { @@ -2131,7 +2107,6 @@ void ED_region_visibility_change_update(bContext *C, ScrArea *area, ARegion *reg ED_area_tag_redraw(area); } -/* for quick toggle, can skip fades */ void region_toggle_hidden(bContext *C, ARegion *region, const bool do_fade) { ScrArea *area = CTX_wm_area(C); @@ -2147,15 +2122,11 @@ void region_toggle_hidden(bContext *C, ARegion *region, const bool do_fade) } } -/* exported to all editors, uses fading default */ void ED_region_toggle_hidden(bContext *C, ARegion *region) { region_toggle_hidden(C, region, true); } -/** - * we swap spaces for fullscreen to keep all allocated data area vertices were set - */ void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free) { const char spacetype = area_dst->spacetype; @@ -2461,9 +2432,6 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2) ED_area_tag_refresh(sa2); } -/** - * \param skip_region_exit: Skip calling area exit callback. Set for opening temp spaces. - */ void ED_area_newspace(bContext *C, ScrArea *area, int type, const bool skip_region_exit) { wmWindow *win = CTX_wm_window(C); @@ -2628,7 +2596,6 @@ void ED_area_prevspace(bContext *C, ScrArea *area) WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, area); } -/* returns offset for next button in header */ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) { ScrArea *area = CTX_wm_area(C); @@ -2950,11 +2917,6 @@ static int panel_draw_width_from_max_width_get(const ARegion *region, max_width; } -/** - * \param contexts: A NULL terminated array of context strings to match against. - * Matching against any of these strings will draw the panel. - * Can be NULL to skip context checks. - */ void ED_region_panels_layout_ex(const bContext *C, ARegion *region, ListBase *paneltypes, @@ -3266,10 +3228,6 @@ static bool panel_property_search(const bContext *C, return false; } -/** - * Build the same panel list as #ED_region_panels_layout_ex and checks whether any - * of the panels contain a search result based on the area / region's search filter. - */ bool ED_region_property_search(const bContext *C, ARegion *region, ListBase *paneltypes, @@ -3475,9 +3433,6 @@ int ED_area_footersize(void) return ED_area_headersize(); } -/** - * \return the final height of a global \a area, accounting for DPI. - */ int ED_area_global_size_y(const ScrArea *area) { BLI_assert(ED_area_is_global(area)); @@ -3527,12 +3482,6 @@ ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area) return screen->areabase.first; } -/** - * For now we just assume all global areas are made up out of horizontal bars - * with the same size. A fixed size could be stored in ARegion instead if needed. - * - * \return the DPI aware height of a single bar/region in global areas. - */ int ED_region_global_size_y(void) { return ED_area_headersize(); /* same size as header */ @@ -3858,9 +3807,6 @@ void ED_region_cache_draw_cached_segments( } } -/** - * Generate subscriptions for this region. - */ void ED_region_message_subscribe(wmRegionMessageSubscribeParams *params) { ARegion *region = params->region; diff --git a/source/blender/editors/screen/area_query.c b/source/blender/editors/screen/area_query.c index 30e744ca174..022f8620b0b 100644 --- a/source/blender/editors/screen/area_query.c +++ b/source/blender/editors/screen/area_query.c @@ -140,10 +140,6 @@ bool ED_region_overlap_isect_xy_with_margin(const ARegion *region, ED_region_overlap_isect_y_with_margin(region, event_xy[1], margin)); } -/** - * \note: This may return true for multiple overlapping regions. If it matters, check overlapped - * regions first (#ARegion.overlap). - */ bool ED_region_contains_xy(const ARegion *region, const int event_xy[2]) { /* Only use the margin when inside the region. */ @@ -193,13 +189,6 @@ bool ED_region_contains_xy(const ARegion *region, const int event_xy[2]) return false; } -/** - * Similar to #BKE_area_find_region_xy() but when \a event_xy intersects an overlapping region, - * this returns the region that is visually under the cursor. E.g. when over the - * transparent part of the region, it returns the region underneath. - * - * The overlapping region is determined using the #ED_region_contains_xy() query. - */ ARegion *ED_area_find_region_xy_visual(const ScrArea *area, const int regiontype, const int event_xy[2]) diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c index 30553bb7f07..9a688ac0b05 100644 --- a/source/blender/editors/screen/area_utils.c +++ b/source/blender/editors/screen/area_utils.c @@ -40,9 +40,6 @@ /** \name Generic Tool System Region Callbacks * \{ */ -/** - * Callback for #ARegionType.message_subscribe - */ void ED_region_generic_tools_region_message_subscribe(const wmRegionMessageSubscribeParams *params) { struct wmMsgBus *mbus = params->message_bus; @@ -56,9 +53,6 @@ void ED_region_generic_tools_region_message_subscribe(const wmRegionMessageSubsc WM_msg_subscribe_rna_anon_prop(mbus, WorkSpace, tools, &msg_sub_value_region_tag_redraw); } -/** - * Callback for #ARegionType.snap_size - */ int ED_region_generic_tools_region_snap_size(const ARegion *region, int size, int axis) { if (axis == 0) { diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index f651fd4fb61..5f523df18d1 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -57,12 +57,6 @@ static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state) vert_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); } -/** - * To be used before calling #immDrawPixelsTex - * Default shader is #GPU_SHADER_2D_IMAGE_COLOR - * You can still set uniforms with: - * `GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);` - */ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin) { IMMDrawPixelsTexState state; @@ -78,20 +72,6 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin) return state; } -/** - * Use the currently bound shader. - * - * Use #immDrawPixelsTexSetup to bind the shader you - * want before calling #immDrawPixelsTex. - * - * If using a special shader double check it uses the same - * attributes "pos" "texCoord" and uniform "image". - * - * If color is NULL then use white by default - * - * Be also aware that this function unbinds the shader when - * it's finished. - */ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, float x, float y, @@ -363,7 +343,6 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state, /* **** Color management helper functions for GLSL display/transform ***** */ -/* Draw given image buffer on a screen using GLSL for display transform */ void ED_draw_imbuf_clipping(ImBuf *ibuf, float x, float y, @@ -577,8 +556,6 @@ int ED_draw_imbuf_method(ImBuf *ibuf) return U.image_draw_method; } -/* don't move to GPU_immediate_util.h because this uses user-prefs - * and isn't very low level */ void immDrawBorderCorners(uint pos, const rcti *border, float zoomx, float zoomy) { float delta_x = 4.0f * UI_DPI_FAC / zoomx; diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 2dc79a0e335..304205d0cc4 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -1283,7 +1283,6 @@ static void ensure_ed_screen_context_functions(void) register_context_function("ui_list", screen_ctx_ui_list); } -/* Entry point for the screen context. */ int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result) { if (CTX_data_dir(member)) { diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index ab50e327de3..e720ae4b9d8 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -162,9 +162,6 @@ static void drawscredge_area(ScrArea *area, int sizex, int sizey, float edge_thi drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, edge_thickness); } -/** - * Only for edge lines between areas. - */ void ED_screen_draw_edges(wmWindow *win) { bScreen *screen = WM_window_get_active_screen(win); @@ -231,12 +228,6 @@ void ED_screen_draw_edges(wmWindow *win) } } -/** - * Visual indication of the two areas involved in a proposed join. - * - * \param sa1: Area from which the resultant originates. - * \param sa2: Target area that will be replaced. - */ void screen_draw_join_highlight(ScrArea *sa1, ScrArea *sa2) { const eScreenDir dir = area_getorientation(sa1, sa2); @@ -445,9 +436,6 @@ static void screen_preview_draw(const bScreen *screen, int size_x, int size_y) GPU_matrix_pop(); } -/** - * Render the preview for a screen layout in \a screen. - */ void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, uint *r_rect) { char err_out[256] = "unknown"; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 92151ea01b3..61d6997b0fb 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -203,9 +203,6 @@ ScrArea *area_split(const wmWindow *win, return newa; } -/** - * Empty screen, with 1 dummy area without spacedata. Uses window size. - */ bScreen *screen_add(Main *bmain, const char *name, const rcti *rect) { bScreen *screen = BKE_libblock_alloc(bmain, ID_SCR, name, 0); @@ -274,9 +271,6 @@ void screen_data_copy(bScreen *to, bScreen *from) } } -/** - * Prepare a newly created screen for initializing it as active screen. - */ void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new) { screen_new->winid = win->winid; @@ -284,11 +278,6 @@ void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new) screen_new->do_draw = true; } -/** - * with `sa_a` as center, `sa_b` is located at: 0=W, 1=N, 2=E, 3=S - * -1 = not valid check. - * used with join operator. - */ eScreenDir area_getorientation(ScrArea *sa_a, ScrArea *sa_b) { if (sa_a == NULL || sa_b == NULL || sa_a == sa_b) { @@ -329,9 +318,6 @@ eScreenDir area_getorientation(ScrArea *sa_a, ScrArea *sa_b) return -1; } -/** - * Get alignment offset of adjacent areas. 'dir' value is like #area_getorientation(). - */ void area_getoffsets( ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2) { @@ -536,13 +522,11 @@ static bool screen_area_join_ex( return true; } -/* Join any two neighboring areas. Might involve complex changes. */ int screen_area_join(bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2) { return screen_area_join_ex(C, screen, sa1, sa2, false); } -/* Close a screen area, allowing most-aligned neighbor to take its place. */ bool screen_area_close(struct bContext *C, bScreen *screen, ScrArea *area) { if (area == NULL) { @@ -640,8 +624,6 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note) } } -/* make this screen usable */ -/* for file read and first use, for scaling window, area moves */ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) { bScreen *screen = WM_window_get_active_screen(win); @@ -681,7 +663,6 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win) screen->context = ed_screen_context; } -/* file read, set all screens, ... */ void ED_screens_init(Main *bmain, wmWindowManager *wm) { LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { @@ -709,10 +690,6 @@ void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *scree } } -/** - * Utility to exit and free an area-region. Screen level regions (menus/popups) need to be treated - * slightly differently, see #ui_region_temp_remove(). - */ void ED_region_remove(bContext *C, ScrArea *area, ARegion *region) { ED_region_exit(C, region); @@ -862,10 +839,6 @@ static void screen_cursor_set(wmWindow *win, const int xy[2]) } } -/** - * Called in wm_event_system.c. sets state vars in screen, cursors. - * event type is mouse move. - */ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2]) { bScreen *screen = WM_window_get_active_screen(win); @@ -1126,10 +1099,6 @@ void ED_screen_global_areas_refresh(wmWindow *win) /* -------------------------------------------------------------------- */ /* Screen changing */ -/** - * \return the screen to activate. - * \warning The returned screen may not always equal \a screen_new! - */ void screen_change_prepare( bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win) { @@ -1176,14 +1145,6 @@ void screen_change_update(bContext *C, wmWindow *win, bScreen *screen) WM_event_add_mousemove(win); } -/** - * \brief Change the active screen. - * - * Operator call, WM + Window + screen already existed before - * - * \warning Do NOT call in area/region queues! - * \returns if screen changing was successful. - */ bool ED_screen_change(bContext *C, bScreen *screen) { Main *bmain = CTX_data_main(C); @@ -1324,9 +1285,6 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *area, int type) return newsa; } -/** - * \a was_prev_temp for the case previous space was a temporary fullscreen as well - */ void ED_screen_full_prevspace(bContext *C, ScrArea *area) { BLI_assert(area->full); @@ -1356,7 +1314,6 @@ void ED_screen_restore_temp_type(bContext *C, ScrArea *area) } } -/* restore a screen / area back to default operation, after temp fullscreen modes */ void ED_screen_full_restore(bContext *C, ScrArea *area) { wmWindow *win = CTX_wm_window(C); @@ -1463,28 +1420,11 @@ static bScreen *screen_state_to_nonnormal(bContext *C, return screen; } -/** - * Create a new temporary screen with a maximized, empty area. - * This can be closed with #ED_screen_state_toggle(). - * - * Use this to just create a new maximized screen/area, rather than maximizing an existing one. - * Otherwise, maximize with #ED_screen_state_toggle(). - */ bScreen *ED_screen_state_maximized_create(bContext *C) { return screen_state_to_nonnormal(C, CTX_wm_window(C), NULL, SCREENMAXIMIZED); } -/** - * This function toggles: if area is maximized/full then the parent will be restored. - * - * Use #ED_screen_state_maximized_create() if you do not want the toggle behavior when changing to - * a maximized area. I.e. if you just want to open a new maximized screen/area, not maximize a - * specific area. In the former case, space data of the maximized and non-maximized area should be - * independent, in the latter it should be the same. - * - * \warning \a area may be freed. - */ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const short state) { wmWindowManager *wm = CTX_wm_manager(C); @@ -1592,14 +1532,6 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const return screen->areabase.first; } -/** - * Wrapper to open a temporary space either as fullscreen space, or as separate window, as defined - * by \a display_type. - * - * \param title: Title to set for the window, if a window is spawned. - * \param x, y: Position of the window, if a window is spawned. - * \param sizex, sizey: Dimensions of the window, if a window is spawned. - */ ScrArea *ED_screen_temp_space_open(bContext *C, const char *title, int x, @@ -1648,7 +1580,6 @@ ScrArea *ED_screen_temp_space_open(bContext *C, return area; } -/* update frame rate info for viewport drawing */ void ED_refresh_viewport_fps(bContext *C) { wmTimer *animtimer = CTX_wm_screen(C)->animtimer; @@ -1674,9 +1605,6 @@ void ED_refresh_viewport_fps(bContext *C) } } -/* redraws: uses defines from stime->redraws - * enable: 1 - forward on, -1 - backwards on, 0 - off - */ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable) { bScreen *screen = CTX_wm_screen(C); @@ -1776,7 +1704,6 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws) } } -/* results in fully updated anim system */ void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph) { Scene *scene = DEG_get_input_scene(depsgraph); @@ -1801,9 +1728,6 @@ void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph) BKE_scene_graph_update_for_newframe(depsgraph); } -/* - * return true if any active area requires to see in 3D - */ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene) { const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; diff --git a/source/blender/editors/screen/screen_geometry.c b/source/blender/editors/screen/screen_geometry.c index e67c933cb8e..394a7fd7350 100644 --- a/source/blender/editors/screen/screen_geometry.c +++ b/source/blender/editors/screen/screen_geometry.c @@ -83,10 +83,6 @@ bool screen_geom_edge_is_horizontal(ScrEdge *se) return (se->v1->vec.y == se->v2->vec.y); } -/** - * \param bounds_rect: Either window or screen bounds. - * Used to exclude edges along window/screen edges. - */ ScrEdge *screen_geom_area_map_find_active_scredge(const ScrAreaMap *area_map, const rcti *bounds_rect, const int mx, @@ -124,7 +120,6 @@ ScrEdge *screen_geom_area_map_find_active_scredge(const ScrAreaMap *area_map, return NULL; } -/* need win size to make sure not to include edges along screen edge */ ScrEdge *screen_geom_find_active_scredge(const wmWindow *win, const bScreen *screen, const int mx, @@ -249,13 +244,6 @@ static bool screen_geom_vertices_scale_pass(const wmWindow *win, return needs_another_pass; } -/** - * \brief Main screen-layout calculation function. - * - * * Scale areas nicely on window size and DPI changes. - * * Ensure areas have a minimum height. - * * Correctly set global areas to their fixed height. - */ void screen_geom_vertices_scale(const wmWindow *win, bScreen *screen) { rcti window_rect, screen_rect; @@ -303,9 +291,6 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *screen) } } -/** - * \return 0 if no split is possible, otherwise the screen-coordinate at which to split. - */ short screen_geom_find_area_split_point(const ScrArea *area, const rcti *window_rect, const eScreenAxis dir_axis, @@ -374,9 +359,6 @@ short screen_geom_find_area_split_point(const ScrArea *area, return x; } -/** - * Select all edges that are directly or indirectly connected to \a edge. - */ void screen_geom_select_connected_edge(const wmWindow *win, ScrEdge *edge) { bScreen *screen = WM_window_get_active_screen(win); diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 47229e5e2b5..53d87005463 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -61,23 +61,48 @@ typedef enum eScreenAxis { #define AREAJOINTOLERANCEX (AREAMINX * U.dpi_fac) #define AREAJOINTOLERANCEY (HEADERY * U.dpi_fac) -/* Expanded interaction influence of area borders. */ +/** + * Expanded interaction influence of area borders. + */ #define BORDERPADDING ((2.0f * U.dpi_fac) + U.pixelsize) /* area.c */ + +/** + * we swap spaces for fullscreen to keep all allocated data area vertices were set + */ void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free); void ED_area_data_swap(ScrArea *area_dst, ScrArea *area_src); +/* for quick toggle, can skip fades */ void region_toggle_hidden(struct bContext *C, ARegion *region, const bool do_fade); /* screen_draw.c */ + +/** + * Visual indication of the two areas involved in a proposed join. + * + * \param sa1: Area from which the resultant originates. + * \param sa2: Target area that will be replaced. + */ void screen_draw_join_highlight(struct ScrArea *sa1, struct ScrArea *sa2); void screen_draw_split_preview(struct ScrArea *area, const eScreenAxis dir_axis, const float fac); /* screen_edit.c */ + +/** + * Empty screen, with 1 dummy area without spacedata. Uses window size. + */ bScreen *screen_add(struct Main *bmain, const char *name, const rcti *rect); void screen_data_copy(bScreen *to, bScreen *from); +/** + * Prepare a newly created screen for initializing it as active screen. + */ void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new); void screen_change_update(struct bContext *C, wmWindow *win, bScreen *screen); +/** + * \return the screen to activate. + * \warning The returned screen may not always equal \a screen_new! + */ void screen_change_prepare(bScreen *screen_old, bScreen *screen_new, struct Main *bmain, @@ -89,10 +114,24 @@ ScrArea *area_split(const wmWindow *win, const eScreenAxis dir_axis, const float fac, const bool merge); +/** + * Join any two neighboring areas. Might involve complex changes. + */ int screen_area_join(struct bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2); +/** + * with `sa_a` as center, `sa_b` is located at: 0=W, 1=N, 2=E, 3=S + * -1 = not valid check. + * used with join operator. + */ eScreenDir area_getorientation(ScrArea *sa_a, ScrArea *sa_b); +/** + * Get alignment offset of adjacent areas. 'dir' value is like #area_getorientation(). + */ void area_getoffsets( ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2); +/** + * Close a screen area, allowing most-aligned neighbor to take its place. + */ bool screen_area_close(struct bContext *C, bScreen *screen, ScrArea *area); void screen_area_spacelink_add(struct Scene *scene, ScrArea *area, eSpace_Type space_type); struct AZone *ED_area_actionzone_find_xy(ScrArea *area, const int xy[2]); @@ -105,22 +144,46 @@ ScrVert *screen_geom_vertex_add(bScreen *screen, short x, short y); ScrEdge *screen_geom_edge_add_ex(ScrAreaMap *area_map, ScrVert *v1, ScrVert *v2); ScrEdge *screen_geom_edge_add(bScreen *screen, ScrVert *v1, ScrVert *v2); bool screen_geom_edge_is_horizontal(ScrEdge *se); +/** + * \param bounds_rect: Either window or screen bounds. + * Used to exclude edges along window/screen edges. + */ ScrEdge *screen_geom_area_map_find_active_scredge(const struct ScrAreaMap *area_map, const rcti *bounds_rect, const int mx, const int my); +/** + * Need win size to make sure not to include edges along screen edge. + */ ScrEdge *screen_geom_find_active_scredge(const wmWindow *win, const bScreen *screen, const int mx, const int my); +/** + * \brief Main screen-layout calculation function. + * + * * Scale areas nicely on window size and DPI changes. + * * Ensure areas have a minimum height. + * * Correctly set global areas to their fixed height. + */ void screen_geom_vertices_scale(const wmWindow *win, bScreen *screen); +/** + * \return 0 if no split is possible, otherwise the screen-coordinate at which to split. + */ short screen_geom_find_area_split_point(const ScrArea *area, const rcti *window_rect, const eScreenAxis dir_axis, float fac); +/** + * Select all edges that are directly or indirectly connected to \a edge. + */ void screen_geom_select_connected_edge(const wmWindow *win, ScrEdge *edge); /* screen_context.c */ + +/** + * Entry point for the screen context. + */ int ed_screen_context(const struct bContext *C, const char *member, struct bContextDataResult *result); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 220697f465e..96012155a55 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -165,7 +165,6 @@ static bool ED_operator_screenactive_norender(bContext *C) return true; } -/* when mouse is over area-edge */ bool ED_operator_screen_mainwinactive(bContext *C) { if (CTX_wm_window(C) == NULL) { @@ -219,10 +218,6 @@ bool ED_operator_objectmode(bContext *C) return true; } -/** - * Same as #ED_operator_objectmode() but additionally sets a "disabled hint". That is, a message - * to be displayed to the user explaining why the operator can't be used in current context. - */ bool ED_operator_objectmode_poll_msg(bContext *C) { if (!ED_operator_objectmode(C)) { @@ -257,7 +252,6 @@ bool ED_operator_region_view3d_active(bContext *C) return false; } -/* generic for any view2d which uses anim_ops */ bool ED_operator_animview_active(bContext *C) { if (ED_operator_areaactive(C)) { @@ -289,21 +283,11 @@ bool ED_operator_outliner_active_no_editobject(bContext *C) return false; } -/** - * \note Will return true for file spaces in either file or asset browsing mode! See - * #ED_operator_file_browsing_active() (file browsing only) and - * #ED_operator_asset_browsing_active() (asset browsing only). - */ bool ED_operator_file_active(bContext *C) { return ed_spacetype_test(C, SPACE_FILE); } -/** - * \note Will only return true if the file space is in file browsing mode, not asset browsing! See - * #ED_operator_file_active() (file or asset browsing) and - * #ED_operator_asset_browsing_active() (asset browsing only). - */ bool ED_operator_file_browsing_active(bContext *C) { if (ed_spacetype_test(C, SPACE_FILE)) { @@ -430,7 +414,6 @@ bool ED_operator_object_active_editable(bContext *C) return ED_operator_object_active_editable_ex(C, ob); } -/** Object must be editable and fully local (i.e. not an override). */ bool ED_operator_object_active_local_editable_ex(bContext *C, const Object *ob) { return ED_operator_object_active_editable_ex(C, ob) && !ID_IS_OVERRIDE_LIBRARY(ob); @@ -530,7 +513,6 @@ bool ED_operator_posemode_exclusive(bContext *C) return ed_operator_posemode_exclusive_ex(C, obact); } -/** Object must be editable, fully local (i.e. not an override), and exclusively in Pose mode. */ bool ED_operator_object_active_local_editable_posemode_exclusive(bContext *C) { Object *obact = ED_object_active_context(C); @@ -547,8 +529,6 @@ bool ED_operator_object_active_local_editable_posemode_exclusive(bContext *C) return true; } -/* allows for pinned pose objects to be used in the object buttons - * and the non-active pose object to be used in the 3D view */ bool ED_operator_posemode_context(bContext *C) { Object *obpose = ED_pose_object_from_context(C); @@ -588,7 +568,6 @@ bool ED_operator_posemode_local(bContext *C) return false; } -/* wrapper for ED_space_image_show_uvedit */ bool ED_operator_uvedit(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); @@ -4812,7 +4791,6 @@ static void SCREEN_OT_animation_step(wmOperatorType *ot) * Animation Playback with Timer. * \{ */ -/* find window that owns the animation timer */ bScreen *ED_screen_animation_playing(const wmWindowManager *wm) { LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { @@ -4839,7 +4817,6 @@ bScreen *ED_screen_animation_no_scrub(const wmWindowManager *wm) return NULL; } -/* toggle operator */ int ED_screen_animation_play(bContext *C, int sync, int mode) { bScreen *screen = CTX_wm_screen(C); @@ -5391,9 +5368,6 @@ static void region_blend_end(bContext *C, ARegion *region, const bool is_running WM_event_remove_timer(CTX_wm_manager(C), NULL, region->regiontimer); /* frees rgi */ region->regiontimer = NULL; } -/** - * \note Assumes that \a region itself is not a split version from previous region. - */ void ED_region_visibility_change_update_animated(bContext *C, ScrArea *area, ARegion *region) { wmWindowManager *wm = CTX_wm_manager(C); @@ -5701,7 +5675,6 @@ static void SCREEN_OT_workspace_cycle(wmOperatorType *ot) /** \name Assigning Operator Types * \{ */ -/* called in spacetypes.c */ void ED_operatortypes_screen(void) { /* Generic UI stuff. */ @@ -5791,7 +5764,6 @@ static void blend_file_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "filepath", drag->path); } -/* called in spacetypes.c */ void ED_keymap_screen(wmKeyConfig *keyconf) { /* Screen Editing ------------------------------------------------ */ diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 4b81e713080..333a1fae99a 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -112,15 +112,6 @@ static WorkSpaceLayout *workspace_change_get_new_layout(Main *bmain, bmain, workspace_new, layout_new, layout_old, win); } -/** - * \brief Change the active workspace. - * - * Operator call, WM + Window + screen already existed before - * Pretty similar to #ED_screen_change since changing workspace also changes screen. - * - * \warning Do NOT call in area/region queues! - * \returns if workspace changing was successful. - */ bool ED_workspace_change(WorkSpace *workspace_new, bContext *C, wmWindowManager *wm, wmWindow *win) { Main *bmain = CTX_data_main(C); @@ -160,10 +151,6 @@ bool ED_workspace_change(WorkSpace *workspace_new, bContext *C, wmWindowManager return true; } -/** - * Duplicate a workspace including its layouts. Does not activate the workspace, but - * it stores the screen-layout to be activated (BKE_workspace_temp_layout_store) - */ WorkSpace *ED_workspace_duplicate(WorkSpace *workspace_old, Main *bmain, wmWindow *win) { WorkSpaceLayout *layout_active_old = BKE_workspace_active_layout_get(win->workspace_hook); @@ -187,9 +174,6 @@ WorkSpace *ED_workspace_duplicate(WorkSpace *workspace_old, Main *bmain, wmWindo return workspace_new; } -/** - * \return if succeeded. - */ bool ED_workspace_delete(WorkSpace *workspace, Main *bmain, bContext *C, wmWindowManager *wm) { if (BLI_listbase_is_single(&bmain->workspaces)) { @@ -220,10 +204,6 @@ bool ED_workspace_delete(WorkSpace *workspace, Main *bmain, bContext *C, wmWindo return true; } -/** - * Some editor data may need to be synced with scene data (3D View camera and layers). - * This function ensures data is synced for editors in active layout of \a workspace. - */ void ED_workspace_scene_data_sync(WorkSpaceInstanceHook *hook, Scene *scene) { bScreen *screen = BKE_workspace_active_screen_get(hook); diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c index 0ec32da0404..e34c4f96aa3 100644 --- a/source/blender/editors/screen/workspace_layout_edit.c +++ b/source/blender/editors/screen/workspace_layout_edit.c @@ -37,9 +37,6 @@ #include "screen_intern.h" -/** - * Empty screen, with 1 dummy area without space-data. Uses window size. - */ WorkSpaceLayout *ED_workspace_layout_add(Main *bmain, WorkSpace *workspace, wmWindow *win, @@ -129,10 +126,6 @@ static WorkSpaceLayout *workspace_layout_delete_find_new(const WorkSpaceLayout * return NULL; } -/** - * \warning Only call outside of area/region loops! - * \return true if succeeded. - */ bool ED_workspace_layout_delete(WorkSpace *workspace, WorkSpaceLayout *layout_old, bContext *C) { const bScreen *screen_old = BKE_workspace_layout_screen_get(layout_old); @@ -183,12 +176,6 @@ static bool screen_is_used_by_other_window(const wmWindow *win, const bScreen *s return BKE_screen_is_used(screen) && (screen->winid != win->winid); } -/** - * Make sure there is a non-fullscreen layout to switch to that is not used yet by an other window. - * Needed for workspace or screen switching to ensure valid screens. - * - * \param layout_fallback_base: As last resort, this layout is duplicated and returned. - */ WorkSpaceLayout *ED_workspace_screen_change_ensure_unused_layout( Main *bmain, WorkSpace *workspace, diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index dafc7f45e2e..265746e27cd 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -98,7 +98,6 @@ static TexSnapshot primary_snap = {0}; static TexSnapshot secondary_snap = {0}; static CursorSnapshot cursor_snap = {0}; -/* Delete overlay cursor textures to preserve memory and invalidate all overlay flags. */ void paint_cursor_delete_textures(void) { if (primary_snap.overlay_texture) { diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c index dbe522bf304..0b59e519f70 100644 --- a/source/blender/editors/sculpt_paint/paint_curve_undo.c +++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c @@ -147,7 +147,6 @@ static void paintcurve_undosys_foreach_ID_ref(UndoStep *us_p, foreach_ID_ref_fn(user_data, ((UndoRefID *)&us->pc_ref)); } -/* Export for ED_undo_sys. */ void ED_paintcurve_undosys_type(UndoType *ut) { ut->name = "Paint Curve"; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ab868df770d..dc2eaacca0c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -181,7 +181,6 @@ void imapaint_image_update( } } -/* paint blur kernels. Projective painting enforces use of a 2x2 kernel due to lagging */ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) { int i, j; @@ -793,11 +792,6 @@ static void toggle_paint_cursor(Scene *scene, bool enable) } } -/* enable the paint cursor if it isn't already. - * - * purpose is to make sure the paint cursor is shown if paint - * mode is enabled in the image editor. the paint poll will - * ensure that the cursor is hidden when not in paint mode */ void ED_space_image_paint_update(Main *bmain, wmWindowManager *wm, Scene *scene) { ToolSettings *settings = scene->toolsettings; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 7191431cf4c..4c54d3b3b5e 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1777,7 +1777,6 @@ static ImageUser *paint_2d_get_tile_iuser(ImagePaintState *s, int tile_number) return iuser; } -/* this function expects linear space color values */ void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 3e5d8e812d2..7df5848e068 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -6324,8 +6324,6 @@ void ED_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool !stencil ? " Stencil," : ""); } -/* Make sure that active object has a material, - * and assign UVs and image layers if they do not exist */ bool ED_paint_proj_mesh_data_check( Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil) { diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index d1bcf87e871..90887b9fc39 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -59,6 +59,7 @@ typedef struct CoNo { } CoNo; /* paint_stroke.c */ + typedef bool (*StrokeGetLocation)(struct bContext *C, float location[3], const float mouse[2]); typedef bool (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, const float mouse[2]); typedef void (*StrokeUpdateStep)(struct bContext *C, @@ -77,13 +78,25 @@ struct PaintStroke *paint_stroke_new(struct bContext *C, int event_type); void paint_stroke_free(struct bContext *C, struct wmOperator *op); +/** + * Returns zero if the stroke dots should not be spaced, non-zero otherwise. + */ bool paint_space_stroke_enabled(struct Brush *br, enum ePaintMode mode); +/** + * Return true if the brush size can change during paint (normally used for pressure). + */ bool paint_supports_dynamic_size(struct Brush *br, enum ePaintMode mode); +/** + * Return true if the brush size can change during paint (normally used for pressure). + */ bool paint_supports_dynamic_tex_coords(struct Brush *br, enum ePaintMode mode); bool paint_supports_smooth_stroke(struct Brush *br, enum ePaintMode mode); bool paint_supports_texture(enum ePaintMode mode); bool paint_supports_jitter(enum ePaintMode mode); +/** + * Called in paint_ops.c, on each regeneration of key-maps. + */ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int paint_stroke_exec(struct bContext *C, struct wmOperator *op); @@ -96,14 +109,21 @@ float paint_stroke_distance_get(struct PaintStroke *stroke); void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data); bool PAINT_brush_tool_poll(struct bContext *C); void paint_cursor_start(struct Paint *p, bool (*poll)(struct bContext *C)); +/** + * Delete overlay cursor textures to preserve memory and invalidate all overlay flags. + */ void paint_cursor_delete_textures(void); /* paint_vertex.c */ + bool weight_paint_poll(struct bContext *C); bool weight_paint_poll_ignore_tool(bContext *C); bool weight_paint_mode_poll(struct bContext *C); bool vertex_paint_poll(struct bContext *C); bool vertex_paint_poll_ignore_tool(struct bContext *C); +/** + * Returns true if vertex paint mode is active. + */ bool vertex_paint_mode_poll(struct bContext *C); typedef void (*VPaintTransform_Callback)(const float col[3], @@ -126,15 +146,31 @@ void PAINT_OT_vertex_paint(struct wmOperatorType *ot); unsigned int vpaint_get_current_col(struct Scene *scene, struct VPaint *vp, bool secondary); /* paint_vertex_color_utils.c */ + +/** + * \note weight-paint has an equivalent function: #ED_wpaint_blend_tool + */ unsigned int ED_vpaint_blend_tool(const int tool, const uint col, const uint paintcol, const int alpha_i); +/** + * Apply callback to each vertex of the active vertex color layer. + */ bool ED_vpaint_color_transform(struct Object *ob, VPaintTransform_Callback vpaint_tx_fn, const void *user_data); /* paint_vertex_weight_utils.c */ + +/** + * \param weight: Typically the current weight: #MDeformWeight.weight + * + * \return The final weight, note that this is _not_ clamped from [0-1]. + * Clamping must be done on the final #MDeformWeight.weight + * + * \note vertex-paint has an equivalent function: #ED_vpaint_blend_tool + */ float ED_wpaint_blend_tool(const int tool, const float weight, const float paintval, @@ -147,13 +183,18 @@ struct WPaintVGroupIndex { int active; int mirror; }; +/** + * Ensure we have data on wpaint start, add if needed. + */ bool ED_wpaint_ensure_data(struct bContext *C, struct ReportList *reports, enum eWPaintFlag flag, struct WPaintVGroupIndex *vgroup_index); +/** Return -1 when invalid. */ int ED_wpaint_mirror_vgroup_ensure(struct Object *ob, const int vgroup_active); /* paint_vertex_color_ops.c */ + void PAINT_OT_vertex_color_set(struct wmOperatorType *ot); void PAINT_OT_vertex_color_from_weight(struct wmOperatorType *ot); void PAINT_OT_vertex_color_smooth(struct wmOperatorType *ot); @@ -163,6 +204,7 @@ void PAINT_OT_vertex_color_invert(struct wmOperatorType *ot); void PAINT_OT_vertex_color_levels(struct wmOperatorType *ot); /* paint_vertex_weight_ops.c */ + void PAINT_OT_weight_from_bones(struct wmOperatorType *ot); void PAINT_OT_weight_sample(struct wmOperatorType *ot); void PAINT_OT_weight_sample_group(struct wmOperatorType *ot); @@ -206,6 +248,9 @@ void paint_2d_stroke(void *ps, float pressure, float distance, float size); +/** + * This function expects linear space color values. + */ void paint_2d_bucket_fill(const struct bContext *C, const float color[3], struct Brush *br, @@ -291,13 +336,16 @@ void paint_curve_mask_cache_update(CurveMaskCache *curve_mask_cache, const float cursor_position[2]); /* sculpt_uv.c */ + void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot); /* paint_utils.c */ -/* Convert the object-space axis-aligned bounding box (expressed as +/** + * Convert the object-space axis-aligned bounding box (expressed as * its minimum and maximum corners) into a screen-space rectangle, - * returns zero if the result is empty */ + * returns zero if the result is empty. + */ bool paint_convert_bb_to_rect(struct rcti *rect, const float bb_min[3], const float bb_max[3], @@ -305,9 +353,11 @@ bool paint_convert_bb_to_rect(struct rcti *rect, struct RegionView3D *rv3d, struct Object *ob); -/* Get four planes in object-space that describe the projection of +/** + * Get four planes in object-space that describe the projection of * screen_rect from screen into object-space (essentially converting a - * 2D screens-space bounding box into four 3D planes) */ + * 2D screens-space bounding box into four 3D planes). + */ void paint_calc_redraw_planes(float planes[4][4], const struct ARegion *region, struct Object *ob, @@ -327,6 +377,9 @@ void paint_get_tex_pixel_col(const struct MTex *mtex, bool convert, struct ColorSpace *colorspace); +/** + * Used for both 3D view and image window. + */ void paint_sample_color( struct bContext *C, struct ARegion *region, int x, int y, bool texpaint_proj, bool palette); @@ -348,6 +401,9 @@ bool mask_paint_poll(struct bContext *C); bool paint_curve_poll(struct bContext *C); bool facemask_paint_poll(struct bContext *C); +/** + * Uses symm to selectively flip any axis of a coordinate. + */ void flip_v3_v3(float out[3], const float in[3], const enum ePaintSymmetryFlags symm); void flip_qt_qt(float out[4], const float in[4], const enum ePaintSymmetryFlags symm); @@ -405,7 +461,10 @@ typedef struct { } BlurKernel; enum eBlurKernelType; -/* can be extended to other blur kernels later */ +/** + * Paint blur kernels. Projective painting enforces use of a 2x2 kernel due to lagging. + * Can be extended to other blur kernels later, + */ BlurKernel *paint_new_blur_kernel(struct Brush *br, bool proj); void paint_delete_blur_kernel(BlurKernel *); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index de01bc3a474..c87f4e0aeec 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1007,7 +1007,6 @@ static void stroke_done(bContext *C, wmOperator *op) paint_stroke_free(C, op); } -/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */ bool paint_space_stroke_enabled(Brush *br, ePaintMode mode) { if ((br->flag & BRUSH_SPACE) == 0) { @@ -1041,7 +1040,6 @@ static bool sculpt_is_grab_tool(Brush *br) SCULPT_TOOL_SNAKE_HOOK); } -/* return true if the brush size can change during paint (normally used for pressure) */ bool paint_supports_dynamic_size(Brush *br, ePaintMode mode) { if (br->flag & BRUSH_ANCHORED) { @@ -1094,7 +1092,6 @@ bool paint_supports_texture(ePaintMode mode) mode, PAINT_MODE_SCULPT, PAINT_MODE_VERTEX, PAINT_MODE_TEXTURE_3D, PAINT_MODE_TEXTURE_2D); } -/* return true if the brush size can change during paint (normally used for pressure) */ bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode) { if (br->flag & BRUSH_ANCHORED) { @@ -1115,7 +1112,6 @@ bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode) #define PAINT_STROKE_MODAL_CANCEL 1 -/* Called in paint_ops.c, on each regeneration of key-maps. */ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf) { static struct EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 709e04d807d..541893f7957 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -80,9 +80,6 @@ #include "paint_intern.h" -/* Convert the object-space axis-aligned bounding box (expressed as - * its minimum and maximum corners) into a screen-space rectangle, - * returns zero if the result is empty */ bool paint_convert_bb_to_rect(rcti *rect, const float bb_min[3], const float bb_max[3], @@ -127,9 +124,6 @@ bool paint_convert_bb_to_rect(rcti *rect, return rect->xmin < rect->xmax && rect->ymin < rect->ymax; } -/* Get four planes in object-space that describe the projection of - * screen_rect from screen into object-space (essentially converting a - * 2D screens-space bounding box into four 3D planes) */ void paint_calc_redraw_planes(float planes[4][4], const ARegion *region, Object *ob, @@ -403,7 +397,6 @@ static Image *imapaint_face_image(Object *ob, Mesh *me, int face_index) return ima; } -/* Uses symm to selectively flip any axis of a coordinate. */ void flip_v3_v3(float out[3], const float in[3], const ePaintSymmetryFlags symm) { if (symm & PAINT_SYMM_X) { @@ -449,7 +442,6 @@ void flip_qt_qt(float out[4], const float in[4], const ePaintSymmetryFlags symm) axis_angle_normalized_to_quat(out, axis, angle); } -/* used for both 3d view and image window */ void paint_sample_color( bContext *C, ARegion *region, int x, int y, bool texpaint_proj, bool use_palette) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index fede01a614b..302de13a881 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -201,7 +201,6 @@ static void paint_last_stroke_update(Scene *scene, const float location[3]) /* polling - retrieve whether cursor should be set or operator should be done */ -/* Returns true if vertex paint mode is active */ bool vertex_paint_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c index dbc6044d2d8..a083af14c89 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_utils.c @@ -41,9 +41,6 @@ #define EPS_SATURATION 0.0005f -/** - * Apply callback to each vertex of the active vertex color layer. - */ bool ED_vpaint_color_transform(struct Object *ob, VPaintTransform_Callback vpaint_tx_fn, const void *user_data) @@ -610,9 +607,6 @@ BLI_INLINE uint mcol_alpha_sub(uint col_src, int fac) return col_mix; } -/** - * \note weight-paint has an equivalent function: #ED_wpaint_blend_tool - */ uint ED_vpaint_blend_tool(const int tool, const uint col, const uint paintcol, const int alpha_i) { switch ((IMB_BlendMode)tool) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 1077f66f10c..d10a56be866 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -408,10 +408,11 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/* TODO: we could make this a menu into OBJECT_OT_vertex_group_set_active - * rather than its own operator */ void PAINT_OT_weight_sample_group(wmOperatorType *ot) { + /* TODO: we could make this a menu into #OBJECT_OT_vertex_group_set_active + * rather than its own operator */ + PropertyRNA *prop = NULL; /* identifiers */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c index 19ffa0c952d..63a70baeaad 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c @@ -51,7 +51,6 @@ /** \name Weight Paint Sanity Checks * \{ */ -/* ensure we have data on wpaint start, add if needed */ bool ED_wpaint_ensure_data(bContext *C, struct ReportList *reports, enum eWPaintFlag flag, @@ -133,7 +132,6 @@ bool ED_wpaint_ensure_data(bContext *C, } /** \} */ -/* mirror_vgroup is set to -1 when invalid */ int ED_wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active) { const ListBase *defbase = BKE_object_defgroup_list(ob); @@ -277,14 +275,6 @@ BLI_INLINE float wval_exclusion(float weight, float paintval, float fac) return temp * fac + weight * mfac; } -/** - * \param weight: Typically the current weight: #MDeformWeight.weight - * - * \return The final weight, note that this is _not_ clamped from [0-1]. - * Clamping must be done on the final #MDeformWeight.weight - * - * \note vertex-paint has an equivalent function: #ED_vpaint_blend_tool - */ float ED_wpaint_blend_tool(const int tool, const float weight, const float paintval, diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7b854e886a0..5e34c526d47 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -911,32 +911,18 @@ bool SCULPT_vertex_is_boundary(const SculptSession *ss, const int index) /* Utilities */ -/** - * Returns true when the step belongs to the stroke that is directly performed by the brush and - * not by one of the symmetry passes. - */ bool SCULPT_stroke_is_main_symmetry_pass(StrokeCache *cache) { return cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0 && cache->tile_pass == 0; } -/** - * Return true only once per stroke on the first symmetry pass, regardless of the symmetry passes - * enabled. - * - * This should be used for functionality that needs to be computed once per stroke of a particular - * tool (allocating memory, updating random seeds...). - */ bool SCULPT_stroke_is_first_brush_step(StrokeCache *cache) { return cache->first_time && cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0 && cache->tile_pass == 0; } -/** - * Returns true on the first brush step of each symmetry pass. - */ bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(StrokeCache *cache) { return cache->first_time; @@ -1049,7 +1035,6 @@ bool SCULPT_is_symmetry_iteration_valid(char i, char symm) return i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (!ELEM(i, 3, 5)))); } -/* Checks if a vertex is inside the brush radius from any of its mirrored axis. */ bool SCULPT_is_vertex_inside_brush_radius_symm(const float vertex[3], const float br_co[3], float radius, @@ -1274,10 +1259,6 @@ typedef enum StrokeFlags { CLIP_Z = 4, } StrokeFlags; -/** - * Initialize a #SculptOrigVertData for accessing original vertex data; - * handles #BMesh, #Mesh, and multi-resolution. - */ void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, SculptUndoNode *unode) { SculptSession *ss = ob->sculpt; @@ -1297,10 +1278,6 @@ void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, Scul } } -/** - * Initialize a #SculptOrigVertData for accessing original vertex data; - * handles #BMesh, #Mesh, and multi-resolution. - */ void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node) { SculptUndoNode *unode; @@ -1308,9 +1285,6 @@ void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode * SCULPT_orig_vert_data_unode_init(data, ob, unode); } -/** - * Update a #SculptOrigVertData for a particular vertex from the PBVH iterator. - */ void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter) { if (orig_data->unode->type == SCULPT_UNDO_COORDS) { @@ -1443,12 +1417,6 @@ static void sculpt_project_v3(const SculptProjectVector *spvc, const float vec[3 /**********************************************************************/ -/* Returns true if the stroke will use dynamic topology, false - * otherwise. - * - * Factors: some brushes like grab cannot do dynamic topology. - * Others, like smooth, are better without. - * Same goes for alt-key smoothing. */ bool SCULPT_stroke_is_dynamic_topology(const SculptSession *ss, const Brush *brush) { return ((BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) && @@ -1573,7 +1541,6 @@ static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect) BLI_rcti_union(rect, &ss->cache->previous_r); } -/* Get a screen-space rectangle of the modified area. */ bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect) { PBVH *pbvh = ob->sculpt->pbvh; @@ -2205,7 +2172,6 @@ void SCULPT_calc_area_normal( SCULPT_pbvh_calc_area_normal(brush, ob, nodes, totnode, true, r_area_no); } -/* Expose 'calc_area_normal' externally. */ bool SCULPT_pbvh_calc_area_normal(const Brush *brush, Object *ob, PBVHNode **nodes, @@ -2463,7 +2429,6 @@ static float brush_strength(const Sculpt *sd, } } -/* Return a multiplier for brush strength on a particular vertex. */ float SCULPT_brush_strength_factor(SculptSession *ss, const Brush *br, const float brush_point[3], @@ -2561,7 +2526,6 @@ float SCULPT_brush_strength_factor(SculptSession *ss, return avg; } -/* Test AABB against sphere. */ bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v) { SculptSearchSphereData *data = data_v; @@ -2608,7 +2572,6 @@ bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v) return len_squared_v3(t) < data->radius_squared; } -/* 2D projection (distance to line). */ bool SCULPT_search_circle_cb(PBVHNode *node, void *data_v) { SculptSearchCircleData *data = data_v; @@ -2636,9 +2599,6 @@ bool SCULPT_search_circle_cb(PBVHNode *node, void *data_v) return dist_sq < data->radius_squared || true; } -/** - * Handles clipping against a mirror modifier and #SCULPT_LOCK_X/Y/Z axis flags. - */ void SCULPT_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3]) { for (int i = 0; i < 3; i++) { @@ -6318,7 +6278,6 @@ static void SCULPT_flush_stroke_deform_task_cb(void *__restrict userdata, BKE_pbvh_vertex_iter_end; } -/* Flush displacement from deformed PBVH to original layer. */ void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used) { SculptSession *ss = ob->sculpt; @@ -6372,10 +6331,6 @@ void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used) } } -/** - * Flip all the edit-data across the axis/axes specified by \a symm. - * Used to calculate multiple modifications to the mesh when symmetry is enabled. - */ void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache, const char symm, const char axis, @@ -7416,9 +7371,6 @@ float SCULPT_raycast_init(ViewContext *vc, return dist; } -/* Gets the normal, location and active vertex location of the geometry under the cursor. This also - * updates the active vertex and cursor related data of the SculptSession using the mouse position - */ bool SCULPT_cursor_geometry_info_update(bContext *C, SculptCursorGeometryInfo *out, const float mouse[2], @@ -7548,9 +7500,6 @@ bool SCULPT_cursor_geometry_info_update(bContext *C, return true; } -/* Do a raycast in the tree to find the 3d brush location - * (This allows us to ignore the GL depth buffer) - * Returns 0 if the ray doesn't hit the mesh, non-zero otherwise. */ bool SCULPT_stroke_get_location(bContext *C, float out[3], const float mouse[2]) { Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); @@ -7714,7 +7663,6 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob) } } -/* Copy the PBVH bounding box into the object's bounding box. */ void SCULPT_update_object_bounding_box(Object *ob) { if (ob->runtime.bb) { diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c b/source/blender/editors/sculpt_paint/sculpt_boundary.c index 37678ec276a..e238fafb063 100644 --- a/source/blender/editors/sculpt_paint/sculpt_boundary.c +++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c @@ -487,8 +487,6 @@ static void sculpt_boundary_falloff_factor_init(SculptSession *ss, } } -/* Main function to get SculptBoundary data both for brush deformation and viewport preview. Can - * return NULL if there is no boundary from the given vertex using the given radius. */ SculptBoundary *SCULPT_boundary_data_init(Object *object, Brush *brush, const int initial_vertex, @@ -946,7 +944,6 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata, BKE_pbvh_vertex_iter_end; } -/* Main Brush Function. */ void SCULPT_do_boundary_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) { SculptSession *ss = ob->sculpt; diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index fa879214794..dcfd7f7bcdc 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -1052,7 +1052,6 @@ static void cloth_sim_initialize_default_node_state(SculptSession *ss, MEM_SAFE_FREE(nodes); } -/* Public functions. */ SculptClothSimulation *SCULPT_cloth_brush_simulation_create(SculptSession *ss, const float cloth_mass, const float cloth_damping, @@ -1195,7 +1194,6 @@ static void sculpt_cloth_ensure_constraints_in_simulation_area(Sculpt *sd, sd, ob, nodes, totnode, ss->cache->cloth_sim, sim_location, limit); } -/* Main Brush Function. */ void SCULPT_do_cloth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) { SculptSession *ss = ob->sculpt; @@ -1271,7 +1269,6 @@ void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim) MEM_SAFE_FREE(cloth_sim); } -/* Cursor drawing function. */ void SCULPT_cloth_simulation_limits_draw(const uint gpuattr, const Brush *brush, const float location[3], diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index 89e07081802..dc8cda964ea 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -73,6 +73,7 @@ #include <stdlib.h> /* Utils. */ + int ED_sculpt_face_sets_find_next_available_id(struct Mesh *mesh) { int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index 760cf632ae9..ff1a8935ba0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -64,7 +64,6 @@ #include <math.h> #include <stdlib.h> -/* Filter orientation utils. */ void SCULPT_filter_to_orientation_space(float r_v[3], struct FilterCache *filter_cache) { switch (filter_cache->orientation) { diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 16df1efd969..4dd2a786922 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -46,7 +46,9 @@ enum ePaintSymmetryFlags; bool SCULPT_mode_poll(struct bContext *C); bool SCULPT_mode_poll_view3d(struct bContext *C); -/* checks for a brush, not just sculpt mode */ +/** + * Checks for a brush, not just sculpt mode. + */ bool SCULPT_poll(struct bContext *C); bool SCULPT_poll_view3d(struct bContext *C); @@ -63,9 +65,14 @@ typedef enum SculptUpdateType { void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags); void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType update_flags); +/** + * Flush displacement from deformed PBVH to original layer. + */ void SCULPT_flush_stroke_deform(struct Sculpt *sd, Object *ob, bool is_proxy_used); -/* Should be used after modifying the mask or Face Sets IDs. */ +/** + * Should be used after modifying the mask or Face Sets IDs. + */ void SCULPT_tag_update_overlays(bContext *C); /* Stroke */ @@ -76,7 +83,16 @@ typedef struct SculptCursorGeometryInfo { float active_vertex_co[3]; } SculptCursorGeometryInfo; +/** + * Do a ray-cast in the tree to find the 3d brush location + * (This allows us to ignore the GL depth buffer) + * Returns 0 if the ray doesn't hit the mesh, non-zero otherwise. + */ bool SCULPT_stroke_get_location(struct bContext *C, float out[3], const float mouse[2]); +/** + * Gets the normal, location and active vertex location of the geometry under the cursor. This also + * updates the active vertex and cursor related data of the SculptSession using the mouse position + */ bool SCULPT_cursor_geometry_info_update(bContext *C, SculptCursorGeometryInfo *out, const float mouse[2], @@ -95,6 +111,7 @@ float SCULPT_raycast_init(struct ViewContext *vc, char SCULPT_mesh_symmetry_xyz_get(Object *object); /* Sculpt PBVH abstraction API */ + void SCULPT_vertex_random_access_ensure(struct SculptSession *ss); int SCULPT_vertex_count_get(struct SculptSession *ss); @@ -106,15 +123,21 @@ const float *SCULPT_vertex_color_get(SculptSession *ss, int index); const float *SCULPT_vertex_persistent_co_get(SculptSession *ss, int index); void SCULPT_vertex_persistent_normal_get(SculptSession *ss, int index, float no[3]); -/* Coordinates used for manipulating the base mesh when Grab Active Vertex is enabled. */ +/** + * Coordinates used for manipulating the base mesh when Grab Active Vertex is enabled. + */ const float *SCULPT_vertex_co_for_grab_active_get(SculptSession *ss, int index); -/* Returns the info of the limit surface when Multires is available, otherwise it returns the - * current coordinate of the vertex. */ +/** + * Returns the info of the limit surface when multi-res is available, + * otherwise it returns the current coordinate of the vertex. + */ void SCULPT_vertex_limit_surface_get(SculptSession *ss, int index, float r_co[3]); -/* Returns the pointer to the coordinates that should be edited from a brush tool iterator - * depending on the given deformation target. */ +/** + * Returns the pointer to the coordinates that should be edited from a brush tool iterator + * depending on the given deformation target. + */ float *SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss, const int deform_target, PBVHVertexIter *iter); @@ -215,8 +238,22 @@ bool SCULPT_vertex_any_face_set_visible_get(SculptSession *ss, int index); void SCULPT_face_sets_visibility_invert(SculptSession *ss); void SCULPT_face_sets_visibility_all_set(SculptSession *ss, bool visible); +/** + * Returns true when the step belongs to the stroke that is directly performed by the brush and + * not by one of the symmetry passes. + */ bool SCULPT_stroke_is_main_symmetry_pass(struct StrokeCache *cache); +/** + * Return true only once per stroke on the first symmetry pass, regardless of the symmetry passes + * enabled. + * + * This should be used for functionality that needs to be computed once per stroke of a particular + * tool (allocating memory, updating random seeds...). + */ bool SCULPT_stroke_is_first_brush_step(struct StrokeCache *cache); +/** + * Returns true on the first brush step of each symmetry pass. + */ bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(struct StrokeCache *cache); /* Sculpt Original Data */ @@ -236,8 +273,19 @@ typedef struct { const float *col; } SculptOrigVertData; +/** + * Initialize a #SculptOrigVertData for accessing original vertex data; + * handles #BMesh, #Mesh, and multi-resolution. + */ void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node); +/** + * Update a #SculptOrigVertData for a particular vertex from the PBVH iterator. + */ void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter); +/** + * Initialize a #SculptOrigVertData for accessing original vertex data; + * handles #BMesh, #Mesh, and multi-resolution. + */ void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, struct SculptUndoNode *unode); @@ -263,12 +311,18 @@ int SCULPT_plane_point_side(const float co[3], const float plane[4]); int SCULPT_plane_trim(const struct StrokeCache *cache, const struct Brush *brush, const float val[3]); +/** + * Handles clipping against a mirror modifier and #SCULPT_LOCK_X/Y/Z axis flags. + */ void SCULPT_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3]); float SCULPT_brush_plane_offset_get(Sculpt *sd, SculptSession *ss); ePaintSymmetryAreas SCULPT_get_vertex_symm_area(const float co[3]); bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm); +/** + * Checks if a vertex is inside the brush radius from any of its mirrored axis. + */ bool SCULPT_is_vertex_inside_brush_radius_symm(const float vertex[3], const float br_co[3], float radius, @@ -329,6 +383,14 @@ void sculpt_dynamic_topology_disable_with_undo(struct Main *bmain, Scene *scene, Object *ob); +/** + * Returns true if the stroke will use dynamic topology, false + * otherwise. + * + * Factors: some brushes like grab cannot do dynamic topology. + * Others, like smooth, are better without. + * Same goes for alt-key smoothing. + */ bool SCULPT_stroke_is_dynamic_topology(const SculptSession *ss, const Brush *brush); void SCULPT_dynamic_topology_triangulate(struct BMesh *bm); @@ -391,6 +453,10 @@ void SCULPT_mask_filter_smooth_apply( /* Brushes. */ /* Cloth Brush. */ + +/** + * Main Brush Function. + */ void SCULPT_do_cloth_brush(struct Sculpt *sd, struct Object *ob, struct PBVHNode **nodes, @@ -398,6 +464,8 @@ void SCULPT_do_cloth_brush(struct Sculpt *sd, void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim); +/* Public functions. */ + struct SculptClothSimulation *SCULPT_cloth_brush_simulation_create( struct SculptSession *ss, const float cloth_mass, @@ -429,6 +497,9 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(struct Sculpt *sd, float initial_location[3], const float radius); +/** + * Cursor drawing function. + */ void SCULPT_cloth_simulation_limits_draw(const uint gpuattr, const struct Brush *brush, const float location[3], @@ -490,10 +561,21 @@ BLI_INLINE bool SCULPT_tool_needs_all_pbvh_nodes(const Brush *brush) } /* Pose Brush. */ + +/** + * Main Brush Function. + */ void SCULPT_do_pose_brush(struct Sculpt *sd, struct Object *ob, struct PBVHNode **nodes, int totnode); +/** + * Calculate the pose origin and (Optionally the pose factor) + * that is used when using the pose brush. + * + * \param r_pose_origin: Must be a valid pointer. + * \param r_pose_factor: Optional, when set to NULL it won't be calculated. + */ void SCULPT_pose_calc_pose_data(struct Sculpt *sd, struct Object *ob, struct SculptSession *ss, @@ -515,11 +597,17 @@ struct SculptPoseIKChain *SCULPT_pose_ik_chain_init(struct Sculpt *sd, void SCULPT_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain); /* Boundary Brush. */ + +/** + * Main function to get #SculptBoundary data both for brush deformation and viewport preview. + * Can return NULL if there is no boundary from the given vertex using the given radius. + */ struct SculptBoundary *SCULPT_boundary_data_init(Object *object, Brush *brush, const int initial_vertex, const float radius); void SCULPT_boundary_data_free(struct SculptBoundary *boundary); +/* Main Brush Function. */ void SCULPT_do_boundary_brush(struct Sculpt *sd, struct Object *ob, struct PBVHNode **nodes, @@ -532,6 +620,7 @@ void SCULPT_boundary_edges_preview_draw(const uint gpuattr, void SCULPT_boundary_pivot_line_preview_draw(const uint gpuattr, struct SculptSession *ss); /* Multi-plane Scrape Brush. */ +/* Main Brush Function. */ void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); void SCULPT_multiplane_scrape_preview_draw(const uint gpuattr, Brush *brush, @@ -548,13 +637,20 @@ void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); /* Smooth Brush. */ + +/** + * For bmesh: Average surrounding verts based on an orthogonality measure. + * Naturally converges to a quad-like structure. + */ void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], struct BMVert *v); void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], int index); float SCULPT_neighbor_mask_average(SculptSession *ss, int index); void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index); -/* Mask the mesh boundaries smoothing only the mesh surface without using automasking. */ +/** + * Mask the mesh boundaries smoothing only the mesh surface without using auto-masking. + */ void SCULPT_neighbor_coords_average_interior(SculptSession *ss, float result[3], int index); void SCULPT_smooth(Sculpt *sd, @@ -852,7 +948,13 @@ bool SCULPT_brush_test_cube(SculptBrushTest *test, const float local[4][4], const float roundness); bool SCULPT_brush_test_circle_sq(SculptBrushTest *test, const float co[3]); +/** + * Test AABB against sphere. + */ bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v); +/** + * 2D projection (distance to line). + */ bool SCULPT_search_circle_cb(PBVHNode *node, void *data_v); SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss, @@ -861,6 +963,9 @@ SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss, const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss, char falloff_shape); +/** + * Return a multiplier for brush strength on a particular vertex. + */ float SCULPT_brush_strength_factor(struct SculptSession *ss, const struct Brush *br, const float point[3], @@ -871,15 +976,21 @@ float SCULPT_brush_strength_factor(struct SculptSession *ss, const int vertex_index, const int thread_id); -/* Tilts a normal by the x and y tilt values using the view axis. */ +/** + * Tilts a normal by the x and y tilt values using the view axis. + */ void SCULPT_tilt_apply_to_normal(float r_normal[3], struct StrokeCache *cache, const float tilt_strength); -/* Get effective surface normal with pen tilt and tilt strength applied to it. */ +/** + * Get effective surface normal with pen tilt and tilt strength applied to it. + */ void SCULPT_tilt_effective_normal_get(const SculptSession *ss, const Brush *brush, float r_no[3]); -/* just for vertex paint. */ +/** + * Expose 'calc_area_normal' externally (just for vertex paint). + */ bool SCULPT_pbvh_calc_area_normal(const struct Brush *brush, Object *ob, PBVHNode **nodes, @@ -1085,6 +1196,7 @@ typedef enum SculptTransformDisplacementMode { SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL = 1, } SculptTransformDisplacementMode; +/* Filter orientation utils. */ void SCULPT_filter_to_orientation_space(float r_v[3], struct FilterCache *filter_cache); void SCULPT_filter_to_object_space(float r_v[3], struct FilterCache *filter_cache); void SCULPT_filter_zero_disabled_axis_components(float r_v[3], struct FilterCache *filter_cache); @@ -1298,6 +1410,10 @@ typedef struct FilterCache { AutomaskingCache *automasking; } FilterCache; +/** + * Flip all the edit-data across the axis/axes specified by \a symm. + * Used to calculate multiple modifications to the mesh when symmetry is enabled. + */ void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache, const char symm, const char axis, @@ -1313,8 +1429,14 @@ void SCULPT_undo_push_end_ex(const bool use_nested_undo); void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]); +/** + * Copy the PBVH bounding box into the object's bounding box. + */ void SCULPT_update_object_bounding_box(struct Object *ob); +/** + * Get a screen-space rectangle of the modified area. + */ bool SCULPT_get_redraw_rect(struct ARegion *region, struct RegionView3D *rv3d, Object *ob, @@ -1323,10 +1445,12 @@ bool SCULPT_get_redraw_rect(struct ARegion *region, /* Operators. */ /* Expand. */ + void SCULPT_OT_expand(struct wmOperatorType *ot); void sculpt_expand_modal_keymap(struct wmKeyConfig *keyconf); /* Gestures. */ + void SCULPT_OT_face_set_lasso_gesture(struct wmOperatorType *ot); void SCULPT_OT_face_set_box_gesture(struct wmOperatorType *ot); @@ -1336,6 +1460,7 @@ void SCULPT_OT_trim_box_gesture(struct wmOperatorType *ot); void SCULPT_OT_project_line_gesture(struct wmOperatorType *ot); /* Face Sets. */ + void SCULPT_OT_face_sets_randomize_colors(struct wmOperatorType *ot); void SCULPT_OT_face_sets_change_visibility(struct wmOperatorType *ot); void SCULPT_OT_face_sets_init(struct wmOperatorType *ot); @@ -1343,32 +1468,41 @@ void SCULPT_OT_face_sets_create(struct wmOperatorType *ot); void SCULPT_OT_face_sets_edit(struct wmOperatorType *ot); /* Transform. */ + void SCULPT_OT_set_pivot_position(struct wmOperatorType *ot); /* Mesh Filter. */ + void SCULPT_OT_mesh_filter(struct wmOperatorType *ot); /* Cloth Filter. */ + void SCULPT_OT_cloth_filter(struct wmOperatorType *ot); /* Color Filter. */ + void SCULPT_OT_color_filter(struct wmOperatorType *ot); /* Mask filter and Dirty Mask. */ + void SCULPT_OT_mask_filter(struct wmOperatorType *ot); void SCULPT_OT_dirty_mask(struct wmOperatorType *ot); /* Mask and Face Sets Expand. */ + void SCULPT_OT_mask_expand(struct wmOperatorType *ot); /* Mask Init. */ + void SCULPT_OT_mask_init(struct wmOperatorType *ot); /* Detail size. */ + void SCULPT_OT_detail_flood_fill(struct wmOperatorType *ot); void SCULPT_OT_sample_detail_size(struct wmOperatorType *ot); void SCULPT_OT_set_detail_size(struct wmOperatorType *ot); void SCULPT_OT_dyntopo_detail_size_edit(struct wmOperatorType *ot); /* Dyntopo. */ + void SCULPT_OT_dynamic_topology_toggle(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c index f78f30a2cfd..05db799cb00 100644 --- a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c +++ b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c @@ -229,7 +229,6 @@ static void do_multiplane_scrape_brush_task_cb_ex(void *__restrict userdata, /* Public functions. */ -/* Main Brush Function. */ void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) { SculptSession *ss = ob->sculpt; diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c index 587ce346428..3b939279bf9 100644 --- a/source/blender/editors/sculpt_paint/sculpt_pose.c +++ b/source/blender/editors/sculpt_paint/sculpt_pose.c @@ -540,13 +540,6 @@ static bool pose_face_sets_floodfill_cb( /* Public functions. */ -/** - * Calculate the pose origin and (Optionally the pose factor) - * that is used when using the pose brush. - * - * \param r_pose_origin: Must be a valid pointer. - * \param r_pose_factor: Optional, when set to NULL it won't be calculated. - */ void SCULPT_pose_calc_pose_data(Sculpt *sd, Object *ob, SculptSession *ss, @@ -1132,7 +1125,6 @@ static void sculpt_pose_align_pivot_local_space(float r_mat[4][4], ortho_basis_v3v3_v3(r_mat[0], r_mat[1], r_mat[2]); } -/* Main Brush Function. */ void SCULPT_do_pose_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) { SculptSession *ss = ob->sculpt; diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c index 1bfe8e1cbf1..847f42fe9e8 100644 --- a/source/blender/editors/sculpt_paint/sculpt_smooth.c +++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c @@ -102,8 +102,6 @@ void SCULPT_neighbor_coords_average_interior(SculptSession *ss, float result[3], mul_v3_v3fl(result, avg, 1.0f / total); } -/* For bmesh: Average surrounding verts based on an orthogonality measure. - * Naturally converges to a quad-like structure. */ void SCULPT_bmesh_four_neighbor_average(float avg[3], float direction[3], BMVert *v) { diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 501a1e53276..4a88b75cf25 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1598,7 +1598,6 @@ void ED_sculpt_undo_geometry_end(struct Object *ob) SCULPT_undo_push_end(); } -/* Export for ED_undo_sys. */ void ED_sculpt_undosys_type(UndoType *ut) { ut->name = "Sculpt"; diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 57f9138ec3a..daa973edfbf 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -70,7 +70,6 @@ /* ************************************************************************** */ /* ACTION CREATION */ -/* Helper function to find the active AnimData block from the Action Editor context */ AnimData *ED_actedit_animdata_from_context(const bContext *C, ID **r_adt_id_owner) { SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index bc13b7f2b1b..0ed55ca5191 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -63,7 +63,6 @@ /* ************************************************************************* */ /* Channel List */ -/* left hand part */ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) { ListBase anim_data = {NULL, NULL}; @@ -179,7 +178,6 @@ static void draw_channel_action_ranges(bAnimContext *ac, ListBase *anim_data, Vi } } -/* draw keyframes in each channel */ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region) { ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index ffe0606c98f..581356a89d0 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -41,7 +41,14 @@ void action_buttons_register(struct ARegionType *art); /* ***************************************** */ /* action_draw.c */ + +/** + * Left hand part. + */ void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region); +/** + * Draw keyframes in each channel. + */ void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *region); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index ebb28f3a208..4463856f40a 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -862,7 +862,6 @@ static void action_space_subtype_item_extend(bContext *UNUSED(C), RNA_enum_items_add(item, totitem, rna_enum_space_action_mode_items); } -/* only called once, from space/spacetypes.c */ void ED_spacetype_action(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype action"); diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 149067a94fe..035bc7e297d 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -70,7 +70,6 @@ #include "io_ops.h" -/* Only called once on startup. storage is global in BKE kernel listbase. */ void ED_spacetypes_init(void) { /* UI unit is a variable, may be used in some space type inits. */ @@ -186,10 +185,6 @@ void ED_spacemacros_init(void) } } -/** - * \note Keymap definitions are registered only once per WM initialize, - * usually on file read, using the keymap the actual areas/regions add the handlers. - * \note Called in wm.c. */ void ED_spacetypes_keymap(wmKeyConfig *keyconf) { ED_keymap_screen(keyconf); diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 9cb363ff0c9..5eddea2cc40 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -88,6 +88,7 @@ typedef struct ButsContextTexture { /* internal exports only */ /* buttons_context.c */ + void buttons_context_compute(const struct bContext *C, struct SpaceProperties *sbuts); int buttons_context(const struct bContext *C, const char *member, @@ -98,12 +99,17 @@ struct ID *buttons_context_id_path(const struct bContext *C); extern const char *buttons_context_dir[]; /* doc access */ /* buttons_texture.c */ + void buttons_texture_context_compute(const struct bContext *C, struct SpaceProperties *sbuts); /* buttons_ops.c */ + void BUTTONS_OT_start_filter(struct wmOperatorType *ot); void BUTTONS_OT_clear_filter(struct wmOperatorType *ot); void BUTTONS_OT_toggle_pin(struct wmOperatorType *ot); void BUTTONS_OT_file_browse(struct wmOperatorType *ot); +/** + * Second operator, only difference from #BUTTONS_OT_file_browse is #WM_FILESEL_DIRECTORY. + */ void BUTTONS_OT_directory_browse(struct wmOperatorType *ot); void BUTTONS_OT_context_menu(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 798f4898aaa..46d6df7c69c 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -383,7 +383,6 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot) FILE_SORT_DEFAULT); } -/* Second operator, only difference from BUTTONS_OT_file_browse is WM_FILESEL_DIRECTORY. */ void BUTTONS_OT_directory_browse(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index f1debcef5a9..554edf680be 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -667,7 +667,6 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p) } } -/* Button to quickly show texture in Properties Editor texture tab. */ void uiTemplateTextureShow(uiLayout *layout, const bContext *C, PointerRNA *ptr, PropertyRNA *prop) { /* Only show the button if there is actually a texture assigned. */ diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index bc701bd7aa5..007a9105c76 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -166,11 +166,6 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *region) /** \name Property Editor Layout * \{ */ -/** - * Fills an array with the tab context values for the properties editor. -1 signals a separator. - * - * \return The total number of items in the array returned. - */ int ED_buttons_tabs_list(SpaceProperties *sbuts, short *context_tabs_array) { int length = 0; @@ -924,7 +919,6 @@ static void buttons_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id /** \name Space Type Initialization * \{ */ -/* only called once, from space/spacetypes.c */ void ED_spacetype_buttons(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype buttons"); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 4bccb3664da..68444cc0313 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -1981,7 +1981,6 @@ void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *region } } -/* draw grease pencil */ void clip_draw_grease_pencil(bContext *C, int onlyv2d) { SpaceClip *sc = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 97fcf4ef8ba..5a999b1fad7 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -223,7 +223,6 @@ void ED_space_clip_get_aspect_dimension_aware(SpaceClip *sc, float *aspx, float } } -/* return current frame number in clip space */ int ED_space_clip_get_clip_frame_number(SpaceClip *sc) { MovieClip *clip = ED_space_clip_get_clip(sc); @@ -288,7 +287,6 @@ bool ED_space_clip_get_position(struct SpaceClip *sc, return true; } -/* Returns color in linear space, matching ED_space_image_color_sample(). */ bool ED_space_clip_color_sample(SpaceClip *sc, ARegion *region, int mval[2], float r_col[3]) { ImBuf *ibuf; @@ -511,10 +509,6 @@ void ED_clip_point_stable_pos( } } -/** - * \brief the reverse of #ED_clip_point_stable_pos(), gets the marker region coords. - * better name here? view_to_track / track_to_view or so? - */ void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *region, const float co[2], @@ -539,7 +533,6 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc, r_co[1] = (pos[1] * height * zoomy) + (float)sy; } -/* takes event->mval */ void ED_clip_mouse_pos(SpaceClip *sc, ARegion *region, const int mval[2], float co[2]) { ED_clip_point_stable_pos(sc, region, mval[0], mval[1], &co[0], &co[1]); diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 202dc00e365..20cc6e3da15 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -50,25 +50,34 @@ struct wmOperatorType; /* internal exports only */ /* clip_buttons.c */ + void ED_clip_buttons_register(struct ARegionType *art); /* clip_dopesheet_draw.c */ + void clip_draw_dopesheet_main(struct SpaceClip *sc, struct ARegion *region, struct Scene *scene); void clip_draw_dopesheet_channels(const struct bContext *C, struct ARegion *region); /* clip_dopesheet_ops.c */ + void CLIP_OT_dopesheet_select_channel(struct wmOperatorType *ot); void CLIP_OT_dopesheet_view_all(struct wmOperatorType *ot); /* clip_draw.c */ + void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct ARegion *region); + +/* draw grease pencil */ + void clip_draw_grease_pencil(struct bContext *C, int onlyv2d); void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *region); /* clip_editor.c */ + void clip_start_prefetch_job(const struct bContext *C); /* clip_graph_draw.c */ + void clip_draw_graph(struct SpaceClip *sc, struct ARegion *region, struct Scene *scene); /* clip_graph_ops.c */ @@ -171,6 +180,9 @@ void clip_delete_plane_track(struct bContext *C, struct MovieClip *clip, struct MovieTrackingPlaneTrack *plane_track); +/** + * Calculate space clip offset to be centered at the given point. + */ void clip_view_offset_for_center_to_point( SpaceClip *sc, const float x, const float y, float *r_offset_x, float *r_offset_y); void clip_view_center_to_point(SpaceClip *sc, float x, float y); @@ -178,6 +190,10 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y); bool clip_view_calculate_view_selection( const struct bContext *C, bool fit, float *r_offset_x, float *r_offset_y, float *r_zoom); +/** + * Returns truth if lock-to-selection is enabled and possible. + * Locking to selection is not possible if there is no selection. + */ bool clip_view_has_locked_selection(const struct bContext *C); void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 23dd290e13f..5f5a24a9407 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -398,7 +398,6 @@ void clip_delete_plane_track(bContext *C, MovieClip *clip, MovieTrackingPlaneTra DEG_id_tag_update(&clip->id, 0); } -/* Calculate space clip offset to be centered at the given point. */ void clip_view_offset_for_center_to_point( SpaceClip *sc, const float x, const float y, float *r_offset_x, float *r_offset_y) { @@ -608,8 +607,6 @@ bool clip_view_calculate_view_selection( return true; } -/* Returns truth if lock-to-selection is enabled and possible. - * Locking to selection is not possible if there is no selection. */ bool clip_view_has_locked_selection(const bContext *C) { SpaceClip *space_clip = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index e2fbb4a5a59..91083fa9682 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1335,7 +1335,6 @@ static void clip_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, I } } -/* only called once, from space/spacetypes.c */ void ED_spacetype_clip(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype clip"); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 84be24e96ac..e66c3898d04 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -293,7 +293,6 @@ static void console_main_region_listener(const wmRegionListenerParams *params) } } -/* only called once, from space/spacetypes.c */ void ED_spacetype_console(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype console"); diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc index 47e650a7e56..2576d0052a8 100644 --- a/source/blender/editors/space_file/asset_catalog_tree_view.cc +++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc @@ -691,10 +691,6 @@ void file_delete_asset_catalog_filter_settings( OBJECT_GUARDED_SAFE_DELETE(*filter_settings, AssetCatalogFilterSettings); } -/** - * \return True if the file list should update its filtered results (e.g. because filtering - * parameters changed). - */ bool file_set_asset_catalog_filter_settings( FileAssetCatalogFilterSettingsHandle *filter_settings_handle, eFileSel_Params_AssetCatalogVisibility catalog_visibility, diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index c2c9cbf797a..44e9735866d 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -1132,10 +1132,6 @@ static void file_draw_invalid_library_hint(const bContext *C, } } -/** - * Draw a string hint if the file list is invalid. - * \return true if the list is invalid and a hint was drawn. - */ bool file_draw_hint_if_invalid(const bContext *C, const SpaceFile *sfile, ARegion *region) { FileAssetSelectParams *asset_params = ED_fileselect_get_asset_params(sfile); diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index f6b5f0f47cd..3fe48157a09 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -41,20 +41,30 @@ struct uiLayout; struct View2D; /* file_draw.c */ + #define ATTRIBUTE_COLUMN_PADDING (0.5f * UI_UNIT_X) -#define SMALL_SIZE_CHECK(_size) ((_size) < 64) /* Related to FileSelectParams.thumbnail_size. */ +/** Related to #FileSelectParams.thumbnail_size. */ +#define SMALL_SIZE_CHECK(_size) ((_size) < 64) void file_calc_previews(const bContext *C, ARegion *region); void file_draw_list(const bContext *C, ARegion *region); +/** + * Draw a string hint if the file list is invalid. + * \return true if the list is invalid and a hint was drawn. + */ bool file_draw_hint_if_invalid(const bContext *C, const SpaceFile *sfile, ARegion *region); void file_draw_check_ex(bContext *C, struct ScrArea *area); void file_draw_check(bContext *C); +/** + * For use with; #UI_block_func_set. + */ void file_draw_check_cb(bContext *C, void *arg1, void *arg2); bool file_draw_check_exists(SpaceFile *sfile); /* file_ops.h */ + struct wmOperator; struct wmOperatorType; @@ -72,6 +82,10 @@ void FILE_OT_bookmark_move(struct wmOperatorType *ot); void FILE_OT_reset_recent(wmOperatorType *ot); void FILE_OT_hidedot(struct wmOperatorType *ot); void FILE_OT_execute(struct wmOperatorType *ot); +/** + * Variation of #FILE_OT_execute that accounts for some mouse specific handling. + * Otherwise calls the same logic. + */ void FILE_OT_mouse_execute(struct wmOperatorType *ot); void FILE_OT_cancel(struct wmOperatorType *ot); void FILE_OT_parent(struct wmOperatorType *ot); @@ -92,6 +106,9 @@ void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but); int file_highlight_set(struct SpaceFile *sfile, struct ARegion *region, int mx, int my); +/** + * Use to set the file selector path from some arbitrary source. + */ void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath); void file_sfile_to_operator_ex(struct Main *bmain, struct wmOperator *op, @@ -102,17 +119,28 @@ void file_sfile_to_operator(struct Main *bmain, struct wmOperator *op, struct Sp void file_operator_to_sfile(struct Main *bmain, struct SpaceFile *sfile, struct wmOperator *op); /* space_file.c */ + extern const char *file_context_dir[]; /* doc access */ /* filesel.c */ + void fileselect_refresh_params(struct SpaceFile *sfile); +/** + * Sets #FileSelectParams.file (name of selected file) + */ void fileselect_file_set(SpaceFile *sfile, const int index); bool file_attribute_column_type_enabled(const FileSelectParams *params, FileAttributeColumnType column); +/** + * Check if the region coordinate defined by \a x and \a y are inside the column header. + */ bool file_attribute_column_header_is_inside(const struct View2D *v2d, const FileLayout *layout, int x, int y); +/** + * Find the column type at region coordinate given by \a x (y doesn't matter for this). + */ FileAttributeColumnType file_attribute_column_type_find_isect(const View2D *v2d, const FileSelectParams *params, FileLayout *layout, @@ -129,13 +157,26 @@ void file_params_smoothscroll_timer_clear(struct wmWindowManager *wm, struct wmWindow *win, SpaceFile *sfile); void file_params_renamefile_clear(struct FileSelectParams *params); +/** + * Set the renaming-state to #FILE_PARAMS_RENAME_POSTSCROLL_PENDING and trigger the smooth-scroll + * timer. To be used right after a file was renamed. + * Note that the caller is responsible for setting the correct rename-file info + * (#FileSelectParams.renamefile or #FileSelectParams.rename_id). + */ void file_params_invoke_rename_postscroll(struct wmWindowManager *wm, struct wmWindow *win, SpaceFile *sfile); +/** + * To be executed whenever renaming ends (successfully or not). + */ void file_params_rename_end(struct wmWindowManager *wm, struct wmWindow *win, SpaceFile *sfile, struct FileDirEntry *rename_file); +/** + * Helper used by both main update code, and smooth-scroll timer, + * to try to enable rename editing from #FileSelectParams.renamefile name. + */ void file_params_renamefile_activate(struct SpaceFile *sfile, struct FileSelectParams *params); typedef void *onReloadFnData; @@ -147,20 +188,27 @@ typedef struct SpaceFile_Runtime { onReloadFnData on_reload_custom_data; } SpaceFile_Runtime; -/* Register an on-reload callback function. Note that there can only be one such function at a - * time; registering a new one will overwrite the previous one. */ +/** + * Register an on-reload callback function. Note that there can only be one such function at a + * time; registering a new one will overwrite the previous one. + */ void file_on_reload_callback_register(struct SpaceFile *sfile, onReloadFn callback, onReloadFnData custom_data); /* file_panels.c */ + void file_tool_props_region_panels_register(struct ARegionType *art); void file_execute_region_panels_register(struct ARegionType *art); void file_tools_region_panels_register(struct ARegionType *art); /* file_utils.c */ + void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds); +/** + * If \a path leads to a .blend, remove the trailing slash (if needed). + */ void file_path_to_ui_path(const char *path, char *r_pathi, int max_size); /* asset_catalog_tree_view.cc */ @@ -172,7 +220,8 @@ FileAssetCatalogFilterSettingsHandle *file_create_asset_catalog_filter_settings( void file_delete_asset_catalog_filter_settings( FileAssetCatalogFilterSettingsHandle **filter_settings_handle); /** - * \return True if the stored filter settings were modified. + * \return True if the file list should update its filtered results + * (e.g. because filtering parameters changed). */ bool file_set_asset_catalog_filter_settings( FileAssetCatalogFilterSettingsHandle *filter_settings_handle, diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 1abdaa542c2..76a0e4f42e7 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1694,9 +1694,6 @@ void file_operator_to_sfile(Main *bmain, SpaceFile *sfile, wmOperator *op) /* XXX, files and dirs updates missing, not really so important though */ } -/** - * Use to set the file selector path from some arbitrary source. - */ void file_sfile_filepath_set(SpaceFile *sfile, const char *filepath) { FileSelectParams *params = ED_fileselect_get_active_params(sfile); @@ -1746,7 +1743,6 @@ void file_draw_check(bContext *C) file_draw_check_ex(C, area); } -/* for use with; UI_block_func_set */ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { file_draw_check(C); @@ -1907,10 +1903,6 @@ static int file_execute_mouse_invoke(bContext *C, wmOperator *UNUSED(op), const return OPERATOR_FINISHED; } -/** - * Variation of #FILE_OT_execute that accounts for some mouse specific handling. Otherwise calls - * the same logic. - */ void FILE_OT_mouse_execute(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/space_file/file_utils.c b/source/blender/editors/space_file/file_utils.c index 186bc04fafe..fbe2426021b 100644 --- a/source/blender/editors/space_file/file_utils.c +++ b/source/blender/editors/space_file/file_utils.c @@ -46,9 +46,6 @@ void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int fil ymax); } -/** - * If \a path leads to a .blend, remove the trailing slash (if needed). - */ void file_path_to_ui_path(const char *path, char *r_path, int max_size) { char tmp_path[PATH_MAX]; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index a580cf672f4..3358cffbce6 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -179,7 +179,6 @@ int folderlist_clear_next(struct SpaceFile *sfile) return 1; } -/* not listbase itself */ void folderlist_free(ListBase *folderlist) { if (folderlist) { @@ -1131,11 +1130,6 @@ void filelist_setfilter_options(FileList *filelist, } } -/** - * Set the indexer to be used by the filelist. - * - * The given indexer allocation should be handled by the caller or defined statically. - */ void filelist_setindexer(FileList *filelist, const FileIndexerType *indexer) { BLI_assert(filelist); @@ -1144,10 +1138,6 @@ void filelist_setindexer(FileList *filelist, const FileIndexerType *indexer) filelist->indexer = indexer; } -/** - * \param catalog_id: The catalog that should be filtered by if \a catalog_visibility is - * #FILE_SHOW_ASSETS_FROM_CATALOG. May be NULL otherwise. - */ void filelist_set_asset_catalog_filter_options( FileList *filelist, eFileSel_Params_AssetCatalogVisibility catalog_visibility, @@ -1187,9 +1177,6 @@ static bool filelist_compare_asset_libraries(const AssetLibraryReference *librar return true; } -/** - * \param asset_library_ref: May be NULL to unset the library. - */ void filelist_setlibrary(FileList *filelist, const AssetLibraryReference *asset_library_ref) { /* Unset if needed. */ @@ -1979,10 +1966,6 @@ void filelist_clear(FileList *filelist) filelist_clear_ex(filelist, true, true, true); } -/** - * A "smarter" version of #filelist_clear() that calls partial clearing based on the filelist - * force-reset flags. - */ void filelist_clear_from_reset_tag(FileList *filelist) { /* Do a full clear if needed. */ @@ -2089,9 +2072,6 @@ bool filelist_is_dir(struct FileList *filelist, const char *path) return filelist->check_dir_fn(filelist, (char *)path, false); } -/** - * May modify in place given r_dir, which is expected to be FILE_MAX_LIBEXTRA length. - */ void filelist_setdir(struct FileList *filelist, char *r_dir) { const bool allow_invalid = filelist->asset_library_ref != NULL; @@ -2149,12 +2129,6 @@ bool filelist_needs_reset_on_main_changes(const FileList *filelist) return (filelist->tags & FILELIST_TAGS_USES_MAIN_DATA) != 0; } -/** - * Limited version of full update done by space_file's file_refresh(), - * to be used by operators and such. - * Ensures given filelist is ready to be used (i.e. it is filtered and sorted), - * unless it is tagged for a full refresh. - */ int filelist_files_ensure(FileList *filelist) { if (!filelist_needs_force_reset(filelist) || !filelist_needs_reading(filelist)) { @@ -2267,10 +2241,6 @@ FileDirEntry *filelist_file(struct FileList *filelist, int index) return filelist_file_ex(filelist, index, true); } -/** - * Find a file from a file name, or more precisely, its file-list relative path, inside the - * filtered items. \return The index of the found file or -1. - */ int filelist_file_find_path(struct FileList *filelist, const char *filename) { if (filelist->filelist.nbr_entries_filtered == FILEDIR_NBR_ENTRIES_UNSET) { @@ -2291,10 +2261,6 @@ int filelist_file_find_path(struct FileList *filelist, const char *filename) return -1; } -/** - * Find a file representing \a id. - * \return The index of the found file or -1. - */ int filelist_file_find_id(const FileList *filelist, const ID *id) { if (filelist->filelist.nbr_entries_filtered == FILEDIR_NBR_ENTRIES_UNSET) { @@ -2311,9 +2277,6 @@ int filelist_file_find_id(const FileList *filelist, const ID *id) return -1; } -/** - * Get the ID a file represents (if any). For #FILE_MAIN, #FILE_MAIN_ASSET. - */ ID *filelist_file_get_id(const FileDirEntry *file) { return file->id; @@ -2409,7 +2372,6 @@ static void filelist_file_cache_block_release(struct FileList *filelist, } } -/* Load in cache all entries "around" given index (as much as block cache may hold). */ bool filelist_file_cache_block(struct FileList *filelist, const int index) { FileListEntryCache *cache = &filelist->filelist_cache; @@ -2752,8 +2714,6 @@ static bool file_is_blend_backup(const char *str) return retval; } -/* TODO: Maybe we should move this to BLI? - * On the other hand, it's using defines from space-file area, so not sure... */ int ED_path_extension_type(const char *path) { if (BLO_has_bfile_extension(path)) { @@ -2981,9 +2941,6 @@ bool filelist_entry_is_selected(FileList *filelist, const int index) return selection_state != 0; } -/** - * Set selection of the '..' parent entry, but only if it's actually visible. - */ void filelist_entry_parent_select_set(FileList *filelist, FileSelType select, uint flag, @@ -2994,7 +2951,6 @@ void filelist_entry_parent_select_set(FileList *filelist, } } -/* WARNING! dir must be FILE_MAX_LIBEXTRA long! */ bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group) { return BLO_library_path_explode(filelist->filelist.root, dir, r_group, NULL); diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index e7cda106224..0119a9b4f52 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -51,6 +51,7 @@ typedef enum FileCheckType { CHECK_ALL = 3, } FileCheckType; +/* not listbase itself */ void folderlist_free(struct ListBase *folderlist); void folderlist_popdir(struct ListBase *folderlist, char *dir); void folderlist_pushdir(struct ListBase *folderlist, const char *dir); @@ -73,13 +74,25 @@ void filelist_setfilter_options(struct FileList *filelist, const bool filter_assets_only, const char *filter_glob, const char *filter_search); +/** + * Set the indexer to be used by the filelist. + * + * The given indexer allocation should be handled by the caller or defined statically. + */ void filelist_setindexer(struct FileList *filelist, const struct FileIndexerType *indexer); +/** + * \param catalog_id: The catalog that should be filtered by if \a catalog_visibility is + * #FILE_SHOW_ASSETS_FROM_CATALOG. May be NULL otherwise. + */ void filelist_set_asset_catalog_filter_options( struct FileList *filelist, eFileSel_Params_AssetCatalogVisibility catalog_visibility, const struct bUUID *catalog_id); void filelist_tag_needs_filtering(struct FileList *filelist); void filelist_filter(struct FileList *filelist); +/** + * \param asset_library_ref: May be NULL to unset the library. + */ void filelist_setlibrary(struct FileList *filelist, const struct AssetLibraryReference *asset_library_ref); @@ -98,24 +111,51 @@ void filelist_clear_ex(struct FileList *filelist, const bool do_asset_library, const bool do_cache, const bool do_selection); +/** + * A "smarter" version of #filelist_clear() that calls partial clearing based on the filelist + * force-reset flags. + */ void filelist_clear_from_reset_tag(struct FileList *filelist); void filelist_free(struct FileList *filelist); const char *filelist_dir(struct FileList *filelist); bool filelist_is_dir(struct FileList *filelist, const char *path); +/** + * May modify in place given r_dir, which is expected to be FILE_MAX_LIBEXTRA length. + */ void filelist_setdir(struct FileList *filelist, char *r_dir); +/** + * Limited version of full update done by space_file's file_refresh(), + * to be used by operators and such. + * Ensures given filelist is ready to be used (i.e. it is filtered and sorted), + * unless it is tagged for a full refresh. + */ int filelist_files_ensure(struct FileList *filelist); int filelist_needs_reading(struct FileList *filelist); FileDirEntry *filelist_file(struct FileList *filelist, int index); FileDirEntry *filelist_file_ex(struct FileList *filelist, int index, bool use_request); +/** + * Find a file from a file name, or more precisely, its file-list relative path, inside the + * filtered items. \return The index of the found file or -1. + */ int filelist_file_find_path(struct FileList *filelist, const char *file); +/** + * Find a file representing \a id. + * \return The index of the found file or -1. + */ int filelist_file_find_id(const struct FileList *filelist, const struct ID *id); +/** + * Get the ID a file represents (if any). For #FILE_MAIN, #FILE_MAIN_ASSET. + */ struct ID *filelist_file_get_id(const struct FileDirEntry *file); bool filelist_uid_is_set(const FileUID uid); void filelist_uid_unset(FileUID *r_uid); void filelist_file_cache_slidingwindow_set(struct FileList *filelist, size_t window_size); +/** + * Load in cache all entries "around" given index (as much as block cache may hold). + */ bool filelist_file_cache_block(struct FileList *filelist, const int index); bool filelist_needs_force_reset(struct FileList *filelist); @@ -147,6 +187,9 @@ unsigned int filelist_entry_select_index_get(struct FileList *filelist, const int index, FileCheckType check); bool filelist_entry_is_selected(struct FileList *filelist, const int index); +/** + * Set selection of the '..' parent entry, but only if it's actually visible. + */ void filelist_entry_parent_select_set(struct FileList *filelist, FileSelType select, unsigned int flag, @@ -157,6 +200,9 @@ void filelist_setrecursion(struct FileList *filelist, const int recursion_level) struct AssetLibrary *filelist_asset_library(struct FileList *filelist); struct BlendHandle *filelist_lib(struct FileList *filelist); +/** + * \param dir: Must be #FILE_MAX_LIBEXTRA long! + */ bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group); void filelist_freelib(struct FileList *filelist); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 8d89fbbd80f..e3ac5840da3 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -358,9 +358,6 @@ static FileSelectParams *fileselect_ensure_updated_file_params(SpaceFile *sfile) return params; } -/** - * If needed, create and return the file select parameters for the active browse mode. - */ FileSelectParams *ED_fileselect_ensure_active_params(SpaceFile *sfile) { switch ((eFileBrowse_Mode)sfile->browse_mode) { @@ -380,9 +377,6 @@ FileSelectParams *ED_fileselect_ensure_active_params(SpaceFile *sfile) return NULL; } -/** - * Get the file select parameters for the active browse mode. - */ FileSelectParams *ED_fileselect_get_active_params(const SpaceFile *sfile) { if (!sfile) { @@ -647,13 +641,6 @@ void ED_fileselect_set_params_from_userdef(SpaceFile *sfile) } } -/** - * Update the user-preference data for the file space. In fact, this also contains some - * non-FileSelectParams data, but we can safely ignore this. - * - * \param temp_win_size: If the browser was opened in a temporary window, - * pass its size here so we can store that in the preferences. Otherwise NULL. - */ void ED_fileselect_params_to_userdef(SpaceFile *sfile, const int temp_win_size[2], const bool is_maximized) @@ -691,9 +678,6 @@ void ED_fileselect_params_to_userdef(SpaceFile *sfile, } } -/** - * Sets FileSelectParams->file (name of selected file) - */ void fileselect_file_set(SpaceFile *sfile, const int index) { const struct FileDirEntry *file = filelist_file(sfile->files, index); @@ -814,10 +798,6 @@ int ED_fileselect_layout_offset(FileLayout *layout, int x, int y) return active_file; } -/** - * Get the currently visible bounds of the layout in screen space. Matches View2D.mask minus the - * top column-header row. - */ void ED_fileselect_layout_maskrect(const FileLayout *layout, const View2D *v2d, rcti *r_rect) { *r_rect = v2d->mask; @@ -857,9 +837,6 @@ void ED_fileselect_layout_tilepos(FileLayout *layout, int tile, int *x, int *y) } } -/** - * Check if the region coordinate defined by \a x and \a y are inside the column header. - */ bool file_attribute_column_header_is_inside(const View2D *v2d, const FileLayout *layout, int x, @@ -886,9 +863,6 @@ bool file_attribute_column_type_enabled(const FileSelectParams *params, } } -/** - * Find the column type at region coordinate given by \a x (y doesn't matter for this). - */ FileAttributeColumnType file_attribute_column_type_find_isect(const View2D *v2d, const FileSelectParams *params, FileLayout *layout, @@ -1105,10 +1079,6 @@ FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, ARegion *region) return sfile->layout; } -/** - * Support updating the directory even when this isn't the active space - * needed so RNA properties update function isn't context sensitive, see T70255. - */ void ED_file_change_dir_ex(bContext *C, ScrArea *area) { /* May happen when manipulating non-active spaces. */ @@ -1304,12 +1274,6 @@ void file_params_smoothscroll_timer_clear(wmWindowManager *wm, wmWindow *win, Sp sfile->smoothscroll_timer = NULL; } -/** - * Set the renaming-state to #FILE_PARAMS_RENAME_POSTSCROLL_PENDING and trigger the smooth-scroll - * timer. To be used right after a file was renamed. - * Note that the caller is responsible for setting the correct rename-file info - * (#FileSelectParams.renamefile or #FileSelectParams.rename_id). - */ void file_params_invoke_rename_postscroll(wmWindowManager *wm, wmWindow *win, SpaceFile *sfile) { FileSelectParams *params = ED_fileselect_get_active_params(sfile); @@ -1323,9 +1287,6 @@ void file_params_invoke_rename_postscroll(wmWindowManager *wm, wmWindow *win, Sp sfile->scroll_offset = 0; } -/** - * To be executed whenever renaming ends (successfully or not). - */ void file_params_rename_end(wmWindowManager *wm, wmWindow *win, SpaceFile *sfile, @@ -1357,10 +1318,6 @@ static int file_params_find_renamed(const FileSelectParams *params, struct FileL filelist_file_find_path(filelist, params->renamefile); } -/** - * Helper used by both main update code, and smooth-scroll timer, - * to try to enable rename editing from #FileSelectParams.renamefile name. - */ void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params) { BLI_assert(params->rename_flag != 0); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index c8e9742be53..bbf3c6f768c 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -1003,7 +1003,6 @@ static void file_id_remap(ScrArea *area, SpaceLink *sl, ID *UNUSED(old_id), ID * file_reset_filelist_showing_main_data(area, sfile); } -/* only called once, from space/spacetypes.c */ void ED_spacetype_file(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype file"); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 3635e9deb29..ed5993c77a7 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1314,9 +1314,6 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) /* Public Curve-Drawing API ---------------- */ -/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) - * NOTE: unit mapping has already been applied to the values, so do not try and apply again - */ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region) { FCurve *fcu; @@ -1364,9 +1361,6 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region GPU_blend(GPU_BLEND_NONE); } -/* This is called twice from space_graph.c -> graph_main_region_draw() - * Unselected then selected F-Curves are drawn so that they do not occlude each other. - */ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, short sel) { ListBase anim_data = {NULL, NULL}; @@ -1408,7 +1402,6 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, shor /** \name Channel List * \{ */ -/* left hand part */ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) { ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 7add2f7cbb8..4db1eb5214e 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -34,12 +34,23 @@ struct bContext; /* ***************************************** */ /* graph_draw.c */ +/** + * Left hand part. + */ void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region); +/** + * This is called twice from space_graph.c -> graph_main_region_draw() + * Unselected then selected F-Curves are drawn so that they do not occlude each other. + */ void graph_draw_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *region, short sel); +/** + * Draw the 'ghost' F-Curves (i.e. snapshots of the curve) + * \note unit mapping has already been applied to the values, so do not try and apply again. + */ void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *region); @@ -47,6 +58,17 @@ void graph_draw_ghost_curves(struct bAnimContext *ac, /* ***************************************** */ /* graph_select.c */ +/** + * Deselects keyframes in the Graph Editor + * - This is called by the deselect all operator, as well as other ones! + * + * - test: check if select or deselect all + * - sel: how to select keyframes + * 0 = deselect + * 1 = select + * 2 = invert + * - do_channels: whether to affect selection status of channels + */ void deselect_graph_keys(struct bAnimContext *ac, bool test, short sel, bool do_channels); void GRAPH_OT_select_all(struct wmOperatorType *ot); @@ -78,6 +100,10 @@ enum eGraphKeys_ColumnSelect_Mode { /* ***************************************** */ /* graph_edit.c */ +/** + * Get the min/max keyframes. + * \note it should return total bound-box, filter for selection only can be argument. + */ void get_graph_keyframe_extents(struct bAnimContext *ac, float *xmin, float *xmax, @@ -166,12 +192,36 @@ void graph_buttons_register(struct ARegionType *art); /* ***************************************** */ /* graph_utils.c */ +/** + * Find 'active' F-Curve. + * It must be editable, since that's the purpose of these buttons (subject to change). + * We return the 'wrapper' since it contains valuable context info (about hierarchy), + * which will need to be freed when the caller is done with it. + * + * \note curve-visible flag isn't included, + * otherwise selecting a curve via list to edit is too cumbersome. + */ struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac); +/** + * Check if there are any visible keyframes (for selection tools). + */ bool graphop_visible_keyframes_poll(struct bContext *C); +/** + * Check if there are any visible + editable keyframes (for editing tools). + */ bool graphop_editable_keyframes_poll(struct bContext *C); +/** + * Has active F-Curve that's editable. + */ bool graphop_active_fcurve_poll(struct bContext *C); +/** + * Has active F-Curve in the context that's editable. + */ bool graphop_active_editable_fcurve_ctx_poll(struct bContext *C); +/** + * Has selected F-Curve that's editable. + */ bool graphop_selected_fcurve_poll(struct bContext *C); /* ***************************************** */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 03bfd1092c6..29eb5b43e6c 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -346,17 +346,6 @@ static tNearestVertInfo *find_nearest_fcurve_vert(bAnimContext *ac, const int mv * 3) (de)select all - no testing is done; only for use internal tools as normal function... * \{ */ -/** - * Deselects keyframes in the Graph Editor - * - This is called by the deselect all operator, as well as other ones! - * - * - test: check if select or deselect all - * - sel: how to select keyframes - * 0 = deselect - * 1 = select - * 2 = invert - * - do_channels: whether to affect selection status of channels - */ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channels) { ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index 89e7fefd9ac..d78af4c4bcf 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -50,9 +50,6 @@ /** \name Set Up Drivers Editor * \{ */ -/* Set up UI configuration for Drivers Editor */ -/* NOTE: Currently called from window-manager - * (new drivers editor window) and RNA (mode switching) */ void ED_drivers_editor_init(bContext *C, ScrArea *area) { SpaceGraph *sipo = (SpaceGraph *)area->spacedata.first; @@ -96,15 +93,6 @@ void ED_drivers_editor_init(bContext *C, ScrArea *area) /** \name Active F-Curve * \{ */ -/** - * Find 'active' F-Curve. - * It must be editable, since that's the purpose of these buttons (subject to change). - * We return the 'wrapper' since it contains valuable context info (about hierarchy), - * which will need to be freed when the caller is done with it. - * - * \note curve-visible flag isn't included, - * otherwise selecting a curve via list to edit is too cumbersome. - */ bAnimListElem *get_active_fcurve_channel(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; @@ -134,7 +122,6 @@ bAnimListElem *get_active_fcurve_channel(bAnimContext *ac) /** \name Operator Polling Callbacks * \{ */ -/* Check if there are any visible keyframes (for selection tools) */ bool graphop_visible_keyframes_poll(bContext *C) { bAnimContext ac; @@ -187,7 +174,6 @@ bool graphop_visible_keyframes_poll(bContext *C) return found; } -/* Check if there are any visible + editable keyframes (for editing tools) */ bool graphop_editable_keyframes_poll(bContext *C) { bAnimContext ac; @@ -242,7 +228,6 @@ bool graphop_editable_keyframes_poll(bContext *C) return found; } -/* has active F-Curve that's editable */ bool graphop_active_fcurve_poll(bContext *C) { bAnimContext ac; @@ -286,7 +271,6 @@ bool graphop_active_fcurve_poll(bContext *C) return has_fcurve; } -/* has active F-Curve in the context that's editable */ bool graphop_active_editable_fcurve_ctx_poll(bContext *C) { PointerRNA ptr = CTX_data_pointer_get_type(C, "active_editable_fcurve", &RNA_FCurve); @@ -294,7 +278,6 @@ bool graphop_active_editable_fcurve_ctx_poll(bContext *C) return ptr.data != NULL; } -/* has selected F-Curve that's editable */ bool graphop_selected_fcurve_poll(bContext *C) { bAnimContext ac; diff --git a/source/blender/editors/space_graph/graph_view.c b/source/blender/editors/space_graph/graph_view.c index a12c6053877..a2f31a01a70 100644 --- a/source/blender/editors/space_graph/graph_view.c +++ b/source/blender/editors/space_graph/graph_view.c @@ -56,8 +56,6 @@ /** \name Calculate Range * \{ */ -/* Get the min/max keyframes. */ -/* NOTE: it should return total boundbox, filter for selection only can be argument... */ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 0e2c9b85bc6..40c95d4f382 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -829,7 +829,6 @@ static void graph_space_subtype_item_extend(bContext *UNUSED(C), RNA_enum_items_add(item, totitem, rna_enum_space_graph_mode_items); } -/* only called once, from space/spacetypes.c */ void ED_spacetype_ipo(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype ipo"); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 6a50f6d42e8..4b8388a0002 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -63,7 +63,6 @@ #define B_NOP -1 #define MAX_IMAGE_INFO_LEN 128 -/* gets active viewer user */ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree) { bNode *node; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index d76b1842c94..ade5993cdb9 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -135,7 +135,6 @@ static void draw_render_info( } } -/* used by node view too */ void ED_image_draw_info(Scene *scene, ARegion *region, bool color_manage, @@ -614,11 +613,6 @@ void ED_space_image_grid_steps(SpaceImage *sima, } } -/** - * Calculate the increment snapping value for UV/image editor based on the zoom factor - * The code in here (except the offset part) is used in `grid_frag.glsl` (see `grid_res`) for - * drawing the grid overlay for the UV/Image editor. - */ float ED_space_image_increment_snap_value(const int grid_dimesnions, const float grid_steps[SI_GRID_STEPS_LEN], const float zoom_factor) diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 05124f49a20..470cff20718 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -177,7 +177,6 @@ void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock) } } -/* Get the SpaceImage flag that is valid for the given ibuf. */ int ED_space_image_get_display_channel_mask(ImBuf *ibuf) { int result = (SI_USE_ALPHA | SI_SHOW_ALPHA | SI_SHOW_ZBUF | SI_SHOW_R | SI_SHOW_G | SI_SHOW_B); @@ -318,7 +317,6 @@ void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *r_aspx, float * } } -/* takes event->mval */ void ED_image_mouse_pos(SpaceImage *sima, const ARegion *region, const int mval[2], float co[2]) { int sx, sy, width, height; @@ -377,10 +375,6 @@ void ED_image_point_pos__reverse(SpaceImage *sima, r_co[1] = (co[1] * height * zoomy) + (float)sy; } -/** - * This is more a user-level functionality, for going to `next/prev` used slot, - * Stepping onto the last unused slot too. - */ bool ED_image_slot_cycle(struct Image *image, int direction) { const int cur = image->render_slot; @@ -482,7 +476,6 @@ bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit) return false; } -/* matches clip function */ bool ED_space_image_check_show_maskedit(SpaceImage *sima, Object *obedit) { /* check editmode - this is reserved for UV editing */ diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index 6af0f3a416b..63c537467f7 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -36,11 +36,13 @@ struct wmOperatorType; extern const char *image_context_dir[]; /* doc access */ /* image_draw.c */ + void draw_image_main_helpers(const struct bContext *C, struct ARegion *region); void draw_image_cache(const struct bContext *C, struct ARegion *region); void draw_image_sample_line(struct SpaceImage *sima); /* image_ops.c */ + bool space_image_main_region_poll(struct bContext *C); bool space_image_view_center_cursor_poll(struct bContext *C); @@ -59,7 +61,13 @@ void IMAGE_OT_view_ndof(struct wmOperatorType *ot); #endif void IMAGE_OT_new(struct wmOperatorType *ot); +/** + * Called by other space types too. + */ void IMAGE_OT_open(struct wmOperatorType *ot); +/** + * Called by other space types too. + */ void IMAGE_OT_match_movie_length(struct wmOperatorType *ot); void IMAGE_OT_replace(struct wmOperatorType *ot); void IMAGE_OT_reload(struct wmOperatorType *ot); @@ -94,5 +102,9 @@ void IMAGE_OT_tile_remove(struct wmOperatorType *ot); void IMAGE_OT_tile_fill(struct wmOperatorType *ot); /* image_panels.c */ + +/** + * Gets active viewer user. + */ struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree); void image_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 44794439f5f..da4ba8fd857 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1499,7 +1499,6 @@ static void image_open_draw(bContext *UNUSED(C), wmOperator *op) } } -/* called by other space types too */ void IMAGE_OT_open(wmOperatorType *ot) { /* identifiers */ @@ -1574,7 +1573,6 @@ static int image_match_len_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -/* called by other space types too */ void IMAGE_OT_match_movie_length(wmOperatorType *ot) { /* identifiers */ @@ -3190,7 +3188,6 @@ void IMAGE_OT_unpack(wmOperatorType *ot) /** \name Sample Image Operator * \{ */ -/* Returns mouse position in image space. */ bool ED_space_image_get_position(SpaceImage *sima, struct ARegion *region, int mval[2], @@ -3210,7 +3207,6 @@ bool ED_space_image_get_position(SpaceImage *sima, return true; } -/* Returns color in linear space, matching ED_space_node_color_sample(). */ bool ED_space_image_color_sample( SpaceImage *sima, ARegion *region, int mval[2], float r_col[3], bool *r_is_data) { diff --git a/source/blender/editors/space_image/image_sequence.c b/source/blender/editors/space_image/image_sequence.c index c4f111264a3..87bff913ff2 100644 --- a/source/blender/editors/space_image/image_sequence.c +++ b/source/blender/editors/space_image/image_sequence.c @@ -217,7 +217,6 @@ static void image_detect_frame_range(ImageFrameRange *range, const bool detect_u } } -/* Used for both images and volume file loading. */ ListBase ED_image_filesel_detect_sequences(Main *bmain, wmOperator *op, const bool detect_udim) { ListBase ranges; diff --git a/source/blender/editors/space_image/image_undo.c b/source/blender/editors/space_image/image_undo.c index 3fbcc8348c8..e81f3b6a490 100644 --- a/source/blender/editors/space_image/image_undo.c +++ b/source/blender/editors/space_image/image_undo.c @@ -989,7 +989,6 @@ static void image_undosys_foreach_ID_ref(UndoStep *us_p, } } -/* Export for ED_undo_sys. */ void ED_image_undosys_type(UndoType *ut) { ut->name = "Image"; @@ -1040,7 +1039,6 @@ ListBase *ED_image_paint_tile_list_get(void) return &us->paint_tiles; } -/* Restore painting image to previous state. Used for anchored and drag-dot style brushes. */ void ED_image_undo_restore(UndoStep *us) { ListBase *paint_tiles = &((ImageUndoStep *)us)->paint_tiles; @@ -1059,10 +1057,6 @@ static ImageUndoStep *image_undo_push_begin(const char *name, int paint_mode) return us; } -/** - * The caller is responsible for running #ED_image_undo_push_end, - * failure to do so causes an invalid state for the undo system. - */ void ED_image_undo_push_begin(const char *name, int paint_mode) { image_undo_push_begin(name, paint_mode); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 516ffcd1e75..dad494e6984 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -1042,7 +1042,6 @@ static void image_space_subtype_item_extend(bContext *UNUSED(C), /**************************** spacetype *****************************/ -/* only called once, from space/spacetypes.c */ void ED_spacetype_image(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype image"); diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 1062b76b1df..ce17450549e 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -299,6 +299,7 @@ static int box_select_exec(bContext *C, wmOperator *op) } /* ****** Box Select ****** */ + void INFO_OT_select_box(wmOperatorType *ot) { /* identifiers */ diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc index 19c98fb4d17..bcf26743030 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.cc @@ -721,11 +721,6 @@ static void stats_row(int col1, BLF_draw_default(col2, *y, 0.0f, values, sizeof(values)); } -/** - * \param v3d_local: Pass this argument to calculate view-port local statistics. - * Note that this must only be used for local-view, otherwise report specific statistics - * will be written into the global scene statistics giving incorrect results. - */ void ED_info_draw_stats( Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d_local, int x, int *y, int height) { diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index e56bb44b1e6..1d28aace7f2 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -264,7 +264,6 @@ static void info_header_region_message_subscribe(const wmRegionMessageSubscribeP WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw); } -/* only called once, from space/spacetypes.c */ void ED_spacetype_info(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype info"); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index e656155fb13..cc14abd8bb3 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -303,13 +303,6 @@ static bool textview_draw_string(TextViewDrawState *tds, return true; } -/** - * \param r_mval_pick_item: The resulting item clicked on using \a mval_init. - * Set from the void pointer which holds the current iterator. - * Its type depends on the data being iterated over. - * \param r_mval_pick_offset: The offset in bytes of the \a mval_init. - * Use for selection. - */ int textview_draw(TextViewContext *tvc, const bool do_draw, const int mval_init[2], diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h index 7520dbce191..96f537b4b97 100644 --- a/source/blender/editors/space_info/textview.h +++ b/source/blender/editors/space_info/textview.h @@ -73,6 +73,13 @@ typedef struct TextViewContext { } TextViewContext; +/** + * \param r_mval_pick_item: The resulting item clicked on using \a mval_init. + * Set from the void pointer which holds the current iterator. + * Its type depends on the data being iterated over. + * \param r_mval_pick_offset: The offset in bytes of the \a mval_init. + * Use for selection. + */ int textview_draw(struct TextViewContext *tvc, const bool do_draw, const int mval_init[2], diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 1b87a8c6b9d..47af7a66f6f 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -629,7 +629,6 @@ void NLA_OT_action_unlink(wmOperatorType *ot) /* ******************** Add Tracks Operator ***************************** */ /* Add NLA Tracks to the same AnimData block as a selected track, or above the selected tracks */ -/* helper - add NLA Tracks alongside existing ones */ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel) { ListBase anim_data = {NULL, NULL}; @@ -678,7 +677,6 @@ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel) return added; } -/* helper - add NLA Tracks to empty (and selected) AnimData blocks */ bool nlaedit_add_tracks_empty(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 4f335a0d13a..12f0011b499 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -65,9 +65,6 @@ /* Action-Line ---------------------- */ -/* get colors for drawing Action-Line - * NOTE: color returned includes fine-tuned alpha! - */ void nla_action_get_color(AnimData *adt, bAction *act, float color[4]) { if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 9f42e6378ca..1376dade659 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -71,7 +71,6 @@ /** \name Public Utilities * \{ */ -/* Perform validation for blending/extend settings */ void ED_nla_postop_refresh(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; @@ -205,7 +204,6 @@ void NLA_OT_tweakmode_enter(wmOperatorType *ot) /** \name Disable Tweak-Mode Operator * \{ */ -/* NLA Editor internal API function for exiting tweak-mode. */ bool nlaedit_disable_tweakmode(bAnimContext *ac, bool do_solo) { ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 9a9ea161f56..dd322dd2ad1 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -75,6 +75,9 @@ enum eNlaEdit_Snap_Mode { /* --- */ +/** + * NLA Editor internal API function for exiting tweak-mode. + */ bool nlaedit_disable_tweakmode(bAnimContext *ac, bool do_solo); void NLA_OT_tweakmode_enter(wmOperatorType *ot); @@ -121,7 +124,13 @@ void NLA_OT_fmodifier_paste(wmOperatorType *ot); /* **************************************** */ /* nla_channels.c */ +/** + * Helper - add NLA Tracks alongside existing ones. + */ bool nlaedit_add_tracks_existing(bAnimContext *ac, bool above_sel); +/** + * helper - add NLA Tracks to empty (and selected) AnimData blocks. + */ bool nlaedit_add_tracks_empty(bAnimContext *ac); /* --- */ @@ -139,9 +148,18 @@ void NLA_OT_selected_objects_add(wmOperatorType *ot); /* **************************************** */ /* nla_ops.c */ +/** + * Tweak-mode is NOT enabled. + */ bool nlaop_poll_tweakmode_off(bContext *C); +/** + * Tweak-mode IS enabled. + */ bool nlaop_poll_tweakmode_on(bContext *C); +/** + * Is tweak-mode enabled - for use in NLA operator code. + */ bool nlaedit_is_tweakmode_on(bAnimContext *ac); /* --- */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 28f194877fa..33449bed798 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -39,7 +39,6 @@ /* ************************** poll callbacks for operators **********************************/ -/* Tweak-mode is NOT enabled. */ bool nlaop_poll_tweakmode_off(bContext *C) { Scene *scene; @@ -62,7 +61,6 @@ bool nlaop_poll_tweakmode_off(bContext *C) return 1; } -/* Tweak-mode IS enabled. */ bool nlaop_poll_tweakmode_on(bContext *C) { Scene *scene; @@ -85,7 +83,6 @@ bool nlaop_poll_tweakmode_on(bContext *C) return 1; } -/* is tweak-mode enabled - for use in NLA operator code */ bool nlaedit_is_tweakmode_on(bAnimContext *ac) { if (ac && ac->scene) { diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 8b44c26f07c..0771153c5f5 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -591,7 +591,6 @@ static void nla_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, ID } } -/* only called once, from space/spacetypes.c */ void ED_spacetype_nla(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype nla"); diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 2fda7af3c14..f229e7090bb 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -3508,7 +3508,6 @@ void draw_nodespace_back_pix(const bContext &C, GPU_matrix_pop(); } -/* return quadratic beziers points for a given nodelink and clip if v2d is not nullptr. */ bool node_link_bezier_handles(const View2D *v2d, const SpaceNode *snode, const bNodeLink &link, @@ -3617,7 +3616,6 @@ bool node_link_bezier_handles(const View2D *v2d, return true; } -/* if v2d not nullptr, it clips and returns 0 if not visible */ bool node_link_bezier_points(const View2D *v2d, const SpaceNode *snode, const bNodeLink &link, @@ -3934,7 +3932,6 @@ static void nodelink_batch_add_link(const SpaceNode &snode, } } -/* don't do shadows if th_col3 is -1. */ void node_draw_link_bezier(const bContext &C, const View2D &v2d, const SpaceNode &snode, @@ -4060,7 +4057,6 @@ void node_draw_link_bezier(const bContext &C, } } -/* NOTE: this is used for fake links in groups too. */ void node_draw_link(const bContext &C, const View2D &v2d, const SpaceNode &snode, diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 5a8d91db085..c6a5e8e68c0 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -61,11 +61,6 @@ /** \name Utilities * \{ */ -/** - * XXX Does some additional initialization on top of #nodeAddNode - * Can be used with both custom and static nodes, - * if `idname == nullptr` the static int type will be used instead. - */ bNode *node_add_node(const bContext &C, const char *idname, int type, float locx, float locy) { SpaceNode &snode = *CTX_wm_space_node(&C); diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 48a81f3dc3a..b4853a6b595 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -259,10 +259,6 @@ static bool compare_nodes(const bNode *a, const bNode *b) return false; } -/** - * Sort nodes by selection: unselected nodes first, then selected, - * then the active node at the very end. Relative order is kept intact. - */ void ED_node_sort(bNodeTree *ntree) { /* Merge sort is the algorithm of choice here. */ @@ -799,8 +795,6 @@ static void node_socket_outline_color_get(const bool selected, } } -/* Usual convention here would be node_socket_get_color(), but that's already used (for setting a - * color property socket). */ void node_socket_color_get(const bContext &C, const bNodeTree &ntree, PointerRNA &node_ptr, @@ -1106,11 +1100,6 @@ static void node_socket_draw_nested(const bContext &C, UI_block_emboss_set(block, old_emboss); } -/** - * Draw a single node socket at default size. - * \note this is only called from external code, internally #node_socket_draw_nested() is used for - * optimized drawing of multiple/all sockets of a node. - */ void ED_node_socket_draw(bNodeSocket *sock, const rcti *rect, const float color[4], float scale) { const float size = 2.25f * NODE_SOCKSIZE * scale; diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 3bce32e7af4..fb90e2bfe50 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -318,13 +318,6 @@ static void compo_startjob(void *cjv, ntree->progress = nullptr; } -/** - * \param scene_owner: is the owner of the job, - * we don't use it for anything else currently so could also be a void pointer, - * but for now keep it an 'Scene' for consistency. - * - * \note only call from spaces `refresh` callbacks, not direct! - use with care. - */ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene *scene_owner) { Main *bmain = CTX_data_main(C); @@ -368,7 +361,6 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene /* ***************************************** */ -/* operator poll callback */ bool composite_node_active(bContext *C) { if (ED_operator_node_active(C)) { @@ -380,7 +372,6 @@ bool composite_node_active(bContext *C) return false; } -/* operator poll callback */ bool composite_node_editable(bContext *C) { if (ED_operator_node_editable(C)) { @@ -468,8 +459,6 @@ bool ED_node_is_geometry(struct SpaceNode *snode) return STREQ(snode->tree_idname, ntreeType_Geometry->idname); } -/* assumes nothing being done in ntree yet, sets the default in/out node */ -/* called from shading buttons or header */ void ED_node_shader_default(const bContext *C, ID *id) { Main *bmain = CTX_data_main(C); @@ -536,8 +525,6 @@ void ED_node_shader_default(const bContext *C, ID *id) } } -/* assumes nothing being done in ntree yet, sets the default in/out node */ -/* called from shading buttons or header */ void ED_node_composit_default(const bContext *C, struct Scene *sce) { /* but lets check it anyway */ @@ -571,8 +558,6 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce) ntreeUpdateTree(CTX_data_main(C), sce->nodetree); } -/* assumes nothing being done in ntree yet, sets the default in/out node */ -/* called from shading buttons or header */ void ED_node_texture_default(const bContext *C, Tex *tex) { /* but lets check it anyway */ @@ -601,7 +586,9 @@ void ED_node_texture_default(const bContext *C, Tex *tex) ntreeUpdateTree(CTX_data_main(C), tex->nodetree); } -/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */ +/** + * Here we set the active tree(s), even called for each redraw now, so keep it fast :) + */ void snode_set_context(const bContext &C) { SpaceNode *snode = CTX_wm_space_node(&C); @@ -1192,7 +1179,6 @@ static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSo return false; } -/* type is SOCK_IN and/or SOCK_OUT */ bool node_find_indicated_socket(SpaceNode &snode, bNode **nodep, bNodeSocket **sockp, diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh index 5a2603bbe9d..01de8a11a84 100644 --- a/source/blender/editors/space_node/node_intern.hh +++ b/source/blender/editors/space_node/node_intern.hh @@ -89,7 +89,9 @@ enum NodeResizeDirection { }; ENUM_OPERATORS(NodeResizeDirection, NODE_RESIZE_LEFT); -/* Transform between View2Ds in the tree path. */ +/** + * Transform between View2Ds in the tree path. + */ blender::float2 space_node_group_offset(const SpaceNode &snode); float node_socket_calculate_height(const bNodeSocket &socket); @@ -100,6 +102,10 @@ blender::float2 node_link_calculate_multi_input_position(const blender::float2 & int node_get_colorid(bNode &node); int node_get_resize_cursor(NodeResizeDirection directions); NodeResizeDirection node_get_resize_direction(const bNode *node, const int x, const int y); +/** + * Usual convention here would be #node_socket_get_color(), + * but that's already used (for setting a color property socket). + */ void node_socket_color_get(const bContext &C, const bNodeTree &ntree, PointerRNA &node_ptr, @@ -152,10 +158,16 @@ void NODE_OT_backimage_sample(wmOperatorType *ot); void nodelink_batch_start(SpaceNode &snode); void nodelink_batch_end(SpaceNode &snode); +/** + * \note this is used for fake links in groups too. + */ void node_draw_link(const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link); +/** + * Don't do shadows if th_col3 is -1. + */ void node_draw_link_bezier(const bContext &C, const View2D &v2d, const SpaceNode &snode, @@ -163,11 +175,15 @@ void node_draw_link_bezier(const bContext &C, int th_col1, int th_col2, int th_col3); +/** If v2d not nullptr, it clips and returns 0 if not visible. */ bool node_link_bezier_points(const View2D *v2d, const SpaceNode *snode, const bNodeLink &link, float coord_array[][2], const int resol); +/** + * Return quadratic beziers points for a given nodelink and clip if v2d is not nullptr. + */ bool node_link_bezier_handles(const View2D *v2d, const SpaceNode *snode, const bNodeLink &ink, @@ -177,6 +193,11 @@ void draw_nodespace_back_pix(const bContext &C, SpaceNode &snode, bNodeInstanceKey parent_key); +/** + * XXX Does some additional initialization on top of #nodeAddNode + * Can be used with both custom and static nodes, + * if `idname == nullptr` the static int type will be used instead. + */ bNode *node_add_node(const bContext &C, const char *idname, int type, float locx, float locy); void NODE_OT_add_reroute(wmOperatorType *ot); void NODE_OT_add_group(wmOperatorType *ot); @@ -220,12 +241,15 @@ void snode_dag_update(bContext &C, SpaceNode &snode); void snode_set_context(const bContext &C); void snode_update(SpaceNode &snode, bNode *node); +/** Operator poll callback. */ bool composite_node_active(bContext *C); +/** Operator poll callback. */ bool composite_node_editable(bContext *C); bool node_has_hidden_sockets(bNode *node); void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set); int node_render_changed_exec(bContext *, wmOperator *); +/** Type is #SOCK_IN and/or #SOCK_OUT. */ bool node_find_indicated_socket(SpaceNode &snode, bNode **nodep, bNodeSocket **sockp, @@ -255,7 +279,9 @@ void NODE_OT_output_file_move_active_socket(wmOperatorType *ot); void NODE_OT_switch_view_update(wmOperatorType *ot); -/* NOTE: clipboard_cut is a simple macro of copy + delete. */ +/** + * \note clipboard_cut is a simple macro of copy + delete. + */ void NODE_OT_clipboard_copy(wmOperatorType *ot); void NODE_OT_clipboard_paste(wmOperatorType *ot); diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 7e845940afd..ce07496068d 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -2015,7 +2015,6 @@ static bool ed_node_link_conditions(ScrArea *area, return true; } -/* test == 0, clear all intersect flags */ void ED_node_link_intersect_test(ScrArea *area, int test) { bNode *select; @@ -2497,7 +2496,6 @@ void NODE_OT_insert_offset(wmOperatorType *ot) /** \name Note Link Insert * \{ */ -/* assumes link with NODE_LINKFLAG_HILITE set */ void ED_node_link_insert(Main *bmain, ScrArea *area) { bNode *select; diff --git a/source/blender/editors/space_node/node_view.cc b/source/blender/editors/space_node/node_view.cc index c7f341bb028..df629a983e3 100644 --- a/source/blender/editors/space_node/node_view.cc +++ b/source/blender/editors/space_node/node_view.cc @@ -444,7 +444,6 @@ static void sample_draw(const bContext *C, ARegion *region, void *arg_info) } } -/* Returns mouse position in image space. */ bool ED_space_node_get_position( Main *bmain, SpaceNode *snode, struct ARegion *region, const int mval[2], float fpos[2]) { @@ -472,9 +471,6 @@ bool ED_space_node_get_position( return true; } -/* Returns color in linear space, matching ED_space_image_color_sample(). - * And here we've got recursion in the comments tips... - */ bool ED_space_node_color_sample( Main *bmain, SpaceNode *snode, ARegion *region, const int mval[2], float r_col[3]) { diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index 714142ef471..f3b95ca2024 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -995,7 +995,6 @@ static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, } } -/* only called once, from space/spacetypes.c */ void ED_spacetype_node() { SpaceType *st = (SpaceType *)MEM_callocN(sizeof(SpaceType), "spacetype node"); diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index ff0bd533671..946d7a0538d 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -134,11 +134,6 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom return TRAVERSE_CONTINUE; } -/** - * Populates the \param objects: ListBase with all the outliner selected objects - * We store it as (Object *)LinkData->data - * \param objects: expected to be empty - */ void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects) { SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index ed52eeab98c..a4d5f2635d4 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -1515,7 +1515,6 @@ void OUTLINER_OT_item_drag_drop(wmOperatorType *ot) /* *************************** Drop Boxes ************************** */ -/* region dropbox definition */ void outliner_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Outliner", SPACE_OUTLINER, RGN_TYPE_WINDOW); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 956c455c545..c339f07fd58 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2933,12 +2933,6 @@ static void outliner_draw_iconrow_doit(uiBlock *block, (*offsx) += UI_UNIT_X; } -/** - * Return the index to use based on the TreeElement ID and object type - * - * We use a continuum of indices until we get to the object data-blocks - * and we then make room for the object types. - */ int tree_element_id_type_to_index(TreeElement *te) { TreeStoreElem *tselem = TREESTORE(te); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index e449e4a609b..9f6fd5d91bb 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -154,9 +154,6 @@ void OUTLINER_OT_highlight_update(wmOperatorType *ot) /** \name Toggle Open/Closed Operator * \{ */ -/** - * Open or close a tree element, optionally toggling all children recursively. - */ void outliner_item_openclose(SpaceOutliner *space_outliner, TreeElement *te, bool open, @@ -964,9 +961,6 @@ void OUTLINER_OT_lib_relocate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* XXX This does not work with several items - * (it is only called once in the end, due to the 'deferred' - * file-browser invocation through event system...). */ void lib_relocate_fn(bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), @@ -975,6 +969,10 @@ void lib_relocate_fn(bContext *C, TreeStoreElem *tselem, void *UNUSED(user_data)) { + /* XXX: This does not work with several items + * (it is only called once in the end, due to the 'deferred' + * file-browser invocation through event system...). */ + wmOperatorType *ot = WM_operatortype_find("WM_OT_lib_relocate", false); lib_relocate(C, te, tselem, ot, false); @@ -1068,10 +1066,6 @@ int outliner_flag_is_any_test(ListBase *lb, short flag, const int curlevel) return 0; } -/** - * Set or unset \a flag for all outliner elements in \a lb and sub-trees. - * \return if any flag was modified. - */ bool outliner_flag_set(ListBase *lb, short flag, short set) { bool changed = false; @@ -1225,7 +1219,6 @@ static void outliner_set_coordinates_element_recursive(SpaceOutliner *space_outl } } -/* to retrieve coordinates with redrawing the entire tree */ void outliner_set_coordinates(ARegion *region, SpaceOutliner *space_outliner) { int starty = (int)(region->v2d.tot.ymax) - UI_UNIT_Y; diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 5336376b576..dfc9017360c 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -250,8 +250,17 @@ typedef enum TreeItemSelectAction { void outliner_free_tree(ListBase *tree); void outliner_cleanup_tree(struct SpaceOutliner *space_outliner); +/** + * Free \a element and its sub-tree and remove its link in \a parent_subtree. + * + * \note Does not remove the #TreeStoreElem of \a element! + * \param parent_subtree: Sub-tree of the parent element, so the list containing \a element. + */ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree); +/** + * Main entry point for building the tree data-structure that the outliner represents. + */ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct ViewLayer *view_layer, @@ -260,6 +269,10 @@ void outliner_build_tree(struct Main *mainvar, bool outliner_requires_rebuild_on_select_or_active_change( const struct SpaceOutliner *space_outliner); +/** + * Check if a display mode needs a full rebuild if the open/collapsed state changes. + * Element types in these modes don't actually add children if collapsed, so the rebuild is needed. + */ bool outliner_requires_rebuild_on_open_change(const struct SpaceOutliner *space_outliner); typedef struct IDsSelectedData { @@ -285,19 +298,34 @@ void outliner_collection_isolate_flag(struct Scene *scene, const char *propname, const bool value); +/** + * Return the index to use based on the TreeElement ID and object type + * + * We use a continuum of indices until we get to the object data-blocks + * and we then make room for the object types. + */ int tree_element_id_type_to_index(TreeElement *te); /* outliner_select.c -------------------------------------------- */ +/** + * Generic call for non-id data to make active in UI + */ void tree_element_type_active_set(struct bContext *C, const TreeViewContext *tvc, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive); +/** + * Generic call for non-id data to check the active state in UI. + */ eOLDrawState tree_element_type_active_state_get(const struct bContext *C, const struct TreeViewContext *tvc, const TreeElement *te, const TreeStoreElem *tselem); +/** + * Generic call for ID data check or make/check active in UI. + */ void tree_element_activate(struct bContext *C, const TreeViewContext *tvc, TreeElement *te, @@ -309,17 +337,32 @@ eOLDrawState tree_element_active_state_get(const TreeViewContext *tvc, struct bPoseChannel *outliner_find_parent_bone(TreeElement *te, TreeElement **r_bone_te); +/** + * Select the item using the set flags. + */ void outliner_item_select(struct bContext *C, struct SpaceOutliner *space_outliner, struct TreeElement *te, const short select_flag); +/** + * Find if x coordinate is over an icon or name. + */ bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x); bool outliner_item_is_co_over_icon(const TreeElement *te, float view_co_x); +/** + * Find if x coordinate is over element name. + */ bool outliner_item_is_co_over_name(const TreeElement *te, float view_co_x); +/** + * Find if x coordinate is over element disclosure toggle. + */ bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x); bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2]); +/** + * Toggle the item's interaction mode if supported. + */ void outliner_item_mode_toggle(struct bContext *C, TreeViewContext *tvc, TreeElement *te, @@ -334,6 +377,10 @@ typedef void (*outliner_operation_fn)(struct bContext *C, TreeStoreElem *, void *); +/** + * \param recurse_selected: Set to false for operations which are already + * recursively operating on their children. + */ void outliner_do_object_operation_ex(struct bContext *C, struct ReportList *reports, struct Scene *scene, @@ -350,6 +397,10 @@ void outliner_do_object_operation(struct bContext *C, outliner_operation_fn operation_fn); int outliner_flag_is_any_test(ListBase *lb, short flag, const int curlevel); +/** + * Set or unset \a flag for all outliner elements in \a lb and sub-trees. + * \return if any flag was modified. + */ bool outliner_flag_set(ListBase *lb, short flag, short set); bool outliner_flag_flip(ListBase *lb, short flag); @@ -390,14 +441,24 @@ void id_remap_fn(struct bContext *C, struct TreeStoreElem *tselem, void *user_data); +/** + * To retrieve coordinates with redrawing the entire tree. + */ void outliner_set_coordinates(struct ARegion *region, struct SpaceOutliner *space_outliner); +/** + * Open or close a tree element, optionally toggling all children recursively. + */ void outliner_item_openclose(struct SpaceOutliner *space_outliner, TreeElement *te, bool open, bool toggle_all); /* outliner_dragdrop.c */ + +/** + * Region dropbox definition. + */ void outliner_dropboxes(void); void OUTLINER_OT_item_drag_drop(struct wmOperatorType *ot); @@ -446,6 +507,8 @@ void merged_element_search_menu_invoke(struct bContext *C, TreeElement *parent_te, TreeElement *activate_te); +/* Menu only! Calls other operators */ + void OUTLINER_OT_operation(struct wmOperatorType *ot); void OUTLINER_OT_scene_operation(struct wmOperatorType *ot); void OUTLINER_OT_object_operation(struct wmOperatorType *ot); @@ -510,19 +573,41 @@ void OUTLINER_OT_collection_color_tag_set(struct wmOperatorType *ot); void outliner_viewcontext_init(const struct bContext *C, TreeViewContext *tvc); +/** + * Try to find an item under y-coordinate \a view_co_y (view-space). + * \note Recursive + */ TreeElement *outliner_find_item_at_y(const SpaceOutliner *space_outliner, const ListBase *tree, float view_co_y); +/** + * Collapsed items can show their children as click-able icons. This function tries to find + * such an icon that represents the child item at x-coordinate \a view_co_x (view-space). + * + * \return a hovered child item or \a parent_te (if no hovered child found). + */ TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner, TreeElement *parent_te, float view_co_x, bool *r_is_merged_icon, bool *r_is_over_icon); +/** + * Tse is not in the treestore, we use its contents to find a match. + */ TreeElement *outliner_find_tse(struct SpaceOutliner *space_outliner, const TreeStoreElem *tse); +/** + * Find specific item from the trees-tore. + */ TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem); +/** + * Find parent element of te. + */ TreeElement *outliner_find_parent_element(ListBase *lb, TreeElement *parent_te, const TreeElement *child_te); +/** + * Find treestore that refers to given ID. + */ TreeElement *outliner_find_id(struct SpaceOutliner *space_outliner, ListBase *lb, const struct ID *id); @@ -530,6 +615,14 @@ TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel * TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone); TreeElement *outliner_search_back_te(TreeElement *te, short idcode); struct ID *outliner_search_back(TreeElement *te, short idcode); +/** + * Iterate over all tree elements (pre-order traversal), executing \a func callback for + * each tree element matching the optional filters. + * + * \param filter_te_flag: If not 0, only TreeElements with this flag will be visited. + * \param filter_tselem_flag: Same as \a filter_te_flag, but for the TreeStoreElem. + * \param func: Custom callback to execute for each visited item. + */ bool outliner_tree_traverse(const SpaceOutliner *space_outliner, ListBase *tree, int filter_te_flag, @@ -537,16 +630,33 @@ bool outliner_tree_traverse(const SpaceOutliner *space_outliner, TreeTraversalFunc func, void *customdata); float outliner_restrict_columns_width(const struct SpaceOutliner *space_outliner); +/** + * Find first tree element in tree with matching treestore flag. + */ TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag); +/** + * Find if element is visible in the outliner tree. + */ bool outliner_is_element_visible(const TreeElement *te); +/** + * Scroll view vertically while keeping within total bounds. + */ void outliner_scroll_view(struct SpaceOutliner *space_outliner, struct ARegion *region, int delta_y); +/** + * The outliner should generally use #ED_region_tag_redraw_no_rebuild() to avoid unnecessary tree + * rebuilds. If elements are open or closed, we may still have to rebuild. + * Upon changing the open/closed state, call this to avoid rebuilds if possible. + */ void outliner_tag_redraw_avoid_rebuild_on_open_change(const struct SpaceOutliner *space_outliner, struct ARegion *region); /* outliner_sync.c ---------------------------------------------- */ +/** + * If outliner is dirty sync selection from view layer and sequencer. + */ void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner *space_outliner); /* outliner_context.c ------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 5e409db0059..855975eb2dc 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -184,7 +184,6 @@ static void do_outliner_item_mode_toggle_generic(bContext *C, TreeViewContext *t ED_undo_group_end(C); } -/* Toggle the item's interaction mode if supported */ void outliner_item_mode_toggle(bContext *C, TreeViewContext *tvc, TreeElement *te, @@ -747,7 +746,6 @@ static void tree_element_text_activate(bContext *C, TreeElement *te) /* ---------------------------------------------- */ -/* generic call for ID data check or make/check active in UI */ void tree_element_activate(bContext *C, const TreeViewContext *tvc, TreeElement *te, @@ -778,9 +776,6 @@ void tree_element_activate(bContext *C, } } -/** - * Generic call for non-id data to make active in UI - */ void tree_element_type_active_set(bContext *C, const TreeViewContext *tvc, TreeElement *te, @@ -1086,9 +1081,6 @@ eOLDrawState tree_element_active_state_get(const TreeViewContext *tvc, return OL_DRAWSEL_NONE; } -/** - * Generic call for non-id data to check the active state in UI. - */ eOLDrawState tree_element_type_active_state_get(const bContext *C, const TreeViewContext *tvc, const TreeElement *te, @@ -1446,7 +1438,6 @@ static void do_outliner_item_activate_tree_element(bContext *C, } } -/* Select the item using the set flags */ void outliner_item_select(bContext *C, SpaceOutliner *space_outliner, TreeElement *te, diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c index d78767019b5..d95a0dde858 100644 --- a/source/blender/editors/space_outliner/outliner_sync.c +++ b/source/blender/editors/space_outliner/outliner_sync.c @@ -52,7 +52,6 @@ #include "outliner_intern.h" -/* Functions for tagging outliner selection syncing is dirty from operators */ void ED_outliner_select_sync_from_object_tag(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); @@ -89,7 +88,6 @@ bool ED_outliner_select_sync_is_dirty(const bContext *C) return wm->outliner_sync_select_dirty & WM_OUTLINER_SYNC_SELECT_FROM_ALL; } -/* Copy sync select dirty flag from window manager to all outliners to be synced lazily on draw */ void ED_outliner_select_sync_flag_outliners(const bContext *C) { Main *bmain = CTX_data_main(C); @@ -352,7 +350,6 @@ static void outliner_sync_selection_from_outliner(Scene *scene, } } -/* Set clean outliner and mark other outliners for syncing */ void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *space_outliner) { /* Don't sync if not checked or in certain outliner display modes */ @@ -547,7 +544,6 @@ static void get_sync_select_active_data(const bContext *C, SyncSelectActiveData active_data->sequence = SEQ_select_active_get(scene); } -/* If outliner is dirty sync selection from view layer and sequencer. */ void outliner_sync_selection(const bContext *C, SpaceOutliner *space_outliner) { /* Set which types of data to sync from sync dirty flag and outliner display mode */ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index ae2b1870884..01f0feec771 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -1095,10 +1095,6 @@ static void singleuser_world_fn(bContext *C, } } -/** - * \param recurse_selected: Set to false for operations which are already - * recursively operating on their children. - */ void outliner_do_object_operation_ex(bContext *C, ReportList *reports, Scene *scene_act, @@ -2984,7 +2980,6 @@ static int outliner_operation(bContext *C, wmOperator *op, const wmEvent *event) return do_outliner_operation_event(C, op->reports, region, space_outliner, hovered_te); } -/* Menu only! Calls other operators */ void OUTLINER_OT_operation(wmOperatorType *ot) { ot->name = "Context Menu"; diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 5427ae31ac3..3353726de18 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -203,12 +203,6 @@ void outliner_cleanup_tree(SpaceOutliner *space_outliner) outliner_storage_cleanup(space_outliner); } -/** - * Free \a element and its sub-tree and remove its link in \a parent_subtree. - * - * \note Does not remove the #TreeStoreElem of \a element! - * \param parent_subtree: Sub-tree of the parent element, so the list containing \a element. - */ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree) { BLI_assert(BLI_findindex(parent_subtree, element) > -1); @@ -235,10 +229,6 @@ bool outliner_requires_rebuild_on_select_or_active_change(const SpaceOutliner *s return exclude_flags & (SO_FILTER_OB_STATE_SELECTED | SO_FILTER_OB_STATE_ACTIVE); } -/** - * Check if a display mode needs a full rebuild if the open/collapsed state changes. - * Element types in these modes don't actually add children if collapsed, so the rebuild is needed. - */ bool outliner_requires_rebuild_on_open_change(const SpaceOutliner *space_outliner) { return ELEM(space_outliner->outlinevis, SO_DATA_API); @@ -822,13 +812,6 @@ static void outliner_add_id_contents(SpaceOutliner *space_outliner, } } -/** - * TODO: this function needs to be split up! It's getting a bit too large... - * - * \note "ID" is not always a real ID. - * \note If child items are only added to the tree if the item is open, - * the `TSE_` type _must_ be added to #outliner_element_needs_rebuild_on_open_change(). - */ TreeElement *outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, @@ -1176,7 +1159,6 @@ TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner, /* Hierarchy --------------------------------------------- */ -/* make sure elements are correctly nested */ void outliner_make_object_parent_hierarchy(ListBase *lb) { /* build hierarchy */ @@ -1876,7 +1858,6 @@ static void outliner_clear_newid_from_main(Main *bmain) /* ======================================================= */ /* Main Tree Building API */ -/* Main entry point for building the tree data-structure that the outliner represents. */ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c index c62ca468747..d370d508198 100644 --- a/source/blender/editors/space_outliner/outliner_utils.c +++ b/source/blender/editors/space_outliner/outliner_utils.c @@ -71,10 +71,6 @@ void outliner_viewcontext_init(const bContext *C, TreeViewContext *tvc) /** \} */ -/** - * Try to find an item under y-coordinate \a view_co_y (view-space). - * \note Recursive - */ TreeElement *outliner_find_item_at_y(const SpaceOutliner *space_outliner, const ListBase *tree, float view_co_y) @@ -142,12 +138,6 @@ static TreeElement *outliner_find_item_at_x_in_row_recursive(const TreeElement * return (TreeElement *)parent_te; } -/** - * Collapsed items can show their children as click-able icons. This function tries to find - * such an icon that represents the child item at x-coordinate \a view_co_x (view-space). - * - * \return a hovered child item or \a parent_te (if no hovered child found). - */ TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner, TreeElement *parent_te, float view_co_x, @@ -167,7 +157,6 @@ TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner, return te; } -/* Find specific item from the trees-tore. */ TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem) { LISTBASE_FOREACH (TreeElement *, te, lb) { @@ -182,7 +171,6 @@ TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store return NULL; } -/* Find parent element of te */ TreeElement *outliner_find_parent_element(ListBase *lb, TreeElement *parent_te, const TreeElement *child_te) @@ -200,7 +188,6 @@ TreeElement *outliner_find_parent_element(ListBase *lb, return NULL; } -/* tse is not in the treestore, we use its contents to find a match */ TreeElement *outliner_find_tse(SpaceOutliner *space_outliner, const TreeStoreElem *tse) { TreeStoreElem *tselem; @@ -219,7 +206,6 @@ TreeElement *outliner_find_tse(SpaceOutliner *space_outliner, const TreeStoreEle return NULL; } -/* Find treestore that refers to given ID */ TreeElement *outliner_find_id(SpaceOutliner *space_outliner, ListBase *lb, const ID *id) { LISTBASE_FOREACH (TreeElement *, te, lb) { @@ -302,14 +288,6 @@ ID *outliner_search_back(TreeElement *te, short idcode) return NULL; } -/** - * Iterate over all tree elements (pre-order traversal), executing \a func callback for - * each tree element matching the optional filters. - * - * \param filter_te_flag: If not 0, only TreeElements with this flag will be visited. - * \param filter_tselem_flag: Same as \a filter_te_flag, but for the TreeStoreElem. - * \param func: Custom callback to execute for each visited item. - */ bool outliner_tree_traverse(const SpaceOutliner *space_outliner, ListBase *tree, int filter_te_flag, @@ -393,7 +371,6 @@ float outliner_restrict_columns_width(const SpaceOutliner *space_outliner) return (num_columns * UI_UNIT_X + V2D_SCROLL_WIDTH); } -/* Find first tree element in tree with matching treestore flag */ TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag) { LISTBASE_FOREACH (TreeElement *, te, lb) { @@ -408,7 +385,6 @@ TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag) return NULL; } -/* Find if element is visible in the outliner tree */ bool outliner_is_element_visible(const TreeElement *te) { TreeStoreElem *tselem; @@ -425,7 +401,6 @@ bool outliner_is_element_visible(const TreeElement *te) return true; } -/* Find if x coordinate is over an icon or name */ bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x) { /* Special case: count area left of Scene Collection as empty space */ @@ -441,19 +416,16 @@ bool outliner_item_is_co_over_icon(const TreeElement *te, float view_co_x) return (view_co_x > (te->xs + UI_UNIT_X)) && (view_co_x < (te->xs + UI_UNIT_X * 2)); } -/* Find if x coordinate is over element name. */ bool outliner_item_is_co_over_name(const TreeElement *te, float view_co_x) { return (view_co_x > (te->xs + UI_UNIT_X * 2)) && (view_co_x < te->xend); } -/* Find if x coordinate is over element disclosure toggle */ bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x) { return (view_co_x > te->xs) && (view_co_x < te->xs + UI_UNIT_X); } -/* Scroll view vertically while keeping within total bounds */ void outliner_scroll_view(SpaceOutliner *space_outliner, ARegion *region, int delta_y) { int tree_width, tree_height; @@ -477,11 +449,6 @@ void outliner_scroll_view(SpaceOutliner *space_outliner, ARegion *region, int de } } -/** - * The outliner should generally use #ED_region_tag_redraw_no_rebuild() to avoid unnecessary tree - * rebuilds. If elements are open or closed, we may still have to rebuild. - * Upon changing the open/closed state, call this to avoid rebuilds if possible. - */ void outliner_tag_redraw_avoid_rebuild_on_open_change(const SpaceOutliner *space_outliner, ARegion *region) { @@ -494,7 +461,6 @@ void outliner_tag_redraw_avoid_rebuild_on_open_change(const SpaceOutliner *space } } -/* Get base of object under cursor. Used for eyedropper tool */ Base *ED_outliner_give_base_under_cursor(bContext *C, const int mval[2]) { ARegion *region = CTX_wm_region(C); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 205f0117e6a..6c45d39e0d8 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -449,7 +449,6 @@ static void outliner_deactivate(struct ScrArea *area) ED_region_tag_redraw_no_rebuild(BKE_area_find_region_type(area, RGN_TYPE_WINDOW)); } -/* only called once, from space_api/spacetypes.c */ void ED_spacetype_outliner(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype time"); diff --git a/source/blender/editors/space_outliner/tree/tree_display.h b/source/blender/editors/space_outliner/tree/tree_display.h index c0a751f2cd5..b6dc33ba7b7 100644 --- a/source/blender/editors/space_outliner/tree/tree_display.h +++ b/source/blender/editors/space_outliner/tree/tree_display.h @@ -49,12 +49,20 @@ ListBase outliner_tree_display_build_tree(TreeDisplay *tree_display, TreeSourceD /* The following functions are needed to build the tree. They are calls back into C; the way * elements are created should be refactored and ported to C++ with a new design/API too. */ +/** + * TODO: this function needs to be split up! It's getting a bit too large... + * + * \note "ID" is not always a real ID. + * \note If child items are only added to the tree if the item is open, + * the `TSE_` type _must_ be added to #outliner_element_needs_rebuild_on_open_change(). + */ struct TreeElement *outliner_add_element(SpaceOutliner *space_outliner, ListBase *lb, void *idv, struct TreeElement *parent, short type, short index); +/* make sure elements are correctly nested */ void outliner_make_object_parent_hierarchy(ListBase *lb); bool outliner_animdata_test(const struct AnimData *adt); TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner, diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh b/source/blender/editors/space_outliner/tree/tree_display.hh index 8aaf396888f..54e64655b18 100644 --- a/source/blender/editors/space_outliner/tree/tree_display.hh +++ b/source/blender/editors/space_outliner/tree/tree_display.hh @@ -148,6 +148,9 @@ class TreeDisplaySequencer final : public AbstractTreeDisplay { private: TreeElement *add_sequencer_contents() const; + /** + * Helped function to put duplicate sequence in the same tree. + */ SequenceAddOp need_add_seq_dup(Sequence *seq) const; void add_seq_dup(Sequence *seq, TreeElement *te, short index) const; }; diff --git a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc index 371813cfb3f..836f0937cf4 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc @@ -33,7 +33,6 @@ namespace blender::ed::outliner { -/* Convenience/readability. */ template<typename T> using List = ListBaseWrapper<T>; TreeDisplayLibraries::TreeDisplayLibraries(SpaceOutliner &space_outliner) diff --git a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc index 69ccf014642..eeb3ca6893a 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc @@ -31,7 +31,6 @@ namespace blender::ed::outliner { -/* Convenience/readability. */ template<typename T> using List = ListBaseWrapper<T>; TreeDisplayIDOrphans::TreeDisplayIDOrphans(SpaceOutliner &space_outliner) diff --git a/source/blender/editors/space_outliner/tree/tree_display_override_library.cc b/source/blender/editors/space_outliner/tree/tree_display_override_library.cc index 0e4636db69d..943e182277c 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_override_library.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_override_library.cc @@ -34,6 +34,11 @@ namespace blender::ed::outliner { /* Convenience/readability. */ +/* Convenience/readability. */ +/* Convenience/readability. */ +/* Convenience/readability. */ +/* Convenience/readability. */ +/* Convenience/readability. */ template<typename T> using List = ListBaseWrapper<T>; TreeDisplayOverrideLibrary::TreeDisplayOverrideLibrary(SpaceOutliner &space_outliner) diff --git a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc index 390f81cfcd1..29442aace37 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_scenes.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_scenes.cc @@ -29,7 +29,6 @@ namespace blender::ed::outliner { -/* Convenience/readability. */ template<typename T> using List = ListBaseWrapper<T>; TreeDisplayScenes::TreeDisplayScenes(SpaceOutliner &space_outliner) diff --git a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc index 02af6a13cb3..aa28b164584 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_sequencer.cc @@ -31,7 +31,6 @@ namespace blender::ed::outliner { -/* Convenience/readability. */ template<typename T> using List = ListBaseWrapper<T>; TreeDisplaySequencer::TreeDisplaySequencer(SpaceOutliner &space_outliner) @@ -63,7 +62,6 @@ ListBase TreeDisplaySequencer::buildTree(const TreeSourceData &source_data) return tree; } -/* Helped function to put duplicate sequence in the same tree. */ SequenceAddOp TreeDisplaySequencer::need_add_seq_dup(Sequence *seq) const { if ((!seq->strip) || (!seq->strip->stripdata)) { diff --git a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc index c3d0aecd3cb..ebbc9baaa9f 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc @@ -37,7 +37,6 @@ namespace blender::ed::outliner { -/* Convenience/readability. */ template<typename T> using List = ListBaseWrapper<T>; class ObjectsChildrenBuilder { diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 11bee36e914..4c4cba2ac58 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -162,7 +162,6 @@ static void script_main_region_listener(const wmRegionListenerParams *UNUSED(par #endif } -/* only called once, from space/spacetypes.c */ void ED_spacetype_script(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype script"); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 896b64d97af..e814530d1e2 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -668,7 +668,6 @@ static void drawmeta_contents(Scene *scene, GPU_blend(GPU_BLEND_NONE); } -/* Get handle width in 2d-View space. */ float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx) { const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize; @@ -1517,13 +1516,6 @@ void ED_sequencer_special_preview_clear(void) sequencer_special_update_set(NULL); } -/** - * Rendering using opengl will change the current viewport/context. - * This is why we need the \a region, to set back the render area. - * - * TODO: do not rely on such hack and just update the \a ibuf outside of - * the UI drawing code. - */ ImBuf *sequencer_ibuf_get(struct Main *bmain, ARegion *region, struct Depsgraph *depsgraph, diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 71fd6bb80f5..e9f37fa6838 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -127,7 +127,6 @@ bool ED_space_sequencer_maskedit_poll(bContext *C) return false; } -/* Are we displaying the seq output (not channels or histogram). */ bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq) { return (sseq->mainb == SEQ_DRAW_IMG_IMBUF) && @@ -152,12 +151,6 @@ static bool sequencer_fcurves_targets_color_strip(const FCurve *fcurve) return true; } -/* - * Check if there is animation shown during playback. - * - * - Colors of color strips are displayed on the strip itself. - * - Backdrop is drawn. - */ bool ED_space_sequencer_has_playback_animation(const struct SpaceSeq *sseq, const struct Scene *scene) { @@ -187,7 +180,6 @@ bool ED_space_sequencer_has_playback_animation(const struct SpaceSeq *sseq, /** \name Shared Poll Functions * \{ */ -/* Operator functions. */ bool sequencer_edit_poll(bContext *C) { return (SEQ_editing_get(CTX_data_scene(C)) != NULL); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index d6360be8693..cb33c648b0a 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -61,11 +61,19 @@ void color3ubv_from_seq(const struct Scene *curscene, uchar r_col[3]); void sequencer_special_update_set(Sequence *seq); +/* Get handle width in 2d-View space. */ float sequence_handle_size_get_clamped(struct Sequence *seq, const float pixelx); /* UNUSED */ /* void seq_reset_imageofs(struct SpaceSeq *sseq); */ +/** + * Rendering using opengl will change the current viewport/context. + * This is why we need the \a region, to set back the render area. + * + * TODO: do not rely on such hack and just update the \a ibuf outside of + * the UI drawing code. + */ struct ImBuf *sequencer_ibuf_get(struct Main *bmain, struct ARegion *region, struct Depsgraph *depsgraph, diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index f6f8e45590f..b93f421ff5c 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -1005,7 +1005,6 @@ static void sequencer_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_ /* ************************************* */ -/* Only called once, from space/spacetypes.c. */ void ED_spacetype_sequencer(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer"); diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc index 7f43b7afb88..173ef43bfb6 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc @@ -393,9 +393,6 @@ static void get_selected_indices_on_domain(const Mesh &mesh, } } -/** - * Only data sets corresponding to mesh objects in edit mode currently support selection filtering. - */ bool GeometryDataSource::has_selection_filter() const { Object *object_orig = DEG_get_original_object(object_eval_); diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh index 5ec3eab4d66..23207734d2b 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.hh @@ -82,6 +82,10 @@ class GeometryDataSource : public DataSource { return object_eval_; } + /** + * Only data sets corresponding to mesh objects in edit mode currently support selection + * filtering. + */ bool has_selection_filter() const override; void apply_selection_filter(MutableSpan<bool> rows_included) const; diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c index bf2a5534e0b..91a85e4c4b0 100644 --- a/source/blender/editors/space_statusbar/space_statusbar.c +++ b/source/blender/editors/space_statusbar/space_statusbar.c @@ -144,7 +144,6 @@ static void statusbar_header_region_message_subscribe(const wmRegionMessageSubsc WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw); } -/* only called once, from space/spacetypes.c */ void ED_spacetype_statusbar(void) { SpaceType *st = MEM_callocN(sizeof(*st), "spacetype statusbar"); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index f8dc61f18f2..f449ce50ae3 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -417,7 +417,6 @@ static void text_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, I /********************* registration ********************/ -/* only called once, from space/spacetypes.c */ void ED_spacetype_text(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype text"); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 589a8859eeb..8fb55ed9b46 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -200,7 +200,6 @@ int wrap_width(const SpaceText *st, ARegion *region) return max > 8 ? max : 8; } -/* Sets (offl, offc) for transforming (line, curs) to its wrapped position */ void wrap_offset( const SpaceText *st, ARegion *region, TextLine *linein, int cursin, int *offl, int *offc) { @@ -305,7 +304,6 @@ void wrap_offset( } } -/* cursin - mem, offc - view */ void wrap_offset_in_line( const SpaceText *st, ARegion *region, TextLine *linein, int cursin, int *offl, int *offc) { @@ -1754,8 +1752,6 @@ bool ED_text_activate_in_screen(bContext *C, Text *text) return false; } -/* Moves the view to the cursor location, - * also used to make sure the view isn't outside the file */ void ED_text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center) { Text *text; @@ -1823,7 +1819,6 @@ void ED_text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center) st->runtime.scroll_ofs_px[1] = 0; } -/* takes an area instead of a region, use for listeners */ void text_scroll_to_cursor__area(SpaceText *st, ScrArea *area, const bool center) { ARegion *region; @@ -1847,9 +1842,6 @@ void text_update_cursor_moved(bContext *C) text_scroll_to_cursor__area(st, area, true); } -/** - * Takes a cursor (row, character) and returns x,y pixel coords. - */ bool ED_text_region_location_from_cursor(SpaceText *st, ARegion *region, const int cursor_co[2], diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c index 66765206fa6..cf0a7c089b5 100644 --- a/source/blender/editors/space_text/text_format.c +++ b/source/blender/editors/space_text/text_format.c @@ -111,7 +111,6 @@ void flatten_string_free(FlattenString *fs) } } -/* takes a string within fs->buf and returns its length */ int flatten_string_strlen(FlattenString *fs, const char *str) { const int len = (fs->pos - (int)(str - fs->buf)) - 1; @@ -119,8 +118,6 @@ int flatten_string_strlen(FlattenString *fs, const char *str) return len; } -/* Ensures the format string for the given line is long enough, reallocating - * as needed. Allocation is done here, alone, to ensure consistency. */ int text_check_format_len(TextLine *line, uint len) { if (line->format) { @@ -142,12 +139,6 @@ int text_check_format_len(TextLine *line, uint len) return 1; } -/** - * Fill the string with formatting constant, - * advancing \a str_p and \a fmt_p - * - * \param len: length in bytes of \a fmt_p to fill. - */ void text_format_fill(const char **str_p, char **fmt_p, const char type, const int len) { const char *str = *str_p; @@ -170,10 +161,6 @@ void text_format_fill(const char **str_p, char **fmt_p, const char type, const i *str_p = str; *fmt_p = fmt; } -/** - * ascii version of #text_format_fill, - * use when we no the text being stepped over is ascii (as is the case for most keywords) - */ void text_format_fill_ascii(const char **str_p, char **fmt_p, const char type, const int len) { const char *str = *str_p; diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h index fe7b3328030..01c40b4ed22 100644 --- a/source/blender/editors/space_text/text_format.h +++ b/source/blender/editors/space_text/text_format.h @@ -33,7 +33,9 @@ typedef struct FlattenString { int pos, len; } FlattenString; -/* format continuation flags (stored just after the NULL terminator) */ +/** + * Format continuation flags (stored just after the NULL terminator). + */ enum { FMT_CONT_NOP = 0, /* no continuation */ FMT_CONT_QUOTESINGLE = (1 << 0), /* single quotes */ @@ -48,10 +50,27 @@ enum { int flatten_string(const struct SpaceText *st, FlattenString *fs, const char *in); void flatten_string_free(FlattenString *fs); +/** + * Takes a string within `fs->buf` and returns its length. + */ int flatten_string_strlen(FlattenString *fs, const char *str); +/** + * Ensures the format string for the given line is long enough, reallocating + * as needed. Allocation is done here, alone, to ensure consistency. + */ int text_check_format_len(TextLine *line, unsigned int len); +/** + * Fill the string with formatting constant, + * advancing \a str_p and \a fmt_p + * + * \param len: length in bytes of \a fmt_p to fill. + */ void text_format_fill(const char **str_p, char **fmt_p, const char type, const int len); +/** + * ASCII version of #text_format_fill, + * use when we no the text being stepped over is ascii (as is the case for most keywords) + */ void text_format_fill_ascii(const char **str_p, char **fmt_p, const char type, const int len); /* *** Generalize Formatting *** */ diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 241e0133a8a..3cae4188932 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -39,6 +39,9 @@ void draw_text_main(struct SpaceText *st, struct ARegion *region); void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); void text_update_character_width(struct SpaceText *st); +/** + * Takes an area instead of a region, use for listeners. + */ void text_scroll_to_cursor__area(struct SpaceText *st, struct ScrArea *area, const bool center); void text_update_cursor_moved(struct bContext *C); @@ -73,12 +76,18 @@ void text_update_cursor_moved(struct bContext *C); #define TOOL_DOCUMENT 0x02 int wrap_width(const struct SpaceText *st, struct ARegion *region); +/** + * Sets (offl, offc) for transforming (line, curs) to its wrapped position. + */ void wrap_offset(const struct SpaceText *st, struct ARegion *region, struct TextLine *linein, int cursin, int *offl, int *offc); +/** + * cursin - mem, offc - view. + */ void wrap_offset_in_line(const struct SpaceText *st, struct ARegion *region, struct TextLine *linein, diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index 80af7d8c9f6..3e40593d40e 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -252,8 +252,6 @@ static void text_undosys_foreach_ID_ref(UndoStep *us_p, foreach_ID_ref_fn(user_data, ((UndoRefID *)&us->text_ref)); } -/* Export for ED_undo_sys. */ - void ED_text_undosys_type(UndoType *ut) { ut->name = "Text"; @@ -276,7 +274,6 @@ void ED_text_undosys_type(UndoType *ut) /** \name Utilities * \{ */ -/* Use operator system to finish the undo step. */ UndoStep *ED_text_undo_push_init(bContext *C) { UndoStack *ustack = ED_undo_stack_get(); diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index 419721cf89e..41eddd32854 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -236,7 +236,6 @@ static void recent_files_menu_register(void) WM_menutype_add(mt); } -/* only called once, from space/spacetypes.c */ void ED_spacetype_topbar(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype topbar"); diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index ceba8ca268d..1711188fca7 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -199,7 +199,6 @@ static void userpref_execute_region_listener(const wmRegionListenerParams *UNUSE { } -/* only called once, from space/spacetypes.c */ void ED_spacetype_userpref(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype userpref"); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index e54ef3c931a..6cc15c638a2 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -91,7 +91,6 @@ /* ******************** manage regions ********************* */ -/* function to always find a regionview3d context inside 3D window */ RegionView3D *ED_view3d_context_rv3d(bContext *C) { RegionView3D *rv3d = CTX_wm_region_view3d(C); @@ -108,8 +107,6 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C) return rv3d; } -/* ideally would return an rv3d but in some cases the region is needed too - * so return that, the caller can then access the region->regiondata */ bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_region) { ScrArea *area = CTX_wm_area(C); @@ -140,10 +137,6 @@ bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_regi return false; } -/** - * Similar to #ED_view3d_context_user_region() but does not use context. Always performs a lookup. - * Also works if \a v3d is not the active space. - */ bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion **r_region) { RegionView3D *rv3d = NULL; @@ -182,17 +175,6 @@ bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion return false; } -/* Most of the time this isn't needed since you could assume the view matrix was - * set while drawing, however when functions like mesh_foreachScreenVert are - * called by selection tools, we can't be sure this object was the last. - * - * for example, transparent objects are drawn after editmode and will cause - * the rv3d mat's to change and break selection. - * - * 'ED_view3d_init_mats_rv3d' should be called before - * view3d_project_short_clip and view3d_project_short_noclip in cases where - * these functions are not used during draw_object - */ void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d) { /* local viewmat and persmat, to calculate projections */ @@ -214,7 +196,6 @@ void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *r } #ifdef DEBUG -/* ensure we correctly initialize */ void ED_view3d_clear_mats_rv3d(struct RegionView3D *rv3d) { zero_m4(rv3d->viewmatob); @@ -1878,7 +1859,6 @@ static void view3d_id_remap(ScrArea *area, SpaceLink *slink, ID *old_id, ID *new } } -/* only called once, from space/spacetypes.c */ void ED_spacetype_view3d(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype view3d"); diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c index 8380c87b999..535a65c8f0c 100644 --- a/source/blender/editors/space_view3d/view3d_camera_control.c +++ b/source/blender/editors/space_view3d/view3d_camera_control.c @@ -102,9 +102,6 @@ BLI_INLINE Object *view3d_cameracontrol_object(const View3DCameraControl *vctrl) return vctrl->root_parent ? vctrl->root_parent : vctrl->ctx_v3d->camera; } -/** - * Returns the object which is being manipulated or NULL. - */ Object *ED_view3d_cameracontrol_object_get(View3DCameraControl *vctrl) { RegionView3D *rv3d = vctrl->ctx_rv3d; @@ -116,10 +113,6 @@ Object *ED_view3d_cameracontrol_object_get(View3DCameraControl *vctrl) return NULL; } -/** - * Creates a #View3DCameraControl handle and sets up - * the view for first-person style navigation. - */ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph, Scene *scene, View3D *v3d, @@ -243,9 +236,6 @@ static bool object_apply_mat4_with_protect(Object *ob, return view_changed; } -/** - * Updates cameras from the `rv3d` values, optionally auto-keyframing. - */ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl, /* args for keyframing */ const bool use_autokey, @@ -317,12 +307,6 @@ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl, } } -/** - * Release view control. - * - * \param restore: Sets the view state to the values that were set - * before #ED_view3d_control_acquire was called. - */ void ED_view3d_cameracontrol_release(View3DCameraControl *vctrl, const bool restore) { View3D *v3d = vctrl->ctx_v3d; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 5639a498d8a..a7d170982ed 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -108,9 +108,6 @@ /** \name General Functions * \{ */ -/** - * \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore - */ void ED_view3d_update_viewmat(Depsgraph *depsgraph, const Scene *scene, View3D *v3d, @@ -355,9 +352,6 @@ static void view3d_xr_mirror_setup(const wmWindowManager *wm, } #endif /* WITH_XR_OPENXR */ -/** - * Set the correct matrices - */ void ED_view3d_draw_setup_view(const wmWindowManager *wm, wmWindow *win, Depsgraph *depsgraph, @@ -848,7 +842,6 @@ static void drawrenderborder(ARegion *region, View3D *v3d) /** \name Other Elements * \{ */ -/** could move this elsewhere, but tied into #ED_view3d_grid_scale */ float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit) { /* apply units */ @@ -921,9 +914,6 @@ void ED_view3d_grid_steps(const Scene *scene, } } -/* Simulates the grid scale that is actually viewed. - * The actual code is seen in `object_grid_frag.glsl` (see `grid_res`). - * Currently the simulation is only done when RV3D_VIEW_IS_AXIS. */ float ED_view3d_grid_view_scale(Scene *scene, View3D *v3d, ARegion *region, @@ -1472,9 +1462,6 @@ static void draw_grid_unit_name( } } -/** - * Information drawn on top of the solid plates and composed data - */ void view3d_draw_region_info(const bContext *C, ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -1751,10 +1738,6 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph, G.f &= ~G_FLAG_RENDER_VIEWPORT; } -/** - * Creates own fake 3d views (wrapping #ED_view3d_draw_offscreen). Similar too - * #ED_view_draw_offscreen_imbuf_simple, but takes view/projection matrices as arguments. - */ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, @@ -1853,12 +1836,6 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph, viewport); } -/** - * Utility func for ED_view3d_draw_offscreen - * - * \param ofs: Optional off-screen buffer, can be NULL. - * (avoids re-creating when doing multiple GL renders). - */ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, Scene *scene, eDrawType drawtype, @@ -2008,14 +1985,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, return ibuf; } -/** - * Creates own fake 3d views (wrapping #ED_view3d_draw_offscreen_imbuf) - * - * \param ofs: Optional off-screen buffer can be NULL. - * (avoids re-creating when doing multiple GL renders). - * - * \note used by the sequencer - */ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, @@ -2146,15 +2115,6 @@ static bool view3d_clipping_test(const float co[3], const float clip[6][4]) return true; } -/** - * Return true when `co` is hidden by the 3D views clipping planes. - * - * \param local: When true use local (object-space) #ED_view3d_clipping_local must run first, - * then all comparisons can be done in local-space. - * \return True when `co` is outside all clipping planes. - * - * \note Callers should check #RV3D_CLIPPING_ENABLED first. - */ bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local) { return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip); @@ -2240,10 +2200,6 @@ void ED_view3d_select_id_validate(ViewContext *vc) validate_object_select_id(vc->depsgraph, vc->view_layer, vc->region, vc->v3d, vc->obact); } -/** - * allow for small values [0.5 - 2.5], - * and large values, FLT_MAX by clamping by the area size - */ int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist) { return (int)min_ff(ceilf(dist), (float)max_ii(region->winx, region->winx)); @@ -2320,7 +2276,6 @@ static ViewDepths *view3d_depths_create(ARegion *region) return d; } -/* Utility function to find the closest Z value, use for auto-depth. */ float view3d_depth_near(ViewDepths *d) { /* Convert to float for comparisons. */ @@ -2344,14 +2299,6 @@ float view3d_depth_near(ViewDepths *d) return far == far_real ? FLT_MAX : far; } -/** - * Redraw the viewport depth buffer. - * - * \param mode: V3D_DEPTH_NO_GPENCIL - Redraw viewport without Grease Pencil and Annotations. - * V3D_DEPTH_GPENCIL_ONLY - Redraw viewport with Grease Pencil and Annotations only. - * V3D_DEPTH_OBJECT_ONLY - Redraw viewport with active object only. - * \param update_cache: If true, store the entire depth buffer in #rv3d->depths. - */ void ED_view3d_depth_override(Depsgraph *depsgraph, ARegion *region, View3D *v3d, @@ -2466,7 +2413,6 @@ void ED_view3d_datamask(const bContext *C, } } -/* Goes over all modes and view3d settings. */ void ED_view3d_screen_datamask(const bContext *C, const Scene *scene, const bScreen *screen, @@ -2536,10 +2482,6 @@ void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixSto /** \name FPS Drawing * \{ */ -/** - * \note The info that this uses is updated in #ED_refresh_viewport_fps, - * which currently gets called during #SCREEN_OT_animation_step. - */ void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset) { ScreenFrameRateInfo *fpsi = scene->fps_info; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 34baf68ccdd..830f7cbeff1 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -618,7 +618,6 @@ enum { VIEWROT_MODAL_SWITCH_ROTATE = 6, }; -/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewrotate_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -1250,9 +1249,6 @@ static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, } } -/** - * Called from both fly mode and walk mode, - */ void view3d_ndof_fly(const wmNDOFMotionData *ndof, View3D *v3d, RegionView3D *rv3d, @@ -1685,7 +1681,6 @@ void VIEW3D_OT_ndof_all(struct wmOperatorType *ot) /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ -/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewmove_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -1882,7 +1877,6 @@ void VIEW3D_OT_move(wmOperatorType *ot) * \{ */ /* #viewdolly_modal_keymap has an exact copy of this, apply fixes to both. */ -/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewzoom_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -2446,7 +2440,6 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) * \{ */ /* This is an exact copy of #viewzoom_modal_keymap. */ -/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewdolly_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -5027,7 +5020,6 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) * \{ */ /* cursor position in vec, result in vec, mval in region coords */ -/* NOTE: cannot use `event->mval` here, called by #object_add(). */ void ED_view3d_cursor3d_position(bContext *C, const int mval[2], const bool use_depth, diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index a21fc006b02..7388004125c 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -91,7 +91,13 @@ void VIEW3D_OT_zoom_border(struct wmOperatorType *ot); void VIEW3D_OT_toggle_shading(struct wmOperatorType *ot); void VIEW3D_OT_toggle_xray(struct wmOperatorType *ot); +/** + * For home, center etc. + */ void view3d_boxview_copy(struct ScrArea *area, struct ARegion *region); +/** + * Sync center/zoom view of region to others, for view transforms. + */ void view3d_boxview_sync(struct ScrArea *area, struct ARegion *region); void view3d_orbit_apply_dyn_ofs(float r_ofs[3], @@ -103,6 +109,9 @@ void view3d_orbit_apply_dyn_ofs(float r_ofs[3], #ifdef WITH_INPUT_NDOF struct wmNDOFMotionData; +/** + * Called from both fly mode and walk mode, + */ void view3d_ndof_fly(const struct wmNDOFMotionData *ndof, struct View3D *v3d, struct RegionView3D *rv3d, @@ -113,17 +122,24 @@ void view3d_ndof_fly(const struct wmNDOFMotionData *ndof, #endif /* WITH_INPUT_NDOF */ /* view3d_navigate_fly.c */ + void view3d_keymap(struct wmKeyConfig *keyconf); void VIEW3D_OT_fly(struct wmOperatorType *ot); /* view3d_navigate_walk.c */ + void VIEW3D_OT_walk(struct wmOperatorType *ot); /* view3d_draw.c */ + void view3d_main_region_draw(const struct bContext *C, struct ARegion *region); +/** + * Information drawn on top of the solid plates and composed data. + */ void view3d_draw_region_info(const struct bContext *C, struct ARegion *region); /* view3d_draw_legacy.c */ + void ED_view3d_draw_select_loop(struct Depsgraph *depsgraph, ViewContext *vc, Scene *scene, @@ -139,6 +155,9 @@ void ED_view3d_draw_depth_loop(struct Depsgraph *depsgraph, View3D *v3d); void view3d_depths_rect_create(struct ARegion *region, struct rcti *rect, struct ViewDepths *r_d); +/** + * Utility function to find the closest Z value, use for auto-depth. + */ float view3d_depth_near(struct ViewDepths *d); /* view3d_select.c */ @@ -175,6 +194,9 @@ typedef struct V3D_SmoothParams { const float *dyn_ofs; } V3D_SmoothParams; +/** + * The arguments are the desired situation. + */ void ED_view3d_smooth_view_ex(const struct Depsgraph *depsgraph, struct wmWindowManager *wm, struct wmWindow *win, @@ -190,20 +212,41 @@ void ED_view3d_smooth_view(struct bContext *C, const int smooth_viewtx, const V3D_SmoothParams *sview); +/** + * Apply the smooth-view immediately, use when we need to start a new view operation. + * (so we don't end up half-applying a view operation when pressing keys quickly). + */ void ED_view3d_smooth_view_force_finish(struct bContext *C, struct View3D *v3d, struct ARegion *region); +/** + * \param rect: optional for picking (can be NULL). + */ void view3d_winmatrix_set(struct Depsgraph *depsgraph, struct ARegion *region, const View3D *v3d, const rcti *rect); +/** + * Sets #RegionView3D.viewmat + * + * \param depsgraph: Depsgraph. + * \param scene: Scene for camera and cursor location. + * \param v3d: View 3D space data. + * \param rv3d: 3D region which stores the final matrices. + * \param rect_scale: Optional 2D scale argument, + * Use when displaying a sub-region, eg: when #view3d_winmatrix_set takes a 'rect' argument. + * + * \note don't set windows active in here, is used by renderwin too. + */ void view3d_viewmatrix_set(struct Depsgraph *depsgraph, const struct Scene *scene, const View3D *v3d, RegionView3D *rv3d, const float rect_scale[2]); +/* Called in transform_ops.c, on each regeneration of key-maps. */ + void fly_modal_keymap(struct wmKeyConfig *keyconf); void walk_modal_keymap(struct wmKeyConfig *keyconf); void viewrotate_modal_keymap(struct wmKeyConfig *keyconf); @@ -213,23 +256,46 @@ void viewdolly_modal_keymap(struct wmKeyConfig *keyconf); void viewplace_modal_keymap(struct wmKeyConfig *keyconf); /* view3d_buttons.c */ + void VIEW3D_OT_object_mode_pie_or_toggle(struct wmOperatorType *ot); void view3d_buttons_register(struct ARegionType *art); /* view3d_camera_control.c */ + +/** + * Creates a #View3DCameraControl handle and sets up + * the view for first-person style navigation. + */ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(struct Depsgraph *depsgraph, Scene *scene, View3D *v3d, RegionView3D *rv3d); +/** + * Updates cameras from the `rv3d` values, optionally auto-keyframing. + */ void ED_view3d_cameracontrol_update(struct View3DCameraControl *vctrl, const bool use_autokey, struct bContext *C, const bool do_rotate, const bool do_translate); +/** + * Release view control. + * + * \param restore: Sets the view state to the values that were set + * before #ED_view3d_control_acquire was called. + */ void ED_view3d_cameracontrol_release(struct View3DCameraControl *vctrl, const bool restore); +/** + * Returns the object which is being manipulated or NULL. + */ struct Object *ED_view3d_cameracontrol_object_get(struct View3DCameraControl *vctrl); /* view3d_snap.c */ + +/** + * Calculates the bounding box corners (min and max) for \a obedit. + * The returned values are in global space. + */ bool ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]); void VIEW3D_OT_snap_selected_to_grid(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 20e00356152..16d9b9182cf 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -486,10 +486,6 @@ static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *userData, data->func(data->userData, eed, screen_co_a, screen_co_b, index); } -/** - * A version of #mesh_foreachScreenEdge that clips the segment when - * there is a clipping bounding box. - */ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc, void (*func)(void *userData, BMEdge *eed, @@ -691,7 +687,6 @@ void nurbs_foreachScreenVert(ViewContext *vc, /** \name Edit-Meta: For Each Screen Meta-Element * \{ */ -/* ED_view3d_init_mats_rv3d must be called first */ void mball_foreachScreenElem(struct ViewContext *vc, void (*func)(void *userData, struct MetaElem *ml, @@ -756,7 +751,6 @@ void lattice_foreachScreenVert(ViewContext *vc, /** \name Edit-Armature: For Each Screen Bone * \{ */ -/* ED_view3d_init_mats_rv3d must be called first */ void armature_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct EditBone *ebone, @@ -824,8 +818,6 @@ void armature_foreachScreenBone(struct ViewContext *vc, /** \name Pose: For Each Screen Bone * \{ */ -/* ED_view3d_init_mats_rv3d must be called first */ -/* almost _exact_ copy of #armature_foreachScreenBone */ void pose_foreachScreenBone(struct ViewContext *vc, void (*func)(void *userData, struct bPoseChannel *pchan, @@ -834,6 +826,8 @@ void pose_foreachScreenBone(struct ViewContext *vc, void *userData, const eV3DProjTest clip_flag) { + /* Almost _exact_ copy of #armature_foreachScreenBone */ + const Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact); const bArmature *arm_eval = ob_eval->data; bPose *pose = vc->obact->pose; diff --git a/source/blender/editors/space_view3d/view3d_navigate_fly.c b/source/blender/editors/space_view3d/view3d_navigate_fly.c index f48e436e014..2e9cb419e2e 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_fly.c +++ b/source/blender/editors/space_view3d/view3d_navigate_fly.c @@ -101,7 +101,6 @@ typedef enum eFlyPanState { FLY_AXISLOCK_STATE_ACTIVE = 2, } eFlyPanState; -/* Called in transform_ops.c, on each regeneration of key-maps. */ void fly_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/space_view3d/view3d_navigate_walk.c b/source/blender/editors/space_view3d/view3d_navigate_walk.c index 83b8c04acb6..ed76b10c95a 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_walk.c +++ b/source/blender/editors/space_view3d/view3d_navigate_walk.c @@ -142,7 +142,6 @@ typedef enum eWalkLockState { WALK_AXISLOCK_STATE_DONE = 3, } eWalkLockState; -/* Called in transform_ops.c, on each regeneration of key-maps. */ void walk_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 88efc530484..8c2e0df0275 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -43,9 +43,6 @@ /* Non Clipping Projection Functions * ********************************* */ -/** - * \note use #ED_view3d_ob_project_mat_get to get the projection matrix - */ void ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], float r_co[2], @@ -68,9 +65,6 @@ void ED_view3d_project_float_v2_m4(const ARegion *region, } } -/** - * \note use #ED_view3d_ob_project_mat_get to get projecting mat - */ void ED_view3d_project_float_v3_m4(const ARegion *region, const float co[3], float r_co[3], @@ -231,7 +225,6 @@ eV3DProjStatus ED_view3d_project_float_ex(const ARegion *region, return ret; } -/* --- short --- */ eV3DProjStatus ED_view3d_project_short_global(const ARegion *region, const float co[3], short r_co[2], @@ -240,7 +233,6 @@ eV3DProjStatus ED_view3d_project_short_global(const ARegion *region, RegionView3D *rv3d = region->regiondata; return ED_view3d_project_short_ex(region, rv3d->persmat, false, co, r_co, flag); } -/* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_short_object(const ARegion *region, const float co[3], short r_co[2], @@ -251,7 +243,6 @@ eV3DProjStatus ED_view3d_project_short_object(const ARegion *region, return ED_view3d_project_short_ex(region, rv3d->persmatob, true, co, r_co, flag); } -/* --- int --- */ eV3DProjStatus ED_view3d_project_int_global(const ARegion *region, const float co[3], int r_co[2], @@ -260,7 +251,6 @@ eV3DProjStatus ED_view3d_project_int_global(const ARegion *region, RegionView3D *rv3d = region->regiondata; return ED_view3d_project_int_ex(region, rv3d->persmat, false, co, r_co, flag); } -/* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_int_object(const ARegion *region, const float co[3], int r_co[2], @@ -271,7 +261,6 @@ eV3DProjStatus ED_view3d_project_int_object(const ARegion *region, return ED_view3d_project_int_ex(region, rv3d->persmatob, true, co, r_co, flag); } -/* --- float --- */ eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, const float co[3], float r_co[2], @@ -280,7 +269,6 @@ eV3DProjStatus ED_view3d_project_float_global(const ARegion *region, RegionView3D *rv3d = region->regiondata; return ED_view3d_project_float_ex(region, rv3d->persmat, false, co, r_co, flag); } -/* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_float_object(const ARegion *region, const float co[3], float r_co[2], @@ -304,9 +292,6 @@ float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[ return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize; } -/** - * Calculate a depth value from \a co, use with #ED_view3d_win_to_delta - */ float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_flip) { float zfac = mul_project_m4_v3_zfac(rv3d->persmat, co); @@ -330,9 +315,6 @@ float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_f return zfac; } -/** - * Calculate a depth value from `co` (result should only be used for comparison). - */ float ED_view3d_calc_depth_for_comparison(const RegionView3D *rv3d, const float co[3]) { if (rv3d->is_persp) { @@ -388,22 +370,6 @@ bool ED_view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float return true; } -/** - * Calculate a 3d viewpoint and direction vector from 2d window coordinates. - * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. - * ray_start is clipped by the view near limit so points in front of it are always in view. - * In orthographic view the resulting ray_normal will match the view vector. - * This version also returns the ray_co point of the ray on window plane, useful to fix precision - * issues esp. with ortho view, where default ray_start is set rather far away. - * \param region: The region (used for the window width and height). - * \param v3d: The 3d viewport (used for near clipping value). - * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). - * \param r_ray_co: The world-space point where the ray intersects the window plane. - * \param r_ray_normal: The normalized world-space direction of towards mval. - * \param r_ray_start: The world-space starting point of the ray. - * \param do_clip_planes: Optionally clip the start of the ray by the view clipping planes. - * \return success, false if the ray is totally clipped. - */ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, @@ -426,19 +392,6 @@ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph, return true; } -/** - * Calculate a 3d viewpoint and direction vector from 2d window coordinates. - * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. - * ray_start is clipped by the view near limit so points in front of it are always in view. - * In orthographic view the resulting ray_normal will match the view vector. - * \param region: The region (used for the window width and height). - * \param v3d: The 3d viewport (used for near clipping value). - * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). - * \param r_ray_start: The world-space point where the ray intersects the window plane. - * \param r_ray_normal: The normalized world-space direction of towards mval. - * \param do_clip_planes: Optionally clip the start of the ray by the view clipping planes. - * \return success, false if the ray is totally clipped. - */ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, @@ -451,17 +404,6 @@ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph, depsgraph, region, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip_planes); } -/** - * Calculate a 3d viewpoint and direction vector from 2d window coordinates. - * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. - * \param region: The region (used for the window width and height). - * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). - * \param r_ray_start: The world-space point where the ray intersects the window plane. - * \param r_ray_normal: The normalized world-space direction of towards mval. - * - * \note Ignores view near/far clipping, - * to take this into account use #ED_view3d_win_to_ray_clipped. - */ void ED_view3d_win_to_ray(const ARegion *region, const float mval[2], float r_ray_start[3], @@ -471,13 +413,6 @@ void ED_view3d_win_to_ray(const ARegion *region, ED_view3d_win_to_vector(region, mval, r_ray_normal); } -/** - * Calculate a normalized 3d direction vector from the viewpoint towards a global location. - * In orthographic view the resulting vector will match the view vector. - * \param rv3d: The region (used for the window width and height). - * \param coord: The world-space location. - * \param vec: The resulting normalized vector. - */ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3], float vec[3]) { if (rv3d->is_persp) { @@ -536,13 +471,6 @@ bool view3d_get_view_aligned_coordinate(ARegion *region, } #endif -/** - * Calculate a 3d location from 2d window coordinates. - * \param region: The region (used for the window width and height). - * \param depth_pt: The reference location used to calculate the Z depth. - * \param mval: The area relative location (such as event->mval converted to floats). - * \param r_out: The resulting world-space location. - */ void ED_view3d_win_to_3d(const View3D *v3d, const ARegion *region, const float depth_pt[3], @@ -636,13 +564,6 @@ bool ED_view3d_win_to_3d_on_plane_int(const ARegion *region, return ED_view3d_win_to_3d_on_plane(region, plane, mval_fl, do_clip, r_out); } -/** - * A wrapper for #ED_view3d_win_to_3d_on_plane that projects onto \a plane_fallback - * then maps this back to \a plane. - * - * This is intended to be used when \a plane is orthogonal to the views Z axis where - * projecting the \a mval doesn't work well (or fail completely when exactly aligned). - */ bool ED_view3d_win_to_3d_on_plane_with_fallback(const ARegion *region, const float plane[4], const float mval[2], @@ -678,14 +599,6 @@ bool ED_view3d_win_to_3d_on_plane_with_fallback(const ARegion *region, return true; } -/** - * Calculate a 3d difference vector from 2d window offset. - * note that #ED_view3d_calc_zfac() must be called first to determine - * the depth used to calculate the delta. - * \param region: The region (used for the window width and height). - * \param mval: The area relative 2d difference (such as event->mval[0] - other_x). - * \param out: The resulting world-space delta. - */ void ED_view3d_win_to_delta(const ARegion *region, const float mval[2], float out[3], @@ -702,16 +615,6 @@ void ED_view3d_win_to_delta(const ARegion *region, out[2] = (rv3d->persinv[0][2] * dx + rv3d->persinv[1][2] * dy); } -/** - * Calculate a 3d origin from 2d window coordinates. - * \note Orthographic views have a less obvious origin, - * Since far clip can be a very large value resulting in numeric precision issues, - * the origin in this case is close to zero coordinate. - * - * \param region: The region (used for the window width and height). - * \param mval: The area relative 2d location (such as event->mval converted to floats). - * \param out: The resulting normalized world-space direction vector. - */ void ED_view3d_win_to_origin(const ARegion *region, const float mval[2], float out[3]) { RegionView3D *rv3d = region->regiondata; @@ -733,19 +636,6 @@ void ED_view3d_win_to_origin(const ARegion *region, const float mval[2], float o } } -/** - * Calculate a 3d direction vector from 2d window coordinates. - * This direction vector starts and the view in the direction of the 2d window coordinates. - * In orthographic view all window coordinates yield the same vector. - * - * \note doesn't rely on ED_view3d_calc_zfac - * for perspective view, get the vector direction to - * the mouse cursor as a normalized vector. - * - * \param region: The region (used for the window width and height). - * \param mval: The area relative 2d location (such as event->mval converted to floats). - * \param out: The resulting normalized world-space direction vector. - */ void ED_view3d_win_to_vector(const ARegion *region, const float mval[2], float out[3]) { RegionView3D *rv3d = region->regiondata; @@ -763,20 +653,6 @@ void ED_view3d_win_to_vector(const ARegion *region, const float mval[2], float o normalize_v3(out); } -/** - * Calculate a 3d segment from 2d window coordinates. - * This ray_start is located at the viewpoint, ray_end is a far point. - * ray_start and ray_end are clipped by the view near and far limits - * so points along this line are always in view. - * In orthographic view all resulting segments will be parallel. - * \param region: The region (used for the window width and height). - * \param v3d: The 3d viewport (used for near and far clipping range). - * \param mval: The area relative 2d location (such as event->mval, converted into float[2]). - * \param r_ray_start: The world-space starting point of the segment. - * \param r_ray_end: The world-space end point of the segment. - * \param do_clip_planes: Optionally clip the ray by the view clipping planes. - * \return success, false if the segment is totally clipped. - */ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, const ARegion *region, View3D *v3d, @@ -817,9 +693,6 @@ void ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d, mul_m4_m4m4(r_pmat, rv3d->winmat, vmat); } -/** - * Convert between region relative coordinates (x,y) and depth component z and - * a point in world space. */ void ED_view3d_project_v3(const struct ARegion *region, const float world[3], float r_region_co[3]) { /* Viewport is set up to make coordinates relative to the region, not window. */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 8d441b08205..cc8aac21a6e 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -119,9 +119,10 @@ float ED_view3d_select_dist_px(void) return 75.0f * U.pixelsize; } -/* TODO: should return whether there is valid context to continue */ void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc, Depsgraph *depsgraph) { + /* TODO: should return whether there is valid context to continue. */ + memset(vc, 0, sizeof(ViewContext)); vc->C = C; vc->region = CTX_wm_region(C); @@ -2195,7 +2196,6 @@ static Base *ed_view3d_give_base_under_cursor_ex(bContext *C, return basact; } -/* mval comes from event->mval, only use within region handlers */ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2]) { return ed_view3d_give_base_under_cursor_ex(C, mval, NULL); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 583a9ad75c2..53bd181f544 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -1013,10 +1013,6 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot) /** \name Min/Max Object Vertices Utility * \{ */ -/** - * Calculates the bounding box corners (min and max) for \a obedit. - * The returned values are in global space. - */ bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3]) { TransVertStore tvs = {NULL}; diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index f01955a6468..8b75ce63cde 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -122,9 +122,6 @@ void ED_view3d_dist_range_get(const View3D *v3d, float r_dist_range[2]) r_dist_range[1] = v3d->clip_end * 10.0f; } -/** - * \note copies logic of #ED_view3d_viewplane_get(), keep in sync. - */ bool ED_view3d_clip_range_get(Depsgraph *depsgraph, const View3D *v3d, const RegionView3D *rv3d, @@ -191,10 +188,6 @@ bool ED_view3d_viewplane_get(Depsgraph *depsgraph, /** \name View State/Context Utilities * \{ */ -/** - * Use this call when executing an operator, - * event system doesn't set for each event the OpenGL drawing context. - */ void view3d_operator_needs_opengl(const bContext *C) { wmWindow *win = CTX_wm_window(C); @@ -218,9 +211,6 @@ void view3d_region_operator_needs_opengl(wmWindow *UNUSED(win), ARegion *region) } } -/** - * Use instead of: `GPU_polygon_offset(rv3d->dist, ...)` see bug T37727. - */ void ED_view3d_polygon_offset(const RegionView3D *rv3d, const float dist) { if (rv3d->rflag & RV3D_ZOFFSET_DISABLED) { @@ -339,18 +329,6 @@ static void points_in_planes_minmax_fn( minmax_v3v3_v3(user_data->min, user_data->max, co); } -/** - * Clamp min/max by the viewport clipping. - * - * \note This is an approximation, with the limitation that the bounding box from the (mix, max) - * calculation might not have any geometry inside the clipped region. - * Performing a clipping test on each vertex would work well enough for most cases, - * although it's not perfect either as edges/faces may intersect the clipping without having any - * of their vertices inside it. - * A more accurate result would be quite involved. - * - * \return True when the arguments were clamped. - */ bool ED_view3d_clipping_clamp_minmax(const RegionView3D *rv3d, float min[3], float max[3]) { /* 6 planes for the cube, 4..6 for the current view clipping planes. */ @@ -481,9 +459,6 @@ bool ED_view3d_offset_lock_check(const View3D *v3d, const RegionView3D *rv3d) return (rv3d->persp != RV3D_CAMOB) && (v3d->ob_center_cursor || v3d->ob_center); } -/** - * Use to store the last view, before entering camera view. - */ void ED_view3d_lastview_store(RegionView3D *rv3d) { copy_qt_qt(rv3d->lviewquat, rv3d->viewquat); @@ -503,13 +478,6 @@ void ED_view3d_lock_clear(View3D *v3d) v3d->flag2 &= ~V3D_LOCK_CAMERA; } -/** - * For viewport operators that exit camera perspective. - * - * \note This differs from simply setting `rv3d->persp = persp` because it - * sets the `ofs` and `dist` values of the viewport so it matches the camera, - * otherwise switching out of camera view may jump to a different part of the scene. - */ void ED_view3d_persp_switch_from_camera(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d, @@ -528,12 +496,6 @@ void ED_view3d_persp_switch_from_camera(const Depsgraph *depsgraph, rv3d->persp = persp; } } -/** - * Action to take when rotating the view, - * handle auto-perspective and logic for switching out of views. - * - * shared with NDOF. - */ bool ED_view3d_persp_ensure(const Depsgraph *depsgraph, View3D *v3d, ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -569,19 +531,12 @@ bool ED_view3d_persp_ensure(const Depsgraph *depsgraph, View3D *v3d, ARegion *re * Lock the camera to the 3D Viewport, allowing view manipulation to transform the camera. * \{ */ -/** - * \return true when the 3D Viewport is locked to its camera. - */ bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d) { return ((v3d->camera) && (!ID_IS_LINKED(v3d->camera)) && (v3d->flag2 & V3D_LOCK_CAMERA) && (rv3d->persp == RV3D_CAMOB)); } -/** - * Apply the camera object transformation to the 3D Viewport. - * (needed so we can use regular 3D Viewport manipulation operators, that sync back to the camera). - */ void ED_view3d_camera_lock_init_ex(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d, @@ -603,11 +558,6 @@ void ED_view3d_camera_lock_init(const Depsgraph *depsgraph, View3D *v3d, RegionV ED_view3d_camera_lock_init_ex(depsgraph, v3d, rv3d, true); } -/** - * Apply the 3D Viewport transformation back to the camera object. - * - * \return true if the camera is moved. - */ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d) { if (ED_view3d_camera_lock_check(v3d, rv3d)) { @@ -701,12 +651,6 @@ bool ED_view3d_camera_autokey(const Scene *scene, return false; } -/** - * Call after modifying a locked view. - * - * \note Not every view edit currently auto-keys (num-pad for eg), - * this is complicated because of smooth-view. - */ bool ED_view3d_camera_lock_autokey(View3D *v3d, RegionView3D *rv3d, struct bContext *C, @@ -885,7 +829,6 @@ static void view3d_boxview_sync_axis(RegionView3D *rv3d_dst, RegionView3D *rv3d_ } } -/* sync center/zoom view of region to others, for view transforms */ void view3d_boxview_sync(ScrArea *area, ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -910,7 +853,6 @@ void view3d_boxview_sync(ScrArea *area, ARegion *region) } } -/* for home, center etc */ void view3d_boxview_copy(ScrArea *area, ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -935,7 +877,6 @@ void view3d_boxview_copy(ScrArea *area, ARegion *region) } } -/* 'clip' is used to know if our clip setting has changed */ void ED_view3d_quadview_update(ScrArea *area, ARegion *region, bool do_clip) { ARegion *region_sync = NULL; @@ -1023,14 +964,6 @@ static float view_autodist_depth_margin(ARegion *region, const int mval[2], int return depth_close; } -/** - * Get the world-space 3d location from a screen-space 2d point. - * TODO: Implement #alphaoverride. We don't want to zoom into billboards. - * - * \param mval: Input screen-space pixel location. - * \param mouse_worldloc: Output world-space location. - * \param fallback_depth_pt: Use this points depth when no depth can be found. - */ bool ED_view3d_autodist(Depsgraph *depsgraph, ARegion *region, View3D *v3d, @@ -1069,7 +1002,6 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, return false; } -/* no 4x4 sampling, run #ED_view3d_depth_override first */ bool ED_view3d_autodist_simple(ARegion *region, const int mval[2], float mouse_worldloc[3], @@ -1157,31 +1089,6 @@ float ED_view3d_radius_to_dist_ortho(const float lens, const float radius) return radius / (DEFAULT_SENSOR_WIDTH / lens); } -/** - * Return a new RegionView3D.dist value to fit the \a radius. - * - * \note Depth isn't taken into account, this will fit a flat plane exactly, - * but points towards the view (with a perspective projection), - * may be within the radius but outside the view. eg: - * - * <pre> - * + - * pt --> + /^ radius - * / | - * / | - * view + + - * \ | - * \ | - * \| - * + - * </pre> - * - * \param region: Can be NULL if \a use_aspect is false. - * \param persp: Allow the caller to tell what kind of perspective to use (ortho/view/camera) - * \param use_aspect: Increase the distance to account for non 1:1 view aspect. - * \param radius: The radius will be fitted exactly, - * typically pre-scaled by a margin (#VIEW3D_MARGIN). - */ float ED_view3d_radius_to_dist(const View3D *v3d, const ARegion *region, const struct Depsgraph *depsgraph, @@ -1262,18 +1169,6 @@ float ED_view3d_radius_to_dist(const View3D *v3d, /** \name View Distance Utilities * \{ */ -/** - * This function solves the problem of having to switch between camera and non-camera views. - * - * When viewing from the perspective of \a mat, and having the view center \a ofs, - * this calculates a distance from \a ofs to the matrix \a mat. - * Using \a fallback_dist when the distance would be too small. - * - * \param mat: A matrix use for the view-point (typically the camera objects matrix). - * \param ofs: Orbit center (negated), matching #RegionView3D.ofs, which is typically passed in. - * \param fallback_dist: The distance to use if the object is too near or in front of \a ofs. - * \returns A newly calculated distance or the fallback. - */ float ED_view3d_offset_distance(const float mat[4][4], const float ofs[3], const float fallback_dist) @@ -1295,11 +1190,6 @@ float ED_view3d_offset_distance(const float mat[4][4], return dist; } -/** - * Set the dist without moving the view (compensate with #RegionView3D.ofs) - * - * \note take care that viewinv is up to date, #ED_view3d_update_viewmat first. - */ void ED_view3d_distance_set(RegionView3D *rv3d, const float dist) { float viewinv[4]; @@ -1320,13 +1210,6 @@ void ED_view3d_distance_set(RegionView3D *rv3d, const float dist) rv3d->dist = dist; } -/** - * Change the distance & offset to match the depth of \a dist_co along the view axis. - * - * \param dist_co: A world-space location to use for the new depth. - * \param dist_min: Resulting distances below this will be ignored. - * \return Success if the distance was set. - */ bool ED_view3d_distance_set_from_location(RegionView3D *rv3d, const float dist_co[3], const float dist_min) @@ -1485,14 +1368,6 @@ bool ED_view3d_lock(RegionView3D *rv3d) /** \name View Transform Utilities * \{ */ -/** - * Set the view transformation from a 4x4 matrix. - * - * \param mat: The view 4x4 transformation matrix to assign. - * \param ofs: The view offset, normally from RegionView3D.ofs. - * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. - * \param dist: The view distance from ofs, normally from RegionView3D.dist. - */ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const float *dist) { float nmat[3][3]; @@ -1519,14 +1394,6 @@ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const } } -/** - * Calculate the view transformation matrix from RegionView3D input. - * The resulting matrix is equivalent to RegionView3D.viewinv - * \param mat: The view 4x4 transformation matrix to calculate. - * \param ofs: The view offset, normally from RegionView3D.ofs. - * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. - * \param dist: The view distance from ofs, normally from RegionView3D.dist. - */ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist) { const float iviewquat[4] = {-quat[0], quat[1], quat[2], quat[3]}; @@ -1537,14 +1404,6 @@ void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], c sub_v3_v3v3(mat[3], dvec, ofs); } -/** - * Set the RegionView3D members from an objects transformation and optionally lens. - * \param ob: The object to set the view to. - * \param ofs: The view offset to be set, normally from RegionView3D.ofs. - * \param quat: The view rotation to be set, quaternion normally from RegionView3D.viewquat. - * \param dist: The view distance from ofs to be set, normally from RegionView3D.dist. - * \param lens: The view lens angle set for cameras and lights, normally from View3D.lens. - */ void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float *dist, float *lens) { ED_view3d_from_m4(ob->obmat, ofs, quat, dist); @@ -1558,15 +1417,6 @@ void ED_view3d_from_object(const Object *ob, float ofs[3], float quat[4], float } } -/** - * Set the object transformation from RegionView3D members. - * \param depsgraph: The depsgraph to get the evaluated object parent - * for the transformation calculation. - * \param ob: The object which has the transformation assigned. - * \param ofs: The view offset, normally from RegionView3D.ofs. - * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. - * \param dist: The view distance from ofs, normally from RegionView3D.dist. - */ void ED_view3d_to_object(const Depsgraph *depsgraph, Object *ob, const float ofs[3], diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 6f0ce6c9326..e5794eb8401 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -123,7 +123,6 @@ static void view3d_smooth_view_state_restore(const struct SmoothView3DState *sms } /* will start timer if appropriate */ -/* the arguments are the desired situation */ void ED_view3d_smooth_view_ex( /* avoid passing in the context */ const Depsgraph *depsgraph, @@ -407,10 +406,6 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w return OPERATOR_FINISHED; } -/** - * Apply the smooth-view immediately, use when we need to start a new view operation. - * (so we don't end up half-applying a view operation when pressing keys quickly). - */ void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -696,9 +691,6 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) /** \name Window and View Matrix Calculation * \{ */ -/** - * \param rect: optional for picking (can be NULL). - */ void view3d_winmatrix_set(Depsgraph *depsgraph, ARegion *region, const View3D *v3d, @@ -761,18 +753,6 @@ static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob) mat4_normalized_to_quat(rv3d->viewquat, rv3d->viewmat); } -/** - * Sets #RegionView3D.viewmat - * - * \param depsgraph: Depsgraph. - * \param scene: Scene for camera and cursor location. - * \param v3d: View 3D space data. - * \param rv3d: 3D region which stores the final matrices. - * \param rect_scale: Optional 2D scale argument, - * Use when displaying a sub-region, eg: when #view3d_winmatrix_set takes a 'rect' argument. - * - * \note don't set windows active in here, is used by renderwin too. - */ void view3d_viewmatrix_set(Depsgraph *depsgraph, const Scene *scene, const View3D *v3d, @@ -862,11 +842,6 @@ void view3d_viewmatrix_set(Depsgraph *depsgraph, /** \name OpenGL Select Utilities * \{ */ -/** - * Optionally cache data for multiple calls to #view3d_opengl_select - * - * just avoid GPU_select headers outside this file - */ void view3d_opengl_select_cache_begin(void) { GPU_select_cache_begin(); @@ -943,13 +918,6 @@ static bool drw_select_filter_object_mode_lock_for_weight_paint(Object *ob, void return ob_pose_list && (BLI_linklist_index(ob_pose_list, DEG_get_original_object(ob)) != -1); } -/** - * \warning be sure to account for a negative return value - * This is an error, "Too many objects in select buffer" - * and no action should be taken (can crash blender) if this happens - * - * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. - */ int view3d_opengl_select_ex(ViewContext *vc, uint *buffer, uint bufsize, @@ -1621,11 +1589,6 @@ static void view3d_local_collections_reset(Main *bmain, const uint local_view_bi } } -/** - * See if current uuid is valid, otherwise set a valid uuid to v3d, - * Try to keep the same uuid previously used to allow users to - * quickly toggle back and forth. - */ bool ED_view3d_local_collections_set(Main *bmain, struct View3D *v3d) { if ((v3d->flag & V3D_LOCAL_COLLECTIONS) == 0) { diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ae4c3f02c46..386fd85213e 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -668,7 +668,6 @@ static bool transform_modal_item_poll(const wmOperator *op, int value) return true; } -/* Called in transform_ops.c, on each regeneration of key-maps. */ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -1449,9 +1448,6 @@ static void drawTransformPixel(const struct bContext *C, ARegion *region, void * } } -/** - * \see #initTransform which reads values from the operator. - */ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); @@ -1670,11 +1666,6 @@ static void initSnapSpatial(TransInfo *t, float r_snap[2]) } } -/** - * \note caller needs to free 't' on a 0 return - * \warning \a event might be NULL (when tweaking from redo panel) - * \see #saveTransform which writes these values back. - */ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode) { int options = 0; @@ -1987,7 +1978,6 @@ int transformEnd(bContext *C, TransInfo *t) return exit_code; } -/* TODO: move to: `transform_query.c`. */ bool checkUseAxisMatrix(TransInfo *t) { /* currently only checks for editmode */ diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 380df739876..3a8155ce9f7 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -687,11 +687,19 @@ typedef struct TransInfo { /** \name Public Transform API * \{ */ +/** + * \note caller needs to free `t` on a 0 return + * \warning \a event might be NULL (when tweaking from redo panel) + * \see #saveTransform which writes these values back. + */ bool initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, const struct wmEvent *event, int mode); +/** + * \see #initTransform which reads values from the operator. + */ void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op); int transformEvent(TransInfo *t, const struct wmEvent *event); void transformApply(struct bContext *C, TransInfo *t); @@ -708,6 +716,9 @@ void projectFloatView(TransInfo *t, const float vec[3], float adr[2]); void applyAspectRatio(TransInfo *t, float vec[2]); void removeAspectRatio(TransInfo *t, float vec[2]); +/** + * Called in transform_ops.c, on each regeneration of key-maps. + */ struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf); /** \} */ @@ -772,12 +783,28 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float val /** \name Generics * \{ */ +/** + * Setup internal data, mouse, vectors + * + * \note \a op and \a event can be NULL + * + * \see #saveTransform does the reverse. + */ void initTransInfo(struct bContext *C, TransInfo *t, struct wmOperator *op, const struct wmEvent *event); +/** + * Needed for mode switching. + */ void freeTransCustomDataForMode(TransInfo *t); +/** + * Here I would suggest only #TransInfo related issues, like free data & reset vars. Not redraws. + */ void postTrans(struct bContext *C, TransInfo *t); +/** + * Free data before switching to another mode. + */ void resetTransModal(TransInfo *t); void resetTransRestrictions(TransInfo *t); @@ -800,17 +827,25 @@ void calculateCenterMedian(TransInfo *t, float r_center[3]); void calculateCenterCursor(TransInfo *t, float r_center[3]); void calculateCenterCursor2D(TransInfo *t, float r_center[2]); void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2]); +/** + * \param select_only: only get active center from data being transformed. + */ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]); void calculatePropRatio(TransInfo *t); +/** + * Rotate an element, low level code, ignore protected channels. + * (use for objects or pose-bones) + * Similar to #ElementRotation. + */ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot); struct Object *transform_object_deform_pose_armature_get(const TransInfo *t, struct Object *ob); void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); -/* TODO: `transform_query.c`. */ +/* TODO: move to: `transform_query.c`. */ bool checkUseAxisMatrix(TransInfo *t); #define TRANSFORM_SNAP_MAX_PX 100.0f diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index a24491119c6..ede4c3e458c 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -295,10 +295,6 @@ static void constraint_snap_plane_to_edge(const TransInfo *t, const float plane[ } } -/** - * Snap to the nearest point between the snap point and the line that - * intersects the face plane with the constraint plane. - */ static void UNUSED_FUNCTION(constraint_snap_plane_to_face(const TransInfo *t, const float plane[4], float r_out[3])) @@ -314,9 +310,6 @@ static void UNUSED_FUNCTION(constraint_snap_plane_to_face(const TransInfo *t, } } -/** - * Snap to the nearest point on the axis to the edge/line element. - */ void transform_constraint_snap_axis_to_edge(const TransInfo *t, const float axis[3], float r_out[3]) @@ -331,9 +324,6 @@ void transform_constraint_snap_axis_to_edge(const TransInfo *t, } } -/** - * Snap to the intersection of the axis and the plane defined by the face. - */ void transform_constraint_snap_axis_to_face(const TransInfo *t, const float axis[3], float r_out[3]) @@ -700,7 +690,6 @@ void setConstraint(TransInfo *t, int mode, const char text[]) t->redraw = TREDRAW_HARD; } -/* applies individual td->axismtx constraints */ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[]) { BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1); @@ -728,12 +717,6 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) } } -/** - * Set the constraint according to the user defined orientation - * - * `ftext` is a format string passed to #BLI_snprintf. It will add the name of - * the orientation where %s is (logically). - */ void setUserConstraint(TransInfo *t, int mode, const char ftext[]) { char text[256]; @@ -842,7 +825,6 @@ void drawConstraint(TransInfo *t) } } -/* called from drawview.c, as an extra per-window draw option */ void drawPropCircle(const struct bContext *C, TransInfo *t) { if (t->flag & T_PROP_EDIT) { @@ -1200,13 +1182,6 @@ bool isLockConstraint(const TransInfo *t) return false; } -/** - * Returns the dimension of the constraint space. - * - * For that reason, the flags always needs to be set to properly evaluate here, - * even if they aren't actually used in the callback function. - * (Which could happen for weird constraints not yet designed. Along a path for example.) - */ int getConstraintSpaceDimension(const TransInfo *t) { int n = 0; diff --git a/source/blender/editors/transform/transform_constraints.h b/source/blender/editors/transform/transform_constraints.h index 3632b352476..12151f9df07 100644 --- a/source/blender/editors/transform/transform_constraints.h +++ b/source/blender/editors/transform/transform_constraints.h @@ -26,17 +26,35 @@ struct TransInfo; void constraintNumInput(TransInfo *t, float vec[3]); +/** + * Snap to the nearest point on the axis to the edge/line element. + */ void transform_constraint_snap_axis_to_edge(const TransInfo *t, const float axis[3], float r_out[3]); +/** + * Snap to the intersection of the axis and the plane defined by the face. + */ void transform_constraint_snap_axis_to_face(const TransInfo *t, const float axis[3], float r_out[3]); void setConstraint(TransInfo *t, int mode, const char text[]); +/** + * Applies individual `td->axismtx` constraints. + */ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[]); void setLocalConstraint(TransInfo *t, int mode, const char text[]); +/** + * Set the constraint according to the user defined orientation + * + * `ftext` is a format string passed to #BLI_snprintf. It will add the name of + * the orientation where %s is (logically). + */ void setUserConstraint(TransInfo *t, int mode, const char text[]); void drawConstraint(TransInfo *t); +/** + * Called from drawview.c, as an extra per-window draw option. + */ void drawPropCircle(const struct bContext *C, TransInfo *t); void startConstraint(TransInfo *t); void stopConstraint(TransInfo *t); @@ -47,4 +65,11 @@ void setNearestAxis(TransInfo *t); int constraintModeToIndex(const TransInfo *t); char constraintModeToChar(const TransInfo *t); bool isLockConstraint(const TransInfo *t); +/** + * Returns the dimension of the constraint space. + * + * For that reason, the flags always needs to be set to properly evaluate here, + * even if they aren't actually used in the callback function. + * (Which could happen for weird constraints not yet designed. Along a path for example.) + */ int getConstraintSpaceDimension(const TransInfo *t); diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index ff20f569a71..8f3d13176a3 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -68,10 +68,6 @@ bool transform_mode_use_local_origins(const TransInfo *t) return ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL); } -/** - * Transforming around ourselves is no use, fallback to individual origins, - * useful for curve/armatures. - */ void transform_around_single_fallback_ex(TransInfo *t, int data_len_all) { if (data_len_all != 1) { @@ -369,7 +365,6 @@ static bool pchan_autoik_adjust(bPoseChannel *pchan, short chainlen) return changed; } -/* change the chain-length of auto-ik */ void transform_autoik_update(TransInfo *t, short mode) { Main *bmain = CTX_data_main(t->context); @@ -482,7 +477,6 @@ void calc_distanceCurveVerts(TransData *head, TransData *tail, bool cyclic) BLI_LINKSTACK_FREE(queue); } -/* Utility function for getting the handle data from bezier's */ TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) { TransDataCurveHandleFlags *hdata; @@ -611,9 +605,6 @@ void clipUVData(TransInfo *t) /** \name Animation Editors (General) * \{ */ -/** - * Used for `TFM_TIME_EXTEND`. - */ char transform_convert_frame_side_dir_get(TransInfo *t, float cframe) { char r_dir; @@ -636,7 +627,6 @@ char transform_convert_frame_side_dir_get(TransInfo *t, float cframe) return r_dir; } -/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */ bool FrameOnMouseSide(char side, float frame, float cframe) { /* both sides, so it doesn't matter */ @@ -667,14 +657,6 @@ typedef struct tRetainedKeyframe { size_t del_count; /* number of keyframes of this sort that have been deleted so far */ } tRetainedKeyframe; -/** - * Called during special_aftertrans_update to make sure selected keyframes replace - * any other keyframes which may reside on that frame (that is not selected). - * - * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine selection. Usually `SELECT`, - * but may want to use a different one at times (if caller does not operate on - * selection). - */ void posttrans_fcurve_clean(FCurve *fcu, const int sel_flag, const bool use_handle) { /* NOTE: We assume that all keys are sorted */ @@ -798,12 +780,6 @@ void posttrans_fcurve_clean(FCurve *fcu, const int sel_flag, const bool use_hand /** \name Transform Utilities * \{ */ -/* Little helper function for ObjectToTransData used to give certain - * constraints (ChildOf, FollowPath, and others that may be added) - * inverse corrections for transform, so that they aren't in CrazySpace. - * These particular constraints benefit from this, but others don't, hence - * this semi-hack ;-) - Aligorith - */ bool constraints_list_needinv(TransInfo *t, ListBase *list) { bConstraint *con; @@ -894,14 +870,12 @@ bool constraints_list_needinv(TransInfo *t, ListBase *list) /** \name Transform (After-Transform Update) * \{ */ -/* inserting keys, pointcache, redraw events... */ -/** - * \note Sequencer freeing has its own function now because of a conflict - * with transform's order of freeing (campbell). - * Order changed, the sequencer stuff should go back in here - */ void special_aftertrans_update(bContext *C, TransInfo *t) { + /* NOTE: Sequencer freeing has its own function now because of a conflict + * with transform's order of freeing (campbell). + * Order changed, the sequencer stuff should go back in here. */ + /* early out when nothing happened */ if (t->data_len_all == 0 || t->mode == TFM_DUMMY) { return; @@ -1609,7 +1583,6 @@ void transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc) } } -/* for the realtime animation recording feature, handle overlapping data */ void animrecord_check_state(TransInfo *t, struct Object *ob) { Scene *scene = t->scene; @@ -1708,7 +1681,6 @@ void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, const fl } } -/* called for updating while transform acts, once per redraw */ void recalcData(TransInfo *t) { switch (t->data_type) { diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index e4f2ab05bec..5ed8182857d 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -36,47 +36,101 @@ struct TransInfo; struct bContext; /* transform_convert.c */ + +/** + * Change the chain-length of auto-IK. + */ void transform_autoik_update(TransInfo *t, short mode); int special_transform_moving(TransInfo *t); +/** + * Inserting keys, point-cache, redraw events. + */ void special_aftertrans_update(struct bContext *C, TransInfo *t); void sort_trans_data_dist(TransInfo *t); void createTransData(struct bContext *C, TransInfo *t); bool clipUVTransform(TransInfo *t, float vec[2], const bool resize); void clipUVData(TransInfo *t); void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, const float y_fac); +/** + * Called for updating while transform acts, once per redraw. + */ void recalcData(TransInfo *t); /* transform_convert_mesh.c */ + void transform_convert_mesh_customdatacorrect_init(TransInfo *t); /* transform_convert_sequencer.c */ + void transform_convert_sequencer_channel_clamp(TransInfo *t, float r_val[2]); /********************* intern **********************/ /* transform_convert.c */ + bool transform_mode_use_local_origins(const TransInfo *t); +/** + * Transforming around ourselves is no use, fallback to individual origins, + * useful for curve/armatures. + */ void transform_around_single_fallback_ex(TransInfo *t, int data_len_all); void transform_around_single_fallback(TransInfo *t); +/** + * Called during special_aftertrans_update to make sure selected keyframes replace + * any other keyframes which may reside on that frame (that is not selected). + * + * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine selection. Usually `SELECT`, + * but may want to use a different one at times (if caller does not operate on + * selection). + */ void posttrans_fcurve_clean(struct FCurve *fcu, const int sel_flag, const bool use_handle); +/** + * Little helper function for ObjectToTransData used to give certain + * constraints (ChildOf, FollowPath, and others that may be added) + * inverse corrections for transform, so that they aren't in CrazySpace. + * These particular constraints benefit from this, but others don't, hence + * this semi-hack ;-) - Aligorith + */ bool constraints_list_needinv(TransInfo *t, ListBase *list); void calc_distanceCurveVerts(TransData *head, TransData *tail, bool cyclic); +/** + * Utility function for getting the handle data from bezier's. + */ struct TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt); +/** + * Used for `TFM_TIME_EXTEND`. + */ char transform_convert_frame_side_dir_get(TransInfo *t, float cframe); +/** + * This function tests if a point is on the "mouse" side of the cursor/frame-marking. + */ bool FrameOnMouseSide(char side, float frame, float cframe); void transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc); +/** + * For the realtime animation recording feature, handle overlapping data. + */ void animrecord_check_state(TransInfo *t, struct Object *ob); /* transform_convert_action.c */ + void createTransActionData(bContext *C, TransInfo *t); +/* helper for recalcData() - for Action Editor transforms */ void recalcData_actedit(TransInfo *t); void special_aftertrans_update__actedit(bContext *C, TransInfo *t); /* transform_convert_armature.c */ + +/** + * Sets transform flags in the bones. + * Returns total number of bones with #BONE_TRANSFORM. + */ int transform_convert_pose_transflags_update(Object *ob, const int mode, const short around, bool has_translate_rotate[2]); +/** + * When objects array is NULL, use 't->data_container' as is. + */ void createTransPose(TransInfo *t); void createTransArmatureVerts(TransInfo *t); void recalcData_edit_armature(TransInfo *t); @@ -84,6 +138,7 @@ void recalcData_pose(TransInfo *t); void special_aftertrans_update__pose(bContext *C, TransInfo *t); /* transform_convert_cursor.c */ + void createTransCursor_image(TransInfo *t); void createTransCursor_sequencer(TransInfo *t); void createTransCursor_view3d(TransInfo *t); @@ -92,16 +147,28 @@ void recalcData_cursor_sequencer(TransInfo *t); void recalcData_cursor_view3d(TransInfo *t); /* transform_convert_curve.c */ + void createTransCurveVerts(TransInfo *t); void recalcData_curve(TransInfo *t); /* transform_convert_graph.c */ +/** + * It is important to note that this doesn't always act on the selection (like it's usually done), + * it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a + * left or right handle (SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT/RIGHT) and then we only transform the + * selected left or right handles accordingly. + * The points to be transformed are tagged with BEZT_FLAG_TEMP_TAG; some lower level curve + * functions may need to be made aware of this. It's ugly that these act based on selection state + * anyway. + */ void createTransGraphEditData(bContext *C, TransInfo *t); +/* helper for recalcData() - for Graph Editor transforms */ void recalcData_graphedit(TransInfo *t); void special_aftertrans_update__graph(bContext *C, TransInfo *t); /* transform_convert_gpencil.c */ void createTransGPencil(bContext *C, TransInfo *t); +/* force recalculation of triangles during transformation */ void recalcData_gpencil_strokes(TransInfo *t); /* transform_convert_lattice.c */ @@ -146,6 +213,11 @@ void transform_convert_mesh_islands_calc(struct BMEditMesh *em, const bool calc_island_axismtx, struct TransIslandData *r_island_data); void transform_convert_mesh_islanddata_free(struct TransIslandData *island_data); +/** + * \param mtx: Measure distance in this space. + * \param dists: Store the closest connected distance to selected vertices. + * \param index: Optionally store the original index we're measuring the distance to (can be NULL). + */ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, const float mtx[3][3], float *dists, @@ -156,6 +228,10 @@ void transform_convert_mesh_mirrordata_calc(struct BMEditMesh *em, const bool mirror_axis[3], struct TransMirrorData *r_mirror_data); void transform_convert_mesh_mirrordata_free(struct TransMirrorData *mirror_data); +/** + * Detect CrazySpace [tm]. + * Vertices with space affected by quats are marked with #BM_ELEM_TAG. + */ void transform_convert_mesh_crazyspace_detect(TransInfo *t, struct TransDataContainer *tc, struct BMEditMesh *em, @@ -181,10 +257,12 @@ void recalcData_mesh_skin(TransInfo *t); /* transform_convert_mesh_uv.c */ void createTransUVs(bContext *C, TransInfo *t); +/* helper for recalcData() - for Image Editor transforms */ void recalcData_uv(TransInfo *t); /* transform_convert_nla.c */ void createTransNlaData(bContext *C, TransInfo *t); +/* helper for recalcData() - for NLA Editor transforms */ void recalcData_nla(TransInfo *t); void special_aftertrans_update__nla(bContext *C, TransInfo *t); @@ -195,11 +273,13 @@ void special_aftertrans_update__node(bContext *C, TransInfo *t); /* transform_convert_object.c */ void createTransObject(bContext *C, TransInfo *t); +/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_objects(TransInfo *t); void special_aftertrans_update__object(bContext *C, TransInfo *t); /* transform_convert_object_texspace.c */ void createTransTexspace(TransInfo *t); +/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_texspace(TransInfo *t); /* transform_convert_paintcurve.c */ @@ -217,6 +297,7 @@ void special_aftertrans_update__sculpt(bContext *C, TransInfo *t); /* transform_convert_sequencer.c */ void createTransSeqData(TransInfo *t); +/* helper for recalcData() - for sequencer transforms */ void recalcData_sequencer(TransInfo *t); void special_aftertrans_update__sequencer(bContext *C, TransInfo *t); @@ -226,5 +307,6 @@ void recalcData_sequencer_image(TransInfo *t); /* transform_convert_tracking.c */ void createTransTrackingData(bContext *C, TransInfo *t); +/* helper for recalcData() - for Movie Clip transforms */ void recalcData_tracking(TransInfo *t); void special_aftertrans_update__movieclip(bContext *C, TransInfo *t); diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c index 24d84bc2de8..69b4de48c56 100644 --- a/source/blender/editors/transform/transform_convert_action.c +++ b/source/blender/editors/transform/transform_convert_action.c @@ -580,7 +580,6 @@ static void flushTransIntFrameActionData(TransInfo *t) } } -/* helper for recalcData() - for Action Editor transforms */ void recalcData_actedit(TransInfo *t) { ViewLayer *view_layer = t->view_layer; diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index 88790e9645c..63aada0f797 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -716,9 +716,6 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr td->con = pchan->constraints.first; } -/** - * When objects array is NULL, use 't->data_container' as is. - */ void createTransPose(TransInfo *t) { Main *bmain = CTX_data_main(t->context); @@ -1502,10 +1499,6 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) } } -/** - * Sets transform flags in the bones. - * Returns total number of bones with #BONE_TRANSFORM. - */ int transform_convert_pose_transflags_update(Object *ob, const int mode, const short around, diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c index f7b78b10868..9c8671c80f3 100644 --- a/source/blender/editors/transform/transform_convert_gpencil.c +++ b/source/blender/editors/transform/transform_convert_gpencil.c @@ -748,7 +748,6 @@ void createTransGPencil(bContext *C, TransInfo *t) } } -/* force recalculation of triangles during transformation */ void recalcData_gpencil_strokes(TransInfo *t) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c index d22277f9d91..40c226b8f7c 100644 --- a/source/blender/editors/transform/transform_convert_graph.c +++ b/source/blender/editors/transform/transform_convert_graph.c @@ -218,15 +218,6 @@ static void graph_key_shortest_dist( } } -/** - * It is important to note that this doesn't always act on the selection (like it's usually done), - * it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a - * left or right handle (SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT/RIGHT) and then we only transform the - * selected left or right handles accordingly. - * The points to be transformed are tagged with BEZT_FLAG_TEMP_TAG; some lower level curve - * functions may need to be made aware of this. It's ugly that these act based on selection state - * anyway. - */ void createTransGraphEditData(bContext *C, TransInfo *t) { SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; @@ -913,7 +904,6 @@ static void remake_graph_transdata(TransInfo *t, ListBase *anim_data) } } -/* helper for recalcData() - for Graph Editor transforms */ void recalcData_graphedit(TransInfo *t) { SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 7377e47da3d..cd3d4fb0659 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1000,11 +1000,6 @@ static bool bmesh_test_loose_edge(BMEdge *edge) return true; } -/** - * \param mtx: Measure distance in this space. - * \param dists: Store the closest connected distance to selected vertices. - * \param index: Optionally store the original index we're measuring the distance to (can be NULL). - */ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, const float mtx[3][3], float *dists, @@ -1307,8 +1302,6 @@ void transform_convert_mesh_mirrordata_free(struct TransMirrorData *mirror_data) /** \name Crazy Space * \{ */ -/* Detect CrazySpace [tm]. - * Vertices with space affected by quats are marked with #BM_ELEM_TAG */ void transform_convert_mesh_crazyspace_detect(TransInfo *t, struct TransDataContainer *tc, struct BMEditMesh *em, diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 61397b6ef4b..69f29389b31 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -464,7 +464,6 @@ static void flushTransUVs(TransInfo *t) } } -/* helper for recalcData() - for Image Editor transforms */ void recalcData_uv(TransInfo *t) { SpaceImage *sima = t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index acef8a666e3..d19698a4f61 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -266,7 +266,6 @@ void createTransNlaData(bContext *C, TransInfo *t) ANIM_animdata_freelist(&anim_data); } -/* helper for recalcData() - for NLA Editor transforms */ void recalcData_nla(TransInfo *t) { SpaceNla *snla = (SpaceNla *)t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_convert_object.c b/source/blender/editors/transform/transform_convert_object.c index 4a8ebf3fc6e..52365e4e519 100644 --- a/source/blender/editors/transform/transform_convert_object.c +++ b/source/blender/editors/transform/transform_convert_object.c @@ -874,7 +874,6 @@ static bool motionpath_need_update_object(Scene *scene, Object *ob) /** \name Recalc Data object * \{ */ -/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_objects(TransInfo *t) { bool motionpath_update = false; diff --git a/source/blender/editors/transform/transform_convert_object_texspace.c b/source/blender/editors/transform/transform_convert_object_texspace.c index 371a5b48818..98879852326 100644 --- a/source/blender/editors/transform/transform_convert_object_texspace.c +++ b/source/blender/editors/transform/transform_convert_object_texspace.c @@ -102,7 +102,6 @@ void createTransTexspace(TransInfo *t) /** \name Recalc Data object * \{ */ -/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_texspace(TransInfo *t) { diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c index 70089164d8a..88c01321785 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.c +++ b/source/blender/editors/transform/transform_convert_sequencer.c @@ -789,7 +789,6 @@ static void flushTransSeq(TransInfo *t) SEQ_collection_free(transformed_strips); } -/* helper for recalcData() - for sequencer transforms */ void recalcData_sequencer(TransInfo *t) { TransData *td; diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index 211dec3c4e8..dc37f2796bf 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -707,7 +707,6 @@ static void flushTransTracking(TransInfo *t) } } -/* helper for recalcData() - for Movie Clip transforms */ void recalcData_tracking(TransInfo *t) { SpaceClip *sc = t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_draw_cursors.c b/source/blender/editors/transform/transform_draw_cursors.c index af1f3cb72a4..13127ae06bb 100644 --- a/source/blender/editors/transform/transform_draw_cursors.c +++ b/source/blender/editors/transform/transform_draw_cursors.c @@ -88,20 +88,12 @@ static void drawArrow(const uint pos_id, const enum eArrowDirection dir) immEnd(); } -/** - * Poll callback for cursor drawing: - * #WM_paint_cursor_activate - */ bool transform_draw_cursor_poll(bContext *C) { ARegion *region = CTX_wm_region(C); return (region && ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) ? 1 : 0; } -/** - * Cursor and help-line drawing, callback for: - * #WM_paint_cursor_activate - */ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customdata) { TransInfo *t = (TransInfo *)customdata; diff --git a/source/blender/editors/transform/transform_draw_cursors.h b/source/blender/editors/transform/transform_draw_cursors.h index 0f626c9039b..b520cd1d4f8 100644 --- a/source/blender/editors/transform/transform_draw_cursors.h +++ b/source/blender/editors/transform/transform_draw_cursors.h @@ -24,5 +24,14 @@ #pragma once /* Callbacks for #WM_paint_cursor_activate */ + +/** + * Poll callback for cursor drawing: + * #WM_paint_cursor_activate + */ bool transform_draw_cursor_poll(struct bContext *C); +/** + * Cursor and help-line drawing, callback for: + * #WM_paint_cursor_activate + */ void transform_draw_cursor_draw(struct bContext *C, int x, int y, void *customdata); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 84a685c2e72..a842975a76e 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -125,9 +125,6 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis GPU_matrix_pop(); } -/** - * Free data before switching to another mode. - */ void resetTransModal(TransInfo *t) { freeTransCustomDataForMode(t); @@ -191,13 +188,6 @@ static int t_around_get(TransInfo *t) return V3D_AROUND_CENTER_BOUNDS; } -/** - * Setup internal data, mouse, vectors - * - * \note \a op and \a event can be NULL - * - * \see #saveTransform does the reverse. - */ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event) { Scene *sce = CTX_data_scene(C); @@ -719,9 +709,6 @@ static void freeTransCustomDataContainer(TransInfo *t, } } -/** - * Needed for mode switching. - */ void freeTransCustomDataForMode(TransInfo *t) { freeTransCustomData(t, NULL, &t->custom.mode); @@ -730,7 +717,6 @@ void freeTransCustomDataForMode(TransInfo *t) } } -/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */ void postTrans(bContext *C, TransInfo *t) { if (t->draw_handle_view) { @@ -1068,9 +1054,6 @@ void calculateCenterBound(TransInfo *t, float r_center[3]) } } -/** - * \param select_only: only get active center from data being transformed. - */ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_OK(t); @@ -1324,11 +1307,6 @@ void calculatePropRatio(TransInfo *t) } } -/** - * Rotate an element, low level code, ignore protected channels. - * (use for objects or pose-bones) - * Similar to #ElementRotation. - */ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) { float totmat[3][3]; diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 6a2353d403f..9bd55d78039 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -623,8 +623,6 @@ bool gimbal_axis_object(Object *ob, float gmat[3][3]) return 1; } -/* centroid, boundbox, of selection */ -/* returns total items selected */ int ED_transform_calc_gizmo_stats(const bContext *C, const struct TransformCalcParams *params, struct TransformBounds *tbounds) @@ -2005,7 +2003,6 @@ void VIEW3D_GGT_xform_gizmo(wmGizmoGroupType *gzgt) ""); } -/** Only poll, flag & gzmap_params differ. */ void VIEW3D_GGT_xform_gizmo_context(wmGizmoGroupType *gzgt) { gzgt->name = "3D View: Transform Gizmo Context"; diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index 0f520c4d3f1..5ecafdeb44e 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -78,7 +78,6 @@ bool transdata_check_local_center(const TransInfo *t, short around) (t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE | CTX_SEQUENCER_IMAGE)))); } -/* Informs if the mode can be switched during modal. */ bool transform_mode_is_changeable(const int mode) { return ELEM(mode, @@ -523,7 +522,6 @@ void constraintSizeLim(const TransInfo *t, TransData *td) /* -------------------------------------------------------------------- */ /** \name Transform (Rotation Utils) * \{ */ -/* Used by Transform Rotation and Transform Normal Rotation */ void headerRotation(TransInfo *t, char *str, const int str_size, float final) { size_t ofs = 0; @@ -551,12 +549,6 @@ void headerRotation(TransInfo *t, char *str, const int str_size, float final) } } -/** - * Applies values of rotation to `td->loc` and `td->ext->quat` - * based on a rotation matrix (mat) and a pivot (center). - * - * Protected axis and other transform settings are taken into account. - */ void ElementRotation_ex(const TransInfo *t, const TransDataContainer *tc, TransData *td, @@ -833,6 +825,7 @@ void ElementRotation(const TransInfo *t, /* -------------------------------------------------------------------- */ /** \name Transform (Resize Utils) * \{ */ + void headerResize(TransInfo *t, const float vec[3], char *str, const int str_size) { char tvec[NUM_STR_REP_LEN * 3]; @@ -1232,9 +1225,6 @@ void transform_mode_init(TransInfo *t, wmOperator *op, const int mode) * BLI_assert(t->mode == mode); */ } -/** - * When in modal and not set, initializes a default orientation for the mode. - */ void transform_mode_default_modal_orientation_set(TransInfo *t, int type) { /* Currently only these types are supported. */ diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h index c561d1c8a4f..ec3d5b8d0fe 100644 --- a/source/blender/editors/transform/transform_mode.h +++ b/source/blender/editors/transform/transform_mode.h @@ -42,12 +42,24 @@ typedef struct TransDataGenericSlideVert { /* transform_mode.c */ int transform_mode_really_used(struct bContext *C, int mode); bool transdata_check_local_center(const TransInfo *t, short around); +/** + * Informs if the mode can be switched during modal. + */ bool transform_mode_is_changeable(const int mode); void protectedTransBits(short protectflag, float vec[3]); void protectedSizeBits(short protectflag, float size[3]); void constraintTransLim(const TransInfo *t, TransData *td); void constraintSizeLim(const TransInfo *t, TransData *td); +/** + * Used by Transform Rotation and Transform Normal Rotation. + */ void headerRotation(TransInfo *t, char *str, int str_size, float final); +/** + * Applies values of rotation to `td->loc` and `td->ext->quat` + * based on a rotation matrix (mat) and a pivot (center). + * + * Protected axis and other transform settings are taken into account. + */ void ElementRotation_ex(const TransInfo *t, const TransDataContainer *tc, TransData *td, @@ -64,6 +76,9 @@ void ElementResize(const TransInfo *t, TransData *td, const float mat[3][3]); void transform_mode_init(TransInfo *t, struct wmOperator *op, const int mode); +/** + * When in modal and not set, initializes a default orientation for the mode. + */ void transform_mode_default_modal_orientation_set(TransInfo *t, int type); /* transform_mode_align.c */ diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 61bbe722d71..fa2485c33c2 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -315,11 +315,6 @@ bool createSpaceNormal(float mat[3][3], const float normal[3]) return true; } -/** - * \note To recreate an orientation from the matrix: - * - (plane == mat[1]) - * - (normal == mat[2]) - */ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]) { if (normalize_v3_v3(mat[2], normal) == 0.0f) { @@ -503,15 +498,6 @@ void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat); } -/** - * \note The resulting matrix may not be orthogonal, - * callers that depend on `r_mat` to be orthogonal should use #orthogonalize_m3. - * - * A non orthogonal matrix may be returned when: - * - #V3D_ORIENT_GIMBAL the result won't be orthogonal unless the object has no rotation. - * - #V3D_ORIENT_LOCAL may contain shear from non-uniform scale in parent/child relationships. - * - #V3D_ORIENT_CUSTOM may have been created from #V3D_ORIENT_LOCAL. - */ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, @@ -602,9 +588,6 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, return orientation_index; } -/* Sets the matrix of the specified space orientation. - * If the matrix cannot be obtained, an orientation different from the one - * informed is returned */ short transform_orientation_matrix_get(bContext *C, TransInfo *t, short orient_index, diff --git a/source/blender/editors/transform/transform_orientations.h b/source/blender/editors/transform/transform_orientations.h index 1da369c8307..6e0e3d9f8c7 100644 --- a/source/blender/editors/transform/transform_orientations.h +++ b/source/blender/editors/transform/transform_orientations.h @@ -25,6 +25,10 @@ struct TransInfo; +/** + * Sets the matrix of the specified space orientation. + * If the matrix cannot be obtained, an orientation different from the one informed is returned. + */ short transform_orientation_matrix_get(struct bContext *C, struct TransInfo *t, short orient_index, @@ -33,12 +37,19 @@ short transform_orientation_matrix_get(struct bContext *C, const char *transform_orientations_spacename_get(struct TransInfo *t, const short orient_type); void transform_orientations_current_set(struct TransInfo *t, const short orient_index); -/* Those two fill in mat and return non-zero on success */ +/** + * Those two fill in mat and return non-zero on success. + */ bool transform_orientations_create_from_axis(float mat[3][3], const float x[3], const float y[3], const float z[3]); bool createSpaceNormal(float mat[3][3], const float normal[3]); +/** + * \note To recreate an orientation from the matrix: + * - (plane == mat[1]) + * - (normal == mat[2]) + */ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]); struct TransformOrientation *addMatrixSpace(struct bContext *C, diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h index ed7f93304bc..bc89c7a8cda 100644 --- a/source/blender/editors/transform/transform_snap.h +++ b/source/blender/editors/transform/transform_snap.h @@ -76,18 +76,30 @@ void removeSnapPoint(TransInfo *t); float transform_snap_distance_len_squared_fn(TransInfo *t, const float p1[3], const float p2[3]); /* transform_snap_sequencer.c */ + struct TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo *t); void transform_snap_sequencer_data_free(struct TransSeqSnapData *data); bool transform_snap_sequencer_calc(struct TransInfo *t); void transform_snap_sequencer_apply_translate(TransInfo *t, float *vec); /* transform_snap_animation.c */ + +/** + * This function returns the snapping 'mode' for Animation Editors only. + * We cannot use the standard snapping due to NLA-strip scaling complexities. + * + * TODO: these modifier checks should be accessible from the key-map. + */ short getAnimEdit_SnapMode(TransInfo *t); void snapFrameTransform(TransInfo *t, const eAnimEdit_AutoSnap autosnap, const float val_initial, const float val_final, float *r_val_final); +/** + * This function is used by Animation Editor specific transform functions to do + * the Snap Keyframe to Nearest Frame/Marker + */ void transform_snap_anim_flush_data(TransInfo *t, TransData *td, const eAnimEdit_AutoSnap autosnap, diff --git a/source/blender/editors/transform/transform_snap_animation.c b/source/blender/editors/transform/transform_snap_animation.c index 8828f96247d..6ca16c171e2 100644 --- a/source/blender/editors/transform/transform_snap_animation.c +++ b/source/blender/editors/transform/transform_snap_animation.c @@ -38,12 +38,6 @@ /** \name Snapping in Anim Editors * \{ */ -/** - * This function returns the snapping 'mode' for Animation Editors only. - * We cannot use the standard snapping due to NLA-strip scaling complexities. - * - * TODO: these modifier checks should be accessible from the key-map. - */ short getAnimEdit_SnapMode(TransInfo *t) { short autosnap = SACTSNAP_OFF; @@ -128,9 +122,6 @@ void snapFrameTransform(TransInfo *t, } } -/* This function is used by Animation Editor specific transform functions to do - * the Snap Keyframe to Nearest Frame/Marker - */ void transform_snap_anim_flush_data(TransInfo *t, TransData *td, const eAnimEdit_AutoSnap autosnap, diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 4b981e763f1..7caa626fe78 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2865,13 +2865,6 @@ bool ED_transform_snap_object_project_ray_ex(SnapObjectContext *sctx, sctx, ray_start, ray_normal, ray_depth, r_loc, r_no, r_index, r_ob, r_obmat, NULL); } -/** - * Fill in a list of all hits. - * - * \param ray_depth: Only depths in this range are considered, -1.0 for maximum. - * \param sort: Optionally sort the hits by depth. - * \param r_hit_list: List of #SnapObjectHitDepth (caller must free). - */ bool ED_transform_snap_object_project_ray_all(SnapObjectContext *sctx, Depsgraph *depsgraph, const View3D *v3d, @@ -3174,19 +3167,6 @@ short ED_transform_snap_object_project_view3d_ex(SnapObjectContext *sctx, r_face_nor); } -/** - * Convenience function for performing snapping. - * - * Given a 2D region value, snap to vert/edge/face. - * - * \param sctx: Snap context. - * \param mval: Screenspace coordinate. - * \param prev_co: Coordinate for perpendicular point calculation (optional). - * \param dist_px: Maximum distance to snap (in pixels). - * \param r_loc: hit location. - * \param r_no: hit normal (optional). - * \return Snap success - */ short ED_transform_snap_object_project_view3d(SnapObjectContext *sctx, Depsgraph *depsgraph, const ARegion *region, @@ -3216,9 +3196,6 @@ short ED_transform_snap_object_project_view3d(SnapObjectContext *sctx, NULL); } -/** - * see: #ED_transform_snap_object_project_ray_all - */ bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, Depsgraph *depsgraph, const ARegion *region, diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index fa722d0646a..ca8b86d525d 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -77,9 +77,6 @@ static CLG_LogRef LOG = {"ed.undo"}; * Non-operator undo editor functions. * \{ */ -/** - * Run from the main event loop, basic checks that undo is left in a correct state. - */ bool ED_undo_is_state_valid(bContext *C) { wmWindowManager *wm = CTX_wm_manager(C); @@ -438,7 +435,6 @@ void ED_undo_pop_op(bContext *C, wmOperator *op) ed_undo_step_by_name(C, op->type->name, op->reports); } -/* name optionally, function used to check for operator redo panel */ bool ED_undo_is_valid(const bContext *C, const char *undoname) { wmWindowManager *wm = CTX_wm_manager(C); @@ -461,14 +457,6 @@ bool ED_undo_is_memfile_compatible(const bContext *C) return true; } -/** - * When a property of ID changes, return false. - * - * This is to avoid changes to a property making undo pushes - * which are ignored by the undo-system. - * For example, changing a brush property isn't stored by sculpt-mode undo steps. - * This workaround is needed until the limitation is removed, see: T61948. - */ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, ID *id) { ViewLayer *view_layer = CTX_data_view_layer(C); @@ -494,13 +482,6 @@ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, ID *id) return true; } -/** - * Ideally we won't access the stack directly, - * this is needed for modes which handle undo themselves (bypassing #ED_undo_push). - * - * Using global isn't great, this just avoids doing inline, - * causing 'BKE_global.h' & 'BKE_main.h' includes. - */ UndoStack *ED_undo_stack_get(void) { wmWindowManager *wm = G_MAIN->wm.first; @@ -682,7 +663,6 @@ void ED_OT_undo_redo(wmOperatorType *ot) /** \name Operator Repeat * \{ */ -/* ui callbacks should call this rather than calling WM_operator_repeat() themselves */ int ED_undo_operator_repeat(bContext *C, wmOperator *op) { int ret = 0; @@ -899,9 +879,6 @@ void ED_undo_object_set_active_or_warn( } } -/** - * Load all our objects from `object_array` into edit-mode, clear everything else. - */ void ED_undo_object_editmode_restore_helper(struct bContext *C, Object **object_array, uint object_array_len, diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index ad3b4162f89..b6ad5603808 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -325,7 +325,6 @@ static void memfile_undosys_step_free(UndoStep *us_p) BKE_memfile_undo_free(us->data); } -/* Export for ED_undo_sys. */ void ED_memfile_undosys_type(UndoType *ut) { ut->name = "Global Undo"; @@ -364,21 +363,6 @@ struct MemFile *ED_undosys_stack_memfile_get_active(UndoStack *ustack) return NULL; } -/** - * If the last undo step is a memfile one, find the first #MemFileChunk matching given ID - * (using its session UUID), and tag it as "changed in the future". - * - * Since non-memfile undo-steps cannot automatically set this flag in the previous step as done - * with memfile ones, this has to be called manually by relevant undo code. - * - * \note Only current known case for this is undoing a switch from Object to Sculpt mode (see - * T82388). - * - * \note Calling this ID by ID is not optimal, as it will loop over all #MemFile.chunks until it - * finds the expected one. If this becomes an issue we'll have to add a mapping from session UUID - * to first #MemFileChunk in #MemFile itself - * (currently we only do that in #MemFileWriteData when writing a new step). - */ void ED_undosys_stack_memfile_id_changed_tag(UndoStack *ustack, ID *id) { UndoStep *us = ustack->step_active; diff --git a/source/blender/editors/undo/undo_intern.h b/source/blender/editors/undo/undo_intern.h index 660f1a5b57d..d27bc1c8c0a 100644 --- a/source/blender/editors/undo/undo_intern.h +++ b/source/blender/editors/undo/undo_intern.h @@ -25,4 +25,6 @@ struct UndoType; /* memfile_undo.c */ + +/** Export for ED_undo_sys. */ void ED_memfile_undosys_type(struct UndoType *ut); diff --git a/source/blender/editors/util/ed_draw.c b/source/blender/editors/util/ed_draw.c index 721e32a3051..ccbde07f5b1 100644 --- a/source/blender/editors/util/ed_draw.c +++ b/source/blender/editors/util/ed_draw.c @@ -397,17 +397,11 @@ tSlider *ED_slider_create(struct bContext *C) return slider; } -/** - * For modal operations so the percentage doesn't pop on the first mouse movement. - */ void ED_slider_init(struct tSlider *slider, const wmEvent *event) { copy_v2fl_v2i(slider->last_cursor, event->xy); } -/** - * Calculate slider factor based on mouse position. - */ bool ED_slider_modal(tSlider *slider, const wmEvent *event) { bool event_handled = true; @@ -441,9 +435,6 @@ bool ED_slider_modal(tSlider *slider, const wmEvent *event) return event_handled; } -/** - * Return string based on the current state of the slider. - */ void ED_slider_status_string_get(const struct tSlider *slider, char *status_string, const size_t size_of_status_string) @@ -523,9 +514,6 @@ void ED_slider_allow_overshoot_set(struct tSlider *slider, const bool value) /** \} */ -/** - * Callback that draws a line between the mouse and a position given as the initial argument. - */ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *region, void *arg_info) { wmWindow *win = CTX_wm_window(C); @@ -776,9 +764,6 @@ static float metadata_box_height_get(ImBuf *ibuf, int fontid, const bool is_top) return 0; } -/** - * \note Keep in sync with #BKE_image_stamp_buf. - */ void ED_region_image_metadata_draw( int x, int y, ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy) { diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 348deec1166..8e94dc23085 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -195,7 +195,6 @@ void ED_editors_init(bContext *C) wm->op_undo_depth--; } -/* frees all editmode stuff */ void ED_editors_exit(Main *bmain, bool do_undo_system) { if (!bmain) { @@ -291,8 +290,6 @@ bool ED_editors_flush_edits_for_object(Main *bmain, Object *ob) return ED_editors_flush_edits_for_object_ex(bmain, ob, false, false); } -/* flush any temp data from object editing to DNA before writing files, - * rendering, copying, etc. */ bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush) { bool has_edited = false; @@ -317,11 +314,6 @@ bool ED_editors_flush_edits(Main *bmain) /* ***** XXX: functions are using old blender names, cleanup later ***** */ -/** - * Now only used in 2D spaces, like time, f-curve, NLA, image, etc. - * - * \note Shift/Control are not configurable key-bindings. - */ void apply_keyb_grid( int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert) { @@ -441,11 +433,6 @@ void unpack_menu(bContext *C, UI_popup_menu_end(C, pup); } -/** - * Use to free ID references within runtime data (stored outside of DNA) - * - * \param new_id: may be NULL to unlink \a old_id. - */ void ED_spacedata_id_remap(struct ScrArea *area, struct SpaceLink *sl, ID *old_id, ID *new_id) { SpaceType *st = BKE_spacetype_from_id(sl->spacetype); diff --git a/source/blender/editors/util/gizmo_utils.c b/source/blender/editors/util/gizmo_utils.c index 08e7b3a9a0a..99df194f0eb 100644 --- a/source/blender/editors/util/gizmo_utils.c +++ b/source/blender/editors/util/gizmo_utils.c @@ -70,7 +70,6 @@ bool ED_gizmo_poll_or_unlink_delayed_from_tool_ex(const bContext *C, return true; } -/** Can use this as poll function directly. */ bool ED_gizmo_poll_or_unlink_delayed_from_tool(const bContext *C, wmGizmoGroupType *gzgt) { return ED_gizmo_poll_or_unlink_delayed_from_tool_ex(C, gzgt, gzgt->idname); diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index d0f27770d9b..583e4060a9a 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -98,7 +98,6 @@ void initNumInput(NumInput *n) n->str_cur = 0; } -/* str must be NUM_STR_REP_LEN * (idx_max + 1) length. */ void outputNumInput(NumInput *n, char *str, UnitSettings *unit_settings) { short j; @@ -201,9 +200,6 @@ bool hasNumInput(const NumInput *n) return false; } -/** - * \warning \a vec must be set beforehand otherwise we risk uninitialized vars. - */ bool applyNumInput(NumInput *n, float *vec) { short i, j; diff --git a/source/blender/editors/util/select_utils.c b/source/blender/editors/util/select_utils.c index 99412079adf..c7bb26db1bd 100644 --- a/source/blender/editors/util/select_utils.c +++ b/source/blender/editors/util/select_utils.c @@ -26,7 +26,6 @@ #include "ED_select_utils.h" -/** 1: select, 0: deselect, -1: pass. */ int ED_select_op_action(const eSelectOp sel_op, const bool is_select, const bool is_inside) { switch (sel_op) { @@ -44,12 +43,6 @@ int ED_select_op_action(const eSelectOp sel_op, const bool is_select, const bool BLI_assert_msg(0, "invalid sel_op"); return -1; } -/** - * Use when we've de-selected all items first (for modes that need it). - * - * \note In some cases changing selection needs to perform other checks, - * so it's more straightforward to deselect all, then select. - */ int ED_select_op_action_deselected(const eSelectOp sel_op, const bool is_select, const bool is_inside) @@ -71,9 +64,6 @@ int ED_select_op_action_deselected(const eSelectOp sel_op, return -1; } -/** - * Utility to use for selection operations that run multiple times (circle select). - */ eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first) { if (sel_op == SEL_OP_SET) { diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index cd8fbd00316..1fa96a932ed 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -93,6 +93,15 @@ bool uv_find_nearest_edge_multi(struct Scene *scene, const float co[2], struct UvNearestHit *hit); +/** + * \param only_in_face: when true, only hit faces which `co` is inside. + * This gives users a result they might expect, especially when zoomed in. + * + * \note Concave faces can cause odd behavior, although in practice this isn't often an issue. + * The center can be outside the face, in this case the distance to the center + * could cause the face to be considered too far away. + * If this becomes an issue we could track the distance to the faces closest edge. + */ bool uv_find_nearest_face_ex(struct Scene *scene, struct Object *obedit, const float co[2], @@ -154,6 +163,10 @@ bool uvedit_select_is_any_selected(struct Scene *scene, struct Object *obedit); bool uvedit_select_is_any_selected_multi(struct Scene *scene, struct Object **objects, const uint objects_len); +/** + * \warning This returns first selected UV, + * not ideal in many cases since there could be multiple. + */ const float *uvedit_first_selected_uv_from_vertex(struct Scene *scene, struct BMVert *eve, const int cd_loop_uv_offset); diff --git a/source/blender/editors/uvedit/uvedit_islands.c b/source/blender/editors/uvedit/uvedit_islands.c index 6159758dbcd..63a7ab6ab2d 100644 --- a/source/blender/editors/uvedit/uvedit_islands.c +++ b/source/blender/editors/uvedit/uvedit_islands.c @@ -237,9 +237,6 @@ static void bm_face_array_uv_scale_y(BMFace **faces, /** \name UDIM packing helper functions * \{ */ -/** - * Returns true if UV coordinates lie on a valid tile in UDIM grid or tiled image. - */ bool uv_coords_isect_udim(const Image *image, const int udim_grid[2], const float coords[2]) { const float coords_floor[2] = {floorf(coords[0]), floorf(coords[1])}; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index acdffd5ff98..342afa847b4 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -253,7 +253,6 @@ bool ED_uvedit_minmax(const Scene *scene, Object *obedit, float r_min[2], float return ED_uvedit_minmax_multi(scene, &obedit, 1, r_min, r_max); } -/* Be careful when using this, it bypasses all synchronization options */ void ED_uvedit_select_all(BMesh *bm) { BMFace *efa; diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 86390882bed..72fd31503de 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -148,10 +148,6 @@ BMLoop *ED_uvedit_active_edge_loop_get(BMesh *bm) /** \name Visibility and Selection Utilities * \{ */ -/** - * Intentionally don't return #UV_SELECT_ISLAND as it's not an element type. - * In this case return #UV_SELECT_VERTEX as a fallback. - */ char ED_uvedit_select_mode_get(const Scene *scene) { const ToolSettings *ts = scene->toolsettings; @@ -719,15 +715,6 @@ bool uv_find_nearest_edge_multi( return found; } -/** - * \param only_in_face: when true, only hit faces which `co` is inside. - * This gives users a result they might expect, especially when zoomed in. - * - * \note Concave faces can cause odd behavior, although in practice this isn't often an issue. - * The center can be outside the face, in this case the distance to the center - * could cause the face to be considered too far away. - * If this becomes an issue we could track the distance to the faces closest edge. - */ bool uv_find_nearest_face_ex( Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit, const bool only_in_face) { @@ -1542,10 +1529,6 @@ static void uv_select_linked_multi(Scene *scene, } } -/** - * \warning This returns first selected UV, - * not ideal in many cases since there could be multiple. - */ const float *uvedit_first_selected_uv_from_vertex(Scene *scene, BMVert *eve, const int cd_loop_uv_offset) |