diff options
author | Julian Eisel <julian@blender.org> | 2022-11-10 15:17:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-11-10 15:17:42 +0300 |
commit | 7246c387435769a169ac24c91434c615df6434b4 (patch) | |
tree | 61842e3e0ce85e80720fdd7476d44d2e629f59fd /source/blender/editors/include | |
parent | c5f55d17096d373791363e46004176e3f7f7ae52 (diff) | |
parent | 0b4bd3ddc016298e868169a541cf6c132b10c587 (diff) |
Merge branch 'master' into asset-browser-grid-viewasset-browser-grid-view
Diffstat (limited to 'source/blender/editors/include')
23 files changed, 304 insertions, 121 deletions
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index ee87de5774a..8fe2d0ae60f 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -101,16 +101,16 @@ typedef struct bAnimContext { /* Main Data container types */ typedef enum eAnimCont_Types { ANIMCONT_NONE = 0, /* invalid or no data */ - ANIMCONT_ACTION = 1, /* action (bAction) */ - ANIMCONT_SHAPEKEY = 2, /* shapekey (Key) */ + ANIMCONT_ACTION = 1, /* action (#bAction) */ + ANIMCONT_SHAPEKEY = 2, /* shape-key (#Key) */ ANIMCONT_GPENCIL = 3, /* grease pencil (screen) */ - ANIMCONT_DOPESHEET = 4, /* dopesheet (bDopesheet) */ - ANIMCONT_FCURVES = 5, /* animation F-Curves (bDopesheet) */ - ANIMCONT_DRIVERS = 6, /* drivers (bDopesheet) */ - ANIMCONT_NLA = 7, /* nla (bDopesheet) */ - ANIMCONT_CHANNEL = 8, /* animation channel (bAnimListElem) */ - ANIMCONT_MASK = 9, /* mask dopesheet */ - ANIMCONT_TIMELINE = 10, /* "timeline" editor (bDopeSheet) */ + ANIMCONT_DOPESHEET = 4, /* dope-sheet (#bDopesheet) */ + ANIMCONT_FCURVES = 5, /* animation F-Curves (#bDopesheet) */ + ANIMCONT_DRIVERS = 6, /* drivers (#bDopesheet) */ + ANIMCONT_NLA = 7, /* NLA (#bDopesheet) */ + ANIMCONT_CHANNEL = 8, /* animation channel (#bAnimListElem) */ + ANIMCONT_MASK = 9, /* mask dope-sheet */ + ANIMCONT_TIMELINE = 10, /* "timeline" editor (#bDopeSheet) */ } eAnimCont_Types; /** \} */ @@ -519,6 +519,11 @@ void ANIM_animdata_update(bAnimContext *ac, ListBase *anim_data); void ANIM_animdata_freelist(ListBase *anim_data); +/** + * Check if the given animation container can contain grease pencil layer keyframes. + */ +bool ANIM_animdata_can_have_greasepencil(const eAnimCont_Types type); + /* ************************************************ */ /* ANIMATION CHANNELS LIST */ /* anim_channels_*.c */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index d969277fef5..8e7f728a3e7 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -312,7 +312,8 @@ void ED_pose_recalculate_paths(struct bContext *C, /** * \return True when pick finds an element or the selection changed. */ -bool ED_armature_pose_select_pick_bone(struct ViewLayer *view_layer, +bool ED_armature_pose_select_pick_bone(const struct Scene *scene, + struct ViewLayer *view_layer, struct View3D *v3d, struct Object *ob, struct Bone *bone, @@ -323,7 +324,8 @@ bool ED_armature_pose_select_pick_bone(struct ViewLayer *view_layer, * * \return True when pick finds an element or the selection changed. */ -bool ED_armature_pose_select_pick_with_buffer(struct ViewLayer *view_layer, +bool ED_armature_pose_select_pick_with_buffer(const struct Scene *scene, + struct ViewLayer *view_layer, struct View3D *v3d, struct Base *base, const struct GPUSelectResult *buffer, @@ -338,7 +340,8 @@ bool ED_armature_pose_select_pick_with_buffer(struct ViewLayer *view_layer, * It can't be set to the active object because we need * to keep this set to the weight paint object. */ -void ED_armature_pose_select_in_wpaint_mode(struct ViewLayer *view_layer, +void ED_armature_pose_select_in_wpaint_mode(const struct Scene *scene, + struct ViewLayer *view_layer, struct Base *base_select); bool ED_pose_deselect_all_multi_ex(struct Base **bases, uint bases_len, diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index bf021d68cec..45e61592424 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -475,7 +475,8 @@ void ED_gpencil_stroke_reproject(struct Depsgraph *depsgraph, struct bGPDframe *gpf, struct bGPDstroke *gps, eGP_ReprojectModes mode, - bool keep_original); + bool keep_original, + const float offset); /** * Turn brush cursor in on/off. diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 91ae8286531..20e62ac8626 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -32,14 +32,15 @@ struct wmWindowManager; float ED_space_image_zoom_level(const struct View2D *v2d, int grid_dimension); void ED_space_image_grid_steps(struct SpaceImage *sima, - float grid_steps[SI_GRID_STEPS_LEN], + float grid_steps_x[SI_GRID_STEPS_LEN], + float grid_steps_y[SI_GRID_STEPS_LEN], 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(int grid_dimesnions, +float ED_space_image_increment_snap_value(int grid_dimensions, const float grid_steps[SI_GRID_STEPS_LEN], float zoom_factor); @@ -50,6 +51,7 @@ void ED_space_image_set(struct Main *bmain, struct SpaceImage *sima, struct Image *ima, bool automatic); +void ED_space_image_sync(struct Main *bmain, Image *image, bool ignore_render_viewer); 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); diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index 1d63e01c84b..e5bcdcdd282 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -235,7 +235,7 @@ typedef enum eKeyPasteError { KEYFRAME_PASTE_OK, /* Nothing was copied */ KEYFRAME_PASTE_NOTHING_TO_PASTE, - /* No F-curves was selected to paste into*/ + /* No F-curves was selected to paste into. */ KEYFRAME_PASTE_NOWHERE_TO_PASTE } eKeyPasteError; diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 26743a2bd08..52527f6c1b8 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -142,12 +142,15 @@ struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, bool use_seams, bool do_islands); void BM_uv_element_map_free(struct UvElementMap *element_map); -struct UvElement *BM_uv_element_get(const struct UvElementMap *map, +struct UvElement *BM_uv_element_get(const struct UvElementMap *element_map, const struct BMFace *efa, const struct BMLoop *l); -struct UvElement *BM_uv_element_get_head(struct UvElementMap *map, struct UvElement *child); +struct UvElement *BM_uv_element_get_head(struct UvElementMap *element_map, + struct UvElement *child); +int BM_uv_element_get_unique_index(struct UvElementMap *element_map, struct UvElement *child); struct UvElement **BM_uv_element_map_ensure_head_table(struct UvElementMap *element_map); +int *BM_uv_element_map_ensure_unique_index(struct UvElementMap *element_map); /** * Can we edit UV's for this mesh? @@ -192,12 +195,12 @@ void EDBM_automerge_and_split(struct Object *obedit, char hflag, float dist); -/* editmesh_undo.c */ +/* editmesh_undo.cc */ /** Export for ED_undo_sys. */ void ED_mesh_undosys_type(struct UndoType *ut); -/* editmesh_select.c */ +/* editmesh_select.cc */ void EDBM_select_mirrored(struct BMEditMesh *em, const struct Mesh *me, diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index c30b8c5ec6a..24e14fdce72 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -87,17 +87,6 @@ void ED_node_tag_update_id(struct ID *id); float ED_node_grid_size(void); -/* node_relationships.cc */ - -/** - * 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.cc */ void ED_node_set_tree_type(struct SpaceNode *snode, struct bNodeTreeType *typeinfo); @@ -186,3 +175,20 @@ bool ED_space_node_color_sample(struct Main *bmain, #ifdef __cplusplus } #endif + +#ifdef __cplusplus + +/* node_relationships.cc */ + +namespace blender::ed::space_node { + +void node_insert_on_link_flags_set(SpaceNode &snode, const ARegion ®ion); +/** + * Assumes link with #NODE_LINKFLAG_HILITE set. + */ +void node_insert_on_link_flags(Main &bmain, SpaceNode &snode); +void node_insert_on_link_flags_clear(bNodeTree &node_tree); + +} // namespace blender::ed::space_node + +#endif
\ No newline at end of file diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 39c7ad3556c..acb0e53aa55 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -112,6 +112,7 @@ struct XFormObjectSkipChild_Container; struct XFormObjectSkipChild_Container *ED_object_xform_skip_child_container_create(void); void ED_object_xform_skip_child_container_item_ensure_from_array( struct XFormObjectSkipChild_Container *xcs, + const struct Scene *scene, struct ViewLayer *view_layer, struct Object **objects, uint objects_len); @@ -213,16 +214,20 @@ void ED_object_base_free_and_unlink(struct Main *bmain, struct Scene *scene, str void ED_object_base_free_and_unlink_no_indirect_check(struct Main *bmain, struct Scene *scene, struct Object *ob); -bool ED_object_base_deselect_all_ex(struct ViewLayer *view_layer, +bool ED_object_base_deselect_all_ex(const struct Scene *scene, + struct ViewLayer *view_layer, struct View3D *v3d, int action, bool *r_any_visible); -bool ED_object_base_deselect_all(struct ViewLayer *view_layer, struct View3D *v3d, int action); +bool ED_object_base_deselect_all(const struct Scene *scene, + struct ViewLayer *view_layer, + struct View3D *v3d, + int action); /** * 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 don't call this within a loop since clear_* functions 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. */ @@ -539,6 +544,7 @@ bool ED_object_modifier_move_to_index(struct ReportList *reports, bool ED_object_modifier_convert_psys_to_mesh(struct ReportList *reports, struct Main *bmain, struct Depsgraph *depsgraph, + struct Scene *scene, struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md); @@ -662,7 +668,9 @@ void ED_object_check_force_modifiers(struct Main *bmain, * 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); +struct Base *ED_object_find_first_by_data_id(const struct Scene *scene, + struct ViewLayer *view_layer, + struct ID *id); /** * Select and make the target object active in the view layer. diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index eeed1c9b286..e1fd53ccdee 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -353,8 +353,8 @@ struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct ScrArea *area, short state); /** - * Wrapper to open a temporary space either as fullscreen space, or as separate window, as defined - * by \a display_type. + * Wrapper to open a temporary space either as full-screen 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. @@ -469,6 +469,8 @@ bool ED_workspace_layout_cycle(struct WorkSpace *workspace, short direction, str void ED_workspace_status_text(struct bContext *C, const char *str); +void ED_workspace_do_listen(struct bContext *C, const struct wmNotifier *note); + /* anim */ /** * Results in fully updated anim system. diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index 21bb412d072..bf64be9f7a7 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -112,7 +112,7 @@ enum { */ AZONE_REGION, /** - * Used when in editor fullscreen draw a corner to return to normal mode. + * Used when in editor full-screen draw a corner to return to normal mode. */ AZONE_FULLSCREEN, /** diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 1e220d33ff4..1c1ce41ef7a 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -34,7 +34,10 @@ bool ED_sculpt_mask_box_select(struct bContext *C, /* 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, const char *undo_name); +void ED_sculpt_init_transform(struct bContext *C, + struct Object *ob, + const int mval[2], + const char *undo_name); void ED_sculpt_end_transform(struct bContext *C, struct Object *ob); /* sculpt_undo.c */ diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index c1968ab49c1..49c7d1e954a 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -51,7 +51,7 @@ void ED_spacetype_spreadsheet(void); /** \} */ /* -------------------------------------------------------------------- */ -/** \name Spacetype Static Data +/** \name Space-type Static Data * Calls for instancing and freeing space-type static data called in #WM_init_exit * \{ */ diff --git a/source/blender/editors/include/ED_spreadsheet.h b/source/blender/editors/include/ED_spreadsheet.h index da13e6d3636..736da367a44 100644 --- a/source/blender/editors/include/ED_spreadsheet.h +++ b/source/blender/editors/include/ED_spreadsheet.h @@ -7,7 +7,6 @@ struct Main; struct Object; struct SpaceNode; struct SpaceSpreadsheet; -struct SpreadsheetContext; struct bContext; struct bNode; @@ -15,29 +14,8 @@ struct bNode; extern "C" { #endif -struct SpreadsheetContext *ED_spreadsheet_context_new(int type); -void ED_spreadsheet_context_free(struct SpreadsheetContext *context); -void ED_spreadsheet_context_path_clear(struct SpaceSpreadsheet *sspreadsheet); -bool ED_spreadsheet_context_path_update_tag(struct SpaceSpreadsheet *sspreadsheet); -uint64_t ED_spreadsheet_context_path_hash(const struct SpaceSpreadsheet *sspreadsheet); - struct ID *ED_spreadsheet_get_current_id(const struct SpaceSpreadsheet *sspreadsheet); -void ED_spreadsheet_context_path_set_geometry_node(struct SpaceSpreadsheet *sspreadsheet, - struct SpaceNode *snode, - struct bNode *node); -void ED_spreadsheet_context_paths_set_geometry_node(struct Main *bmain, - struct SpaceNode *snode, - struct bNode *node); -void ED_spreadsheet_context_path_set_evaluated_object(struct SpaceSpreadsheet *sspreadsheet, - struct Object *object); - -void ED_spreadsheet_context_path_guess(const struct bContext *C, - struct SpaceSpreadsheet *sspreadsheet); -bool ED_spreadsheet_context_path_is_active(const struct bContext *C, - struct SpaceSpreadsheet *sspreadsheet); -bool ED_spreadsheet_context_path_exists(struct Main *bmain, struct SpaceSpreadsheet *sspreadsheet); - #ifdef __cplusplus } #endif diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 82cc518f029..d7fb108809f 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -94,7 +94,8 @@ bool BIF_createTransformOrientation(struct bContext *C, bool overwrite); void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *target); -void ED_getTransformOrientationMatrix(struct ViewLayer *view_layer, +void ED_getTransformOrientationMatrix(const struct Scene *scene, + struct ViewLayer *view_layer, const struct View3D *v3d, struct Object *ob, struct Object *obedit, diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h index 8c5f25e6b67..39bbd8adc75 100644 --- a/source/blender/editors/include/ED_undo.h +++ b/source/blender/editors/include/ED_undo.h @@ -15,6 +15,7 @@ extern "C" { struct Base; struct CLG_LogRef; struct Object; +struct Scene; struct UndoStack; struct ViewLayer; struct bContext; @@ -79,9 +80,12 @@ void ED_undo_object_editmode_restore_helper(struct bContext *C, uint object_array_len, uint object_array_stride); -struct Object **ED_undo_editmode_objects_from_view_layer(struct ViewLayer *view_layer, +struct Object **ED_undo_editmode_objects_from_view_layer(const struct Scene *scene, + struct ViewLayer *view_layer, uint *r_len); -struct Base **ED_undo_editmode_bases_from_view_layer(struct ViewLayer *view_layer, uint *r_len); +struct Base **ED_undo_editmode_bases_from_view_layer(const struct Scene *scene, + struct ViewLayer *view_layer, + uint *r_len); /** * Ideally we won't access the stack directly, diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 38e542fc0ca..5fea8711a84 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -73,8 +73,8 @@ bool ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **r_ima, struct ImageUser **r_iuser, - struct bNode **r_node, - struct bNodeTree **r_ntree); + const struct bNode **r_node, + const struct bNodeTree **r_ntree); void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, @@ -107,7 +107,7 @@ bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_l * Changes selection state of a single UV Face. */ void uvedit_face_select_set(const struct Scene *scene, - struct BMesh *em, + struct BMesh *bm, struct BMFace *efa, bool select, bool do_history, @@ -118,7 +118,7 @@ void uvedit_face_select_set(const struct Scene *scene, * Changes selection state of a single UV Edge. */ void uvedit_edge_select_set(const struct Scene *scene, - struct BMesh *em, + struct BMesh *bm, struct BMLoop *l, bool select, bool do_history, @@ -129,7 +129,7 @@ void uvedit_edge_select_set(const struct Scene *scene, * Changes selection state of a single UV vertex. */ void uvedit_uv_select_set(const struct Scene *scene, - struct BMesh *em, + struct BMesh *bm, struct BMLoop *l, bool select, bool do_history, @@ -339,14 +339,22 @@ bool ED_uvedit_udim_params_from_image_space(const struct SpaceImage *sima, bool use_active, struct UVMapUDIM_Params *udim_params); +typedef enum { + ED_UVPACK_MARGIN_SCALED = 0, /* Use scale of existing UVs to multiply margin. */ + ED_UVPACK_MARGIN_ADD, /* Just add the margin, ignoring any UV scale. */ + ED_UVPACK_MARGIN_FRACTION, /* Specify a precise fraction of final UV output. */ +} eUVPackIsland_MarginMethod; + +/** See also #UnwrapOptions. */ struct UVPackIsland_Params { uint rotate : 1; - /** -1 not to align to axis, otherwise 0,1 for X,Y. */ - int rotate_align_axis : 2; uint only_selected_uvs : 1; uint only_selected_faces : 1; uint use_seams : 1; uint correct_aspect : 1; + bool ignore_pinned; /* Ignore islands which have any pinned UVs. */ + eUVPackIsland_MarginMethod margin_method; /* Which formula to use when scaling island margin. */ + float margin; /* Additional space to add around each island. */ }; /** @@ -355,9 +363,24 @@ struct UVPackIsland_Params { bool uv_coords_isect_udim(const struct Image *image, const int udim_grid[2], const float coords[2]); + +/** + * Pack UV islands from multiple objects. + * + * \param scene: Scene containing the objects to be packed. + * \param objects: Array of Objects to pack. + * \param objects_len: Length of `objects` array. + * \param bmesh_override: BMesh array aligned with `objects`. + * Optional, when non-null this overrides object's BMesh. + * This is needed to perform UV packing on objects that aren't in edit-mode. + * \param udim_params: Parameters to specify UDIM target and UDIM source image. + * \param params: Parameters and options to pass to the packing engine. + * + */ void ED_uvedit_pack_islands_multi(const struct Scene *scene, Object **objects, uint objects_len, + struct BMesh **bmesh_override, const struct UVMapUDIM_Params *udim_params, const struct UVPackIsland_Params *params); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index c72f3121217..52aa5f56fee 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -228,6 +228,7 @@ typedef enum { /** outside range (mainly for short), (can't avoid) */ V3D_PROJ_RET_OVERFLOW = 6, } eV3DProjStatus; +ENUM_OPERATORS(eV3DProjStatus, V3D_PROJ_RET_OVERFLOW); /* some clipping tests are optional */ typedef enum { @@ -350,7 +351,7 @@ void ED_view3d_cursor_snap_draw_util(struct RegionView3D *rv3d, const uchar color_point[4], eSnapMode snap_elem_type); -/* view3d_iterators.c */ +/* view3d_iterators.cc */ /* foreach iterators */ @@ -456,7 +457,9 @@ void ED_view3d_project_float_v3_m4(const struct ARegion *region, float r_co[3], const float mat[4][4]); -eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct Base *base); +eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, + struct Base *base, + float r_co[2]); /* *** short *** */ eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *region, @@ -1311,7 +1314,7 @@ void ED_view3d_draw_bgpic_test(const struct Scene *scene, bool do_foreground, bool do_camera_frame); -/* view3d_gizmo_preselect_type.c */ +/* view3d_gizmo_preselect_type.cc */ void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C, struct wmGizmo *gz, @@ -1319,7 +1322,7 @@ void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C, struct BMElem **r_ele); void ED_view3d_gizmo_mesh_preselect_clear(struct wmGizmo *gz); -/* space_view3d.c */ +/* space_view3d.cc */ void ED_view3d_buttons_region_layout_ex(const struct bContext *C, struct ARegion *region, diff --git a/source/blender/editors/include/ED_viewer_path.hh b/source/blender/editors/include/ED_viewer_path.hh new file mode 100644 index 00000000000..957dfddb8af --- /dev/null +++ b/source/blender/editors/include/ED_viewer_path.hh @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include <optional> + +#include "BLI_string_ref.hh" +#include "BLI_vector.hh" + +#include "BKE_viewer_path.h" + +struct Main; +struct SpaceNode; +struct bNode; +struct bContext; +struct Object; + +namespace blender::ed::viewer_path { + +/** + * Activates the given node in the context provided by the editor. This indirectly updates all + * non-pinned viewer paths in other editors (spreadsheet and 3d view). + */ +void activate_geometry_node(Main &bmain, SpaceNode &snode, bNode &node); + +/** + * Returns the object referenced by the viewer path. This only returns something if the viewer path + * *only* contains the object and nothing more. + */ +Object *parse_object_only(const ViewerPath &viewer_path); + +/** + * Represents a parsed #ViewerPath for easier consumption. + */ +struct ViewerPathForGeometryNodesViewer { + Object *object; + blender::StringRefNull modifier_name; + blender::Vector<blender::StringRefNull> group_node_names; + blender::StringRefNull viewer_node_name; +}; + +/** + * Parses a #ViewerPath into a #ViewerPathForGeometryNodesViewer or returns none if that does not + * work. + */ +std::optional<ViewerPathForGeometryNodesViewer> parse_geometry_nodes_viewer( + const ViewerPath &viewer_path); + +/** + * Finds the node referenced by the #ViewerPath within the provided editor. If no node is + * referenced, null is returned. When two different editors show the same node group but in a + * different context, it's possible that the same node is active in one editor but not the other. + */ +bNode *find_geometry_nodes_viewer(const ViewerPath &viewer_path, SpaceNode &snode); + +/** + * Checks if the node referenced by the viewer path and its entire context still exists. The node + * does not have to be visible for this to return true. + */ +bool exists_geometry_nodes_viewer(const ViewerPathForGeometryNodesViewer &parsed_viewer_path); + +/** + * Checks if the node referenced by the viewer and its entire context is still active, i.e. some + * editor is showing it. + */ +bool is_active_geometry_nodes_viewer(const bContext &C, + const ViewerPathForGeometryNodesViewer &parsed_viewer_path); + +} // namespace blender::ed::viewer_path diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 09057fd846e..31c766e95f2 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -472,8 +472,8 @@ DEF_ICON_BLANK(742) DEF_ICON_BLANK(743) DEF_ICON_MODIFIER(CON_ACTION) DEF_ICON_BLANK(745) -DEF_ICON_BLANK(746) -DEF_ICON_BLANK(747) +DEF_ICON_MODIFIER(MOD_ENVELOPE) +DEF_ICON_MODIFIER(MOD_OUTLINE) DEF_ICON_MODIFIER(MOD_LENGTH) DEF_ICON_MODIFIER(MOD_DASH) DEF_ICON_MODIFIER(MOD_LINEART) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 27e2f89f684..415356d1d71 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -133,6 +133,8 @@ enum { /** #uiBlock.flag (controls) */ enum { UI_BLOCK_LOOP = 1 << 0, + /** Indicate that items in a popup are drawn with inverted order. Used for arrow key navigation + * so that it knows to invert the navigation direction to match the drawing order. */ UI_BLOCK_IS_FLIP = 1 << 1, UI_BLOCK_NO_FLIP = 1 << 2, UI_BLOCK_NUMSELECT = 1 << 3, @@ -532,6 +534,7 @@ typedef struct ARegion *(*uiButSearchTooltipFn)(struct bContext *C, const struct rcti *item_rect, void *arg, void *active); +typedef void (*uiButSearchListenFn)(const struct wmRegionListenerParams *params, void *arg); /* Must return allocated string. */ typedef char *(*uiButToolTipFunc)(struct bContext *C, void *argN, const char *tip); @@ -783,6 +786,9 @@ 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); + +void UI_block_listen(const uiBlock *block, const struct wmRegionListenerParams *listener_params); + /** * Can be called with C==NULL. */ @@ -1392,6 +1398,7 @@ void UI_but_extra_icon_string_info_get(struct bContext *C, uiButExtraOpIcon *ext * - AutoButR: RNA property button with type automatically defined. */ enum { + UI_ID_NOP = 0, UI_ID_RENAME = 1 << 0, UI_ID_BROWSE = 1 << 1, UI_ID_ADD_NEW = 1 << 2, @@ -1659,6 +1666,7 @@ 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); +void UI_but_func_search_set_listen(uiBut *but, uiButSearchListenFn listen_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. @@ -1680,6 +1688,7 @@ 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_icon_indicator_number_set(uiBut *but, const int indicator_number); void UI_but_node_link_set(uiBut *but, struct bNodeSocket *socket, const float draw_color[4]); @@ -1780,7 +1789,6 @@ void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, float scale); void UI_but_drag_set_asset(uiBut *but, const struct AssetHandle *asset, const char *path, - struct AssetMetaData *metadata, int import_type, /* eFileAssetImportType */ int icon, struct ImBuf *imb, @@ -2521,6 +2529,7 @@ void uiTemplateNodeView(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); +void uiTemplateNodeAssetMenuItems(uiLayout *layout, struct bContext *C, const char *catalog_path); void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); /** * Button to quickly show texture in Properties Editor texture tab. @@ -2785,7 +2794,8 @@ typedef struct uiPropertySplitWrapper { 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, bool highlight, bool redalert); +struct uiBut *uiItemL_ex( + uiLayout *layout, const char *name, int icon, bool highlight, bool redalert); /** * Helper to add a label and creates a property split layout if needed. */ @@ -3192,9 +3202,6 @@ void UI_interface_tag_script_reload(void); /* Support click-drag motion which presses the button and closes a popover (like a menu). */ #define USE_UI_POPOVER_ONCE -void UI_block_views_listen(const uiBlock *block, - const struct wmRegionListenerParams *listener_params); - bool UI_view_item_is_active(const uiViewItemHandle *item_handle); bool UI_view_item_matches(const uiViewItemHandle *a_handle, const uiViewItemHandle *b_handle); /** diff --git a/source/blender/editors/include/UI_interface.hh b/source/blender/editors/include/UI_interface.hh index 6c756984203..fc03b0218c0 100644 --- a/source/blender/editors/include/UI_interface.hh +++ b/source/blender/editors/include/UI_interface.hh @@ -35,6 +35,7 @@ struct ContextPathItem { std::string name; /* #BIFIconID */ int icon; + int icon_indicator_number; }; void context_path_add_generic(Vector<ContextPathItem> &path, diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index a1a98a4b08c..9669e242dac 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -27,6 +27,12 @@ typedef struct IconFile { int index; } IconFile; +typedef struct IconTextOverlay { + char text[5]; +} IconTextOverlay; + +#define UI_NO_ICON_OVERLAY_TEXT NULL + #define ICON_DEFAULT_HEIGHT 16 #define ICON_DEFAULT_WIDTH 16 @@ -105,7 +111,8 @@ void UI_icon_draw_ex(float x, float alpha, float desaturate, const uchar mono_color[4], - bool mono_border); + bool mono_border, + const struct IconTextOverlay *text_overlay); void UI_icons_free(void); void UI_icons_free_drawinfo(void *drawinfo); @@ -124,6 +131,9 @@ int UI_icon_from_library(const struct ID *id); int UI_icon_from_object_mode(int mode); int UI_icon_color_from_collection(const struct Collection *collection); +void UI_icon_text_overlay_init_from_count(struct IconTextOverlay *text_overlay, + const int icon_indicator_number); + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index e508c96b4f1..f0bf04ed408 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -16,37 +16,39 @@ extern "C" { #endif -/* ------------------------------------------ */ -/* Settings and Defines: */ +/* -------------------------------------------------------------------- */ +/** \name General Defines + * \{ */ -/* ---- General Defines ---- */ - -/* generic value to use when coordinate lies out of view when converting */ +/** Generic value to use when coordinate lies out of view when converting. */ #define V2D_IS_CLIPPED 12000 -/* Common View2D view types - * NOTE: only define a type here if it completely sets all (+/- a few) of the relevant flags - * and settings for a View2D region, and that set of settings is used in more - * than one specific place +/** + * Common View2D view types. + * + * \note only define a type here if it completely sets all (+/- a few) of the relevant flags and + * settings for a View2D region, and that set of settings is used in more than one specific place. */ enum eView2D_CommonViewTypes { - /* custom view type (region has defined all necessary flags already) */ + /** custom view type (region has defined all necessary flags already). */ V2D_COMMONVIEW_CUSTOM = -1, - /* standard (only use this when setting up a new view, as a sensible base for most settings) */ + /** standard (only use this when setting up a new view, as a sensible base for most settings). */ V2D_COMMONVIEW_STANDARD, - /* listview (i.e. Outliner) */ + /** List-view (i.e. Outliner). */ V2D_COMMONVIEW_LIST, - /* Stack-view (this is basically a list where new items are added at the top). */ + /** Stack-view (this is basically a list where new items are added at the top). */ V2D_COMMONVIEW_STACK, - /* headers (this is basically the same as listview, but no y-panning) */ + /** headers (this is basically the same as list-view, but no Y-panning). */ V2D_COMMONVIEW_HEADER, - /* ui region containing panels */ + /** UI region containing panels. */ V2D_COMMONVIEW_PANELS_UI, }; -/* ---- Defines for Scroller Arguments ----- */ +/** \} */ -/* ------ Defines for Scrollers ----- */ +/* -------------------------------------------------------------------- */ +/** \name Defines for Scroll Bars + * \{ */ /** Scroll bar area. */ @@ -54,7 +56,7 @@ enum eView2D_CommonViewTypes { #define V2D_SCROLL_HEIGHT ((0.45f * U.widget_unit) + (2.0f * U.pixelsize)) #define V2D_SCROLL_WIDTH ((0.45f * U.widget_unit) + (2.0f * U.pixelsize)) -/* Alpha of scrollbar when at minimum size. */ +/* Alpha of scroll-bar when at minimum size. */ #define V2D_SCROLL_MIN_ALPHA (0.4f) /* Minimum size needs to include outline which varies with line width. */ @@ -74,25 +76,35 @@ enum eView2D_CommonViewTypes { /** Don't allow scroll thumb to show below this size (so it's never too small to click on). */ #define V2D_SCROLL_THUMB_SIZE_MIN (30.0 * UI_DPI_FAC) -/* ------ Define for UI_view2d_sync ----- */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Define for #UI_view2d_sync + * \{ */ /* means copy it from another v2d */ #define V2D_LOCK_SET 0 /* means copy it to the other v2ds */ #define V2D_LOCK_COPY 1 -/* ------------------------------------------ */ -/* Macros: */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Macros + * \{ */ -/* test if mouse in a scrollbar (assume that scroller availability has been tested) */ +/* Test if mouse in a scroll-bar (assume that scroller availability has been tested). */ #define IN_2D_VERT_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->vert, co)) #define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->hor, co)) #define IN_2D_VERT_SCROLL_RECT(v2d, rct) (BLI_rcti_isect(&v2d->vert, rct, NULL)) #define IN_2D_HORIZ_SCROLL_RECT(v2d, rct) (BLI_rcti_isect(&v2d->hor, rct, NULL)) -/* ------------------------------------------ */ -/* Type definitions: */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Forward Declarations + * \{ */ struct View2D; struct View2DScrollers; @@ -112,8 +124,11 @@ struct wmOperatorType; typedef struct View2DScrollers View2DScrollers; -/* ----------------------------------------- */ -/* Prototypes: */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Prototypes + * \{ */ /** * Refresh and validation (of view rects). @@ -161,7 +176,12 @@ void UI_view2d_mask_from_win(const struct View2D *v2d, struct rcti *r_mask); void UI_view2d_zoom_cache_reset(void); -/* view matrix operations */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name View Matrix Operations + * \{ */ + /** * Set view matrices to use 'cur' rect as viewing frame for View2D drawing. */ @@ -178,7 +198,11 @@ void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, boo */ void UI_view2d_view_restore(const struct bContext *C); -/* grid drawing */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Grid Drawing + * \{ */ /** * Draw a multi-level grid in given 2d-region. @@ -241,7 +265,11 @@ void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region, bool display_seconds, int colorid); -/* Scroll-bar drawing. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Scroll-bar Drawing + * \{ */ /** * Calculate relevant scroller properties. @@ -258,7 +286,11 @@ void UI_view2d_scrollers_draw_ex(struct View2D *v2d, bool use_full_hide); void UI_view2d_scrollers_draw(struct View2D *v2d, const struct rcti *mask_custom); -/* List view tools. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name List View Tools + * \{ */ /** * Get the 'cell' (row, column) that the given 2D-view coordinates @@ -281,7 +313,11 @@ void UI_view2d_listview_view_to_cell(float columnwidth, int *r_column, int *r_row); -/* Coordinate conversion. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name 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); @@ -338,7 +374,11 @@ bool UI_view2d_view_to_region_rcti_clip(const struct View2D *v2d, const struct rctf *rect_src, struct rcti *rect_dst) ATTR_NONNULL(); -/* Utilities. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Utilities + * \{ */ /** * View2D data by default resides in region, so get from region stored in context. @@ -350,8 +390,8 @@ struct View2D *UI_view2d_fromcontext(const struct bContext *C); 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. + * Get scroll-bar sizes of the current 2D view. + * The size will be zero if the view has its scroll-bars disabled. * * \param mapped: whether to use view2d_scroll_mapped which changes flags */ @@ -432,7 +472,11 @@ 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. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Operators + * \{ */ void ED_operatortypes_view2d(void); void ED_keymap_view2d(struct wmKeyConfig *keyconf); @@ -449,7 +493,11 @@ void UI_view2d_smooth_view(const struct bContext *C, #define UI_MARKER_MARGIN_Y (42 * UI_DPI_FAC) #define UI_TIME_SCRUB_MARGIN_Y (23 * UI_DPI_FAC) -/* Gizmo Types. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Gizmo Types + * \{ */ /* view2d_gizmo_navigate.c */ @@ -458,7 +506,11 @@ void UI_view2d_smooth_view(const struct bContext *C, */ void VIEW2D_GGT_navigate_impl(struct wmGizmoGroupType *gzgt, const char *idname); -/* Edge pan. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edge Pan + * \{ */ /** * Custom-data for view panning operators. @@ -559,6 +611,8 @@ void UI_view2d_edge_pan_operator_init(struct bContext *C, struct View2DEdgePanData *vpd, struct wmOperator *op); +/** \} */ + #ifdef __cplusplus } #endif |