From 5ebebcfbfff4c218ab4101ee7f6a66617ee9b01f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Jul 2018 23:49:00 +0200 Subject: WM: rename manipulator to gizmo internally --- source/blender/blenkernel/BKE_context.h | 4 +- source/blender/blenkernel/BKE_screen.h | 14 +- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenkernel/intern/blendfile.c | 2 +- source/blender/blenkernel/intern/constraint.c | 4 +- source/blender/blenkernel/intern/context.c | 10 +- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/screen.c | 30 +- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/blenloader/intern/versioning_280.c | 4 +- source/blender/bmesh/intern/bmesh_marking.c | 4 +- source/blender/bmesh/intern/bmesh_polygon.c | 2 +- source/blender/draw/intern/draw_manager.c | 8 +- source/blender/draw/intern/draw_view.c | 22 +- source/blender/draw/intern/draw_view.h | 4 +- source/blender/draw/modes/pose_mode.c | 2 +- .../gizmo_library/geometry/geom_arrow_gizmo.c | 2 +- .../gizmo_library/geometry/geom_cube_gizmo.c | 2 +- .../gizmo_library/geometry/geom_dial_gizmo.c | 2 +- .../editors/gizmo_library/gizmo_draw_utils.c | 10 +- .../blender/editors/gizmo_library/gizmo_geometry.h | 22 +- .../editors/gizmo_library/gizmo_library_intern.h | 56 +- .../editors/gizmo_library/gizmo_library_presets.c | 44 +- .../editors/gizmo_library/gizmo_library_utils.c | 78 +-- .../gizmo_library/gizmo_types/arrow2d_gizmo.c | 56 +- .../gizmo_library/gizmo_types/arrow3d_gizmo.c | 246 ++++---- .../gizmo_library/gizmo_types/button2d_gizmo.c | 76 +-- .../gizmo_library/gizmo_types/cage2d_gizmo.c | 322 +++++----- .../gizmo_library/gizmo_types/cage3d_gizmo.c | 214 +++---- .../gizmo_library/gizmo_types/dial3d_gizmo.c | 128 ++-- .../gizmo_library/gizmo_types/grab3d_gizmo.c | 144 ++--- .../gizmo_library/gizmo_types/primitive3d_gizmo.c | 76 +-- source/blender/editors/include/ED_gizmo_library.h | 206 +++---- source/blender/editors/include/ED_transform.h | 20 +- source/blender/editors/include/UI_interface.h | 4 +- source/blender/editors/include/UI_resources.h | 10 +- .../editors/interface/interface_region_tooltip.c | 14 +- source/blender/editors/interface/resources.c | 28 +- source/blender/editors/mesh/editmesh_add_gizmo.c | 138 ++--- source/blender/editors/mesh/editmesh_bevel.c | 2 +- source/blender/editors/mesh/editmesh_bisect.c | 180 +++--- source/blender/editors/mesh/editmesh_extrude.c | 120 ++-- .../blender/editors/mesh/editmesh_extrude_spin.c | 208 +++---- source/blender/editors/mesh/editmesh_inset.c | 2 +- source/blender/editors/mesh/editmesh_polybuild.c | 2 +- source/blender/editors/mesh/mesh_intern.h | 4 +- source/blender/editors/mesh/mesh_ops.c | 2 +- source/blender/editors/screen/area.c | 4 +- source/blender/editors/screen/screen_edit.c | 4 +- source/blender/editors/space_api/spacetypes.c | 28 +- source/blender/editors/space_image/space_image.c | 40 +- source/blender/editors/space_node/node_draw.c | 2 +- source/blender/editors/space_node/node_gizmo.c | 170 ++--- source/blender/editors/space_node/node_intern.h | 8 +- source/blender/editors/space_node/space_node.c | 34 +- .../editors/space_sequencer/sequencer_select.c | 2 +- source/blender/editors/space_view3d/space_view3d.c | 70 +-- source/blender/editors/space_view3d/view3d_draw.c | 6 +- source/blender/editors/space_view3d/view3d_edit.c | 8 +- .../editors/space_view3d/view3d_gizmo_armature.c | 52 +- .../editors/space_view3d/view3d_gizmo_camera.c | 156 ++--- .../editors/space_view3d/view3d_gizmo_empty.c | 56 +- .../editors/space_view3d/view3d_gizmo_forcefield.c | 52 +- .../editors/space_view3d/view3d_gizmo_lamp.c | 128 ++-- .../editors/space_view3d/view3d_gizmo_navigate.c | 98 +-- .../space_view3d/view3d_gizmo_navigate_type.c | 34 +- .../editors/space_view3d/view3d_gizmo_ruler.c | 92 +-- .../blender/editors/space_view3d/view3d_header.c | 6 +- .../blender/editors/space_view3d/view3d_intern.h | 30 +- source/blender/editors/space_view3d/view3d_ops.c | 2 +- source/blender/editors/transform/transform.c | 12 +- source/blender/editors/transform/transform.h | 6 +- .../editors/transform/transform_conversions.c | 2 +- .../blender/editors/transform/transform_generics.c | 6 +- .../blender/editors/transform/transform_gizmo_2d.c | 150 ++--- .../blender/editors/transform/transform_gizmo_3d.c | 336 +++++----- source/blender/editors/transform/transform_ops.c | 4 +- source/blender/makesdna/DNA_scene_types.h | 4 +- source/blender/makesdna/DNA_screen_types.h | 2 +- source/blender/makesdna/DNA_userdef_types.h | 18 +- source/blender/makesdna/DNA_view3d_types.h | 14 +- source/blender/makesdna/DNA_workspace_types.h | 2 +- source/blender/makesrna/RNA_access.h | 4 +- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_context.c | 10 +- source/blender/makesrna/intern/rna_internal.h | 6 +- source/blender/makesrna/intern/rna_scene.c | 16 +- source/blender/makesrna/intern/rna_space.c | 22 +- source/blender/makesrna/intern/rna_userdef.c | 36 +- source/blender/makesrna/intern/rna_wm_api.c | 30 +- source/blender/makesrna/intern/rna_wm_gizmo.c | 684 ++++++++++----------- source/blender/makesrna/intern/rna_wm_gizmo_api.c | 94 +-- source/blender/makesrna/intern/rna_workspace_api.c | 6 +- source/blender/python/intern/bpy.c | 2 +- source/blender/python/intern/bpy_gizmo_wrap.c | 38 +- source/blender/python/intern/bpy_gizmo_wrap.h | 8 +- source/blender/python/intern/bpy_rna.c | 8 +- source/blender/python/intern/bpy_rna_gizmo.c | 172 +++--- source/blender/python/intern/bpy_rna_gizmo.h | 2 +- source/blender/python/intern/gpu_py_select.c | 2 +- source/blender/windowmanager/WM_api.h | 6 +- source/blender/windowmanager/WM_types.h | 2 +- source/blender/windowmanager/gizmo/WM_gizmo_api.h | 442 ++++++------- .../blender/windowmanager/gizmo/WM_gizmo_types.h | 346 +++++------ .../blender/windowmanager/gizmo/intern/wm_gizmo.c | 314 +++++----- .../windowmanager/gizmo/intern/wm_gizmo_group.c | 466 +++++++------- .../gizmo/intern/wm_gizmo_group_type.c | 98 +-- .../windowmanager/gizmo/intern/wm_gizmo_intern.h | 108 ++-- .../windowmanager/gizmo/intern/wm_gizmo_map.c | 590 +++++++++--------- .../gizmo/intern/wm_gizmo_target_props.c | 140 ++--- .../windowmanager/gizmo/intern/wm_gizmo_type.c | 90 +-- source/blender/windowmanager/gizmo/wm_gizmo_fn.h | 84 +-- .../blender/windowmanager/gizmo/wm_gizmo_wmapi.h | 66 +- .../blender/windowmanager/intern/wm_event_system.c | 64 +- source/blender/windowmanager/intern/wm_init_exit.c | 16 +- source/blender/windowmanager/intern/wm_operators.c | 8 +- .../blender/windowmanager/intern/wm_toolsystem.c | 18 +- source/blender/windowmanager/wm_event_system.h | 4 +- source/blender/windowmanager/wm_event_types.h | 4 +- 119 files changed, 4090 insertions(+), 4090 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 9fa00e7f63f..6703d828bf0 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -157,7 +157,7 @@ struct SpaceLink *CTX_wm_space_data(const bContext *C); struct ARegion *CTX_wm_region(const bContext *C); void *CTX_wm_region_data(const bContext *C); struct ARegion *CTX_wm_menu(const bContext *C); -struct wmManipulatorGroup *CTX_wm_manipulator_group(const bContext *C); +struct wmGizmoGroup *CTX_wm_gizmo_group(const bContext *C); struct wmMsgBus *CTX_wm_message_bus(const bContext *C); struct ReportList *CTX_wm_reports(const bContext *C); @@ -185,7 +185,7 @@ void CTX_wm_screen_set(bContext *C, struct bScreen *screen); /* to be removed */ void CTX_wm_area_set(bContext *C, struct ScrArea *sa); void CTX_wm_region_set(bContext *C, struct ARegion *region); void CTX_wm_menu_set(bContext *C, struct ARegion *menu); -void CTX_wm_manipulator_group_set(bContext *C, struct wmManipulatorGroup *mgroup); +void CTX_wm_gizmo_group_set(bContext *C, struct wmGizmoGroup *mgroup); const char *CTX_wm_operator_poll_msg_get(struct bContext *C); void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg); diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 23f57586ed1..60981c6e76e 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -51,7 +51,7 @@ struct bScreen; struct uiLayout; struct uiList; struct wmKeyConfig; -struct wmManipulatorMap; +struct wmGizmoMap; struct wmNotifier; struct wmWindow; struct wmWindowManager; @@ -104,8 +104,8 @@ typedef struct SpaceType { /* on startup, define dropboxes for spacetype+regions */ void (*dropboxes)(void); - /* initialize manipulator-map-types and manipulator-group-types with the region */ - void (*manipulators)(void); + /* initialize gizmo-map-types and gizmo-group-types with the region */ + void (*gizmos)(void); /* return context data */ int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result); @@ -325,9 +325,9 @@ void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar); void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar); void BKE_screen_area_free(struct ScrArea *sa); -/* Manipulator-maps of a region need to be freed with the region. Uses callback to avoid low-level call. */ -void BKE_region_callback_free_manipulatormap_set(void (*callback)(struct wmManipulatorMap *)); -void BKE_region_callback_refresh_tag_manipulatormap_set(void (*callback)(struct wmManipulatorMap *)); +/* Gizmo-maps of a region need to be freed with the region. Uses callback to avoid low-level call. */ +void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *)); +void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizmoMap *)); struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type); struct ARegion *BKE_area_find_region_active_win(struct ScrArea *sa); @@ -344,7 +344,7 @@ unsigned int BKE_screen_view3d_layer_active( unsigned int BKE_screen_view3d_layer_all(const struct bScreen *sc) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); -void BKE_screen_manipulator_tag_refresh(struct bScreen *sc); +void BKE_screen_gizmo_tag_refresh(struct bScreen *sc); void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene); void BKE_screen_view3d_scene_sync(struct bScreen *sc, struct Scene *scene); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 23c2147ff7e..66020679bf7 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -300,7 +300,7 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use DATA_SWAP(font_path_ui_mono); DATA_SWAP(keyconfigstr); - DATA_SWAP(manipulator_flag); + DATA_SWAP(gizmo_flag); DATA_SWAP(app_flag); /* We could add others. */ diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 27b5089b092..b16648fd73f 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -226,7 +226,7 @@ static void setup_app_data( * only the current screen is important because we wont have to handle * events from multiple screens at once.*/ { - BKE_screen_manipulator_tag_refresh(curscreen); + BKE_screen_gizmo_tag_refresh(curscreen); } } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 0cbd77b67d2..4f772673e1d 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -463,8 +463,8 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ } /* derive the rotation from the average normal: - * - code taken from transform_manipulator.c, - * calc_manipulator_stats, V3D_MANIP_NORMAL case + * - code taken from transform_gizmo.c, + * calc_gizmo_stats, V3D_MANIP_NORMAL case */ /* we need the transpose of the inverse for a normal... */ copy_m3_m4(imat, ob->obmat); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 1aaf5e4f485..68a1e607517 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -80,7 +80,7 @@ struct bContext { struct ScrArea *area; struct ARegion *region; struct ARegion *menu; - struct wmManipulatorGroup *manipulator_group; + struct wmGizmoGroup *gizmo_group; struct bContextStore *store; const char *operator_poll_msg; /* reason for poll failing */ } wm; @@ -675,9 +675,9 @@ struct ARegion *CTX_wm_menu(const bContext *C) return C->wm.menu; } -struct wmManipulatorGroup *CTX_wm_manipulator_group(const bContext *C) +struct wmGizmoGroup *CTX_wm_gizmo_group(const bContext *C) { - return C->wm.manipulator_group; + return C->wm.gizmo_group; } struct wmMsgBus *CTX_wm_message_bus(const bContext *C) @@ -876,9 +876,9 @@ void CTX_wm_menu_set(bContext *C, ARegion *menu) C->wm.menu = menu; } -void CTX_wm_manipulator_group_set(bContext *C, struct wmManipulatorGroup *mgroup) +void CTX_wm_gizmo_group_set(bContext *C, struct wmGizmoGroup *mgroup) { - C->wm.manipulator_group = mgroup; + C->wm.gizmo_group = mgroup; } void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 8299d785cfc..6a8f46badd9 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -645,7 +645,7 @@ void BKE_scene_init(Scene *sce) sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT; sce->toolsettings->unwrapper = 1; sce->toolsettings->select_thresh = 0.01f; - sce->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE; + sce->toolsettings->gizmo_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE; sce->toolsettings->selectmode = SCE_SELECT_VERTEX; sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX; diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 1c8a93981c7..448b97c63b3 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -222,7 +222,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) BLI_listbase_clear(&newar->panels_category_active); BLI_listbase_clear(&newar->ui_lists); newar->visible = 0; - newar->manipulator_map = NULL; + newar->gizmo_map = NULL; newar->regiontimer = NULL; newar->headerstr = NULL; newar->draw_buffer = NULL; @@ -324,18 +324,18 @@ void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID } /** - * Avoid bad-level calls to #WM_manipulatormap_tag_refresh. + * Avoid bad-level calls to #WM_gizmomap_tag_refresh. */ -static void (*region_refresh_tag_manipulatormap_callback)(struct wmManipulatorMap *) = NULL; +static void (*region_refresh_tag_gizmomap_callback)(struct wmGizmoMap *) = NULL; -void BKE_region_callback_refresh_tag_manipulatormap_set(void (*callback)(struct wmManipulatorMap *)) +void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizmoMap *)) { - region_refresh_tag_manipulatormap_callback = callback; + region_refresh_tag_gizmomap_callback = callback; } -void BKE_screen_manipulator_tag_refresh(struct bScreen *sc) +void BKE_screen_gizmo_tag_refresh(struct bScreen *sc) { - if (region_refresh_tag_manipulatormap_callback == NULL) { + if (region_refresh_tag_gizmomap_callback == NULL) { return; } @@ -343,21 +343,21 @@ void BKE_screen_manipulator_tag_refresh(struct bScreen *sc) ARegion *ar; for (sa = sc->areabase.first; sa; sa = sa->next) { for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->manipulator_map != NULL) { - region_refresh_tag_manipulatormap_callback(ar->manipulator_map); + if (ar->gizmo_map != NULL) { + region_refresh_tag_gizmomap_callback(ar->gizmo_map); } } } } /** - * Avoid bad-level calls to #WM_manipulatormap_delete. + * Avoid bad-level calls to #WM_gizmomap_delete. */ -static void (*region_free_manipulatormap_callback)(struct wmManipulatorMap *) = NULL; +static void (*region_free_gizmomap_callback)(struct wmGizmoMap *) = NULL; -void BKE_region_callback_free_manipulatormap_set(void (*callback)(struct wmManipulatorMap *)) +void BKE_region_callback_free_gizmomap_set(void (*callback)(struct wmGizmoMap *)) { - region_free_manipulatormap_callback = callback; + region_free_gizmomap_callback = callback; } static void panel_list_free(ListBase *lb) @@ -414,8 +414,8 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar) } } - if (ar->manipulator_map != NULL) { - region_free_manipulatormap_callback(ar->manipulator_map); + if (ar->gizmo_map != NULL) { + region_free_gizmomap_callback(ar->gizmo_map); } BLI_freelistN(&ar->ui_lists); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6bc0a634599..6b356ac2e96 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6535,7 +6535,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) ar->visible = 0; ar->type = NULL; ar->do_draw = 0; - ar->manipulator_map = NULL; + ar->gizmo_map = NULL; ar->regiontimer = NULL; ar->draw_buffer = NULL; memset(&ar->drawrct, 0, sizeof(ar->drawrct)); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index a078b794536..b854438ed47 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1549,8 +1549,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { - if (scene->toolsettings->manipulator_flag == 0) { - scene->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE; + if (scene->toolsettings->gizmo_flag == 0) { + scene->toolsettings->gizmo_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE; } } diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 10a03050d4b..1e53180396e 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -863,7 +863,7 @@ void BM_editselection_normal(BMEditSelection *ese, float r_normal[3]) /* Calculate a plane that is rightangles to the edge/vert/faces normal * also make the plane run along an axis that is related to the geometry, - * because this is used for the manipulators Y axis. */ + * because this is used for the gizmos Y axis. */ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) { if (ese->htype == BM_VERT) { @@ -895,7 +895,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) else { /* the plane is simple, it runs along the edge * however selecting different edges can swap the direction of the y axis. - * this makes it less likely for the y axis of the manipulator + * this makes it less likely for the y axis of the gizmo * (running along the edge).. to flip less often. * at least its more predictable */ if (eed->v2->co[1] > eed->v1->co[1]) { /* check which to do first */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 7cbc6461667..421b2adc3a7 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -487,7 +487,7 @@ void BM_face_calc_tangent_vert_diagonal(const BMFace *f, float r_tangent[3]) } /** - * Compute a meaningful direction along the face (use for manipulator axis). + * Compute a meaningful direction along the face (use for gizmo axis). * * \note Callers shouldn't depend on the *exact* method used here. */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index d8e1aa2c7a4..98d6f167d30 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1438,12 +1438,12 @@ void DRW_draw_render_loop_ex( glEnable(GL_DEPTH_TEST); if (DST.draw_ctx.evil_C) { - /* needed so manipulator isn't obscured */ + /* needed so gizmo isn't obscured */ if (((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) && - ((v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0)) + ((v3d->mpr_flag & V3D_GIZMO_HIDE) == 0)) { glDisable(GL_DEPTH_TEST); - DRW_draw_manipulator_3d(); + DRW_draw_gizmo_3d(); } DRW_draw_region_info(); @@ -1451,7 +1451,7 @@ void DRW_draw_render_loop_ex( if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { /* Draw 2D after region info so we can draw on top of the camera passepartout overlay. * 'DRW_draw_region_info' sets the projection in pixel-space. */ - DRW_draw_manipulator_2d(); + DRW_draw_gizmo_2d(); glEnable(GL_DEPTH_TEST); } } diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 59ae8a918f9..75a7d567d5c 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -739,30 +739,30 @@ void DRW_draw_cursor(void) } } -/* **************************** 3D Manipulator ******************************** */ +/* **************************** 3D Gizmo ******************************** */ -void DRW_draw_manipulator_3d(void) +void DRW_draw_gizmo_3d(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); ARegion *ar = draw_ctx->ar; - /* draw depth culled manipulators - manipulators need to be updated *after* view matrix was set up */ - /* TODO depth culling manipulators is not yet supported, just drawing _3D here, should + /* draw depth culled gizmos - gizmos need to be updated *after* view matrix was set up */ + /* TODO depth culling gizmos is not yet supported, just drawing _3D here, should * later become _IN_SCENE (and draw _3D separate) */ - WM_manipulatormap_draw( - ar->manipulator_map, draw_ctx->evil_C, - WM_MANIPULATORMAP_DRAWSTEP_3D); + WM_gizmomap_draw( + ar->gizmo_map, draw_ctx->evil_C, + WM_GIZMOMAP_DRAWSTEP_3D); } -void DRW_draw_manipulator_2d(void) +void DRW_draw_gizmo_2d(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); ARegion *ar = draw_ctx->ar; - WM_manipulatormap_draw( - ar->manipulator_map, draw_ctx->evil_C, - WM_MANIPULATORMAP_DRAWSTEP_2D); + WM_gizmomap_draw( + ar->gizmo_map, draw_ctx->evil_C, + WM_GIZMOMAP_DRAWSTEP_2D); glDepthMask(GL_TRUE); } diff --git a/source/blender/draw/intern/draw_view.h b/source/blender/draw/intern/draw_view.h index 203420483a7..8f45a5fd786 100644 --- a/source/blender/draw/intern/draw_view.h +++ b/source/blender/draw/intern/draw_view.h @@ -30,7 +30,7 @@ void DRW_draw_grid(void); void DRW_draw_region_info(void); void DRW_draw_background(void); void DRW_draw_cursor(void); -void DRW_draw_manipulator_3d(void); -void DRW_draw_manipulator_2d(void); +void DRW_draw_gizmo_3d(void); +void DRW_draw_gizmo_2d(void); #endif /* __DRAW_VIEW_H__ */ diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c index 90bbd3580cb..57efc65542c 100644 --- a/source/blender/draw/modes/pose_mode.c +++ b/source/blender/draw/modes/pose_mode.c @@ -198,7 +198,7 @@ static void POSE_cache_populate(void *vedata, Object *ob) POSE_StorageList *stl = ((POSE_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); - /* In the future this will allow us to implement face manipulators, + /* In the future this will allow us to implement face gizmos, * and similar functionalities. For now we handle only pose bones. */ if (ob->type == OB_ARMATURE) { diff --git a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c index e8804238590..11708f5b5ce 100644 --- a/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c +++ b/source/blender/editors/gizmo_library/geometry/geom_arrow_gizmo.c @@ -132,7 +132,7 @@ static unsigned short indices[] = { 3, 1, 17, }; -ManipulatorGeomInfo wm_manipulator_geom_data_arrow = { +GizmoGeomInfo wm_gizmo_geom_data_arrow = { .nverts = 25, .ntris = 46, .verts = verts, diff --git a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c index f2d03821302..28eb772c082 100644 --- a/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c +++ b/source/blender/editors/gizmo_library/geometry/geom_cube_gizmo.c @@ -66,7 +66,7 @@ static const unsigned short indices[] = { 4, 0, 7, }; -ManipulatorGeomInfo wm_manipulator_geom_data_cube = { +GizmoGeomInfo wm_gizmo_geom_data_cube = { .nverts = 8, .ntris = 12, .verts = verts, diff --git a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c index bc3fb6fcaff..0225a662ff3 100644 --- a/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c +++ b/source/blender/editors/gizmo_library/geometry/geom_dial_gizmo.c @@ -804,7 +804,7 @@ static const unsigned short indices[] = { 186, 191, 0, }; -ManipulatorGeomInfo wm_manipulator_geom_data_dial = { +GizmoGeomInfo wm_gizmo_geom_data_dial = { .nverts = 192, .ntris = 384, .verts = verts, diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c index 8ae21f61758..aaaee182c71 100644 --- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c @@ -50,18 +50,18 @@ #include "WM_api.h" #include "WM_types.h" -/* only for own init/exit calls (wm_manipulatortype_init/wm_manipulatortype_free) */ +/* only for own init/exit calls (wm_gizmotype_init/wm_gizmotype_free) */ #include "wm.h" /* own includes */ #include "gizmo_library_intern.h" /** - * Main draw call for ManipulatorGeomInfo data + * Main draw call for GizmoGeomInfo data */ -void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const bool UNUSED(select), const float color[4]) +void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4]) { - /* TODO store the Batches inside the ManipulatorGeomInfo and updated it when geom changes + /* TODO store the Batches inside the GizmoGeomInfo and updated it when geom changes * So we don't need to re-created and discard it every time */ Gwn_VertBuf *vbo; @@ -108,7 +108,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo GWN_batch_discard(batch); } -void wm_manipulator_vec_draw( +void wm_gizmo_vec_draw( const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type) { diff --git a/source/blender/editors/gizmo_library/gizmo_geometry.h b/source/blender/editors/gizmo_library/gizmo_geometry.h index de976bbad48..254fb6b0957 100644 --- a/source/blender/editors/gizmo_library/gizmo_geometry.h +++ b/source/blender/editors/gizmo_library/gizmo_geometry.h @@ -24,31 +24,31 @@ /** \file gizmo_geometry.h * \ingroup wm * - * \name Manipulator Geometry + * \name Gizmo Geometry * - * \brief Prototypes for arrays defining the manipulator geometry. The actual definitions can be found in files usually - * called geom_xxx_manipulator.c + * \brief Prototypes for arrays defining the gizmo geometry. The actual definitions can be found in files usually + * called geom_xxx_gizmo.c */ #ifndef __GIZMO_GEOMETRY_H__ #define __GIZMO_GEOMETRY_H__ -typedef struct ManipulatorGeomInfo { +typedef struct GizmoGeomInfo { int nverts; int ntris; const float (*verts)[3]; const float (*normals)[3]; const unsigned short *indices; -} ManipulatorGeomInfo; +} GizmoGeomInfo; -/* arrow manipulator */ -extern ManipulatorGeomInfo wm_manipulator_geom_data_arrow; +/* arrow gizmo */ +extern GizmoGeomInfo wm_gizmo_geom_data_arrow; -/* cube manipulator */ -extern ManipulatorGeomInfo wm_manipulator_geom_data_cube; +/* cube gizmo */ +extern GizmoGeomInfo wm_gizmo_geom_data_cube; -/* dial manipulator */ -extern ManipulatorGeomInfo wm_manipulator_geom_data_dial; +/* dial gizmo */ +extern GizmoGeomInfo wm_gizmo_geom_data_dial; #endif /* __GIZMO_GEOMETRY_H__ */ diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h index 17121d3752e..f1689ee93db 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_intern.h +++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h @@ -30,25 +30,25 @@ #ifndef __GIZMO_LIBRARY_INTERN_H__ #define __GIZMO_LIBRARY_INTERN_H__ -/* distance around which manipulators respond to input (and get highlighted) */ -#define MANIPULATOR_HOTSPOT 14.0f +/* distance around which gizmos respond to input (and get highlighted) */ +#define GIZMO_HOTSPOT 14.0f /** - * Data for common interactions. Used in manipulator_library_utils.c functions. + * Data for common interactions. Used in gizmo_library_utils.c functions. */ -typedef struct ManipulatorCommonData { +typedef struct GizmoCommonData { int flag; float range_fac; /* factor for arrow min/max distance */ float offset; - /* property range for constrained manipulators */ + /* property range for constrained gizmos */ float range; - /* min/max value for constrained manipulators */ + /* min/max value for constrained gizmos */ float min, max; -} ManipulatorCommonData; +} GizmoCommonData; -typedef struct ManipulatorInteraction { +typedef struct GizmoInteraction { float init_value; /* initial property value */ float init_mval[2]; float init_offset; @@ -60,50 +60,50 @@ typedef struct ManipulatorInteraction { /* Total offset added by precision tweaking. * Needed to allow toggling precision on/off without causing jumps */ float precision_offset; -} ManipulatorInteraction; +} GizmoInteraction; -/* ManipulatorCommonData->flag */ +/* GizmoCommonData->flag */ enum { - MANIPULATOR_CUSTOM_RANGE_SET = (1 << 0), + GIZMO_CUSTOM_RANGE_SET = (1 << 0), }; -float manipulator_offset_from_value( - ManipulatorCommonData *data, const float value, +float gizmo_offset_from_value( + GizmoCommonData *data, const float value, const bool constrained, const bool inverted); -float manipulator_value_from_offset( - ManipulatorCommonData *data, ManipulatorInteraction *inter, const float offset, +float gizmo_value_from_offset( + GizmoCommonData *data, GizmoInteraction *inter, const float offset, const bool constrained, const bool inverted, const bool use_precision); -void manipulator_property_data_update( - struct wmManipulator *mpr, ManipulatorCommonData *data, wmManipulatorProperty *mpr_prop, +void gizmo_property_data_update( + struct wmGizmo *mpr, GizmoCommonData *data, wmGizmoProperty *mpr_prop, const bool constrained, const bool inverted); -void manipulator_property_value_reset( - bContext *C, const struct wmManipulator *mpr, ManipulatorInteraction *inter, wmManipulatorProperty *mpr_prop); +void gizmo_property_value_reset( + bContext *C, const struct wmGizmo *mpr, GizmoInteraction *inter, wmGizmoProperty *mpr_prop); /* -------------------------------------------------------------------- */ -void manipulator_color_get( - const struct wmManipulator *mpr, const bool highlight, +void gizmo_color_get( + const struct wmGizmo *mpr, const bool highlight, float r_color[4]); -bool manipulator_window_project_2d( - bContext *C, const struct wmManipulator *mpr, const float mval[2], int axis, bool use_offset, +bool gizmo_window_project_2d( + bContext *C, const struct wmGizmo *mpr, const float mval[2], int axis, bool use_offset, float r_co[2]); -bool manipulator_window_project_3d( - bContext *C, const struct wmManipulator *mpr, const float mval[2], bool use_offset, +bool gizmo_window_project_3d( + bContext *C, const struct wmGizmo *mpr, const float mval[2], bool use_offset, float r_co[3]); /* -------------------------------------------------------------------- */ -/* Manipulator drawing */ +/* Gizmo drawing */ #include "gizmo_geometry.h" -void wm_manipulator_geometryinfo_draw(const struct ManipulatorGeomInfo *info, const bool select, const float color[4]); -void wm_manipulator_vec_draw( +void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, const bool select, const float color[4]); +void wm_gizmo_vec_draw( const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type); diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c index d58e0c9dc85..8a6b92e48d6 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_presets.c +++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c @@ -21,9 +21,9 @@ /** \file blender/editors/gizmo_library/gizmo_library_presets.c * \ingroup wm * - * \name Manipulator Lib Presets + * \name Gizmo Lib Presets * - * \brief Preset shapes that can be drawn from any manipulator type. + * \brief Preset shapes that can be drawn from any gizmo type. */ #include "MEM_guardedalloc.h" @@ -57,7 +57,7 @@ #include "ED_gizmo_library.h" /* own include */ #include "gizmo_library_intern.h" /* own include */ -/* TODO, this is to be used by RNA. might move to ED_manipulator_library */ +/* TODO, this is to be used by RNA. might move to ED_gizmo_library */ /** * Given a single axis, orient the matrix to a different direction. @@ -80,15 +80,15 @@ static void single_axis_convert( /** * Use for all geometry. */ -static void ed_manipulator_draw_preset_geometry( - const struct wmManipulator *mpr, float mat[4][4], int select_id, - const ManipulatorGeomInfo *info) +static void ed_gizmo_draw_preset_geometry( + const struct wmGizmo *mpr, float mat[4][4], int select_id, + const GizmoGeomInfo *info) { const bool is_select = (select_id != -1); - const bool is_highlight = is_select && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; + const bool is_highlight = is_select && (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; float color[4]; - manipulator_color_get(mpr, is_highlight, color); + gizmo_color_get(mpr, is_highlight, color); if (is_select) { GPU_select_load_id(select_id); @@ -96,7 +96,7 @@ static void ed_manipulator_draw_preset_geometry( gpuPushMatrix(); gpuMultMatrix(mat); - wm_manipulator_geometryinfo_draw(info, is_select, color); + wm_gizmo_geometryinfo_draw(info, is_select, color); gpuPopMatrix(); if (is_select) { @@ -104,36 +104,36 @@ static void ed_manipulator_draw_preset_geometry( } } -void ED_manipulator_draw_preset_box( - const struct wmManipulator *mpr, float mat[4][4], int select_id) +void ED_gizmo_draw_preset_box( + const struct wmGizmo *mpr, float mat[4][4], int select_id) { - ed_manipulator_draw_preset_geometry(mpr, mat, select_id, &wm_manipulator_geom_data_cube); + ed_gizmo_draw_preset_geometry(mpr, mat, select_id, &wm_gizmo_geom_data_cube); } -void ED_manipulator_draw_preset_arrow( - const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id) +void ED_gizmo_draw_preset_arrow( + const struct wmGizmo *mpr, float mat[4][4], int axis, int select_id) { float mat_rotate[4][4]; single_axis_convert(OB_POSZ, mat, axis, mat_rotate); - ed_manipulator_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_manipulator_geom_data_arrow); + ed_gizmo_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_gizmo_geom_data_arrow); } -void ED_manipulator_draw_preset_circle( - const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id) +void ED_gizmo_draw_preset_circle( + const struct wmGizmo *mpr, float mat[4][4], int axis, int select_id) { float mat_rotate[4][4]; single_axis_convert(OB_POSZ, mat, axis, mat_rotate); - ed_manipulator_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_manipulator_geom_data_dial); + ed_gizmo_draw_preset_geometry(mpr, mat_rotate, select_id, &wm_gizmo_geom_data_dial); } -void ED_manipulator_draw_preset_facemap( - const bContext *C, const struct wmManipulator *mpr, struct Scene *scene, Object *ob, const int facemap, int select_id) +void ED_gizmo_draw_preset_facemap( + const bContext *C, const struct wmGizmo *mpr, struct Scene *scene, Object *ob, const int facemap, int select_id) { const bool is_select = (select_id != -1); - const bool is_highlight = is_select && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; + const bool is_highlight = is_select && (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; float color[4]; - manipulator_color_get(mpr, is_highlight, color); + gizmo_color_get(mpr, is_highlight, color); if (is_select) { GPU_select_load_id(select_id); diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c index 794728dd03c..6e6bc2ed824 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c @@ -26,9 +26,9 @@ /** \file gizmo_library_utils.c * \ingroup wm * - * \name Manipulator Library Utilities + * \name Gizmo Library Utilities * - * \brief This file contains functions for common behaviors of manipulators. + * \brief This file contains functions for common behaviors of gizmos. */ #include "BLI_math.h" @@ -50,34 +50,34 @@ #include "gizmo_library_intern.h" /* factor for precision tweaking */ -#define MANIPULATOR_PRECISION_FAC 0.05f +#define GIZMO_PRECISION_FAC 0.05f -BLI_INLINE float manipulator_offset_from_value_constr( +BLI_INLINE float gizmo_offset_from_value_constr( const float range_fac, const float min, const float range, const float value, const bool inverted) { return inverted ? (range_fac * (min + range - value) / range) : (range_fac * (value / range)); } -BLI_INLINE float manipulator_value_from_offset_constr( +BLI_INLINE float gizmo_value_from_offset_constr( const float range_fac, const float min, const float range, const float value, const bool inverted) { return inverted ? (min + range - (value * range / range_fac)) : (value * range / range_fac); } -float manipulator_offset_from_value( - ManipulatorCommonData *data, const float value, const bool constrained, const bool inverted) +float gizmo_offset_from_value( + GizmoCommonData *data, const float value, const bool constrained, const bool inverted) { if (constrained) - return manipulator_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted); + return gizmo_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted); return value; } -float manipulator_value_from_offset( - ManipulatorCommonData *data, ManipulatorInteraction *inter, const float offset, +float gizmo_value_from_offset( + GizmoCommonData *data, GizmoInteraction *inter, const float offset, const bool constrained, const bool inverted, const bool use_precision) { const float max = data->min + data->range; @@ -88,26 +88,26 @@ float manipulator_value_from_offset( } inter->prev_offset = offset; - float ofs_new = inter->init_offset + offset - inter->precision_offset * (1.0f - MANIPULATOR_PRECISION_FAC); + float ofs_new = inter->init_offset + offset - inter->precision_offset * (1.0f - GIZMO_PRECISION_FAC); float value; if (constrained) { - value = manipulator_value_from_offset_constr(data->range_fac, data->min, data->range, ofs_new, inverted); + value = gizmo_value_from_offset_constr(data->range_fac, data->min, data->range, ofs_new, inverted); } else { value = ofs_new; } /* clamp to custom range */ - if (data->flag & MANIPULATOR_CUSTOM_RANGE_SET) { + if (data->flag & GIZMO_CUSTOM_RANGE_SET) { CLAMP(value, data->min, max); } return value; } -void manipulator_property_data_update( - wmManipulator *mpr, ManipulatorCommonData *data, wmManipulatorProperty *mpr_prop, +void gizmo_property_data_update( + wmGizmo *mpr, GizmoCommonData *data, wmGizmoProperty *mpr_prop, const bool constrained, const bool inverted) { if (mpr_prop->custom_func.value_get_fn != NULL) { @@ -121,12 +121,12 @@ void manipulator_property_data_update( return; } - float value = WM_manipulator_target_property_value_get(mpr, mpr_prop); + float value = WM_gizmo_target_property_value_get(mpr, mpr_prop); if (constrained) { - if ((data->flag & MANIPULATOR_CUSTOM_RANGE_SET) == 0) { + if ((data->flag & GIZMO_CUSTOM_RANGE_SET) == 0) { float range[2]; - if (WM_manipulator_target_property_range_get(mpr, mpr_prop, range)) { + if (WM_gizmo_target_property_range_get(mpr, mpr_prop, range)) { data->range = range[1] - range[0]; data->min = range[0]; } @@ -134,27 +134,27 @@ void manipulator_property_data_update( BLI_assert(0); } } - data->offset = manipulator_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted); + data->offset = gizmo_offset_from_value_constr(data->range_fac, data->min, data->range, value, inverted); } else { data->offset = value; } } -void manipulator_property_value_reset( - bContext *C, const wmManipulator *mpr, ManipulatorInteraction *inter, - wmManipulatorProperty *mpr_prop) +void gizmo_property_value_reset( + bContext *C, const wmGizmo *mpr, GizmoInteraction *inter, + wmGizmoProperty *mpr_prop) { - WM_manipulator_target_property_value_set(C, mpr, mpr_prop, inter->init_value); + WM_gizmo_target_property_value_set(C, mpr, mpr_prop, inter->init_value); } /* -------------------------------------------------------------------- */ -void manipulator_color_get( - const wmManipulator *mpr, const bool highlight, +void gizmo_color_get( + const wmGizmo *mpr, const bool highlight, float r_col[4]) { - if (highlight && !(mpr->flag & WM_MANIPULATOR_DRAW_HOVER)) { + if (highlight && !(mpr->flag & WM_GIZMO_DRAW_HOVER)) { copy_v4_v4(r_col, mpr->color_hi); } else { @@ -165,26 +165,26 @@ void manipulator_color_get( /* -------------------------------------------------------------------- */ /** - * Takes mouse coordinates and returns them in relation to the manipulator. - * Both 2D & 3D supported, use so we can use 2D manipulators in the 3D view. + * 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 manipulator_window_project_2d( - bContext *C, const struct wmManipulator *mpr, const float mval[2], int axis, bool use_offset, +bool gizmo_window_project_2d( + bContext *C, const struct wmGizmo *mpr, const float mval[2], int axis, bool use_offset, float r_co[2]) { float mat[4][4]; { float mat_identity[4][4]; - struct WM_ManipulatorMatrixParams params = {NULL}; + struct WM_GizmoMatrixParams params = {NULL}; if (use_offset == false) { unit_m4(mat_identity); params.matrix_offset = mat_identity; } - WM_manipulator_calc_matrix_final_params(mpr, ¶ms, mat); + WM_gizmo_calc_matrix_final_params(mpr, ¶ms, mat); } /* rotate mouse in relation to the center and relocate it */ - if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { + if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { /* For 3d views, transform 2D mouse pos onto plane. */ View3D *v3d = CTX_wm_view3d(C); ARegion *ar = CTX_wm_region(C); @@ -220,26 +220,26 @@ bool manipulator_window_project_2d( } } -bool manipulator_window_project_3d( - bContext *C, const struct wmManipulator *mpr, const float mval[2], bool use_offset, +bool gizmo_window_project_3d( + bContext *C, const struct wmGizmo *mpr, const float mval[2], bool use_offset, float r_co[3]) { float mat[4][4]; { float mat_identity[4][4]; - struct WM_ManipulatorMatrixParams params = {NULL}; + struct WM_GizmoMatrixParams params = {NULL}; if (use_offset == false) { unit_m4(mat_identity); params.matrix_offset = mat_identity; } - WM_manipulator_calc_matrix_final_params(mpr, ¶ms, mat); + WM_gizmo_calc_matrix_final_params(mpr, ¶ms, mat); } - if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { + if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { View3D *v3d = CTX_wm_view3d(C); ARegion *ar = CTX_wm_region(C); /* Note: we might want a custom reference point passed in, - * instead of the manipulator center. */ + * instead of the gizmo center. */ ED_view3d_win_to_3d(v3d, ar, mat[3], mval, r_co); invert_m4(mat); mul_m4_v3(mat, r_co); diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c index fbb30b95562..dfa2eeeb38b 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c @@ -26,9 +26,9 @@ /** \file arrow2d_gizmo.c * \ingroup wm * - * \name 2D Arrow Manipulator + * \name 2D Arrow Gizmo * - * \brief Simple arrow manipulator which is dragged into a certain direction. + * \brief Simple arrow gizmo which is dragged into a certain direction. */ #include "BLI_listbase.h" @@ -61,7 +61,7 @@ #include "../gizmo_library_intern.h" -static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], const float color[4]) +static void arrow2d_draw_geom(wmGizmo *mpr, const float matrix[4][4], const float color[4]) { const float size = 0.11f; const float size_breadth = size / 2.0f; @@ -96,24 +96,24 @@ static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], cons gpuPopMatrix(); } -static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *mpr) +static void gizmo_arrow2d_draw(const bContext *UNUSED(C), wmGizmo *mpr) { float color[4]; float matrix_final[4][4]; - manipulator_color_get(mpr, mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT, color); + gizmo_color_get(mpr, mpr->state & WM_GIZMO_STATE_HIGHLIGHT, color); GPU_line_width(mpr->line_width); - WM_manipulator_calc_matrix_final(mpr, matrix_final); + WM_gizmo_calc_matrix_final(mpr, matrix_final); GPU_blend(true); arrow2d_draw_geom(mpr, matrix_final, color); GPU_blend(false); if (mpr->interaction_data) { - ManipulatorInteraction *inter = mpr->interaction_data; + GizmoInteraction *inter = mpr->interaction_data; GPU_blend(true); arrow2d_draw_geom(mpr, inter->init_matrix_final, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}); @@ -121,26 +121,26 @@ static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *m } } -static void manipulator_arrow2d_setup(wmManipulator *mpr) +static void gizmo_arrow2d_setup(wmGizmo *mpr) { - mpr->flag |= WM_MANIPULATOR_DRAW_MODAL; + mpr->flag |= WM_GIZMO_DRAW_MODAL; } -static int manipulator_arrow2d_invoke( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *UNUSED(event)) +static int gizmo_arrow2d_invoke( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *UNUSED(event)) { - ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__); + GizmoInteraction *inter = MEM_callocN(sizeof(GizmoInteraction), __func__); copy_m4_m4(inter->init_matrix_basis, mpr->matrix_basis); - WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final); + WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final); mpr->interaction_data = inter; return OPERATOR_RUNNING_MODAL; } -static int manipulator_arrow2d_test_select( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event) +static int gizmo_arrow2d_test_select( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event) { const float mval[2] = {event->mval[0], event->mval[1]}; const float arrow_length = RNA_float_get(mpr->ptr, "length"); @@ -165,14 +165,14 @@ static int manipulator_arrow2d_test_select( /* arrow line intersection check */ float isect_1[2], isect_2[2]; const int isect = isect_line_sphere_v2( - line[0], line[1], mval_local, MANIPULATOR_HOTSPOT + mpr->line_width * 0.5f, + line[0], line[1], mval_local, GIZMO_HOTSPOT + mpr->line_width * 0.5f, isect_1, isect_2); if (isect > 0) { float line_ext[2][2]; /* extended line for segment check including hotspot */ copy_v2_v2(line_ext[0], line[0]); - line_ext[1][0] = line[1][0] + MANIPULATOR_HOTSPOT * ((line[1][0] - line[0][0]) / line_len); - line_ext[1][1] = line[1][1] + MANIPULATOR_HOTSPOT * ((line[1][1] - line[0][1]) / line_len); + line_ext[1][0] = line[1][0] + GIZMO_HOTSPOT * ((line[1][0] - line[0][0]) / line_len); + line_ext[1][1] = line[1][1] + GIZMO_HOTSPOT * ((line[1][1] - line[0][1]) / line_len); const float lambda_1 = line_point_factor_v2(isect_1, line_ext[0], line_ext[1]); if (isect == 1) { @@ -193,22 +193,22 @@ static int manipulator_arrow2d_test_select( } /* -------------------------------------------------------------------- */ -/** \name 2D Arrow Manipulator API +/** \name 2D Arrow Gizmo API * * \{ */ -static void MANIPULATOR_WT_arrow_2d(wmManipulatorType *wt) +static void GIZMO_WT_arrow_2d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_arrow_2d"; + wt->idname = "GIZMO_WT_arrow_2d"; /* api callbacks */ - wt->draw = manipulator_arrow2d_draw; - wt->setup = manipulator_arrow2d_setup; - wt->invoke = manipulator_arrow2d_invoke; - wt->test_select = manipulator_arrow2d_test_select; + wt->draw = gizmo_arrow2d_draw; + wt->setup = gizmo_arrow2d_setup; + wt->invoke = gizmo_arrow2d_invoke; + wt->test_select = gizmo_arrow2d_test_select; - wt->struct_size = sizeof(wmManipulator); + wt->struct_size = sizeof(wmGizmo); /* rna */ RNA_def_float(wt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX); @@ -217,9 +217,9 @@ static void MANIPULATOR_WT_arrow_2d(wmManipulatorType *wt) "Roll", "", DEG2RADF(-360.0f), DEG2RADF(360.0f)); } -void ED_manipulatortypes_arrow_2d(void) +void ED_gizmotypes_arrow_2d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_arrow_2d); + WM_gizmotype_append(GIZMO_WT_arrow_2d); } /** \} */ 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 72b24e03c00..9807a111d26 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -26,15 +26,15 @@ /** \file arrow3d_gizmo.c * \ingroup wm * - * \name Arrow Manipulator + * \name Arrow Gizmo * - * 3D Manipulator + * 3D Gizmo * - * \brief Simple arrow manipulator which is dragged into a certain direction. + * \brief Simple arrow gizmo which is dragged into a certain direction. * The arrow head can have varying shapes, e.g. cone, box, etc. * * - `matrix[0]` is derived from Y and Z. - * - `matrix[1]` is 'up' for manipulator types that have an up. + * - `matrix[1]` is 'up' for gizmo types that have an up. * - `matrix[2]` is the arrow direction (for all arrowes). */ @@ -69,35 +69,35 @@ #include "../gizmo_geometry.h" #include "../gizmo_library_intern.h" -/* to use custom arrows exported to geom_arrow_manipulator.c */ -//#define USE_MANIPULATOR_CUSTOM_ARROWS +/* to use custom arrows exported to geom_arrow_gizmo.c */ +//#define USE_GIZMO_CUSTOM_ARROWS -typedef struct ArrowManipulator3D { - wmManipulator manipulator; - ManipulatorCommonData data; -} ArrowManipulator3D; +typedef struct ArrowGizmo3D { + wmGizmo gizmo; + GizmoCommonData data; +} ArrowGizmo3D; /* -------------------------------------------------------------------- */ -static void manipulator_arrow_matrix_basis_get(const wmManipulator *mpr, float r_matrix[4][4]) +static void gizmo_arrow_matrix_basis_get(const wmGizmo *mpr, float r_matrix[4][4]) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; - copy_m4_m4(r_matrix, arrow->manipulator.matrix_basis); - madd_v3_v3fl(r_matrix[3], arrow->manipulator.matrix_basis[2], arrow->data.offset); + copy_m4_m4(r_matrix, arrow->gizmo.matrix_basis); + madd_v3_v3fl(r_matrix[3], arrow->gizmo.matrix_basis[2], arrow->data.offset); } -static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, const float color[4]) +static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const float color[4]) { uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); bool unbind_shader = true; - const int draw_style = RNA_enum_get(arrow->manipulator.ptr, "draw_style"); - const int draw_options = RNA_enum_get(arrow->manipulator.ptr, "draw_options"); + const int draw_style = RNA_enum_get(arrow->gizmo.ptr, "draw_style"); + const int draw_options = RNA_enum_get(arrow->gizmo.ptr, "draw_options"); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - if (draw_style == ED_MANIPULATOR_ARROW_STYLE_CROSS) { + if (draw_style == ED_GIZMO_ARROW_STYLE_CROSS) { immUniformColor4fv(color); immBegin(GWN_PRIM_LINES, 4); @@ -107,9 +107,9 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, immVertex3f(pos, 0.0f, 1.0f, 0.0f); immEnd(); } - else if (draw_style == ED_MANIPULATOR_ARROW_STYLE_CONE) { + else if (draw_style == ED_GIZMO_ARROW_STYLE_CONE) { float aspect[2]; - RNA_float_get_array(arrow->manipulator.ptr, "aspect", aspect); + RNA_float_get_array(arrow->gizmo.ptr, "aspect", aspect); const float unitx = aspect[0]; const float unity = aspect[1]; const float vec[4][3] = { @@ -119,23 +119,23 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, {-unitx, unity, 0}, }; - GPU_line_width(arrow->manipulator.line_width); - wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP); + GPU_line_width(arrow->gizmo.line_width); + wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP); } else { -#ifdef USE_MANIPULATOR_CUSTOM_ARROWS - wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_arrow, select, color); +#ifdef USE_GIZMO_CUSTOM_ARROWS + wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_arrow, select, color); #else - const float arrow_length = RNA_float_get(arrow->manipulator.ptr, "length"); + const float arrow_length = RNA_float_get(arrow->gizmo.ptr, "length"); const float vec[2][3] = { {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, arrow_length}, }; - if (draw_options & ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM) { - GPU_line_width(arrow->manipulator.line_width); - wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP); + if (draw_options & ED_GIZMO_ARROW_DRAW_FLAG_STEM) { + GPU_line_width(arrow->gizmo.line_width); + wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP); } else { immUniformColor4fv(color); @@ -145,7 +145,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, gpuPushMatrix(); - if (draw_style == ED_MANIPULATOR_ARROW_STYLE_BOX) { + if (draw_style == ED_GIZMO_ARROW_STYLE_BOX) { const float size = 0.05f; /* translate to line end with some extra offset so box starts exactly where line ends */ @@ -156,10 +156,10 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, /* draw cube */ immUnbindProgram(); unbind_shader = false; - wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_cube, select, color); + wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_cube, select, color); } else { - BLI_assert(draw_style == ED_MANIPULATOR_ARROW_STYLE_NORMAL); + BLI_assert(draw_style == ED_GIZMO_ARROW_STYLE_NORMAL); const float len = 0.25f; const float width = 0.06f; @@ -172,7 +172,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, } gpuPopMatrix(); -#endif /* USE_MANIPULATOR_CUSTOM_ARROWS */ +#endif /* USE_GIZMO_CUSTOM_ARROWS */ } if (unbind_shader) { @@ -180,15 +180,15 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, } } -static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, const bool highlight) +static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool highlight) { - wmManipulator *mpr = &arrow->manipulator; + wmGizmo *mpr = &arrow->gizmo; float color[4]; float matrix_final[4][4]; - manipulator_color_get(mpr, highlight, color); + gizmo_color_get(mpr, highlight, color); - WM_manipulator_calc_matrix_final(mpr, matrix_final); + WM_gizmo_calc_matrix_final(mpr, matrix_final); gpuPushMatrix(); gpuMultMatrix(matrix_final); @@ -199,7 +199,7 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons gpuPopMatrix(); if (mpr->interaction_data) { - ManipulatorInteraction *inter = mpr->interaction_data; + GizmoInteraction *inter = mpr->interaction_data; gpuPushMatrix(); gpuMultMatrix(inter->init_matrix_final); @@ -213,29 +213,29 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons } } -static void manipulator_arrow_draw_select( - const bContext *UNUSED(C), wmManipulator *mpr, +static void gizmo_arrow_draw_select( + const bContext *UNUSED(C), wmGizmo *mpr, int select_id) { GPU_select_load_id(select_id); - arrow_draw_intern((ArrowManipulator3D *)mpr, true, false); + arrow_draw_intern((ArrowGizmo3D *)mpr, true, false); } -static void manipulator_arrow_draw(const bContext *UNUSED(C), wmManipulator *mpr) +static void gizmo_arrow_draw(const bContext *UNUSED(C), wmGizmo *mpr) { - arrow_draw_intern((ArrowManipulator3D *)mpr, false, (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0); + arrow_draw_intern((ArrowGizmo3D *)mpr, false, (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0); } /** * Calculate arrow offset independent from prop min value, * meaning the range will not be offset by min value first. */ -static int manipulator_arrow_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak tweak_flag) +static int gizmo_arrow_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak tweak_flag) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; - ManipulatorInteraction *inter = mpr->interaction_data; + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; + GizmoInteraction *inter = mpr->interaction_data; View3D *v3d = CTX_wm_view3d(C); ARegion *ar = CTX_wm_region(C); RegionView3D *rv3d = ar->regiondata; @@ -256,7 +256,7 @@ static int manipulator_arrow_modal( float arrow_co[3]; float arrow_no[3]; copy_v3_v3(arrow_co, inter->init_matrix_basis[3]); - normalize_v3_v3(arrow_no, arrow->manipulator.matrix_basis[2]); + normalize_v3_v3(arrow_no, arrow->gizmo.matrix_basis[2]); int ok = 0; @@ -268,7 +268,7 @@ static int manipulator_arrow_modal( { /* Force Y axis if we're view aligned */ if (j == 0) { - if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->manipulator.matrix_basis[2]))) < 5.0f) { + if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->gizmo.matrix_basis[2]))) < 5.0f) { normalize_v3_v3(arrow_no, rv3d->viewinv[1]); } } @@ -296,24 +296,24 @@ static int manipulator_arrow_modal( sub_v3_v3v3(offset, proj[1].location, proj[0].location); facdir = dot_v3v3(arrow_no, offset) < 0.0f ? -1 : 1; - ManipulatorCommonData *data = &arrow->data; + GizmoCommonData *data = &arrow->data; const float ofs_new = facdir * len_v3(offset); - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); /* set the property for the operator and call its modal function */ - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - const int transform_flag = RNA_enum_get(arrow->manipulator.ptr, "transform"); - const bool constrained = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED) != 0; - const bool inverted = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED) != 0; - const bool use_precision = (tweak_flag & WM_MANIPULATOR_TWEAK_PRECISE) != 0; - float value = manipulator_value_from_offset(data, inter, ofs_new, constrained, inverted, use_precision); - - WM_manipulator_target_property_value_set(C, mpr, mpr_prop, value); + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + const int transform_flag = RNA_enum_get(arrow->gizmo.ptr, "transform"); + const bool constrained = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED) != 0; + const bool inverted = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_INVERTED) != 0; + const bool use_precision = (tweak_flag & WM_GIZMO_TWEAK_PRECISE) != 0; + float value = gizmo_value_from_offset(data, inter, ofs_new, constrained, inverted, use_precision); + + WM_gizmo_target_property_value_set(C, mpr, mpr_prop, value); /* get clamped value */ - value = WM_manipulator_target_property_value_get(mpr, mpr_prop); + value = WM_gizmo_target_property_value_get(mpr, mpr_prop); - data->offset = manipulator_offset_from_value(data, value, constrained, inverted); + data->offset = gizmo_offset_from_value(data, value, constrained, inverted); } else { data->offset = ofs_new; @@ -326,25 +326,25 @@ static int manipulator_arrow_modal( return OPERATOR_RUNNING_MODAL; } -static void manipulator_arrow_setup(wmManipulator *mpr) +static void gizmo_arrow_setup(wmGizmo *mpr) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; - arrow->manipulator.flag |= WM_MANIPULATOR_DRAW_MODAL; + arrow->gizmo.flag |= WM_GIZMO_DRAW_MODAL; arrow->data.range_fac = 1.0f; } -static int manipulator_arrow_invoke( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event) +static int gizmo_arrow_invoke( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; - ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__); - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; + GizmoInteraction *inter = MEM_callocN(sizeof(GizmoInteraction), __func__); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); - /* Some manipulators don't use properties. */ - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - inter->init_value = WM_manipulator_target_property_value_get(mpr, mpr_prop); + /* Some gizmos don't use properties. */ + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + inter->init_value = WM_gizmo_target_property_value_get(mpr, mpr_prop); } inter->init_offset = arrow->data.offset; @@ -352,126 +352,126 @@ static int manipulator_arrow_invoke( inter->init_mval[0] = event->mval[0]; inter->init_mval[1] = event->mval[1]; - manipulator_arrow_matrix_basis_get(mpr, inter->init_matrix_basis); - WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final); + gizmo_arrow_matrix_basis_get(mpr, inter->init_matrix_basis); + WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final); mpr->interaction_data = inter; return OPERATOR_RUNNING_MODAL; } -static void manipulator_arrow_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop) +static void gizmo_arrow_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; - const int transform_flag = RNA_enum_get(arrow->manipulator.ptr, "transform"); - const bool constrained = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED) != 0; - const bool inverted = (transform_flag & ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED) != 0; - manipulator_property_data_update(mpr, &arrow->data, mpr_prop, constrained, inverted); + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; + const int transform_flag = RNA_enum_get(arrow->gizmo.ptr, "transform"); + const bool constrained = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED) != 0; + const bool inverted = (transform_flag & ED_GIZMO_ARROW_XFORM_FLAG_INVERTED) != 0; + gizmo_property_data_update(mpr, &arrow->data, mpr_prop, constrained, inverted); } -static void manipulator_arrow_exit(bContext *C, wmManipulator *mpr, const bool cancel) +static void gizmo_arrow_exit(bContext *C, wmGizmo *mpr, const bool cancel) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; - ManipulatorCommonData *data = &arrow->data; - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); - const bool is_prop_valid = WM_manipulator_target_property_is_valid(mpr_prop); + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; + GizmoCommonData *data = &arrow->data; + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); + const bool is_prop_valid = WM_gizmo_target_property_is_valid(mpr_prop); if (!cancel) { /* Assign incase applying the opetration needs an updated offset * editmesh bisect needs this. */ if (is_prop_valid) { - data->offset = WM_manipulator_target_property_value_get(mpr, mpr_prop); + data->offset = WM_gizmo_target_property_value_get(mpr, mpr_prop); } return; } - ManipulatorInteraction *inter = mpr->interaction_data; + GizmoInteraction *inter = mpr->interaction_data; if (is_prop_valid) { - manipulator_property_value_reset(C, mpr, inter, mpr_prop); + gizmo_property_value_reset(C, mpr, inter, mpr_prop); } data->offset = inter->init_offset; } /* -------------------------------------------------------------------- */ -/** \name Arrow Manipulator API +/** \name Arrow Gizmo API * * \{ */ /** * Define a custom property UI range * - * \note Needs to be called before WM_manipulator_target_property_def_rna! + * \note Needs to be called before WM_gizmo_target_property_def_rna! */ -void ED_manipulator_arrow3d_set_ui_range(wmManipulator *mpr, const float min, const float max) +void ED_gizmo_arrow3d_set_ui_range(wmGizmo *mpr, const float min, const float max) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; BLI_assert(min < max); - BLI_assert(!(WM_manipulator_target_property_is_valid(WM_manipulator_target_property_find(mpr, "offset")) && - "Make sure this function is called before WM_manipulator_target_property_def_rna")); + BLI_assert(!(WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(mpr, "offset")) && + "Make sure this function is called before WM_gizmo_target_property_def_rna")); arrow->data.range = max - min; arrow->data.min = min; - arrow->data.flag |= MANIPULATOR_CUSTOM_RANGE_SET; + arrow->data.flag |= GIZMO_CUSTOM_RANGE_SET; } /** * Define a custom factor for arrow min/max distance * - * \note Needs to be called before WM_manipulator_target_property_def_rna! + * \note Needs to be called before WM_gizmo_target_property_def_rna! */ -void ED_manipulator_arrow3d_set_range_fac(wmManipulator *mpr, const float range_fac) +void ED_gizmo_arrow3d_set_range_fac(wmGizmo *mpr, const float range_fac) { - ArrowManipulator3D *arrow = (ArrowManipulator3D *)mpr; - BLI_assert(!(WM_manipulator_target_property_is_valid(WM_manipulator_target_property_find(mpr, "offset")) && - "Make sure this function is called before WM_manipulator_target_property_def_rna")); + ArrowGizmo3D *arrow = (ArrowGizmo3D *)mpr; + BLI_assert(!(WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(mpr, "offset")) && + "Make sure this function is called before WM_gizmo_target_property_def_rna")); arrow->data.range_fac = range_fac; } -static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt) +static void GIZMO_WT_arrow_3d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_arrow_3d"; + wt->idname = "GIZMO_WT_arrow_3d"; /* api callbacks */ - wt->draw = manipulator_arrow_draw; - wt->draw_select = manipulator_arrow_draw_select; - wt->matrix_basis_get = manipulator_arrow_matrix_basis_get; - wt->modal = manipulator_arrow_modal; - wt->setup = manipulator_arrow_setup; - wt->invoke = manipulator_arrow_invoke; - wt->property_update = manipulator_arrow_property_update; - wt->exit = manipulator_arrow_exit; + wt->draw = gizmo_arrow_draw; + wt->draw_select = gizmo_arrow_draw_select; + wt->matrix_basis_get = gizmo_arrow_matrix_basis_get; + wt->modal = gizmo_arrow_modal; + wt->setup = gizmo_arrow_setup; + wt->invoke = gizmo_arrow_invoke; + wt->property_update = gizmo_arrow_property_update; + wt->exit = gizmo_arrow_exit; - wt->struct_size = sizeof(ArrowManipulator3D); + wt->struct_size = sizeof(ArrowGizmo3D); /* rna */ static EnumPropertyItem rna_enum_draw_style_items[] = { - {ED_MANIPULATOR_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""}, - {ED_MANIPULATOR_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""}, - {ED_MANIPULATOR_ARROW_STYLE_BOX, "BOX", 0, "Box", ""}, - {ED_MANIPULATOR_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""}, + {ED_GIZMO_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""}, + {ED_GIZMO_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""}, + {ED_GIZMO_ARROW_STYLE_BOX, "BOX", 0, "Box", ""}, + {ED_GIZMO_ARROW_STYLE_CONE, "CONE", 0, "Cone", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_draw_options_items[] = { - {ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""}, + {ED_GIZMO_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_transform_items[] = { - {ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""}, - {ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""}, + {ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""}, + {ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""}, {0, NULL, 0, NULL, NULL} }; RNA_def_enum( wt->srna, "draw_style", rna_enum_draw_style_items, - ED_MANIPULATOR_ARROW_STYLE_NORMAL, + ED_GIZMO_ARROW_STYLE_NORMAL, "Draw Style", ""); RNA_def_enum_flag( wt->srna, "draw_options", rna_enum_draw_options_items, - ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM, + ED_GIZMO_ARROW_DRAW_FLAG_STEM, "Draw Options", ""); RNA_def_enum_flag( wt->srna, "transform", rna_enum_transform_items, @@ -481,12 +481,12 @@ static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt) RNA_def_float(wt->srna, "length", 1.0f, 0.0f, FLT_MAX, "Arrow Line Length", "", 0.0f, FLT_MAX); RNA_def_float_vector(wt->srna, "aspect", 2, NULL, 0, FLT_MAX, "Aspect", "Cone/box style only", 0.0f, FLT_MAX); - WM_manipulatortype_target_property_def(wt, "offset", PROP_FLOAT, 1); + WM_gizmotype_target_property_def(wt, "offset", PROP_FLOAT, 1); } -void ED_manipulatortypes_arrow_3d(void) +void ED_gizmotypes_arrow_3d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_arrow_3d); + WM_gizmotype_append(GIZMO_WT_arrow_3d); } /** \} */ diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c index 78f374064e6..33639dd7ec7 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -21,11 +21,11 @@ /** \file button2d_gizmo.c * \ingroup wm * - * \name Button Manipulator + * \name Button Gizmo * - * 2D Manipulator, also works in 3D views. + * 2D Gizmo, also works in 3D views. * - * \brief Single click button action for use in manipulator groups. + * \brief Single click button action for use in gizmo groups. * * \note Currently only basic icon & vector-shape buttons are supported. * @@ -66,20 +66,20 @@ #include "../gizmo_geometry.h" #include "../gizmo_library_intern.h" -typedef struct ButtonManipulator2D { - wmManipulator manipulator; +typedef struct ButtonGizmo2D { + wmGizmo gizmo; bool is_init; /* Use an icon or shape */ int icon; Gwn_Batch *shape_batch[2]; -} ButtonManipulator2D; +} ButtonGizmo2D; #define CIRCLE_RESOLUTION 32 /* -------------------------------------------------------------------- */ static void button2d_geom_draw_backdrop( - const wmManipulator *mpr, const float color[4], const bool select) + const wmGizmo *mpr, const float color[4], const bool select) { GPU_line_width(mpr->line_width); @@ -99,10 +99,10 @@ static void button2d_geom_draw_backdrop( } static void button2d_draw_intern( - const bContext *C, wmManipulator *mpr, + const bContext *C, wmGizmo *mpr, const bool select, const bool highlight) { - ButtonManipulator2D *button = (ButtonManipulator2D *)mpr; + ButtonGizmo2D *button = (ButtonGizmo2D *)mpr; const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); if (button->is_init == false) { @@ -126,16 +126,16 @@ static void button2d_draw_intern( float color[4]; float matrix_final[4][4]; - manipulator_color_get(mpr, highlight, color); - WM_manipulator_calc_matrix_final(mpr, matrix_final); + gizmo_color_get(mpr, highlight, color); + WM_gizmo_calc_matrix_final(mpr, matrix_final); - bool is_3d = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) != 0; + bool is_3d = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) != 0; - if (draw_options & ED_MANIPULATOR_BUTTON_SHOW_HELPLINE) { + if (draw_options & ED_GIZMO_BUTTON_SHOW_HELPLINE) { float matrix_final_no_offset[4][4]; - WM_manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset); + WM_gizmo_calc_matrix_final_no_offset(mpr, matrix_final_no_offset); uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -180,7 +180,7 @@ static void button2d_draw_intern( GWN_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color)); GWN_batch_draw(button->shape_batch[i]); - if (draw_options & ED_MANIPULATOR_BUTTON_SHOW_OUTLINE) { + if (draw_options & ED_GIZMO_BUTTON_SHOW_OUTLINE) { color[0] = 1.0f - color[0]; color[1] = 1.0f - color[1]; color[2] = 1.0f - color[2]; @@ -215,29 +215,29 @@ static void button2d_draw_intern( } } -static void manipulator_button2d_draw_select(const bContext *C, wmManipulator *mpr, int select_id) +static void gizmo_button2d_draw_select(const bContext *C, wmGizmo *mpr, int select_id) { GPU_select_load_id(select_id); button2d_draw_intern(C, mpr, true, false); } -static void manipulator_button2d_draw(const bContext *C, wmManipulator *mpr) +static void gizmo_button2d_draw(const bContext *C, wmGizmo *mpr) { - const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; + const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; GPU_blend(true); button2d_draw_intern(C, mpr, false, is_highlight); GPU_blend(false); } -static int manipulator_button2d_test_select( - bContext *C, wmManipulator *mpr, const wmEvent *event) +static int gizmo_button2d_test_select( + bContext *C, wmGizmo *mpr, const wmEvent *event) { float point_local[2]; if (0) { /* correct, but unnecessarily slow. */ - if (manipulator_window_project_2d( + if (gizmo_window_project_2d( C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false) { return -1; @@ -256,7 +256,7 @@ static int manipulator_button2d_test_select( return -1; } -static int manipulator_button2d_cursor_get(wmManipulator *mpr) +static int gizmo_button2d_cursor_get(wmGizmo *mpr) { if (RNA_boolean_get(mpr->ptr, "show_drag")) { return BC_NSEW_SCROLLCURSOR; @@ -264,9 +264,9 @@ static int manipulator_button2d_cursor_get(wmManipulator *mpr) return CURSOR_STD; } -static void manipulator_button2d_free(wmManipulator *mpr) +static void gizmo_button2d_free(wmGizmo *mpr) { - ButtonManipulator2D *shape = (ButtonManipulator2D *)mpr; + ButtonGizmo2D *shape = (ButtonGizmo2D *)mpr; for (uint i = 0; i < ARRAY_SIZE(shape->shape_batch); i++) { GWN_BATCH_DISCARD_SAFE(shape->shape_batch[i]); @@ -276,28 +276,28 @@ static void manipulator_button2d_free(wmManipulator *mpr) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Button Manipulator API +/** \name Button Gizmo API * * \{ */ -static void MANIPULATOR_WT_button_2d(wmManipulatorType *wt) +static void GIZMO_WT_button_2d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_button_2d"; + wt->idname = "GIZMO_WT_button_2d"; /* api callbacks */ - wt->draw = manipulator_button2d_draw; - wt->draw_select = manipulator_button2d_draw_select; - wt->test_select = manipulator_button2d_test_select; - wt->cursor_get = manipulator_button2d_cursor_get; - wt->free = manipulator_button2d_free; + wt->draw = gizmo_button2d_draw; + wt->draw_select = gizmo_button2d_draw_select; + wt->test_select = gizmo_button2d_test_select; + wt->cursor_get = gizmo_button2d_cursor_get; + wt->free = gizmo_button2d_free; - wt->struct_size = sizeof(ButtonManipulator2D); + wt->struct_size = sizeof(ButtonGizmo2D); /* rna */ static EnumPropertyItem rna_enum_draw_options[] = { - {ED_MANIPULATOR_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""}, - {ED_MANIPULATOR_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""}, + {ED_GIZMO_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""}, + {ED_GIZMO_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""}, {0, NULL, 0, NULL, NULL} }; PropertyRNA *prop; @@ -314,9 +314,9 @@ static void MANIPULATOR_WT_button_2d(wmManipulatorType *wt) RNA_def_boolean(wt->srna, "show_drag", true, "Show Drag", ""); } -void ED_manipulatortypes_button_2d(void) +void ED_gizmotypes_button_2d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_button_2d); + WM_gizmotype_append(GIZMO_WT_button_2d); } -/** \} */ // Button Manipulator API +/** \} */ // Button Gizmo API diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index 382733d298f..a037727de58 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -26,12 +26,12 @@ /** \file cage2d_gizmo.c * \ingroup wm * - * \name Cage Manipulator + * \name Cage Gizmo * - * 2D Manipulator + * 2D Gizmo * - * \brief Rectangular manipulator acting as a 'cage' around its content. - * Interacting scales or translates the manipulator. + * \brief Rectangular gizmo acting as a 'cage' around its content. + * Interacting scales or translates the gizmo. */ #include "MEM_guardedalloc.h" @@ -64,11 +64,11 @@ /* own includes */ #include "../gizmo_library_intern.h" -#define MANIPULATOR_RESIZER_SIZE 10.0f -#define MANIPULATOR_MARGIN_OFFSET_SCALE 1.5f +#define GIZMO_RESIZER_SIZE 10.0f +#define GIZMO_MARGIN_OFFSET_SCALE 1.5f -static void manipulator_calc_rect_view_scale( - const wmManipulator *mpr, const float dims[2], float scale[2]) +static void gizmo_calc_rect_view_scale( + const wmGizmo *mpr, const float dims[2], float scale[2]) { float matrix_final_no_offset[4][4]; float asp[2] = {1.0f, 1.0f}; @@ -79,7 +79,7 @@ static void manipulator_calc_rect_view_scale( asp[1] = dims[0] / dims[1]; } float x_axis[3], y_axis[3]; - WM_manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset); + WM_gizmo_calc_matrix_final_no_offset(mpr, matrix_final_no_offset); mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, mpr->matrix_offset[0]); mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, mpr->matrix_offset[1]); @@ -90,37 +90,37 @@ static void manipulator_calc_rect_view_scale( scale[1] = 1.0f / len_v3(y_axis); } -static void manipulator_calc_rect_view_margin( - const wmManipulator *mpr, const float dims[2], float margin[2]) +static void gizmo_calc_rect_view_margin( + const wmGizmo *mpr, const float dims[2], float margin[2]) { float handle_size; - if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { + if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { handle_size = 0.15f; } else { - handle_size = MANIPULATOR_RESIZER_SIZE; + handle_size = GIZMO_RESIZER_SIZE; } handle_size *= mpr->scale_final; float scale_xy[2]; - manipulator_calc_rect_view_scale(mpr, dims, scale_xy); + gizmo_calc_rect_view_scale(mpr, dims, scale_xy); margin[0] = ((handle_size * scale_xy[0])); margin[1] = ((handle_size * scale_xy[1])); } /* -------------------------------------------------------------------- */ -static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[2], bool r_constrain_axis[2]) +static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[2], bool r_constrain_axis[2]) { bool x = true, y = true; switch (part) { - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.0); x = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.0); x = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, 0.5); y = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, -0.5); y = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.5); x = y = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, -0.5); x = y = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.5); x = y = false; break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, -0.5); x = y = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.0); x = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.0); x = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, 0.5); y = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.0, -0.5); y = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, 0.5); x = y = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, 0.5, -0.5); x = y = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, 0.5); x = y = false; break; } + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y: { ARRAY_SET_ITEMS(r_pt, -0.5, -0.5); x = y = false; break; } default: BLI_assert(0); } r_constrain_axis[0] = x; @@ -130,7 +130,7 @@ static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[2], bool /* -------------------------------------------------------------------- */ /** \name Box Draw Style * - * Useful for 3D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_BOX + * Useful for 3D views, see: #ED_GIZMO_CAGE2D_STYLE_BOX * \{ */ static void cage2d_draw_box_corners( @@ -179,7 +179,7 @@ static void cage2d_draw_box_interaction( Gwn_PrimType prim_type = GWN_PRIM_NONE; switch (highlighted) { - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X: { rctf r = { .xmin = -size[0], .xmax = -size[0] + margin[0], @@ -199,7 +199,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X: { rctf r = { .xmin = size[0] - margin[0], .xmax = size[0], @@ -219,7 +219,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y: { rctf r = { .xmin = -size[0] + margin[0], .xmax = size[0] - margin[0], @@ -239,7 +239,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y: { rctf r = { .xmin = -size[0] + margin[0], .xmax = size[0] - margin[0], @@ -259,7 +259,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y: { rctf r = { .xmin = -size[0], .xmax = -size[0] + margin[0], @@ -279,7 +279,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y: { rctf r = { .xmin = -size[0], .xmax = -size[0] + margin[0], @@ -299,7 +299,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y: { rctf r = { .xmin = size[0] - margin[0], .xmax = size[0], @@ -319,7 +319,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y: { rctf r = { .xmin = size[0] - margin[0], .xmax = size[0], @@ -339,7 +339,7 @@ static void cage2d_draw_box_interaction( } break; } - case ED_MANIPULATOR_CAGE2D_PART_ROTATE: + case ED_GIZMO_CAGE2D_PART_ROTATE: { const float rotate_pt[2] = {0.0f, size[1] + margin[1]}; const rctf r_rotate = { @@ -363,8 +363,8 @@ static void cage2d_draw_box_interaction( break; } - case ED_MANIPULATOR_CAGE2D_PART_TRANSLATE: - if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { + case ED_GIZMO_CAGE2D_PART_TRANSLATE: + if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { ARRAY_SET_ITEMS(verts[0], -margin[0] / 2, -margin[1] / 2); ARRAY_SET_ITEMS(verts[1], margin[0] / 2, margin[1] / 2); ARRAY_SET_ITEMS(verts[2], -margin[0] / 2, margin[1] / 2); @@ -449,7 +449,7 @@ static void cage2d_draw_box_interaction( /* -------------------------------------------------------------------- */ /** \name Circle Draw Style * - * Useful for 2D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE + * Useful for 2D views, see: #ED_GIZMO_CAGE2D_STYLE_CIRCLE * \{ */ static void imm_draw_point_aspect_2d( @@ -479,15 +479,15 @@ static void cage2d_draw_circle_wire( immVertex2f(pos, r->xmin, r->ymax); immEnd(); - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) { immBegin(GWN_PRIM_LINE_LOOP, 2); immVertex2f(pos, BLI_rctf_cent_x(r), r->ymax); immVertex2f(pos, BLI_rctf_cent_x(r), r->ymax + margin[1]); immEnd(); } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { - if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { + if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { const float rad[2] = {margin[0] / 2, margin[1] / 2}; const float center[2] = {BLI_rctf_cent_x(r), BLI_rctf_cent_y(r)}; @@ -525,8 +525,8 @@ static void cage2d_draw_circle_handles( imm_draw_point_aspect_2d(pos, r->xmin, r->ymax, rad[0], rad[1], solid); } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) { - const float handle[2] = {BLI_rctf_cent_x(r), r->ymax + (margin[1] * MANIPULATOR_MARGIN_OFFSET_SCALE)}; + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) { + const float handle[2] = {BLI_rctf_cent_x(r), r->ymax + (margin[1] * GIZMO_MARGIN_OFFSET_SCALE)}; circle_fn(pos, handle[0], handle[1], rad[0], rad[1], resolu); } @@ -535,10 +535,10 @@ static void cage2d_draw_circle_handles( /** \} */ -static void manipulator_cage2d_draw_intern( - wmManipulator *mpr, const bool select, const bool highlight, const int select_id) +static void gizmo_cage2d_draw_intern( + wmGizmo *mpr, const bool select, const bool highlight, const int select_id) { - // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) == 0; + // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0; float dims[2]; RNA_float_get_array(mpr->ptr, "dimensions", dims); float matrix_final[4][4]; @@ -549,13 +549,13 @@ static void manipulator_cage2d_draw_intern( const float size_real[2] = {dims[0] / 2.0f, dims[1] / 2.0f}; - WM_manipulator_calc_matrix_final(mpr, matrix_final); + WM_gizmo_calc_matrix_final(mpr, matrix_final); gpuPushMatrix(); gpuMultMatrix(matrix_final); float margin[2]; - manipulator_calc_rect_view_margin(mpr, dims, margin); + gizmo_calc_rect_view_margin(mpr, dims, margin); /* Handy for quick testing draw (if it's outside bounds). */ if (false) { @@ -573,17 +573,17 @@ static void manipulator_cage2d_draw_intern( /* expand for hotspot */ const float size[2] = {size_real[0] + margin[0] / 2, size_real[1] + margin[1] / 2}; - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE) { int scale_parts[] = { - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y, - - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, + + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, }; for (int i = 0; i < ARRAY_SIZE(scale_parts); i++) { GPU_select_load_id(select_id | scale_parts[i]); @@ -591,15 +591,15 @@ static void manipulator_cage2d_draw_intern( mpr->color, scale_parts[i], size, margin, mpr->line_width, true, draw_options); } } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { - const int transform_part = ED_MANIPULATOR_CAGE2D_PART_TRANSLATE; + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { + const int transform_part = ED_GIZMO_CAGE2D_PART_TRANSLATE; GPU_select_load_id(select_id | transform_part); cage2d_draw_box_interaction( mpr->color, transform_part, size, margin, mpr->line_width, true, draw_options); } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) { cage2d_draw_box_interaction( - mpr->color, ED_MANIPULATOR_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, true, draw_options); + mpr->color, ED_GIZMO_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, true, draw_options); } } else { @@ -609,22 +609,22 @@ static void manipulator_cage2d_draw_intern( .xmax = size_real[0], .ymax = size_real[1], }; - if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) { - /* corner manipulators */ + if (draw_style == ED_GIZMO_CAGE2D_STYLE_BOX) { + /* corner gizmos */ GPU_line_width(mpr->line_width + 3.0f); cage2d_draw_box_corners(&r, margin, (const float[3]){0, 0, 0}); - /* corner manipulators */ + /* corner gizmos */ float color[4]; - manipulator_color_get(mpr, highlight, color); + gizmo_color_get(mpr, highlight, color); GPU_line_width(mpr->line_width); cage2d_draw_box_corners(&r, margin, color); bool show = false; - if (mpr->highlight_part == ED_MANIPULATOR_CAGE2D_PART_TRANSLATE) { + if (mpr->highlight_part == ED_GIZMO_CAGE2D_PART_TRANSLATE) { /* Only show if we're drawing the center handle * otherwise the entire rectangle is the hotspot. */ - if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { + if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { show = true; } } @@ -637,14 +637,14 @@ static void manipulator_cage2d_draw_intern( mpr->color, mpr->highlight_part, size_real, margin, mpr->line_width, false, draw_options); } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) { cage2d_draw_box_interaction( - mpr->color, ED_MANIPULATOR_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, false, draw_options); + mpr->color, ED_GIZMO_CAGE2D_PART_ROTATE, size_real, margin, mpr->line_width, false, draw_options); } } - else if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE) { + else if (draw_style == ED_GIZMO_CAGE2D_STYLE_CIRCLE) { float color[4]; - manipulator_color_get(mpr, highlight, color); + gizmo_color_get(mpr, highlight, color); GPU_line_smooth(true); GPU_blend(true); @@ -655,7 +655,7 @@ static void manipulator_cage2d_draw_intern( cage2d_draw_circle_wire(&r, margin, color, transform_flag, draw_options); - /* corner manipulators */ + /* corner gizmos */ cage2d_draw_circle_handles(&r, margin, color, transform_flag, true); cage2d_draw_circle_handles(&r, margin, (const float[3]){0, 0, 0}, transform_flag, false); @@ -674,74 +674,74 @@ static void manipulator_cage2d_draw_intern( /** * For when we want to draw 2d cage in 3d views. */ -static void manipulator_cage2d_draw_select(const bContext *UNUSED(C), wmManipulator *mpr, int select_id) +static void gizmo_cage2d_draw_select(const bContext *UNUSED(C), wmGizmo *mpr, int select_id) { - manipulator_cage2d_draw_intern(mpr, true, false, select_id); + gizmo_cage2d_draw_intern(mpr, true, false, select_id); } -static void manipulator_cage2d_draw(const bContext *UNUSED(C), wmManipulator *mpr) +static void gizmo_cage2d_draw(const bContext *UNUSED(C), wmGizmo *mpr) { - const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; - manipulator_cage2d_draw_intern(mpr, false, is_highlight, -1); + const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; + gizmo_cage2d_draw_intern(mpr, false, is_highlight, -1); } -static int manipulator_cage2d_get_cursor(wmManipulator *mpr) +static int gizmo_cage2d_get_cursor(wmGizmo *mpr) { int highlight_part = mpr->highlight_part; - if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { + if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { return BC_NSEW_SCROLLCURSOR; } switch (highlight_part) { - case ED_MANIPULATOR_CAGE2D_PART_TRANSLATE: + case ED_GIZMO_CAGE2D_PART_TRANSLATE: return BC_NSEW_SCROLLCURSOR; - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X: - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X: return CURSOR_X_MOVE; - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y: - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y: return CURSOR_Y_MOVE; /* TODO diagonal cursor */ - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y: - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y: return BC_NSEW_SCROLLCURSOR; - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y: - case ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y: + case ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y: return BC_NSEW_SCROLLCURSOR; - case ED_MANIPULATOR_CAGE2D_PART_ROTATE: + case ED_GIZMO_CAGE2D_PART_ROTATE: return BC_CROSSCURSOR; default: return CURSOR_STD; } } -static int manipulator_cage2d_test_select( - bContext *C, wmManipulator *mpr, const wmEvent *event) +static int gizmo_cage2d_test_select( + bContext *C, wmGizmo *mpr, const wmEvent *event) { float point_local[2]; float dims[2]; RNA_float_get_array(mpr->ptr, "dimensions", dims); const float size_real[2] = {dims[0] / 2.0f, dims[1] / 2.0f}; - if (manipulator_window_project_2d( + if (gizmo_window_project_2d( C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false) { return -1; } float margin[2]; - manipulator_calc_rect_view_margin(mpr, dims, margin); + gizmo_calc_rect_view_margin(mpr, dims, margin); /* expand for hotspot */ const float size[2] = {size_real[0] + margin[0] / 2, size_real[1] + margin[1] / 2}; const int transform_flag = RNA_enum_get(mpr->ptr, "transform"); const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { rctf r; - if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { + if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { r.xmin = -margin[0] / 2; r.ymin = -margin[1] / 2; r.xmax = margin[0] / 2; @@ -755,12 +755,12 @@ static int manipulator_cage2d_test_select( }; bool isect = BLI_rctf_isect_pt_v(&r, point_local); if (isect) { - return ED_MANIPULATOR_CAGE2D_PART_TRANSLATE; + return ED_GIZMO_CAGE2D_PART_TRANSLATE; } } - /* if manipulator does not have a scale intersection, don't do it */ - if (transform_flag & (ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE | ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM)) { + /* if gizmo does not have a scale intersection, don't do it */ + if (transform_flag & (ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM)) { const rctf r_xmin = {.xmin = -size[0], .ymin = -size[1], .xmax = -size[0] + margin[0], .ymax = size[1]}; const rctf r_xmax = {.xmin = size[0] - margin[0], .ymin = -size[1], .xmax = size[0], .ymax = size[1]}; const rctf r_ymin = {.xmin = -size[0], .ymin = -size[1], .xmax = size[0], .ymax = -size[1] + margin[1]}; @@ -768,37 +768,37 @@ static int manipulator_cage2d_test_select( if (BLI_rctf_isect_pt_v(&r_xmin, point_local)) { if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y; + return ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y; } if (BLI_rctf_isect_pt_v(&r_ymax, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y; + return ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y; } - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X; + return ED_GIZMO_CAGE2D_PART_SCALE_MIN_X; } if (BLI_rctf_isect_pt_v(&r_xmax, point_local)) { if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y; + return ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y; } if (BLI_rctf_isect_pt_v(&r_ymax, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y; + return ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y; } - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X; + return ED_GIZMO_CAGE2D_PART_SCALE_MAX_X; } if (BLI_rctf_isect_pt_v(&r_ymin, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y; + return ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y; } if (BLI_rctf_isect_pt_v(&r_ymax, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y; + return ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y; } } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) { /* Rotate: * (*) <-- hot spot is here! * +---+ * | | * +---+ */ - const float r_rotate_pt[2] = {0.0f, size_real[1] + (margin[1] * MANIPULATOR_MARGIN_OFFSET_SCALE)}; + const float r_rotate_pt[2] = {0.0f, size_real[1] + (margin[1] * GIZMO_MARGIN_OFFSET_SCALE)}; const rctf r_rotate = { .xmin = r_rotate_pt[0] - margin[0] / 2.0f, .xmax = r_rotate_pt[0] + margin[0] / 2.0f, @@ -807,7 +807,7 @@ static int manipulator_cage2d_test_select( }; if (BLI_rctf_isect_pt_v(&r_rotate, point_local)) { - return ED_MANIPULATOR_CAGE2D_PART_ROTATE; + return ED_GIZMO_CAGE2D_PART_ROTATE; } } @@ -821,20 +821,20 @@ typedef struct RectTransformInteraction { Dial *dial; } RectTransformInteraction; -static void manipulator_cage2d_setup(wmManipulator *mpr) +static void gizmo_cage2d_setup(wmGizmo *mpr) { - mpr->flag |= WM_MANIPULATOR_DRAW_MODAL | WM_MANIPULATOR_DRAW_NO_SCALE; + mpr->flag |= WM_GIZMO_DRAW_MODAL | WM_GIZMO_DRAW_NO_SCALE; } -static int manipulator_cage2d_invoke( - bContext *C, wmManipulator *mpr, const wmEvent *event) +static int gizmo_cage2d_invoke( + bContext *C, wmGizmo *mpr, const wmEvent *event) { RectTransformInteraction *data = MEM_callocN(sizeof(RectTransformInteraction), "cage_interaction"); copy_m4_m4(data->orig_matrix_offset, mpr->matrix_offset); - WM_manipulator_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset); + WM_gizmo_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset); - if (manipulator_window_project_2d( + if (gizmo_window_project_2d( C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, false, data->orig_mouse) == 0) { zero_v2(data->orig_mouse); @@ -845,9 +845,9 @@ static int manipulator_cage2d_invoke( return OPERATOR_RUNNING_MODAL; } -static int manipulator_cage2d_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo_cage2d_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { /* For transform logic to be managable we operate in -0.5..0.5 2D space, * no matter the size of the rectangle, mouse coorts are scaled to unit space. @@ -867,7 +867,7 @@ static int manipulator_cage2d_modal( copy_m4_m4(matrix_back, mpr->matrix_offset); copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset); - bool ok = manipulator_window_project_2d( + bool ok = gizmo_window_project_2d( C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, false, point_local); copy_m4_m4(mpr->matrix_offset, matrix_back); if (!ok) { @@ -876,20 +876,20 @@ static int manipulator_cage2d_modal( } const int transform_flag = RNA_enum_get(mpr->ptr, "transform"); - wmManipulatorProperty *mpr_prop; + wmGizmoProperty *mpr_prop; - mpr_prop = WM_manipulator_target_property_find(mpr, "matrix"); + mpr_prop = WM_gizmo_target_property_find(mpr, "matrix"); if (mpr_prop->type != NULL) { - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); } - if (mpr->highlight_part == ED_MANIPULATOR_CAGE2D_PART_TRANSLATE) { + if (mpr->highlight_part == ED_GIZMO_CAGE2D_PART_TRANSLATE) { /* do this to prevent clamping from changing size */ copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset); mpr->matrix_offset[3][0] = data->orig_matrix_offset[3][0] + (point_local[0] - data->orig_mouse[0]); mpr->matrix_offset[3][1] = data->orig_matrix_offset[3][1] + (point_local[1] - data->orig_mouse[1]); } - else if (mpr->highlight_part == ED_MANIPULATOR_CAGE2D_PART_ROTATE) { + else if (mpr->highlight_part == ED_GIZMO_CAGE2D_PART_ROTATE) { #define MUL_V2_V3_M4_FINAL(test_co, mouse_co) \ mul_v3_m4v3(test_co, data->orig_matrix_final_no_offset, ((const float[3]){UNPACK2(mouse_co), 0.0})) @@ -935,8 +935,8 @@ static int manipulator_cage2d_modal( float pivot[2]; bool constrain_axis[2] = {false}; - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { - manipulator_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis); + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { + gizmo_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis); } else { zero_v2(pivot); @@ -960,7 +960,7 @@ static int manipulator_cage2d_modal( scale[i] = 1.0f + ((delta_curr[i] - delta_orig[i]) / len_v3(data->orig_matrix_offset[i])); - if ((transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) { + if ((transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) { if (sign != signum_i(scale[i])) { scale[i] = 0.0f; } @@ -968,7 +968,7 @@ static int manipulator_cage2d_modal( } } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) { if (constrain_axis[0] == false && constrain_axis[1] == false) { scale[1] = scale[0] = (scale[1] + scale[0]) / 2.0f; } @@ -995,7 +995,7 @@ static int manipulator_cage2d_modal( } if (mpr_prop->type != NULL) { - WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]); + WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]); } /* tag the region for redraw */ @@ -1005,11 +1005,11 @@ static int manipulator_cage2d_modal( return OPERATOR_RUNNING_MODAL; } -static void manipulator_cage2d_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop) +static void gizmo_cage2d_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop) { if (STREQ(mpr_prop->type->idname, "matrix")) { - if (WM_manipulator_target_property_array_length(mpr, mpr_prop) == 16) { - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); + if (WM_gizmo_target_property_array_length(mpr, mpr_prop) == 16) { + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); } else { BLI_assert(0); @@ -1020,7 +1020,7 @@ static void manipulator_cage2d_property_update(wmManipulator *mpr, wmManipulator } } -static void manipulator_cage2d_exit(bContext *C, wmManipulator *mpr, const bool cancel) +static void gizmo_cage2d_exit(bContext *C, wmGizmo *mpr, const bool cancel) { RectTransformInteraction *data = mpr->interaction_data; @@ -1029,12 +1029,12 @@ static void manipulator_cage2d_exit(bContext *C, wmManipulator *mpr, const bool if (!cancel) return; - wmManipulatorProperty *mpr_prop; + wmGizmoProperty *mpr_prop; /* reset properties */ - mpr_prop = WM_manipulator_target_property_find(mpr, "matrix"); + mpr_prop = WM_gizmo_target_property_find(mpr, "matrix"); if (mpr_prop->type != NULL) { - WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]); + WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]); } copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset); @@ -1042,59 +1042,59 @@ static void manipulator_cage2d_exit(bContext *C, wmManipulator *mpr, const bool /* -------------------------------------------------------------------- */ -/** \name Cage Manipulator API +/** \name Cage Gizmo API * * \{ */ -static void MANIPULATOR_WT_cage_2d(wmManipulatorType *wt) +static void GIZMO_WT_cage_2d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_cage_2d"; + wt->idname = "GIZMO_WT_cage_2d"; /* api callbacks */ - wt->draw = manipulator_cage2d_draw; - wt->draw_select = manipulator_cage2d_draw_select; - wt->test_select = manipulator_cage2d_test_select; - wt->setup = manipulator_cage2d_setup; - wt->invoke = manipulator_cage2d_invoke; - wt->property_update = manipulator_cage2d_property_update; - wt->modal = manipulator_cage2d_modal; - wt->exit = manipulator_cage2d_exit; - wt->cursor_get = manipulator_cage2d_get_cursor; - - wt->struct_size = sizeof(wmManipulator); + wt->draw = gizmo_cage2d_draw; + wt->draw_select = gizmo_cage2d_draw_select; + wt->test_select = gizmo_cage2d_test_select; + wt->setup = gizmo_cage2d_setup; + wt->invoke = gizmo_cage2d_invoke; + wt->property_update = gizmo_cage2d_property_update; + wt->modal = gizmo_cage2d_modal; + wt->exit = gizmo_cage2d_exit; + wt->cursor_get = gizmo_cage2d_get_cursor; + + wt->struct_size = sizeof(wmGizmo); /* rna */ static EnumPropertyItem rna_enum_draw_style[] = { - {ED_MANIPULATOR_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""}, - {ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, + {ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""}, + {ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_transform[] = { - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""}, - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""}, - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_draw_options[] = { - {ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""}, + {ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""}, {0, NULL, 0, NULL, NULL} }; static float unit_v2[2] = {1.0f, 1.0f}; RNA_def_float_vector(wt->srna, "dimensions", 2, unit_v2, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX); RNA_def_enum_flag(wt->srna, "transform", rna_enum_transform, 0, "Transform Options", ""); - RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "Draw Style", ""); + RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_CAGE2D_STYLE_CIRCLE, "Draw Style", ""); RNA_def_enum_flag( wt->srna, "draw_options", rna_enum_draw_options, - ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", ""); + ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", ""); - WM_manipulatortype_target_property_def(wt, "matrix", PROP_FLOAT, 16); + WM_gizmotype_target_property_def(wt, "matrix", PROP_FLOAT, 16); } -void ED_manipulatortypes_cage_2d(void) +void ED_gizmotypes_cage_2d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_cage_2d); + WM_gizmotype_append(GIZMO_WT_cage_2d); } /** \} */ diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c index 0f3e67d7585..e266514855b 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -26,12 +26,12 @@ /** \file cage3d_gizmo.c * \ingroup wm * - * \name Cage Manipulator + * \name Cage Gizmo * - * 2D Manipulator + * 2D Gizmo * - * \brief Rectangular manipulator acting as a 'cage' around its content. - * Interacting scales or translates the manipulator. + * \brief Rectangular gizmo acting as a 'cage' around its content. + * Interacting scales or translates the gizmo. */ #include "MEM_guardedalloc.h" @@ -63,24 +63,24 @@ /* own includes */ #include "../gizmo_library_intern.h" -#define MANIPULATOR_RESIZER_SIZE 10.0f -#define MANIPULATOR_MARGIN_OFFSET_SCALE 1.5f +#define GIZMO_RESIZER_SIZE 10.0f +#define GIZMO_MARGIN_OFFSET_SCALE 1.5f -static void manipulator_calc_matrix_final_no_offset( - const wmManipulator *mpr, float orig_matrix_final_no_offset[4][4], bool use_space) +static void gizmo_calc_matrix_final_no_offset( + const wmGizmo *mpr, float orig_matrix_final_no_offset[4][4], bool use_space) { float mat_identity[4][4]; - struct WM_ManipulatorMatrixParams params = {NULL}; + struct WM_GizmoMatrixParams params = {NULL}; unit_m4(mat_identity); if (use_space == false) { params.matrix_basis = mat_identity; } params.matrix_offset = mat_identity; - WM_manipulator_calc_matrix_final_params(mpr, ¶ms, orig_matrix_final_no_offset); + WM_gizmo_calc_matrix_final_params(mpr, ¶ms, orig_matrix_final_no_offset); } -static void manipulator_calc_rect_view_scale( - const wmManipulator *mpr, const float dims[3], float scale[3]) +static void gizmo_calc_rect_view_scale( + const wmGizmo *mpr, const float dims[3], float scale[3]) { UNUSED_VARS(dims); @@ -88,7 +88,7 @@ static void manipulator_calc_rect_view_scale( float matrix_final_no_offset[4][4]; float x_axis[3], y_axis[3], z_axis[3]; - manipulator_calc_matrix_final_no_offset(mpr, matrix_final_no_offset, false); + gizmo_calc_matrix_final_no_offset(mpr, matrix_final_no_offset, false); mul_v3_mat3_m4v3(x_axis, matrix_final_no_offset, mpr->matrix_offset[0]); mul_v3_mat3_m4v3(y_axis, matrix_final_no_offset, mpr->matrix_offset[1]); mul_v3_mat3_m4v3(z_axis, matrix_final_no_offset, mpr->matrix_offset[2]); @@ -98,21 +98,21 @@ static void manipulator_calc_rect_view_scale( scale[2] = 1.0f / len_v3(z_axis); } -static void manipulator_calc_rect_view_margin( - const wmManipulator *mpr, const float dims[3], float margin[3]) +static void gizmo_calc_rect_view_margin( + const wmGizmo *mpr, const float dims[3], float margin[3]) { float handle_size; - if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { + if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { handle_size = 0.15f; } else { - handle_size = MANIPULATOR_RESIZER_SIZE; + handle_size = GIZMO_RESIZER_SIZE; } // XXX, the scale isn't taking offset into account, we need to calculate scale per handle! // handle_size *= mpr->scale_final; float scale_xyz[3]; - manipulator_calc_rect_view_scale(mpr, dims, scale_xyz); + gizmo_calc_rect_view_scale(mpr, dims, scale_xyz); margin[0] = ((handle_size * scale_xyz[0])); margin[1] = ((handle_size * scale_xyz[1])); margin[2] = ((handle_size * scale_xyz[2])); @@ -120,12 +120,12 @@ static void manipulator_calc_rect_view_margin( /* -------------------------------------------------------------------- */ -static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[3], bool r_constrain_axis[3]) +static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[3], bool r_constrain_axis[3]) { - if (part >= ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z && - part <= ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z) + if (part >= ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z && + part <= ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z) { - int index = (part - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z); + int index = (part - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z); int range[3]; range[2] = index % 3; index = index / 3; @@ -144,7 +144,7 @@ static void manipulator_rect_pivot_from_scale_part(int part, float r_pt[3], bool /* -------------------------------------------------------------------- */ /** \name Box Draw Style * - * Useful for 3D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_BOX + * Useful for 3D views, see: #ED_GIZMO_CAGE2D_STYLE_BOX * \{ */ static void cage3d_draw_box_corners( @@ -165,10 +165,10 @@ static void cage3d_draw_box_interaction( const float color[4], const int highlighted, const float size[3], const float margin[3]) { - if (highlighted >= ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z && - highlighted <= ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z) + if (highlighted >= ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z && + highlighted <= ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z) { - int index = (highlighted - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z); + int index = (highlighted - ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z); int range[3]; range[2] = index % 3; index = index / 3; @@ -199,7 +199,7 @@ static void cage3d_draw_box_interaction( /* -------------------------------------------------------------------- */ /** \name Circle Draw Style * - * Useful for 2D views, see: #ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE + * Useful for 2D views, see: #ED_GIZMO_CAGE2D_STYLE_CIRCLE * \{ */ static void imm_draw_point_aspect_3d( @@ -225,8 +225,8 @@ static void cage3d_draw_circle_wire( imm_draw_cube_wire_3d(pos, (float[3]){0}, r); #if 0 - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { - if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { + if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { const float rad[2] = {margin[0] / 2, margin[1] / 2}; const float center[2] = {0.0f, 0.0f}; @@ -279,11 +279,11 @@ static void cage3d_draw_circle_handles( /** \} */ -static void manipulator_cage3d_draw_intern( +static void gizmo_cage3d_draw_intern( RegionView3D *rv3d, - wmManipulator *mpr, const bool select, const bool highlight, const int select_id) + wmGizmo *mpr, const bool select, const bool highlight, const int select_id) { - // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) == 0; + // const bool use_clamp = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0; float dims[3]; RNA_float_get_array(mpr->ptr, "dimensions", dims); float matrix_final[4][4]; @@ -294,13 +294,13 @@ static void manipulator_cage3d_draw_intern( const float size_real[3] = {dims[0] / 2.0f, dims[1] / 2.0f, dims[2] / 2.0f}; - WM_manipulator_calc_matrix_final(mpr, matrix_final); + WM_gizmo_calc_matrix_final(mpr, matrix_final); gpuPushMatrix(); gpuMultMatrix(matrix_final); float margin[3]; - manipulator_calc_rect_view_margin(mpr, dims, margin); + gizmo_calc_rect_view_margin(mpr, dims, margin); /* Handy for quick testing draw (if it's outside bounds). */ if (false) { @@ -328,12 +328,12 @@ static void manipulator_cage3d_draw_intern( #endif - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE) { - for (int i = ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z; - i <= ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z; + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE) { + for (int i = ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z; + i <= ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z; i++) { - if (i == ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z) { + if (i == ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z) { continue; } GPU_select_load_id(select_id | i); @@ -341,8 +341,8 @@ static void manipulator_cage3d_draw_intern( mpr->color, i, size, margin); } } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { - const int transform_part = ED_MANIPULATOR_CAGE3D_PART_TRANSLATE; + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { + const int transform_part = ED_GIZMO_CAGE3D_PART_TRANSLATE; GPU_select_load_id(select_id | transform_part); cage3d_draw_box_interaction( mpr->color, transform_part, size, margin); @@ -357,22 +357,22 @@ static void manipulator_cage3d_draw_intern( .ymax = size_real[1], }; #endif - if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) { - /* corner manipulators */ + if (draw_style == ED_GIZMO_CAGE2D_STYLE_BOX) { + /* corner gizmos */ GPU_line_width(mpr->line_width + 3.0f); cage3d_draw_box_corners(size_real, margin, (const float[3]){0, 0, 0}); - /* corner manipulators */ + /* corner gizmos */ float color[4]; - manipulator_color_get(mpr, highlight, color); + gizmo_color_get(mpr, highlight, color); GPU_line_width(mpr->line_width); cage3d_draw_box_corners(size_real, margin, color); bool show = false; - if (mpr->highlight_part == ED_MANIPULATOR_CAGE3D_PART_TRANSLATE) { + if (mpr->highlight_part == ED_GIZMO_CAGE3D_PART_TRANSLATE) { /* Only show if we're drawing the center handle * otherwise the entire rectangle is the hotspot. */ - if (draw_options & ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { + if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { show = true; } } @@ -385,9 +385,9 @@ static void manipulator_cage3d_draw_intern( mpr->color, mpr->highlight_part, size_real, margin); } } - else if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE) { + else if (draw_style == ED_GIZMO_CAGE2D_STYLE_CIRCLE) { float color[4]; - manipulator_color_get(mpr, highlight, color); + gizmo_color_get(mpr, highlight, color); GPU_line_smooth(true); GPU_polygon_smooth(true); @@ -398,7 +398,7 @@ static void manipulator_cage3d_draw_intern( GPU_line_width(mpr->line_width); cage3d_draw_circle_wire(size_real, margin, color, transform_flag, draw_options); - /* corner manipulators */ + /* corner gizmos */ cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, (const float[3]){0, 0, 0}, true, 60); cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, color, true, 40); @@ -418,24 +418,24 @@ static void manipulator_cage3d_draw_intern( /** * For when we want to draw 3d cage in 3d views. */ -static void manipulator_cage3d_draw_select(const bContext *C, wmManipulator *mpr, int select_id) +static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *mpr, int select_id) { ARegion *ar = CTX_wm_region(C); RegionView3D *rv3d = ar->regiondata; - manipulator_cage3d_draw_intern(rv3d, mpr, true, false, select_id); + gizmo_cage3d_draw_intern(rv3d, mpr, true, false, select_id); } -static void manipulator_cage3d_draw(const bContext *C, wmManipulator *mpr) +static void gizmo_cage3d_draw(const bContext *C, wmGizmo *mpr) { ARegion *ar = CTX_wm_region(C); RegionView3D *rv3d = ar->regiondata; - const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; - manipulator_cage3d_draw_intern(rv3d, mpr, false, is_highlight, -1); + const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; + gizmo_cage3d_draw_intern(rv3d, mpr, false, is_highlight, -1); } -static int manipulator_cage3d_get_cursor(wmManipulator *mpr) +static int gizmo_cage3d_get_cursor(wmGizmo *mpr) { - if (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { + if (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { return BC_NSEW_SCROLLCURSOR; } @@ -448,21 +448,21 @@ typedef struct RectTransformInteraction { float orig_matrix_final_no_offset[4][4]; } RectTransformInteraction; -static void manipulator_cage3d_setup(wmManipulator *mpr) +static void gizmo_cage3d_setup(wmGizmo *mpr) { - mpr->flag |= /* WM_MANIPULATOR_DRAW_MODAL | */ /* TODO */ - WM_MANIPULATOR_DRAW_NO_SCALE; + mpr->flag |= /* WM_GIZMO_DRAW_MODAL | */ /* TODO */ + WM_GIZMO_DRAW_NO_SCALE; } -static int manipulator_cage3d_invoke( - bContext *C, wmManipulator *mpr, const wmEvent *event) +static int gizmo_cage3d_invoke( + bContext *C, wmGizmo *mpr, const wmEvent *event) { RectTransformInteraction *data = MEM_callocN(sizeof(RectTransformInteraction), "cage_interaction"); copy_m4_m4(data->orig_matrix_offset, mpr->matrix_offset); - manipulator_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset, true); + gizmo_calc_matrix_final_no_offset(mpr, data->orig_matrix_final_no_offset, true); - if (manipulator_window_project_3d( + if (gizmo_window_project_3d( C, mpr, (const float[2]){UNPACK2(event->mval)}, false, data->orig_mouse) == 0) { zero_v3(data->orig_mouse); @@ -473,9 +473,9 @@ static int manipulator_cage3d_invoke( return OPERATOR_RUNNING_MODAL; } -static int manipulator_cage3d_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo_cage3d_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { /* For transform logic to be managable we operate in -0.5..0.5 2D space, * no matter the size of the rectangle, mouse coorts are scaled to unit space. @@ -495,7 +495,7 @@ static int manipulator_cage3d_modal( copy_m4_m4(matrix_back, mpr->matrix_offset); copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset); - bool ok = manipulator_window_project_3d( + bool ok = gizmo_window_project_3d( C, mpr, (const float[2]){UNPACK2(event->mval)}, false, point_local); copy_m4_m4(mpr->matrix_offset, matrix_back); if (!ok) { @@ -504,21 +504,21 @@ static int manipulator_cage3d_modal( } const int transform_flag = RNA_enum_get(mpr->ptr, "transform"); - wmManipulatorProperty *mpr_prop; + wmGizmoProperty *mpr_prop; - mpr_prop = WM_manipulator_target_property_find(mpr, "matrix"); + mpr_prop = WM_gizmo_target_property_find(mpr, "matrix"); if (mpr_prop->type != NULL) { - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); } - if (mpr->highlight_part == ED_MANIPULATOR_CAGE3D_PART_TRANSLATE) { + if (mpr->highlight_part == ED_GIZMO_CAGE3D_PART_TRANSLATE) { /* do this to prevent clamping from changing size */ copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset); mpr->matrix_offset[3][0] = data->orig_matrix_offset[3][0] + (point_local[0] - data->orig_mouse[0]); mpr->matrix_offset[3][1] = data->orig_matrix_offset[3][1] + (point_local[1] - data->orig_mouse[1]); mpr->matrix_offset[3][2] = data->orig_matrix_offset[3][2] + (point_local[2] - data->orig_mouse[2]); } - else if (mpr->highlight_part == ED_MANIPULATOR_CAGE3D_PART_ROTATE) { + else if (mpr->highlight_part == ED_GIZMO_CAGE3D_PART_ROTATE) { /* TODO (if needed) */ } else { @@ -527,8 +527,8 @@ static int manipulator_cage3d_modal( float pivot[3]; bool constrain_axis[3] = {false}; - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE) { - manipulator_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis); + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE) { + gizmo_rect_pivot_from_scale_part(mpr->highlight_part, pivot, constrain_axis); } else { zero_v3(pivot); @@ -553,7 +553,7 @@ static int manipulator_cage3d_modal( scale[i] = 1.0f + ((delta_curr[i] - delta_orig[i]) / len_v3(data->orig_matrix_offset[i])); - if ((transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) { + if ((transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED) == 0) { if (sign != signum_i(scale[i])) { scale[i] = 0.0f; } @@ -561,7 +561,7 @@ static int manipulator_cage3d_modal( } } - if (transform_flag & ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) { + if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM) { if (constrain_axis[0] == false && constrain_axis[1] == false) { scale[1] = scale[0] = (scale[1] + scale[0]) / 2.0f; } @@ -591,7 +591,7 @@ static int manipulator_cage3d_modal( } if (mpr_prop->type != NULL) { - WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]); + WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &mpr->matrix_offset[0][0]); } /* tag the region for redraw */ @@ -601,11 +601,11 @@ static int manipulator_cage3d_modal( return OPERATOR_RUNNING_MODAL; } -static void manipulator_cage3d_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop) +static void gizmo_cage3d_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop) { if (STREQ(mpr_prop->type->idname, "matrix")) { - if (WM_manipulator_target_property_array_length(mpr, mpr_prop) == 16) { - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); + if (WM_gizmo_target_property_array_length(mpr, mpr_prop) == 16) { + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, &mpr->matrix_offset[0][0]); } else { BLI_assert(0); @@ -616,19 +616,19 @@ static void manipulator_cage3d_property_update(wmManipulator *mpr, wmManipulator } } -static void manipulator_cage3d_exit(bContext *C, wmManipulator *mpr, const bool cancel) +static void gizmo_cage3d_exit(bContext *C, wmGizmo *mpr, const bool cancel) { RectTransformInteraction *data = mpr->interaction_data; if (!cancel) return; - wmManipulatorProperty *mpr_prop; + wmGizmoProperty *mpr_prop; /* reset properties */ - mpr_prop = WM_manipulator_target_property_find(mpr, "matrix"); + mpr_prop = WM_gizmo_target_property_find(mpr, "matrix"); if (mpr_prop->type != NULL) { - WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]); + WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, &data->orig_matrix_offset[0][0]); } copy_m4_m4(mpr->matrix_offset, data->orig_matrix_offset); @@ -636,57 +636,57 @@ static void manipulator_cage3d_exit(bContext *C, wmManipulator *mpr, const bool /* -------------------------------------------------------------------- */ -/** \name Cage Manipulator API +/** \name Cage Gizmo API * * \{ */ -static void MANIPULATOR_WT_cage_3d(wmManipulatorType *wt) +static void GIZMO_WT_cage_3d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_cage_3d"; + wt->idname = "GIZMO_WT_cage_3d"; /* api callbacks */ - wt->draw = manipulator_cage3d_draw; - wt->draw_select = manipulator_cage3d_draw_select; - wt->setup = manipulator_cage3d_setup; - wt->invoke = manipulator_cage3d_invoke; - wt->property_update = manipulator_cage3d_property_update; - wt->modal = manipulator_cage3d_modal; - wt->exit = manipulator_cage3d_exit; - wt->cursor_get = manipulator_cage3d_get_cursor; + wt->draw = gizmo_cage3d_draw; + wt->draw_select = gizmo_cage3d_draw_select; + wt->setup = gizmo_cage3d_setup; + wt->invoke = gizmo_cage3d_invoke; + wt->property_update = gizmo_cage3d_property_update; + wt->modal = gizmo_cage3d_modal; + wt->exit = gizmo_cage3d_exit; + wt->cursor_get = gizmo_cage3d_get_cursor; - wt->struct_size = sizeof(wmManipulator); + wt->struct_size = sizeof(wmGizmo); /* rna */ static EnumPropertyItem rna_enum_draw_style[] = { - {ED_MANIPULATOR_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""}, - {ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, + {ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""}, + {ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_transform[] = { - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""}, - {ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""}, + {ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_draw_options[] = { - {ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""}, + {ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""}, {0, NULL, 0, NULL, NULL} }; static float unit_v3[3] = {1.0f, 1.0f, 1.0f}; RNA_def_float_vector(wt->srna, "dimensions", 3, unit_v3, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX); RNA_def_enum_flag(wt->srna, "transform", rna_enum_transform, 0, "Transform Options", ""); - RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE, "Draw Style", ""); + RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_CAGE2D_STYLE_CIRCLE, "Draw Style", ""); RNA_def_enum_flag( wt->srna, "draw_options", rna_enum_draw_options, - ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", ""); + ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE, "Draw Options", ""); - WM_manipulatortype_target_property_def(wt, "matrix", PROP_FLOAT, 16); + WM_gizmotype_target_property_def(wt, "matrix", PROP_FLOAT, 16); } -void ED_manipulatortypes_cage_3d(void) +void ED_gizmotypes_cage_3d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_cage_3d); + WM_gizmotype_append(GIZMO_WT_cage_3d); } /** \} */ diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index 8d0061f66c8..b93b87b1efa 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -26,15 +26,15 @@ /** \file dial3d_gizmo.c * \ingroup wm * - * \name Dial Manipulator + * \name Dial Gizmo * - * 3D Manipulator + * 3D Gizmo * - * \brief Circle shaped manipulator for circular interaction. + * \brief Circle shaped gizmo for circular interaction. * Currently no own handling, use with operator only. * * - `matrix[0]` is derived from Y and Z. - * - `matrix[1]` is 'up' when DialManipulator.use_start_y_axis is set. + * - `matrix[1]` is 'up' when DialGizmo.use_start_y_axis is set. * - `matrix[2]` is the axis the dial rotates around (all dials). */ @@ -67,12 +67,12 @@ #include "../gizmo_geometry.h" #include "../gizmo_library_intern.h" -/* to use custom dials exported to geom_dial_manipulator.c */ -// #define USE_MANIPULATOR_CUSTOM_DIAL +/* to use custom dials exported to geom_dial_gizmo.c */ +// #define USE_GIZMO_CUSTOM_DIAL -static int manipulator_dial_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak tweak_flag); +static int gizmo_dial_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak tweak_flag); typedef struct DialInteraction { float init_mval[2]; @@ -99,9 +99,9 @@ typedef struct DialInteraction { #define DIAL_CLIP_BIAS 0.02 /** - * We can't use this for the #wmManipulatorType.matrix_basis_get callback, it conflicts with depth picking. + * We can't use this for the #wmGizmoType.matrix_basis_get callback, it conflicts with depth picking. */ -static void dial_calc_matrix(const wmManipulator *mpr, float mat[4][4]) +static void dial_calc_matrix(const wmGizmo *mpr, float mat[4][4]) { float rot[3][3]; const float up[3] = {0.0f, 0.0f, 1.0f}; @@ -114,15 +114,15 @@ static void dial_calc_matrix(const wmManipulator *mpr, float mat[4][4]) /* -------------------------------------------------------------------- */ static void dial_geom_draw( - const wmManipulator *mpr, const float color[4], const bool select, + const wmGizmo *mpr, const float color[4], const bool select, float axis_modal_mat[4][4], float clip_plane[4]) { -#ifdef USE_MANIPULATOR_CUSTOM_DIAL +#ifdef USE_GIZMO_CUSTOM_DIAL UNUSED_VARS(dial, col, axis_modal_mat, clip_plane); - wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_dial, select); + wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_dial, select); #else const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); - const bool filled = (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL) != 0; + const bool filled = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_FILL) != 0; GPU_line_width(mpr->line_width); @@ -181,9 +181,9 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[ } static void dial_ghostarc_draw( - const wmManipulator *mpr, const float angle_ofs, const float angle_delta, const float color[4]) + const wmGizmo *mpr, const float angle_ofs, const float angle_delta, const float color[4]) { - const float width_inner = DIAL_WIDTH - mpr->line_width * 0.5f / U.manipulator_size; + const float width_inner = DIAL_WIDTH - mpr->line_width * 0.5f / U.gizmo_size; Gwn_VertFormat *format = immVertexFormat(); uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -196,7 +196,7 @@ static void dial_ghostarc_draw( static void dial_ghostarc_get_angles( struct Depsgraph *depsgraph, - const wmManipulator *mpr, + const wmGizmo *mpr, const wmEvent *event, const ARegion *ar, const View3D *v3d, float mat[4][4], const float co_outer[3], @@ -243,7 +243,7 @@ static void dial_ghostarc_get_angles( /* Start direction from mouse or set by user */ const float *proj_init_rel = - (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y) ? + (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y) ? mpr->matrix_basis[1] : proj_mval_init_rel; /* return angles */ @@ -274,7 +274,7 @@ fail: } static void dial_draw_intern( - const bContext *C, wmManipulator *mpr, + const bContext *C, wmGizmo *mpr, const bool select, const bool highlight, float clip_plane[4]) { float matrix_basis_adjust[4][4]; @@ -283,12 +283,12 @@ static void dial_draw_intern( BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D); - manipulator_color_get(mpr, highlight, color); + gizmo_color_get(mpr, highlight, color); dial_calc_matrix(mpr, matrix_basis_adjust); - WM_manipulator_calc_matrix_final_params( - mpr, &((struct WM_ManipulatorMatrixParams) { + WM_gizmo_calc_matrix_final_params( + mpr, &((struct WM_GizmoMatrixParams) { .matrix_basis = (void *)matrix_basis_adjust, }), matrix_final); @@ -296,17 +296,17 @@ static void dial_draw_intern( gpuMultMatrix(matrix_final); /* draw rotation indicator arc first */ - if ((mpr->flag & WM_MANIPULATOR_DRAW_VALUE) && - (mpr->state & WM_MANIPULATOR_STATE_MODAL)) + if ((mpr->flag & WM_GIZMO_DRAW_VALUE) && + (mpr->state & WM_GIZMO_STATE_MODAL)) { const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */ DialInteraction *inter = mpr->interaction_data; - /* XXX, View3D rotation manipulator doesn't call modal. */ - if (!WM_manipulator_target_property_is_valid_any(mpr)) { + /* XXX, View3D rotation gizmo doesn't call modal. */ + if (!WM_gizmo_target_property_is_valid_any(mpr)) { wmWindow *win = CTX_wm_window(C); - manipulator_dial_modal((bContext *)C, mpr, win->eventstate, 0); + gizmo_dial_modal((bContext *)C, mpr, win->eventstate, 0); } float angle_ofs = inter->output.angle_ofs; @@ -323,7 +323,7 @@ static void dial_draw_intern( if (i == 0) { const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); - if ((draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR) == 0) { + if ((draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR) == 0) { break; } } @@ -332,17 +332,17 @@ static void dial_draw_intern( } } - /* draw actual dial manipulator */ + /* draw actual dial gizmo */ dial_geom_draw(mpr, color, select, matrix_basis_adjust, clip_plane); gpuPopMatrix(); } -static void manipulator_dial_draw_select(const bContext *C, wmManipulator *mpr, int select_id) +static void gizmo_dial_draw_select(const bContext *C, wmGizmo *mpr, int select_id) { float clip_plane_buf[4]; const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); - float *clip_plane = (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL; + float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL; /* enable clipping if needed */ if (clip_plane) { @@ -363,13 +363,13 @@ static void manipulator_dial_draw_select(const bContext *C, wmManipulator *mpr, } } -static void manipulator_dial_draw(const bContext *C, wmManipulator *mpr) +static void gizmo_dial_draw(const bContext *C, wmGizmo *mpr) { - const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL; - const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; + const bool is_modal = mpr->state & WM_GIZMO_STATE_MODAL; + const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; float clip_plane_buf[4]; const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); - float *clip_plane = (!is_modal && (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL; + float *clip_plane = (!is_modal && (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP)) ? clip_plane_buf : NULL; /* enable clipping if needed */ if (clip_plane) { @@ -392,9 +392,9 @@ static void manipulator_dial_draw(const bContext *C, wmManipulator *mpr) } } -static int manipulator_dial_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo_dial_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */ float angle_ofs, angle_delta; @@ -413,15 +413,15 @@ static int manipulator_dial_modal( inter->output.angle_ofs = angle_ofs; /* set the property for the operator and call its modal function */ - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - WM_manipulator_target_property_value_set(C, mpr, mpr_prop, inter->init_prop_angle + angle_delta); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + WM_gizmo_target_property_value_set(C, mpr, mpr_prop, inter->init_prop_angle + angle_delta); } return OPERATOR_RUNNING_MODAL; } -static void manipulator_dial_setup(wmManipulator *mpr) +static void gizmo_dial_setup(wmGizmo *mpr) { const float dir_default[3] = {0.0f, 0.0f, 1.0f}; @@ -429,17 +429,17 @@ static void manipulator_dial_setup(wmManipulator *mpr) copy_v3_v3(mpr->matrix_basis[2], dir_default); } -static int manipulator_dial_invoke( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event) +static int gizmo_dial_invoke( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event) { DialInteraction *inter = MEM_callocN(sizeof(DialInteraction), __func__); inter->init_mval[0] = event->mval[0]; inter->init_mval[1] = event->mval[1]; - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - inter->init_prop_angle = WM_manipulator_target_property_value_get(mpr, mpr_prop); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + inter->init_prop_angle = WM_gizmo_target_property_value_get(mpr, mpr_prop); } mpr->interaction_data = inter; @@ -448,40 +448,40 @@ static int manipulator_dial_invoke( } /* -------------------------------------------------------------------- */ -/** \name Dial Manipulator API +/** \name Dial Gizmo API * * \{ */ -static void MANIPULATOR_WT_dial_3d(wmManipulatorType *wt) +static void GIZMO_WT_dial_3d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_dial_3d"; + wt->idname = "GIZMO_WT_dial_3d"; /* api callbacks */ - wt->draw = manipulator_dial_draw; - wt->draw_select = manipulator_dial_draw_select; - wt->setup = manipulator_dial_setup; - wt->invoke = manipulator_dial_invoke; - wt->modal = manipulator_dial_modal; + wt->draw = gizmo_dial_draw; + wt->draw_select = gizmo_dial_draw_select; + wt->setup = gizmo_dial_setup; + wt->invoke = gizmo_dial_invoke; + wt->modal = gizmo_dial_modal; - wt->struct_size = sizeof(wmManipulator); + wt->struct_size = sizeof(wmGizmo); /* rna */ static EnumPropertyItem rna_enum_draw_options[] = { - {ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""}, - {ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""}, - {ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""}, - {ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""}, + {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""}, + {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""}, + {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR, "ANGLE_MIRROR", 0, "Angle Mirror", ""}, + {ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y, "ANGLE_START_Y", 0, "Angle Start Y", ""}, {0, NULL, 0, NULL, NULL} }; RNA_def_enum_flag(wt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", ""); - WM_manipulatortype_target_property_def(wt, "offset", PROP_FLOAT, 1); + WM_gizmotype_target_property_def(wt, "offset", PROP_FLOAT, 1); } -void ED_manipulatortypes_dial_3d(void) +void ED_gizmotypes_dial_3d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_dial_3d); + WM_gizmotype_append(GIZMO_WT_dial_3d); } /** \} */ diff --git a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c index e55b57327b6..2a89c8cc4ab 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c @@ -21,15 +21,15 @@ /** \file grab3d_gizmo.c * \ingroup wm * - * \name Grab Manipulator + * \name Grab Gizmo * - * 3D Manipulator, also works in 2D views. + * 3D Gizmo, also works in 2D views. * - * \brief Simple manipulator to grab and translate. + * \brief Simple gizmo to grab and translate. * * - `matrix[0]` is derived from Y and Z. * - `matrix[1]` currently not used. - * - `matrix[2]` is the widget direction (for all manipulators). + * - `matrix[2]` is the widget direction (for all gizmos). * */ @@ -62,23 +62,23 @@ #include "../gizmo_geometry.h" #include "../gizmo_library_intern.h" -typedef struct GrabManipulator3D { - wmManipulator manipulator; +typedef struct GrabGizmo3D { + wmGizmo gizmo; /* Added to 'matrix_basis' when calculating the matrix. */ float prop_co[3]; -} GrabManipulator3D; +} GrabGizmo3D; -static void manipulator_grab_matrix_basis_get(const wmManipulator *mpr, float r_matrix[4][4]) +static void gizmo_grab_matrix_basis_get(const wmGizmo *mpr, float r_matrix[4][4]) { - GrabManipulator3D *grab = (GrabManipulator3D *)mpr; + GrabGizmo3D *grab = (GrabGizmo3D *)mpr; - copy_m4_m4(r_matrix, grab->manipulator.matrix_basis); + copy_m4_m4(r_matrix, grab->gizmo.matrix_basis); add_v3_v3(r_matrix[3], grab->prop_co); } -static int manipulator_grab_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak tweak_flag); +static int gizmo_grab_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak tweak_flag); typedef struct GrabInteraction { float init_mval[2]; @@ -94,14 +94,14 @@ typedef struct GrabInteraction { /* -------------------------------------------------------------------- */ static void grab_geom_draw( - const wmManipulator *mpr, const float color[4], const bool select, const int draw_options) + const wmGizmo *mpr, const float color[4], const bool select, const int draw_options) { -#ifdef USE_MANIPULATOR_CUSTOM_DIAL +#ifdef USE_GIZMO_CUSTOM_DIAL UNUSED_VARS(grab3d, col, axis_modal_mat); - wm_manipulator_geometryinfo_draw(&wm_manipulator_geom_data_grab3d, select); + wm_gizmo_geometryinfo_draw(&wm_gizmo_geom_data_grab3d, select); #else const int draw_style = RNA_enum_get(mpr->ptr, "draw_style"); - const bool filled = (draw_options & ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL) != 0; + const bool filled = (draw_options & ED_GIZMO_GRAB_DRAW_FLAG_FILL) != 0; GPU_line_width(mpr->line_width); @@ -112,7 +112,7 @@ static void grab_geom_draw( immUniformColor4fv(color); - if (draw_style == ED_MANIPULATOR_GRAB_STYLE_RING_2D) { + if (draw_style == ED_GIZMO_GRAB_STYLE_RING_2D) { if (filled) { imm_draw_circle_fill_2d(pos, 0, 0, 1.0f, DIAL_RESOLUTION); } @@ -120,7 +120,7 @@ static void grab_geom_draw( imm_draw_circle_wire_2d(pos, 0, 0, 1.0f, DIAL_RESOLUTION); } } - else if (draw_style == ED_MANIPULATOR_GRAB_STYLE_CROSS_2D) { + else if (draw_style == ED_GIZMO_GRAB_STYLE_CROSS_2D) { immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, 1.0f, 1.0f); immVertex2f(pos, -1.0f, -1.0f); @@ -140,7 +140,7 @@ static void grab_geom_draw( } static void grab3d_get_translate( - const wmManipulator *mpr, const wmEvent *event, const ARegion *ar, + const wmGizmo *mpr, const wmEvent *event, const ARegion *ar, float co_delta[3]) { GrabInteraction *inter = mpr->interaction_data; @@ -163,18 +163,18 @@ static void grab3d_get_translate( } static void grab3d_draw_intern( - const bContext *C, wmManipulator *mpr, + const bContext *C, wmGizmo *mpr, const bool select, const bool highlight) { GrabInteraction *inter = mpr->interaction_data; const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); - const bool align_view = (draw_options & ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW) != 0; + const bool align_view = (draw_options & ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW) != 0; float color[4]; float matrix_final[4][4]; float matrix_align[4][4]; - manipulator_color_get(mpr, highlight, color); - WM_manipulator_calc_matrix_final(mpr, matrix_final); + gizmo_color_get(mpr, highlight, color); + WM_gizmo_calc_matrix_final(mpr, matrix_final); gpuPushMatrix(); gpuMultMatrix(matrix_final); @@ -209,16 +209,16 @@ static void grab3d_draw_intern( } } -static void manipulator_grab_draw_select(const bContext *C, wmManipulator *mpr, int select_id) +static void gizmo_grab_draw_select(const bContext *C, wmGizmo *mpr, int select_id) { GPU_select_load_id(select_id); grab3d_draw_intern(C, mpr, true, false); } -static void manipulator_grab_draw(const bContext *C, wmManipulator *mpr) +static void gizmo_grab_draw(const bContext *C, wmGizmo *mpr) { - const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL; - const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; + const bool is_modal = mpr->state & WM_GIZMO_STATE_MODAL; + const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; (void)is_modal; @@ -227,11 +227,11 @@ static void manipulator_grab_draw(const bContext *C, wmManipulator *mpr) GPU_blend(false); } -static int manipulator_grab_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo_grab_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { - GrabManipulator3D *grab = (GrabManipulator3D *)mpr; + GrabGizmo3D *grab = (GrabGizmo3D *)mpr; GrabInteraction *inter = mpr->interaction_data; ARegion *ar = CTX_wm_region(C); @@ -241,9 +241,9 @@ static int manipulator_grab_modal( } else { float mval_proj_init[2], mval_proj_curr[2]; - if ((manipulator_window_project_2d( + if ((gizmo_window_project_2d( C, mpr, inter->init_mval, 2, false, mval_proj_init) == false) || - (manipulator_window_project_2d( + (gizmo_window_project_2d( C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, false, mval_proj_curr) == false)) { return OPERATOR_RUNNING_MODAL; @@ -254,9 +254,9 @@ static int manipulator_grab_modal( add_v3_v3v3(grab->prop_co, inter->init_prop_co, prop_delta); /* set the property for the operator and call its modal function */ - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, grab->prop_co); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + WM_gizmo_target_property_value_set_array(C, mpr, mpr_prop, grab->prop_co); } else { zero_v3(grab->prop_co); @@ -267,8 +267,8 @@ static int manipulator_grab_modal( return OPERATOR_RUNNING_MODAL; } -static int manipulator_grab_invoke( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event) +static int gizmo_grab_invoke( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event) { GrabInteraction *inter = MEM_callocN(sizeof(GrabInteraction), __func__); @@ -278,13 +278,13 @@ static int manipulator_grab_invoke( #if 0 copy_v3_v3(inter->init_prop_co, grab->prop_co); #else - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset"); - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, inter->init_prop_co); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_find(mpr, "offset"); + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, inter->init_prop_co); } #endif - WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final); + WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final); mpr->interaction_data = inter; @@ -292,12 +292,12 @@ static int manipulator_grab_invoke( } -static int manipulator_grab_test_select( - bContext *C, wmManipulator *mpr, const wmEvent *event) +static int gizmo_grab_test_select( + bContext *C, wmGizmo *mpr, const wmEvent *event) { float point_local[2]; - if (manipulator_window_project_2d( + if (gizmo_window_project_2d( C, mpr, (const float[2]){UNPACK2(event->mval)}, 2, true, point_local) == false) { return -1; @@ -311,65 +311,65 @@ static int manipulator_grab_test_select( return -1; } -static void manipulator_grab_property_update(wmManipulator *mpr, wmManipulatorProperty *mpr_prop) +static void gizmo_grab_property_update(wmGizmo *mpr, wmGizmoProperty *mpr_prop) { - GrabManipulator3D *grab = (GrabManipulator3D *)mpr; - if (WM_manipulator_target_property_is_valid(mpr_prop)) { - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, grab->prop_co); + GrabGizmo3D *grab = (GrabGizmo3D *)mpr; + if (WM_gizmo_target_property_is_valid(mpr_prop)) { + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, grab->prop_co); } else { zero_v3(grab->prop_co); } } -static int manipulator_grab_cursor_get(wmManipulator *UNUSED(mpr)) +static int gizmo_grab_cursor_get(wmGizmo *UNUSED(mpr)) { return BC_NSEW_SCROLLCURSOR; } /* -------------------------------------------------------------------- */ -/** \name Grab Manipulator API +/** \name Grab Gizmo API * * \{ */ -static void MANIPULATOR_WT_grab_3d(wmManipulatorType *wt) +static void GIZMO_WT_grab_3d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_grab_3d"; + wt->idname = "GIZMO_WT_grab_3d"; /* api callbacks */ - wt->draw = manipulator_grab_draw; - wt->draw_select = manipulator_grab_draw_select; - wt->test_select = manipulator_grab_test_select; - wt->matrix_basis_get = manipulator_grab_matrix_basis_get; - wt->invoke = manipulator_grab_invoke; - wt->property_update = manipulator_grab_property_update; - wt->modal = manipulator_grab_modal; - wt->cursor_get = manipulator_grab_cursor_get; + wt->draw = gizmo_grab_draw; + wt->draw_select = gizmo_grab_draw_select; + wt->test_select = gizmo_grab_test_select; + wt->matrix_basis_get = gizmo_grab_matrix_basis_get; + wt->invoke = gizmo_grab_invoke; + wt->property_update = gizmo_grab_property_update; + wt->modal = gizmo_grab_modal; + wt->cursor_get = gizmo_grab_cursor_get; - wt->struct_size = sizeof(GrabManipulator3D); + wt->struct_size = sizeof(GrabGizmo3D); /* rna */ static EnumPropertyItem rna_enum_draw_style[] = { - {ED_MANIPULATOR_GRAB_STYLE_RING_2D, "RING_2D", 0, "Ring", ""}, - {ED_MANIPULATOR_GRAB_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""}, + {ED_GIZMO_GRAB_STYLE_RING_2D, "RING_2D", 0, "Ring", ""}, + {ED_GIZMO_GRAB_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem rna_enum_draw_options[] = { - {ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""}, - {ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""}, + {ED_GIZMO_GRAB_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""}, + {ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""}, {0, NULL, 0, NULL, NULL} }; - RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_GRAB_STYLE_RING_2D, "Draw Style", ""); + RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_GRAB_STYLE_RING_2D, "Draw Style", ""); RNA_def_enum_flag(wt->srna, "draw_options", rna_enum_draw_options, 0, "Draw Options", ""); - WM_manipulatortype_target_property_def(wt, "offset", PROP_FLOAT, 3); + WM_gizmotype_target_property_def(wt, "offset", PROP_FLOAT, 3); } -void ED_manipulatortypes_grab_3d(void) +void ED_gizmotypes_grab_3d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_grab_3d); + WM_gizmotype_append(GIZMO_WT_grab_3d); } -/** \} */ // Grab Manipulator API +/** \} */ // Grab Gizmo API diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c index 1331a4e983f..ff02517dafa 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c @@ -21,11 +21,11 @@ /** \file primitive3d_gizmo.c * \ingroup wm * - * \name Primitive Manipulator + * \name Primitive Gizmo * - * 3D Manipulator + * 3D Gizmo * - * \brief Manipulator with primitive drawing type (plane, cube, etc.). + * \brief Gizmo with primitive drawing type (plane, cube, etc.). * Currently only plane primitive supported without own handling, use with operator only. */ @@ -65,13 +65,13 @@ static float verts_plane[4][3] = { /* -------------------------------------------------------------------- */ -static void manipulator_primitive_draw_geom( +static void gizmo_primitive_draw_geom( const float col_inner[4], const float col_outer[4], const int draw_style) { float (*verts)[3]; uint vert_count = 0; - if (draw_style == ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE) { + if (draw_style == ED_GIZMO_PRIMITIVE_STYLE_PLANE) { verts = verts_plane; vert_count = ARRAY_SIZE(verts_plane); } @@ -79,37 +79,37 @@ static void manipulator_primitive_draw_geom( if (vert_count > 0) { uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN); - wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP); + wm_gizmo_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN); + wm_gizmo_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP); immUnbindProgram(); } } -static void manipulator_primitive_draw_intern( - wmManipulator *mpr, const bool UNUSED(select), +static void gizmo_primitive_draw_intern( + wmGizmo *mpr, const bool UNUSED(select), const bool highlight) { float color_inner[4], color_outer[4]; float matrix_final[4][4]; const int draw_style = RNA_enum_get(mpr->ptr, "draw_style"); - manipulator_color_get(mpr, highlight, color_outer); + gizmo_color_get(mpr, highlight, color_outer); copy_v4_v4(color_inner, color_outer); color_inner[3] *= 0.5f; - WM_manipulator_calc_matrix_final(mpr, matrix_final); + WM_gizmo_calc_matrix_final(mpr, matrix_final); gpuPushMatrix(); gpuMultMatrix(matrix_final); GPU_blend(true); - manipulator_primitive_draw_geom(color_inner, color_outer, draw_style); + gizmo_primitive_draw_geom(color_inner, color_outer, draw_style); GPU_blend(false); gpuPopMatrix(); if (mpr->interaction_data) { - ManipulatorInteraction *inter = mpr->interaction_data; + GizmoInteraction *inter = mpr->interaction_data; copy_v4_fl(color_inner, 0.5f); copy_v3_fl(color_outer, 0.5f); @@ -119,39 +119,39 @@ static void manipulator_primitive_draw_intern( gpuMultMatrix(inter->init_matrix_final); GPU_blend(true); - manipulator_primitive_draw_geom(color_inner, color_outer, draw_style); + gizmo_primitive_draw_geom(color_inner, color_outer, draw_style); GPU_blend(false); gpuPopMatrix(); } } -static void manipulator_primitive_draw_select( - const bContext *UNUSED(C), wmManipulator *mpr, +static void gizmo_primitive_draw_select( + const bContext *UNUSED(C), wmGizmo *mpr, int select_id) { GPU_select_load_id(select_id); - manipulator_primitive_draw_intern(mpr, true, false); + gizmo_primitive_draw_intern(mpr, true, false); } -static void manipulator_primitive_draw(const bContext *UNUSED(C), wmManipulator *mpr) +static void gizmo_primitive_draw(const bContext *UNUSED(C), wmGizmo *mpr) { - manipulator_primitive_draw_intern( + gizmo_primitive_draw_intern( mpr, false, - (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT)); + (mpr->state & WM_GIZMO_STATE_HIGHLIGHT)); } -static void manipulator_primitive_setup(wmManipulator *mpr) +static void gizmo_primitive_setup(wmGizmo *mpr) { - mpr->flag |= WM_MANIPULATOR_DRAW_MODAL; + mpr->flag |= WM_GIZMO_DRAW_MODAL; } -static int manipulator_primitive_invoke( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *UNUSED(event)) +static int gizmo_primitive_invoke( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *UNUSED(event)) { - ManipulatorInteraction *inter = MEM_callocN(sizeof(ManipulatorInteraction), __func__); + GizmoInteraction *inter = MEM_callocN(sizeof(GizmoInteraction), __func__); - WM_manipulator_calc_matrix_final(mpr, inter->init_matrix_final); + WM_gizmo_calc_matrix_final(mpr, inter->init_matrix_final); mpr->interaction_data = inter; @@ -159,33 +159,33 @@ static int manipulator_primitive_invoke( } /* -------------------------------------------------------------------- */ -/** \name Primitive Manipulator API +/** \name Primitive Gizmo API * * \{ */ -static void MANIPULATOR_WT_primitive_3d(wmManipulatorType *wt) +static void GIZMO_WT_primitive_3d(wmGizmoType *wt) { /* identifiers */ - wt->idname = "MANIPULATOR_WT_primitive_3d"; + wt->idname = "GIZMO_WT_primitive_3d"; /* api callbacks */ - wt->draw = manipulator_primitive_draw; - wt->draw_select = manipulator_primitive_draw_select; - wt->setup = manipulator_primitive_setup; - wt->invoke = manipulator_primitive_invoke; + wt->draw = gizmo_primitive_draw; + wt->draw_select = gizmo_primitive_draw_select; + wt->setup = gizmo_primitive_setup; + wt->invoke = gizmo_primitive_invoke; - wt->struct_size = sizeof(wmManipulator); + wt->struct_size = sizeof(wmGizmo); static EnumPropertyItem rna_enum_draw_style[] = { - {ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""}, + {ED_GIZMO_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} }; - RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE, "Draw Style", ""); + RNA_def_enum(wt->srna, "draw_style", rna_enum_draw_style, ED_GIZMO_PRIMITIVE_STYLE_PLANE, "Draw Style", ""); } -void ED_manipulatortypes_primitive_3d(void) +void ED_gizmotypes_primitive_3d(void) { - WM_manipulatortype_append(MANIPULATOR_WT_primitive_3d); + WM_gizmotype_append(GIZMO_WT_primitive_3d); } /** \} */ diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index b33fbf47630..39a58929b7c 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -21,28 +21,28 @@ /** \file ED_gizmo_library.h * \ingroup wm * - * \name Generic Manipulators. + * \name Generic Gizmos. * - * This is exposes pre-defined manipulators for re-use. + * This is exposes pre-defined gizmos for re-use. */ #ifndef __ED_GIZMO_LIBRARY_H__ #define __ED_GIZMO_LIBRARY_H__ -/* initialize manipulators */ -void ED_manipulatortypes_arrow_2d(void); -void ED_manipulatortypes_arrow_3d(void); -void ED_manipulatortypes_button_2d(void); -void ED_manipulatortypes_cage_2d(void); -void ED_manipulatortypes_cage_3d(void); -void ED_manipulatortypes_dial_3d(void); -void ED_manipulatortypes_grab_3d(void); -void ED_manipulatortypes_facemap_3d(void); -void ED_manipulatortypes_primitive_3d(void); +/* initialize gizmos */ +void ED_gizmotypes_arrow_2d(void); +void ED_gizmotypes_arrow_3d(void); +void ED_gizmotypes_button_2d(void); +void ED_gizmotypes_cage_2d(void); +void ED_gizmotypes_cage_3d(void); +void ED_gizmotypes_dial_3d(void); +void ED_gizmotypes_grab_3d(void); +void ED_gizmotypes_facemap_3d(void); +void ED_gizmotypes_primitive_3d(void); -struct wmManipulator; -struct wmManipulatorGroup; +struct wmGizmo; +struct wmGizmoGroup; /* -------------------------------------------------------------------- */ @@ -51,172 +51,172 @@ struct wmManipulatorGroup; * Intended to be called by custom draw functions. */ -/* manipulator_library_presets.c */ -void ED_manipulator_draw_preset_box( - const struct wmManipulator *mpr, float mat[4][4], int select_id); -void ED_manipulator_draw_preset_arrow( - const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id); -void ED_manipulator_draw_preset_circle( - const struct wmManipulator *mpr, float mat[4][4], int axis, int select_id); -void ED_manipulator_draw_preset_facemap( - const struct bContext *C, const struct wmManipulator *mpr, struct Scene *scene, +/* gizmo_library_presets.c */ +void ED_gizmo_draw_preset_box( + const struct wmGizmo *mpr, float mat[4][4], int select_id); +void ED_gizmo_draw_preset_arrow( + const struct wmGizmo *mpr, float mat[4][4], int axis, int select_id); +void ED_gizmo_draw_preset_circle( + const struct wmGizmo *mpr, float mat[4][4], int axis, int select_id); +void ED_gizmo_draw_preset_facemap( + const struct bContext *C, const struct wmGizmo *mpr, struct Scene *scene, struct Object *ob, const int facemap, int select_id); /* -------------------------------------------------------------------- */ -/* 3D Arrow Manipulator */ +/* 3D Arrow Gizmo */ enum { - ED_MANIPULATOR_ARROW_STYLE_NORMAL = 0, - ED_MANIPULATOR_ARROW_STYLE_CROSS = 1, - ED_MANIPULATOR_ARROW_STYLE_BOX = 2, - ED_MANIPULATOR_ARROW_STYLE_CONE = 3, + ED_GIZMO_ARROW_STYLE_NORMAL = 0, + ED_GIZMO_ARROW_STYLE_CROSS = 1, + ED_GIZMO_ARROW_STYLE_BOX = 2, + ED_GIZMO_ARROW_STYLE_CONE = 3, }; /* transform */ enum { /* inverted offset during interaction - if set it also sets constrained below */ - ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED = (1 << 3), + ED_GIZMO_ARROW_XFORM_FLAG_INVERTED = (1 << 3), /* clamp arrow interaction to property width */ - ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED = (1 << 4), + ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED = (1 << 4), }; /* draw_options */ enum { /* Show arrow stem. */ - ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM = (1 << 0), + ED_GIZMO_ARROW_DRAW_FLAG_STEM = (1 << 0), }; -void ED_manipulator_arrow3d_set_ui_range(struct wmManipulator *mpr, const float min, const float max); -void ED_manipulator_arrow3d_set_range_fac(struct wmManipulator *mpr, const float range_fac); +void ED_gizmo_arrow3d_set_ui_range(struct wmGizmo *mpr, const float min, const float max); +void ED_gizmo_arrow3d_set_range_fac(struct wmGizmo *mpr, const float range_fac); /* -------------------------------------------------------------------- */ -/* 2D Arrow Manipulator */ +/* 2D Arrow Gizmo */ /* none */ /* -------------------------------------------------------------------- */ -/* Cage Manipulator */ +/* Cage Gizmo */ enum { - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE = (1 << 0), /* Translates */ - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE = (1 << 1), /* Rotates */ - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE = (1 << 2), /* Scales */ - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM = (1 << 3), /* Scales uniformly */ - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED = (1 << 4), /* Negative scale allowed */ + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE = (1 << 0), /* Translates */ + ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE = (1 << 1), /* Rotates */ + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE = (1 << 2), /* Scales */ + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM = (1 << 3), /* Scales uniformly */ + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED = (1 << 4), /* Negative scale allowed */ }; /* draw_style */ enum { - ED_MANIPULATOR_CAGE2D_STYLE_BOX = 0, - ED_MANIPULATOR_CAGE2D_STYLE_CIRCLE = 1, + ED_GIZMO_CAGE2D_STYLE_BOX = 0, + ED_GIZMO_CAGE2D_STYLE_CIRCLE = 1, }; /* draw_options */ enum { /** Draw a central handle (instead of having the entire area selectable) * Needed for large rectangles that we don't want to swallow all events. */ - ED_MANIPULATOR_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE = (1 << 0), + ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE = (1 << 0), }; -/** #wmManipulator.highlight_part */ +/** #wmGizmo.highlight_part */ enum { - ED_MANIPULATOR_CAGE2D_PART_TRANSLATE = 0, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X = 1, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X = 2, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y = 3, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y = 4, + ED_GIZMO_CAGE2D_PART_TRANSLATE = 0, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X = 1, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X = 2, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y = 3, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y = 4, /* Corners */ - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y = 5, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y = 6, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y = 7, - ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y = 8, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y = 5, + ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y = 6, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y = 7, + ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y = 8, - ED_MANIPULATOR_CAGE2D_PART_ROTATE = 9, + ED_GIZMO_CAGE2D_PART_ROTATE = 9, }; -/** #wmManipulator.highlight_part */ +/** #wmGizmo.highlight_part */ enum { /* ordered min/mid/max so we can loop over values (MIN/MID/MAX) on each axis. */ - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z = 0, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MID_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MID_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MID_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MIN_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MIN_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MIN_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MID_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MAX_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MAX_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MID_X_MAX_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MID_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MID_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MID_Y_MAX_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MIN_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MID_Z, - ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, - - ED_MANIPULATOR_CAGE3D_PART_TRANSLATE, - - ED_MANIPULATOR_CAGE3D_PART_ROTATE, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z = 0, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MID_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MAX_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MIN_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MID_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MID_X_MAX_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MIN_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MID_Y_MAX_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MIN_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MID_Z, + ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, + + ED_GIZMO_CAGE3D_PART_TRANSLATE, + + ED_GIZMO_CAGE3D_PART_ROTATE, }; /* -------------------------------------------------------------------- */ -/* Dial Manipulator */ +/* Dial Gizmo */ /* draw_options */ enum { - ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP = 0, - ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP = (1 << 0), - ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL = (1 << 1), - ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR = (1 << 2), - ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y = (1 << 3), + ED_GIZMO_DIAL_DRAW_FLAG_NOP = 0, + ED_GIZMO_DIAL_DRAW_FLAG_CLIP = (1 << 0), + ED_GIZMO_DIAL_DRAW_FLAG_FILL = (1 << 1), + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR = (1 << 2), + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y = (1 << 3), }; /* -------------------------------------------------------------------- */ -/* Grab Manipulator */ +/* Grab Gizmo */ /* draw_options */ enum { - ED_MANIPULATOR_GRAB_DRAW_FLAG_NOP = 0, + ED_GIZMO_GRAB_DRAW_FLAG_NOP = 0, /* only for solid shapes */ - ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL = (1 << 0), - ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW = (1 << 1), + ED_GIZMO_GRAB_DRAW_FLAG_FILL = (1 << 0), + ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW = (1 << 1), }; enum { - ED_MANIPULATOR_GRAB_STYLE_RING_2D = 0, - ED_MANIPULATOR_GRAB_STYLE_CROSS_2D = 1, + ED_GIZMO_GRAB_STYLE_RING_2D = 0, + ED_GIZMO_GRAB_STYLE_CROSS_2D = 1, }; /* -------------------------------------------------------------------- */ -/* Button Manipulator */ +/* Button Gizmo */ enum { - ED_MANIPULATOR_BUTTON_SHOW_OUTLINE = (1 << 0), + ED_GIZMO_BUTTON_SHOW_OUTLINE = (1 << 0), /** * Draw a line from the origin to the offset (similar to an arrow) * sometimes needed to show what the button edits. */ - ED_MANIPULATOR_BUTTON_SHOW_HELPLINE = (1 << 1), + ED_GIZMO_BUTTON_SHOW_HELPLINE = (1 << 1), }; /* -------------------------------------------------------------------- */ -/* Primitive Manipulator */ +/* Primitive Gizmo */ enum { - ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE = 0, + ED_GIZMO_PRIMITIVE_STYLE_PLANE = 0, }; #endif /* __ED_GIZMO_LIBRARY_H__ */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 1e3c8995314..80dea103f8c 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -113,8 +113,8 @@ bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3 struct TransInfo; struct Scene; struct Object; -struct wmManipulatorGroup; -struct wmManipulatorGroupType; +struct wmGizmoGroup; +struct wmGizmoGroupType; struct wmOperator; /* UNUSED */ @@ -157,15 +157,15 @@ int BIF_countTransformOrientation(const struct bContext *C); void Transform_Properties(struct wmOperatorType *ot, int flags); -/* transform manipulators */ +/* transform gizmos */ -void TRANSFORM_WGT_manipulator(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_xform_cage(struct wmManipulatorGroupType *wgt); +void TRANSFORM_WGT_gizmo(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_xform_cage(struct wmGizmoGroupType *wgt); -bool ED_widgetgroup_manipulator2d_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt); -void ED_widgetgroup_manipulator2d_setup(const struct bContext *C, struct wmManipulatorGroup *mgroup); -void ED_widgetgroup_manipulator2d_refresh(const struct bContext *C, struct wmManipulatorGroup *mgroup); -void ED_widgetgroup_manipulator2d_draw_prepare(const struct bContext *C, struct wmManipulatorGroup *mgroup); +bool ED_widgetgroup_gizmo2d_poll(const struct bContext *C, struct wmGizmoGroupType *wgt); +void ED_widgetgroup_gizmo2d_setup(const struct bContext *C, struct wmGizmoGroup *mgroup); +void ED_widgetgroup_gizmo2d_refresh(const struct bContext *C, struct wmGizmoGroup *mgroup); +void ED_widgetgroup_gizmo2d_draw_prepare(const struct bContext *C, struct wmGizmoGroup *mgroup); /* Snapping */ @@ -211,7 +211,7 @@ struct TransformCalcParams { /* Use 'Scene.orientation_type' when zero, otherwise subtract one and use. */ ushort orientation_type; }; -int ED_transform_calc_manipulator_stats( +int ED_transform_calc_gizmo_stats( const struct bContext *C, const struct TransformCalcParams *params, struct TransformBounds *tbounds); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 251f2b92acd..723dde640e4 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -73,7 +73,7 @@ struct bNodeSocket; struct wmDropBox; struct wmDrag; struct wmEvent; -struct wmManipulator; +struct wmGizmo; struct wmMsgBus; struct wmKeyMap; struct wmKeyMapItem; @@ -1265,7 +1265,7 @@ void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p); /* ui_interface_region_tooltip.c */ struct ARegion *UI_tooltip_create_from_button(struct bContext *C, struct ARegion *butregion, uiBut *but); -struct ARegion *UI_tooltip_create_from_manipulator(struct bContext *C, struct wmManipulator *mpr); +struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *mpr); void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar); /* How long before a tool-tip shows. */ diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 5e6c346d9cf..d2fbb881a0a 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -280,11 +280,11 @@ typedef enum ThemeColorID { TH_AXIS_Y, TH_AXIS_Z, - TH_MANIPULATOR_HI, - TH_MANIPULATOR_PRIMARY, - TH_MANIPULATOR_SECONDARY, - TH_MANIPULATOR_A, - TH_MANIPULATOR_B, + TH_GIZMO_HI, + TH_GIZMO_PRIMARY, + TH_GIZMO_SECONDARY, + TH_GIZMO_A, + TH_GIZMO_B, TH_LOW_GRAD, TH_HIGH_GRAD, diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index ed83a715c7e..fae547d460c 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -615,11 +615,11 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but) } } -static uiTooltipData *ui_tooltip_data_from_manipulator(bContext *C, wmManipulator *mpr) +static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *mpr) { uiTooltipData *data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - /* TODO(campbell): a way for manipulators to have their own descriptions (low priority). */ + /* TODO(campbell): a way for gizmos to have their own descriptions (low priority). */ /* Operator Actions */ { @@ -639,7 +639,7 @@ static uiTooltipData *ui_tooltip_data_from_manipulator(bContext *C, wmManipulato }; for (int i = 0; i < ARRAY_SIZE(mpop_actions); i++) { - wmManipulatorOpElem *mpop = (mpop_actions[i].part != -1) ? WM_manipulator_operator_get(mpr, mpop_actions[i].part) : NULL; + wmGizmoOpElem *mpop = (mpop_actions[i].part != -1) ? WM_gizmo_operator_get(mpr, mpop_actions[i].part) : NULL; if (mpop != NULL) { /* Description */ const char *info = RNA_struct_ui_description(mpop->type->srna); @@ -692,10 +692,10 @@ static uiTooltipData *ui_tooltip_data_from_manipulator(bContext *C, wmManipulato /* Property Actions */ if (mpr->type->target_property_defs_len) { - wmManipulatorProperty *mpr_prop_array = WM_manipulator_target_property_array(mpr); + wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr); for (int i = 0; i < mpr->type->target_property_defs_len; i++) { /* TODO(campbell): function callback descriptions. */ - wmManipulatorProperty *mpr_prop = &mpr_prop_array[i]; + wmGizmoProperty *mpr_prop = &mpr_prop_array[i]; if (mpr_prop->prop != NULL) { const char *info = RNA_property_ui_description(mpr_prop->prop); if (info && info[0]) { @@ -934,13 +934,13 @@ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *b return ui_tooltip_create_with_data(C, data, init_position, aspect); } -ARegion *UI_tooltip_create_from_manipulator(bContext *C, wmManipulator *mpr) +ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *mpr) { wmWindow *win = CTX_wm_window(C); const float aspect = 1.0f; float init_position[2]; - uiTooltipData *data = ui_tooltip_data_from_manipulator(C, mpr); + uiTooltipData *data = ui_tooltip_data_from_gizmo(C, mpr); if (data == NULL) { return NULL; } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index a2b1aa1f251..47d664eaeb2 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -679,16 +679,16 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo case TH_AXIS_Z: cp = btheme->tui.zaxis; break; - case TH_MANIPULATOR_HI: - cp = btheme->tui.manipulator_hi; break; - case TH_MANIPULATOR_PRIMARY: - cp = btheme->tui.manipulator_primary; break; - case TH_MANIPULATOR_SECONDARY: - cp = btheme->tui.manipulator_secondary; break; - case TH_MANIPULATOR_A: - cp = btheme->tui.manipulator_a; break; - case TH_MANIPULATOR_B: - cp = btheme->tui.manipulator_b; break; + case TH_GIZMO_HI: + cp = btheme->tui.gizmo_hi; break; + case TH_GIZMO_PRIMARY: + cp = btheme->tui.gizmo_primary; break; + case TH_GIZMO_SECONDARY: + cp = btheme->tui.gizmo_secondary; break; + case TH_GIZMO_A: + cp = btheme->tui.gizmo_a; break; + case TH_GIZMO_B: + cp = btheme->tui.gizmo_b; break; case TH_INFO_SELECTED: cp = ts->info_selected; @@ -1338,9 +1338,9 @@ void init_userdef_do_versions(Main *bmain) U.savetime = 1; // XXX error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n"); } - if (U.manipulator_size == 0) { - U.manipulator_size = 75; - U.manipulator_flag |= USER_MANIPULATOR_DRAW; + if (U.gizmo_size == 0) { + U.gizmo_size = 75; + U.gizmo_flag |= USER_GIZMO_DRAW; } if (U.pad_rot_angle == 0.0f) U.pad_rot_angle = 15.0f; @@ -1383,7 +1383,7 @@ void init_userdef_do_versions(Main *bmain) if (U.rvisize == 0) { U.rvisize = 15; U.rvibright = 8; - U.uiflag |= USER_SHOW_MANIPULATOR_AXIS; + U.uiflag |= USER_SHOW_GIZMO_AXIS; } } diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index 3918d8847a6..be5c01e08df 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -21,7 +21,7 @@ /** \file blender/editors/mesh/editmesh_add_gizmo.c * \ingroup edmesh * - * Creation manipulators. + * Creation gizmos. */ #include "MEM_guardedalloc.h" @@ -123,24 +123,24 @@ static void calc_initial_placement_point_from_view( /** \} */ /* -------------------------------------------------------------------- */ -/** \name Placement Manipulator +/** \name Placement Gizmo * \{ */ -typedef struct ManipulatorPlacementGroup { - struct wmManipulator *cage; +typedef struct GizmoPlacementGroup { + struct wmGizmo *cage; struct { bContext *context; wmOperator *op; PropertyRNA *prop_matrix; } data; -} ManipulatorPlacementGroup; +} GizmoPlacementGroup; /** * \warning Calling redo from property updates is not great. * This is needed because changing the RNA doesn't cause a redo * and we're not using operator UI which does just this. */ -static void manipulator_placement_exec(ManipulatorPlacementGroup *man) +static void gizmo_placement_exec(GizmoPlacementGroup *man) { wmOperator *op = man->data.op; if (op == WM_operator_last_redo((bContext *)man->data.context)) { @@ -148,7 +148,7 @@ static void manipulator_placement_exec(ManipulatorPlacementGroup *man) } } -static void manipulator_mesh_placement_update_from_op(ManipulatorPlacementGroup *man) +static void gizmo_mesh_placement_update_from_op(GizmoPlacementGroup *man) { wmOperator *op = man->data.op; UNUSED_VARS(op); @@ -159,11 +159,11 @@ static void manipulator_mesh_placement_update_from_op(ManipulatorPlacementGroup } /* translate callbacks */ -static void manipulator_placement_prop_matrix_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_placement_prop_matrix_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorPlacementGroup *man = mpr->parent_mgroup->customdata; + GizmoPlacementGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; BLI_assert(mpr_prop->type->array_length == 16); @@ -175,11 +175,11 @@ static void manipulator_placement_prop_matrix_get( } } -static void manipulator_placement_prop_matrix_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_placement_prop_matrix_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value) { - ManipulatorPlacementGroup *man = mpr->parent_mgroup->customdata; + GizmoPlacementGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; BLI_assert(mpr_prop->type->array_length == 16); @@ -194,30 +194,30 @@ static void manipulator_placement_prop_matrix_set( RNA_property_float_set_array(op->ptr, man->data.prop_matrix, &mat[0][0]); - manipulator_placement_exec(man); + gizmo_placement_exec(man); } -static bool manipulator_mesh_placement_poll(const bContext *C, wmManipulatorGroupType *wgt) +static bool gizmo_mesh_placement_poll(const bContext *C, wmGizmoGroupType *wgt) { wmOperator *op = WM_operator_last_redo(C); - if (op == NULL || !STREQ(op->type->idname, "MESH_OT_primitive_cube_add_manipulator")) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + if (op == NULL || !STREQ(op->type->idname, "MESH_OT_primitive_cube_add_gizmo")) { + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } return true; } -static void manipulator_mesh_placement_modal_from_setup( - const bContext *C, wmManipulatorGroup *mgroup) +static void gizmo_mesh_placement_modal_from_setup( + const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorPlacementGroup *man = mgroup->customdata; + GizmoPlacementGroup *man = mgroup->customdata; /* Initial size. */ { - wmManipulator *mpr = man->cage; + wmGizmo *mpr = man->cage; zero_m4(mpr->matrix_offset); - /* TODO: support zero scaled matrix in 'MANIPULATOR_WT_cage_3d'. */ + /* TODO: support zero scaled matrix in 'GIZMO_WT_cage_3d'. */ mpr->matrix_offset[0][0] = 0.01; mpr->matrix_offset[1][1] = 0.01; mpr->matrix_offset[2][2] = 0.01; @@ -228,7 +228,7 @@ static void manipulator_mesh_placement_modal_from_setup( { wmWindow *win = CTX_wm_window(C); ARegion *ar = CTX_wm_region(C); - wmManipulator *mpr = man->cage; + wmGizmo *mpr = man->cage; { float mat3[3][3]; @@ -244,87 +244,87 @@ static void manipulator_mesh_placement_modal_from_setup( } if (1) { - wmManipulatorMap *mmap = mgroup->parent_mmap; - WM_manipulator_modal_set_from_setup( - mmap, (bContext *)C, man->cage, ED_MANIPULATOR_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, win->eventstate); + wmGizmoMap *mmap = mgroup->parent_mmap; + WM_gizmo_modal_set_from_setup( + mmap, (bContext *)C, man->cage, ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, win->eventstate); } } } -static void manipulator_mesh_placement_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void gizmo_mesh_placement_setup(const bContext *C, wmGizmoGroup *mgroup) { wmOperator *op = WM_operator_last_redo(C); - if (op == NULL || !STREQ(op->type->idname, "MESH_OT_primitive_cube_add_manipulator")) { + if (op == NULL || !STREQ(op->type->idname, "MESH_OT_primitive_cube_add_gizmo")) { return; } - struct ManipulatorPlacementGroup *man = MEM_callocN(sizeof(ManipulatorPlacementGroup), __func__); + struct GizmoPlacementGroup *man = MEM_callocN(sizeof(GizmoPlacementGroup), __func__); mgroup->customdata = man; - const wmManipulatorType *wt_cage = WM_manipulatortype_find("MANIPULATOR_WT_cage_3d", true); + const wmGizmoType *wt_cage = WM_gizmotype_find("GIZMO_WT_cage_3d", true); - man->cage = WM_manipulator_new_ptr(wt_cage, mgroup, NULL); + man->cage = WM_gizmo_new_ptr(wt_cage, mgroup, NULL); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->cage->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->cage->color); RNA_enum_set(man->cage->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_SIGNED); + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED); - WM_manipulator_set_flag(man->cage, WM_MANIPULATOR_DRAW_VALUE, true); + WM_gizmo_set_flag(man->cage, WM_GIZMO_DRAW_VALUE, true); man->data.context = (bContext *)C; man->data.op = op; man->data.prop_matrix = RNA_struct_find_property(op->ptr, "matrix"); - manipulator_mesh_placement_update_from_op(man); + gizmo_mesh_placement_update_from_op(man); /* Setup property callbacks */ { - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->cage, "matrix", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_placement_prop_matrix_get, - .value_set_fn = manipulator_placement_prop_matrix_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_placement_prop_matrix_get, + .value_set_fn = gizmo_placement_prop_matrix_set, .range_get_fn = NULL, .user_data = NULL, }); } - manipulator_mesh_placement_modal_from_setup(C, mgroup); + gizmo_mesh_placement_modal_from_setup(C, mgroup); } -static void manipulator_mesh_placement_draw_prepare( - const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void gizmo_mesh_placement_draw_prepare( + const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - ManipulatorPlacementGroup *man = mgroup->customdata; + GizmoPlacementGroup *man = mgroup->customdata; if (man->data.op->next) { man->data.op = WM_operator_last_redo((bContext *)man->data.context); } - manipulator_mesh_placement_update_from_op(man); + gizmo_mesh_placement_update_from_op(man); } -static void MESH_WGT_add_bounds(struct wmManipulatorGroupType *wgt) +static void MESH_WGT_add_bounds(struct wmGizmoGroupType *wgt) { wgt->name = "Mesh Add Bounds"; wgt->idname = "MESH_WGT_add_bounds"; - wgt->flag = WM_MANIPULATORGROUPTYPE_3D; + wgt->flag = WM_GIZMOGROUPTYPE_3D; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; - wgt->poll = manipulator_mesh_placement_poll; - wgt->setup = manipulator_mesh_placement_setup; - wgt->draw_prepare = manipulator_mesh_placement_draw_prepare; + wgt->poll = gizmo_mesh_placement_poll; + wgt->setup = gizmo_mesh_placement_setup; + wgt->draw_prepare = gizmo_mesh_placement_draw_prepare; } /** \} */ /* -------------------------------------------------------------------- */ -/** \name Add Cube Manipulator-Operator +/** \name Add Cube Gizmo-Operator * * For now we use a separate operator to add a cube, * we can try to merge then however they are invoked differently @@ -332,13 +332,13 @@ static void MESH_WGT_add_bounds(struct wmManipulatorGroupType *wgt) * \{ */ -static int add_primitive_cube_manipulator_exec(bContext *C, wmOperator *op) +static int add_primitive_cube_gizmo_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C);; BMEditMesh *em = BKE_editmesh_from_object(obedit); float matrix[4][4]; - /* Get the matrix that defines the cube bounds (as set by the manipulator cage). */ + /* Get the matrix that defines the cube bounds (as set by the gizmo cage). */ { PropertyRNA *prop_matrix = RNA_struct_find_property(op->ptr, "matrix"); if (RNA_property_is_set(op->ptr, prop_matrix)) { @@ -372,25 +372,25 @@ static int add_primitive_cube_manipulator_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int add_primitive_cube_manipulator_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +static int add_primitive_cube_gizmo_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { View3D *v3d = CTX_wm_view3d(C); - int ret = add_primitive_cube_manipulator_exec(C, op); + int ret = add_primitive_cube_gizmo_exec(C, op); if (ret & OPERATOR_FINISHED) { - /* Setup manipulators */ - if (v3d && ((v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0)) { + /* Setup gizmos */ + if (v3d && ((v3d->mpr_flag & V3D_GIZMO_HIDE) == 0)) { ARegion *ar = CTX_wm_region(C); - wmManipulatorMap *mmap = ar->manipulator_map; - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find("MESH_WGT_add_bounds", false); - wmManipulatorGroup *mgroup = WM_manipulatormap_group_find_ptr(mmap, wgt); + wmGizmoMap *mmap = ar->gizmo_map; + wmGizmoGroupType *wgt = WM_gizmogrouptype_find("MESH_WGT_add_bounds", false); + wmGizmoGroup *mgroup = WM_gizmomap_group_find_ptr(mmap, wgt); if (mgroup != NULL) { - ManipulatorPlacementGroup *man = mgroup->customdata; + GizmoPlacementGroup *man = mgroup->customdata; man->data.op = op; - manipulator_mesh_placement_modal_from_setup(C, mgroup); + gizmo_mesh_placement_modal_from_setup(C, mgroup); } else { - WM_manipulator_group_type_ensure_ptr(wgt); + WM_gizmo_group_type_ensure_ptr(wgt); } } } @@ -398,16 +398,16 @@ static int add_primitive_cube_manipulator_invoke(bContext *C, wmOperator *op, co return ret; } -void MESH_OT_primitive_cube_add_manipulator(wmOperatorType *ot) +void MESH_OT_primitive_cube_add_gizmo(wmOperatorType *ot) { /* identifiers */ ot->name = "Add Cube"; ot->description = "Construct a cube mesh"; - ot->idname = "MESH_OT_primitive_cube_add_manipulator"; + ot->idname = "MESH_OT_primitive_cube_add_gizmo"; /* api callbacks */ - ot->invoke = add_primitive_cube_manipulator_invoke; - ot->exec = add_primitive_cube_manipulator_exec; + ot->invoke = add_primitive_cube_gizmo_invoke; + ot->exec = add_primitive_cube_gizmo_exec; ot->poll = ED_operator_editmesh_view3d; /* flags */ @@ -420,7 +420,7 @@ void MESH_OT_primitive_cube_add_manipulator(wmOperatorType *ot) PropertyRNA *prop = RNA_def_float_matrix(ot->srna, "matrix", 4, 4, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); - WM_manipulatorgrouptype_append(MESH_WGT_add_bounds); + WM_gizmogrouptype_append(MESH_WGT_add_bounds); } /** \} */ diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 58246a60362..b73ce410626 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -202,7 +202,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal) if (v3d) { opdata->mpr_flag = v3d->mpr_flag; - v3d->mpr_flag = V3D_MANIPULATOR_HIDE; + v3d->mpr_flag = V3D_GIZMO_HIDE; } } diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 87a65924979..a9e11b7b411 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -54,9 +54,9 @@ #include "mesh_intern.h" /* own include */ -#define USE_MANIPULATOR +#define USE_GIZMO -#ifdef USE_MANIPULATOR +#ifdef USE_GIZMO #include "ED_gizmo_library.h" #include "ED_undo.h" #endif @@ -157,7 +157,7 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* misc other vars */ G.moving = G_TRANSFORM_EDIT; opdata->mpr_flag = v3d->mpr_flag; - v3d->mpr_flag = V3D_MANIPULATOR_HIDE; + v3d->mpr_flag = V3D_GIZMO_HIDE; /* initialize modal callout */ ED_workspace_status_text(C, IFACE_("LMB: Click and drag to draw cut line")); @@ -195,12 +195,12 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event) if (ret & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) { edbm_bisect_exit(C, &opdata_back); -#ifdef USE_MANIPULATOR - /* Setup manipulators */ +#ifdef USE_GIZMO + /* Setup gizmos */ { View3D *v3d = CTX_wm_view3d(C); - if (v3d && (v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0) { - WM_manipulator_group_type_ensure("MESH_WGT_bisect"); + if (v3d && (v3d->mpr_flag & V3D_GIZMO_HIDE) == 0) { + WM_gizmo_group_type_ensure("MESH_WGT_bisect"); } } #endif @@ -333,8 +333,8 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op) } } -#ifdef USE_MANIPULATOR -static void MESH_WGT_bisect(struct wmManipulatorGroupType *wgt); +#ifdef USE_GIZMO +static void MESH_WGT_bisect(struct wmGizmoGroupType *wgt); #endif void MESH_OT_bisect(struct wmOperatorType *ot) @@ -373,26 +373,26 @@ void MESH_OT_bisect(struct wmOperatorType *ot) WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); -#ifdef USE_MANIPULATOR - WM_manipulatorgrouptype_append(MESH_WGT_bisect); +#ifdef USE_GIZMO + WM_gizmogrouptype_append(MESH_WGT_bisect); #endif } -#ifdef USE_MANIPULATOR +#ifdef USE_GIZMO /* -------------------------------------------------------------------- */ -/** \name Bisect Manipulator +/** \name Bisect Gizmo * \{ */ -typedef struct ManipulatorGroup { +typedef struct GizmoGroup { /* Arrow to change plane depth. */ - struct wmManipulator *translate_z; + struct wmGizmo *translate_z; /* Translate XYZ */ - struct wmManipulator *translate_c; - /* For grabbing the manipulator and moving freely. */ - struct wmManipulator *rotate_c; + struct wmGizmo *translate_c; + /* For grabbing the gizmo and moving freely. */ + struct wmGizmo *rotate_c; /* We could store more vars here! */ struct { @@ -404,14 +404,14 @@ typedef struct ManipulatorGroup { float rotate_axis[3]; float rotate_up[3]; } data; -} ManipulatorGroup; +} GizmoGroup; /** * XXX. calling redo from property updates is not great. * This is needed because changing the RNA doesn't cause a redo * and we're not using operator UI which does just this. */ -static void manipulator_bisect_exec(ManipulatorGroup *man) +static void gizmo_bisect_exec(GizmoGroup *man) { wmOperator *op = man->data.op; if (op == WM_operator_last_redo((bContext *)man->data.context)) { @@ -419,7 +419,7 @@ static void manipulator_bisect_exec(ManipulatorGroup *man) } } -static void manipulator_mesh_bisect_update_from_op(ManipulatorGroup *man) +static void gizmo_mesh_bisect_update_from_op(GizmoGroup *man) { wmOperator *op = man->data.op; @@ -428,13 +428,13 @@ static void manipulator_mesh_bisect_update_from_op(ManipulatorGroup *man) RNA_property_float_get_array(op->ptr, man->data.prop_plane_co, plane_co); RNA_property_float_get_array(op->ptr, man->data.prop_plane_no, plane_no); - WM_manipulator_set_matrix_location(man->translate_z, plane_co); - WM_manipulator_set_matrix_location(man->rotate_c, plane_co); + WM_gizmo_set_matrix_location(man->translate_z, plane_co); + WM_gizmo_set_matrix_location(man->rotate_c, plane_co); /* translate_c location comes from the property. */ - WM_manipulator_set_matrix_rotation_from_z_axis(man->translate_z, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_z, plane_no); - WM_manipulator_set_scale(man->translate_c, 0.2); + WM_gizmo_set_scale(man->translate_c, 0.2); RegionView3D *rv3d = ED_view3d_context_rv3d(man->data.context); if (rv3d) { @@ -445,24 +445,24 @@ static void manipulator_mesh_bisect_update_from_op(ManipulatorGroup *man) project_plane_normalized_v3_v3v3(man->data.rotate_up, man->data.rotate_up, man->data.rotate_axis); normalize_v3(man->data.rotate_up); - WM_manipulator_set_matrix_rotation_from_z_axis(man->translate_c, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_c, plane_no); float plane_no_cross[3]; cross_v3_v3v3(plane_no_cross, plane_no, man->data.rotate_axis); - WM_manipulator_set_matrix_offset_rotation_from_yz_axis(man->rotate_c, plane_no_cross, man->data.rotate_axis); + WM_gizmo_set_matrix_offset_rotation_from_yz_axis(man->rotate_c, plane_no_cross, man->data.rotate_axis); RNA_enum_set(man->rotate_c->ptr, "draw_options", - ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR | - ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y); + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR | + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y); } } /* depth callbacks */ -static void manipulator_bisect_prop_depth_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_bisect_prop_depth_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorGroup *man = mpr->parent_mgroup->customdata; + GizmoGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; @@ -476,11 +476,11 @@ static void manipulator_bisect_prop_depth_get( value[0] = dot_v3v3(plane_no, plane_co) - dot_v3v3(plane_no, mpr->matrix_basis[3]); } -static void manipulator_bisect_prop_depth_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_bisect_prop_depth_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { - ManipulatorGroup *man = mpr->parent_mgroup->customdata; + GizmoGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; const float *value = value_p; @@ -499,15 +499,15 @@ static void manipulator_bisect_prop_depth_set( RNA_property_float_set_array(op->ptr, man->data.prop_plane_co, plane_co); - manipulator_bisect_exec(man); + gizmo_bisect_exec(man); } /* translate callbacks */ -static void manipulator_bisect_prop_translate_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_bisect_prop_translate_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorGroup *man = mpr->parent_mgroup->customdata; + GizmoGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; BLI_assert(mpr_prop->type->array_length == 3); @@ -516,11 +516,11 @@ static void manipulator_bisect_prop_translate_get( RNA_property_float_get_array(op->ptr, man->data.prop_plane_co, value_p); } -static void manipulator_bisect_prop_translate_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_bisect_prop_translate_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { - ManipulatorGroup *man = mpr->parent_mgroup->customdata; + GizmoGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; BLI_assert(mpr_prop->type->array_length == 3); @@ -528,15 +528,15 @@ static void manipulator_bisect_prop_translate_set( RNA_property_float_set_array(op->ptr, man->data.prop_plane_co, value_p); - manipulator_bisect_exec(man); + gizmo_bisect_exec(man); } /* angle callbacks */ -static void manipulator_bisect_prop_angle_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_bisect_prop_angle_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorGroup *man = mpr->parent_mgroup->customdata; + GizmoGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; @@ -559,11 +559,11 @@ static void manipulator_bisect_prop_angle_get( } } -static void manipulator_bisect_prop_angle_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_bisect_prop_angle_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { - ManipulatorGroup *man = mpr->parent_mgroup->customdata; + GizmoGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; const float *value = value_p; @@ -588,22 +588,22 @@ static void manipulator_bisect_prop_angle_set( /* re-normalize - seems acceptable */ RNA_property_float_set_array(op->ptr, man->data.prop_plane_no, plane_no); - manipulator_bisect_exec(man); + gizmo_bisect_exec(man); } } } -static bool manipulator_mesh_bisect_poll(const bContext *C, wmManipulatorGroupType *wgt) +static bool gizmo_mesh_bisect_poll(const bContext *C, wmGizmoGroupType *wgt) { wmOperator *op = WM_operator_last_redo(C); if (op == NULL || !STREQ(op->type->idname, "MESH_OT_bisect")) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } return true; } -static void manipulator_mesh_bisect_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *mgroup) { wmOperator *op = WM_operator_last_redo(C); @@ -611,26 +611,26 @@ static void manipulator_mesh_bisect_setup(const bContext *C, wmManipulatorGroup return; } - struct ManipulatorGroup *man = MEM_callocN(sizeof(ManipulatorGroup), __func__); + struct GizmoGroup *man = MEM_callocN(sizeof(GizmoGroup), __func__); mgroup->customdata = man; - const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true); - const wmManipulatorType *wt_grab = WM_manipulatortype_find("MANIPULATOR_WT_grab_3d", true); - const wmManipulatorType *wt_dial = WM_manipulatortype_find("MANIPULATOR_WT_dial_3d", true); + const wmGizmoType *wt_arrow = WM_gizmotype_find("GIZMO_WT_arrow_3d", true); + const wmGizmoType *wt_grab = WM_gizmotype_find("GIZMO_WT_grab_3d", true); + const wmGizmoType *wt_dial = WM_gizmotype_find("GIZMO_WT_dial_3d", true); - man->translate_z = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - man->translate_c = WM_manipulator_new_ptr(wt_grab, mgroup, NULL); - man->rotate_c = WM_manipulator_new_ptr(wt_dial, mgroup, NULL); + man->translate_z = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + man->translate_c = WM_gizmo_new_ptr(wt_grab, mgroup, NULL); + man->rotate_c = WM_gizmo_new_ptr(wt_dial, mgroup, NULL); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->translate_z->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->translate_c->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_SECONDARY, man->rotate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_z->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, man->rotate_c->color); - RNA_enum_set(man->translate_z->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_NORMAL); - RNA_enum_set(man->translate_c->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_RING_2D); + RNA_enum_set(man->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL); + RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_RING_2D); - WM_manipulator_set_flag(man->translate_c, WM_MANIPULATOR_DRAW_VALUE, true); - WM_manipulator_set_flag(man->rotate_c, WM_MANIPULATOR_DRAW_VALUE, true); + WM_gizmo_set_flag(man->translate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(man->rotate_c, WM_GIZMO_DRAW_VALUE, true); { man->data.context = (bContext *)C; @@ -639,64 +639,64 @@ static void manipulator_mesh_bisect_setup(const bContext *C, wmManipulatorGroup man->data.prop_plane_no = RNA_struct_find_property(op->ptr, "plane_no"); } - manipulator_mesh_bisect_update_from_op(man); + gizmo_mesh_bisect_update_from_op(man); /* Setup property callbacks */ { - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->translate_z, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_bisect_prop_depth_get, - .value_set_fn = manipulator_bisect_prop_depth_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_bisect_prop_depth_get, + .value_set_fn = gizmo_bisect_prop_depth_set, .range_get_fn = NULL, .user_data = NULL, }); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->translate_c, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_bisect_prop_translate_get, - .value_set_fn = manipulator_bisect_prop_translate_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_bisect_prop_translate_get, + .value_set_fn = gizmo_bisect_prop_translate_set, .range_get_fn = NULL, .user_data = NULL, }); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->rotate_c, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_bisect_prop_angle_get, - .value_set_fn = manipulator_bisect_prop_angle_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_bisect_prop_angle_get, + .value_set_fn = gizmo_bisect_prop_angle_set, .range_get_fn = NULL, .user_data = NULL, }); } } -static void manipulator_mesh_bisect_draw_prepare( - const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void gizmo_mesh_bisect_draw_prepare( + const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - ManipulatorGroup *man = mgroup->customdata; + GizmoGroup *man = mgroup->customdata; if (man->data.op->next) { man->data.op = WM_operator_last_redo((bContext *)man->data.context); } - manipulator_mesh_bisect_update_from_op(man); + gizmo_mesh_bisect_update_from_op(man); } -static void MESH_WGT_bisect(struct wmManipulatorGroupType *wgt) +static void MESH_WGT_bisect(struct wmGizmoGroupType *wgt) { wgt->name = "Mesh Bisect"; wgt->idname = "MESH_WGT_bisect"; - wgt->flag = WM_MANIPULATORGROUPTYPE_3D; + wgt->flag = WM_GIZMOGROUPTYPE_3D; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; - wgt->poll = manipulator_mesh_bisect_poll; - wgt->setup = manipulator_mesh_bisect_setup; - wgt->draw_prepare = manipulator_mesh_bisect_draw_prepare; + wgt->poll = gizmo_mesh_bisect_poll; + wgt->setup = gizmo_mesh_bisect_setup; + wgt->draw_prepare = gizmo_mesh_bisect_draw_prepare; } /** \} */ -#endif /* USE_MANIPULATOR */ +#endif /* USE_GIZMO */ diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index b007bcf04ba..dd167c1fc15 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -61,7 +61,7 @@ #include "mesh_intern.h" /* own include */ -#define USE_MANIPULATOR +#define USE_GIZMO /* -------------------------------------------------------------------- */ /** \name Extrude Internal Utilities @@ -360,10 +360,10 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot) /* -------------------------------------------------------------------- */ -/** \name Extrude Manipulator +/** \name Extrude Gizmo * \{ */ -#ifdef USE_MANIPULATOR +#ifdef USE_GIZMO const float extrude_button_scale = 0.15f; const float extrude_button_offset_scale = 1.5f; @@ -380,11 +380,11 @@ static const uchar shape_plus[] = { 0x90, 0x6e, 0xd7, 0x80, 0xff, 0x5f, 0xfb, 0x5f, 0xfb, }; -typedef struct ManipulatorExtrudeGroup { +typedef struct GizmoExtrudeGroup { /* XYZ & normal. */ - struct wmManipulator *invoke_xyz_no[4]; - struct wmManipulator *adjust_xyz_no[5]; + struct wmGizmo *invoke_xyz_no[4]; + struct wmGizmo *adjust_xyz_no[5]; struct { float normal_mat3[3][3]; /* use Z axis for normal. */ @@ -392,10 +392,10 @@ typedef struct ManipulatorExtrudeGroup { } data; wmOperatorType *ot_extrude; -} ManipulatorExtrudeGroup; +} GizmoExtrudeGroup; -static void manipulator_mesh_extrude_orientation_matrix_set( - struct ManipulatorExtrudeGroup *man, const float mat[3][3]) +static void gizmo_mesh_extrude_orientation_matrix_set( + struct GizmoExtrudeGroup *man, const float mat[3][3]) { for (int i = 0; i < 3; i++) { /* Set orientation without location. */ @@ -417,32 +417,32 @@ static void manipulator_mesh_extrude_orientation_matrix_set( } } -static bool manipulator_mesh_extrude_poll(const bContext *C, wmManipulatorGroupType *wgt) +static bool gizmo_mesh_extrude_poll(const bContext *C, wmGizmoGroupType *wgt) { ScrArea *sa = CTX_wm_area(C); bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL; if ((tref_rt == NULL) || - !STREQ(wgt->idname, tref_rt->manipulator_group) || + !STREQ(wgt->idname, tref_rt->gizmo_group) || !ED_operator_editmesh_view3d((bContext *)C)) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } return true; } -static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void gizmo_mesh_extrude_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - struct ManipulatorExtrudeGroup *man = MEM_callocN(sizeof(ManipulatorExtrudeGroup), __func__); + struct GizmoExtrudeGroup *man = MEM_callocN(sizeof(GizmoExtrudeGroup), __func__); mgroup->customdata = man; - const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true); - const wmManipulatorType *wt_grab = WM_manipulatortype_find("MANIPULATOR_WT_button_2d", true); + const wmGizmoType *wt_arrow = WM_gizmotype_find("GIZMO_WT_arrow_3d", true); + const wmGizmoType *wt_grab = WM_gizmotype_find("GIZMO_WT_button_2d", true); for (int i = 0; i < 4; i++) { - man->adjust_xyz_no[i] = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - man->invoke_xyz_no[i] = WM_manipulator_new_ptr(wt_grab, mgroup, NULL); - man->invoke_xyz_no[i]->flag |= WM_MANIPULATOR_DRAW_OFFSET_SCALE; + man->adjust_xyz_no[i] = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + man->invoke_xyz_no[i] = WM_gizmo_new_ptr(wt_grab, mgroup, NULL); + man->invoke_xyz_no[i]->flag |= WM_GIZMO_DRAW_OFFSET_SCALE; } { @@ -460,25 +460,25 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula UI_GetThemeColor3fv(TH_AXIS_X + i, man->invoke_xyz_no[i]->color); UI_GetThemeColor3fv(TH_AXIS_X + i, man->adjust_xyz_no[i]->color); } - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->invoke_xyz_no[3]->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->adjust_xyz_no[3]->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->invoke_xyz_no[3]->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->adjust_xyz_no[3]->color); for (int i = 0; i < 4; i++) { - WM_manipulator_set_scale(man->invoke_xyz_no[i], extrude_button_scale); - WM_manipulator_set_scale(man->adjust_xyz_no[i], extrude_arrow_scale); + WM_gizmo_set_scale(man->invoke_xyz_no[i], extrude_button_scale); + WM_gizmo_set_scale(man->adjust_xyz_no[i], extrude_arrow_scale); } - WM_manipulator_set_scale(man->adjust_xyz_no[3], extrude_arrow_normal_axis_scale); + WM_gizmo_set_scale(man->adjust_xyz_no[3], extrude_arrow_normal_axis_scale); for (int i = 0; i < 4; i++) { } for (int i = 0; i < 4; i++) { - WM_manipulator_set_flag(man->adjust_xyz_no[i], WM_MANIPULATOR_DRAW_VALUE, true); + WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_DRAW_VALUE, true); } /* XYZ & normal axis extrude. */ for (int i = 0; i < 4; i++) { - PointerRNA *ptr = WM_manipulator_operator_set(man->invoke_xyz_no[i], 0, man->ot_extrude, NULL); + PointerRNA *ptr = WM_gizmo_operator_set(man->invoke_xyz_no[i], 0, man->ot_extrude, NULL); { bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; @@ -490,7 +490,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula /* Adjust extrude. */ for (int i = 0; i < 4; i++) { - PointerRNA *ptr = WM_manipulator_operator_set(man->adjust_xyz_no[i], 0, man->ot_extrude, NULL); + PointerRNA *ptr = WM_gizmo_operator_set(man->adjust_xyz_no[i], 0, man->ot_extrude, NULL); { bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; @@ -498,18 +498,18 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula RNA_boolean_set(¯optr, "release_confirm", true); RNA_boolean_set_array(¯optr, "constraint_axis", constraint); } - wmManipulatorOpElem *mpop = WM_manipulator_operator_get(man->adjust_xyz_no[i], 0); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(man->adjust_xyz_no[i], 0); mpop->is_redo = true; } } -static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorExtrudeGroup *man = mgroup->customdata; + GizmoExtrudeGroup *man = mgroup->customdata; for (int i = 0; i < 4; i++) { - WM_manipulator_set_flag(man->invoke_xyz_no[i], WM_MANIPULATOR_HIDDEN, true); - WM_manipulator_set_flag(man->adjust_xyz_no[i], WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(man->invoke_xyz_no[i], WM_GIZMO_HIDDEN, true); + WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_HIDDEN, true); } if (G.moving) { @@ -525,7 +525,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro if (use_normal) { struct TransformBounds tbounds_normal; - if (!ED_transform_calc_manipulator_stats( + if (!ED_transform_calc_gizmo_stats( C, &(struct TransformCalcParams){ .orientation_type = V3D_MANIP_NORMAL + 1, }, &tbounds_normal)) @@ -536,7 +536,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro } /* TODO(campbell): run second since this modifies the 3D view, it should not. */ - if (!ED_transform_calc_manipulator_stats( + if (!ED_transform_calc_gizmo_stats( C, &(struct TransformCalcParams){ .orientation_type = man->data.orientation_type + 1, }, &tbounds)) @@ -556,15 +556,15 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro (extrude_arrow_normal_axis_scale * extrude_button_offset_scale) / extrude_button_scale); /* Needed for normal orientation. */ - manipulator_mesh_extrude_orientation_matrix_set(man, tbounds.axis); + gizmo_mesh_extrude_orientation_matrix_set(man, tbounds.axis); if (use_normal) { copy_m4_m3(man->adjust_xyz_no[3]->matrix_basis, man->data.normal_mat3); } /* Location. */ for (int i = 0; i < axis_len_used; i++) { - WM_manipulator_set_matrix_location(man->invoke_xyz_no[i], tbounds.center); - WM_manipulator_set_matrix_location(man->adjust_xyz_no[i], tbounds.center); + WM_gizmo_set_matrix_location(man->invoke_xyz_no[i], tbounds.center); + WM_gizmo_set_matrix_location(man->adjust_xyz_no[i], tbounds.center); } wmOperator *op = WM_operator_last_redo(C); @@ -572,13 +572,13 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro /* Un-hide. */ for (int i = 0; i < axis_len_used; i++) { - WM_manipulator_set_flag(man->invoke_xyz_no[i], WM_MANIPULATOR_HIDDEN, false); - WM_manipulator_set_flag(man->adjust_xyz_no[i], WM_MANIPULATOR_HIDDEN, !has_redo); + WM_gizmo_set_flag(man->invoke_xyz_no[i], WM_GIZMO_HIDDEN, false); + WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_HIDDEN, !has_redo); } /* Operator properties. */ if (use_normal) { - wmManipulatorOpElem *mpop = WM_manipulator_operator_get(man->invoke_xyz_no[3], 0); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(man->invoke_xyz_no[3], 0); PointerRNA macroptr = RNA_pointer_get(&mpop->ptr, "TRANSFORM_OT_translate"); RNA_enum_set(¯optr, "constraint_orientation", V3D_MANIP_NORMAL); } @@ -598,7 +598,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro (orientation_type == man->data.orientation_type && constraint_axis[i]) : (orientation_type == V3D_MANIP_NORMAL && constraint_axis[2])) { - wmManipulatorOpElem *mpop = WM_manipulator_operator_get(man->adjust_xyz_no[i], 0); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(man->adjust_xyz_no[i], 0); PointerRNA macroptr = RNA_pointer_get(&mpop->ptr, "TRANSFORM_OT_translate"); @@ -609,7 +609,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro else { /* TODO(campbell): ideally we could adjust all, * this is complicated by how operator redo and the transform macro works. */ - WM_manipulator_set_flag(man->adjust_xyz_no[i], WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(man->adjust_xyz_no[i], WM_GIZMO_HIDDEN, true); } } } @@ -618,14 +618,14 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro RNA_enum_set( man->invoke_xyz_no[i]->ptr, "draw_options", - (man->adjust_xyz_no[i]->flag & WM_MANIPULATOR_HIDDEN) ? - ED_MANIPULATOR_BUTTON_SHOW_HELPLINE : 0); + (man->adjust_xyz_no[i]->flag & WM_GIZMO_HIDDEN) ? + ED_GIZMO_BUTTON_SHOW_HELPLINE : 0); } } -static void manipulator_mesh_extrude_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void gizmo_mesh_extrude_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorExtrudeGroup *man = mgroup->customdata; + GizmoExtrudeGroup *man = mgroup->customdata; switch (man->data.orientation_type) { case V3D_MANIP_VIEW: { @@ -633,14 +633,14 @@ static void manipulator_mesh_extrude_draw_prepare(const bContext *C, wmManipulat float mat[3][3]; copy_m3_m4(mat, rv3d->viewinv); normalize_m3(mat); - manipulator_mesh_extrude_orientation_matrix_set(man, mat); + gizmo_mesh_extrude_orientation_matrix_set(man, mat); break; } } } -static void manipulator_mesh_extrude_message_subscribe( - const bContext *C, wmManipulatorGroup *mgroup, struct wmMsgBus *mbus) +static void gizmo_mesh_extrude_message_subscribe( + const bContext *C, wmGizmoGroup *mgroup, struct wmMsgBus *mbus) { ARegion *ar = CTX_wm_region(C); @@ -648,7 +648,7 @@ static void manipulator_mesh_extrude_message_subscribe( wmMsgSubscribeValue msg_sub_value_mpr_tag_refresh = { .owner = ar, .user_data = mgroup->parent_mmap, - .notify = WM_manipulator_do_msg_notify_tag_refresh, + .notify = WM_gizmo_do_msg_notify_tag_refresh, }; { @@ -657,24 +657,24 @@ static void manipulator_mesh_extrude_message_subscribe( } -static void MESH_WGT_extrude(struct wmManipulatorGroupType *wgt) +static void MESH_WGT_extrude(struct wmGizmoGroupType *wgt) { wgt->name = "Mesh Extrude"; wgt->idname = "MESH_WGT_extrude"; - wgt->flag = WM_MANIPULATORGROUPTYPE_3D; + wgt->flag = WM_GIZMOGROUPTYPE_3D; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; - wgt->poll = manipulator_mesh_extrude_poll; - wgt->setup = manipulator_mesh_extrude_setup; - wgt->refresh = manipulator_mesh_extrude_refresh; - wgt->draw_prepare = manipulator_mesh_extrude_draw_prepare; - wgt->message_subscribe = manipulator_mesh_extrude_message_subscribe; + wgt->poll = gizmo_mesh_extrude_poll; + wgt->setup = gizmo_mesh_extrude_setup; + wgt->refresh = gizmo_mesh_extrude_refresh; + wgt->draw_prepare = gizmo_mesh_extrude_draw_prepare; + wgt->message_subscribe = gizmo_mesh_extrude_message_subscribe; } -#endif /* USE_MANIPULATOR */ +#endif /* USE_GIZMO */ /** \} */ @@ -825,8 +825,8 @@ void MESH_OT_extrude_context(wmOperatorType *ot) Transform_Properties(ot, P_NO_DEFAULTS | P_MIRROR_DUMMY); -#ifdef USE_MANIPULATOR - WM_manipulatorgrouptype_append(MESH_WGT_extrude); +#ifdef USE_GIZMO + WM_gizmogrouptype_append(MESH_WGT_extrude); #endif } diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c index 74e2833b2d9..3864bd63036 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin.c @@ -54,27 +54,27 @@ #include "mesh_intern.h" /* own include */ -#define USE_MANIPULATOR +#define USE_GIZMO -#ifdef USE_MANIPULATOR +#ifdef USE_GIZMO #include "ED_gizmo_library.h" #include "ED_undo.h" #endif /* -------------------------------------------------------------------- */ -/** \name Spin Manipulator +/** \name Spin Gizmo * \{ */ -#ifdef USE_MANIPULATOR -typedef struct ManipulatorSpinGroup { +#ifdef USE_GIZMO +typedef struct GizmoSpinGroup { /* Arrow to change plane depth. */ - struct wmManipulator *translate_z; + struct wmGizmo *translate_z; /* Translate XYZ */ - struct wmManipulator *translate_c; - /* For grabbing the manipulator and moving freely. */ - struct wmManipulator *rotate_c; + struct wmGizmo *translate_c; + /* For grabbing the gizmo and moving freely. */ + struct wmGizmo *rotate_c; /* Spin angle */ - struct wmManipulator *angle_z; + struct wmGizmo *angle_z; /* We could store more vars here! */ struct { @@ -87,14 +87,14 @@ typedef struct ManipulatorSpinGroup { float rotate_axis[3]; float rotate_up[3]; } data; -} ManipulatorSpinGroup; +} GizmoSpinGroup; /** * XXX. calling redo from property updates is not great. * This is needed because changing the RNA doesn't cause a redo * and we're not using operator UI which does just this. */ -static void manipulator_spin_exec(ManipulatorSpinGroup *man) +static void gizmo_spin_exec(GizmoSpinGroup *man) { wmOperator *op = man->data.op; if (op == WM_operator_last_redo((bContext *)man->data.context)) { @@ -102,7 +102,7 @@ static void manipulator_spin_exec(ManipulatorSpinGroup *man) } } -static void manipulator_mesh_spin_update_from_op(ManipulatorSpinGroup *man) +static void gizmo_mesh_spin_update_from_op(GizmoSpinGroup *man) { wmOperator *op = man->data.op; @@ -111,15 +111,15 @@ static void manipulator_mesh_spin_update_from_op(ManipulatorSpinGroup *man) RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, plane_co); RNA_property_float_get_array(op->ptr, man->data.prop_axis_no, plane_no); - WM_manipulator_set_matrix_location(man->translate_z, plane_co); - WM_manipulator_set_matrix_location(man->rotate_c, plane_co); - WM_manipulator_set_matrix_location(man->angle_z, plane_co); + WM_gizmo_set_matrix_location(man->translate_z, plane_co); + WM_gizmo_set_matrix_location(man->rotate_c, plane_co); + WM_gizmo_set_matrix_location(man->angle_z, plane_co); /* translate_c location comes from the property. */ - WM_manipulator_set_matrix_rotation_from_z_axis(man->translate_z, plane_no); - WM_manipulator_set_matrix_rotation_from_z_axis(man->angle_z, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_z, plane_no); + WM_gizmo_set_matrix_rotation_from_z_axis(man->angle_z, plane_no); - WM_manipulator_set_scale(man->translate_c, 0.2); + WM_gizmo_set_scale(man->translate_c, 0.2); RegionView3D *rv3d = ED_view3d_context_rv3d(man->data.context); if (rv3d) { @@ -130,23 +130,23 @@ static void manipulator_mesh_spin_update_from_op(ManipulatorSpinGroup *man) project_plane_normalized_v3_v3v3(man->data.rotate_up, man->data.rotate_up, man->data.rotate_axis); normalize_v3(man->data.rotate_up); - WM_manipulator_set_matrix_rotation_from_z_axis(man->translate_c, plane_no); - WM_manipulator_set_matrix_rotation_from_yz_axis(man->rotate_c, plane_no, man->data.rotate_axis); + WM_gizmo_set_matrix_rotation_from_z_axis(man->translate_c, plane_no); + WM_gizmo_set_matrix_rotation_from_yz_axis(man->rotate_c, plane_no, man->data.rotate_axis); /* show the axis instead of mouse cursor */ RNA_enum_set(man->rotate_c->ptr, "draw_options", - ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_MIRROR | - ED_MANIPULATOR_DIAL_DRAW_FLAG_ANGLE_START_Y); + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR | + ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y); } } /* depth callbacks */ -static void manipulator_spin_prop_depth_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_depth_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; @@ -160,11 +160,11 @@ static void manipulator_spin_prop_depth_get( value[0] = dot_v3v3(plane_no, plane_co) - dot_v3v3(plane_no, mpr->matrix_basis[3]); } -static void manipulator_spin_prop_depth_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_depth_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; const float *value = value_p; @@ -183,15 +183,15 @@ static void manipulator_spin_prop_depth_set( RNA_property_float_set_array(op->ptr, man->data.prop_axis_co, plane_co); - manipulator_spin_exec(man); + gizmo_spin_exec(man); } /* translate callbacks */ -static void manipulator_spin_prop_translate_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_translate_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; @@ -201,11 +201,11 @@ static void manipulator_spin_prop_translate_get( RNA_property_float_get_array(op->ptr, man->data.prop_axis_co, value); } -static void manipulator_spin_prop_translate_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_translate_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; BLI_assert(mpr_prop->type->array_length == 3); @@ -213,15 +213,15 @@ static void manipulator_spin_prop_translate_set( RNA_property_float_set_array(op->ptr, man->data.prop_axis_co, value); - manipulator_spin_exec(man); + gizmo_spin_exec(man); } /* angle callbacks */ -static void manipulator_spin_prop_axis_angle_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_axis_angle_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; @@ -244,11 +244,11 @@ static void manipulator_spin_prop_axis_angle_get( } } -static void manipulator_spin_prop_axis_angle_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_axis_angle_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; const float *value = value_p; @@ -273,17 +273,17 @@ static void manipulator_spin_prop_axis_angle_set( /* re-normalize - seems acceptable */ RNA_property_float_set_array(op->ptr, man->data.prop_axis_no, plane_no); - manipulator_spin_exec(man); + gizmo_spin_exec(man); } } } /* angle callbacks */ -static void manipulator_spin_prop_angle_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_angle_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; float *value = value_p; @@ -292,31 +292,31 @@ static void manipulator_spin_prop_angle_get( value[0] = RNA_property_float_get(op->ptr, man->data.prop_angle); } -static void manipulator_spin_prop_angle_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_spin_prop_angle_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { - ManipulatorSpinGroup *man = mpr->parent_mgroup->customdata; + GizmoSpinGroup *man = mpr->parent_mgroup->customdata; wmOperator *op = man->data.op; BLI_assert(mpr_prop->type->array_length == 1); UNUSED_VARS_NDEBUG(mpr_prop); const float *value = value_p; RNA_property_float_set(op->ptr, man->data.prop_angle, value[0]); - manipulator_spin_exec(man); + gizmo_spin_exec(man); } -static bool manipulator_mesh_spin_poll(const bContext *C, wmManipulatorGroupType *wgt) +static bool gizmo_mesh_spin_poll(const bContext *C, wmGizmoGroupType *wgt) { wmOperator *op = WM_operator_last_redo(C); if (op == NULL || !STREQ(op->type->idname, "MESH_OT_spin")) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } return true; } -static void manipulator_mesh_spin_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void gizmo_mesh_spin_setup(const bContext *C, wmGizmoGroup *mgroup) { wmOperator *op = WM_operator_last_redo(C); @@ -324,32 +324,32 @@ static void manipulator_mesh_spin_setup(const bContext *C, wmManipulatorGroup *m return; } - struct ManipulatorSpinGroup *man = MEM_callocN(sizeof(ManipulatorSpinGroup), __func__); + struct GizmoSpinGroup *man = MEM_callocN(sizeof(GizmoSpinGroup), __func__); mgroup->customdata = man; - const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true); - const wmManipulatorType *wt_grab = WM_manipulatortype_find("MANIPULATOR_WT_grab_3d", true); - const wmManipulatorType *wt_dial = WM_manipulatortype_find("MANIPULATOR_WT_dial_3d", true); + const wmGizmoType *wt_arrow = WM_gizmotype_find("GIZMO_WT_arrow_3d", true); + const wmGizmoType *wt_grab = WM_gizmotype_find("GIZMO_WT_grab_3d", true); + const wmGizmoType *wt_dial = WM_gizmotype_find("GIZMO_WT_dial_3d", true); - man->translate_z = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - man->translate_c = WM_manipulator_new_ptr(wt_grab, mgroup, NULL); - man->rotate_c = WM_manipulator_new_ptr(wt_dial, mgroup, NULL); - man->angle_z = WM_manipulator_new_ptr(wt_dial, mgroup, NULL); + man->translate_z = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + man->translate_c = WM_gizmo_new_ptr(wt_grab, mgroup, NULL); + man->rotate_c = WM_gizmo_new_ptr(wt_dial, mgroup, NULL); + man->angle_z = WM_gizmo_new_ptr(wt_dial, mgroup, NULL); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->translate_z->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, man->translate_c->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_SECONDARY, man->rotate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_z->color); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, man->translate_c->color); + UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, man->rotate_c->color); UI_GetThemeColor3fv(TH_AXIS_Z, man->angle_z->color); - RNA_enum_set(man->translate_z->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_NORMAL); - RNA_enum_set(man->translate_c->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_RING_2D); + RNA_enum_set(man->translate_z->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_NORMAL); + RNA_enum_set(man->translate_c->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_RING_2D); - WM_manipulator_set_flag(man->translate_c, WM_MANIPULATOR_DRAW_VALUE, true); - WM_manipulator_set_flag(man->rotate_c, WM_MANIPULATOR_DRAW_VALUE, true); - WM_manipulator_set_flag(man->angle_z, WM_MANIPULATOR_DRAW_VALUE, true); + WM_gizmo_set_flag(man->translate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(man->rotate_c, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_flag(man->angle_z, WM_GIZMO_DRAW_VALUE, true); - WM_manipulator_set_scale(man->angle_z, 0.5f); + WM_gizmo_set_scale(man->angle_z, 0.5f); { man->data.context = (bContext *)C; @@ -359,42 +359,42 @@ static void manipulator_mesh_spin_setup(const bContext *C, wmManipulatorGroup *m man->data.prop_angle = RNA_struct_find_property(op->ptr, "angle"); } - manipulator_mesh_spin_update_from_op(man); + gizmo_mesh_spin_update_from_op(man); /* Setup property callbacks */ { - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->translate_z, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_spin_prop_depth_get, - .value_set_fn = manipulator_spin_prop_depth_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_spin_prop_depth_get, + .value_set_fn = gizmo_spin_prop_depth_set, .range_get_fn = NULL, .user_data = NULL, }); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->translate_c, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_spin_prop_translate_get, - .value_set_fn = manipulator_spin_prop_translate_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_spin_prop_translate_get, + .value_set_fn = gizmo_spin_prop_translate_set, .range_get_fn = NULL, .user_data = NULL, }); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->rotate_c, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_spin_prop_axis_angle_get, - .value_set_fn = manipulator_spin_prop_axis_angle_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_spin_prop_axis_angle_get, + .value_set_fn = gizmo_spin_prop_axis_angle_set, .range_get_fn = NULL, .user_data = NULL, }); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( man->angle_z, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_spin_prop_angle_get, - .value_set_fn = manipulator_spin_prop_angle_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_spin_prop_angle_get, + .value_set_fn = gizmo_spin_prop_angle_set, .range_get_fn = NULL, .user_data = NULL, }); @@ -402,34 +402,34 @@ static void manipulator_mesh_spin_setup(const bContext *C, wmManipulatorGroup *m } } -static void manipulator_mesh_spin_draw_prepare( - const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void gizmo_mesh_spin_draw_prepare( + const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - ManipulatorSpinGroup *man = mgroup->customdata; + GizmoSpinGroup *man = mgroup->customdata; if (man->data.op->next) { man->data.op = WM_operator_last_redo((bContext *)man->data.context); } - manipulator_mesh_spin_update_from_op(man); + gizmo_mesh_spin_update_from_op(man); } -static void MESH_WGT_spin(struct wmManipulatorGroupType *wgt) +static void MESH_WGT_spin(struct wmGizmoGroupType *wgt) { wgt->name = "Mesh Spin"; wgt->idname = "MESH_WGT_spin"; - wgt->flag = WM_MANIPULATORGROUPTYPE_3D; + wgt->flag = WM_GIZMOGROUPTYPE_3D; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; - wgt->poll = manipulator_mesh_spin_poll; - wgt->setup = manipulator_mesh_spin_setup; - wgt->draw_prepare = manipulator_mesh_spin_draw_prepare; + wgt->poll = gizmo_mesh_spin_poll; + wgt->setup = gizmo_mesh_spin_setup; + wgt->draw_prepare = gizmo_mesh_spin_draw_prepare; } /** \} */ -#endif /* USE_MANIPULATOR */ +#endif /* USE_GIZMO */ /* -------------------------------------------------------------------- */ /** \name Spin Operator @@ -508,11 +508,11 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e int ret = edbm_spin_exec(C, op); -#ifdef USE_MANIPULATOR +#ifdef USE_GIZMO if (ret & OPERATOR_FINISHED) { - /* Setup manipulators */ - if (v3d && ((v3d->mpr_flag & V3D_MANIPULATOR_HIDE) == 0)) { - WM_manipulator_group_type_ensure("MESH_WGT_spin"); + /* Setup gizmos */ + if (v3d && ((v3d->mpr_flag & V3D_GIZMO_HIDE) == 0)) { + WM_gizmo_group_type_ensure("MESH_WGT_spin"); } } #endif @@ -548,7 +548,7 @@ void MESH_OT_spin(wmOperatorType *ot) "Center", "Center in global view space", -1e4f, 1e4f); RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -1.0f, 1.0f); -#ifdef USE_MANIPULATOR - WM_manipulatorgrouptype_append(MESH_WGT_spin); +#ifdef USE_GIZMO + WM_gizmogrouptype_append(MESH_WGT_spin); #endif } diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 1f1d2f5a2e1..1be180b852c 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -174,7 +174,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal) G.moving = G_TRANSFORM_EDIT; if (v3d) { opdata->mpr_flag = v3d->mpr_flag; - v3d->mpr_flag = V3D_MANIPULATOR_HIDE; + v3d->mpr_flag = V3D_GIZMO_HIDE; } } diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index e8bcfb5eb08..86c9fc0243b 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -390,7 +390,7 @@ void MESH_OT_polybuild_dissolve_at_cursor(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Cursor Manipulator +/** \name Cursor Gizmo * * \note This may need its own file, for now not. * \{ */ diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 3800ab9dddd..cc9448e5e06 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -92,8 +92,8 @@ void MESH_OT_primitive_monkey_add(struct wmOperatorType *ot); void MESH_OT_primitive_uv_sphere_add(struct wmOperatorType *ot); void MESH_OT_primitive_ico_sphere_add(struct wmOperatorType *ot); -/* *** editmesh_add_manipulator.c *** */ -void MESH_OT_primitive_cube_add_manipulator(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); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 2bfc0634f1e..0fcc5ada854 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -78,7 +78,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_primitive_uv_sphere_add); WM_operatortype_append(MESH_OT_primitive_ico_sphere_add); - WM_operatortype_append(MESH_OT_primitive_cube_add_manipulator); + WM_operatortype_append(MESH_OT_primitive_cube_add_gizmo); WM_operatortype_append(MESH_OT_duplicate); WM_operatortype_append(MESH_OT_remove_doubles); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 137fd01a146..41c3209dbb1 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2936,8 +2936,8 @@ void ED_region_message_subscribe( struct bScreen *screen, struct ScrArea *sa, struct ARegion *ar, struct wmMsgBus *mbus) { - if (ar->manipulator_map != NULL) { - WM_manipulatormap_message_subscribe(C, ar->manipulator_map, ar, mbus); + if (ar->gizmo_map != NULL) { + WM_gizmomap_message_subscribe(C, ar->gizmo_map, ar, mbus); } if (BLI_listbase_is_empty(&ar->uiblocks)) { diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 8fbf74ed800..1d14940085b 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -381,8 +381,8 @@ static void region_cursor_set(wmWindow *win, bool swin_changed) for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { if (ar == screen->active_region) { if (swin_changed || (ar->type && ar->type->event_cursor)) { - if (ar->manipulator_map != NULL) { - if (WM_manipulatormap_cursor_set(ar->manipulator_map, win)) { + if (ar->gizmo_map != NULL) { + if (WM_gizmomap_cursor_set(ar->gizmo_map, win)) { return; } } diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 37f5ed642fe..7246812dc82 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -129,22 +129,22 @@ void ED_spacetypes_init(void) ED_screen_user_menu_register(); - /* manipulator types */ - ED_manipulatortypes_button_2d(); - ED_manipulatortypes_dial_3d(); - ED_manipulatortypes_grab_3d(); - ED_manipulatortypes_arrow_2d(); - ED_manipulatortypes_arrow_3d(); - ED_manipulatortypes_primitive_3d(); - ED_manipulatortypes_cage_2d(); - ED_manipulatortypes_cage_3d(); - - /* register types for operators and manipulators */ + /* gizmo types */ + ED_gizmotypes_button_2d(); + ED_gizmotypes_dial_3d(); + ED_gizmotypes_grab_3d(); + ED_gizmotypes_arrow_2d(); + ED_gizmotypes_arrow_3d(); + ED_gizmotypes_primitive_3d(); + ED_gizmotypes_cage_2d(); + ED_gizmotypes_cage_3d(); + + /* register types for operators and gizmos */ spacetypes = BKE_spacetypes_list(); for (type = spacetypes->first; type; type = type->next) { - /* init manipulator types first, operator-types need them */ - if (type->manipulators) { - type->manipulators(); + /* init gizmo types first, operator-types need them */ + if (type->gizmos) { + type->gizmos(); } if (type->operatortypes) { type->operatortypes(); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 650f377787a..68b0f42768a 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -581,25 +581,25 @@ static int image_context(const bContext *C, const char *member, bContextDataResu return 0; } -static void IMAGE_WGT_manipulator2d(wmManipulatorGroupType *wgt) +static void IMAGE_WGT_gizmo2d(wmGizmoGroupType *wgt) { - wgt->name = "UV Transform Manipulator"; - wgt->idname = "IMAGE_WGT_manipulator2d"; + wgt->name = "UV Transform Gizmo"; + wgt->idname = "IMAGE_WGT_gizmo2d"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_PERSISTENT; + wgt->flag |= WM_GIZMOGROUPTYPE_PERSISTENT; - wgt->poll = ED_widgetgroup_manipulator2d_poll; - wgt->setup = ED_widgetgroup_manipulator2d_setup; - wgt->refresh = ED_widgetgroup_manipulator2d_refresh; - wgt->draw_prepare = ED_widgetgroup_manipulator2d_draw_prepare; + wgt->poll = ED_widgetgroup_gizmo2d_poll; + wgt->setup = ED_widgetgroup_gizmo2d_setup; + wgt->refresh = ED_widgetgroup_gizmo2d_refresh; + wgt->draw_prepare = ED_widgetgroup_gizmo2d_draw_prepare; } static void image_widgets(void) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure( - &(const struct wmManipulatorMapType_Params){SPACE_IMAGE, RGN_TYPE_WINDOW}); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure( + &(const struct wmGizmoMapType_Params){SPACE_IMAGE, RGN_TYPE_WINDOW}); - WM_manipulatorgrouptype_append_and_link(mmap_type, IMAGE_WGT_manipulator2d); + WM_gizmogrouptype_append_and_link(mmap_type, IMAGE_WGT_gizmo2d); } /************************** main region ***************************/ @@ -665,15 +665,15 @@ static void image_main_region_init(wmWindowManager *wm, ARegion *ar) // image space manages own v2d // UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); - /* manipulators */ - if (ar->manipulator_map == NULL) { - const struct wmManipulatorMapType_Params wmap_params = { + /* gizmos */ + if (ar->gizmo_map == NULL) { + const struct wmGizmoMapType_Params wmap_params = { .spaceid = SPACE_IMAGE, .regionid = RGN_TYPE_WINDOW, }; - ar->manipulator_map = WM_manipulatormap_new_from_type(&wmap_params); + ar->gizmo_map = WM_gizmomap_new_from_type(&wmap_params); } - WM_manipulatormap_add_handlers(ar, ar->manipulator_map); + WM_gizmomap_add_handlers(ar, ar->gizmo_map); /* mask polls mode */ keymap = WM_keymap_find(wm->defaultconf, "Mask Editing", 0, 0); @@ -807,7 +807,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); } - WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_2D); + WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D); draw_image_cache(C, ar); @@ -827,7 +827,7 @@ static void image_main_region_listener( switch (wmn->category) { case NC_GEOM: if (ELEM(wmn->data, ND_DATA, ND_SELECT)) - WM_manipulatormap_tag_refresh(ar->manipulator_map); + WM_gizmomap_tag_refresh(ar->gizmo_map); break; case NC_GPENCIL: if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) @@ -838,7 +838,7 @@ static void image_main_region_listener( case NC_IMAGE: if (wmn->action == NA_PAINTING) ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(ar->manipulator_map); + WM_gizmomap_tag_refresh(ar->gizmo_map); break; case NC_MATERIAL: if (wmn->data == ND_SHADING_LINKS) { @@ -1089,7 +1089,7 @@ void ED_spacetype_image(void) st->refresh = image_refresh; st->listener = image_listener; st->context = image_context; - st->manipulators = image_widgets; + st->gizmos = image_widgets; st->id_remap = image_id_remap; /* regions: main window */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 5b91796d41c..c632b354440 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1412,7 +1412,7 @@ void drawnodespace(const bContext *C, ARegion *ar) wmOrtho2_pixelspace(ar->winx, ar->winy); - WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_2D); + WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D); gpuPopMatrix(); gpuLoadProjectionMatrix(original_proj); diff --git a/source/blender/editors/space_node/node_gizmo.c b/source/blender/editors/space_node/node_gizmo.c index 62b4a4b6583..37ea53aa710 100644 --- a/source/blender/editors/space_node/node_gizmo.c +++ b/source/blender/editors/space_node/node_gizmo.c @@ -53,7 +53,7 @@ /** \name Local Utilities * \{ */ -static void node_manipulator_calc_matrix_space( +static void node_gizmo_calc_matrix_space( const SpaceNode *snode, const ARegion *ar, float matrix_space[4][4]) { unit_m4(matrix_space); @@ -63,7 +63,7 @@ static void node_manipulator_calc_matrix_space( matrix_space[3][1] = (ar->winy / 2) + snode->yof; } -static void node_manipulator_calc_matrix_space_with_image_dims( +static void node_gizmo_calc_matrix_space_with_image_dims( const SpaceNode *snode, const ARegion *ar, const float image_dims[2], float matrix_space[4][4]) { unit_m4(matrix_space); @@ -79,11 +79,11 @@ static void node_manipulator_calc_matrix_space_with_image_dims( /* -------------------------------------------------------------------- */ -/** \name Backdrop Manipulator +/** \name Backdrop Gizmo * \{ */ -static void manipulator_node_backdrop_prop_matrix_get( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_node_backdrop_prop_matrix_get( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, void *value_p) { float (*matrix)[4] = value_p; @@ -95,8 +95,8 @@ static void manipulator_node_backdrop_prop_matrix_get( matrix[3][1] = snode->yof; } -static void manipulator_node_backdrop_prop_matrix_set( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_node_backdrop_prop_matrix_set( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, const void *value_p) { const float (*matrix)[4] = value_p; @@ -108,7 +108,7 @@ static void manipulator_node_backdrop_prop_matrix_set( snode->yof = matrix[3][1]; } -static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -127,22 +127,22 @@ static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmManipulatorGrou return false; } -static void WIDGETGROUP_node_transform_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_transform_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__); + wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); - wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, NULL); + wwrapper->gizmo = WM_gizmo_new("GIZMO_WT_cage_2d", mgroup, NULL); - RNA_enum_set(wwrapper->manipulator->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM); + RNA_enum_set(wwrapper->gizmo->ptr, "transform", + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM); mgroup->customdata = wwrapper; } -static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmGizmoGroup *mgroup) { Main *bmain = CTX_data_main(C); - wmManipulator *cage = ((wmManipulatorWrapper *)mgroup->customdata)->manipulator; + wmGizmo *cage = ((wmGizmoWrapper *)mgroup->customdata)->gizmo; const ARegion *ar = CTX_wm_region(C); /* center is always at the origin */ const float origin[3] = {ar->winx / 2, ar->winy / 2}; @@ -158,40 +158,40 @@ static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmManipulatorG }; RNA_float_set_array(cage->ptr, "dimensions", dims); - WM_manipulator_set_matrix_location(cage, origin); - WM_manipulator_set_flag(cage, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_matrix_location(cage, origin); + WM_gizmo_set_flag(cage, WM_GIZMO_HIDDEN, false); /* need to set property here for undo. TODO would prefer to do this in _init */ SpaceNode *snode = CTX_wm_space_node(C); #if 0 PointerRNA nodeptr; RNA_pointer_create(snode->id, &RNA_SpaceNodeEditor, snode, &nodeptr); - WM_manipulator_target_property_def_rna(cage, "offset", &nodeptr, "backdrop_offset", -1); - WM_manipulator_target_property_def_rna(cage, "scale", &nodeptr, "backdrop_zoom", -1); + WM_gizmo_target_property_def_rna(cage, "offset", &nodeptr, "backdrop_offset", -1); + WM_gizmo_target_property_def_rna(cage, "scale", &nodeptr, "backdrop_zoom", -1); #endif - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( cage, "matrix", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_node_backdrop_prop_matrix_get, - .value_set_fn = manipulator_node_backdrop_prop_matrix_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_node_backdrop_prop_matrix_get, + .value_set_fn = gizmo_node_backdrop_prop_matrix_set, .range_get_fn = NULL, .user_data = snode, }); } else { - WM_manipulator_set_flag(cage, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(cage, WM_GIZMO_HIDDEN, true); } BKE_image_release_ibuf(ima, ibuf, lock); } -void NODE_WGT_backdrop_transform(wmManipulatorGroupType *wgt) +void NODE_WGT_backdrop_transform(wmGizmoGroupType *wgt) { wgt->name = "Backdrop Transform Widget"; wgt->idname = "NODE_WGT_backdrop_transform"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_PERSISTENT; + wgt->flag |= WM_GIZMOGROUPTYPE_PERSISTENT; wgt->poll = WIDGETGROUP_node_transform_poll; wgt->setup = WIDGETGROUP_node_transform_setup; @@ -202,11 +202,11 @@ void NODE_WGT_backdrop_transform(wmManipulatorGroupType *wgt) /* -------------------------------------------------------------------- */ -/** \name Crop Manipulator +/** \name Crop Gizmo * \{ */ struct NodeCropWidgetGroup { - wmManipulator *border; + wmGizmo *border; struct { float dims[2]; @@ -219,7 +219,7 @@ struct NodeCropWidgetGroup { } update_data; }; -static void manipulator_node_crop_update(struct NodeCropWidgetGroup *crop_group) +static void gizmo_node_crop_update(struct NodeCropWidgetGroup *crop_group) { RNA_property_update(crop_group->update_data.context, &crop_group->update_data.ptr, crop_group->update_data.prop); } @@ -257,8 +257,8 @@ static void two_xy_from_rect(NodeTwoXYs *nxy, const rctf *rect, const float dims } /* scale callbacks */ -static void manipulator_node_crop_prop_matrix_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_node_crop_prop_matrix_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { float (*matrix)[4] = value_p; @@ -276,8 +276,8 @@ static void manipulator_node_crop_prop_matrix_get( matrix[3][1] = (BLI_rctf_cent_y(&rct) - 0.5f) * dims[1]; } -static void manipulator_node_crop_prop_matrix_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_node_crop_prop_matrix_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { const float (*matrix)[4] = value_p; @@ -293,10 +293,10 @@ static void manipulator_node_crop_prop_matrix_set( BLI_rctf_recenter(&rct, (matrix[3][0] / dims[0]) + 0.5f, (matrix[3][1] / dims[1]) + 0.5f); BLI_rctf_isect(&(rctf){.xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1}, &rct, &rct); two_xy_from_rect(nxy, &rct, dims, is_relative); - manipulator_node_crop_update(crop_group); + gizmo_node_crop_update(crop_group); } -static bool WIDGETGROUP_node_crop_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_node_crop_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -318,33 +318,33 @@ static bool WIDGETGROUP_node_crop_poll(const bContext *C, wmManipulatorGroupType return false; } -static void WIDGETGROUP_node_crop_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_crop_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct NodeCropWidgetGroup *crop_group = MEM_mallocN(sizeof(struct NodeCropWidgetGroup), __func__); - crop_group->border = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, NULL); + crop_group->border = WM_gizmo_new("GIZMO_WT_cage_2d", mgroup, NULL); RNA_enum_set(crop_group->border->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE); + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE); mgroup->customdata = crop_group; } -static void WIDGETGROUP_node_crop_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_crop_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { ARegion *ar = CTX_wm_region(C); - wmManipulator *mpr = mgroup->manipulators.first; + wmGizmo *mpr = mgroup->gizmos.first; SpaceNode *snode = CTX_wm_space_node(C); - node_manipulator_calc_matrix_space(snode, ar, mpr->matrix_space); + node_gizmo_calc_matrix_space(snode, ar, mpr->matrix_space); } -static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmGizmoGroup *mgroup) { Main *bmain = CTX_data_main(C); struct NodeCropWidgetGroup *crop_group = mgroup->customdata; - wmManipulator *mpr = crop_group->border; + wmGizmo *mpr = crop_group->border; void *lock; Image *ima = BKE_image_verify_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); @@ -355,7 +355,7 @@ static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmManipulatorGroup crop_group->state.dims[1] = (ibuf->y > 0) ? ibuf->y : 64.0f; RNA_float_set_array(mpr->ptr, "dimensions", crop_group->state.dims); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); SpaceNode *snode = CTX_wm_space_node(C); bNode *node = nodeGetActive(snode->edittree); @@ -364,28 +364,28 @@ static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmManipulatorGroup RNA_pointer_create((ID *)snode->edittree, &RNA_CompositorNodeCrop, node, &crop_group->update_data.ptr); crop_group->update_data.prop = RNA_struct_find_property(&crop_group->update_data.ptr, "relative"); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( mpr, "matrix", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_node_crop_prop_matrix_get, - .value_set_fn = manipulator_node_crop_prop_matrix_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_node_crop_prop_matrix_get, + .value_set_fn = gizmo_node_crop_prop_matrix_set, .range_get_fn = NULL, .user_data = node, }); } else { - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, true); } BKE_image_release_ibuf(ima, ibuf, lock); } -void NODE_WGT_backdrop_crop(wmManipulatorGroupType *wgt) +void NODE_WGT_backdrop_crop(wmGizmoGroupType *wgt) { wgt->name = "Backdrop Crop Widget"; wgt->idname = "NODE_WGT_backdrop_crop"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_PERSISTENT; + wgt->flag |= WM_GIZMOGROUPTYPE_PERSISTENT; wgt->poll = WIDGETGROUP_node_crop_poll; wgt->setup = WIDGETGROUP_node_crop_setup; @@ -401,14 +401,14 @@ void NODE_WGT_backdrop_crop(wmManipulatorGroupType *wgt) * \{ */ struct NodeSunBeamsWidgetGroup { - wmManipulator *manipulator; + wmGizmo *gizmo; struct { float dims[2]; } state; }; -static bool WIDGETGROUP_node_sbeam_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_node_sbeam_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -427,36 +427,36 @@ static bool WIDGETGROUP_node_sbeam_poll(const bContext *C, wmManipulatorGroupTyp return false; } -static void WIDGETGROUP_node_sbeam_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_sbeam_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct NodeSunBeamsWidgetGroup *sbeam_group = MEM_mallocN(sizeof(struct NodeSunBeamsWidgetGroup), __func__); - sbeam_group->manipulator = WM_manipulator_new("MANIPULATOR_WT_grab_3d", mgroup, NULL); - wmManipulator *mpr = sbeam_group->manipulator; + sbeam_group->gizmo = WM_gizmo_new("GIZMO_WT_grab_3d", mgroup, NULL); + wmGizmo *mpr = sbeam_group->gizmo; - RNA_enum_set(mpr->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_CROSS_2D); + RNA_enum_set(mpr->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_CROSS_2D); mpr->scale_basis = 0.05f; mgroup->customdata = sbeam_group; } -static void WIDGETGROUP_node_sbeam_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_sbeam_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { struct NodeSunBeamsWidgetGroup *sbeam_group = mgroup->customdata; ARegion *ar = CTX_wm_region(C); - wmManipulator *mpr = mgroup->manipulators.first; + wmGizmo *mpr = mgroup->gizmos.first; SpaceNode *snode = CTX_wm_space_node(C); - node_manipulator_calc_matrix_space_with_image_dims(snode, ar, sbeam_group->state.dims, mpr->matrix_space); + node_gizmo_calc_matrix_space_with_image_dims(snode, ar, sbeam_group->state.dims, mpr->matrix_space); } -static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmGizmoGroup *mgroup) { Main *bmain = CTX_data_main(C); struct NodeSunBeamsWidgetGroup *sbeam_group = mgroup->customdata; - wmManipulator *mpr = sbeam_group->manipulator; + wmGizmo *mpr = sbeam_group->gizmo; void *lock; Image *ima = BKE_image_verify_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); @@ -472,23 +472,23 @@ static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmManipulatorGroup /* need to set property here for undo. TODO would prefer to do this in _init */ PointerRNA nodeptr; RNA_pointer_create((ID *)snode->edittree, &RNA_CompositorNodeSunBeams, node, &nodeptr); - WM_manipulator_target_property_def_rna(mpr, "offset", &nodeptr, "source", -1); + WM_gizmo_target_property_def_rna(mpr, "offset", &nodeptr, "source", -1); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_MODAL, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_MODAL, true); } else { - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, true); } BKE_image_release_ibuf(ima, ibuf, lock); } -void NODE_WGT_backdrop_sun_beams(wmManipulatorGroupType *wgt) +void NODE_WGT_backdrop_sun_beams(wmGizmoGroupType *wgt) { wgt->name = "Sun Beams Widget"; wgt->idname = "NODE_WGT_sbeam"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_PERSISTENT; + wgt->flag |= WM_GIZMOGROUPTYPE_PERSISTENT; wgt->poll = WIDGETGROUP_node_sbeam_poll; wgt->setup = WIDGETGROUP_node_sbeam_setup; @@ -506,14 +506,14 @@ void NODE_WGT_backdrop_sun_beams(wmManipulatorGroupType *wgt) * \{ */ struct NodeCornerPinWidgetGroup { - wmManipulator *manipulators[4]; + wmGizmo *gizmos[4]; struct { float dims[2]; } state; }; -static bool WIDGETGROUP_node_corner_pin_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_node_corner_pin_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -532,16 +532,16 @@ static bool WIDGETGROUP_node_corner_pin_poll(const bContext *C, wmManipulatorGro return false; } -static void WIDGETGROUP_node_corner_pin_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_corner_pin_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct NodeCornerPinWidgetGroup *cpin_group = MEM_mallocN(sizeof(struct NodeCornerPinWidgetGroup), __func__); - const wmManipulatorType *wt_grab_3d = WM_manipulatortype_find("MANIPULATOR_WT_grab_3d", false); + const wmGizmoType *wt_grab_3d = WM_gizmotype_find("GIZMO_WT_grab_3d", false); for (int i = 0; i < 4; i++) { - cpin_group->manipulators[i] = WM_manipulator_new_ptr(wt_grab_3d, mgroup, NULL); - wmManipulator *mpr = cpin_group->manipulators[i]; + cpin_group->gizmos[i] = WM_gizmo_new_ptr(wt_grab_3d, mgroup, NULL); + wmGizmo *mpr = cpin_group->gizmos[i]; - RNA_enum_set(mpr->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_CROSS_2D); + RNA_enum_set(mpr->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_CROSS_2D); mpr->scale_basis = 0.01f; } @@ -549,7 +549,7 @@ static void WIDGETGROUP_node_corner_pin_setup(const bContext *UNUSED(C), wmManip mgroup->customdata = cpin_group; } -static void WIDGETGROUP_node_corner_pin_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_corner_pin_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { struct NodeCornerPinWidgetGroup *cpin_group = mgroup->customdata; ARegion *ar = CTX_wm_region(C); @@ -557,15 +557,15 @@ static void WIDGETGROUP_node_corner_pin_draw_prepare(const bContext *C, wmManipu SpaceNode *snode = CTX_wm_space_node(C); float matrix_space[4][4]; - node_manipulator_calc_matrix_space_with_image_dims(snode, ar, cpin_group->state.dims, matrix_space); + node_gizmo_calc_matrix_space_with_image_dims(snode, ar, cpin_group->state.dims, matrix_space); for (int i = 0; i < 4; i++) { - wmManipulator *mpr = cpin_group->manipulators[i]; + wmGizmo *mpr = cpin_group->gizmos[i]; copy_m4_m4(mpr->matrix_space, matrix_space); } } -static void WIDGETGROUP_node_corner_pin_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_node_corner_pin_refresh(const bContext *C, wmGizmoGroup *mgroup) { Main *bmain = CTX_data_main(C); struct NodeCornerPinWidgetGroup *cpin_group = mgroup->customdata; @@ -585,32 +585,32 @@ static void WIDGETGROUP_node_corner_pin_refresh(const bContext *C, wmManipulator int i = 0; for (bNodeSocket *sock = node->inputs.first; sock && i < 4; sock = sock->next) { if (sock->type == SOCK_VECTOR) { - wmManipulator *mpr = cpin_group->manipulators[i++]; + wmGizmo *mpr = cpin_group->gizmos[i++]; PointerRNA sockptr; RNA_pointer_create((ID *)snode->edittree, &RNA_NodeSocket, sock, &sockptr); - WM_manipulator_target_property_def_rna(mpr, "offset", &sockptr, "default_value", -1); + WM_gizmo_target_property_def_rna(mpr, "offset", &sockptr, "default_value", -1); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_MODAL, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_MODAL, true); } } } else { for (int i = 0; i < 4; i++) { - wmManipulator *mpr = cpin_group->manipulators[i]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true); + wmGizmo *mpr = cpin_group->gizmos[i]; + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, true); } } BKE_image_release_ibuf(ima, ibuf, lock); } -void NODE_WGT_backdrop_corner_pin(wmManipulatorGroupType *wgt) +void NODE_WGT_backdrop_corner_pin(wmGizmoGroupType *wgt) { wgt->name = "Corner Pin Widget"; wgt->idname = "NODE_WGT_backdrop_corner_pin"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_PERSISTENT; + wgt->flag |= WM_GIZMOGROUPTYPE_PERSISTENT; wgt->poll = WIDGETGROUP_node_corner_pin_poll; wgt->setup = WIDGETGROUP_node_corner_pin_setup; diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index d7a43bda461..742c3975c8d 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -224,10 +224,10 @@ void NODE_OT_viewer_border(struct wmOperatorType *ot); void NODE_OT_clear_viewer_border(struct wmOperatorType *ot); /* node_widgets.c */ -void NODE_WGT_backdrop_transform(struct wmManipulatorGroupType *wgt); -void NODE_WGT_backdrop_crop(struct wmManipulatorGroupType *wgt); -void NODE_WGT_backdrop_sun_beams(struct wmManipulatorGroupType *wgt); -void NODE_WGT_backdrop_corner_pin(struct wmManipulatorGroupType *wgt); +void NODE_WGT_backdrop_transform(struct wmGizmoGroupType *wgt); +void NODE_WGT_backdrop_crop(struct wmGizmoGroupType *wgt); +void NODE_WGT_backdrop_sun_beams(struct wmGizmoGroupType *wgt); +void NODE_WGT_backdrop_corner_pin(struct wmGizmoGroupType *wgt); extern const char *node_context_dir[]; diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index a87a68392c7..1149b910947 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -646,13 +646,13 @@ static void node_main_region_init(wmWindowManager *wm, ARegion *ar) UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); - /* manipulators stay in the background for now - quick patchjob to make sure nodes themselves work */ - if (ar->manipulator_map == NULL) { - ar->manipulator_map = WM_manipulatormap_new_from_type( - &(const struct wmManipulatorMapType_Params){SPACE_NODE, RGN_TYPE_WINDOW}); + /* gizmos stay in the background for now - quick patchjob to make sure nodes themselves work */ + if (ar->gizmo_map == NULL) { + ar->gizmo_map = WM_gizmomap_new_from_type( + &(const struct wmGizmoMapType_Params){SPACE_NODE, RGN_TYPE_WINDOW}); } - WM_manipulatormap_add_handlers(ar, ar->manipulator_map); + WM_gizmomap_add_handlers(ar, ar->gizmo_map); /* own keymaps */ keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0); @@ -752,7 +752,7 @@ static void node_region_listener( wmWindow *UNUSED(win), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn, const Scene *UNUSED(scene)) { - wmManipulatorMap *mmap = ar->manipulator_map; + wmGizmoMap *mmap = ar->gizmo_map; /* context changes */ switch (wmn->category) { @@ -762,13 +762,13 @@ static void node_region_listener( ED_region_tag_redraw(ar); break; case ND_SPACE_NODE_VIEW: - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); break; } break; case NC_SCREEN: if (wmn->data == ND_LAYOUTSET || wmn->action == NA_EDITED) { - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); } switch (wmn->data) { case ND_ANIMPLAY: @@ -784,13 +784,13 @@ static void node_region_listener( case NC_SCENE: ED_region_tag_redraw(ar); if (wmn->data == ND_RENDER_RESULT) { - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); } break; case NC_NODE: ED_region_tag_redraw(ar); if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) { - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); } break; case NC_MATERIAL: @@ -863,12 +863,12 @@ static int node_context(const bContext *C, const char *member, bContextDataResul static void node_widgets(void) { /* create the widgetmap for the area here */ - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure( - &(const struct wmManipulatorMapType_Params){SPACE_NODE, RGN_TYPE_WINDOW}); - WM_manipulatorgrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_transform); - WM_manipulatorgrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_crop); - WM_manipulatorgrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_sun_beams); - WM_manipulatorgrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_corner_pin); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure( + &(const struct wmGizmoMapType_Params){SPACE_NODE, RGN_TYPE_WINDOW}); + WM_gizmogrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_transform); + WM_gizmogrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_crop); + WM_gizmogrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_sun_beams); + WM_gizmogrouptype_append_and_link(mmap_type, NODE_WGT_backdrop_corner_pin); } static void node_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id) @@ -987,7 +987,7 @@ void ED_spacetype_node(void) st->refresh = node_area_refresh; st->context = node_context; st->dropboxes = node_dropboxes; - st->manipulators = node_widgets; + st->gizmos = node_widgets; st->id_remap = node_id_remap; st->space_subtype_item_extend = node_space_subtype_item_extend; st->space_subtype_get = node_space_subtype_get; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 1ec9ea53e33..c440d12e444 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -829,7 +829,7 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot) /* identifiers */ ot->name = "Select Handles"; ot->idname = "SEQUENCER_OT_select_handles"; - ot->description = "Select manipulator handles on the sides of the selected strip"; + ot->description = "Select gizmo handles on the sides of the selected strip"; /* api callbacks */ ot->exec = sequencer_select_handles_exec; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 691baaf48f7..6d4009e9d2b 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -451,12 +451,12 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar) ListBase *lb; wmKeyMap *keymap; - if (ar->manipulator_map == NULL) { - ar->manipulator_map = WM_manipulatormap_new_from_type( - &(const struct wmManipulatorMapType_Params) {SPACE_VIEW3D, RGN_TYPE_WINDOW}); + if (ar->gizmo_map == NULL) { + ar->gizmo_map = WM_gizmomap_new_from_type( + &(const struct wmGizmoMapType_Params) {SPACE_VIEW3D, RGN_TYPE_WINDOW}); } - WM_manipulatormap_add_handlers(ar, ar->manipulator_map); + WM_gizmomap_add_handlers(ar, ar->gizmo_map); /* object ops. */ @@ -716,26 +716,26 @@ static void view3d_dropboxes(void) static void view3d_widgets(void) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure( - &(const struct wmManipulatorMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW}); - - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_spot); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_area); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_target); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_force_field); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_camera); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_camera_view); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_empty_image); - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_armature_spline); - - WM_manipulatorgrouptype_append(TRANSFORM_WGT_manipulator); - WM_manipulatorgrouptype_append(VIEW3D_WGT_xform_cage); - - WM_manipulatorgrouptype_append(VIEW3D_WGT_ruler); - WM_manipulatortype_append(VIEW3D_WT_ruler_item); - - WM_manipulatorgrouptype_append_and_link(mmap_type, VIEW3D_WGT_navigate); - WM_manipulatortype_append(VIEW3D_WT_navigate_rotate); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure( + &(const struct wmGizmoMapType_Params){SPACE_VIEW3D, RGN_TYPE_WINDOW}); + + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_spot); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_area); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_lamp_target); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_force_field); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_camera); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_camera_view); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_empty_image); + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_armature_spline); + + WM_gizmogrouptype_append(TRANSFORM_WGT_gizmo); + WM_gizmogrouptype_append(VIEW3D_WGT_xform_cage); + + WM_gizmogrouptype_append(VIEW3D_WGT_ruler); + WM_gizmotype_append(VIEW3D_WT_ruler_item); + + WM_gizmogrouptype_append_and_link(mmap_type, VIEW3D_WGT_navigate); + WM_gizmotype_append(VIEW3D_WT_navigate_rotate); } @@ -815,13 +815,13 @@ static void view3d_main_region_listener( { View3D *v3d = sa->spacedata.first; RegionView3D *rv3d = ar->regiondata; - wmManipulatorMap *mmap = ar->manipulator_map; + wmGizmoMap *mmap = ar->gizmo_map; /* context changes */ switch (wmn->category) { case NC_WM: if (ELEM(wmn->data, ND_UNDO)) { - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); } break; case NC_ANIMATION: @@ -848,14 +848,14 @@ static void view3d_main_region_listener( if (wmn->reference) view3d_recalc_used_layers(ar, wmn, wmn->reference); ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); break; case ND_LAYER: if (wmn->reference) { BKE_screen_view3d_sync(v3d, wmn->reference); } ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); break; case ND_OB_ACTIVE: case ND_OB_SELECT: @@ -867,7 +867,7 @@ static void view3d_main_region_listener( case ND_MARKERS: case ND_MODE: ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); break; case ND_WORLD: /* handled by space_view3d_listener() for v3d access */ @@ -899,7 +899,7 @@ static void view3d_main_region_listener( case ND_POINTCACHE: case ND_LOD: ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); break; } switch (wmn->action) { @@ -912,7 +912,7 @@ static void view3d_main_region_listener( switch (wmn->data) { case ND_SELECT: { - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); ATTR_FALLTHROUGH; } case ND_DATA: @@ -993,7 +993,7 @@ static void view3d_main_region_listener( break; case ND_LIGHTING_DRAW: ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); break; } break; @@ -1019,7 +1019,7 @@ static void view3d_main_region_listener( rv3d->rflag |= RV3D_GPULIGHT_UPDATE; } ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); } break; case NC_ID: @@ -1035,7 +1035,7 @@ static void view3d_main_region_listener( case ND_LAYOUTBROWSE: case ND_LAYOUTDELETE: case ND_LAYOUTSET: - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); ED_region_tag_redraw(ar); break; case ND_LAYER: @@ -1545,7 +1545,7 @@ void ED_spacetype_view3d(void) st->operatortypes = view3d_operatortypes; st->keymap = view3d_keymap; st->dropboxes = view3d_dropboxes; - st->manipulators = view3d_widgets; + st->gizmos = view3d_widgets; st->context = view3d_context; st->id_remap = view3d_id_remap; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 62e9d4ee3bf..3b86e574a1a 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1203,10 +1203,10 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int UNUSED(of BLF_batch_draw_begin(); - if ((U.uiflag & USER_SHOW_MANIPULATOR_AXIS) || + if ((U.uiflag & USER_SHOW_GIZMO_AXIS) || (v3d->flag2 & V3D_RENDER_OVERRIDE) || - /* No need to display manipulator and this info. */ - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_NAVIGATE))) + /* No need to display gizmo and this info. */ + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE))) { /* pass */ } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index b6e20def432..792a341fba4 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2812,8 +2812,8 @@ static int viewselected_exec(bContext *C, wmOperator *op) ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph); bGPdata *gpd = CTX_data_gpencil_data(C); const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)); - const bool is_face_map = ((is_gp_edit == false) && ar->manipulator_map && - WM_manipulatormap_is_any_selected(ar->manipulator_map)); + const bool is_face_map = ((is_gp_edit == false) && ar->gizmo_map && + WM_gizmomap_is_any_selected(ar->gizmo_map)); Object *ob_eval = OBACT(view_layer_eval); Object *obedit = CTX_data_edit_object(C); float min[3], max[3]; @@ -2858,7 +2858,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) CTX_DATA_END; } else if (is_face_map) { - ok = WM_manipulatormap_minmax(ar->manipulator_map, true, true, min, max); + ok = WM_gizmomap_minmax(ar->gizmo_map, true, true, min, max); } else if (obedit) { /* only selected */ @@ -3705,7 +3705,7 @@ static int view_axis_exec(bContext *C, wmOperator *op) Object *obact = CTX_data_active_object(C); if (obact != NULL) { float twmat[3][3]; - /* same as transform manipulator when normal is set */ + /* same as transform gizmo when normal is set */ ED_getTransformOrientationMatrix(C, twmat, V3D_AROUND_ACTIVE); align_quat = align_quat_buf; mat3_to_quat(align_quat, twmat); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c index 16c7d574873..c7b12529798 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c @@ -52,7 +52,7 @@ /* -------------------------------------------------------------------- */ -/** \name Armature Spline Manipulator +/** \name Armature Spline Gizmo * * \{ */ @@ -68,7 +68,7 @@ #define BBONE_SCALE_Y 3.0f struct BoneSplineHandle { - wmManipulator *manipulator; + wmGizmo *gizmo; bPoseChannel *pchan; /* We could remove, keep since at the moment for checking the conversion. */ float co[3]; @@ -79,8 +79,8 @@ struct BoneSplineWidgetGroup { struct BoneSplineHandle handles[2]; }; -static void manipulator_bbone_offset_get( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_bbone_offset_get( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, void *value_p) { struct BoneSplineHandle *bh = mpr_prop->custom_func.user_data; @@ -102,8 +102,8 @@ static void manipulator_bbone_offset_get( copy_v3_v3(value, bh->co); } -static void manipulator_bbone_offset_set( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_bbone_offset_set( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, const void *value_p) { struct BoneSplineHandle *bh = mpr_prop->custom_func.user_data; @@ -127,7 +127,7 @@ static void manipulator_bbone_offset_set( } -static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); if (ob != NULL) { @@ -136,7 +136,7 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmManipulatorGro if (arm->act_bone && arm->act_bone->segments > 1) { View3D *v3d = CTX_wm_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) { /* pass */ } @@ -150,27 +150,27 @@ static bool WIDGETGROUP_armature_spline_poll(const bContext *C, wmManipulatorGro } -static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmGizmoGroup *mgroup) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bPoseChannel *pchan = BKE_pose_channel_active(ob); - const wmManipulatorType *wt_grab = WM_manipulatortype_find("MANIPULATOR_WT_grab_3d", true); + const wmGizmoType *wt_grab = WM_gizmotype_find("GIZMO_WT_grab_3d", true); struct BoneSplineWidgetGroup *bspline_group = MEM_callocN(sizeof(struct BoneSplineWidgetGroup), __func__); mgroup->customdata = bspline_group; /* Handles */ for (int i = 0; i < ARRAY_SIZE(bspline_group->handles); i++) { - wmManipulator *mpr; - mpr = bspline_group->handles[i].manipulator = WM_manipulator_new_ptr(wt_grab, mgroup, NULL); - RNA_enum_set(mpr->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_RING_2D); + wmGizmo *mpr; + mpr = bspline_group->handles[i].gizmo = WM_gizmo_new_ptr(wt_grab, mgroup, NULL); + RNA_enum_set(mpr->ptr, "draw_style", ED_GIZMO_GRAB_STYLE_RING_2D); RNA_enum_set(mpr->ptr, "draw_options", - ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL | ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_VALUE, true); + ED_GIZMO_GRAB_DRAW_FLAG_FILL | ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_VALUE, true); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); mpr->scale_basis = 0.06f; @@ -180,7 +180,7 @@ static void WIDGETGROUP_armature_spline_setup(const bContext *C, wmManipulatorGr } } -static void WIDGETGROUP_armature_spline_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_armature_spline_refresh(const bContext *C, wmGizmoGroup *mgroup) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); @@ -192,7 +192,7 @@ static void WIDGETGROUP_armature_spline_refresh(const bContext *C, wmManipulator /* Handles */ for (int i = 0; i < ARRAY_SIZE(bspline_group->handles); i++) { - wmManipulator *mpr = bspline_group->handles[i].manipulator; + wmGizmo *mpr = bspline_group->handles[i].gizmo; bspline_group->handles[i].pchan = pchan; bspline_group->handles[i].index = i; @@ -201,24 +201,24 @@ static void WIDGETGROUP_armature_spline_refresh(const bContext *C, wmManipulator copy_m4_m4(mpr->matrix_space, mat); /* need to set property here for undo. TODO would prefer to do this in _init */ - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( mpr, "offset", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_bbone_offset_get, - .value_set_fn = manipulator_bbone_offset_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_bbone_offset_get, + .value_set_fn = gizmo_bbone_offset_set, .range_get_fn = NULL, .user_data = &bspline_group->handles[i], }); } } -void VIEW3D_WGT_armature_spline(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_armature_spline(wmGizmoGroupType *wgt) { wgt->name = "Armature Spline Widgets"; wgt->idname = "VIEW3D_WGT_armature_spline"; - wgt->flag = (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D); + wgt->flag = (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D); wgt->poll = WIDGETGROUP_armature_spline_poll; wgt->setup = WIDGETGROUP_armature_spline_setup; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c index 0c97669a9af..b011e6e2e21 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c @@ -52,20 +52,20 @@ /* -------------------------------------------------------------------- */ -/** \name Camera Manipulators +/** \name Camera Gizmos * \{ */ struct CameraWidgetGroup { - wmManipulator *dop_dist; - wmManipulator *focal_len; - wmManipulator *ortho_scale; + wmGizmo *dop_dist; + wmGizmo *focal_len; + wmGizmo *ortho_scale; }; -static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) { return false; } @@ -81,12 +81,12 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *U return false; } -static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_camera_setup(const bContext *C, wmGizmoGroup *mgroup) { Object *ob = CTX_data_active_object(C); float dir[3]; - const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true); + const wmGizmoType *wt_arrow = WM_gizmotype_find("GIZMO_WT_arrow_3d", true); struct CameraWidgetGroup *camgroup = MEM_callocN(sizeof(struct CameraWidgetGroup), __func__); mgroup->customdata = camgroup; @@ -95,38 +95,38 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro /* dof distance */ { - wmManipulator *mpr; - mpr = camgroup->dop_dist = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - RNA_enum_set(mpr->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_CROSS); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_HOVER, true); + wmGizmo *mpr; + mpr = camgroup->dop_dist = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + RNA_enum_set(mpr->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_CROSS); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_HOVER, true); - UI_GetThemeColor3fv(TH_MANIPULATOR_A, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_A, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); } /* focal length * - logic/calculations are similar to BKE_camera_view_frame_ex, better keep in sync */ { - wmManipulator *mpr; - mpr = camgroup->focal_len = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - mpr->flag |= WM_MANIPULATOR_DRAW_NO_SCALE; - RNA_enum_set(mpr->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_CONE); - RNA_enum_set(mpr->ptr, "transform", ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED); - - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); - - mpr = camgroup->ortho_scale = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - mpr->flag |= WM_MANIPULATOR_DRAW_NO_SCALE; - RNA_enum_set(mpr->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_CONE); - RNA_enum_set(mpr->ptr, "transform", ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED); - - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + wmGizmo *mpr; + mpr = camgroup->focal_len = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + mpr->flag |= WM_GIZMO_DRAW_NO_SCALE; + RNA_enum_set(mpr->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_CONE); + RNA_enum_set(mpr->ptr, "transform", ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED); + + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); + + mpr = camgroup->ortho_scale = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + mpr->flag |= WM_GIZMO_DRAW_NO_SCALE; + RNA_enum_set(mpr->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_CONE); + RNA_enum_set(mpr->ptr, "transform", ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED); + + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); } } -static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_camera_refresh(const bContext *C, wmGizmoGroup *mgroup) { if (!mgroup->customdata) return; @@ -149,16 +149,16 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg negate_v3_v3(dir, ob->obmat[2]); if (ca->flag & CAM_SHOWLIMITS) { - WM_manipulator_set_matrix_location(camgroup->dop_dist, ob->obmat[3]); - WM_manipulator_set_matrix_rotation_from_yz_axis(camgroup->dop_dist, ob->obmat[1], dir); - WM_manipulator_set_scale(camgroup->dop_dist, ca->drawsize); - WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_matrix_location(camgroup->dop_dist, ob->obmat[3]); + WM_gizmo_set_matrix_rotation_from_yz_axis(camgroup->dop_dist, ob->obmat[1], dir); + WM_gizmo_set_scale(camgroup->dop_dist, ca->drawsize); + WM_gizmo_set_flag(camgroup->dop_dist, WM_GIZMO_HIDDEN, false); /* need to set property here for undo. TODO would prefer to do this in _init */ - WM_manipulator_target_property_def_rna(camgroup->dop_dist, "offset", &camera_ptr, "dof_distance", -1); + WM_gizmo_target_property_def_rna(camgroup->dop_dist, "offset", &camera_ptr, "dof_distance", -1); } else { - WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(camgroup->dop_dist, WM_GIZMO_HIDDEN, true); } /* TODO - make focal length/ortho ob_scale_inv widget optional */ @@ -167,14 +167,14 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg const float aspy = (float)scene->r.ysch * scene->r.yasp; const bool is_ortho = (ca->type == CAM_ORTHO); const int sensor_fit = BKE_camera_sensor_fit(ca->sensor_fit, aspx, aspy); - wmManipulator *widget = is_ortho ? camgroup->ortho_scale : camgroup->focal_len; + wmGizmo *widget = is_ortho ? camgroup->ortho_scale : camgroup->focal_len; float scale_matrix; if (true) { float offset[3]; float aspect[2]; - WM_manipulator_set_flag(widget, WM_MANIPULATOR_HIDDEN, false); - WM_manipulator_set_flag(is_ortho ? camgroup->focal_len : camgroup->ortho_scale, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(widget, WM_GIZMO_HIDDEN, false); + WM_gizmo_set_flag(is_ortho ? camgroup->focal_len : camgroup->ortho_scale, WM_GIZMO_HIDDEN, true); /* account for lens shifting */ @@ -187,8 +187,8 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg aspect[1] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? aspy / aspx : 1.0f; unit_m4(widget->matrix_basis); - WM_manipulator_set_matrix_location(widget, ob->obmat[3]); - WM_manipulator_set_matrix_rotation_from_yz_axis(widget, ob->obmat[1], dir); + WM_gizmo_set_matrix_location(widget, ob->obmat[3]); + WM_gizmo_set_matrix_rotation_from_yz_axis(widget, ob->obmat[1], dir); if (is_ortho) { scale_matrix = ca->ortho_scale * 0.5f; @@ -201,16 +201,16 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg RNA_float_set_array(widget->ptr, "aspect", aspect); - WM_manipulator_set_matrix_offset_location(widget, offset); + WM_gizmo_set_matrix_offset_location(widget, offset); } /* define & update properties */ { const char *propname = is_ortho ? "ortho_scale" : "lens"; PropertyRNA *prop = RNA_struct_find_property(&camera_ptr, propname); - const wmManipulatorPropertyType *mpr_prop_type = WM_manipulatortype_target_property_find(widget->type, "offset"); + const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(widget->type, "offset"); - WM_manipulator_target_property_clear_rna_ptr(widget, mpr_prop_type); + WM_gizmo_target_property_clear_rna_ptr(widget, mpr_prop_type); float min, max, range; float step, precision; @@ -219,20 +219,20 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg RNA_property_float_ui_range(&camera_ptr, prop, &min, &max, &step, &precision); range = max - min; - ED_manipulator_arrow3d_set_range_fac( + ED_gizmo_arrow3d_set_range_fac( widget, is_ortho ? (ca->drawsize * range) : (scale_matrix * range / /* Half sensor, intentionally use sensor from camera and not calculated above. */ (0.5f * ((ca->sensor_fit == CAMERA_SENSOR_FIT_HOR) ? ca->sensor_x : ca->sensor_x)))); - WM_manipulator_target_property_def_rna_ptr(widget, mpr_prop_type, &camera_ptr, prop, -1); + WM_gizmo_target_property_def_rna_ptr(widget, mpr_prop_type, &camera_ptr, prop, -1); } } static void WIDGETGROUP_camera_message_subscribe( - const bContext *C, wmManipulatorGroup *mgroup, struct wmMsgBus *mbus) + const bContext *C, wmGizmoGroup *mgroup, struct wmMsgBus *mbus) { ARegion *ar = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); @@ -241,7 +241,7 @@ static void WIDGETGROUP_camera_message_subscribe( wmMsgSubscribeValue msg_sub_value_mpr_tag_refresh = { .owner = ar, .user_data = mgroup->parent_mmap, - .notify = WM_manipulator_do_msg_notify_tag_refresh, + .notify = WM_gizmo_do_msg_notify_tag_refresh, }; { @@ -283,14 +283,14 @@ static void WIDGETGROUP_camera_message_subscribe( } } -void VIEW3D_WGT_camera(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_camera(wmGizmoGroupType *wgt) { wgt->name = "Camera Widgets"; wgt->idname = "VIEW3D_WGT_camera"; - wgt->flag = (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D | - WM_MANIPULATORGROUPTYPE_DEPTH_3D); + wgt->flag = (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D | + WM_GIZMOGROUPTYPE_DEPTH_3D); wgt->poll = WIDGETGROUP_camera_poll; wgt->setup = WIDGETGROUP_camera_setup; @@ -302,11 +302,11 @@ void VIEW3D_WGT_camera(wmManipulatorGroupType *wgt) /* -------------------------------------------------------------------- */ -/** \name CameraView Manipulators +/** \name CameraView Gizmos * \{ */ struct CameraViewWidgetGroup { - wmManipulator *border; + wmGizmo *border; struct { rctf *edit_border; @@ -315,8 +315,8 @@ struct CameraViewWidgetGroup { }; /* scale callbacks */ -static void manipulator_render_border_prop_matrix_get( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_render_border_prop_matrix_get( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, void *value_p) { float (*matrix)[4] = value_p; @@ -331,8 +331,8 @@ static void manipulator_render_border_prop_matrix_get( matrix[3][1] = BLI_rctf_cent_y(border); } -static void manipulator_render_border_prop_matrix_set( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_render_border_prop_matrix_set( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, const void *value_p) { const float (*matrix)[4] = value_p; @@ -345,7 +345,7 @@ static void manipulator_render_border_prop_matrix_set( BLI_rctf_isect(&(rctf){.xmin = 0, .ymin = 0, .xmax = 1, .ymax = 1}, border, border); } -static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { Scene *scene = CTX_data_scene(C); @@ -361,7 +361,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmManipulatorGroupTy View3D *v3d = CTX_wm_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) { return false; } @@ -382,22 +382,22 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmManipulatorGroupTy return false; } -static void WIDGETGROUP_camera_view_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_camera_view_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct CameraViewWidgetGroup *viewgroup = MEM_mallocN(sizeof(struct CameraViewWidgetGroup), __func__); - viewgroup->border = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, NULL); + viewgroup->border = WM_gizmo_new("GIZMO_WT_cage_2d", mgroup, NULL); RNA_enum_set(viewgroup->border->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE); + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE); /* Box style is more subtle in this case. */ - RNA_enum_set(viewgroup->border->ptr, "draw_style", ED_MANIPULATOR_CAGE2D_STYLE_BOX); + RNA_enum_set(viewgroup->border->ptr, "draw_style", ED_GIZMO_CAGE2D_STYLE_BOX); mgroup->customdata = viewgroup; } -static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { struct CameraViewWidgetGroup *viewgroup = mgroup->customdata; @@ -413,7 +413,7 @@ static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmManipulato viewgroup->state.view_border = (rctf){.xmin = 0, .ymin = 0, .xmax = ar->winx, .ymax = ar->winy}; } - wmManipulator *mpr = viewgroup->border; + wmGizmo *mpr = viewgroup->border; unit_m4(mpr->matrix_space); mul_v3_fl(mpr->matrix_space[0], BLI_rctf_size_x(&viewgroup->state.view_border)); mul_v3_fl(mpr->matrix_space[1], BLI_rctf_size_y(&viewgroup->state.view_border)); @@ -421,7 +421,7 @@ static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmManipulato mpr->matrix_space[3][1] = viewgroup->state.view_border.ymin; } -static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *mgroup) { struct CameraViewWidgetGroup *viewgroup = mgroup->customdata; @@ -431,11 +431,11 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmManipulatorGrou Scene *scene = CTX_data_scene(C); { - wmManipulator *mpr = viewgroup->border; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + wmGizmo *mpr = viewgroup->border; + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); RNA_enum_set(viewgroup->border->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE); + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE); if (rv3d->persp == RV3D_CAMOB) { viewgroup->state.edit_border = &scene->r.border; @@ -444,11 +444,11 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmManipulatorGrou viewgroup->state.edit_border = &v3d->render_border; } - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( mpr, "matrix", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_render_border_prop_matrix_get, - .value_set_fn = manipulator_render_border_prop_matrix_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_render_border_prop_matrix_get, + .value_set_fn = gizmo_render_border_prop_matrix_set, .range_get_fn = NULL, .user_data = viewgroup, }); @@ -456,13 +456,13 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmManipulatorGrou } -void VIEW3D_WGT_camera_view(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_camera_view(wmGizmoGroupType *wgt) { wgt->name = "Camera View Widgets"; wgt->idname = "VIEW3D_WGT_camera_view"; - wgt->flag = (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_SCALE); + wgt->flag = (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_SCALE); wgt->poll = WIDGETGROUP_camera_view_poll; wgt->setup = WIDGETGROUP_camera_view_setup; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c index 89f55bc1d9a..3b51af5ca15 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c @@ -50,11 +50,11 @@ /* -------------------------------------------------------------------- */ -/** \name Empty Image Manipulators +/** \name Empty Image Gizmos * \{ */ struct EmptyImageWidgetGroup { - wmManipulator *manipulator; + wmGizmo *gizmo; struct { Object *ob; float dims[2]; @@ -62,8 +62,8 @@ struct EmptyImageWidgetGroup { }; /* translate callbacks */ -static void manipulator_empty_image_prop_matrix_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_empty_image_prop_matrix_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, void *value_p) { float (*matrix)[4] = value_p; @@ -84,8 +84,8 @@ static void manipulator_empty_image_prop_matrix_get( matrix[3][1] = (ob->ima_ofs[1] * dims[1]) + (0.5f * dims[1]); } -static void manipulator_empty_image_prop_matrix_set( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +static void gizmo_empty_image_prop_matrix_set( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const void *value_p) { const float (*matrix)[4] = value_p; @@ -104,12 +104,12 @@ static void manipulator_empty_image_prop_matrix_set( ob->ima_ofs[1] = (matrix[3][1] - (0.5f * dims[1])) / dims[1]; } -static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) { return false; } @@ -122,34 +122,34 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmManipulatorGroupTy return false; } -static void WIDGETGROUP_empty_image_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_empty_image_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct EmptyImageWidgetGroup *imgroup = MEM_mallocN(sizeof(struct EmptyImageWidgetGroup), __func__); - imgroup->manipulator = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, NULL); - wmManipulator *mpr = imgroup->manipulator; + imgroup->gizmo = WM_gizmo_new("GIZMO_WT_cage_2d", mgroup, NULL); + wmGizmo *mpr = imgroup->gizmo; RNA_enum_set(mpr->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE); + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE); mgroup->customdata = imgroup; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_HOVER, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_HOVER, true); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); } -static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmGizmoGroup *mgroup) { struct EmptyImageWidgetGroup *imgroup = mgroup->customdata; Object *ob = CTX_data_active_object(C); - wmManipulator *mpr = imgroup->manipulator; + wmGizmo *mpr = imgroup->gizmo; copy_m4_m4(mpr->matrix_basis, ob->obmat); RNA_enum_set(mpr->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM); + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM); imgroup->state.ob = ob; @@ -177,24 +177,24 @@ static void WIDGETGROUP_empty_image_refresh(const bContext *C, wmManipulatorGrou } RNA_float_set_array(mpr->ptr, "dimensions", imgroup->state.dims); - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( mpr, "matrix", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_empty_image_prop_matrix_get, - .value_set_fn = manipulator_empty_image_prop_matrix_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_empty_image_prop_matrix_get, + .value_set_fn = gizmo_empty_image_prop_matrix_set, .range_get_fn = NULL, .user_data = imgroup, }); } -void VIEW3D_WGT_empty_image(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_empty_image(wmGizmoGroupType *wgt) { wgt->name = "Area Light Widgets"; wgt->idname = "VIEW3D_WGT_empty_image"; - wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D | - WM_MANIPULATORGROUPTYPE_DEPTH_3D); + wgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D | + WM_GIZMOGROUPTYPE_DEPTH_3D); wgt->poll = WIDGETGROUP_empty_image_poll; wgt->setup = WIDGETGROUP_empty_image_setup; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c index db985c18c08..d4605bb0c7d 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_forcefield.c @@ -49,15 +49,15 @@ /* -------------------------------------------------------------------- */ -/** \name Force Field Manipulators +/** \name Force Field Gizmos * \{ */ -static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) { return false; } @@ -67,26 +67,26 @@ static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmManipulatorGroupTyp return (ob && ob->pd && ob->pd->forcefield); } -static void WIDGETGROUP_forcefield_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_forcefield_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { /* only wind effector for now */ - wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__); + wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); mgroup->customdata = wwrapper; - wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, NULL); - wmManipulator *mpr = wwrapper->manipulator; - RNA_enum_set(mpr->ptr, "transform", ED_MANIPULATOR_ARROW_XFORM_FLAG_CONSTRAINED); - ED_manipulator_arrow3d_set_ui_range(mpr, -200.0f, 200.0f); - ED_manipulator_arrow3d_set_range_fac(mpr, 6.0f); + wwrapper->gizmo = WM_gizmo_new("GIZMO_WT_arrow_3d", mgroup, NULL); + wmGizmo *mpr = wwrapper->gizmo; + RNA_enum_set(mpr->ptr, "transform", ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED); + ED_gizmo_arrow3d_set_ui_range(mpr, -200.0f, 200.0f); + ED_gizmo_arrow3d_set_range_fac(mpr, 6.0f); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); } -static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = mgroup->customdata; - wmManipulator *mpr = wwrapper->manipulator; + wmGizmoWrapper *wwrapper = mgroup->customdata; + wmGizmo *mpr = wwrapper->gizmo; Object *ob = CTX_data_active_object(C); PartDeflect *pd = ob->pd; @@ -96,26 +96,26 @@ static void WIDGETGROUP_forcefield_refresh(const bContext *C, wmManipulatorGroup PointerRNA field_ptr; RNA_pointer_create(&ob->id, &RNA_FieldSettings, pd, &field_ptr); - WM_manipulator_set_matrix_location(mpr, ob->obmat[3]); - WM_manipulator_set_matrix_rotation_from_z_axis(mpr, ob->obmat[2]); - WM_manipulator_set_matrix_offset_location(mpr, ofs); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); - WM_manipulator_target_property_def_rna(mpr, "offset", &field_ptr, "strength", -1); + WM_gizmo_set_matrix_location(mpr, ob->obmat[3]); + WM_gizmo_set_matrix_rotation_from_z_axis(mpr, ob->obmat[2]); + WM_gizmo_set_matrix_offset_location(mpr, ofs); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); + WM_gizmo_target_property_def_rna(mpr, "offset", &field_ptr, "strength", -1); } else { - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, true); } } -void VIEW3D_WGT_force_field(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_force_field(wmGizmoGroupType *wgt) { wgt->name = "Force Field Widgets"; wgt->idname = "VIEW3D_WGT_force_field"; - wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D | - WM_MANIPULATORGROUPTYPE_SCALE | - WM_MANIPULATORGROUPTYPE_DEPTH_3D); + wgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D | + WM_GIZMOGROUPTYPE_SCALE | + WM_GIZMOGROUPTYPE_DEPTH_3D); wgt->poll = WIDGETGROUP_forcefield_poll; wgt->setup = WIDGETGROUP_forcefield_setup; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c b/source/blender/editors/space_view3d/view3d_gizmo_lamp.c index 8087fcbdddd..a872cc96172 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_lamp.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_lamp.c @@ -49,14 +49,14 @@ /* -------------------------------------------------------------------- */ -/** \name Spot Lamp Manipulators +/** \name Spot Lamp Gizmos * \{ */ -static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_CONTEXT))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_CONTEXT))) { return false; } @@ -70,49 +70,49 @@ static bool WIDGETGROUP_lamp_spot_poll(const bContext *C, wmManipulatorGroupType return false; } -static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__); + wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); - wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, NULL); - wmManipulator *mpr = wwrapper->manipulator; - RNA_enum_set(mpr->ptr, "transform", ED_MANIPULATOR_ARROW_XFORM_FLAG_INVERTED); + wwrapper->gizmo = WM_gizmo_new("GIZMO_WT_arrow_3d", mgroup, NULL); + wmGizmo *mpr = wwrapper->gizmo; + RNA_enum_set(mpr->ptr, "transform", ED_GIZMO_ARROW_XFORM_FLAG_INVERTED); mgroup->customdata = wwrapper; - ED_manipulator_arrow3d_set_range_fac(mpr, 4.0f); + ED_gizmo_arrow3d_set_range_fac(mpr, 4.0f); - UI_GetThemeColor3fv(TH_MANIPULATOR_SECONDARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_SECONDARY, mpr->color); } -static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = mgroup->customdata; - wmManipulator *mpr = wwrapper->manipulator; + wmGizmoWrapper *wwrapper = mgroup->customdata; + wmGizmo *mpr = wwrapper->gizmo; Object *ob = CTX_data_active_object(C); Lamp *la = ob->data; float dir[3]; negate_v3_v3(dir, ob->obmat[2]); - WM_manipulator_set_matrix_rotation_from_z_axis(mpr, dir); - WM_manipulator_set_matrix_location(mpr, ob->obmat[3]); + WM_gizmo_set_matrix_rotation_from_z_axis(mpr, dir); + WM_gizmo_set_matrix_location(mpr, ob->obmat[3]); /* need to set property here for undo. TODO would prefer to do this in _init */ PointerRNA lamp_ptr; const char *propname = "spot_size"; RNA_pointer_create(&la->id, &RNA_Light, la, &lamp_ptr); - WM_manipulator_target_property_def_rna(mpr, "offset", &lamp_ptr, propname, -1); + WM_gizmo_target_property_def_rna(mpr, "offset", &lamp_ptr, propname, -1); } -void VIEW3D_WGT_lamp_spot(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_lamp_spot(wmGizmoGroupType *wgt) { wgt->name = "Spot Light Widgets"; wgt->idname = "VIEW3D_WGT_lamp_spot"; - wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D | - WM_MANIPULATORGROUPTYPE_DEPTH_3D); + wgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D | + WM_GIZMOGROUPTYPE_DEPTH_3D); wgt->poll = WIDGETGROUP_lamp_spot_poll; wgt->setup = WIDGETGROUP_lamp_spot_setup; @@ -123,12 +123,12 @@ void VIEW3D_WGT_lamp_spot(wmManipulatorGroupType *wgt) /* -------------------------------------------------------------------- */ -/** \name Area Lamp Manipulators +/** \name Area Lamp Gizmos * \{ */ /* scale callbacks */ -static void manipulator_area_lamp_prop_matrix_get( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_area_lamp_prop_matrix_get( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, void *value_p) { BLI_assert(mpr_prop->type->array_length == 16); @@ -139,8 +139,8 @@ static void manipulator_area_lamp_prop_matrix_get( matrix[1][1] = ELEM(la->area_shape, LA_AREA_RECT, LA_AREA_ELLIPSE) ? la->area_sizey : la->area_size; } -static void manipulator_area_lamp_prop_matrix_set( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void gizmo_area_lamp_prop_matrix_set( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, const void *value_p) { const float (*matrix)[4] = value_p; @@ -156,7 +156,7 @@ static void manipulator_area_lamp_prop_matrix_set( } } -static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); if (v3d->flag2 & V3D_RENDER_OVERRIDE) { @@ -171,56 +171,56 @@ static bool WIDGETGROUP_lamp_area_poll(const bContext *C, wmManipulatorGroupType return false; } -static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__); - wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, NULL); - wmManipulator *mpr = wwrapper->manipulator; + wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); + wwrapper->gizmo = WM_gizmo_new("GIZMO_WT_cage_2d", mgroup, NULL); + wmGizmo *mpr = wwrapper->gizmo; RNA_enum_set(mpr->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE); + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE); mgroup->customdata = wwrapper; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_HOVER, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_HOVER, true); - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); } -static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = mgroup->customdata; + wmGizmoWrapper *wwrapper = mgroup->customdata; Object *ob = CTX_data_active_object(C); Lamp *la = ob->data; - wmManipulator *mpr = wwrapper->manipulator; + wmGizmo *mpr = wwrapper->gizmo; copy_m4_m4(mpr->matrix_basis, ob->obmat); - int flag = ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE; + int flag = ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE; if (ELEM(la->area_shape, LA_AREA_SQUARE, LA_AREA_DISK)) { - flag |= ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE_UNIFORM; + flag |= ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_UNIFORM; } RNA_enum_set(mpr->ptr, "transform", flag); /* need to set property here for undo. TODO would prefer to do this in _init */ - WM_manipulator_target_property_def_func( + WM_gizmo_target_property_def_func( mpr, "matrix", - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = manipulator_area_lamp_prop_matrix_get, - .value_set_fn = manipulator_area_lamp_prop_matrix_set, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = gizmo_area_lamp_prop_matrix_get, + .value_set_fn = gizmo_area_lamp_prop_matrix_set, .range_get_fn = NULL, .user_data = la, }); } -void VIEW3D_WGT_lamp_area(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_lamp_area(wmGizmoGroupType *wgt) { wgt->name = "Area Light Widgets"; wgt->idname = "VIEW3D_WGT_lamp_area"; - wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D | - WM_MANIPULATORGROUPTYPE_DEPTH_3D); + wgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D | + WM_GIZMOGROUPTYPE_DEPTH_3D); wgt->poll = WIDGETGROUP_lamp_area_poll; wgt->setup = WIDGETGROUP_lamp_area_setup; @@ -232,10 +232,10 @@ void VIEW3D_WGT_lamp_area(wmManipulatorGroupType *wgt) /* -------------------------------------------------------------------- */ -/** \name Lamp Target Manipulator +/** \name Lamp Target Gizmo * \{ */ -static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); if (v3d->flag2 & V3D_RENDER_OVERRIDE) { @@ -258,46 +258,46 @@ static bool WIDGETGROUP_lamp_target_poll(const bContext *C, wmManipulatorGroupTy return false; } -static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__); - wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_grab_3d", mgroup, NULL); - wmManipulator *mpr = wwrapper->manipulator; + wmGizmoWrapper *wwrapper = MEM_mallocN(sizeof(wmGizmoWrapper), __func__); + wwrapper->gizmo = WM_gizmo_new("GIZMO_WT_grab_3d", mgroup, NULL); + wmGizmo *mpr = wwrapper->gizmo; mgroup->customdata = wwrapper; - UI_GetThemeColor3fv(TH_MANIPULATOR_PRIMARY, mpr->color); - UI_GetThemeColor3fv(TH_MANIPULATOR_HI, mpr->color_hi); + UI_GetThemeColor3fv(TH_GIZMO_PRIMARY, mpr->color); + UI_GetThemeColor3fv(TH_GIZMO_HI, mpr->color_hi); mpr->scale_basis = 0.06f; wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_transform_axis_target", true); RNA_enum_set(mpr->ptr, "draw_options", - ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL | ED_MANIPULATOR_GRAB_DRAW_FLAG_ALIGN_VIEW); + ED_GIZMO_GRAB_DRAW_FLAG_FILL | ED_GIZMO_GRAB_DRAW_FLAG_ALIGN_VIEW); - WM_manipulator_operator_set(mpr, 0, ot, NULL); + WM_gizmo_operator_set(mpr, 0, ot, NULL); } -static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { - wmManipulatorWrapper *wwrapper = mgroup->customdata; + wmGizmoWrapper *wwrapper = mgroup->customdata; Object *ob = CTX_data_active_object(C); - wmManipulator *mpr = wwrapper->manipulator; + wmGizmo *mpr = wwrapper->gizmo; copy_m4_m4(mpr->matrix_basis, ob->obmat); unit_m4(mpr->matrix_offset); mpr->matrix_offset[3][2] = -2.4f / mpr->scale_basis; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_OFFSET_SCALE, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_DRAW_OFFSET_SCALE, true); } -void VIEW3D_WGT_lamp_target(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_lamp_target(wmGizmoGroupType *wgt) { wgt->name = "Target Light Widgets"; wgt->idname = "VIEW3D_WGT_lamp_target"; - wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_3D); + wgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_3D); wgt->poll = WIDGETGROUP_lamp_target_poll; wgt->setup = WIDGETGROUP_lamp_target_setup; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c index db4eeef18f7..98669739745 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c @@ -47,17 +47,17 @@ #include "view3d_intern.h" /* own include */ /* -------------------------------------------------------------------- */ -/** \name View3D Navigation Manipulator Group +/** \name View3D Navigation Gizmo Group * \{ */ /* Offset from screen edge. */ -#define MANIPULATOR_OFFSET_FAC 1.5f +#define GIZMO_OFFSET_FAC 1.5f /* Size of main icon. */ -#define MANIPULATOR_SIZE 64 +#define GIZMO_SIZE 64 /* Factor for size of smaller button. */ -#define MANIPULATOR_MINI_FAC 0.35f +#define GIZMO_MINI_FAC 0.35f /* How much mini buttons offset from the primary. */ -#define MANIPULATOR_MINI_OFFSET_FAC 0.42f +#define GIZMO_MINI_OFFSET_FAC 0.42f enum { @@ -122,40 +122,40 @@ static const uchar shape_zoom[] = { }; -struct NavigateManipulatorInfo { +struct NavigateGizmoInfo { const char *opname; - const char *manipulator; + const char *gizmo; const unsigned char *shape; uint shape_size; }; #define SHAPE_VARS(shape_id) shape = shape_id, .shape_size = ARRAY_SIZE(shape_id) -struct NavigateManipulatorInfo g_navigate_params[MPR_TOTAL] = { +struct NavigateGizmoInfo g_navigate_params[MPR_TOTAL] = { { .opname = "VIEW3D_OT_move", - .manipulator = "MANIPULATOR_WT_button_2d", + .gizmo = "GIZMO_WT_button_2d", .SHAPE_VARS(shape_pan), }, { .opname = "VIEW3D_OT_rotate", - .manipulator = "VIEW3D_WT_navigate_rotate", + .gizmo = "VIEW3D_WT_navigate_rotate", .shape = NULL, .shape_size = 0, }, { .opname = "VIEW3D_OT_zoom", - .manipulator = "MANIPULATOR_WT_button_2d", + .gizmo = "GIZMO_WT_button_2d", .SHAPE_VARS(shape_zoom), }, { .opname = "VIEW3D_OT_view_persportho", - .manipulator = "MANIPULATOR_WT_button_2d", + .gizmo = "GIZMO_WT_button_2d", .SHAPE_VARS(shape_persp), }, { .opname = "VIEW3D_OT_view_persportho", - .manipulator = "MANIPULATOR_WT_button_2d", + .gizmo = "GIZMO_WT_button_2d", .SHAPE_VARS(shape_ortho), }, { .opname = "VIEW3D_OT_view_camera", - .manipulator = "MANIPULATOR_WT_button_2d", + .gizmo = "GIZMO_WT_button_2d", .SHAPE_VARS(shape_camera), }, }; @@ -163,7 +163,7 @@ struct NavigateManipulatorInfo g_navigate_params[MPR_TOTAL] = { #undef SHAPE_VARS struct NavigateWidgetGroup { - wmManipulator *mpr_array[MPR_TOTAL]; + wmGizmo *mpr_array[MPR_TOTAL]; /* Store the view state to check for changes. */ struct { rcti rect_visible; @@ -176,12 +176,12 @@ struct NavigateWidgetGroup { int region_size[2]; }; -static bool WIDGETGROUP_navigate_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { View3D *v3d = CTX_wm_view3d(C); - if (((U.uiflag & USER_SHOW_MANIPULATOR_AXIS) == 0) || + if (((U.uiflag & USER_SHOW_GIZMO_AXIS) == 0) || (v3d->flag2 & V3D_RENDER_OVERRIDE) || - (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_NAVIGATE))) + (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE))) { return false; } @@ -189,7 +189,7 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmManipulatorGroupType } -static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct NavigateWidgetGroup *navgroup = MEM_callocN(sizeof(struct NavigateWidgetGroup), __func__); @@ -200,37 +200,37 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG wmOperatorType *ot_view_camera = WM_operatortype_find("VIEW3D_OT_view_camera", true); for (int i = 0; i < MPR_TOTAL; i++) { - const struct NavigateManipulatorInfo *info = &g_navigate_params[i]; - navgroup->mpr_array[i] = WM_manipulator_new(info->manipulator, mgroup, NULL); - wmManipulator *mpr = navgroup->mpr_array[i]; - mpr->flag |= WM_MANIPULATOR_GRAB_CURSOR | WM_MANIPULATOR_DRAW_MODAL; + const struct NavigateGizmoInfo *info = &g_navigate_params[i]; + navgroup->mpr_array[i] = WM_gizmo_new(info->gizmo, mgroup, NULL); + wmGizmo *mpr = navgroup->mpr_array[i]; + mpr->flag |= WM_GIZMO_GRAB_CURSOR | WM_GIZMO_DRAW_MODAL; mpr->color[3] = 0.2f; mpr->color_hi[3] = 0.4f; /* may be overwritten later */ - mpr->scale_basis = (MANIPULATOR_SIZE * MANIPULATOR_MINI_FAC) / 2; + mpr->scale_basis = (GIZMO_SIZE * GIZMO_MINI_FAC) / 2; if (info->shape != NULL) { PropertyRNA *prop = RNA_struct_find_property(mpr->ptr, "shape"); RNA_property_string_set_bytes( mpr->ptr, prop, (const char *)info->shape, info->shape_size); - RNA_enum_set(mpr->ptr, "draw_options", ED_MANIPULATOR_BUTTON_SHOW_OUTLINE); + RNA_enum_set(mpr->ptr, "draw_options", ED_GIZMO_BUTTON_SHOW_OUTLINE); } wmOperatorType *ot = WM_operatortype_find(info->opname, true); - WM_manipulator_operator_set(mpr, 0, ot, NULL); + WM_gizmo_operator_set(mpr, 0, ot, NULL); } { - wmManipulator *mpr = navgroup->mpr_array[MPR_CAMERA]; - WM_manipulator_operator_set(mpr, 0, ot_view_camera, NULL); + wmGizmo *mpr = navgroup->mpr_array[MPR_CAMERA]; + WM_gizmo_operator_set(mpr, 0, ot_view_camera, NULL); } /* Click only buttons (not modal). */ { int mpr_ids[] = {MPR_PERSP, MPR_ORTHO, MPR_CAMERA}; for (int i = 0; i < ARRAY_SIZE(mpr_ids); i++) { - wmManipulator *mpr = navgroup->mpr_array[mpr_ids[i]]; + wmGizmo *mpr = navgroup->mpr_array[mpr_ids[i]]; RNA_boolean_set(mpr->ptr, "show_drag", false); } } @@ -239,15 +239,15 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG { int mpr_ids[] = {MPR_MOVE, MPR_ROTATE, MPR_ZOOM}; for (int i = 0; i < ARRAY_SIZE(mpr_ids); i++) { - wmManipulator *mpr = navgroup->mpr_array[mpr_ids[i]]; - wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, 0); + wmGizmo *mpr = navgroup->mpr_array[mpr_ids[i]]; + wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, 0); RNA_boolean_set(&mpop->ptr, "use_mouse_init", false); } } { - wmManipulator *mpr = navgroup->mpr_array[MPR_ROTATE]; - mpr->scale_basis = MANIPULATOR_SIZE / 2; + wmGizmo *mpr = navgroup->mpr_array[MPR_ROTATE]; + mpr->scale_basis = GIZMO_SIZE / 2; char mapping[6] = { RV3D_VIEW_LEFT, RV3D_VIEW_RIGHT, @@ -258,7 +258,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG }; for (int part_index = 0; part_index < 6; part_index += 1) { - PointerRNA *ptr = WM_manipulator_operator_set(mpr, part_index + 1, ot_view_axis, NULL); + PointerRNA *ptr = WM_gizmo_operator_set(mpr, part_index + 1, ot_view_axis, NULL); RNA_enum_set(ptr, "type", mapping[part_index]); } @@ -269,7 +269,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG mgroup->customdata = navgroup; } -static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { struct NavigateWidgetGroup *navgroup = mgroup->customdata; ARegion *ar = CTX_wm_region(C); @@ -300,9 +300,9 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGr ((rv3d->viewlock & RV3D_LOCKED) == 0) && (navgroup->state.rv3d.is_camera == false)); const bool show_fixed_offset = navgroup->state.rv3d.is_camera; - const float icon_size = MANIPULATOR_SIZE; - const float icon_offset = (icon_size * 0.52f) * MANIPULATOR_OFFSET_FAC * UI_DPI_FAC; - const float icon_offset_mini = icon_size * MANIPULATOR_MINI_OFFSET_FAC * UI_DPI_FAC; + const float icon_size = GIZMO_SIZE; + const float icon_offset = (icon_size * 0.52f) * GIZMO_OFFSET_FAC * UI_DPI_FAC; + const float icon_offset_mini = icon_size * GIZMO_MINI_OFFSET_FAC * UI_DPI_FAC; const float co_rotate[2] = { rect_visible.xmax - icon_offset, rect_visible.ymax - icon_offset, @@ -312,11 +312,11 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGr rect_visible.ymax - icon_offset_mini * 0.75f, }; - wmManipulator *mpr; + wmGizmo *mpr; for (uint i = 0; i < ARRAY_SIZE(navgroup->mpr_array); i++) { mpr = navgroup->mpr_array[i]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, true); } /* RV3D_LOCKED or Camera: only show supported buttons. */ @@ -324,7 +324,7 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGr mpr = navgroup->mpr_array[MPR_ROTATE]; mpr->matrix_basis[3][0] = co_rotate[0]; mpr->matrix_basis[3][1] = co_rotate[1]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); } int icon_mini_slot = 0; @@ -332,36 +332,36 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGr mpr = navgroup->mpr_array[MPR_ZOOM]; mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++); mpr->matrix_basis[3][1] = co[1]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); mpr = navgroup->mpr_array[MPR_MOVE]; mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++); mpr->matrix_basis[3][1] = co[1]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); if ((rv3d->viewlock & RV3D_LOCKED) == 0) { mpr = navgroup->mpr_array[MPR_CAMERA]; mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++); mpr->matrix_basis[3][1] = co[1]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); if (navgroup->state.rv3d.is_camera == false) { mpr = navgroup->mpr_array[rv3d->is_persp ? MPR_PERSP : MPR_ORTHO]; mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++); mpr->matrix_basis[3][1] = co[1]; - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); } } } -void VIEW3D_WGT_navigate(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_navigate(wmGizmoGroupType *wgt) { wgt->name = "View3D Navigate"; wgt->idname = "VIEW3D_WGT_navigate"; - wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT | - WM_MANIPULATORGROUPTYPE_SCALE | - WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL); + wgt->flag |= (WM_GIZMOGROUPTYPE_PERSISTENT | + WM_GIZMOGROUPTYPE_SCALE | + WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL); wgt->poll = WIDGETGROUP_navigate_poll; wgt->setup = WIDGETGROUP_navigate_setup; diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 072f2ee4583..0136b235cc0 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -21,9 +21,9 @@ /** \file view3d_gizmo_navigate_type.c * \ingroup wm * - * \name Custom Orientation/Navigation Manipulator for the 3D View + * \name Custom Orientation/Navigation Gizmo for the 3D View * - * \brief Simple manipulator to axis and translate. + * \brief Simple gizmo to axis and translate. * * - scale_basis: used for the size. * - matrix_basis: used for the location. @@ -63,7 +63,7 @@ #define HANDLE_SIZE 0.33 static void axis_geom_draw( - const wmManipulator *mpr, const float color[4], const bool UNUSED(select)) + const wmGizmo *mpr, const float color[4], const bool UNUSED(select)) { GPU_line_width(mpr->line_width); @@ -199,7 +199,7 @@ static void axis_geom_draw( } static void axis3d_draw_intern( - const bContext *UNUSED(C), wmManipulator *mpr, + const bContext *UNUSED(C), wmGizmo *mpr, const bool select, const bool highlight) { const float *color = highlight ? mpr->color_hi : mpr->color; @@ -208,9 +208,9 @@ static void axis3d_draw_intern( unit_m4(matrix_unit); - WM_manipulator_calc_matrix_final_params( + WM_gizmo_calc_matrix_final_params( mpr, - &((struct WM_ManipulatorMatrixParams) { + &((struct WM_GizmoMatrixParams) { .matrix_offset = matrix_unit, }), matrix_final); @@ -223,10 +223,10 @@ static void axis3d_draw_intern( gpuPopMatrix(); } -static void manipulator_axis_draw(const bContext *C, wmManipulator *mpr) +static void gizmo_axis_draw(const bContext *C, wmGizmo *mpr) { - const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL; - const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0; + const bool is_modal = mpr->state & WM_GIZMO_STATE_MODAL; + const bool is_highlight = (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; (void)is_modal; @@ -235,8 +235,8 @@ static void manipulator_axis_draw(const bContext *C, wmManipulator *mpr) GPU_blend(false); } -static int manipulator_axis_test_select( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event) +static int gizmo_axis_test_select( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event) { float point_local[2] = {UNPACK2(event->mval)}; sub_v2_v2(point_local, mpr->matrix_basis[3]); @@ -288,7 +288,7 @@ static int manipulator_axis_test_select( return -1; } -static int manipulator_axis_cursor_get(wmManipulator *mpr) +static int gizmo_axis_cursor_get(wmGizmo *mpr) { if (mpr->highlight_part > 0) { return CURSOR_EDIT; @@ -296,15 +296,15 @@ static int manipulator_axis_cursor_get(wmManipulator *mpr) return BC_NSEW_SCROLLCURSOR; } -void VIEW3D_WT_navigate_rotate(wmManipulatorType *wt) +void VIEW3D_WT_navigate_rotate(wmGizmoType *wt) { /* identifiers */ wt->idname = "VIEW3D_WT_navigate_rotate"; /* api callbacks */ - wt->draw = manipulator_axis_draw; - wt->test_select = manipulator_axis_test_select; - wt->cursor_get = manipulator_axis_cursor_get; + wt->draw = gizmo_axis_draw; + wt->test_select = gizmo_axis_test_select; + wt->cursor_get = gizmo_axis_cursor_get; - wt->struct_size = sizeof(wmManipulator); + wt->struct_size = sizeof(wmGizmo); } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index c29b07e4147..ac6a984bea5 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -93,7 +93,7 @@ enum { #define PART_LINE 0xff /* -------------------------------------------------------------------- */ -/* Ruler Info (wmManipulatorGroup customdata) */ +/* Ruler Info (wmGizmoGroup customdata) */ enum { RULER_STATE_NORMAL = 0, @@ -123,7 +123,7 @@ typedef struct RulerInfo { /* Ruler Item (two or three points) */ typedef struct RulerItem { - wmManipulator mpr; + wmGizmo mpr; /* worldspace coords, middle being optional */ float co[3][3]; @@ -143,18 +143,18 @@ typedef struct RulerInteraction { /** \name Internal Ruler Utilities * \{ */ -static RulerItem *ruler_item_add(wmManipulatorGroup *mgroup) +static RulerItem *ruler_item_add(wmGizmoGroup *mgroup) { /* could pass this as an arg */ - const wmManipulatorType *wt_ruler = WM_manipulatortype_find("VIEW3D_WT_ruler_item", true); - RulerItem *ruler_item = (RulerItem *)WM_manipulator_new_ptr(wt_ruler, mgroup, NULL); - WM_manipulator_set_flag(&ruler_item->mpr, WM_MANIPULATOR_DRAW_MODAL, true); + const wmGizmoType *wt_ruler = WM_gizmotype_find("VIEW3D_WT_ruler_item", true); + RulerItem *ruler_item = (RulerItem *)WM_gizmo_new_ptr(wt_ruler, mgroup, NULL); + WM_gizmo_set_flag(&ruler_item->mpr, WM_GIZMO_DRAW_MODAL, true); return ruler_item; } -static void ruler_item_remove(bContext *C, wmManipulatorGroup *mgroup, RulerItem *ruler_item) +static void ruler_item_remove(bContext *C, wmGizmoGroup *mgroup, RulerItem *ruler_item) { - WM_manipulator_unlink(&mgroup->manipulators, mgroup->parent_mmap, &ruler_item->mpr, C); + WM_gizmo_unlink(&mgroup->gizmos, mgroup->parent_mmap, &ruler_item->mpr, C); } static void ruler_item_as_string(RulerItem *ruler_item, UnitSettings *unit, @@ -192,7 +192,7 @@ static void ruler_item_as_string(RulerItem *ruler_item, UnitSettings *unit, } static bool view3d_ruler_pick( - wmManipulatorGroup *mgroup, RulerItem *ruler_item, const float mval[2], + wmGizmoGroup *mgroup, RulerItem *ruler_item, const float mval[2], int *r_co_index) { RulerInfo *ruler_info = mgroup->customdata; @@ -380,7 +380,7 @@ static bool view3d_ruler_item_mousemove( * \{ */ #define RULER_ID "RulerData3D" -static bool view3d_ruler_to_gpencil(bContext *C, wmManipulatorGroup *mgroup) +static bool view3d_ruler_to_gpencil(bContext *C, wmGizmoGroup *mgroup) { // RulerInfo *ruler_info = mgroup->customdata; Main *bmain = CTX_data_main(C); @@ -419,7 +419,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, wmManipulatorGroup *mgroup) gpf = BKE_gpencil_layer_getframe(gpl, CFRA, true); BKE_gpencil_free_strokes(gpf); - for (ruler_item = mgroup->manipulators.first; ruler_item; ruler_item = (RulerItem *)ruler_item->mpr.next) { + for (ruler_item = mgroup->gizmos.first; ruler_item; ruler_item = (RulerItem *)ruler_item->mpr.next) { bGPDspoint *pt; int j; @@ -457,7 +457,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, wmManipulatorGroup *mgroup) return changed; } -static bool view3d_ruler_from_gpencil(const bContext *C, wmManipulatorGroup *mgroup) +static bool view3d_ruler_from_gpencil(const bContext *C, wmGizmoGroup *mgroup) { Scene *scene = CTX_data_scene(C); bool changed = false; @@ -503,10 +503,10 @@ static bool view3d_ruler_from_gpencil(const bContext *C, wmManipulatorGroup *mgr /** \} */ /* -------------------------------------------------------------------- */ -/** \name Ruler Item Manipulator Type +/** \name Ruler Item Gizmo Type * \{ */ -static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr) +static void gizmo_ruler_draw(const bContext *C, wmGizmo *mpr) { Scene *scene = CTX_data_scene(C); UnitSettings *unit = &scene->unit; @@ -536,7 +536,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr) UI_GetThemeColor3ubv(TH_TEXT, color_text); UI_GetThemeColor3ubv(TH_WIRE, color_wire); - const bool is_act = (mpr->flag & WM_MANIPULATOR_DRAW_HOVER); + const bool is_act = (mpr->flag & WM_GIZMO_DRAW_HOVER); float dir_ruler[2]; float co_ss[3][2]; int j; @@ -804,8 +804,8 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr) } } -static int manipulator_ruler_test_select( - bContext *UNUSED(C), wmManipulator *mpr, const wmEvent *event) +static int gizmo_ruler_test_select( + bContext *UNUSED(C), wmGizmo *mpr, const wmEvent *event) { RulerItem *ruler_item_pick = (RulerItem *)mpr; float mval_fl[2] = {UNPACK2(event->mval)}; @@ -825,9 +825,9 @@ static int manipulator_ruler_test_select( return -1; } -static int manipulator_ruler_modal( - bContext *C, wmManipulator *mpr, const wmEvent *event, - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo_ruler_modal( + bContext *C, wmGizmo *mpr, const wmEvent *event, + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { bool do_draw = false; int exit_code = OPERATOR_RUNNING_MODAL; @@ -859,10 +859,10 @@ static int manipulator_ruler_modal( return exit_code; } -static int manipulator_ruler_invoke( - bContext *C, wmManipulator *mpr, const wmEvent *event) +static int gizmo_ruler_invoke( + bContext *C, wmGizmo *mpr, const wmEvent *event) { - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + wmGizmoGroup *mgroup = mpr->parent_mgroup; RulerInfo *ruler_info = mgroup->customdata; RulerItem *ruler_item_pick = (RulerItem *)mpr; RulerInteraction *inter = MEM_callocN(sizeof(RulerInteraction), __func__); @@ -913,9 +913,9 @@ static int manipulator_ruler_invoke( return OPERATOR_RUNNING_MODAL; } -static void manipulator_ruler_exit(bContext *C, wmManipulator *mpr, const bool cancel) +static void gizmo_ruler_exit(bContext *C, wmGizmo *mpr, const bool cancel) { - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + wmGizmoGroup *mgroup = mpr->parent_mgroup; RulerInfo *ruler_info = mgroup->customdata; if (!cancel) { @@ -941,7 +941,7 @@ static void manipulator_ruler_exit(bContext *C, wmManipulator *mpr, const bool c } ruler_state_set(C, ruler_info, RULER_STATE_NORMAL); } - /* We could convert only the current manipulator, for now just re-generate. */ + /* We could convert only the current gizmo, for now just re-generate. */ view3d_ruler_to_gpencil(C, mgroup); } @@ -952,7 +952,7 @@ static void manipulator_ruler_exit(bContext *C, wmManipulator *mpr, const bool c ruler_state_set(C, ruler_info, RULER_STATE_NORMAL); } -static int manipulator_ruler_cursor_get(wmManipulator *mpr) +static int gizmo_ruler_cursor_get(wmGizmo *mpr) { if (mpr->highlight_part == PART_LINE) { return BC_CROSSCURSOR; @@ -960,18 +960,18 @@ static int manipulator_ruler_cursor_get(wmManipulator *mpr) return BC_NSEW_SCROLLCURSOR; } -void VIEW3D_WT_ruler_item(wmManipulatorType *wt) +void VIEW3D_WT_ruler_item(wmGizmoType *wt) { /* identifiers */ wt->idname = "VIEW3D_WT_ruler_item"; /* api callbacks */ - wt->draw = manipulator_ruler_draw; - wt->test_select = manipulator_ruler_test_select; - wt->modal = manipulator_ruler_modal; - wt->invoke = manipulator_ruler_invoke; - wt->exit = manipulator_ruler_exit; - wt->cursor_get = manipulator_ruler_cursor_get; + wt->draw = gizmo_ruler_draw; + wt->test_select = gizmo_ruler_test_select; + wt->modal = gizmo_ruler_modal; + wt->invoke = gizmo_ruler_invoke; + wt->exit = gizmo_ruler_exit; + wt->cursor_get = gizmo_ruler_cursor_get; wt->struct_size = sizeof(RulerItem); } @@ -979,22 +979,22 @@ void VIEW3D_WT_ruler_item(wmManipulatorType *wt) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Ruler Manipulator Group +/** \name Ruler Gizmo Group * \{ */ -static bool WIDGETGROUP_ruler_poll(const bContext *C, wmManipulatorGroupType *wgt) +static bool WIDGETGROUP_ruler_poll(const bContext *C, wmGizmoGroupType *wgt) { bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); if ((tref_rt == NULL) || - !STREQ(wgt->idname, tref_rt->manipulator_group)) + !STREQ(wgt->idname, tref_rt->gizmo_group)) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } return true; } -static void WIDGETGROUP_ruler_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_ruler_setup(const bContext *C, wmGizmoGroup *mgroup) { RulerInfo *ruler_info = MEM_callocN(sizeof(RulerInfo), __func__); @@ -1012,12 +1012,12 @@ static void WIDGETGROUP_ruler_setup(const bContext *C, wmManipulatorGroup *mgrou mgroup->customdata = ruler_info; } -void VIEW3D_WGT_ruler(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_ruler(wmGizmoGroupType *wgt) { wgt->name = "Ruler Widgets"; wgt->idname = view3d_wgt_ruler_id; - wgt->flag |= WM_MANIPULATORGROUPTYPE_SCALE | WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL; + wgt->flag |= WM_GIZMOGROUPTYPE_SCALE | WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; @@ -1036,7 +1036,7 @@ static bool view3d_ruler_poll(bContext *C) { bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); if ((tref_rt == NULL) || - !STREQ(view3d_wgt_ruler_id, tref_rt->manipulator_group) || + !STREQ(view3d_wgt_ruler_id, tref_rt->gizmo_group) || CTX_wm_region_view3d(C) == NULL) { return false; @@ -1050,8 +1050,8 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *UNUSED(op), const wm View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ar->regiondata; - wmManipulatorMap *mmap = ar->manipulator_map; - wmManipulatorGroup *mgroup = WM_manipulatormap_group_find(mmap, view3d_wgt_ruler_id); + wmGizmoMap *mmap = ar->gizmo_map; + wmGizmoGroup *mgroup = WM_gizmomap_group_find(mmap, view3d_wgt_ruler_id); const bool use_depth = (v3d->drawtype >= OB_SOLID); /* Create new line */ @@ -1059,9 +1059,9 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *UNUSED(op), const wm ruler_item = ruler_item_add(mgroup); /* This is a little weak, but there is no real good way to tweak directly. */ - WM_manipulator_highlight_set(mmap, &ruler_item->mpr); + WM_gizmo_highlight_set(mmap, &ruler_item->mpr); if (WM_operator_name_call( - C, "MANIPULATORGROUP_OT_manipulator_tweak", + C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_REGION_WIN, NULL) == OPERATOR_RUNNING_MODAL) { RulerInfo *ruler_info = mgroup->customdata; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index a2dda8d6403..c9277235d50 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -308,7 +308,7 @@ static void uiTemplatePaintModeSelection(uiLayout *layout, struct bContext *C) ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); - /* Manipulators aren't used in paint modes */ + /* Gizmos aren't used in paint modes */ if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) { /* masks aren't used for sculpt and particle painting */ PointerRNA meshptr; @@ -391,9 +391,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) else { /* Moved to popover and topbar. */ #if 0 - /* Transform widget / manipulators */ + /* Transform widget / gizmos */ row = uiLayoutRow(layout, true); - uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(row, &v3dptr, "show_gizmo", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); uiItemR(row, &sceneptr, "transform_orientation", 0, "", ICON_NONE); #endif } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index b74a40969a1..89dd254c130 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -51,8 +51,8 @@ struct Mesh; struct ViewLayer; struct wmOperatorType; struct wmKeyConfig; -struct wmManipulatorGroupType; -struct wmManipulatorType; +struct wmGizmoGroupType; +struct wmGizmoType; struct wmWindowManager; /* drawing flags: */ @@ -254,21 +254,21 @@ ARegion *view3d_has_tools_region(ScrArea *sa); extern const char *view3d_context_dir[]; /* doc access */ /* view3d_widgets.c */ -void VIEW3D_WGT_lamp_spot(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_lamp_area(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_lamp_target(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_camera(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_camera_view(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_force_field(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_empty_image(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_armature_spline(struct wmManipulatorGroupType *wgt); -void VIEW3D_WGT_navigate(struct wmManipulatorGroupType *wgt); - -void VIEW3D_WGT_ruler(struct wmManipulatorGroupType *wgt); -void VIEW3D_WT_ruler_item(struct wmManipulatorType *wt); +void VIEW3D_WGT_lamp_spot(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_lamp_area(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_lamp_target(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_camera(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_camera_view(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_force_field(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_empty_image(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_armature_spline(struct wmGizmoGroupType *wgt); +void VIEW3D_WGT_navigate(struct wmGizmoGroupType *wgt); + +void VIEW3D_WGT_ruler(struct wmGizmoGroupType *wgt); +void VIEW3D_WT_ruler_item(struct wmGizmoType *wt); void VIEW3D_OT_ruler_add(struct wmOperatorType *ot); -void VIEW3D_WT_navigate_rotate(struct wmManipulatorType *wt); +void VIEW3D_WT_navigate_rotate(struct wmGizmoType *wt); /* draw_volume.c */ void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob, diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index fb9cf917701..cf9b8afe8e5 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -541,7 +541,7 @@ void view3d_keymap(wmKeyConfig *keyconf) #else kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", ACCENTGRAVEKEY, KM_PRESS, KM_CTRL, 0); #endif - RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator_tool"); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_gizmo_tool"); transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 15c830e45d0..ad7b5d55ba5 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2215,7 +2215,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve t->launch_event = event ? WM_userdef_event_type_from_keymap_type(event->type) : -1; // XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0) - // For manipulator only, so assume LEFTMOUSE + // For gizmo only, so assume LEFTMOUSE if (t->launch_event == 0) { t->launch_event = LEFTMOUSE; } @@ -2267,10 +2267,10 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve /* keymap for shortcut header prints */ t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap); - /* Stupid code to have Ctrl-Click on manipulator work ok + /* Stupid code to have Ctrl-Click on gizmo work ok * * do this only for translation/rotation/resize due to only this - * moded are available from manipulator and doing such check could + * moded are available from gizmo and doing such check could * lead to keymap conflicts for other modes (see #31584) */ if (ELEM(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) { @@ -3590,7 +3590,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2])) t->con.applySize(t, NULL, NULL, mat); } - copy_m3_m3(t->mat, mat); // used in manipulator + copy_m3_m3(t->mat, mat); // used in gizmo headerResize(t, t->values, str); @@ -4302,7 +4302,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2])) mul_m3_m3m3(mat, smat, totmat); // TRANSFORM_FIX_ME - //copy_m3_m3(t->mat, mat); // used in manipulator + //copy_m3_m3(t->mat, mat); // used in gizmo #endif applyTrackballValue(t, axis1, axis2, phi); @@ -5453,7 +5453,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2])) t->con.applySize(t, NULL, NULL, mat); } - copy_m3_m3(t->mat, mat); // used in manipulator + copy_m3_m3(t->mat, mat); // used in gizmo headerBoneSize(t, size, str); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index b022d5a3058..2006bd830b4 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -491,7 +491,7 @@ typedef struct TransInfo { short persp; short around; char spacetype; /* spacetype where transforming is */ - char helpline; /* Choice of custom cursor with or without a help line from the manipulator to the mouse position. */ + char helpline; /* Choice of custom cursor with or without a help line from the gizmo to the mouse position. */ short obedit_type; /* Avoid looking inside TransDataContainer obedit. */ float vec[3]; /* translation, to show for widget */ @@ -710,9 +710,9 @@ void flushTransMasking(TransInfo *t); void flushTransPaintCurve(TransInfo *t); void restoreBones(TransDataContainer *tc); -/*********************** transform_manipulator.c ********** */ +/*********************** transform_gizmo.c ********** */ -#define MANIPULATOR_AXIS_LINE_WIDTH 2.0f +#define GIZMO_AXIS_LINE_WIDTH 2.0f /* return 0 when no gimbal for selection */ bool gimbal_axis(struct Object *ob, float gmat[3][3]); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 83b568b494c..a5706f4a003 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -6684,7 +6684,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) BKE_pose_where_is(t->depsgraph, t->scene, pose_ob); } - /* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */ + /* set BONE_TRANSFORM flags for autokey, gizmo draw might have changed them */ if (!canceled && (t->mode != TFM_DUMMY)) { count_set_pose_transflags(ob, t->mode, t->around, NULL); } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index c79c28a99da..e32bef72cf6 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1348,10 +1348,10 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve t->view = v3d; t->animtimer = (animscreen) ? animscreen->animtimer : NULL; - /* turn manipulator off during transform */ + /* turn gizmo off during transform */ if (t->flag & T_MODAL) { t->mpr_flag = v3d->mpr_flag; - v3d->mpr_flag = V3D_MANIPULATOR_HIDE; + v3d->mpr_flag = V3D_GIZMO_HIDE; } if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) { @@ -1688,7 +1688,7 @@ void postTrans(bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_VIEW3D) { View3D *v3d = t->sa->spacedata.first; - /* restore manipulator */ + /* restore gizmo */ if (t->flag & T_MODAL) { v3d->mpr_flag = t->mpr_flag; } diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c index 5d5d55de848..995faae8333 100644 --- a/source/blender/editors/transform/transform_gizmo_2d.c +++ b/source/blender/editors/transform/transform_gizmo_2d.c @@ -21,7 +21,7 @@ /** \file blender/editors/transform/transform_gizmo_2d.c * \ingroup edtransform * - * \name 2D Transform Manipulator + * \name 2D Transform Gizmo * * Used for UV/Image Editor */ @@ -64,18 +64,18 @@ enum { MAN2D_AXIS_LAST, }; -typedef struct ManipulatorGroup2D { - wmManipulator *translate_x, +typedef struct GizmoGroup2D { + wmGizmo *translate_x, *translate_y; - wmManipulator *cage; + wmGizmo *cage; /* Current origin in view space, used to update widget origin for possible view changes */ float origin[2]; float min[2]; float max[2]; -} ManipulatorGroup2D; +} GizmoGroup2D; /* **************** Utilities **************** */ @@ -83,16 +83,16 @@ typedef struct ManipulatorGroup2D { /* loop over axes */ #define MAN2D_ITER_AXES_BEGIN(axis, axis_idx) \ { \ - wmManipulator *axis; \ + wmGizmo *axis; \ int axis_idx; \ for (axis_idx = 0; axis_idx < MAN2D_AXIS_LAST; axis_idx++) { \ - axis = manipulator2d_get_axis_from_index(man, axis_idx); + axis = gizmo2d_get_axis_from_index(man, axis_idx); #define MAN2D_ITER_AXES_END \ } \ } ((void)0) -static wmManipulator *manipulator2d_get_axis_from_index(const ManipulatorGroup2D *man, const short axis_idx) +static wmGizmo *gizmo2d_get_axis_from_index(const GizmoGroup2D *man, const short axis_idx) { BLI_assert(IN_RANGE_INCL(axis_idx, (float)MAN2D_AXIS_TRANS_X, (float)MAN2D_AXIS_TRANS_Y)); @@ -106,7 +106,7 @@ static wmManipulator *manipulator2d_get_axis_from_index(const ManipulatorGroup2D return NULL; } -static void manipulator2d_get_axis_color(const int axis_idx, float *r_col, float *r_col_hi) +static void gizmo2d_get_axis_color(const int axis_idx, float *r_col, float *r_col_hi) { const float alpha = 0.6f; const float alpha_hi = 1.0f; @@ -128,29 +128,29 @@ static void manipulator2d_get_axis_color(const int axis_idx, float *r_col, float r_col_hi[3] *= alpha_hi; } -static ManipulatorGroup2D *manipulatorgroup2d_init(wmManipulatorGroup *mgroup) +static GizmoGroup2D *gizmogroup2d_init(wmGizmoGroup *mgroup) { - const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_2d", true); - const wmManipulatorType *wt_cage = WM_manipulatortype_find("MANIPULATOR_WT_cage_2d", true); + const wmGizmoType *wt_arrow = WM_gizmotype_find("GIZMO_WT_arrow_2d", true); + const wmGizmoType *wt_cage = WM_gizmotype_find("GIZMO_WT_cage_2d", true); - ManipulatorGroup2D *man = MEM_callocN(sizeof(ManipulatorGroup2D), __func__); + GizmoGroup2D *man = MEM_callocN(sizeof(GizmoGroup2D), __func__); - man->translate_x = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - man->translate_y = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); - man->cage = WM_manipulator_new_ptr(wt_cage, mgroup, NULL); + man->translate_x = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + man->translate_y = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); + man->cage = WM_gizmo_new_ptr(wt_cage, mgroup, NULL); RNA_enum_set(man->cage->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_ROTATE); + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE | + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | + ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE); return man; } /** - * Calculates origin in view space, use with #manipulator2d_origin_to_region. + * Calculates origin in view space, use with #gizmo2d_origin_to_region. */ -static void manipulator2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max) +static void gizmo2d_calc_bounds(const bContext *C, float *r_center, float *r_min, float *r_max) { SpaceImage *sima = CTX_wm_space_image(C); Image *ima = ED_space_image(sima); @@ -173,34 +173,34 @@ static void manipulator2d_calc_bounds(const bContext *C, float *r_center, float /** * Convert origin (or any other point) from view to region space. */ -BLI_INLINE void manipulator2d_origin_to_region(ARegion *ar, float *r_origin) +BLI_INLINE void gizmo2d_origin_to_region(ARegion *ar, float *r_origin) { UI_view2d_view_to_region_fl(&ar->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]); } /** - * Custom handler for manipulator widgets + * Custom handler for gizmo widgets */ -static int manipulator2d_modal( - bContext *C, wmManipulator *widget, const wmEvent *UNUSED(event), - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo2d_modal( + bContext *C, wmGizmo *widget, const wmEvent *UNUSED(event), + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { ARegion *ar = CTX_wm_region(C); float origin[3]; - manipulator2d_calc_bounds(C, origin, NULL, NULL); - manipulator2d_origin_to_region(ar, origin); - WM_manipulator_set_matrix_location(widget, origin); + gizmo2d_calc_bounds(C, origin, NULL, NULL); + gizmo2d_origin_to_region(ar, origin); + WM_gizmo_set_matrix_location(widget, origin); ED_region_tag_redraw(ar); return OPERATOR_RUNNING_MODAL; } -void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +void ED_widgetgroup_gizmo2d_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { wmOperatorType *ot_translate = WM_operatortype_find("TRANSFORM_OT_translate", true); - ManipulatorGroup2D *man = manipulatorgroup2d_init(mgroup); + GizmoGroup2D *man = gizmogroup2d_init(mgroup); mgroup->customdata = man; MAN2D_ITER_AXES_BEGIN(axis, axis_idx) @@ -208,21 +208,21 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator const float offset[3] = {0.0f, 0.2f}; float color[4], color_hi[4]; - manipulator2d_get_axis_color(axis_idx, color, color_hi); + gizmo2d_get_axis_color(axis_idx, color, color_hi); /* custom handler! */ - WM_manipulator_set_fn_custom_modal(axis, manipulator2d_modal); + WM_gizmo_set_fn_custom_modal(axis, gizmo2d_modal); /* set up widget data */ RNA_float_set(axis->ptr, "angle", -M_PI_2 * axis_idx); RNA_float_set(axis->ptr, "length", 0.8f); - WM_manipulator_set_matrix_offset_location(axis, offset); - WM_manipulator_set_line_width(axis, MANIPULATOR_AXIS_LINE_WIDTH); - WM_manipulator_set_scale(axis, U.manipulator_size); - WM_manipulator_set_color(axis, color); - WM_manipulator_set_color_highlight(axis, color_hi); + WM_gizmo_set_matrix_offset_location(axis, offset); + WM_gizmo_set_line_width(axis, GIZMO_AXIS_LINE_WIDTH); + WM_gizmo_set_scale(axis, U.gizmo_size); + WM_gizmo_set_color(axis, color); + WM_gizmo_set_color_highlight(axis, color_hi); /* assign operator */ - PointerRNA *ptr = WM_manipulator_operator_set(axis, 0, ot_translate, NULL); + PointerRNA *ptr = WM_gizmo_operator_set(axis, 0, ot_translate, NULL); bool constraint[3] = {0}; constraint[(axis_idx + 1) % 2] = 1; if (RNA_struct_find_property(ptr, "constraint_axis")) @@ -237,107 +237,107 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator PointerRNA *ptr; /* assign operator */ - ptr = WM_manipulator_operator_set(man->cage, 0, ot_translate, NULL); + ptr = WM_gizmo_operator_set(man->cage, 0, ot_translate, NULL); RNA_boolean_set(ptr, "release_confirm", 1); bool constraint_x[3] = {1, 0, 0}; bool constraint_y[3] = {0, 1, 0}; - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL); PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm"); PropertyRNA *prop_constraint_axis = RNA_struct_find_property(ptr, "constraint_axis"); RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X, ot_resize, NULL); RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_x); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y, ot_resize, NULL); RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_y); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y, ot_resize, NULL); RNA_property_boolean_set_array(ptr, prop_constraint_axis, constraint_y); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y, ot_resize, NULL); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y, ot_resize, NULL); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y, ot_resize, NULL); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ot_resize, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y, ot_resize, NULL); RNA_property_boolean_set(ptr, prop_release_confirm, true); - ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_ROTATE, ot_rotate, NULL); + ptr = WM_gizmo_operator_set(man->cage, ED_GIZMO_CAGE2D_PART_ROTATE, ot_rotate, NULL); RNA_property_boolean_set(ptr, prop_release_confirm, true); } } -void ED_widgetgroup_manipulator2d_refresh(const bContext *C, wmManipulatorGroup *mgroup) +void ED_widgetgroup_gizmo2d_refresh(const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorGroup2D *man = mgroup->customdata; + GizmoGroup2D *man = mgroup->customdata; float origin[3]; - manipulator2d_calc_bounds(C, origin, man->min, man->max); + gizmo2d_calc_bounds(C, origin, man->min, man->max); copy_v2_v2(man->origin, origin); bool show_cage = !equals_v2v2(man->min, man->max); if (show_cage) { - man->cage->flag &= ~WM_MANIPULATOR_HIDDEN; - man->translate_x->flag |= WM_MANIPULATOR_HIDDEN; - man->translate_y->flag |= WM_MANIPULATOR_HIDDEN; + man->cage->flag &= ~WM_GIZMO_HIDDEN; + man->translate_x->flag |= WM_GIZMO_HIDDEN; + man->translate_y->flag |= WM_GIZMO_HIDDEN; } else { - man->cage->flag |= WM_MANIPULATOR_HIDDEN; - man->translate_x->flag &= ~WM_MANIPULATOR_HIDDEN; - man->translate_y->flag &= ~WM_MANIPULATOR_HIDDEN; + man->cage->flag |= WM_GIZMO_HIDDEN; + man->translate_x->flag &= ~WM_GIZMO_HIDDEN; + man->translate_y->flag &= ~WM_GIZMO_HIDDEN; } if (show_cage) { - wmManipulatorOpElem *mpop; + wmGizmoOpElem *mpop; float mid[2]; const float *min = man->min; const float *max = man->max; mid_v2_v2v2(mid, min, max); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X); PropertyRNA *prop_center_override = RNA_struct_find_property(&mpop->ptr, "center_override"); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){max[0], mid[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){min[0], mid[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_Y); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_Y); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){mid[0], max[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_Y); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_Y); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){mid[0], min[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MIN_Y); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MIN_Y); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){max[0], max[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X_MAX_Y); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X_MAX_Y); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){max[0], min[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MIN_Y); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MIN_Y); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){min[0], max[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MAX_X_MAX_Y); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_SCALE_MAX_X_MAX_Y); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){min[0], min[1], 0.0f}); - mpop = WM_manipulator_operator_get(man->cage, ED_MANIPULATOR_CAGE2D_PART_ROTATE); + mpop = WM_gizmo_operator_get(man->cage, ED_GIZMO_CAGE2D_PART_ROTATE); RNA_property_float_set_array(&mpop->ptr, prop_center_override, (float[3]){mid[0], mid[1], 0.0f}); } } -void ED_widgetgroup_manipulator2d_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +void ED_widgetgroup_gizmo2d_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { ARegion *ar = CTX_wm_region(C); - ManipulatorGroup2D *man = mgroup->customdata; + GizmoGroup2D *man = mgroup->customdata; float origin[3] = {UNPACK2(man->origin), 0.0f}; float origin_aa[3] = {UNPACK2(man->origin), 0.0f}; - manipulator2d_origin_to_region(ar, origin); + gizmo2d_origin_to_region(ar, origin); MAN2D_ITER_AXES_BEGIN(axis, axis_idx) { - WM_manipulator_set_matrix_location(axis, origin); + WM_gizmo_set_matrix_location(axis, origin); } MAN2D_ITER_AXES_END; UI_view2d_view_to_region_m4(&ar->v2d, man->cage->matrix_space); - WM_manipulator_set_matrix_offset_location(man->cage, origin_aa); + WM_gizmo_set_matrix_offset_location(man->cage, origin_aa); man->cage->matrix_offset[0][0] = (man->max[0] - man->min[0]); man->cage->matrix_offset[1][1] = (man->max[1] - man->min[1]); } @@ -346,9 +346,9 @@ void ED_widgetgroup_manipulator2d_draw_prepare(const bContext *C, wmManipulatorG * - Called on every redraw, better to do a more simple poll and check for selection in _refresh * - UV editing only, could be expanded for other things. */ -bool ED_widgetgroup_manipulator2d_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt)) +bool ED_widgetgroup_gizmo2d_poll(const bContext *C, wmGizmoGroupType *UNUSED(wgt)) { - if ((U.manipulator_flag & USER_MANIPULATOR_DRAW) == 0) { + if ((U.gizmo_flag & USER_GIZMO_DRAW) == 0) { return false; } diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 1a30bd1cdcb..7d608c433c3 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -21,7 +21,7 @@ /** \file blender/editors/transform/transform_gizmo_3d.c * \ingroup edtransform * - * \name 3D Transform Manipulator + * \name 3D Transform Gizmo * * Used for 3D View */ @@ -106,7 +106,7 @@ #define MAN_SCALE_Z (1 << 10) #define MAN_SCALE_C (MAN_SCALE_X | MAN_SCALE_Y | MAN_SCALE_Z) -/* threshold for testing view aligned manipulator axis */ +/* threshold for testing view aligned gizmo axis */ struct { float min, max; } g_tw_axis_range[2] = { @@ -159,17 +159,17 @@ enum { MAN_AXES_SCALE, }; -typedef struct ManipulatorGroup { +typedef struct GizmoGroup { bool all_hidden; int twtype; - /* Users may change the twtype, detect changes to re-setup manipulator options. */ + /* Users may change the twtype, detect changes to re-setup gizmo options. */ int twtype_init; int twtype_prev; int use_twtype_refresh; - struct wmManipulator *manipulators[MAN_AXIS_LAST]; -} ManipulatorGroup; + struct wmGizmo *gizmos[MAN_AXIS_LAST]; +} GizmoGroup; /* -------------------------------------------------------------------- */ /** \name Utilities @@ -178,22 +178,22 @@ typedef struct ManipulatorGroup { /* loop over axes */ #define MAN_ITER_AXES_BEGIN(axis, axis_idx) \ { \ - wmManipulator *axis; \ + wmGizmo *axis; \ int axis_idx; \ for (axis_idx = 0; axis_idx < MAN_AXIS_LAST; axis_idx++) { \ - axis = manipulator_get_axis_from_index(man, axis_idx); + axis = gizmo_get_axis_from_index(man, axis_idx); #define MAN_ITER_AXES_END \ } \ } ((void)0) -static wmManipulator *manipulator_get_axis_from_index(const ManipulatorGroup *man, const short axis_idx) +static wmGizmo *gizmo_get_axis_from_index(const GizmoGroup *man, const short axis_idx) { BLI_assert(IN_RANGE_INCL(axis_idx, (float)MAN_AXIS_TRANS_X, (float)MAN_AXIS_LAST)); - return man->manipulators[axis_idx]; + return man->gizmos[axis_idx]; } -static short manipulator_get_axis_type(const int axis_idx) +static short gizmo_get_axis_type(const int axis_idx) { if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) { return MAN_AXES_TRANSLATE; @@ -208,7 +208,7 @@ static short manipulator_get_axis_type(const int axis_idx) return -1; } -static uint manipulator_orientation_axis(const int axis_idx, bool *r_is_plane) +static uint gizmo_orientation_axis(const int axis_idx, bool *r_is_plane) { switch (axis_idx) { case MAN_AXIS_TRANS_YZ: @@ -247,13 +247,13 @@ static uint manipulator_orientation_axis(const int axis_idx, bool *r_is_plane) return 3; } -static bool manipulator_is_axis_visible( +static bool gizmo_is_axis_visible( const RegionView3D *rv3d, const int twtype, const float idot[3], const int axis_type, const int axis_idx) { if ((axis_idx >= MAN_AXIS_RANGE_ROT_START && axis_idx < MAN_AXIS_RANGE_ROT_END) == 0) { bool is_plane = false; - const uint aidx_norm = manipulator_orientation_axis(axis_idx, &is_plane); + const uint aidx_norm = gizmo_orientation_axis(axis_idx, &is_plane); /* don't draw axis perpendicular to the view */ if (aidx_norm < 3) { float idot_axis = idot[aidx_norm]; @@ -330,7 +330,7 @@ static bool manipulator_is_axis_visible( return false; } -static void manipulator_get_axis_color( +static void gizmo_get_axis_color( const int axis_idx, const float idot[3], float r_col[4], float r_col_hi[4]) { @@ -346,7 +346,7 @@ static void manipulator_get_axis_color( } else { bool is_plane = false; - const int axis_idx_norm = manipulator_orientation_axis(axis_idx, &is_plane); + const int axis_idx_norm = gizmo_orientation_axis(axis_idx, &is_plane); /* get alpha fac based on axis angle, to fade axis out when hiding it because it points towards view */ if (axis_idx_norm < 3) { const float idot_min = g_tw_axis_range[is_plane].min; @@ -401,7 +401,7 @@ static void manipulator_get_axis_color( r_col_hi[3] = alpha_hi * alpha_fac; } -static void manipulator_get_axis_constraint(const int axis_idx, bool r_axis[3]) +static void gizmo_get_axis_constraint(const int axis_idx, bool r_axis[3]) { ARRAY_SET_ITEMS(r_axis, 0, 0, 0); @@ -596,7 +596,7 @@ bool gimbal_axis(Object *ob, float gmat[3][3]) /* centroid, boundbox, of selection */ /* returns total items selected */ -int ED_transform_calc_manipulator_stats( +int ED_transform_calc_gizmo_stats( const bContext *C, const struct TransformCalcParams *params, struct TransformBounds *tbounds) @@ -952,7 +952,7 @@ int ED_transform_calc_manipulator_stats( } else if (ob && (ob->mode & OB_MODE_POSE)) { bPoseChannel *pchan; - int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed + int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the gizmo mode, could be mixed bool ok = false; if ((pivot_point == V3D_AROUND_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) { @@ -1061,7 +1061,7 @@ int ED_transform_calc_manipulator_stats( return totsel; } -static void manipulator_get_idot(RegionView3D *rv3d, float r_idot[3]) +static void gizmo_get_idot(RegionView3D *rv3d, float r_idot[3]) { float view_vec[3], axis_vec[3]; ED_view3d_global_to_vector(rv3d, rv3d->twmat[3], view_vec); @@ -1071,7 +1071,7 @@ static void manipulator_get_idot(RegionView3D *rv3d, float r_idot[3]) } } -static void manipulator_prepare_mat( +static void gizmo_prepare_mat( const bContext *C, View3D *v3d, RegionView3D *rv3d, const struct TransformBounds *tbounds) { Scene *scene = CTX_data_scene(C); @@ -1108,9 +1108,9 @@ static void manipulator_prepare_mat( /** * Sets up \a r_start and \a r_len to define arrow line range. - * Needed to adjust line drawing for combined manipulator axis types. + * Needed to adjust line drawing for combined gizmo axis types. */ -static void manipulator_line_range(const int twtype, const short axis_type, float *r_start, float *r_len) +static void gizmo_line_range(const int twtype, const short axis_type, float *r_start, float *r_len) { const float ofs = 0.2f; @@ -1136,15 +1136,15 @@ static void manipulator_line_range(const int twtype, const short axis_type, floa *r_len -= *r_start; } -static void manipulator_xform_message_subscribe( - wmManipulatorGroup *mgroup, struct wmMsgBus *mbus, +static void gizmo_xform_message_subscribe( + wmGizmoGroup *mgroup, struct wmMsgBus *mbus, Scene *scene, bScreen *UNUSED(screen), ScrArea *UNUSED(sa), ARegion *ar, const void *type_fn) { /* Subscribe to view properties */ wmMsgSubscribeValue msg_sub_value_mpr_tag_refresh = { .owner = ar, .user_data = mgroup->parent_mmap, - .notify = WM_manipulator_do_msg_notify_tag_refresh, + .notify = WM_gizmo_do_msg_notify_tag_refresh, }; PointerRNA scene_ptr; @@ -1167,12 +1167,12 @@ static void manipulator_xform_message_subscribe( PointerRNA toolsettings_ptr; RNA_pointer_create(&scene->id, &RNA_ToolSettings, scene->toolsettings, &toolsettings_ptr); - if (type_fn == TRANSFORM_WGT_manipulator) { + if (type_fn == TRANSFORM_WGT_gizmo) { extern PropertyRNA rna_ToolSettings_transform_pivot_point; - extern PropertyRNA rna_ToolSettings_use_manipulator_mode; + extern PropertyRNA rna_ToolSettings_use_gizmo_mode; const PropertyRNA *props[] = { &rna_ToolSettings_transform_pivot_point, - &rna_ToolSettings_use_manipulator_mode, + &rna_ToolSettings_use_gizmo_mode, }; for (int i = 0; i < ARRAY_SIZE(props); i++) { WM_msg_subscribe_rna(mbus, &toolsettings_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__); @@ -1192,73 +1192,73 @@ static void manipulator_xform_message_subscribe( /* -------------------------------------------------------------------- */ -/** \name Transform Manipulator +/** \name Transform Gizmo * \{ */ -static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *mgroup) +static GizmoGroup *gizmogroup_init(wmGizmoGroup *mgroup) { - ManipulatorGroup *man; + GizmoGroup *man; - man = MEM_callocN(sizeof(ManipulatorGroup), "manipulator_data"); + man = MEM_callocN(sizeof(GizmoGroup), "gizmo_data"); - const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true); - const wmManipulatorType *wt_dial = WM_manipulatortype_find("MANIPULATOR_WT_dial_3d", true); - const wmManipulatorType *wt_prim = WM_manipulatortype_find("MANIPULATOR_WT_primitive_3d", true); + const wmGizmoType *wt_arrow = WM_gizmotype_find("GIZMO_WT_arrow_3d", true); + const wmGizmoType *wt_dial = WM_gizmotype_find("GIZMO_WT_dial_3d", true); + const wmGizmoType *wt_prim = WM_gizmotype_find("GIZMO_WT_primitive_3d", true); -#define MANIPULATOR_NEW_ARROW(v, draw_style) { \ - man->manipulators[v] = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); \ - RNA_enum_set(man->manipulators[v]->ptr, "draw_style", draw_style); \ +#define GIZMO_NEW_ARROW(v, draw_style) { \ + man->gizmos[v] = WM_gizmo_new_ptr(wt_arrow, mgroup, NULL); \ + RNA_enum_set(man->gizmos[v]->ptr, "draw_style", draw_style); \ } ((void)0) -#define MANIPULATOR_NEW_DIAL(v, draw_options) { \ - man->manipulators[v] = WM_manipulator_new_ptr(wt_dial, mgroup, NULL); \ - RNA_enum_set(man->manipulators[v]->ptr, "draw_options", draw_options); \ +#define GIZMO_NEW_DIAL(v, draw_options) { \ + man->gizmos[v] = WM_gizmo_new_ptr(wt_dial, mgroup, NULL); \ + RNA_enum_set(man->gizmos[v]->ptr, "draw_options", draw_options); \ } ((void)0) -#define MANIPULATOR_NEW_PRIM(v, draw_style) { \ - man->manipulators[v] = WM_manipulator_new_ptr(wt_prim, mgroup, NULL); \ - RNA_enum_set(man->manipulators[v]->ptr, "draw_style", draw_style); \ +#define GIZMO_NEW_PRIM(v, draw_style) { \ + man->gizmos[v] = WM_gizmo_new_ptr(wt_prim, mgroup, NULL); \ + RNA_enum_set(man->gizmos[v]->ptr, "draw_style", draw_style); \ } ((void)0) /* add/init widgets - order matters! */ - MANIPULATOR_NEW_DIAL(MAN_AXIS_ROT_T, ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL); + GIZMO_NEW_DIAL(MAN_AXIS_ROT_T, ED_GIZMO_DIAL_DRAW_FLAG_FILL); - MANIPULATOR_NEW_DIAL(MAN_AXIS_SCALE_C, ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP); + GIZMO_NEW_DIAL(MAN_AXIS_SCALE_C, ED_GIZMO_DIAL_DRAW_FLAG_NOP); - MANIPULATOR_NEW_ARROW(MAN_AXIS_SCALE_X, ED_MANIPULATOR_ARROW_STYLE_BOX); - MANIPULATOR_NEW_ARROW(MAN_AXIS_SCALE_Y, ED_MANIPULATOR_ARROW_STYLE_BOX); - MANIPULATOR_NEW_ARROW(MAN_AXIS_SCALE_Z, ED_MANIPULATOR_ARROW_STYLE_BOX); + GIZMO_NEW_ARROW(MAN_AXIS_SCALE_X, ED_GIZMO_ARROW_STYLE_BOX); + GIZMO_NEW_ARROW(MAN_AXIS_SCALE_Y, ED_GIZMO_ARROW_STYLE_BOX); + GIZMO_NEW_ARROW(MAN_AXIS_SCALE_Z, ED_GIZMO_ARROW_STYLE_BOX); - MANIPULATOR_NEW_PRIM(MAN_AXIS_SCALE_XY, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE); - MANIPULATOR_NEW_PRIM(MAN_AXIS_SCALE_YZ, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE); - MANIPULATOR_NEW_PRIM(MAN_AXIS_SCALE_ZX, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE); + GIZMO_NEW_PRIM(MAN_AXIS_SCALE_XY, ED_GIZMO_PRIMITIVE_STYLE_PLANE); + GIZMO_NEW_PRIM(MAN_AXIS_SCALE_YZ, ED_GIZMO_PRIMITIVE_STYLE_PLANE); + GIZMO_NEW_PRIM(MAN_AXIS_SCALE_ZX, ED_GIZMO_PRIMITIVE_STYLE_PLANE); - MANIPULATOR_NEW_DIAL(MAN_AXIS_ROT_X, ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP); - MANIPULATOR_NEW_DIAL(MAN_AXIS_ROT_Y, ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP); - MANIPULATOR_NEW_DIAL(MAN_AXIS_ROT_Z, ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP); + GIZMO_NEW_DIAL(MAN_AXIS_ROT_X, ED_GIZMO_DIAL_DRAW_FLAG_CLIP); + GIZMO_NEW_DIAL(MAN_AXIS_ROT_Y, ED_GIZMO_DIAL_DRAW_FLAG_CLIP); + GIZMO_NEW_DIAL(MAN_AXIS_ROT_Z, ED_GIZMO_DIAL_DRAW_FLAG_CLIP); /* init screen aligned widget last here, looks better, behaves better */ - MANIPULATOR_NEW_DIAL(MAN_AXIS_ROT_C, ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP); + GIZMO_NEW_DIAL(MAN_AXIS_ROT_C, ED_GIZMO_DIAL_DRAW_FLAG_NOP); - MANIPULATOR_NEW_DIAL(MAN_AXIS_TRANS_C, ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP); + GIZMO_NEW_DIAL(MAN_AXIS_TRANS_C, ED_GIZMO_DIAL_DRAW_FLAG_NOP); - MANIPULATOR_NEW_ARROW(MAN_AXIS_TRANS_X, ED_MANIPULATOR_ARROW_STYLE_NORMAL); - MANIPULATOR_NEW_ARROW(MAN_AXIS_TRANS_Y, ED_MANIPULATOR_ARROW_STYLE_NORMAL); - MANIPULATOR_NEW_ARROW(MAN_AXIS_TRANS_Z, ED_MANIPULATOR_ARROW_STYLE_NORMAL); + GIZMO_NEW_ARROW(MAN_AXIS_TRANS_X, ED_GIZMO_ARROW_STYLE_NORMAL); + GIZMO_NEW_ARROW(MAN_AXIS_TRANS_Y, ED_GIZMO_ARROW_STYLE_NORMAL); + GIZMO_NEW_ARROW(MAN_AXIS_TRANS_Z, ED_GIZMO_ARROW_STYLE_NORMAL); - MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_XY, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE); - MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_YZ, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE); - MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_ZX, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE); + GIZMO_NEW_PRIM(MAN_AXIS_TRANS_XY, ED_GIZMO_PRIMITIVE_STYLE_PLANE); + GIZMO_NEW_PRIM(MAN_AXIS_TRANS_YZ, ED_GIZMO_PRIMITIVE_STYLE_PLANE); + GIZMO_NEW_PRIM(MAN_AXIS_TRANS_ZX, ED_GIZMO_PRIMITIVE_STYLE_PLANE); - man->manipulators[MAN_AXIS_ROT_T]->flag |= WM_MANIPULATOR_SELECT_BACKGROUND; + man->gizmos[MAN_AXIS_ROT_T]->flag |= WM_GIZMO_SELECT_BACKGROUND; return man; } /** - * Custom handler for manipulator widgets + * Custom handler for gizmo widgets */ -static int manipulator_modal( - bContext *C, wmManipulator *widget, const wmEvent *event, - eWM_ManipulatorTweak UNUSED(tweak_flag)) +static int gizmo_modal( + bContext *C, wmGizmo *widget, const wmEvent *event, + eWM_GizmoFlagTweak UNUSED(tweak_flag)) { /* Avoid unnecessary updates, partially address: T55458. */ if (ELEM(event->type, TIMER, INBETWEEN_MOUSEMOVE)) { @@ -1272,13 +1272,13 @@ static int manipulator_modal( struct TransformBounds tbounds; - if (ED_transform_calc_manipulator_stats( + if (ED_transform_calc_gizmo_stats( C, &(struct TransformCalcParams){ .use_only_center = true, }, &tbounds)) { - manipulator_prepare_mat(C, v3d, rv3d, &tbounds); - WM_manipulator_set_matrix_location(widget, rv3d->twmat[3]); + gizmo_prepare_mat(C, v3d, rv3d, &tbounds); + WM_gizmo_set_matrix_location(widget, rv3d->twmat[3]); } ED_region_tag_redraw(ar); @@ -1286,22 +1286,22 @@ static int manipulator_modal( return OPERATOR_RUNNING_MODAL; } -static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgroup) +static void gizmogroup_init_properties_from_twtype(wmGizmoGroup *mgroup) { struct { wmOperatorType *translate, *rotate, *trackball, *resize; } ot_store = {NULL}; - ManipulatorGroup *man = mgroup->customdata; + GizmoGroup *man = mgroup->customdata; MAN_ITER_AXES_BEGIN(axis, axis_idx) { - const short axis_type = manipulator_get_axis_type(axis_idx); + const short axis_type = gizmo_get_axis_type(axis_idx); bool constraint_axis[3] = {1, 0, 0}; PointerRNA *ptr; - manipulator_get_axis_constraint(axis_idx, constraint_axis); + gizmo_get_axis_constraint(axis_idx, constraint_axis); /* custom handler! */ - WM_manipulator_set_fn_custom_modal(axis, manipulator_modal); + WM_gizmo_set_fn_custom_modal(axis, gizmo_modal); switch (axis_idx) { case MAN_AXIS_TRANS_X: @@ -1313,19 +1313,19 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) { int draw_options = 0; if ((man->twtype & (SCE_MANIP_ROTATE | SCE_MANIP_SCALE)) == 0) { - draw_options |= ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM; + draw_options |= ED_GIZMO_ARROW_DRAW_FLAG_STEM; } RNA_enum_set(axis->ptr, "draw_options", draw_options); } - WM_manipulator_set_line_width(axis, MANIPULATOR_AXIS_LINE_WIDTH); + WM_gizmo_set_line_width(axis, GIZMO_AXIS_LINE_WIDTH); break; case MAN_AXIS_ROT_X: case MAN_AXIS_ROT_Y: case MAN_AXIS_ROT_Z: /* increased line width for better display */ - WM_manipulator_set_line_width(axis, MANIPULATOR_AXIS_LINE_WIDTH + 1.0f); - WM_manipulator_set_flag(axis, WM_MANIPULATOR_DRAW_VALUE, true); + WM_gizmo_set_line_width(axis, GIZMO_AXIS_LINE_WIDTH + 1.0f); + WM_gizmo_set_flag(axis, WM_GIZMO_DRAW_VALUE, true); break; case MAN_AXIS_TRANS_XY: case MAN_AXIS_TRANS_YZ: @@ -1336,25 +1336,25 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr { const float ofs_ax = 7.0f; const float ofs[3] = {ofs_ax, ofs_ax, 0.0f}; - WM_manipulator_set_scale(axis, 0.07f); - WM_manipulator_set_matrix_offset_location(axis, ofs); - WM_manipulator_set_flag(axis, WM_MANIPULATOR_DRAW_OFFSET_SCALE, true); + WM_gizmo_set_scale(axis, 0.07f); + WM_gizmo_set_matrix_offset_location(axis, ofs); + WM_gizmo_set_flag(axis, WM_GIZMO_DRAW_OFFSET_SCALE, true); break; } case MAN_AXIS_TRANS_C: case MAN_AXIS_ROT_C: case MAN_AXIS_SCALE_C: case MAN_AXIS_ROT_T: - WM_manipulator_set_line_width(axis, MANIPULATOR_AXIS_LINE_WIDTH); + WM_gizmo_set_line_width(axis, GIZMO_AXIS_LINE_WIDTH); if (axis_idx == MAN_AXIS_ROT_T) { - WM_manipulator_set_flag(axis, WM_MANIPULATOR_DRAW_HOVER, true); + WM_gizmo_set_flag(axis, WM_GIZMO_DRAW_HOVER, true); } else if (axis_idx == MAN_AXIS_ROT_C) { - WM_manipulator_set_flag(axis, WM_MANIPULATOR_DRAW_VALUE, true); - WM_manipulator_set_scale(axis, 1.2f); + WM_gizmo_set_flag(axis, WM_GIZMO_DRAW_VALUE, true); + WM_gizmo_set_scale(axis, 1.2f); } else { - WM_manipulator_set_scale(axis, 0.2f); + WM_gizmo_set_scale(axis, 0.2f); } break; } @@ -1364,7 +1364,7 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr if (ot_store.translate == NULL) { ot_store.translate = WM_operatortype_find("TRANSFORM_OT_translate", true); } - ptr = WM_manipulator_operator_set(axis, 0, ot_store.translate, NULL); + ptr = WM_gizmo_operator_set(axis, 0, ot_store.translate, NULL); break; case MAN_AXES_ROTATE: { @@ -1381,7 +1381,7 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr } ot_rotate = ot_store.rotate; } - ptr = WM_manipulator_operator_set(axis, 0, ot_rotate, NULL); + ptr = WM_gizmo_operator_set(axis, 0, ot_rotate, NULL); break; } case MAN_AXES_SCALE: @@ -1389,7 +1389,7 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr if (ot_store.resize == NULL) { ot_store.resize = WM_operatortype_find("TRANSFORM_OT_resize", true); } - ptr = WM_manipulator_operator_set(axis, 0, ot_store.resize, NULL); + ptr = WM_gizmo_operator_set(axis, 0, ot_store.resize, NULL); break; } } @@ -1406,9 +1406,9 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr MAN_ITER_AXES_END; } -static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_gizmo_setup(const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorGroup *man = manipulatorgroup_init(mgroup); + GizmoGroup *man = gizmogroup_init(mgroup); mgroup->customdata = man; @@ -1418,7 +1418,7 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup const bToolRef *tref = sa->runtime.tool; if (tref == NULL || STREQ(tref->idname, "Transform")) { - /* Setup all manipulators, they can be toggled via 'ToolSettings.manipulator_flag' */ + /* Setup all gizmos, they can be toggled via 'ToolSettings.gizmo_flag' */ man->twtype = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE; man->use_twtype_refresh = true; } @@ -1436,12 +1436,12 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup } /* *** set properties for axes *** */ - manipulatorgroup_init_properties_from_twtype(mgroup); + gizmogroup_init_properties_from_twtype(mgroup); } -static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorGroup *man = mgroup->customdata; + GizmoGroup *man = mgroup->customdata; ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = sa->spacedata.first; @@ -1450,16 +1450,16 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou if (man->use_twtype_refresh) { Scene *scene = CTX_data_scene(C); - man->twtype = scene->toolsettings->manipulator_flag & man->twtype_init; + man->twtype = scene->toolsettings->gizmo_flag & man->twtype_init; if (man->twtype != man->twtype_prev) { man->twtype_prev = man->twtype; - manipulatorgroup_init_properties_from_twtype(mgroup); + gizmogroup_init_properties_from_twtype(mgroup); } } /* skip, we don't draw anything anyway */ if ((man->all_hidden = - (ED_transform_calc_manipulator_stats( + (ED_transform_calc_gizmo_stats( C, &(struct TransformCalcParams){ .use_only_center = true, }, &tbounds) == 0))) @@ -1467,16 +1467,16 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou return; } - manipulator_prepare_mat(C, v3d, rv3d, &tbounds); + gizmo_prepare_mat(C, v3d, rv3d, &tbounds); /* *** set properties for axes *** */ MAN_ITER_AXES_BEGIN(axis, axis_idx) { - const short axis_type = manipulator_get_axis_type(axis_idx); - const int aidx_norm = manipulator_orientation_axis(axis_idx, NULL); + const short axis_type = gizmo_get_axis_type(axis_idx); + const int aidx_norm = gizmo_orientation_axis(axis_idx, NULL); - WM_manipulator_set_matrix_location(axis, rv3d->twmat[3]); + WM_gizmo_set_matrix_location(axis, rv3d->twmat[3]); switch (axis_idx) { case MAN_AXIS_TRANS_X: @@ -1489,9 +1489,9 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou float start_co[3] = {0.0f, 0.0f, 0.0f}; float len; - manipulator_line_range(man->twtype, axis_type, &start_co[2], &len); + gizmo_line_range(man->twtype, axis_type, &start_co[2], &len); - WM_manipulator_set_matrix_rotation_from_z_axis(axis, rv3d->twmat[aidx_norm]); + WM_gizmo_set_matrix_rotation_from_z_axis(axis, rv3d->twmat[aidx_norm]); RNA_float_set(axis->ptr, "length", len); if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) { @@ -1500,14 +1500,14 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou start_co[2] += 0.215f; } } - WM_manipulator_set_matrix_offset_location(axis, start_co); - WM_manipulator_set_flag(axis, WM_MANIPULATOR_DRAW_OFFSET_SCALE, true); + WM_gizmo_set_matrix_offset_location(axis, start_co); + WM_gizmo_set_flag(axis, WM_GIZMO_DRAW_OFFSET_SCALE, true); break; } case MAN_AXIS_ROT_X: case MAN_AXIS_ROT_Y: case MAN_AXIS_ROT_Z: - WM_manipulator_set_matrix_rotation_from_z_axis(axis, rv3d->twmat[aidx_norm]); + WM_gizmo_set_matrix_rotation_from_z_axis(axis, rv3d->twmat[aidx_norm]); break; case MAN_AXIS_TRANS_XY: case MAN_AXIS_TRANS_YZ: @@ -1518,7 +1518,7 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou { const float *y_axis = rv3d->twmat[aidx_norm - 1 < 0 ? 2 : aidx_norm - 1]; const float *z_axis = rv3d->twmat[aidx_norm]; - WM_manipulator_set_matrix_rotation_from_yz_axis(axis, y_axis, z_axis); + WM_gizmo_set_matrix_rotation_from_yz_axis(axis, y_axis, z_axis); break; } } @@ -1526,134 +1526,134 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou MAN_ITER_AXES_END; } -static void WIDGETGROUP_manipulator_message_subscribe( - const bContext *C, wmManipulatorGroup *mgroup, struct wmMsgBus *mbus) +static void WIDGETGROUP_gizmo_message_subscribe( + const bContext *C, wmGizmoGroup *mgroup, struct wmMsgBus *mbus) { Scene *scene = CTX_data_scene(C); bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - manipulator_xform_message_subscribe(mgroup, mbus, scene, screen, sa, ar, TRANSFORM_WGT_manipulator); + gizmo_xform_message_subscribe(mgroup, mbus, scene, screen, sa, ar, TRANSFORM_WGT_gizmo); } -static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { - ManipulatorGroup *man = mgroup->customdata; + GizmoGroup *man = mgroup->customdata; // ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); // View3D *v3d = sa->spacedata.first; RegionView3D *rv3d = ar->regiondata; float idot[3]; - /* when looking through a selected camera, the manipulator can be at the + /* when looking through a selected camera, the gizmo can be at the * exact same position as the view, skip so we don't break selection */ if (man->all_hidden || fabsf(ED_view3d_pixel_size(rv3d, rv3d->twmat[3])) < 1e-6f) { MAN_ITER_AXES_BEGIN(axis, axis_idx) { - WM_manipulator_set_flag(axis, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(axis, WM_GIZMO_HIDDEN, true); } MAN_ITER_AXES_END; return; } - manipulator_get_idot(rv3d, idot); + gizmo_get_idot(rv3d, idot); /* *** set properties for axes *** */ MAN_ITER_AXES_BEGIN(axis, axis_idx) { - const short axis_type = manipulator_get_axis_type(axis_idx); + const short axis_type = gizmo_get_axis_type(axis_idx); /* XXX maybe unset _HIDDEN flag on redraw? */ - if (manipulator_is_axis_visible(rv3d, man->twtype, idot, axis_type, axis_idx)) { - WM_manipulator_set_flag(axis, WM_MANIPULATOR_HIDDEN, false); + if (gizmo_is_axis_visible(rv3d, man->twtype, idot, axis_type, axis_idx)) { + WM_gizmo_set_flag(axis, WM_GIZMO_HIDDEN, false); } else { - WM_manipulator_set_flag(axis, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(axis, WM_GIZMO_HIDDEN, true); continue; } float color[4], color_hi[4]; - manipulator_get_axis_color(axis_idx, idot, color, color_hi); - WM_manipulator_set_color(axis, color); - WM_manipulator_set_color_highlight(axis, color_hi); + gizmo_get_axis_color(axis_idx, idot, color, color_hi); + WM_gizmo_set_color(axis, color); + WM_gizmo_set_color_highlight(axis, color_hi); switch (axis_idx) { case MAN_AXIS_TRANS_C: case MAN_AXIS_ROT_C: case MAN_AXIS_SCALE_C: case MAN_AXIS_ROT_T: - WM_manipulator_set_matrix_rotation_from_z_axis(axis, rv3d->viewinv[2]); + WM_gizmo_set_matrix_rotation_from_z_axis(axis, rv3d->viewinv[2]); break; } } MAN_ITER_AXES_END; } -static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt) +static bool WIDGETGROUP_gizmo_poll(const struct bContext *C, struct wmGizmoGroupType *wgt) { /* it's a given we only use this in 3D view */ bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); if ((tref_rt == NULL) || - !STREQ(wgt->idname, tref_rt->manipulator_group)) + !STREQ(wgt->idname, tref_rt->gizmo_group)) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } View3D *v3d = CTX_wm_view3d(C); - if (v3d->mpr_flag & (V3D_MANIPULATOR_HIDE | V3D_MANIPULATOR_HIDE_TOOL)) { + if (v3d->mpr_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) { return false; } return true; } -void TRANSFORM_WGT_manipulator(wmManipulatorGroupType *wgt) +void TRANSFORM_WGT_gizmo(wmGizmoGroupType *wgt) { - wgt->name = "Transform Manipulator"; - wgt->idname = "TRANSFORM_WGT_manipulator"; + wgt->name = "Transform Gizmo"; + wgt->idname = "TRANSFORM_WGT_gizmo"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_3D; + wgt->flag |= WM_GIZMOGROUPTYPE_3D; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; - wgt->poll = WIDGETGROUP_manipulator_poll; - wgt->setup = WIDGETGROUP_manipulator_setup; - wgt->refresh = WIDGETGROUP_manipulator_refresh; - wgt->message_subscribe = WIDGETGROUP_manipulator_message_subscribe; - wgt->draw_prepare = WIDGETGROUP_manipulator_draw_prepare; + wgt->poll = WIDGETGROUP_gizmo_poll; + wgt->setup = WIDGETGROUP_gizmo_setup; + wgt->refresh = WIDGETGROUP_gizmo_refresh; + wgt->message_subscribe = WIDGETGROUP_gizmo_message_subscribe; + wgt->draw_prepare = WIDGETGROUP_gizmo_draw_prepare; } /** \} */ /* -------------------------------------------------------------------- */ -/** \name Scale Cage Manipulator +/** \name Scale Cage Gizmo * \{ */ struct XFormCageWidgetGroup { - wmManipulator *manipulator; + wmGizmo *gizmo; }; -static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmManipulatorGroupType *wgt) +static bool WIDGETGROUP_xform_cage_poll(const bContext *C, wmGizmoGroupType *wgt) { bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); - if (!STREQ(wgt->idname, tref_rt->manipulator_group)) { - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + if (!STREQ(wgt->idname, tref_rt->gizmo_group)) { + WM_gizmo_group_type_unlink_delayed_ptr(wgt); return false; } return true; } -static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup) +static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmGizmoGroup *mgroup) { struct XFormCageWidgetGroup *xmgroup = MEM_mallocN(sizeof(struct XFormCageWidgetGroup), __func__); - const wmManipulatorType *wt_cage = WM_manipulatortype_find("MANIPULATOR_WT_cage_3d", true); - xmgroup->manipulator = WM_manipulator_new_ptr(wt_cage, mgroup, NULL); - wmManipulator *mpr = xmgroup->manipulator; + const wmGizmoType *wt_cage = WM_gizmotype_find("GIZMO_WT_cage_3d", true); + xmgroup->gizmo = WM_gizmo_new_ptr(wt_cage, mgroup, NULL); + wmGizmo *mpr = xmgroup->gizmo; RNA_enum_set(mpr->ptr, "transform", - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE | - ED_MANIPULATOR_CAGE2D_XFORM_FLAG_TRANSLATE); + ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE | + ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE); mpr->color[0] = 1; mpr->color_hi[0] = 1; @@ -1668,12 +1668,12 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulato PropertyRNA *prop_release_confirm = NULL; PropertyRNA *prop_constraint_axis = NULL; - int i = ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z; + int i = ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z; for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { for (int z = 0; z < 3; z++) { bool constraint[3] = {x != 1, y != 1, z != 1}; - ptr = WM_manipulator_operator_set(mpr, i, ot_resize, NULL); + ptr = WM_gizmo_operator_set(mpr, i, ot_resize, NULL); if (prop_release_confirm == NULL) { prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm"); prop_constraint_axis = RNA_struct_find_property(ptr, "constraint_axis"); @@ -1687,7 +1687,7 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulato } } -static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *mgroup) { ScrArea *sa = CTX_wm_area(C); View3D *v3d = sa->spacedata.first; @@ -1695,23 +1695,23 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup RegionView3D *rv3d = ar->regiondata; struct XFormCageWidgetGroup *xmgroup = mgroup->customdata; - wmManipulator *mpr = xmgroup->manipulator; + wmGizmo *mpr = xmgroup->gizmo; struct TransformBounds tbounds; - if ((ED_transform_calc_manipulator_stats( + if ((ED_transform_calc_gizmo_stats( C, &(struct TransformCalcParams) { .use_local_axis = true, }, &tbounds) == 0) || equals_v3v3(rv3d->tw_axis_min, rv3d->tw_axis_max)) { - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, true); } else { - manipulator_prepare_mat(C, v3d, rv3d, &tbounds); + gizmo_prepare_mat(C, v3d, rv3d, &tbounds); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false); - WM_manipulator_set_flag(mpr, WM_MANIPULATOR_GRAB_CURSOR, true); + WM_gizmo_set_flag(mpr, WM_GIZMO_HIDDEN, false); + WM_gizmo_set_flag(mpr, WM_GIZMO_GRAB_CURSOR, true); float dims[3]; sub_v3_v3v3(dims, rv3d->tw_axis_max, rv3d->tw_axis_min); @@ -1725,14 +1725,14 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup PropertyRNA *prop_center_override = NULL; float center[3]; float center_global[3]; - int i = ED_MANIPULATOR_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z; + int i = ED_GIZMO_CAGE3D_PART_SCALE_MIN_X_MIN_Y_MIN_Z; for (int x = 0; x < 3; x++) { center[0] = (float)(1 - x) * dims[0]; for (int y = 0; y < 3; y++) { center[1] = (float)(1 - y) * dims[1]; for (int z = 0; z < 3; z++) { center[2] = (float)(1 - z) * dims[2]; - struct wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, i); + struct wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, i); if (prop_center_override == NULL) { prop_center_override = RNA_struct_find_property(&mpop->ptr, "center_override"); } @@ -1746,19 +1746,19 @@ static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmManipulatorGroup } static void WIDGETGROUP_xform_cage_message_subscribe( - const bContext *C, wmManipulatorGroup *mgroup, struct wmMsgBus *mbus) + const bContext *C, wmGizmoGroup *mgroup, struct wmMsgBus *mbus) { Scene *scene = CTX_data_scene(C); bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - manipulator_xform_message_subscribe(mgroup, mbus, scene, screen, sa, ar, VIEW3D_WGT_xform_cage); + gizmo_xform_message_subscribe(mgroup, mbus, scene, screen, sa, ar, VIEW3D_WGT_xform_cage); } -static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) +static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup *mgroup) { struct XFormCageWidgetGroup *xmgroup = mgroup->customdata; - wmManipulator *mpr = xmgroup->manipulator; + wmGizmo *mpr = xmgroup->gizmo; ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); @@ -1770,12 +1770,12 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmManipulator } } -void VIEW3D_WGT_xform_cage(wmManipulatorGroupType *wgt) +void VIEW3D_WGT_xform_cage(wmGizmoGroupType *wgt) { wgt->name = "Transform Cage"; wgt->idname = "VIEW3D_WGT_xform_cage"; - wgt->flag |= WM_MANIPULATORGROUPTYPE_3D; + wgt->flag |= WM_GIZMOGROUPTYPE_3D; wgt->mmap_params.spaceid = SPACE_VIEW3D; wgt->mmap_params.regionid = RGN_TYPE_WINDOW; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index eedf6f50a1f..c9a97c8530c 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -493,7 +493,7 @@ static int transform_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* add temp handler */ WM_event_add_modal_handler(C, op); - op->flag |= OP_IS_MODAL_GRAB_CURSOR; // XXX maybe we want this with the manipulator only? + op->flag |= OP_IS_MODAL_GRAB_CURSOR; // XXX maybe we want this with the gizmo only? /* Use when modal input has some transformation to begin with. */ { @@ -585,7 +585,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } if (flags & P_CENTER) { - /* For manipulators that define their own center. */ + /* For gizmos that define their own center. */ prop = RNA_def_property(ot->srna, "center_override", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 3); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index e6ad7835b24..0c4c0a00f1a 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1237,7 +1237,7 @@ typedef struct ToolSettings { short autoik_chainlen; /* runtime only */ /* SCE_MPR_LOC/SCAL */ - char manipulator_flag; + char gizmo_flag; /* Grease Pencil */ char gpencil_flags; /* flags/options for how the tool works */ @@ -2010,7 +2010,7 @@ typedef enum eImagePaintMode { #define EDGE_MODE_TAG_BEVEL 4 #define EDGE_MODE_TAG_FREESTYLE 5 -/* ToolSettings.manipulator_flag */ +/* ToolSettings.gizmo_flag */ #define SCE_MANIP_TRANSLATE 1 #define SCE_MANIP_ROTATE 2 #define SCE_MANIP_SCALE 4 diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 3ee6bc38644..3815f01abeb 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -347,7 +347,7 @@ typedef struct ARegion { ListBase handlers; /* wmEventHandler */ ListBase panels_category; /* Panel categories runtime */ - struct wmManipulatorMap *manipulator_map; /* manipulator-map of this region */ + struct wmGizmoMap *gizmo_map; /* gizmo-map of this region */ struct wmTimer *regiontimer; /* blend in/out */ struct wmDrawBuffer *draw_buffer; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 5b8f6fcb73f..cdfcf5598e8 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -195,12 +195,12 @@ typedef struct ThemeUI { /* Axis Colors */ char xaxis[4], yaxis[4], zaxis[4]; - /* Manipulator Colors. */ - char manipulator_hi[4]; - char manipulator_primary[4]; - char manipulator_secondary[4]; - char manipulator_a[4]; - char manipulator_b[4]; + /* Gizmo Colors. */ + char gizmo_hi[4]; + char gizmo_primary[4]; + char gizmo_secondary[4]; + char gizmo_a[4]; + char gizmo_b[4]; char pad2[4]; } ThemeUI; @@ -572,7 +572,7 @@ typedef struct UserDef { short gp_settings; /* eGP_UserdefSettings */ short tb_leftmouse, tb_rightmouse; struct SolidLight light[3]; - short manipulator_flag, manipulator_size; + short gizmo_flag, gizmo_size; short pad6[3]; short textimeout, texcollectrate; short dragthreshold; @@ -751,7 +751,7 @@ typedef enum eUserpref_UI_Flag { USER_ORBIT_SELECTION = (1 << 14), USER_DEPTH_NAVIGATE = (1 << 15), USER_HIDE_DOT = (1 << 16), - USER_SHOW_MANIPULATOR_AXIS = (1 << 17), + USER_SHOW_GIZMO_AXIS = (1 << 17), USER_SHOW_VIEWPORTNAME = (1 << 18), USER_CAM_LOCK_NO_PARENT = (1 << 19), USER_ZOOM_TO_MOUSEPOS = (1 << 20), @@ -875,7 +875,7 @@ typedef enum eGP_UserdefSettings { } eGP_UserdefSettings; enum { - USER_MANIPULATOR_DRAW = (1 << 0), + USER_GIZMO_DRAW = (1 << 0), }; /* Color Picker Types. diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index e0ab3a744f1..40551701627 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -90,7 +90,7 @@ typedef struct RegionView3D { struct wmTimer *smooth_timer; - /* transform manipulator matrix */ + /* transform gizmo matrix */ float twmat[4][4]; /* min/max dot product on twmat xyz axis. */ float tw_axis_min[3], tw_axis_max[3]; @@ -236,7 +236,7 @@ typedef struct View3D { short gridsubdiv; /* Number of subdivisions in the grid between each highlighted grid line */ char gridflag; - /* transform manipulator info */ + /* transform gizmo info */ char _pad5[2], mpr_flag; short flag3; @@ -453,11 +453,11 @@ enum { /* View3d.mpr_flag (also) */ enum { - /** All manipulators. */ - V3D_MANIPULATOR_HIDE = (1 << 0), - V3D_MANIPULATOR_HIDE_NAVIGATE = (1 << 1), - V3D_MANIPULATOR_HIDE_CONTEXT = (1 << 2), - V3D_MANIPULATOR_HIDE_TOOL = (1 << 3), + /** All gizmos. */ + V3D_GIZMO_HIDE = (1 << 0), + V3D_GIZMO_HIDE_NAVIGATE = (1 << 1), + V3D_GIZMO_HIDE_CONTEXT = (1 << 2), + V3D_GIZMO_HIDE_TOOL = (1 << 3), }; #define RV3D_CAMZOOM_MIN -30 diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index 2b0f74a54ee..3eb40bfa523 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -60,7 +60,7 @@ typedef struct bToolRef_Runtime { /** One of these 3 must be defined. */ char keymap[64]; - char manipulator_group[64]; + char gizmo_group[64]; char data_block[64]; /** Use to infer primary operator to use when setting accelerator keys. */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index fe8868235c4..f66c80beeab 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -374,8 +374,8 @@ extern StructRNA RNA_LineStyleThicknessModifier_Tangent; extern StructRNA RNA_LockedTrackConstraint; extern StructRNA RNA_Macro; extern StructRNA RNA_MagicTexture; -extern StructRNA RNA_Manipulator; -extern StructRNA RNA_ManipulatorProperties; +extern StructRNA RNA_Gizmo; +extern StructRNA RNA_GizmoProperties; extern StructRNA RNA_MarbleTexture; extern StructRNA RNA_MaskModifier; extern StructRNA RNA_MaskSequence; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index bb24452d67a..393ebc15d3e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3443,7 +3443,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_userdef.c", NULL, RNA_def_userdef}, {"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont}, {"rna_wm.c", "rna_wm_api.c", RNA_def_wm}, - {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_manipulator}, + {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo}, {"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace}, {"rna_world.c", NULL, RNA_def_world}, {"rna_movieclip.c", NULL, RNA_def_movieclip}, diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 6e07976a3c6..7b07faf8ee7 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -121,11 +121,11 @@ static PointerRNA rna_Context_region_data_get(PointerRNA *ptr) return PointerRNA_NULL; } -static PointerRNA rna_Context_manipulator_group_get(PointerRNA *ptr) +static PointerRNA rna_Context_gizmo_group_get(PointerRNA *ptr) { bContext *C = (bContext *)ptr->data; PointerRNA newptr; - RNA_pointer_create(NULL, &RNA_ManipulatorGroup, CTX_wm_manipulator_group(C), &newptr); + RNA_pointer_create(NULL, &RNA_GizmoGroup, CTX_wm_gizmo_group(C), &newptr); return newptr; } @@ -256,10 +256,10 @@ void RNA_def_context(BlenderRNA *brna) RNA_def_property_struct_type(prop, "RegionView3D"); RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL); - prop = RNA_def_property(srna, "manipulator_group", PROP_POINTER, PROP_NONE); + prop = RNA_def_property(srna, "gizmo_group", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_struct_type(prop, "ManipulatorGroup"); - RNA_def_property_pointer_funcs(prop, "rna_Context_manipulator_group_get", NULL, NULL, NULL); + RNA_def_property_struct_type(prop, "GizmoGroup"); + RNA_def_property_pointer_funcs(prop, "rna_Context_gizmo_group_get", NULL, NULL, NULL); /* Data */ prop = RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index a57777f0630..83d173de6c8 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -193,7 +193,7 @@ void RNA_def_ui(struct BlenderRNA *brna); void RNA_def_userdef(struct BlenderRNA *brna); void RNA_def_vfont(struct BlenderRNA *brna); void RNA_def_wm(struct BlenderRNA *brna); -void RNA_def_wm_manipulator(struct BlenderRNA *brna); +void RNA_def_wm_gizmo(struct BlenderRNA *brna); void RNA_def_workspace(struct BlenderRNA *brna); void RNA_def_world(struct BlenderRNA *brna); void RNA_def_movieclip(struct BlenderRNA *brna); @@ -308,8 +308,8 @@ void RNA_api_image(struct StructRNA *srna); void RNA_api_lattice(struct StructRNA *srna); void RNA_api_operator(struct StructRNA *srna); void RNA_api_macro(struct StructRNA *srna); -void RNA_api_manipulator(struct StructRNA *srna); -void RNA_api_manipulatorgroup(struct StructRNA *srna); +void RNA_api_gizmo(struct StructRNA *srna); +void RNA_api_gizmogroup(struct StructRNA *srna); void RNA_api_keyconfig(struct StructRNA *srna); void RNA_api_keyconfigs(struct StructRNA *srna); void RNA_api_keyingset(struct StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 690c6d8e4c1..54b553e94ae 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -413,7 +413,7 @@ const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static const EnumPropertyItem rna_enum_manipulator_items[] = { +static const EnumPropertyItem rna_enum_gizmo_items[] = { {SCE_MANIP_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, {SCE_MANIP_ROTATE, "ROTATE", 0, "Rotate", ""}, {SCE_MANIP_SCALE, "SCALE", 0, "Scale", ""}, @@ -647,11 +647,11 @@ static void rna_GPencilBrush_name_set(PointerRNA *ptr, const char *value) /* ----------------- end of Grease pencil drawing brushes ------------*/ -static void rna_ToolSettings_manipulator_flag_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +static void rna_ToolSettings_gizmo_flag_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { ToolSettings *ts = scene->toolsettings; - if ((ts->manipulator_flag & (SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE)) == 0) { - ts->manipulator_flag |= SCE_MANIP_TRANSLATE; + if ((ts->gizmo_flag & (SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE)) == 0) { + ts->gizmo_flag |= SCE_MANIP_TRANSLATE; } } @@ -2690,12 +2690,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_ORTHO, 0); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ - prop = RNA_def_property(srna, "use_manipulator_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "manipulator_flag"); - RNA_def_property_enum_items(prop, rna_enum_manipulator_items); + prop = RNA_def_property(srna, "use_gizmo_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "gizmo_flag"); + RNA_def_property_enum_items(prop, rna_enum_gizmo_items); RNA_def_property_flag(prop, PROP_ENUM_FLAG); RNA_def_property_ui_text(prop, "Gizmo Mode", ""); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ToolSettings_manipulator_flag_update"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ToolSettings_gizmo_flag_update"); /* Grease Pencil */ prop = RNA_def_property(srna, "use_gpencil_continuous_drawing", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4bdf7a09585..5c30cdb2b07 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2562,7 +2562,7 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE); - RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like manipulators and outlines"); + RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like gizmos and outlines"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE); @@ -2939,24 +2939,24 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_ORTHO, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE); + prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_GIZMO_HIDE); RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_manipulator_navigate", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE_NAVIGATE); + prop = RNA_def_property(srna, "show_gizmo_navigate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_GIZMO_HIDE_NAVIGATE); RNA_def_property_ui_text(prop, "Navigate Gizmo", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_manipulator_context", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE_CONTEXT); - RNA_def_property_ui_text(prop, "Context Gizmo", "Context sensitive manipulators for the active item"); + prop = RNA_def_property(srna, "show_gizmo_context", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_GIZMO_HIDE_CONTEXT); + RNA_def_property_ui_text(prop, "Context Gizmo", "Context sensitive gizmos for the active item"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_manipulator_tool", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_MANIPULATOR_HIDE_TOOL); - RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool manipulator"); + prop = RNA_def_property(srna, "show_gizmo_tool", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "mpr_flag", V3D_GIZMO_HIDE_TOOL); + RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index d8941e303d9..5557afdb33f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1201,33 +1201,33 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Z Axis", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - /* Generic manipulator colors. */ - prop = RNA_def_property(srna, "manipulator_hi", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "manipulator_hi"); + /* Generic gizmo colors. */ + prop = RNA_def_property(srna, "gizmo_hi", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "gizmo_hi"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Gizmo Highlight", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "manipulator_primary", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "manipulator_primary"); + prop = RNA_def_property(srna, "gizmo_primary", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "gizmo_primary"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Gizmo Primary", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "manipulator_secondary", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "manipulator_secondary"); + prop = RNA_def_property(srna, "gizmo_secondary", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "gizmo_secondary"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Gizmo Secondary", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "manipulator_a", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "manipulator_a"); + prop = RNA_def_property(srna, "gizmo_a", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "gizmo_a"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Gizmo A", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "manipulator_b", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, NULL, "manipulator_b"); + prop = RNA_def_property(srna, "gizmo_b", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "gizmo_b"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Gizmo B", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); @@ -3705,7 +3705,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) /* mini axis */ static const EnumPropertyItem mini_axis_type_items[] = { {0, "MINIMAL", 0, "Simple Axis", ""}, - {USER_SHOW_MANIPULATOR_AXIS, "MANIPULATOR", 0, "Interactive Navigation", ""}, + {USER_SHOW_GIZMO_AXIS, "GIZMO", 0, "Interactive Navigation", ""}, {0, NULL, 0, NULL, NULL} }; @@ -3739,16 +3739,16 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation step for numerical pad keys (2 4 6 8)"); /* 3D transform widget */ - prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "manipulator_flag", USER_MANIPULATOR_DRAW); - RNA_def_property_ui_text(prop, "Manipulators", "Use transform manipulators by default"); + prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gizmo_flag", USER_GIZMO_DRAW); + RNA_def_property_ui_text(prop, "Gizmos", "Use transform gizmos by default"); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_PIXEL); - RNA_def_property_int_sdna(prop, NULL, "manipulator_size"); + prop = RNA_def_property(srna, "gizmo_size", PROP_INT, PROP_PIXEL); + RNA_def_property_int_sdna(prop, NULL, "gizmo_size"); RNA_def_property_range(prop, 10, 200); RNA_def_property_int_default(prop, 75); - RNA_def_property_ui_text(prop, "Manipulator Size", "Diameter of the manipulator"); + RNA_def_property_ui_text(prop, "Gizmo Size", "Diameter of the gizmo"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index f398c4143ae..7abcf0f0667 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -118,33 +118,33 @@ static void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer) } -static wmManipulatorGroupType *wm_manipulatorgrouptype_find_for_add_remove(ReportList *reports, const char *idname) +static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *reports, const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, true); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, true); if (wgt == NULL) { - BKE_reportf(reports, RPT_ERROR, "Manipulator group type '%s' not found!", idname); + BKE_reportf(reports, RPT_ERROR, "Gizmo group type '%s' not found!", idname); return NULL; } - if (wgt->flag & WM_MANIPULATORGROUPTYPE_PERSISTENT) { - BKE_reportf(reports, RPT_ERROR, "Manipulator group '%s' has 'PERSISTENT' option set!", idname); + if (wgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) { + BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' has 'PERSISTENT' option set!", idname); return NULL; } return wgt; } -static void rna_manipulator_group_type_add(ReportList *reports, const char *idname) +static void rna_gizmo_group_type_add(ReportList *reports, const char *idname) { - wmManipulatorGroupType *wgt = wm_manipulatorgrouptype_find_for_add_remove(reports, idname); + wmGizmoGroupType *wgt = wm_gizmogrouptype_find_for_add_remove(reports, idname); if (wgt != NULL) { - WM_manipulator_group_type_add_ptr(wgt); + WM_gizmo_group_type_add_ptr(wgt); } } -static void rna_manipulator_group_type_remove(Main *bmain, ReportList *reports, const char *idname) +static void rna_gizmo_group_type_remove(Main *bmain, ReportList *reports, const char *idname) { - wmManipulatorGroupType *wgt = wm_manipulatorgrouptype_find_for_add_remove(reports, idname); + wmGizmoGroupType *wgt = wm_gizmogrouptype_find_for_add_remove(reports, idname); if (wgt != NULL) { - WM_manipulator_group_type_remove_ptr(bmain, wgt); + WM_gizmo_group_type_remove_ptr(bmain, wgt); } } @@ -516,16 +516,16 @@ void RNA_api_wm(StructRNA *srna) parm = RNA_def_pointer(func, "timer", "Timer", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - func = RNA_def_function(srna, "manipulator_group_type_add", "rna_manipulator_group_type_add"); + func = RNA_def_function(srna, "gizmo_group_type_add", "rna_gizmo_group_type_add"); RNA_def_function_ui_description(func, "Activate an existing widget group (when the persistent option isn't set)"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS); - parm = RNA_def_string(func, "identifier", NULL, 0, "", "Manipulator group type name"); + parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - func = RNA_def_function(srna, "manipulator_group_type_remove", "rna_manipulator_group_type_remove"); + func = RNA_def_function(srna, "gizmo_group_type_remove", "rna_gizmo_group_type_remove"); RNA_def_function_ui_description(func, "De-activate a widget group (when the persistent option isn't set)"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_MAIN | FUNC_USE_REPORTS); - parm = RNA_def_string(func, "identifier", NULL, 0, "", "Manipulator group type name"); + parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* Progress bar interface */ diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c index c2c4c95b83f..754ef4575a4 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo.c @@ -71,38 +71,38 @@ /* -------------------------------------------------------------------- */ -/** \name Manipulator API +/** \name Gizmo API * \{ */ #ifdef WITH_PYTHON -static void rna_manipulator_draw_cb( - const struct bContext *C, struct wmManipulator *mpr) +static void rna_gizmo_draw_cb( + const struct bContext *C, struct wmGizmo *mpr) { - extern FunctionRNA rna_Manipulator_draw_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_draw_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "draw"); */ - func = &rna_Manipulator_draw_func; + func = &rna_Gizmo_draw_func; RNA_parameter_list_create(&list, &mpr_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); mgroup->type->ext.call((bContext *)C, &mpr_ptr, func, &list); RNA_parameter_list_free(&list); } -static void rna_manipulator_draw_select_cb( - const struct bContext *C, struct wmManipulator *mpr, int select_id) +static void rna_gizmo_draw_select_cb( + const struct bContext *C, struct wmGizmo *mpr, int select_id) { - extern FunctionRNA rna_Manipulator_draw_select_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_draw_select_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "draw_select"); */ - func = &rna_Manipulator_draw_select_func; + func = &rna_Gizmo_draw_select_func; RNA_parameter_list_create(&list, &mpr_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "select_id", &select_id); @@ -110,17 +110,17 @@ static void rna_manipulator_draw_select_cb( RNA_parameter_list_free(&list); } -static int rna_manipulator_test_select_cb( - struct bContext *C, struct wmManipulator *mpr, const struct wmEvent *event) +static int rna_gizmo_test_select_cb( + struct bContext *C, struct wmGizmo *mpr, const struct wmEvent *event) { - extern FunctionRNA rna_Manipulator_test_select_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_test_select_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "test_select"); */ - func = &rna_Manipulator_test_select_func; + func = &rna_Gizmo_test_select_func; RNA_parameter_list_create(&list, &mpr_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "event", &event); @@ -134,19 +134,19 @@ static int rna_manipulator_test_select_cb( return intersect_id; } -static int rna_manipulator_modal_cb( - struct bContext *C, struct wmManipulator *mpr, const struct wmEvent *event, - eWM_ManipulatorTweak tweak_flag) +static int rna_gizmo_modal_cb( + struct bContext *C, struct wmGizmo *mpr, const struct wmEvent *event, + eWM_GizmoFlagTweak tweak_flag) { - extern FunctionRNA rna_Manipulator_modal_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_modal_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; const int tweak_flag_int = tweak_flag; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "modal"); */ - func = &rna_Manipulator_modal_func; + func = &rna_Gizmo_modal_func; RNA_parameter_list_create(&list, &mpr_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "event", &event); @@ -161,34 +161,34 @@ static int rna_manipulator_modal_cb( return ret_enum; } -static void rna_manipulator_setup_cb( - struct wmManipulator *mpr) +static void rna_gizmo_setup_cb( + struct wmGizmo *mpr) { - extern FunctionRNA rna_Manipulator_setup_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_setup_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "setup"); */ - func = &rna_Manipulator_setup_func; + func = &rna_Gizmo_setup_func; RNA_parameter_list_create(&list, &mpr_ptr, func); mgroup->type->ext.call((bContext *)NULL, &mpr_ptr, func, &list); RNA_parameter_list_free(&list); } -static int rna_manipulator_invoke_cb( - struct bContext *C, struct wmManipulator *mpr, const struct wmEvent *event) +static int rna_gizmo_invoke_cb( + struct bContext *C, struct wmGizmo *mpr, const struct wmEvent *event) { - extern FunctionRNA rna_Manipulator_invoke_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_invoke_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "invoke"); */ - func = &rna_Manipulator_invoke_func; + func = &rna_Gizmo_invoke_func; RNA_parameter_list_create(&list, &mpr_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); RNA_parameter_set_lookup(&list, "event", &event); @@ -202,17 +202,17 @@ static int rna_manipulator_invoke_cb( return ret_enum; } -static void rna_manipulator_exit_cb( - struct bContext *C, struct wmManipulator *mpr, bool cancel) +static void rna_gizmo_exit_cb( + struct bContext *C, struct wmGizmo *mpr, bool cancel) { - extern FunctionRNA rna_Manipulator_exit_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_exit_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "exit"); */ - func = &rna_Manipulator_exit_func; + func = &rna_Gizmo_exit_func; RNA_parameter_list_create(&list, &mpr_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); { @@ -223,17 +223,17 @@ static void rna_manipulator_exit_cb( RNA_parameter_list_free(&list); } -static void rna_manipulator_select_refresh_cb( - struct wmManipulator *mpr) +static void rna_gizmo_select_refresh_cb( + struct wmGizmo *mpr) { - extern FunctionRNA rna_Manipulator_select_refresh_func; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; + extern FunctionRNA rna_Gizmo_select_refresh_func; + wmGizmoGroup *mgroup = mpr->parent_mgroup; PointerRNA mpr_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr); /* RNA_struct_find_function(&mpr_ptr, "select_refresh"); */ - func = &rna_Manipulator_select_refresh_func; + func = &rna_Gizmo_select_refresh_func; RNA_parameter_list_create(&list, &mpr_ptr, func); mgroup->type->ext.call((bContext *)NULL, &mpr_ptr, func, &list); RNA_parameter_list_free(&list); @@ -242,9 +242,9 @@ static void rna_manipulator_select_refresh_cb( #endif /* WITH_PYTHON */ /* just to work around 'const char *' warning and to ensure this is a python op */ -static void rna_Manipulator_bl_idname_set(PointerRNA *ptr, const char *value) +static void rna_Gizmo_bl_idname_set(PointerRNA *ptr, const char *value) { - wmManipulator *data = ptr->data; + wmGizmo *data = ptr->data; char *str = (char *)data->type->idname; if (!str[0]) { BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ @@ -254,7 +254,7 @@ static void rna_Manipulator_bl_idname_set(PointerRNA *ptr, const char *value) } } -static wmManipulator *rna_ManipulatorProperties_find_operator(PointerRNA *ptr) +static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr) { #if 0 wmWindowManager *wm = ptr->id.data; @@ -265,13 +265,13 @@ static wmManipulator *rna_ManipulatorProperties_find_operator(PointerRNA *ptr) IDProperty *properties = ptr->data; for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->manipulator_map) { - wmManipulatorMap *mmap = ar->manipulator_map; - for (wmManipulatorGroup *mgroup = WM_manipulatormap_group_list(mmap)->first; + if (ar->gizmo_map) { + wmGizmoMap *mmap = ar->gizmo_map; + for (wmGizmoGroup *mgroup = WM_gizmomap_group_list(mmap)->first; mgroup; mgroup = mgroup->next) { - for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { + for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { if (mpr->properties == properties) { return mpr; } @@ -284,9 +284,9 @@ static wmManipulator *rna_ManipulatorProperties_find_operator(PointerRNA *ptr) return NULL; } -static StructRNA *rna_ManipulatorProperties_refine(PointerRNA *ptr) +static StructRNA *rna_GizmoProperties_refine(PointerRNA *ptr) { - wmManipulator *mpr = rna_ManipulatorProperties_find_operator(ptr); + wmGizmo *mpr = rna_GizmoProperties_find_operator(ptr); if (mpr) return mpr->type->srna; @@ -294,143 +294,143 @@ static StructRNA *rna_ManipulatorProperties_refine(PointerRNA *ptr) return ptr->type; } -static IDProperty *rna_ManipulatorProperties_idprops(PointerRNA *ptr, bool create) +static IDProperty *rna_GizmoProperties_idprops(PointerRNA *ptr, bool create) { if (create && !ptr->data) { IDPropertyTemplate val = {0}; - ptr->data = IDP_New(IDP_GROUP, &val, "RNA_ManipulatorProperties group"); + ptr->data = IDP_New(IDP_GROUP, &val, "RNA_GizmoProperties group"); } return ptr->data; } -static PointerRNA rna_Manipulator_properties_get(PointerRNA *ptr) +static PointerRNA rna_Gizmo_properties_get(PointerRNA *ptr) { - wmManipulator *mpr = ptr->data; + wmGizmo *mpr = ptr->data; return rna_pointer_inherit_refine(ptr, mpr->type->srna, mpr->properties); } -/* wmManipulator.float */ -#define RNA_MANIPULATOR_GENERIC_FLOAT_RW_DEF(func_id, member_id) \ -static float rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ +/* wmGizmo.float */ +#define RNA_GIZMO_GENERIC_FLOAT_RW_DEF(func_id, member_id) \ +static float rna_Gizmo_##func_id##_get(PointerRNA *ptr) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ return mpr->member_id; \ } \ -static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, float value) \ +static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, float value) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ mpr->member_id = value; \ } -#define RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(func_id, member_id, index) \ -static float rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ +#define RNA_GIZMO_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(func_id, member_id, index) \ +static float rna_Gizmo_##func_id##_get(PointerRNA *ptr) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ return mpr->member_id[index]; \ } \ -static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, float value) \ +static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, float value) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ mpr->member_id[index] = value; \ } -/* wmManipulator.float[len] */ -#define RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(func_id, member_id, len) \ -static void rna_Manipulator_##func_id##_get(PointerRNA *ptr, float value[len]) \ +/* wmGizmo.float[len] */ +#define RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(func_id, member_id, len) \ +static void rna_Gizmo_##func_id##_get(PointerRNA *ptr, float value[len]) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ memcpy(value, mpr->member_id, sizeof(float[len])); \ } \ -static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, const float value[len]) \ +static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, const float value[len]) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ memcpy(mpr->member_id, value, sizeof(float[len])); \ } -/* wmManipulator.flag */ -#define RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(func_id, member_id, flag_value) \ -static bool rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ +/* wmGizmo.flag */ +#define RNA_GIZMO_GENERIC_FLAG_RW_DEF(func_id, member_id, flag_value) \ +static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ return (mpr->member_id & flag_value) != 0; \ } \ -static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, bool value) \ +static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, bool value) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ SET_FLAG_FROM_TEST(mpr->member_id, value, flag_value); \ } -/* wmManipulator.flag (negative) */ -#define RNA_MANIPULATOR_GENERIC_FLAG_NEG_RW_DEF(func_id, member_id, flag_value) \ -static bool rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ +/* wmGizmo.flag (negative) */ +#define RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(func_id, member_id, flag_value) \ +static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ return (mpr->member_id & flag_value) == 0; \ } \ -static void rna_Manipulator_##func_id##_set(PointerRNA *ptr, bool value) \ +static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, bool value) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ SET_FLAG_FROM_TEST(mpr->member_id, !value, flag_value); \ } -#define RNA_MANIPULATOR_FLAG_RO_DEF(func_id, member_id, flag_value) \ -static int rna_Manipulator_##func_id##_get(PointerRNA *ptr) \ +#define RNA_GIZMO_FLAG_RO_DEF(func_id, member_id, flag_value) \ +static int rna_Gizmo_##func_id##_get(PointerRNA *ptr) \ { \ - wmManipulator *mpr = ptr->data; \ + wmGizmo *mpr = ptr->data; \ return (mpr->member_id & flag_value) != 0; \ } -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(color, color, 3); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(color_hi, color_hi, 3); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(color, color, 3); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(color_hi, color_hi, 3); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(alpha, color, 3); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(alpha_hi, color_hi, 3); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(alpha, color, 3); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(alpha_hi, color_hi, 3); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_space, matrix_space, 16); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_basis, matrix_basis, 16); -RNA_MANIPULATOR_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_offset, matrix_offset, 16); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_space, matrix_space, 16); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_basis, matrix_basis, 16); +RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_offset, matrix_offset, 16); -static void rna_Manipulator_matrix_world_get(PointerRNA *ptr, float value[16]) +static void rna_Gizmo_matrix_world_get(PointerRNA *ptr, float value[16]) { - wmManipulator *mpr = ptr->data; - WM_manipulator_calc_matrix_final(mpr, (float (*)[4])value); + wmGizmo *mpr = ptr->data; + WM_gizmo_calc_matrix_final(mpr, (float (*)[4])value); } -RNA_MANIPULATOR_GENERIC_FLOAT_RW_DEF(scale_basis, scale_basis); -RNA_MANIPULATOR_GENERIC_FLOAT_RW_DEF(line_width, line_width); +RNA_GIZMO_GENERIC_FLOAT_RW_DEF(scale_basis, scale_basis); +RNA_GIZMO_GENERIC_FLOAT_RW_DEF(line_width, line_width); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_use_draw_hover, flag, WM_MANIPULATOR_DRAW_HOVER); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_use_draw_modal, flag, WM_MANIPULATOR_DRAW_MODAL); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_use_draw_value, flag, WM_MANIPULATOR_DRAW_VALUE); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_use_draw_offset_scale, flag, WM_MANIPULATOR_DRAW_OFFSET_SCALE); -RNA_MANIPULATOR_GENERIC_FLAG_NEG_RW_DEF(flag_use_draw_scale, flag, WM_MANIPULATOR_DRAW_OFFSET_SCALE); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_hide, flag, WM_MANIPULATOR_HIDDEN); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_use_grab_cursor, flag, WM_MANIPULATOR_GRAB_CURSOR); -RNA_MANIPULATOR_GENERIC_FLAG_RW_DEF(flag_use_select_background, flag, WM_MANIPULATOR_SELECT_BACKGROUND); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_hover, flag, WM_GIZMO_DRAW_HOVER); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_modal, flag, WM_GIZMO_DRAW_MODAL); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_value, flag, WM_GIZMO_DRAW_VALUE); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_draw_offset_scale, flag, WM_GIZMO_DRAW_OFFSET_SCALE); +RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(flag_use_draw_scale, flag, WM_GIZMO_DRAW_OFFSET_SCALE); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide, flag, WM_GIZMO_HIDDEN); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_grab_cursor, flag, WM_GIZMO_GRAB_CURSOR); +RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_select_background, flag, WM_GIZMO_SELECT_BACKGROUND); -/* wmManipulator.state */ -RNA_MANIPULATOR_FLAG_RO_DEF(state_is_highlight, state, WM_MANIPULATOR_STATE_HIGHLIGHT); -RNA_MANIPULATOR_FLAG_RO_DEF(state_is_modal, state, WM_MANIPULATOR_STATE_MODAL); -RNA_MANIPULATOR_FLAG_RO_DEF(state_select, state, WM_MANIPULATOR_STATE_SELECT); +/* wmGizmo.state */ +RNA_GIZMO_FLAG_RO_DEF(state_is_highlight, state, WM_GIZMO_STATE_HIGHLIGHT); +RNA_GIZMO_FLAG_RO_DEF(state_is_modal, state, WM_GIZMO_STATE_MODAL); +RNA_GIZMO_FLAG_RO_DEF(state_select, state, WM_GIZMO_STATE_SELECT); -static void rna_Manipulator_state_select_set(struct PointerRNA *ptr, bool value) +static void rna_Gizmo_state_select_set(struct PointerRNA *ptr, bool value) { - wmManipulator *mpr = ptr->data; - wmManipulatorGroup *mgroup = mpr->parent_mgroup; - WM_manipulator_select_set(mgroup->parent_mmap, mpr, value); + wmGizmo *mpr = ptr->data; + wmGizmoGroup *mgroup = mpr->parent_mgroup; + WM_gizmo_select_set(mgroup->parent_mmap, mpr, value); } -static PointerRNA rna_Manipulator_group_get(PointerRNA *ptr) +static PointerRNA rna_Gizmo_group_get(PointerRNA *ptr) { - wmManipulator *mpr = ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_ManipulatorGroup, mpr->parent_mgroup); + wmGizmo *mpr = ptr->data; + return rna_pointer_inherit_refine(ptr, &RNA_GizmoGroup, mpr->parent_mgroup); } #ifdef WITH_PYTHON -static void rna_Manipulator_unregister(struct Main *bmain, StructRNA *type); -void BPY_RNA_manipulator_wrapper(wmManipulatorType *wgt, void *userdata); +static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type); +void BPY_RNA_gizmo_wrapper(wmGizmoType *wgt, void *userdata); -static StructRNA *rna_Manipulator_register( +static StructRNA *rna_Gizmo_register( Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { @@ -438,17 +438,17 @@ static StructRNA *rna_Manipulator_register( char idname[MAX_NAME]; } temp_buffers; - wmManipulatorType dummywt = {NULL}; - wmManipulator dummymnp = {NULL}; + wmGizmoType dummywt = {NULL}; + wmGizmo dummymnp = {NULL}; PointerRNA mnp_ptr; /* Two sets of functions. */ int have_function[8]; - /* setup dummy manipulator & manipulator type to store static properties in */ + /* setup dummy gizmo & gizmo type to store static properties in */ dummymnp.type = &dummywt; dummywt.idname = temp_buffers.idname; - RNA_pointer_create(NULL, &RNA_Manipulator, &dummymnp, &mnp_ptr); + RNA_pointer_create(NULL, &RNA_Gizmo, &dummymnp, &mnp_ptr); /* Clear so we can detect if it's left unset. */ temp_buffers.idname[0] = '\0'; @@ -458,16 +458,16 @@ static StructRNA *rna_Manipulator_register( return NULL; if (strlen(identifier) >= sizeof(temp_buffers.idname)) { - BKE_reportf(reports, RPT_ERROR, "Registering manipulator class: '%s' is too long, maximum length is %d", + BKE_reportf(reports, RPT_ERROR, "Registering gizmo class: '%s' is too long, maximum length is %d", identifier, (int)sizeof(temp_buffers.idname)); return NULL; } - /* check if we have registered this manipulator type before, and remove it */ + /* check if we have registered this gizmo type before, and remove it */ { - const wmManipulatorType *wt = WM_manipulatortype_find(dummywt.idname, true); + const wmGizmoType *wt = WM_gizmotype_find(dummywt.idname, true); if (wt && wt->ext.srna) { - rna_Manipulator_unregister(bmain, wt->ext.srna); + rna_Gizmo_unregister(bmain, wt->ext.srna); } } if (!RNA_struct_available_or_report(reports, dummywt.idname)) { @@ -475,13 +475,13 @@ static StructRNA *rna_Manipulator_register( } { /* allocate the idname */ - /* For multiple strings see ManipulatorGroup. */ + /* For multiple strings see GizmoGroup. */ dummywt.idname = BLI_strdup(temp_buffers.idname); } - /* create a new manipulator type */ - dummywt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywt.idname, &RNA_Manipulator); - /* manipulator properties are registered separately */ + /* create a new gizmo type */ + dummywt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywt.idname, &RNA_Gizmo); + /* gizmo properties are registered separately */ RNA_def_struct_flag(dummywt.ext.srna, STRUCT_NO_IDPROPERTIES); dummywt.ext.data = data; dummywt.ext.call = call; @@ -489,21 +489,21 @@ static StructRNA *rna_Manipulator_register( { int i = 0; - dummywt.draw = (have_function[i++]) ? rna_manipulator_draw_cb : NULL; - dummywt.draw_select = (have_function[i++]) ? rna_manipulator_draw_select_cb : NULL; - dummywt.test_select = (have_function[i++]) ? rna_manipulator_test_select_cb : NULL; - dummywt.modal = (have_function[i++]) ? rna_manipulator_modal_cb : NULL; -// dummywt.property_update = (have_function[i++]) ? rna_manipulator_property_update : NULL; -// dummywt.position_get = (have_function[i++]) ? rna_manipulator_position_get : NULL; - dummywt.setup = (have_function[i++]) ? rna_manipulator_setup_cb : NULL; - dummywt.invoke = (have_function[i++]) ? rna_manipulator_invoke_cb : NULL; - dummywt.exit = (have_function[i++]) ? rna_manipulator_exit_cb : NULL; - dummywt.select_refresh = (have_function[i++]) ? rna_manipulator_select_refresh_cb : NULL; + dummywt.draw = (have_function[i++]) ? rna_gizmo_draw_cb : NULL; + dummywt.draw_select = (have_function[i++]) ? rna_gizmo_draw_select_cb : NULL; + dummywt.test_select = (have_function[i++]) ? rna_gizmo_test_select_cb : NULL; + dummywt.modal = (have_function[i++]) ? rna_gizmo_modal_cb : NULL; +// dummywt.property_update = (have_function[i++]) ? rna_gizmo_property_update : NULL; +// dummywt.position_get = (have_function[i++]) ? rna_gizmo_position_get : NULL; + dummywt.setup = (have_function[i++]) ? rna_gizmo_setup_cb : NULL; + dummywt.invoke = (have_function[i++]) ? rna_gizmo_invoke_cb : NULL; + dummywt.exit = (have_function[i++]) ? rna_gizmo_exit_cb : NULL; + dummywt.select_refresh = (have_function[i++]) ? rna_gizmo_select_refresh_cb : NULL; BLI_assert(i == ARRAY_SIZE(have_function)); } - WM_manipulatortype_append_ptr(BPY_RNA_manipulator_wrapper, (void *)&dummywt); + WM_gizmotype_append_ptr(BPY_RNA_gizmo_wrapper, (void *)&dummywt); /* update while blender is running */ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); @@ -511,9 +511,9 @@ static StructRNA *rna_Manipulator_register( return dummywt.ext.srna; } -static void rna_Manipulator_unregister(struct Main *bmain, StructRNA *type) +static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type) { - wmManipulatorType *wt = RNA_struct_blender_type_get(type); + wmGizmoType *wt = RNA_struct_blender_type_get(type); if (!wt) return; @@ -523,71 +523,71 @@ static void rna_Manipulator_unregister(struct Main *bmain, StructRNA *type) WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); - WM_manipulatortype_remove_ptr(NULL, bmain, wt); + WM_gizmotype_remove_ptr(NULL, bmain, wt); } -static void **rna_Manipulator_instance(PointerRNA *ptr) +static void **rna_Gizmo_instance(PointerRNA *ptr) { - wmManipulator *mpr = ptr->data; + wmGizmo *mpr = ptr->data; return &mpr->py_instance; } #endif /* WITH_PYTHON */ -static StructRNA *rna_Manipulator_refine(PointerRNA *mnp_ptr) +static StructRNA *rna_Gizmo_refine(PointerRNA *mnp_ptr) { - wmManipulator *mpr = mnp_ptr->data; - return (mpr->type && mpr->type->ext.srna) ? mpr->type->ext.srna : &RNA_Manipulator; + wmGizmo *mpr = mnp_ptr->data; + return (mpr->type && mpr->type->ext.srna) ? mpr->type->ext.srna : &RNA_Gizmo; } /** \} */ -/** \name Manipulator Group API +/** \name Gizmo Group API * \{ */ -static wmManipulator *rna_ManipulatorGroup_manipulator_new( - wmManipulatorGroup *mgroup, ReportList *reports, const char *idname) +static wmGizmo *rna_GizmoGroup_gizmo_new( + wmGizmoGroup *mgroup, ReportList *reports, const char *idname) { - const wmManipulatorType *wt = WM_manipulatortype_find(idname, true); + const wmGizmoType *wt = WM_gizmotype_find(idname, true); if (wt == NULL) { - BKE_reportf(reports, RPT_ERROR, "ManipulatorType '%s' not known", idname); + BKE_reportf(reports, RPT_ERROR, "GizmoType '%s' not known", idname); return NULL; } - wmManipulator *mpr = WM_manipulator_new_ptr(wt, mgroup, NULL); + wmGizmo *mpr = WM_gizmo_new_ptr(wt, mgroup, NULL); return mpr; } -static void rna_ManipulatorGroup_manipulator_remove( - wmManipulatorGroup *mgroup, bContext *C, wmManipulator *mpr) +static void rna_GizmoGroup_gizmo_remove( + wmGizmoGroup *mgroup, bContext *C, wmGizmo *mpr) { - WM_manipulator_unlink(&mgroup->manipulators, mgroup->parent_mmap, mpr, C); + WM_gizmo_unlink(&mgroup->gizmos, mgroup->parent_mmap, mpr, C); } -static void rna_ManipulatorGroup_manipulator_clear( - wmManipulatorGroup *mgroup, bContext *C) +static void rna_GizmoGroup_gizmo_clear( + wmGizmoGroup *mgroup, bContext *C) { - while (mgroup->manipulators.first) { - WM_manipulator_unlink(&mgroup->manipulators, mgroup->parent_mmap, mgroup->manipulators.first, C); + while (mgroup->gizmos.first) { + WM_gizmo_unlink(&mgroup->gizmos, mgroup->parent_mmap, mgroup->gizmos.first, C); } } -static void rna_ManipulatorGroup_name_get(PointerRNA *ptr, char *value) +static void rna_GizmoGroup_name_get(PointerRNA *ptr, char *value) { - wmManipulatorGroup *mgroup = ptr->data; + wmGizmoGroup *mgroup = ptr->data; strcpy(value, mgroup->type->name); } -static int rna_ManipulatorGroup_name_length(PointerRNA *ptr) +static int rna_GizmoGroup_name_length(PointerRNA *ptr) { - wmManipulatorGroup *mgroup = ptr->data; + wmGizmoGroup *mgroup = ptr->data; return strlen(mgroup->type->name); } /* just to work around 'const char *' warning and to ensure this is a python op */ -static void rna_ManipulatorGroup_bl_idname_set(PointerRNA *ptr, const char *value) +static void rna_GizmoGroup_bl_idname_set(PointerRNA *ptr, const char *value) { - wmManipulatorGroup *data = ptr->data; + wmGizmoGroup *data = ptr->data; char *str = (char *)data->type->idname; if (!str[0]) BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ @@ -595,9 +595,9 @@ static void rna_ManipulatorGroup_bl_idname_set(PointerRNA *ptr, const char *valu assert(!"setting the bl_idname on a non-builtin operator"); } -static void rna_ManipulatorGroup_bl_label_set(PointerRNA *ptr, const char *value) +static void rna_GizmoGroup_bl_label_set(PointerRNA *ptr, const char *value) { - wmManipulatorGroup *data = ptr->data; + wmGizmoGroup *data = ptr->data; char *str = (char *)data->type->name; if (!str[0]) BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */ @@ -605,18 +605,18 @@ static void rna_ManipulatorGroup_bl_label_set(PointerRNA *ptr, const char *value assert(!"setting the bl_label on a non-builtin operator"); } -static bool rna_ManipulatorGroup_has_reports_get(PointerRNA *ptr) +static bool rna_GizmoGroup_has_reports_get(PointerRNA *ptr) { - wmManipulatorGroup *mgroup = ptr->data; + wmGizmoGroup *mgroup = ptr->data; return (mgroup->reports && mgroup->reports->list.first); } #ifdef WITH_PYTHON -static bool rna_manipulatorgroup_poll_cb(const bContext *C, wmManipulatorGroupType *wgt) +static bool rna_gizmogroup_poll_cb(const bContext *C, wmGizmoGroupType *wgt) { - extern FunctionRNA rna_ManipulatorGroup_poll_func; + extern FunctionRNA rna_GizmoGroup_poll_func; PointerRNA ptr; ParameterList list; @@ -625,7 +625,7 @@ static bool rna_manipulatorgroup_poll_cb(const bContext *C, wmManipulatorGroupTy int visible; RNA_pointer_create(NULL, wgt->ext.srna, NULL, &ptr); /* dummy */ - func = &rna_ManipulatorGroup_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ + func = &rna_GizmoGroup_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -639,16 +639,16 @@ static bool rna_manipulatorgroup_poll_cb(const bContext *C, wmManipulatorGroupTy return visible; } -static void rna_manipulatorgroup_setup_cb(const bContext *C, wmManipulatorGroup *mgroup) +static void rna_gizmogroup_setup_cb(const bContext *C, wmGizmoGroup *mgroup) { - extern FunctionRNA rna_ManipulatorGroup_setup_func; + extern FunctionRNA rna_GizmoGroup_setup_func; PointerRNA mgroup_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mgroup->type->ext.srna, mgroup, &mgroup_ptr); - func = &rna_ManipulatorGroup_setup_func; /* RNA_struct_find_function(&wgroupr, "setup"); */ + func = &rna_GizmoGroup_setup_func; /* RNA_struct_find_function(&wgroupr, "setup"); */ RNA_parameter_list_create(&list, &mgroup_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -657,9 +657,9 @@ static void rna_manipulatorgroup_setup_cb(const bContext *C, wmManipulatorGroup RNA_parameter_list_free(&list); } -static wmKeyMap *rna_manipulatorgroup_setup_keymap_cb(const wmManipulatorGroupType *wgt, wmKeyConfig *config) +static wmKeyMap *rna_gizmogroup_setup_keymap_cb(const wmGizmoGroupType *wgt, wmKeyConfig *config) { - extern FunctionRNA rna_ManipulatorGroup_setup_keymap_func; + extern FunctionRNA rna_GizmoGroup_setup_keymap_func; void *ret; PointerRNA ptr; @@ -667,7 +667,7 @@ static wmKeyMap *rna_manipulatorgroup_setup_keymap_cb(const wmManipulatorGroupTy FunctionRNA *func; RNA_pointer_create(NULL, wgt->ext.srna, NULL, &ptr); /* dummy */ - func = &rna_ManipulatorGroup_setup_keymap_func; /* RNA_struct_find_function(&wgroupr, "setup_keymap"); */ + func = &rna_GizmoGroup_setup_keymap_func; /* RNA_struct_find_function(&wgroupr, "setup_keymap"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "keyconfig", &config); @@ -681,16 +681,16 @@ static wmKeyMap *rna_manipulatorgroup_setup_keymap_cb(const wmManipulatorGroupTy return keymap; } -static void rna_manipulatorgroup_refresh_cb(const bContext *C, wmManipulatorGroup *mgroup) +static void rna_gizmogroup_refresh_cb(const bContext *C, wmGizmoGroup *mgroup) { - extern FunctionRNA rna_ManipulatorGroup_refresh_func; + extern FunctionRNA rna_GizmoGroup_refresh_func; PointerRNA mgroup_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mgroup->type->ext.srna, mgroup, &mgroup_ptr); - func = &rna_ManipulatorGroup_refresh_func; /* RNA_struct_find_function(&wgroupr, "refresh"); */ + func = &rna_GizmoGroup_refresh_func; /* RNA_struct_find_function(&wgroupr, "refresh"); */ RNA_parameter_list_create(&list, &mgroup_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -699,16 +699,16 @@ static void rna_manipulatorgroup_refresh_cb(const bContext *C, wmManipulatorGrou RNA_parameter_list_free(&list); } -static void rna_manipulatorgroup_draw_prepare_cb(const bContext *C, wmManipulatorGroup *mgroup) +static void rna_gizmogroup_draw_prepare_cb(const bContext *C, wmGizmoGroup *mgroup) { - extern FunctionRNA rna_ManipulatorGroup_draw_prepare_func; + extern FunctionRNA rna_GizmoGroup_draw_prepare_func; PointerRNA mgroup_ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, mgroup->type->ext.srna, mgroup, &mgroup_ptr); - func = &rna_ManipulatorGroup_draw_prepare_func; /* RNA_struct_find_function(&wgroupr, "draw_prepare"); */ + func = &rna_GizmoGroup_draw_prepare_func; /* RNA_struct_find_function(&wgroupr, "draw_prepare"); */ RNA_parameter_list_create(&list, &mgroup_ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -717,10 +717,10 @@ static void rna_manipulatorgroup_draw_prepare_cb(const bContext *C, wmManipulato RNA_parameter_list_free(&list); } -void BPY_RNA_manipulatorgroup_wrapper(wmManipulatorGroupType *wgt, void *userdata); -static void rna_ManipulatorGroup_unregister(struct Main *bmain, StructRNA *type); +void BPY_RNA_gizmogroup_wrapper(wmGizmoGroupType *wgt, void *userdata); +static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type); -static StructRNA *rna_ManipulatorGroup_register( +static StructRNA *rna_GizmoGroup_register( Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) { @@ -729,19 +729,19 @@ static StructRNA *rna_ManipulatorGroup_register( char idname[MAX_NAME]; } temp_buffers; - wmManipulatorGroupType dummywgt = {NULL}; - wmManipulatorGroup dummywg = {NULL}; + wmGizmoGroupType dummywgt = {NULL}; + wmGizmoGroup dummywg = {NULL}; PointerRNA wgptr; /* Two sets of functions. */ int have_function[5]; - /* setup dummy manipulatorgroup & manipulatorgroup type to store static properties in */ + /* setup dummy gizmogroup & gizmogroup type to store static properties in */ dummywg.type = &dummywgt; dummywgt.name = temp_buffers.name; dummywgt.idname = temp_buffers.idname; - RNA_pointer_create(NULL, &RNA_ManipulatorGroup, &dummywg, &wgptr); + RNA_pointer_create(NULL, &RNA_GizmoGroup, &dummywg, &wgptr); /* Clear so we can detect if it's left unset. */ temp_buffers.idname[0] = temp_buffers.name[0] = '\0'; @@ -751,28 +751,28 @@ static StructRNA *rna_ManipulatorGroup_register( return NULL; if (strlen(identifier) >= sizeof(temp_buffers.idname)) { - BKE_reportf(reports, RPT_ERROR, "Registering manipulatorgroup class: '%s' is too long, maximum length is %d", + BKE_reportf(reports, RPT_ERROR, "Registering gizmogroup class: '%s' is too long, maximum length is %d", identifier, (int)sizeof(temp_buffers.idname)); return NULL; } /* check if the area supports widgets */ - const struct wmManipulatorMapType_Params wmap_params = { + const struct wmGizmoMapType_Params wmap_params = { .spaceid = dummywgt.mmap_params.spaceid, .regionid = dummywgt.mmap_params.regionid, }; - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wmap_params); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wmap_params); if (mmap_type == NULL) { - BKE_reportf(reports, RPT_ERROR, "Area type does not support manipulators"); + BKE_reportf(reports, RPT_ERROR, "Area type does not support gizmos"); return NULL; } - /* check if we have registered this manipulatorgroup type before, and remove it */ + /* check if we have registered this gizmogroup type before, and remove it */ { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(dummywgt.idname, true); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(dummywgt.idname, true); if (wgt && wgt->ext.srna) { - rna_ManipulatorGroup_unregister(bmain, wgt->ext.srna); + rna_GizmoGroup_unregister(bmain, wgt->ext.srna); } } if (!RNA_struct_available_or_report(reports, dummywgt.idname)) { @@ -792,23 +792,23 @@ static StructRNA *rna_ManipulatorGroup_register( BLI_assert(ARRAY_SIZE(strings) == 2); } - /* create a new manipulatorgroup type */ - dummywgt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_ManipulatorGroup); - RNA_def_struct_flag(dummywgt.ext.srna, STRUCT_NO_IDPROPERTIES); /* manipulatorgroup properties are registered separately */ + /* create a new gizmogroup type */ + dummywgt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_GizmoGroup); + RNA_def_struct_flag(dummywgt.ext.srna, STRUCT_NO_IDPROPERTIES); /* gizmogroup properties are registered separately */ dummywgt.ext.data = data; dummywgt.ext.call = call; dummywgt.ext.free = free; /* We used to register widget group types like this, now we do it similar to * operator types. Thus we should be able to do the same as operator types now. */ - dummywgt.poll = (have_function[0]) ? rna_manipulatorgroup_poll_cb : NULL; - dummywgt.setup_keymap = (have_function[1]) ? rna_manipulatorgroup_setup_keymap_cb : NULL; - dummywgt.setup = (have_function[2]) ? rna_manipulatorgroup_setup_cb : NULL; - dummywgt.refresh = (have_function[3]) ? rna_manipulatorgroup_refresh_cb : NULL; - dummywgt.draw_prepare = (have_function[4]) ? rna_manipulatorgroup_draw_prepare_cb : NULL; + dummywgt.poll = (have_function[0]) ? rna_gizmogroup_poll_cb : NULL; + dummywgt.setup_keymap = (have_function[1]) ? rna_gizmogroup_setup_keymap_cb : NULL; + dummywgt.setup = (have_function[2]) ? rna_gizmogroup_setup_cb : NULL; + dummywgt.refresh = (have_function[3]) ? rna_gizmogroup_refresh_cb : NULL; + dummywgt.draw_prepare = (have_function[4]) ? rna_gizmogroup_draw_prepare_cb : NULL; - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_append_ptr( - BPY_RNA_manipulatorgroup_wrapper, (void *)&dummywgt); + wmGizmoGroupType *wgt = WM_gizmogrouptype_append_ptr( + BPY_RNA_gizmogroup_wrapper, (void *)&dummywgt); { const char *owner_id = RNA_struct_state_owner_get(); @@ -817,8 +817,8 @@ static StructRNA *rna_ManipulatorGroup_register( } } - if (wgt->flag & WM_MANIPULATORGROUPTYPE_PERSISTENT) { - WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); + if (wgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) { + WM_gizmo_group_type_add_ptr_ex(wgt, mmap_type); /* update while blender is running */ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); @@ -827,9 +827,9 @@ static StructRNA *rna_ManipulatorGroup_register( return dummywgt.ext.srna; } -static void rna_ManipulatorGroup_unregister(struct Main *bmain, StructRNA *type) +static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type) { - wmManipulatorGroupType *wgt = RNA_struct_blender_type_get(type); + wmGizmoGroupType *wgt = RNA_struct_blender_type_get(type); if (!wgt) return; @@ -839,27 +839,27 @@ static void rna_ManipulatorGroup_unregister(struct Main *bmain, StructRNA *type) WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); - WM_manipulator_group_type_remove_ptr(bmain, wgt); + WM_gizmo_group_type_remove_ptr(bmain, wgt); } -static void **rna_ManipulatorGroup_instance(PointerRNA *ptr) +static void **rna_GizmoGroup_instance(PointerRNA *ptr) { - wmManipulatorGroup *mgroup = ptr->data; + wmGizmoGroup *mgroup = ptr->data; return &mgroup->py_instance; } #endif /* WITH_PYTHON */ -static StructRNA *rna_ManipulatorGroup_refine(PointerRNA *mgroup_ptr) +static StructRNA *rna_GizmoGroup_refine(PointerRNA *mgroup_ptr) { - wmManipulatorGroup *mgroup = mgroup_ptr->data; - return (mgroup->type && mgroup->type->ext.srna) ? mgroup->type->ext.srna : &RNA_ManipulatorGroup; + wmGizmoGroup *mgroup = mgroup_ptr->data; + return (mgroup->type && mgroup->type->ext.srna) ? mgroup->type->ext.srna : &RNA_GizmoGroup; } -static void rna_ManipulatorGroup_manipulators_begin(CollectionPropertyIterator *iter, PointerRNA *mgroup_ptr) +static void rna_GizmoGroup_gizmos_begin(CollectionPropertyIterator *iter, PointerRNA *mgroup_ptr) { - wmManipulatorGroup *mgroup = mgroup_ptr->data; - rna_iterator_listbase_begin(iter, &mgroup->manipulators, NULL); + wmGizmoGroup *mgroup = mgroup_ptr->data; + rna_iterator_listbase_begin(iter, &mgroup->gizmos, NULL); } /** \} */ @@ -868,40 +868,40 @@ static void rna_ManipulatorGroup_manipulators_begin(CollectionPropertyIterator * #else /* RNA_RUNTIME */ -/* ManipulatorGroup.manipulators */ -static void rna_def_manipulators(BlenderRNA *brna, PropertyRNA *cprop) +/* GizmoGroup.gizmos */ +static void rna_def_gizmos(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - RNA_def_property_srna(cprop, "Manipulators"); - srna = RNA_def_struct(brna, "Manipulators", NULL); - RNA_def_struct_sdna(srna, "wmManipulatorGroup"); - RNA_def_struct_ui_text(srna, "Manipulators", "Collection of manipulators"); + RNA_def_property_srna(cprop, "Gizmos"); + srna = RNA_def_struct(brna, "Gizmos", NULL); + RNA_def_struct_sdna(srna, "wmGizmoGroup"); + RNA_def_struct_ui_text(srna, "Gizmos", "Collection of gizmos"); - func = RNA_def_function(srna, "new", "rna_ManipulatorGroup_manipulator_new"); - RNA_def_function_ui_description(func, "Add manipulator"); + func = RNA_def_function(srna, "new", "rna_GizmoGroup_gizmo_new"); + RNA_def_function_ui_description(func, "Add gizmo"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - RNA_def_string(func, "type", "Type", 0, "", "Manipulator identifier"); /* optional */ - parm = RNA_def_pointer(func, "manipulator", "Manipulator", "", "New manipulator"); + RNA_def_string(func, "type", "Type", 0, "", "Gizmo identifier"); /* optional */ + parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "New gizmo"); RNA_def_function_return(func, parm); - func = RNA_def_function(srna, "remove", "rna_ManipulatorGroup_manipulator_remove"); + func = RNA_def_function(srna, "remove", "rna_GizmoGroup_gizmo_remove"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, "Delete manipulator"); - parm = RNA_def_pointer(func, "manipulator", "Manipulator", "", "New manipulator"); + RNA_def_function_ui_description(func, "Delete gizmo"); + parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "New gizmo"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); - func = RNA_def_function(srna, "clear", "rna_ManipulatorGroup_manipulator_clear"); + func = RNA_def_function(srna, "clear", "rna_GizmoGroup_gizmo_clear"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, "Delete all manipulators"); + RNA_def_function_ui_description(func, "Delete all gizmos"); } -static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) +static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; PropertyRNA *prop; @@ -909,26 +909,26 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) FunctionRNA *func; PropertyRNA *parm; - RNA_def_property_srna(cprop, "Manipulator"); - srna = RNA_def_struct(brna, "Manipulator", NULL); - RNA_def_struct_sdna(srna, "wmManipulator"); - RNA_def_struct_ui_text(srna, "Manipulator", "Collection of manipulators"); - RNA_def_struct_refine_func(srna, "rna_Manipulator_refine"); + RNA_def_property_srna(cprop, "Gizmo"); + srna = RNA_def_struct(brna, "Gizmo", NULL); + RNA_def_struct_sdna(srna, "wmGizmo"); + RNA_def_struct_ui_text(srna, "Gizmo", "Collection of gizmos"); + RNA_def_struct_refine_func(srna, "rna_Gizmo_refine"); #ifdef WITH_PYTHON RNA_def_struct_register_funcs( srna, - "rna_Manipulator_register", - "rna_Manipulator_unregister", - "rna_Manipulator_instance"); + "rna_Gizmo_register", + "rna_Gizmo_unregister", + "rna_Gizmo_instance"); #endif RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "ManipulatorProperties"); + RNA_def_property_struct_type(prop, "GizmoProperties"); RNA_def_property_ui_text(prop, "Properties", ""); - RNA_def_property_pointer_funcs(prop, "rna_Manipulator_properties_get", NULL, NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_Gizmo_properties_get", NULL, NULL, NULL); /* -------------------------------------------------------------------- */ /* Registerable Variables */ @@ -938,20 +938,20 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, MAX_NAME); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Manipulator_bl_idname_set"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Gizmo_bl_idname_set"); /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER); RNA_define_verify_sdna(1); /* not in sdna */ - /* wmManipulator.draw */ + /* wmGizmo.draw */ func = RNA_def_function(srna, "draw", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); - /* wmManipulator.draw_select */ + /* wmGizmo.draw_select */ func = RNA_def_function(srna, "draw_select", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); @@ -959,7 +959,7 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_int(func, "select_id", 0, 0, INT_MAX, "", "", 0, INT_MAX); - /* wmManipulator.test_select */ + /* wmGizmo.test_select */ func = RNA_def_function(srna, "test_select", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); @@ -970,10 +970,10 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_int(func, "intersect_id", 0, 0, INT_MAX, "", "", 0, INT_MAX); RNA_def_function_return(func, parm); - /* wmManipulator.handler */ + /* wmGizmo.handler */ static EnumPropertyItem tweak_actions[] = { - {WM_MANIPULATOR_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""}, - {WM_MANIPULATOR_TWEAK_SNAP, "SNAP", 0, "Snap", ""}, + {WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""}, + {WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""}, {0, NULL, 0, NULL, NULL} }; func = RNA_def_function(srna, "modal", NULL); @@ -988,15 +988,15 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); RNA_def_function_return(func, parm); - /* wmManipulator.property_update */ + /* wmGizmo.property_update */ /* TODO */ - /* wmManipulator.setup */ + /* wmGizmo.setup */ func = RNA_def_function(srna, "setup", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); - /* wmManipulator.invoke */ + /* wmGizmo.invoke */ func = RNA_def_function(srna, "invoke", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); @@ -1007,7 +1007,7 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", ""); RNA_def_function_return(func, parm); - /* wmManipulator.exit */ + /* wmGizmo.exit */ func = RNA_def_function(srna, "exit", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); @@ -1016,10 +1016,10 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_boolean(func, "cancel", 0, "Cancel, otherwise confirm", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - /* wmManipulator.cursor_get */ + /* wmGizmo.cursor_get */ /* TODO */ - /* wmManipulator.select_refresh */ + /* wmGizmo.select_refresh */ func = RNA_def_function(srna, "select_refresh", NULL); RNA_def_function_ui_description(func, ""); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); @@ -1030,146 +1030,146 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop) prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_struct_type(prop, "ManipulatorGroup"); - RNA_def_property_pointer_funcs(prop, "rna_Manipulator_group_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "", "Manipulator group this manipulator is a member of"); + RNA_def_property_struct_type(prop, "GizmoGroup"); + RNA_def_property_pointer_funcs(prop, "rna_Gizmo_group_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "", "Gizmo group this gizmo is a member of"); /* Color & Alpha */ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_float_funcs(prop, "rna_Manipulator_color_get", "rna_Manipulator_color_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_color_get", "rna_Gizmo_color_set", NULL); prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(prop, "Alpha", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_alpha_get", "rna_Manipulator_alpha_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_get", "rna_Gizmo_alpha_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); /* Color & Alpha (highlight) */ prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); - RNA_def_property_float_funcs(prop, "rna_Manipulator_color_hi_get", "rna_Manipulator_color_hi_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_color_hi_get", "rna_Gizmo_color_hi_set", NULL); prop = RNA_def_property(srna, "alpha_highlight", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(prop, "Alpha", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_alpha_hi_get", "rna_Manipulator_alpha_hi_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_hi_get", "rna_Gizmo_alpha_hi_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); prop = RNA_def_property(srna, "matrix_space", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(prop, "Space Matrix", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_matrix_space_get", "rna_Manipulator_matrix_space_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_space_get", "rna_Gizmo_matrix_space_set", NULL); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(prop, "Basis Matrix", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_matrix_basis_get", "rna_Manipulator_matrix_basis_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_basis_get", "rna_Gizmo_matrix_basis_set", NULL); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); prop = RNA_def_property(srna, "matrix_offset", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(prop, "Offset Matrix", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_matrix_offset_get", "rna_Manipulator_matrix_offset_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_offset_get", "rna_Gizmo_matrix_offset_set", NULL); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(prop, "Final World Matrix", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_matrix_world_get", NULL, NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_world_get", NULL, NULL); prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(prop, "Scale Basis", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_scale_basis_get", "rna_Manipulator_scale_basis_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_scale_basis_get", "rna_Gizmo_scale_basis_set", NULL); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL); RNA_def_property_ui_text(prop, "Line Width", ""); - RNA_def_property_float_funcs(prop, "rna_Manipulator_line_width_get", "rna_Manipulator_line_width_set", NULL); + RNA_def_property_float_funcs(prop, "rna_Gizmo_line_width_get", "rna_Gizmo_line_width_set", NULL); RNA_def_property_range(prop, 0.0f, FLT_MAX); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* wmManipulator.flag */ - /* WM_MANIPULATOR_HIDDEN */ + /* wmGizmo.flag */ + /* WM_GIZMO_HIDDEN */ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_hide_get", "rna_Manipulator_flag_hide_set"); + prop, "rna_Gizmo_flag_hide_get", "rna_Gizmo_flag_hide_set"); RNA_def_property_ui_text(prop, "Hide", ""); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_GRAB_CURSOR */ + /* WM_GIZMO_GRAB_CURSOR */ prop = RNA_def_property(srna, "use_grab_cursor", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_grab_cursor_get", "rna_Manipulator_flag_use_grab_cursor_set"); + prop, "rna_Gizmo_flag_use_grab_cursor_get", "rna_Gizmo_flag_use_grab_cursor_set"); RNA_def_property_ui_text(prop, "Grab Cursor", ""); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_DRAW_HOVER */ + /* WM_GIZMO_DRAW_HOVER */ prop = RNA_def_property(srna, "use_draw_hover", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_draw_hover_get", "rna_Manipulator_flag_use_draw_hover_set"); + prop, "rna_Gizmo_flag_use_draw_hover_get", "rna_Gizmo_flag_use_draw_hover_set"); RNA_def_property_ui_text(prop, "Draw Hover", ""); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_DRAW_MODAL */ + /* WM_GIZMO_DRAW_MODAL */ prop = RNA_def_property(srna, "use_draw_modal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_draw_modal_get", "rna_Manipulator_flag_use_draw_modal_set"); + prop, "rna_Gizmo_flag_use_draw_modal_get", "rna_Gizmo_flag_use_draw_modal_set"); RNA_def_property_ui_text(prop, "Draw Active", "Draw while dragging"); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_DRAW_VALUE */ + /* WM_GIZMO_DRAW_VALUE */ prop = RNA_def_property(srna, "use_draw_value", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_draw_value_get", "rna_Manipulator_flag_use_draw_value_set"); + prop, "rna_Gizmo_flag_use_draw_value_get", "rna_Gizmo_flag_use_draw_value_set"); RNA_def_property_ui_text(prop, "Draw Value", "Show an indicator for the current value while dragging"); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_DRAW_OFFSET_SCALE */ + /* WM_GIZMO_DRAW_OFFSET_SCALE */ prop = RNA_def_property(srna, "use_draw_offset_scale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_draw_offset_scale_get", "rna_Manipulator_flag_use_draw_offset_scale_set"); + prop, "rna_Gizmo_flag_use_draw_offset_scale_get", "rna_Gizmo_flag_use_draw_offset_scale_set"); RNA_def_property_ui_text(prop, "Scale Offset", "Scale the offset matrix (use to apply screen-space offset)"); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_DRAW_NO_SCALE (negated) */ + /* WM_GIZMO_DRAW_NO_SCALE (negated) */ prop = RNA_def_property(srna, "use_draw_scale", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_draw_scale_get", "rna_Manipulator_flag_use_draw_scale_set"); + prop, "rna_Gizmo_flag_use_draw_scale_get", "rna_Gizmo_flag_use_draw_scale_set"); RNA_def_property_ui_text(prop, "Scale", "Use scale when calculating the matrix"); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* WM_MANIPULATOR_SELECT_BACKGROUND */ + /* WM_GIZMO_SELECT_BACKGROUND */ prop = RNA_def_property(srna, "use_select_background", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs( - prop, "rna_Manipulator_flag_use_select_background_get", "rna_Manipulator_flag_use_select_background_set"); + prop, "rna_Gizmo_flag_use_select_background_get", "rna_Gizmo_flag_use_select_background_set"); RNA_def_property_ui_text(prop, "Select Background", "Don't write into the depth buffer"); RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL); - /* wmManipulator.state (readonly) */ - /* WM_MANIPULATOR_STATE_HIGHLIGHT */ + /* wmGizmo.state (readonly) */ + /* WM_GIZMO_STATE_HIGHLIGHT */ prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_Manipulator_state_is_highlight_get", NULL); + RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_highlight_get", NULL); RNA_def_property_ui_text(prop, "Highlight", ""); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - /* WM_MANIPULATOR_STATE_MODAL */ + /* WM_GIZMO_STATE_MODAL */ prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_Manipulator_state_is_modal_get", NULL); + RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_modal_get", NULL); RNA_def_property_ui_text(prop, "Highlight", ""); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - /* WM_MANIPULATOR_STATE_SELECT */ + /* WM_GIZMO_STATE_SELECT */ /* (note that setting is involved, needs to handle array) */ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_Manipulator_state_select_get", "rna_Manipulator_state_select_set"); + RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_select_get", "rna_Gizmo_state_select_set"); RNA_def_property_ui_text(prop, "Select", ""); - RNA_api_manipulator(srna); + RNA_api_gizmo(srna); - srna = RNA_def_struct(brna, "ManipulatorProperties", NULL); - RNA_def_struct_ui_text(srna, "Manipulator Properties", "Input properties of an Manipulator"); - RNA_def_struct_refine_func(srna, "rna_ManipulatorProperties_refine"); - RNA_def_struct_idprops_func(srna, "rna_ManipulatorProperties_idprops"); + srna = RNA_def_struct(brna, "GizmoProperties", NULL); + RNA_def_struct_ui_text(srna, "Gizmo Properties", "Input properties of an Gizmo"); + RNA_def_struct_refine_func(srna, "rna_GizmoProperties_refine"); + RNA_def_struct_idprops_func(srna, "rna_GizmoProperties_idprops"); RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); } -static void rna_def_manipulatorgroup(BlenderRNA *brna) +static void rna_def_gizmogroup(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -1177,16 +1177,16 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - srna = RNA_def_struct(brna, "ManipulatorGroup", NULL); - RNA_def_struct_ui_text(srna, "ManipulatorGroup", "Storage of an operator being executed, or registered after execution"); - RNA_def_struct_sdna(srna, "wmManipulatorGroup"); - RNA_def_struct_refine_func(srna, "rna_ManipulatorGroup_refine"); + srna = RNA_def_struct(brna, "GizmoGroup", NULL); + RNA_def_struct_ui_text(srna, "GizmoGroup", "Storage of an operator being executed, or registered after execution"); + RNA_def_struct_sdna(srna, "wmGizmoGroup"); + RNA_def_struct_refine_func(srna, "rna_GizmoGroup_refine"); #ifdef WITH_PYTHON RNA_def_struct_register_funcs( srna, - "rna_ManipulatorGroup_register", - "rna_ManipulatorGroup_unregister", - "rna_ManipulatorGroup_instance"); + "rna_GizmoGroup_register", + "rna_GizmoGroup_unregister", + "rna_GizmoGroup_instance"); #endif RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); @@ -1198,14 +1198,14 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, MAX_NAME); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ManipulatorGroup_bl_idname_set"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_idname_set"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_struct_name_property(srna, prop); prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, MAX_NAME); /* else it uses the pointer size! */ - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ManipulatorGroup_bl_label_set"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_label_set"); /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ RNA_def_property_flag(prop, PROP_REGISTER); @@ -1226,24 +1226,24 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* bl_options */ - static EnumPropertyItem manipulatorgroup_flag_items[] = { - {WM_MANIPULATORGROUPTYPE_3D, "3D", 0, "3D", + static EnumPropertyItem gizmogroup_flag_items[] = { + {WM_GIZMOGROUPTYPE_3D, "3D", 0, "3D", "Use in 3D viewport"}, - {WM_MANIPULATORGROUPTYPE_SCALE, "SCALE", 0, "Scale", + {WM_GIZMOGROUPTYPE_SCALE, "SCALE", 0, "Scale", "Scale to respect zoom (otherwise zoom independent draw size)"}, - {WM_MANIPULATORGROUPTYPE_DEPTH_3D, "DEPTH_3D", 0, "Depth 3D", + {WM_GIZMOGROUPTYPE_DEPTH_3D, "DEPTH_3D", 0, "Depth 3D", "Supports culled depth by other objects in the view"}, - {WM_MANIPULATORGROUPTYPE_SELECT, "SELECT", 0, "Select", + {WM_GIZMOGROUPTYPE_SELECT, "SELECT", 0, "Select", "Supports selection"}, - {WM_MANIPULATORGROUPTYPE_PERSISTENT, "PERSISTENT", 0, "Persistent", + {WM_GIZMOGROUPTYPE_PERSISTENT, "PERSISTENT", 0, "Persistent", ""}, - {WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL, "SHOW_MODAL_ALL", 0, "Show Modal All", + {WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL, "SHOW_MODAL_ALL", 0, "Show Modal All", "Show all while interacting"}, {0, NULL, 0, NULL, NULL} }; prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type->flag"); - RNA_def_property_enum_items(prop, manipulatorgroup_flag_items); + RNA_def_property_enum_items(prop, gizmogroup_flag_items); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG); RNA_def_property_ui_text(prop, "Options", "Options for this operator type"); @@ -1254,7 +1254,7 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) /* poll */ func = RNA_def_function(srna, "poll", NULL); - RNA_def_function_ui_description(func, "Test if the manipulator group can be called or not"); + RNA_def_function_ui_description(func, "Test if the gizmo group can be called or not"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); parm = RNA_def_pointer(func, "context", "Context", "", ""); @@ -1264,7 +1264,7 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) func = RNA_def_function(srna, "setup_keymap", NULL); RNA_def_function_ui_description( func, - "Initialize keymaps for this manipulator group, use fallback keymap when not present"); + "Initialize keymaps for this gizmo group, use fallback keymap when not present"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); @@ -1275,7 +1275,7 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) /* setup */ func = RNA_def_function(srna, "setup", NULL); - RNA_def_function_ui_description(func, "Create manipulators function for the manipulator group"); + RNA_def_function_ui_description(func, "Create gizmos function for the gizmo group"); RNA_def_function_flag(func, FUNC_REGISTER); parm = RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); @@ -1298,38 +1298,38 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_string_funcs(prop, "rna_ManipulatorGroup_name_get", "rna_ManipulatorGroup_name_length", NULL); + RNA_def_property_string_funcs(prop, "rna_GizmoGroup_name_get", "rna_GizmoGroup_name_length", NULL); RNA_def_property_ui_text(prop, "Name", ""); prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */ - RNA_def_property_boolean_funcs(prop, "rna_ManipulatorGroup_has_reports_get", NULL); + RNA_def_property_boolean_funcs(prop, "rna_GizmoGroup_has_reports_get", NULL); RNA_def_property_ui_text(prop, "Has Reports", - "ManipulatorGroup has a set of reports (warnings and errors) from last execution"); + "GizmoGroup has a set of reports (warnings and errors) from last execution"); RNA_define_verify_sdna(0); /* not in sdna */ - prop = RNA_def_property(srna, "manipulators", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "manipulators", NULL); - RNA_def_property_struct_type(prop, "Manipulator"); + prop = RNA_def_property(srna, "gizmos", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "gizmos", NULL); + RNA_def_property_struct_type(prop, "Gizmo"); RNA_def_property_collection_funcs( - prop, "rna_ManipulatorGroup_manipulators_begin", "rna_iterator_listbase_next", + prop, "rna_GizmoGroup_gizmos_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Manipulators", "List of manipulators in the Manipulator Map"); - rna_def_manipulator(brna, prop); - rna_def_manipulators(brna, prop); + RNA_def_property_ui_text(prop, "Gizmos", "List of gizmos in the Gizmo Map"); + rna_def_gizmo(brna, prop); + rna_def_gizmos(brna, prop); RNA_define_verify_sdna(1); /* not in sdna */ - RNA_api_manipulatorgroup(srna); + RNA_api_gizmogroup(srna); } -void RNA_def_wm_manipulator(BlenderRNA *brna) +void RNA_def_wm_gizmo(BlenderRNA *brna) { - rna_def_manipulatorgroup(brna); + rna_def_gizmogroup(brna); } #endif /* RNA_RUNTIME */ diff --git a/source/blender/makesrna/intern/rna_wm_gizmo_api.c b/source/blender/makesrna/intern/rna_wm_gizmo_api.c index b06ba4d3dac..04c02889fa3 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo_api.c +++ b/source/blender/makesrna/intern/rna_wm_gizmo_api.c @@ -46,43 +46,43 @@ #include "ED_gizmo_library.h" -static void rna_manipulator_draw_preset_box( - wmManipulator *mpr, float matrix[16], int select_id) +static void rna_gizmo_draw_preset_box( + wmGizmo *mpr, float matrix[16], int select_id) { - ED_manipulator_draw_preset_box(mpr, (float (*)[4])matrix, select_id); + ED_gizmo_draw_preset_box(mpr, (float (*)[4])matrix, select_id); } -static void rna_manipulator_draw_preset_arrow( - wmManipulator *mpr, float matrix[16], int axis, int select_id) +static void rna_gizmo_draw_preset_arrow( + wmGizmo *mpr, float matrix[16], int axis, int select_id) { - ED_manipulator_draw_preset_arrow(mpr, (float (*)[4])matrix, axis, select_id); + ED_gizmo_draw_preset_arrow(mpr, (float (*)[4])matrix, axis, select_id); } -static void rna_manipulator_draw_preset_circle( - wmManipulator *mpr, float matrix[16], int axis, int select_id) +static void rna_gizmo_draw_preset_circle( + wmGizmo *mpr, float matrix[16], int axis, int select_id) { - ED_manipulator_draw_preset_circle(mpr, (float (*)[4])matrix, axis, select_id); + ED_gizmo_draw_preset_circle(mpr, (float (*)[4])matrix, axis, select_id); } -static void rna_manipulator_draw_preset_facemap( - wmManipulator *mpr, struct bContext *C, struct Object *ob, int facemap, int select_id) +static void rna_gizmo_draw_preset_facemap( + wmGizmo *mpr, struct bContext *C, struct Object *ob, int facemap, int select_id) { struct Scene *scene = CTX_data_scene(C); - ED_manipulator_draw_preset_facemap(C, mpr, scene, ob, facemap, select_id); + ED_gizmo_draw_preset_facemap(C, mpr, scene, ob, facemap, select_id); } /* -------------------------------------------------------------------- */ -/** \name Manipulator Property Define +/** \name Gizmo Property Define * \{ */ -static void rna_manipulator_target_set_prop( - wmManipulator *mpr, ReportList *reports, const char *target_propname, +static void rna_gizmo_target_set_prop( + wmGizmo *mpr, ReportList *reports, const char *target_propname, PointerRNA *ptr, const char *propname, int index) { - const wmManipulatorPropertyType *mpr_prop_type = - WM_manipulatortype_target_property_find(mpr->type, target_propname); + const wmGizmoPropertyType *mpr_prop_type = + WM_gizmotype_target_property_find(mpr->type, target_propname); if (mpr_prop_type == NULL) { - BKE_reportf(reports, RPT_ERROR, "Manipulator target property '%s.%s' not found", + BKE_reportf(reports, RPT_ERROR, "Gizmo target property '%s.%s' not found", mpr->type->idname, target_propname); return; } @@ -95,13 +95,13 @@ static void rna_manipulator_target_set_prop( } if (mpr_prop_type->data_type != RNA_property_type(prop)) { - const int manipulator_type_index = RNA_enum_from_value(rna_enum_property_type_items, mpr_prop_type->data_type); + const int gizmo_type_index = RNA_enum_from_value(rna_enum_property_type_items, mpr_prop_type->data_type); const int prop_type_index = RNA_enum_from_value(rna_enum_property_type_items, RNA_property_type(prop)); - BLI_assert((manipulator_type_index != -1) && (prop_type_index == -1)); + BLI_assert((gizmo_type_index != -1) && (prop_type_index == -1)); - BKE_reportf(reports, RPT_ERROR, "Manipulator target '%s.%s' expects '%s', '%s.%s' is '%s'", + BKE_reportf(reports, RPT_ERROR, "Gizmo target '%s.%s' expects '%s', '%s.%s' is '%s'", mpr->type->idname, target_propname, - rna_enum_property_type_items[manipulator_type_index].identifier, + rna_enum_property_type_items[gizmo_type_index].identifier, RNA_struct_identifier(ptr->type), propname, rna_enum_property_type_items[prop_type_index].identifier); return; @@ -112,7 +112,7 @@ static void rna_manipulator_target_set_prop( const int prop_array_length = RNA_property_array_length(ptr, prop); if (mpr_prop_type->array_length != prop_array_length) { BKE_reportf(reports, RPT_ERROR, - "Manipulator target property '%s.%s' expects an array of length %d, found %d", + "Gizmo target property '%s.%s' expects an array of length %d, found %d", mpr->type->idname, target_propname, mpr_prop_type->array_length, prop_array_length); @@ -123,7 +123,7 @@ static void rna_manipulator_target_set_prop( else { if (mpr_prop_type->array_length != 1) { BKE_reportf(reports, RPT_ERROR, - "Manipulator target property '%s.%s' expects an array of length %d", + "Gizmo target property '%s.%s' expects an array of length %d", mpr->type->idname, target_propname, mpr_prop_type->array_length); return; @@ -131,16 +131,16 @@ static void rna_manipulator_target_set_prop( } if (index >= mpr_prop_type->array_length) { - BKE_reportf(reports, RPT_ERROR, "Manipulator target property '%s.%s', index %d must be below %d", + BKE_reportf(reports, RPT_ERROR, "Gizmo target property '%s.%s', index %d must be below %d", mpr->type->idname, target_propname, index, mpr_prop_type->array_length); return; } - WM_manipulator_target_property_def_rna_ptr(mpr, mpr_prop_type, ptr, prop, index); + WM_gizmo_target_property_def_rna_ptr(mpr, mpr_prop_type, ptr, prop, index); } -static PointerRNA rna_manipulator_target_set_operator( - wmManipulator *mpr, ReportList *reports, const char *opname, int part_index) +static PointerRNA rna_gizmo_target_set_operator( + wmGizmo *mpr, ReportList *reports, const char *opname, int part_index) { wmOperatorType *ot; @@ -154,36 +154,36 @@ static PointerRNA rna_manipulator_target_set_operator( IDProperty *properties; { IDPropertyTemplate val = {0}; - properties = IDP_New(IDP_GROUP, &val, "wmManipulatorProperties"); + properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties"); } - return *WM_manipulator_operator_set(mpr, part_index, ot, properties); + return *WM_gizmo_operator_set(mpr, part_index, ot, properties); } /** \} */ /* -------------------------------------------------------------------- */ -/** \name Manipulator Property Access +/** \name Gizmo Property Access * \{ */ -static bool rna_manipulator_target_is_valid( - wmManipulator *mpr, ReportList *reports, const char *target_propname) +static bool rna_gizmo_target_is_valid( + wmGizmo *mpr, ReportList *reports, const char *target_propname) { - wmManipulatorProperty *mpr_prop = - WM_manipulator_target_property_find(mpr, target_propname); + wmGizmoProperty *mpr_prop = + WM_gizmo_target_property_find(mpr, target_propname); if (mpr_prop == NULL) { - BKE_reportf(reports, RPT_ERROR, "Manipulator target property '%s.%s' not found", + BKE_reportf(reports, RPT_ERROR, "Gizmo target property '%s.%s' not found", mpr->type->idname, target_propname); return false; } - return WM_manipulator_target_property_is_valid(mpr_prop); + return WM_gizmo_target_property_is_valid(mpr_prop); } /** \} */ #else -void RNA_api_manipulator(StructRNA *srna) +void RNA_api_gizmo(StructRNA *srna) { /* Utility draw functions, since we don't expose new OpenGL drawing wrappers via Python yet. * exactly how these should be exposed isn't totally clear. @@ -198,7 +198,7 @@ void RNA_api_manipulator(StructRNA *srna) /* Primitive Shapes */ /* draw_preset_box */ - func = RNA_def_function(srna, "draw_preset_box", "rna_manipulator_draw_preset_box"); + func = RNA_def_function(srna, "draw_preset_box", "rna_gizmo_draw_preset_box"); RNA_def_function_ui_description(func, "Draw a box"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -207,7 +207,7 @@ void RNA_api_manipulator(StructRNA *srna) RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX); /* draw_preset_box */ - func = RNA_def_function(srna, "draw_preset_arrow", "rna_manipulator_draw_preset_arrow"); + func = RNA_def_function(srna, "draw_preset_arrow", "rna_gizmo_draw_preset_arrow"); RNA_def_function_ui_description(func, "Draw a box"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -216,7 +216,7 @@ void RNA_api_manipulator(StructRNA *srna) RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation"); RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX); - func = RNA_def_function(srna, "draw_preset_circle", "rna_manipulator_draw_preset_circle"); + func = RNA_def_function(srna, "draw_preset_circle", "rna_gizmo_draw_preset_circle"); RNA_def_function_ui_description(func, "Draw a box"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -229,7 +229,7 @@ void RNA_api_manipulator(StructRNA *srna) /* Other Shapes */ /* draw_preset_facemap */ - func = RNA_def_function(srna, "draw_preset_facemap", "rna_manipulator_draw_preset_facemap"); + func = RNA_def_function(srna, "draw_preset_facemap", "rna_gizmo_draw_preset_facemap"); RNA_def_function_ui_description(func, "Draw the face-map of a mesh object"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "object", "Object", "", "Object"); @@ -243,7 +243,7 @@ void RNA_api_manipulator(StructRNA *srna) /* Define Properties */ /* note, 'target_set_handler' is defined in 'bpy_rna_gizmo.c' */ - func = RNA_def_function(srna, "target_set_prop", "rna_manipulator_target_set_prop"); + func = RNA_def_function(srna, "target_set_prop", "rna_gizmo_target_set_prop"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, ""); parm = RNA_def_string(func, "target", NULL, 0, "", "Target property"); @@ -255,10 +255,10 @@ void RNA_api_manipulator(StructRNA *srna) RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_int(func, "index", -1, -1, INT_MAX, "", "", -1, INT_MAX); /* RNA_NO_INDEX == -1 */ - func = RNA_def_function(srna, "target_set_operator", "rna_manipulator_target_set_operator"); + func = RNA_def_function(srna, "target_set_operator", "rna_gizmo_target_set_operator"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description( - func, "Operator to run when activating the manipulator " + func, "Operator to run when activating the gizmo " "(overrides property targets)"); parm = RNA_def_string(func, "operator", NULL, 0, "", "Target operator"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -271,7 +271,7 @@ void RNA_api_manipulator(StructRNA *srna) /* Access Properties */ /* note, 'target_get', 'target_set' is defined in 'bpy_rna_gizmo.c' */ - func = RNA_def_function(srna, "target_is_valid", "rna_manipulator_target_is_valid"); + func = RNA_def_function(srna, "target_is_valid", "rna_gizmo_target_is_valid"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_string(func, "property", NULL, 0, "", "Property identifier"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); @@ -282,7 +282,7 @@ void RNA_api_manipulator(StructRNA *srna) } -void RNA_api_manipulatorgroup(StructRNA *UNUSED(srna)) +void RNA_api_gizmogroup(StructRNA *UNUSED(srna)) { /* nothing yet */ } diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c index eceaaeec3a4..98e84f60b33 100644 --- a/source/blender/makesrna/intern/rna_workspace_api.c +++ b/source/blender/makesrna/intern/rna_workspace_api.c @@ -51,7 +51,7 @@ static void rna_WorkspaceTool_setup( /* Args for: 'bToolRef_Runtime'. */ int cursor, const char *keymap, - const char *manipulator_group, + const char *gizmo_group, const char *data_block, const char *operator, int index) @@ -60,7 +60,7 @@ static void rna_WorkspaceTool_setup( tref_rt.cursor = cursor; STRNCPY(tref_rt.keymap, keymap); - STRNCPY(tref_rt.manipulator_group, manipulator_group); + STRNCPY(tref_rt.gizmo_group, gizmo_group); STRNCPY(tref_rt.data_block, data_block); STRNCPY(tref_rt.operator, operator); tref_rt.index = index; @@ -110,7 +110,7 @@ void RNA_api_workspace_tool(StructRNA *srna) parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(parm, rna_enum_window_cursor_items); RNA_def_string(func, "keymap", NULL, KMAP_MAX_NAME, "Key Map", ""); - RNA_def_string(func, "manipulator_group", NULL, MAX_NAME, "Manipulator Group", ""); + RNA_def_string(func, "gizmo_group", NULL, MAX_NAME, "Gizmo Group", ""); RNA_def_string(func, "data_block", NULL, MAX_NAME, "Data Block", ""); RNA_def_string(func, "operator", NULL, MAX_NAME, "Operator", ""); RNA_def_int(func, "index", 0, INT_MIN, INT_MAX, "Index", "", INT_MIN, INT_MAX); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 3083322d496..07ad8274f11 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -340,7 +340,7 @@ void BPy_init_modules(void) BPY_rna_id_collection_module(mod); - BPY_rna_manipulator_module(mod); + BPY_rna_gizmo_module(mod); bpy_import_test("bpy_types"); PyModule_AddObject(mod, "data", BPY_rna_module()); /* imports bpy_types by running this */ diff --git a/source/blender/python/intern/bpy_gizmo_wrap.c b/source/blender/python/intern/bpy_gizmo_wrap.c index eda1f58a4cc..4b71ea92010 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.c +++ b/source/blender/python/intern/bpy_gizmo_wrap.c @@ -49,12 +49,12 @@ /* -------------------------------------------------------------------- */ -/** \name Manipulator +/** \name Gizmo * \{ */ -static bool bpy_manipulatortype_target_property_def( - wmManipulatorType *wt, PyObject *item) +static bool bpy_gizmotype_target_property_def( + wmGizmoType *wt, PyObject *item) { /* Note: names based on 'rna_rna.c' */ PyObject *empty_tuple = PyTuple_New(0); @@ -102,7 +102,7 @@ static bool bpy_manipulatortype_target_property_def( goto fail; } - WM_manipulatortype_target_property_def(wt, params.id, params.type, params.array_length); + WM_gizmotype_target_property_def(wt, params.id, params.type, params.array_length); Py_DECREF(empty_tuple); return true; @@ -111,7 +111,7 @@ fail: return false; } -static void manipulator_properties_init(wmManipulatorType *wt) +static void gizmo_properties_init(wmGizmoType *wt) { PyTypeObject *py_class = wt->ext.data; RNA_struct_blender_type_set(wt->ext.srna, wt); @@ -149,7 +149,7 @@ static void manipulator_properties_init(wmManipulatorType *wt) PyObject **items = PySequence_Fast_ITEMS(bl_target_properties_fast); for (uint i = 0; i < items_len; i++) { - if (!bpy_manipulatortype_target_property_def(wt, items[i])) { + if (!bpy_gizmotype_target_property_def(wt, items[i])) { PyErr_Print(); PyErr_Clear(); break; @@ -161,25 +161,25 @@ static void manipulator_properties_init(wmManipulatorType *wt) } } -void BPY_RNA_manipulator_wrapper(wmManipulatorType *wt, void *userdata) +void BPY_RNA_gizmo_wrapper(wmGizmoType *wt, void *userdata) { /* take care not to overwrite anything set in - * WM_manipulatormaptype_group_link_ptr before opfunc() is called */ + * WM_gizmomaptype_group_link_ptr before opfunc() is called */ StructRNA *srna = wt->srna; - *wt = *((wmManipulatorType *)userdata); + *wt = *((wmGizmoType *)userdata); wt->srna = srna; /* restore */ /* don't do translations here yet */ #if 0 - /* Use i18n context from ext.srna if possible (py manipulatorgroups). */ + /* Use i18n context from ext.srna if possible (py gizmogroups). */ if (wt->ext.srna) { RNA_def_struct_translation_context(wt->srna, RNA_struct_translation_context(wt->ext.srna)); } #endif - wt->struct_size = sizeof(wmManipulator); + wt->struct_size = sizeof(wmGizmo); - manipulator_properties_init(wt); + gizmo_properties_init(wt); } /** \} */ @@ -187,10 +187,10 @@ void BPY_RNA_manipulator_wrapper(wmManipulatorType *wt, void *userdata) /* -------------------------------------------------------------------- */ -/** \name Manipulator Group +/** \name Gizmo Group * \{ */ -static void manipulatorgroup_properties_init(wmManipulatorGroupType *wgt) +static void gizmogroup_properties_init(wmGizmoGroupType *wgt) { #ifdef USE_SRNA PyTypeObject *py_class = wgt->ext.data; @@ -210,26 +210,26 @@ static void manipulatorgroup_properties_init(wmManipulatorGroupType *wgt) #endif } -void BPY_RNA_manipulatorgroup_wrapper(wmManipulatorGroupType *wgt, void *userdata) +void BPY_RNA_gizmogroup_wrapper(wmGizmoGroupType *wgt, void *userdata) { /* take care not to overwrite anything set in - * WM_manipulatormaptype_group_link_ptr before opfunc() is called */ + * WM_gizmomaptype_group_link_ptr before opfunc() is called */ #ifdef USE_SRNA StructRNA *srna = wgt->srna; #endif - *wgt = *((wmManipulatorGroupType *)userdata); + *wgt = *((wmGizmoGroupType *)userdata); #ifdef USE_SRNA wgt->srna = srna; /* restore */ #endif #ifdef USE_SRNA - /* Use i18n context from ext.srna if possible (py manipulatorgroups). */ + /* Use i18n context from ext.srna if possible (py gizmogroups). */ if (wgt->ext.srna) { RNA_def_struct_translation_context(wgt->srna, RNA_struct_translation_context(wgt->ext.srna)); } #endif - manipulatorgroup_properties_init(wgt); + gizmogroup_properties_init(wgt); } /** \} */ diff --git a/source/blender/python/intern/bpy_gizmo_wrap.h b/source/blender/python/intern/bpy_gizmo_wrap.h index 71fa123d6ce..4d6639d977f 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.h +++ b/source/blender/python/intern/bpy_gizmo_wrap.h @@ -25,11 +25,11 @@ #ifndef __BPY_GIZMO_WRAP_H__ #define __BPY_GIZMO_WRAP_H__ -struct wmManipulatorType; -struct wmManipulatorGroupType; +struct wmGizmoType; +struct wmGizmoGroupType; /* exposed to rna/wm api */ -void BPY_RNA_manipulator_wrapper(struct wmManipulatorType *wt, void *userdata); -void BPY_RNA_manipulatorgroup_wrapper(struct wmManipulatorGroupType *wgt, void *userdata); +void BPY_RNA_gizmo_wrapper(struct wmGizmoType *wt, void *userdata); +void BPY_RNA_gizmogroup_wrapper(struct wmGizmoGroupType *wgt, void *userdata); #endif /* __BPY_GIZMO_WRAP_H__ */ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b288e311633..e0fbd144590 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1853,13 +1853,13 @@ static int pyrna_py_to_prop( { const StructRNA *base_type = RNA_struct_base_child_of(((const BPy_StructRNA *)value)->ptr.type, NULL); - if (ELEM(base_type, &RNA_Operator, &RNA_Manipulator)) { + if (ELEM(base_type, &RNA_Operator, &RNA_Gizmo)) { value = PyObject_GetAttr(value, bpy_intern_str_properties); value_new = value; } } - /* if property is an OperatorProperties/ManipulatorProperties pointer and value is a map, + /* if property is an OperatorProperties/GizmoProperties pointer and value is a map, * forward back to pyrna_pydict_to_props */ if (PyDict_Check(value)) { const StructRNA *base_type = RNA_struct_base_child_of(ptr_type, NULL); @@ -1867,7 +1867,7 @@ static int pyrna_py_to_prop( PointerRNA opptr = RNA_property_pointer_get(ptr, prop); return pyrna_pydict_to_props(&opptr, value, false, error_prefix); } - else if (base_type == &RNA_ManipulatorProperties) { + else if (base_type == &RNA_GizmoProperties) { PointerRNA opptr = RNA_property_pointer_get(ptr, prop); return pyrna_pydict_to_props(&opptr, value, false, error_prefix); } @@ -7738,7 +7738,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param #ifdef USE_PEDANTIC_WRITE const bool is_readonly_init = !(RNA_struct_is_a(ptr->type, &RNA_Operator) || - RNA_struct_is_a(ptr->type, &RNA_Manipulator)); + RNA_struct_is_a(ptr->type, &RNA_Gizmo)); // const char *func_id = RNA_function_identifier(func); /* UNUSED */ /* testing, for correctness, not operator and not draw function */ const bool is_readonly = !(RNA_function_flag(func) & FUNC_ALLOW_WRITE); diff --git a/source/blender/python/intern/bpy_rna_gizmo.c b/source/blender/python/intern/bpy_rna_gizmo.c index 34a4594bdae..e834595114a 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.c +++ b/source/blender/python/intern/bpy_rna_gizmo.c @@ -51,29 +51,29 @@ /* -------------------------------------------------------------------- */ -/** \name Manipulator Target Property Define API +/** \name Gizmo Target Property Define API * \{ */ enum { - BPY_MANIPULATOR_FN_SLOT_GET = 0, - BPY_MANIPULATOR_FN_SLOT_SET, - BPY_MANIPULATOR_FN_SLOT_RANGE_GET, + BPY_GIZMO_FN_SLOT_GET = 0, + BPY_GIZMO_FN_SLOT_SET, + BPY_GIZMO_FN_SLOT_RANGE_GET, }; -#define BPY_MANIPULATOR_FN_SLOT_LEN (BPY_MANIPULATOR_FN_SLOT_RANGE_GET + 1) +#define BPY_GIZMO_FN_SLOT_LEN (BPY_GIZMO_FN_SLOT_RANGE_GET + 1) -struct BPyManipulatorHandlerUserData { +struct BPyGizmoHandlerUserData { - PyObject *fn_slots[BPY_MANIPULATOR_FN_SLOT_LEN]; + PyObject *fn_slots[BPY_GIZMO_FN_SLOT_LEN]; }; -static void py_rna_manipulator_handler_get_cb( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void py_rna_gizmo_handler_get_cb( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, void *value_p) { PyGILState_STATE gilstate = PyGILState_Ensure(); - struct BPyManipulatorHandlerUserData *data = mpr_prop->custom_func.user_data; - PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_MANIPULATOR_FN_SLOT_GET], NULL); + struct BPyGizmoHandlerUserData *data = mpr_prop->custom_func.user_data; + PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_GIZMO_FN_SLOT_GET], NULL); if (ret == NULL) { goto fail; } @@ -87,7 +87,7 @@ static void py_rna_manipulator_handler_get_cb( } else { if (PyC_AsArray(value, ret, mpr_prop->type->array_length, &PyFloat_Type, false, - "Manipulator get callback: ") == -1) + "Gizmo get callback: ") == -1) { goto fail; } @@ -110,13 +110,13 @@ fail: PyGILState_Release(gilstate); } -static void py_rna_manipulator_handler_set_cb( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void py_rna_gizmo_handler_set_cb( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, const void *value_p) { PyGILState_STATE gilstate = PyGILState_Ensure(); - struct BPyManipulatorHandlerUserData *data = mpr_prop->custom_func.user_data; + struct BPyGizmoHandlerUserData *data = mpr_prop->custom_func.user_data; PyObject *args = PyTuple_New(1); @@ -139,7 +139,7 @@ static void py_rna_manipulator_handler_set_cb( goto fail; } - PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_MANIPULATOR_FN_SLOT_SET], args); + PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_GIZMO_FN_SLOT_SET], args); if (ret == NULL) { goto fail; } @@ -157,15 +157,15 @@ fail: PyGILState_Release(gilstate); } -static void py_rna_manipulator_handler_range_get_cb( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop, +static void py_rna_gizmo_handler_range_get_cb( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop, void *value_p) { - struct BPyManipulatorHandlerUserData *data = mpr_prop->custom_func.user_data; + struct BPyGizmoHandlerUserData *data = mpr_prop->custom_func.user_data; PyGILState_STATE gilstate = PyGILState_Ensure(); - PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_MANIPULATOR_FN_SLOT_RANGE_GET], NULL); + PyObject *ret = PyObject_CallObject(data->fn_slots[BPY_GIZMO_FN_SLOT_RANGE_GET], NULL); if (ret == NULL) { goto fail; } @@ -214,13 +214,13 @@ fail: PyGILState_Release(gilstate); } -static void py_rna_manipulator_handler_free_cb( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop) +static void py_rna_gizmo_handler_free_cb( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop) { - struct BPyManipulatorHandlerUserData *data = mpr_prop->custom_func.user_data; + struct BPyGizmoHandlerUserData *data = mpr_prop->custom_func.user_data; PyGILState_STATE gilstate = PyGILState_Ensure(); - for (int i = 0; i < BPY_MANIPULATOR_FN_SLOT_LEN; i++) { + for (int i = 0; i < BPY_GIZMO_FN_SLOT_LEN; i++) { Py_XDECREF(data->fn_slots[i]); } PyGILState_Release(gilstate); @@ -229,26 +229,26 @@ static void py_rna_manipulator_handler_free_cb( } -PyDoc_STRVAR(bpy_manipulator_target_set_handler_doc, +PyDoc_STRVAR(bpy_gizmo_target_set_handler_doc, ".. method:: target_set_handler(target, get, set, range=None):\n" "\n" -" Assigns callbacks to a manipulators property.\n" +" Assigns callbacks to a gizmos property.\n" "\n" " :arg get: Function that returns the value for this property (single value or sequence).\n" " :type get: callable\n" " :arg set: Function that takes a single value argument and applies it.\n" " :type set: callable\n" -" :arg range: Function that returns a (min, max) tuple for manipulators that use a range.\n" +" :arg range: Function that returns a (min, max) tuple for gizmos that use a range.\n" " :type range: callable\n" ); -static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyObject *args, PyObject *kw) +static PyObject *bpy_gizmo_target_set_handler(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { PyGILState_STATE gilstate = PyGILState_Ensure(); struct { PyObject *self; char *target; - PyObject *py_fn_slots[BPY_MANIPULATOR_FN_SLOT_LEN]; + PyObject *py_fn_slots[BPY_GIZMO_FN_SLOT_LEN]; } params = { .self = NULL, .target = NULL, @@ -256,28 +256,28 @@ static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyOb }; /* Note: this is a counter-part to functions: - * 'Manipulator.target_set_prop & target_set_operator' - * (see: rna_wm_manipulator_api.c). conventions should match. */ + * 'Gizmo.target_set_prop & target_set_operator' + * (see: rna_wm_gizmo_api.c). conventions should match. */ static const char * const _keywords[] = {"self", "target", "get", "set", "range", NULL}; static _PyArg_Parser _parser = {"Os|$OOO:target_set_handler", _keywords, 0}; if (!_PyArg_ParseTupleAndKeywordsFast( args, kw, &_parser, ¶ms.self, ¶ms.target, - ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_GET], - ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_SET], - ¶ms.py_fn_slots[BPY_MANIPULATOR_FN_SLOT_RANGE_GET])) + ¶ms.py_fn_slots[BPY_GIZMO_FN_SLOT_GET], + ¶ms.py_fn_slots[BPY_GIZMO_FN_SLOT_SET], + ¶ms.py_fn_slots[BPY_GIZMO_FN_SLOT_RANGE_GET])) { goto fail; } - wmManipulator *mpr = ((BPy_StructRNA *)params.self)->ptr.data; + wmGizmo *mpr = ((BPy_StructRNA *)params.self)->ptr.data; - const wmManipulatorPropertyType *mpr_prop_type = - WM_manipulatortype_target_property_find(mpr->type, params.target); + const wmGizmoPropertyType *mpr_prop_type = + WM_gizmotype_target_property_find(mpr->type, params.target); if (mpr_prop_type == NULL) { PyErr_Format(PyExc_ValueError, - "Manipulator target property '%s.%s' not found", + "Gizmo target property '%s.%s' not found", mpr->type->idname, params.target); goto fail; } @@ -285,7 +285,7 @@ static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyOb { const int slots_required = 2; const int slots_start = 2; - for (int i = 0; i < BPY_MANIPULATOR_FN_SLOT_LEN; i++) { + for (int i = 0; i < BPY_GIZMO_FN_SLOT_LEN; i++) { if (params.py_fn_slots[i] == NULL) { if (i < slots_required) { PyErr_Format(PyExc_ValueError, "Argument '%s' not given", _keywords[slots_start + i]); @@ -299,20 +299,20 @@ static PyObject *bpy_manipulator_target_set_handler(PyObject *UNUSED(self), PyOb } } - struct BPyManipulatorHandlerUserData *data = MEM_callocN(sizeof(*data), __func__); + struct BPyGizmoHandlerUserData *data = MEM_callocN(sizeof(*data), __func__); - for (int i = 0; i < BPY_MANIPULATOR_FN_SLOT_LEN; i++) { + for (int i = 0; i < BPY_GIZMO_FN_SLOT_LEN; i++) { data->fn_slots[i] = params.py_fn_slots[i]; Py_XINCREF(params.py_fn_slots[i]); } - WM_manipulator_target_property_def_func_ptr( + WM_gizmo_target_property_def_func_ptr( mpr, mpr_prop_type, - &(const struct wmManipulatorPropertyFnParams) { - .value_get_fn = py_rna_manipulator_handler_get_cb, - .value_set_fn = py_rna_manipulator_handler_set_cb, - .range_get_fn = py_rna_manipulator_handler_range_get_cb, - .free_fn = py_rna_manipulator_handler_free_cb, + &(const struct wmGizmoPropertyFnParams) { + .value_get_fn = py_rna_gizmo_handler_get_cb, + .value_set_fn = py_rna_gizmo_handler_set_cb, + .range_get_fn = py_rna_gizmo_handler_range_get_cb, + .free_fn = py_rna_gizmo_handler_free_cb, .user_data = data, }); @@ -328,10 +328,10 @@ fail: /** \} */ /* -------------------------------------------------------------------- */ -/** \name Manipulator Target Property Access API +/** \name Gizmo Target Property Access API * \{ */ -PyDoc_STRVAR(bpy_manipulator_target_get_value_doc, +PyDoc_STRVAR(bpy_gizmo_target_get_value_doc, ".. method:: target_get_value(target):\n" "\n" " Get the value of this target property.\n" @@ -341,7 +341,7 @@ PyDoc_STRVAR(bpy_manipulator_target_get_value_doc, " :return: The value of the target property.\n" " :rtype: Single value or array based on the target type\n" ); -static PyObject *bpy_manipulator_target_get_value(PyObject *UNUSED(self), PyObject *args, PyObject *kw) +static PyObject *bpy_gizmo_target_get_value(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { struct { PyObject *self; @@ -361,28 +361,28 @@ static PyObject *bpy_manipulator_target_get_value(PyObject *UNUSED(self), PyObje goto fail; } - wmManipulator *mpr = ((BPy_StructRNA *)params.self)->ptr.data; + wmGizmo *mpr = ((BPy_StructRNA *)params.self)->ptr.data; - wmManipulatorProperty *mpr_prop = - WM_manipulator_target_property_find(mpr, params.target); + wmGizmoProperty *mpr_prop = + WM_gizmo_target_property_find(mpr, params.target); if (mpr_prop == NULL) { PyErr_Format(PyExc_ValueError, - "Manipulator target property '%s.%s' not found", + "Gizmo target property '%s.%s' not found", mpr->type->idname, params.target); goto fail; } - const int array_len = WM_manipulator_target_property_array_length(mpr, mpr_prop); + const int array_len = WM_gizmo_target_property_array_length(mpr, mpr_prop); switch (mpr_prop->type->data_type) { case PROP_FLOAT: { if (array_len != 0) { float *value = BLI_array_alloca(value, array_len); - WM_manipulator_target_property_value_get_array(mpr, mpr_prop, value); + WM_gizmo_target_property_value_get_array(mpr, mpr_prop, value); return PyC_Tuple_PackArray_F32(value, array_len); } else { - float value = WM_manipulator_target_property_value_get(mpr, mpr_prop); + float value = WM_gizmo_target_property_value_get(mpr, mpr_prop); return PyFloat_FromDouble(value); } break; @@ -398,7 +398,7 @@ fail: return NULL; } -PyDoc_STRVAR(bpy_manipulator_target_set_value_doc, +PyDoc_STRVAR(bpy_gizmo_target_set_value_doc, ".. method:: target_set_value(target):\n" "\n" " Set the value of this target property.\n" @@ -406,7 +406,7 @@ PyDoc_STRVAR(bpy_manipulator_target_set_value_doc, " :arg target: Target property name.\n" " :type target: string\n" ); -static PyObject *bpy_manipulator_target_set_value(PyObject *UNUSED(self), PyObject *args, PyObject *kw) +static PyObject *bpy_gizmo_target_set_value(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { struct { PyObject *self; @@ -429,36 +429,36 @@ static PyObject *bpy_manipulator_target_set_value(PyObject *UNUSED(self), PyObje goto fail; } - wmManipulator *mpr = ((BPy_StructRNA *)params.self)->ptr.data; + wmGizmo *mpr = ((BPy_StructRNA *)params.self)->ptr.data; - wmManipulatorProperty *mpr_prop = - WM_manipulator_target_property_find(mpr, params.target); + wmGizmoProperty *mpr_prop = + WM_gizmo_target_property_find(mpr, params.target); if (mpr_prop == NULL) { PyErr_Format(PyExc_ValueError, - "Manipulator target property '%s.%s' not found", + "Gizmo target property '%s.%s' not found", mpr->type->idname, params.target); goto fail; } - const int array_len = WM_manipulator_target_property_array_length(mpr, mpr_prop); + const int array_len = WM_gizmo_target_property_array_length(mpr, mpr_prop); switch (mpr_prop->type->data_type) { case PROP_FLOAT: { if (array_len != 0) { float *value = BLI_array_alloca(value, array_len); if (PyC_AsArray(value, params.value, mpr_prop->type->array_length, &PyFloat_Type, false, - "Manipulator target property array") == -1) + "Gizmo target property array") == -1) { goto fail; } - WM_manipulator_target_property_value_set_array(BPy_GetContext(), mpr, mpr_prop, value); + WM_gizmo_target_property_value_set_array(BPy_GetContext(), mpr, mpr_prop, value); } else { float value; if ((value = PyFloat_AsDouble(params.value)) == -1.0f && PyErr_Occurred()) { goto fail; } - WM_manipulator_target_property_value_set(BPy_GetContext(), mpr, mpr_prop, value); + WM_gizmo_target_property_value_set(BPy_GetContext(), mpr, mpr_prop, value); } Py_RETURN_NONE; } @@ -474,7 +474,7 @@ fail: } -PyDoc_STRVAR(bpy_manipulator_target_get_range_doc, +PyDoc_STRVAR(bpy_gizmo_target_get_range_doc, ".. method:: target_get_range(target):\n" "\n" " Get the range for this target property.\n" @@ -484,7 +484,7 @@ PyDoc_STRVAR(bpy_manipulator_target_get_range_doc, " :return: The range of this property (min, max).\n" " :rtype: tuple pair.\n" ); -static PyObject *bpy_manipulator_target_get_range(PyObject *UNUSED(self), PyObject *args, PyObject *kw) +static PyObject *bpy_gizmo_target_get_range(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { struct { PyObject *self; @@ -504,13 +504,13 @@ static PyObject *bpy_manipulator_target_get_range(PyObject *UNUSED(self), PyObje goto fail; } - wmManipulator *mpr = ((BPy_StructRNA *)params.self)->ptr.data; + wmGizmo *mpr = ((BPy_StructRNA *)params.self)->ptr.data; - wmManipulatorProperty *mpr_prop = - WM_manipulator_target_property_find(mpr, params.target); + wmGizmoProperty *mpr_prop = + WM_gizmo_target_property_find(mpr, params.target); if (mpr_prop == NULL) { PyErr_Format(PyExc_ValueError, - "Manipulator target property '%s.%s' not found", + "Gizmo target property '%s.%s' not found", mpr->type->idname, params.target); goto fail; } @@ -519,7 +519,7 @@ static PyObject *bpy_manipulator_target_get_range(PyObject *UNUSED(self), PyObje case PROP_FLOAT: { float range[2]; - WM_manipulator_target_property_range_get(mpr, mpr_prop, range); + WM_gizmo_target_property_range_get(mpr, mpr_prop, range); return PyC_Tuple_PackArray_F32(range, 2); } default: @@ -535,19 +535,19 @@ fail: /** \} */ -int BPY_rna_manipulator_module(PyObject *mod_par) +int BPY_rna_gizmo_module(PyObject *mod_par) { static PyMethodDef method_def_array[] = { - /* Manipulator Target Property Define API */ - {"target_set_handler", (PyCFunction)bpy_manipulator_target_set_handler, - METH_VARARGS | METH_KEYWORDS, bpy_manipulator_target_set_handler_doc}, - /* Manipulator Target Property Access API */ - {"target_get_value", (PyCFunction)bpy_manipulator_target_get_value, - METH_VARARGS | METH_KEYWORDS, bpy_manipulator_target_get_value_doc}, - {"target_set_value", (PyCFunction)bpy_manipulator_target_set_value, - METH_VARARGS | METH_KEYWORDS, bpy_manipulator_target_set_value_doc}, - {"target_get_range", (PyCFunction)bpy_manipulator_target_get_range, - METH_VARARGS | METH_KEYWORDS, bpy_manipulator_target_get_range_doc}, + /* Gizmo Target Property Define API */ + {"target_set_handler", (PyCFunction)bpy_gizmo_target_set_handler, + METH_VARARGS | METH_KEYWORDS, bpy_gizmo_target_set_handler_doc}, + /* Gizmo Target Property Access API */ + {"target_get_value", (PyCFunction)bpy_gizmo_target_get_value, + METH_VARARGS | METH_KEYWORDS, bpy_gizmo_target_get_value_doc}, + {"target_set_value", (PyCFunction)bpy_gizmo_target_set_value, + METH_VARARGS | METH_KEYWORDS, bpy_gizmo_target_set_value_doc}, + {"target_get_range", (PyCFunction)bpy_gizmo_target_get_range, + METH_VARARGS | METH_KEYWORDS, bpy_gizmo_target_get_range_doc}, /* no sentinel needed. */ }; @@ -556,7 +556,7 @@ int BPY_rna_manipulator_module(PyObject *mod_par) PyObject *func = PyCFunction_New(m, NULL); PyObject *func_inst = PyInstanceMethod_New(func); char name_prefix[128]; - PyOS_snprintf(name_prefix, sizeof(name_prefix), "_rna_manipulator_%s", m->ml_name); + PyOS_snprintf(name_prefix, sizeof(name_prefix), "_rna_gizmo_%s", m->ml_name); /* TODO, return a type that binds nearly to a method. */ PyModule_AddObject(mod_par, name_prefix, func_inst); } diff --git a/source/blender/python/intern/bpy_rna_gizmo.h b/source/blender/python/intern/bpy_rna_gizmo.h index e848fd9800f..68d8c1e052a 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.h +++ b/source/blender/python/intern/bpy_rna_gizmo.h @@ -27,6 +27,6 @@ #ifndef __BPY_RNA_GIZMO_H__ #define __BPY_RNA_GIZMO_H__ -int BPY_rna_manipulator_module(PyObject *); +int BPY_rna_gizmo_module(PyObject *); #endif /* __BPY_RNA_GIZMO_H__ */ diff --git a/source/blender/python/intern/gpu_py_select.c b/source/blender/python/intern/gpu_py_select.c index f570c4cdae2..fcdcce24935 100644 --- a/source/blender/python/intern/gpu_py_select.c +++ b/source/blender/python/intern/gpu_py_select.c @@ -23,7 +23,7 @@ * * This file defines the gpu.select API. * - * \note Currently only used for manipulator selection, + * \note Currently only used for gizmo selection, * will need to add begin/end and a way to access the hits. */ diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 32900b75514..67ca5f8a08a 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -77,9 +77,9 @@ struct wmNDOFMotionData; #endif typedef struct wmJob wmJob; -typedef struct wmManipulator wmManipulator; -typedef struct wmManipulatorMap wmManipulatorMap; -typedef struct wmManipulatorMapType wmManipulatorMapType; +typedef struct wmGizmo wmGizmo; +typedef struct wmGizmoMap wmGizmoMap; +typedef struct wmGizmoMapType wmGizmoMapType; /* general API */ void WM_init_state_size_set (int stax, int stay, int sizx, int sizy); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 486eae0a0ed..a5536dbd652 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -123,7 +123,7 @@ struct ImBuf; #include "wm_event_types.h" #include "gizmo/WM_gizmo_types.h" -/* Include external manipulator API's */ +/* Include external gizmo API's */ #include "gizmo/WM_gizmo_api.h" /* ************** wmOperatorType ************************ */ diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index ffd18af496e..1d2abab8af4 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -26,8 +26,8 @@ /** \file blender/windowmanager/gizmos/WM_gizmo_api.h * \ingroup wm * - * \name Manipulator API - * \brief API for external use of wmManipulator types. + * \name Gizmo API + * \brief API for external use of wmGizmo types. * * Only included in WM_api.h */ @@ -42,302 +42,302 @@ struct IDProperty; struct Main; struct PropertyRNA; struct wmKeyConfig; -struct wmManipulator; -struct wmManipulatorProperty; -struct wmManipulatorPropertyType; -struct wmManipulatorType; -struct wmManipulatorGroup; -struct wmManipulatorGroupType; -struct wmManipulatorMap; -struct wmManipulatorMapType; -struct wmManipulatorMapType_Params; +struct wmGizmo; +struct wmGizmoProperty; +struct wmGizmoPropertyType; +struct wmGizmoType; +struct wmGizmoGroup; +struct wmGizmoGroupType; +struct wmGizmoMap; +struct wmGizmoMapType; +struct wmGizmoMapType_Params; struct wmMsgSubscribeKey; struct wmMsgSubscribeValue; #include "wm_gizmo_fn.h" /* -------------------------------------------------------------------- */ -/* wmManipulator */ +/* wmGizmo */ -struct wmManipulator *WM_manipulator_new_ptr( - const struct wmManipulatorType *wt, struct wmManipulatorGroup *mgroup, +struct wmGizmo *WM_gizmo_new_ptr( + const struct wmGizmoType *wt, struct wmGizmoGroup *mgroup, struct PointerRNA *properties); -struct wmManipulator *WM_manipulator_new( - const char *idname, struct wmManipulatorGroup *mgroup, +struct wmGizmo *WM_gizmo_new( + const char *idname, struct wmGizmoGroup *mgroup, struct PointerRNA *properties); -void WM_manipulator_free(struct wmManipulator *mpr); -void WM_manipulator_unlink( - ListBase *manipulatorlist, struct wmManipulatorMap *mmap, struct wmManipulator *mpr, +void WM_gizmo_free(struct wmGizmo *mpr); +void WM_gizmo_unlink( + ListBase *gizmolist, struct wmGizmoMap *mmap, struct wmGizmo *mpr, struct bContext *C); -void WM_manipulator_name_set(struct wmManipulatorGroup *mgroup, struct wmManipulator *mpr, const char *name); +void WM_gizmo_name_set(struct wmGizmoGroup *mgroup, struct wmGizmo *mpr, const char *name); -bool WM_manipulator_select_unlink(struct wmManipulatorMap *mmap, struct wmManipulator *mpr); -bool WM_manipulator_select_set(struct wmManipulatorMap *mmap, struct wmManipulator *mpr, bool select); -void WM_manipulator_highlight_set(struct wmManipulatorMap *mmap, struct wmManipulator *mpr); +bool WM_gizmo_select_unlink(struct wmGizmoMap *mmap, struct wmGizmo *mpr); +bool WM_gizmo_select_set(struct wmGizmoMap *mmap, struct wmGizmo *mpr, bool select); +void WM_gizmo_highlight_set(struct wmGizmoMap *mmap, struct wmGizmo *mpr); -void WM_manipulator_modal_set_from_setup( - struct wmManipulatorMap *mmap, struct bContext *C, - struct wmManipulator *mpr, int part_index, const struct wmEvent *event); +void WM_gizmo_modal_set_from_setup( + struct wmGizmoMap *mmap, struct bContext *C, + struct wmGizmo *mpr, int part_index, const struct wmEvent *event); -struct wmManipulatorOpElem *WM_manipulator_operator_get( - struct wmManipulator *mpr, int part_index); -struct PointerRNA *WM_manipulator_operator_set( - struct wmManipulator *mpr, int part_index, +struct wmGizmoOpElem *WM_gizmo_operator_get( + struct wmGizmo *mpr, int part_index); +struct PointerRNA *WM_gizmo_operator_set( + struct wmGizmo *mpr, int part_index, struct wmOperatorType *ot, struct IDProperty *properties); /* callbacks */ -void WM_manipulator_set_fn_custom_modal(struct wmManipulator *mpr, wmManipulatorFnModal fn); - -void WM_manipulator_set_matrix_location( - struct wmManipulator *mpr, const float origin[3]); -void WM_manipulator_set_matrix_rotation_from_z_axis( - struct wmManipulator *mpr, const float z_axis[3]); -void WM_manipulator_set_matrix_rotation_from_yz_axis( - struct wmManipulator *mpr, const float y_axis[3], const float z_axis[3]); - -void WM_manipulator_set_matrix_offset_location( - struct wmManipulator *mpr, const float origin[3]); -void WM_manipulator_set_matrix_offset_rotation_from_z_axis( - struct wmManipulator *mpr, const float z_axis[3]); -void WM_manipulator_set_matrix_offset_rotation_from_yz_axis( - struct wmManipulator *mpr, const float y_axis[3], const float z_axis[3]); - -void WM_manipulator_set_flag(struct wmManipulator *mpr, const int flag, const bool enable); -void WM_manipulator_set_scale(struct wmManipulator *mpr, float scale); -void WM_manipulator_set_line_width(struct wmManipulator *mpr, const float line_width); - -void WM_manipulator_get_color(const struct wmManipulator *mpr, float color[4]); -void WM_manipulator_set_color(struct wmManipulator *mpr, const float color[4]); -void WM_manipulator_get_color_highlight(const struct wmManipulator *mpr, float color_hi[4]); -void WM_manipulator_set_color_highlight(struct wmManipulator *mpr, const float color[4]); +void WM_gizmo_set_fn_custom_modal(struct wmGizmo *mpr, wmGizmoFnModal fn); + +void WM_gizmo_set_matrix_location( + struct wmGizmo *mpr, const float origin[3]); +void WM_gizmo_set_matrix_rotation_from_z_axis( + struct wmGizmo *mpr, const float z_axis[3]); +void WM_gizmo_set_matrix_rotation_from_yz_axis( + struct wmGizmo *mpr, const float y_axis[3], const float z_axis[3]); + +void WM_gizmo_set_matrix_offset_location( + struct wmGizmo *mpr, const float origin[3]); +void WM_gizmo_set_matrix_offset_rotation_from_z_axis( + struct wmGizmo *mpr, const float z_axis[3]); +void WM_gizmo_set_matrix_offset_rotation_from_yz_axis( + struct wmGizmo *mpr, const float y_axis[3], const float z_axis[3]); + +void WM_gizmo_set_flag(struct wmGizmo *mpr, const int flag, const bool enable); +void WM_gizmo_set_scale(struct wmGizmo *mpr, float scale); +void WM_gizmo_set_line_width(struct wmGizmo *mpr, const float line_width); + +void WM_gizmo_get_color(const struct wmGizmo *mpr, float color[4]); +void WM_gizmo_set_color(struct wmGizmo *mpr, const float color[4]); +void WM_gizmo_get_color_highlight(const struct wmGizmo *mpr, float color_hi[4]); +void WM_gizmo_set_color_highlight(struct wmGizmo *mpr, const float color[4]); /** - * Leaving values NULL use values from #wmManipulator. + * Leaving values NULL use values from #wmGizmo. */ -struct WM_ManipulatorMatrixParams { +struct WM_GizmoMatrixParams { const float(*matrix_space)[4]; const float(*matrix_basis)[4]; const float(*matrix_offset)[4]; const float *scale_final; }; -void WM_manipulator_calc_matrix_final_params( - const struct wmManipulator *mpr, const struct WM_ManipulatorMatrixParams *params, +void WM_gizmo_calc_matrix_final_params( + const struct wmGizmo *mpr, const struct WM_GizmoMatrixParams *params, float r_mat[4][4]); -void WM_manipulator_calc_matrix_final_no_offset( - const struct wmManipulator *mpr, float r_mat[4][4]); +void WM_gizmo_calc_matrix_final_no_offset( + const struct wmGizmo *mpr, float r_mat[4][4]); -void WM_manipulator_calc_matrix_final( - const struct wmManipulator *mpr, float r_mat[4][4]); +void WM_gizmo_calc_matrix_final( + const struct wmGizmo *mpr, float r_mat[4][4]); /* properties */ -void WM_manipulator_properties_create_ptr(struct PointerRNA *ptr, struct wmManipulatorType *wt); -void WM_manipulator_properties_create(struct PointerRNA *ptr, const char *opstring); -void WM_manipulator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *wtstring); -void WM_manipulator_properties_sanitize(struct PointerRNA *ptr, const bool no_context); -bool WM_manipulator_properties_default(struct PointerRNA *ptr, const bool do_update); -void WM_manipulator_properties_reset(struct wmManipulator *op); -void WM_manipulator_properties_clear(struct PointerRNA *ptr); -void WM_manipulator_properties_free(struct PointerRNA *ptr); - - -/* wm_manipulator_type.c */ -const struct wmManipulatorType *WM_manipulatortype_find(const char *idname, bool quiet); -void WM_manipulatortype_append(void (*wtfunc)(struct wmManipulatorType *)); -void WM_manipulatortype_append_ptr(void (*mnpfunc)(struct wmManipulatorType *, void *), void *userdata); -bool WM_manipulatortype_remove(struct bContext *C, struct Main *bmain, const char *idname); -void WM_manipulatortype_remove_ptr(struct bContext *C, struct Main *bmain, struct wmManipulatorType *wt); -void WM_manipulatortype_iter(struct GHashIterator *ghi); - -/* wm_manipulator_group_type.c */ -struct wmManipulatorGroupType *WM_manipulatorgrouptype_find(const char *idname, bool quiet); -struct wmManipulatorGroupType *WM_manipulatorgrouptype_append(void (*wtfunc)(struct wmManipulatorGroupType *)); -struct wmManipulatorGroupType *WM_manipulatorgrouptype_append_ptr(void (*mnpfunc)(struct wmManipulatorGroupType *, void *), void *userdata); -bool WM_manipulatorgrouptype_free(const char *idname); -void WM_manipulatorgrouptype_free_ptr(struct wmManipulatorGroupType *wt); -void WM_manipulatorgrouptype_iter(struct GHashIterator *ghi); - -struct wmManipulatorGroupTypeRef *WM_manipulatorgrouptype_append_and_link( - struct wmManipulatorMapType *mmap_type, - void (*wtfunc)(struct wmManipulatorGroupType *)); - -/* wm_manipulator_map.c */ +void WM_gizmo_properties_create_ptr(struct PointerRNA *ptr, struct wmGizmoType *wt); +void WM_gizmo_properties_create(struct PointerRNA *ptr, const char *opstring); +void WM_gizmo_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *wtstring); +void WM_gizmo_properties_sanitize(struct PointerRNA *ptr, const bool no_context); +bool WM_gizmo_properties_default(struct PointerRNA *ptr, const bool do_update); +void WM_gizmo_properties_reset(struct wmGizmo *op); +void WM_gizmo_properties_clear(struct PointerRNA *ptr); +void WM_gizmo_properties_free(struct PointerRNA *ptr); + + +/* wm_gizmo_type.c */ +const struct wmGizmoType *WM_gizmotype_find(const char *idname, bool quiet); +void WM_gizmotype_append(void (*wtfunc)(struct wmGizmoType *)); +void WM_gizmotype_append_ptr(void (*mnpfunc)(struct wmGizmoType *, void *), void *userdata); +bool WM_gizmotype_remove(struct bContext *C, struct Main *bmain, const char *idname); +void WM_gizmotype_remove_ptr(struct bContext *C, struct Main *bmain, struct wmGizmoType *wt); +void WM_gizmotype_iter(struct GHashIterator *ghi); + +/* wm_gizmo_group_type.c */ +struct wmGizmoGroupType *WM_gizmogrouptype_find(const char *idname, bool quiet); +struct wmGizmoGroupType *WM_gizmogrouptype_append(void (*wtfunc)(struct wmGizmoGroupType *)); +struct wmGizmoGroupType *WM_gizmogrouptype_append_ptr(void (*mnpfunc)(struct wmGizmoGroupType *, void *), void *userdata); +bool WM_gizmogrouptype_free(const char *idname); +void WM_gizmogrouptype_free_ptr(struct wmGizmoGroupType *wt); +void WM_gizmogrouptype_iter(struct GHashIterator *ghi); + +struct wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link( + struct wmGizmoMapType *mmap_type, + void (*wtfunc)(struct wmGizmoGroupType *)); + +/* wm_gizmo_map.c */ /* Dynamic Updates (for RNA runtime registration) */ -void WM_manipulatorconfig_update_tag_init(struct wmManipulatorMapType *mmap_type, struct wmManipulatorGroupType *wgt); -void WM_manipulatorconfig_update_tag_remove(struct wmManipulatorMapType *mmap_type, struct wmManipulatorGroupType *wgt); -void WM_manipulatorconfig_update(struct Main *bmain); +void WM_gizmoconfig_update_tag_init(struct wmGizmoMapType *mmap_type, struct wmGizmoGroupType *wgt); +void WM_gizmoconfig_update_tag_remove(struct wmGizmoMapType *mmap_type, struct wmGizmoGroupType *wgt); +void WM_gizmoconfig_update(struct Main *bmain); /* wm_maniulator_target_props.c */ -struct wmManipulatorProperty *WM_manipulator_target_property_array(struct wmManipulator *mpr); -struct wmManipulatorProperty *WM_manipulator_target_property_at_index( - struct wmManipulator *mpr, int index); -struct wmManipulatorProperty *WM_manipulator_target_property_find( - struct wmManipulator *mpr, const char *idname); - -void WM_manipulator_target_property_def_rna_ptr( - struct wmManipulator *mpr, const struct wmManipulatorPropertyType *mpr_prop_type, +struct wmGizmoProperty *WM_gizmo_target_property_array(struct wmGizmo *mpr); +struct wmGizmoProperty *WM_gizmo_target_property_at_index( + struct wmGizmo *mpr, int index); +struct wmGizmoProperty *WM_gizmo_target_property_find( + struct wmGizmo *mpr, const char *idname); + +void WM_gizmo_target_property_def_rna_ptr( + struct wmGizmo *mpr, const struct wmGizmoPropertyType *mpr_prop_type, struct PointerRNA *ptr, struct PropertyRNA *prop, int index); -void WM_manipulator_target_property_def_rna( - struct wmManipulator *mpr, const char *idname, +void WM_gizmo_target_property_def_rna( + struct wmGizmo *mpr, const char *idname, struct PointerRNA *ptr, const char *propname, int index); -void WM_manipulator_target_property_def_func_ptr( - struct wmManipulator *mpr, const struct wmManipulatorPropertyType *mpr_prop_type, - const struct wmManipulatorPropertyFnParams *params); -void WM_manipulator_target_property_def_func( - struct wmManipulator *mpr, const char *idname, - const struct wmManipulatorPropertyFnParams *params); - -void WM_manipulator_target_property_clear_rna_ptr( - struct wmManipulator *mpr, const struct wmManipulatorPropertyType *mpr_prop_type); -void WM_manipulator_target_property_clear_rna( - struct wmManipulator *mpr, const char *idname); - -bool WM_manipulator_target_property_is_valid_any(struct wmManipulator *mpr); -bool WM_manipulator_target_property_is_valid( - const struct wmManipulatorProperty *mpr_prop); -float WM_manipulator_target_property_value_get( - const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop); -void WM_manipulator_target_property_value_set( - struct bContext *C, const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop, +void WM_gizmo_target_property_def_func_ptr( + struct wmGizmo *mpr, const struct wmGizmoPropertyType *mpr_prop_type, + const struct wmGizmoPropertyFnParams *params); +void WM_gizmo_target_property_def_func( + struct wmGizmo *mpr, const char *idname, + const struct wmGizmoPropertyFnParams *params); + +void WM_gizmo_target_property_clear_rna_ptr( + struct wmGizmo *mpr, const struct wmGizmoPropertyType *mpr_prop_type); +void WM_gizmo_target_property_clear_rna( + struct wmGizmo *mpr, const char *idname); + +bool WM_gizmo_target_property_is_valid_any(struct wmGizmo *mpr); +bool WM_gizmo_target_property_is_valid( + const struct wmGizmoProperty *mpr_prop); +float WM_gizmo_target_property_value_get( + const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop); +void WM_gizmo_target_property_value_set( + struct bContext *C, const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop, const float value); -void WM_manipulator_target_property_value_get_array( - const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop, +void WM_gizmo_target_property_value_get_array( + const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop, float *value); -void WM_manipulator_target_property_value_set_array( - struct bContext *C, const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop, +void WM_gizmo_target_property_value_set_array( + struct bContext *C, const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop, const float *value); -bool WM_manipulator_target_property_range_get( - const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop, +bool WM_gizmo_target_property_range_get( + const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop, float range[2]); -int WM_manipulator_target_property_array_length( - const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop); +int WM_gizmo_target_property_array_length( + const struct wmGizmo *mpr, struct wmGizmoProperty *mpr_prop); /* definitions */ -const struct wmManipulatorPropertyType *WM_manipulatortype_target_property_find( - const struct wmManipulatorType *wt, const char *idname); -void WM_manipulatortype_target_property_def( - struct wmManipulatorType *wt, const char *idname, int data_type, int array_length); +const struct wmGizmoPropertyType *WM_gizmotype_target_property_find( + const struct wmGizmoType *wt, const char *idname); +void WM_gizmotype_target_property_def( + struct wmGizmoType *wt, const char *idname, int data_type, int array_length); /* utilities */ -void WM_manipulator_do_msg_notify_tag_refresh( +void WM_gizmo_do_msg_notify_tag_refresh( struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val); -void WM_manipulator_target_property_subscribe_all( - struct wmManipulator *mpr, struct wmMsgBus *mbus, struct ARegion *ar); +void WM_gizmo_target_property_subscribe_all( + struct wmGizmo *mpr, struct wmMsgBus *mbus, struct ARegion *ar); /* -------------------------------------------------------------------- */ -/* wmManipulatorGroup */ +/* wmGizmoGroup */ -/* Callbacks for 'wmManipulatorGroupType.setup_keymap' */ -struct wmKeyMap *WM_manipulatorgroup_keymap_common( - const struct wmManipulatorGroupType *wgt, struct wmKeyConfig *config); -struct wmKeyMap *WM_manipulatorgroup_keymap_common_select( - const struct wmManipulatorGroupType *wgt, struct wmKeyConfig *config); +/* Callbacks for 'wmGizmoGroupType.setup_keymap' */ +struct wmKeyMap *WM_gizmogroup_keymap_common( + const struct wmGizmoGroupType *wgt, struct wmKeyConfig *config); +struct wmKeyMap *WM_gizmogroup_keymap_common_select( + const struct wmGizmoGroupType *wgt, struct wmKeyConfig *config); /* -------------------------------------------------------------------- */ -/* wmManipulatorMap */ +/* wmGizmoMap */ -struct wmManipulatorMap *WM_manipulatormap_new_from_type( - const struct wmManipulatorMapType_Params *mmap_params); -const struct ListBase *WM_manipulatormap_group_list(struct wmManipulatorMap *mmap); -struct wmManipulatorGroup *WM_manipulatormap_group_find( - struct wmManipulatorMap *mmap, +struct wmGizmoMap *WM_gizmomap_new_from_type( + const struct wmGizmoMapType_Params *mmap_params); +const struct ListBase *WM_gizmomap_group_list(struct wmGizmoMap *mmap); +struct wmGizmoGroup *WM_gizmomap_group_find( + struct wmGizmoMap *mmap, const char *idname); -struct wmManipulatorGroup *WM_manipulatormap_group_find_ptr( - struct wmManipulatorMap *mmap, - const struct wmManipulatorGroupType *wgt); -void WM_manipulatormap_tag_refresh(struct wmManipulatorMap *mmap); -void WM_manipulatormap_draw( - struct wmManipulatorMap *mmap, const struct bContext *C, const eWM_ManipulatorMapDrawStep drawstep); -void WM_manipulatormap_add_handlers(struct ARegion *ar, struct wmManipulatorMap *mmap); -bool WM_manipulatormap_select_all(struct bContext *C, struct wmManipulatorMap *mmap, const int action); -bool WM_manipulatormap_cursor_set(const struct wmManipulatorMap *mmap, struct wmWindow *win); -void WM_manipulatormap_message_subscribe( - struct bContext *C, struct wmManipulatorMap *mmap, struct ARegion *ar, struct wmMsgBus *mbus); -bool WM_manipulatormap_is_any_selected(const struct wmManipulatorMap *mmap); -bool WM_manipulatormap_minmax( - const struct wmManipulatorMap *mmap, bool use_hidden, bool use_select, +struct wmGizmoGroup *WM_gizmomap_group_find_ptr( + struct wmGizmoMap *mmap, + const struct wmGizmoGroupType *wgt); +void WM_gizmomap_tag_refresh(struct wmGizmoMap *mmap); +void WM_gizmomap_draw( + struct wmGizmoMap *mmap, const struct bContext *C, const eWM_GizmoFlagMapDrawStep drawstep); +void WM_gizmomap_add_handlers(struct ARegion *ar, struct wmGizmoMap *mmap); +bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *mmap, const int action); +bool WM_gizmomap_cursor_set(const struct wmGizmoMap *mmap, struct wmWindow *win); +void WM_gizmomap_message_subscribe( + struct bContext *C, struct wmGizmoMap *mmap, struct ARegion *ar, struct wmMsgBus *mbus); +bool WM_gizmomap_is_any_selected(const struct wmGizmoMap *mmap); +bool WM_gizmomap_minmax( + const struct wmGizmoMap *mmap, bool use_hidden, bool use_select, float r_min[3], float r_max[3]); -struct ARegion *WM_manipulatormap_tooltip_init( +struct ARegion *WM_gizmomap_tooltip_init( struct bContext *C, struct ARegion *ar, bool *r_exit_on_event); /* -------------------------------------------------------------------- */ -/* wmManipulatorMapType */ +/* wmGizmoMapType */ -struct wmManipulatorMapType *WM_manipulatormaptype_find( - const struct wmManipulatorMapType_Params *mmap_params); -struct wmManipulatorMapType *WM_manipulatormaptype_ensure( - const struct wmManipulatorMapType_Params *mmap_params); +struct wmGizmoMapType *WM_gizmomaptype_find( + const struct wmGizmoMapType_Params *mmap_params); +struct wmGizmoMapType *WM_gizmomaptype_ensure( + const struct wmGizmoMapType_Params *mmap_params); -struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_find( - struct wmManipulatorMapType *mmap_type, +struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find( + struct wmGizmoMapType *mmap_type, const char *idname); -struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_find_ptr( - struct wmManipulatorMapType *mmap_type, - const struct wmManipulatorGroupType *wgt); -struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_link( - struct wmManipulatorMapType *mmap_type, +struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find_ptr( + struct wmGizmoMapType *mmap_type, + const struct wmGizmoGroupType *wgt); +struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_link( + struct wmGizmoMapType *mmap_type, const char *idname); -struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_link_ptr( - struct wmManipulatorMapType *mmap_type, - struct wmManipulatorGroupType *wgt); +struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_link_ptr( + struct wmGizmoMapType *mmap_type, + struct wmGizmoGroupType *wgt); -void WM_manipulatormaptype_group_init_runtime_keymap( +void WM_gizmomaptype_group_init_runtime_keymap( const struct Main *bmain, - struct wmManipulatorGroupType *wgt); -void WM_manipulatormaptype_group_init_runtime( - const struct Main *bmain, struct wmManipulatorMapType *mmap_type, - struct wmManipulatorGroupType *wgt); -void WM_manipulatormaptype_group_unlink( - struct bContext *C, struct Main *bmain, struct wmManipulatorMapType *mmap_type, - const struct wmManipulatorGroupType *wgt); + struct wmGizmoGroupType *wgt); +void WM_gizmomaptype_group_init_runtime( + const struct Main *bmain, struct wmGizmoMapType *mmap_type, + struct wmGizmoGroupType *wgt); +void WM_gizmomaptype_group_unlink( + struct bContext *C, struct Main *bmain, struct wmGizmoMapType *mmap_type, + const struct wmGizmoGroupType *wgt); -void WM_manipulatormaptype_group_free(struct wmManipulatorGroupTypeRef *wgt); +void WM_gizmomaptype_group_free(struct wmGizmoGroupTypeRef *wgt); /* -------------------------------------------------------------------- */ -/* ManipulatorGroup */ +/* GizmoGroup */ /* Add/Ensure/Remove (High level API) */ -void WM_manipulator_group_type_add_ptr_ex( - struct wmManipulatorGroupType *wgt, - struct wmManipulatorMapType *mmap_type); -void WM_manipulator_group_type_add_ptr( - struct wmManipulatorGroupType *wgt); -void WM_manipulator_group_type_add(const char *idname); - -void WM_manipulator_group_type_ensure_ptr_ex( - struct wmManipulatorGroupType *wgt, - struct wmManipulatorMapType *mmap_type); -void WM_manipulator_group_type_ensure_ptr( - struct wmManipulatorGroupType *wgt); -void WM_manipulator_group_type_ensure(const char *idname); - -void WM_manipulator_group_type_remove_ptr_ex( - struct Main *bmain, struct wmManipulatorGroupType *wgt, - struct wmManipulatorMapType *mmap_type); -void WM_manipulator_group_type_remove_ptr( - struct Main *bmain, struct wmManipulatorGroupType *wgt); -void WM_manipulator_group_type_remove(struct Main *bmain, const char *idname); - -void WM_manipulator_group_type_unlink_delayed_ptr_ex( - struct wmManipulatorGroupType *wgt, - struct wmManipulatorMapType *mmap_type); -void WM_manipulator_group_type_unlink_delayed_ptr( - struct wmManipulatorGroupType *wgt); -void WM_manipulator_group_type_unlink_delayed(const char *idname); +void WM_gizmo_group_type_add_ptr_ex( + struct wmGizmoGroupType *wgt, + struct wmGizmoMapType *mmap_type); +void WM_gizmo_group_type_add_ptr( + struct wmGizmoGroupType *wgt); +void WM_gizmo_group_type_add(const char *idname); + +void WM_gizmo_group_type_ensure_ptr_ex( + struct wmGizmoGroupType *wgt, + struct wmGizmoMapType *mmap_type); +void WM_gizmo_group_type_ensure_ptr( + struct wmGizmoGroupType *wgt); +void WM_gizmo_group_type_ensure(const char *idname); + +void WM_gizmo_group_type_remove_ptr_ex( + struct Main *bmain, struct wmGizmoGroupType *wgt, + struct wmGizmoMapType *mmap_type); +void WM_gizmo_group_type_remove_ptr( + struct Main *bmain, struct wmGizmoGroupType *wgt); +void WM_gizmo_group_type_remove(struct Main *bmain, const char *idname); + +void WM_gizmo_group_type_unlink_delayed_ptr_ex( + struct wmGizmoGroupType *wgt, + struct wmGizmoMapType *mmap_type); +void WM_gizmo_group_type_unlink_delayed_ptr( + struct wmGizmoGroupType *wgt); +void WM_gizmo_group_type_unlink_delayed(const char *idname); /* Utilities */ -bool WM_manipulator_context_check_drawstep(const struct bContext *C, eWM_ManipulatorMapDrawStep step); +bool WM_gizmo_context_check_drawstep(const struct bContext *C, eWM_GizmoFlagMapDrawStep step); -bool WM_manipulator_group_type_poll(const struct bContext *C, const struct wmManipulatorGroupType *wgt); +bool WM_gizmo_group_type_poll(const struct bContext *C, const struct wmGizmoGroupType *wgt); #endif /* __WM_GIZMO_API_H__ */ diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index 0f6af6db24c..ecdda256306 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -26,8 +26,8 @@ /** \file blender/windowmanager/gizmo/WM_gizmo_types.h * \ingroup wm * - * \name Manipulator Types - * \brief Manipulator defines for external use. + * \name Gizmo Types + * \brief Gizmo defines for external use. * * Only included in WM_types.h and lower level files. */ @@ -38,11 +38,11 @@ #include "BLI_compiler_attrs.h" -struct wmManipulatorMapType; -struct wmManipulatorGroupType; -struct wmManipulatorGroup; -struct wmManipulator; -struct wmManipulatorProperty; +struct wmGizmoMapType; +struct wmGizmoGroupType; +struct wmGizmoGroup; +struct wmGizmo; +struct wmGizmoProperty; struct wmKeyConfig; #include "DNA_listBase.h" @@ -53,154 +53,154 @@ struct wmKeyConfig; /** - * #wmManipulator.state + * #wmGizmo.state */ -typedef enum eWM_ManipulatorState { - WM_MANIPULATOR_STATE_HIGHLIGHT = (1 << 0), /* while hovered */ - WM_MANIPULATOR_STATE_MODAL = (1 << 1), /* while dragging */ - WM_MANIPULATOR_STATE_SELECT = (1 << 2), -} eWM_ManipulatorState; +typedef enum eWM_GizmoFlagState { + WM_GIZMO_STATE_HIGHLIGHT = (1 << 0), /* while hovered */ + WM_GIZMO_STATE_MODAL = (1 << 1), /* while dragging */ + WM_GIZMO_STATE_SELECT = (1 << 2), +} eWM_GizmoFlagState; /** - * #wmManipulator.flag - * Flags for individual manipulators. + * #wmGizmo.flag + * Flags for individual gizmos. */ -typedef enum eWM_ManipulatorFlag { - WM_MANIPULATOR_DRAW_HOVER = (1 << 0), /* draw *only* while hovering */ - WM_MANIPULATOR_DRAW_MODAL = (1 << 1), /* draw while dragging */ - WM_MANIPULATOR_DRAW_VALUE = (1 << 2), /* draw an indicator for the current value while dragging */ - WM_MANIPULATOR_HIDDEN = (1 << 3), +typedef enum eWM_GizmoFlagFlag { + WM_GIZMO_DRAW_HOVER = (1 << 0), /* draw *only* while hovering */ + WM_GIZMO_DRAW_MODAL = (1 << 1), /* draw while dragging */ + WM_GIZMO_DRAW_VALUE = (1 << 2), /* draw an indicator for the current value while dragging */ + WM_GIZMO_HIDDEN = (1 << 3), /** * When set 'scale_final' value also scales the offset. * Use when offset is to avoid screen-space overlap instead of absolute positioning. */ - WM_MANIPULATOR_DRAW_OFFSET_SCALE = (1 << 4), + WM_GIZMO_DRAW_OFFSET_SCALE = (1 << 4), /** * User should still use 'scale_final' for any handles and UI elements. * This simply skips scale when calculating the final matrix. - * Needed when the manipulator needs to align with the interface underneath it. */ - WM_MANIPULATOR_DRAW_NO_SCALE = (1 << 5), + * Needed when the gizmo needs to align with the interface underneath it. */ + WM_GIZMO_DRAW_NO_SCALE = (1 << 5), /** - * Hide the cursor and lock it's position while interacting with this manipulator. + * Hide the cursor and lock it's position while interacting with this gizmo. */ - WM_MANIPULATOR_GRAB_CURSOR = (1 << 6), + WM_GIZMO_GRAB_CURSOR = (1 << 6), /** Don't write into the depth buffer when selecting. */ - WM_MANIPULATOR_SELECT_BACKGROUND = (1 << 7), -} eWM_ManipulatorFlag; + WM_GIZMO_SELECT_BACKGROUND = (1 << 7), +} eWM_GizmoFlagFlag; /** - * #wmManipulatorGroupType.flag - * Flags that influence the behavior of all manipulators in the group. + * #wmGizmoGroupType.flag + * Flags that influence the behavior of all gizmos in the group. */ -typedef enum eWM_ManipulatorGroupTypeFlag { - /* Mark manipulator-group as being 3D */ - WM_MANIPULATORGROUPTYPE_3D = (1 << 0), - /* Scale manipulators as 3D object that respects zoom (otherwise zoom independent draw size). +typedef enum eWM_GizmoFlagGroupTypeFlag { + /* Mark gizmo-group as being 3D */ + WM_GIZMOGROUPTYPE_3D = (1 << 0), + /* Scale gizmos as 3D object that respects zoom (otherwise zoom independent draw size). * note: currently only for 3D views, 2D support needs adding. */ - WM_MANIPULATORGROUPTYPE_SCALE = (1 << 1), - /* Manipulators can be depth culled with scene objects (covered by other geometry - TODO) */ - WM_MANIPULATORGROUPTYPE_DEPTH_3D = (1 << 2), - /* Manipulators can be selected */ - WM_MANIPULATORGROUPTYPE_SELECT = (1 << 3), - /* The manipulator group is to be kept (not removed on loading a new file for eg). */ - WM_MANIPULATORGROUPTYPE_PERSISTENT = (1 << 4), - /* Show all other manipulators when interacting. */ - WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL = (1 << 5), -} eWM_ManipulatorGroupTypeFlag; + WM_GIZMOGROUPTYPE_SCALE = (1 << 1), + /* Gizmos can be depth culled with scene objects (covered by other geometry - TODO) */ + WM_GIZMOGROUPTYPE_DEPTH_3D = (1 << 2), + /* Gizmos can be selected */ + WM_GIZMOGROUPTYPE_SELECT = (1 << 3), + /* The gizmo group is to be kept (not removed on loading a new file for eg). */ + WM_GIZMOGROUPTYPE_PERSISTENT = (1 << 4), + /* Show all other gizmos when interacting. */ + WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL = (1 << 5), +} eWM_GizmoFlagGroupTypeFlag; /** - * #wmManipulatorGroup.init_flag + * #wmGizmoGroup.init_flag */ -typedef enum eWM_ManipulatorGroupInitFlag { +typedef enum eWM_GizmoFlagGroupInitFlag { /* mgroup has been initialized */ - WM_MANIPULATORGROUP_INIT_SETUP = (1 << 0), - WM_MANIPULATORGROUP_INIT_REFRESH = (1 << 1), -} eWM_ManipulatorGroupInitFlag; + WM_GIZMOGROUP_INIT_SETUP = (1 << 0), + WM_GIZMOGROUP_INIT_REFRESH = (1 << 1), +} eWM_GizmoFlagGroupInitFlag; /** - * #wmManipulatorMapType.type_update_flag - * Manipulator-map type update flag + * #wmGizmoMapType.type_update_flag + * Gizmo-map type update flag */ -typedef enum eWM_ManipulatorMapTypeUpdateFlag { +typedef enum eWM_GizmoFlagMapTypeUpdateFlag { /* A new type has been added, needs to be initialized for all views. */ - WM_MANIPULATORMAPTYPE_UPDATE_INIT = (1 << 0), - WM_MANIPULATORMAPTYPE_UPDATE_REMOVE = (1 << 1), + WM_GIZMOMAPTYPE_UPDATE_INIT = (1 << 0), + WM_GIZMOMAPTYPE_UPDATE_REMOVE = (1 << 1), /* Needed because keymap may be registered before and after window initialization. * So we need to keep track of keymap initialization separately. */ - WM_MANIPULATORMAPTYPE_KEYMAP_INIT = (1 << 2), -} eWM_ManipulatorMapTypeUpdateFlag; + WM_GIZMOMAPTYPE_KEYMAP_INIT = (1 << 2), +} eWM_GizmoFlagMapTypeUpdateFlag; /* -------------------------------------------------------------------- */ -/* wmManipulator */ +/* wmGizmo */ /** - * \brief Manipulator tweak flag. - * Bitflag passed to manipulator while tweaking. + * \brief Gizmo tweak flag. + * Bitflag passed to gizmo while tweaking. * - * \note Manipulators are responsible for handling this #wmManipulator.modal callback!. + * \note Gizmos are responsible for handling this #wmGizmo.modal callback!. */ typedef enum { /* Drag with extra precision (Shift). */ - WM_MANIPULATOR_TWEAK_PRECISE = (1 << 0), + WM_GIZMO_TWEAK_PRECISE = (1 << 0), /* Drag with snap enabled (Ctrl). */ - WM_MANIPULATOR_TWEAK_SNAP = (1 << 1), -} eWM_ManipulatorTweak; + WM_GIZMO_TWEAK_SNAP = (1 << 1), +} eWM_GizmoFlagTweak; #include "wm_gizmo_fn.h" -typedef struct wmManipulatorOpElem { +typedef struct wmGizmoOpElem { struct wmOperatorType *type; - /* operator properties if manipulator spawns and controls an operator, - * or owner pointer if manipulator spawns and controls a property */ + /* operator properties if gizmo spawns and controls an operator, + * or owner pointer if gizmo spawns and controls a property */ PointerRNA ptr; bool is_redo; -} wmManipulatorOpElem; +} wmGizmoOpElem; -/* manipulators are set per region by registering them on manipulator-maps */ -struct wmManipulator { - struct wmManipulator *next, *prev; +/* gizmos are set per region by registering them on gizmo-maps */ +struct wmGizmo { + struct wmGizmo *next, *prev; /* While we don't have a real type, use this to put type-like vars. */ - const struct wmManipulatorType *type; + const struct wmGizmoType *type; /* Overrides 'type->modal' when set. * Note that this is a workaround, remove if we can. */ - wmManipulatorFnModal custom_modal; + wmGizmoFnModal custom_modal; - /* pointer back to group this manipulator is in (just for quick access) */ - struct wmManipulatorGroup *parent_mgroup; + /* pointer back to group this gizmo is in (just for quick access) */ + struct wmGizmoGroup *parent_mgroup; void *py_instance; /* rna pointer to access properties */ struct PointerRNA *ptr; - /* flags that influence the behavior or how the manipulators are drawn */ - eWM_ManipulatorFlag flag; + /* flags that influence the behavior or how the gizmos are drawn */ + eWM_GizmoFlagFlag flag; /* state flags (active, highlighted, selected) */ - eWM_ManipulatorState state; + eWM_GizmoFlagState state; - /* Optional ID for highlighting different parts of this manipulator. + /* Optional ID for highlighting different parts of this gizmo. * -1 when unset, otherwise a valid index. (Used as index to 'op_data'). */ int highlight_part; - /* For single click button manipulators, use a different part as a fallback, -1 when unused. */ + /* For single click button gizmos, use a different part as a fallback, -1 when unused. */ int drag_part; - /* Transformation of the manipulator in 2d or 3d space. + /* Transformation of the gizmo in 2d or 3d space. * - Matrix axis are expected to be unit length (scale is applied after). - * - Behavior when axis aren't orthogonal depends on each manipulator. - * - Typically the +Z is the primary axis for manipulators to use. + * - Behavior when axis aren't orthogonal depends on each gizmo. + * - Typically the +Z is the primary axis for gizmos to use. * - 'matrix[3]' must be used for location, - * besides this it's up to the manipulators internal code how the + * besides this it's up to the gizmos internal code how the * rotation components are used for drawing and interaction. */ - /* The space this manipulator is being modified in. */ + /* The space this gizmo is being modified in. */ float matrix_space[4][4]; - /* Transformation of this manipulator. */ + /* Transformation of this gizmo. */ float matrix_basis[4][4]; /* custom offset from origin */ float matrix_offset[4][4]; @@ -210,25 +210,25 @@ struct wmManipulator { float scale_basis; /* user defined width for line drawing */ float line_width; - /* manipulator colors (uses default fallbacks if not defined) */ + /* gizmo colors (uses default fallbacks if not defined) */ float color[4], color_hi[4]; /* data used during interaction */ void *interaction_data; - /* Operator to spawn when activating the manipulator (overrides property editing), - * an array of items (aligned with #wmManipulator.highlight_part). */ - wmManipulatorOpElem *op_data; + /* Operator to spawn when activating the gizmo (overrides property editing), + * an array of items (aligned with #wmGizmo.highlight_part). */ + wmGizmoOpElem *op_data; int op_data_len; struct IDProperty *properties; - /* over alloc target_properties after 'wmManipulatorType.struct_size' */ + /* over alloc target_properties after 'wmGizmoType.struct_size' */ }; /* Similar to PropertyElemRNA, but has an identifier. */ -typedef struct wmManipulatorProperty { - const struct wmManipulatorPropertyType *type; +typedef struct wmGizmoProperty { + const struct wmGizmoPropertyType *type; PointerRNA ptr; PropertyRNA *prop; @@ -237,88 +237,88 @@ typedef struct wmManipulatorProperty { /* Optional functions for converting to/from RNA */ struct { - wmManipulatorPropertyFnGet value_get_fn; - wmManipulatorPropertyFnSet value_set_fn; - wmManipulatorPropertyFnRangeGet range_get_fn; - wmManipulatorPropertyFnFree free_fn; + wmGizmoPropertyFnGet value_get_fn; + wmGizmoPropertyFnSet value_set_fn; + wmGizmoPropertyFnRangeGet range_get_fn; + wmGizmoPropertyFnFree free_fn; void *user_data; } custom_func; -} wmManipulatorProperty; +} wmGizmoProperty; -typedef struct wmManipulatorPropertyType { - struct wmManipulatorPropertyType *next, *prev; +typedef struct wmGizmoPropertyType { + struct wmGizmoPropertyType *next, *prev; /* PropertyType, typically 'PROP_FLOAT' */ int data_type; int array_length; - /* index within 'wmManipulatorType' */ + /* index within 'wmGizmoType' */ int index_in_type; /* over alloc */ char idname[0]; -} wmManipulatorPropertyType; +} wmGizmoPropertyType; /** - * Simple utility wrapper for storing a single manipulator as wmManipulatorGroup.customdata (which gets freed). + * Simple utility wrapper for storing a single gizmo as wmGizmoGroup.customdata (which gets freed). */ -typedef struct wmManipulatorWrapper { - struct wmManipulator *manipulator; -} wmManipulatorWrapper; +typedef struct wmGizmoWrapper { + struct wmGizmo *gizmo; +} wmGizmoWrapper; -struct wmManipulatorMapType_Params { +struct wmGizmoMapType_Params { short spaceid; short regionid; }; -typedef struct wmManipulatorType { +typedef struct wmGizmoType { const char *idname; /* MAX_NAME */ - /* Set to 'sizeof(wmManipulator)' or larger for instances of this type, + /* Set to 'sizeof(wmGizmo)' or larger for instances of this type, * use so we can cant to other types without the hassle of a custom-data pointer. */ uint struct_size; /* Initialize struct (calloc'd 'struct_size' region). */ - wmManipulatorFnSetup setup; + wmGizmoFnSetup setup; - /* draw manipulator */ - wmManipulatorFnDraw draw; + /* draw gizmo */ + wmGizmoFnDraw draw; - /* determines 3d intersection by rendering the manipulator in a selection routine. */ - wmManipulatorFnDrawSelect draw_select; + /* determines 3d intersection by rendering the gizmo in a selection routine. */ + wmGizmoFnDrawSelect draw_select; - /* Determine if the mouse intersects with the manipulator. + /* Determine if the mouse intersects with the gizmo. * The calculation should be done in the callback itself, -1 for no seleciton. */ - wmManipulatorFnTestSelect test_select; + wmGizmoFnTestSelect test_select; - /* handler used by the manipulator. Usually handles interaction tied to a manipulator type */ - wmManipulatorFnModal modal; + /* handler used by the gizmo. Usually handles interaction tied to a gizmo type */ + wmGizmoFnModal modal; - /* manipulator-specific handler to update manipulator attributes based on the property value */ - wmManipulatorFnPropertyUpdate property_update; + /* gizmo-specific handler to update gizmo attributes based on the property value */ + wmGizmoFnPropertyUpdate property_update; /* Returns the final transformation which may be different from the 'matrix', - * depending on the manipulator. + * depending on the gizmo. * Notes: - * - Scale isn't applied (wmManipulator.scale/user_scale). - * - Offset isn't applied (wmManipulator.matrix_offset). + * - Scale isn't applied (wmGizmo.scale/user_scale). + * - Offset isn't applied (wmGizmo.matrix_offset). */ - wmManipulatorFnMatrixBasisGet matrix_basis_get; + wmGizmoFnMatrixBasisGet matrix_basis_get; - /* activate a manipulator state when the user clicks on it */ - wmManipulatorFnInvoke invoke; + /* activate a gizmo state when the user clicks on it */ + wmGizmoFnInvoke invoke; - /* called when manipulator tweaking is done - used to free data and reset property when cancelling */ - wmManipulatorFnExit exit; + /* called when gizmo tweaking is done - used to free data and reset property when cancelling */ + wmGizmoFnExit exit; - wmManipulatorFnCursorGet cursor_get; + wmGizmoFnCursorGet cursor_get; - /* called when manipulator selection state changes */ - wmManipulatorFnSelectRefresh select_refresh; + /* called when gizmo selection state changes */ + wmGizmoFnSelectRefresh select_refresh; - /* Free data (not the manipulator it's self), use when the manipulator allocates it's own members. */ - wmManipulatorFnFree free; + /* Free data (not the gizmo it's self), use when the gizmo allocates it's own members. */ + wmGizmoFnFree free; /* RNA for properties */ struct StructRNA *srna; @@ -329,41 +329,41 @@ typedef struct wmManipulatorType { ListBase target_property_defs; int target_property_defs_len; -} wmManipulatorType; +} wmGizmoType; /* -------------------------------------------------------------------- */ -/* wmManipulatorGroup */ +/* wmGizmoGroup */ -/* factory class for a manipulator-group type, gets called every time a new area is spawned */ -typedef struct wmManipulatorGroupTypeRef { - struct wmManipulatorGroupTypeRef *next, *prev; - struct wmManipulatorGroupType *type; -} wmManipulatorGroupTypeRef; +/* factory class for a gizmo-group type, gets called every time a new area is spawned */ +typedef struct wmGizmoGroupTypeRef { + struct wmGizmoGroupTypeRef *next, *prev; + struct wmGizmoGroupType *type; +} wmGizmoGroupTypeRef; -/* factory class for a manipulator-group type, gets called every time a new area is spawned */ -typedef struct wmManipulatorGroupType { +/* factory class for a gizmo-group type, gets called every time a new area is spawned */ +typedef struct wmGizmoGroupType { const char *idname; /* MAX_NAME */ - const char *name; /* manipulator-group name - displayed in UI (keymap editor) */ + const char *name; /* gizmo-group name - displayed in UI (keymap editor) */ char owner_id[64]; /* MAX_NAME */ - /* poll if manipulator-map should be visible */ - wmManipulatorGroupFnPoll poll; - /* initially create manipulators and set permanent data - stuff you only need to do once */ - wmManipulatorGroupFnInit setup; - /* refresh data, only called if recreate flag is set (WM_manipulatormap_tag_refresh) */ - wmManipulatorGroupFnRefresh refresh; + /* poll if gizmo-map should be visible */ + wmGizmoGroupFnPoll poll; + /* initially create gizmos and set permanent data - stuff you only need to do once */ + wmGizmoGroupFnInit setup; + /* refresh data, only called if recreate flag is set (WM_gizmomap_tag_refresh) */ + wmGizmoGroupFnRefresh refresh; /* refresh data for drawing, called before each redraw */ - wmManipulatorGroupFnDrawPrepare draw_prepare; + wmGizmoGroupFnDrawPrepare draw_prepare; - /* Keymap init callback for this manipulator-group (optional), + /* Keymap init callback for this gizmo-group (optional), * will fall back to default tweak keymap when left NULL. */ - wmManipulatorGroupFnSetupKeymap setup_keymap; + wmGizmoGroupFnSetupKeymap setup_keymap; /* Optionally subscribe to wmMsgBus events, * these are calculated automatically from RNA properties, - * only needed if manipulators depend indirectly on properties. */ - wmManipulatorGroupFnMsgBusSubscribe message_subscribe; + * only needed if gizmos depend indirectly on properties. */ + wmGizmoGroupFnMsgBusSubscribe message_subscribe; /* keymap created with callback from above */ struct wmKeyMap *keymap; @@ -379,44 +379,44 @@ typedef struct wmManipulatorGroupType { /* RNA integration */ ExtensionRNA ext; - eWM_ManipulatorGroupTypeFlag flag; + eWM_GizmoFlagGroupTypeFlag flag; /* So we know which group type to update. */ - eWM_ManipulatorMapTypeUpdateFlag type_update_flag; + eWM_GizmoFlagMapTypeUpdateFlag type_update_flag; - /* same as manipulator-maps, so registering/unregistering goes to the correct region */ - struct wmManipulatorMapType_Params mmap_params; + /* same as gizmo-maps, so registering/unregistering goes to the correct region */ + struct wmGizmoMapType_Params mmap_params; -} wmManipulatorGroupType; +} wmGizmoGroupType; -typedef struct wmManipulatorGroup { - struct wmManipulatorGroup *next, *prev; +typedef struct wmGizmoGroup { + struct wmGizmoGroup *next, *prev; - struct wmManipulatorGroupType *type; - ListBase manipulators; + struct wmGizmoGroupType *type; + ListBase gizmos; - struct wmManipulatorMap *parent_mmap; + struct wmGizmoMap *parent_mmap; void *py_instance; /* python stores the class instance here */ struct ReportList *reports; /* errors and warnings storage */ void *customdata; void (*customdata_free)(void *); /* for freeing customdata from above */ - eWM_ManipulatorGroupInitFlag init_flag; -} wmManipulatorGroup; + eWM_GizmoFlagGroupInitFlag init_flag; +} wmGizmoGroup; /* -------------------------------------------------------------------- */ -/* wmManipulatorMap */ +/* wmGizmoMap */ /** - * Pass a value of this enum to #WM_manipulatormap_draw to tell it what to draw. + * Pass a value of this enum to #WM_gizmomap_draw to tell it what to draw. */ -typedef enum eWM_ManipulatorMapDrawStep { - /** Draw 2D manipulator-groups (#WM_MANIPULATORGROUPTYPE_3D not set). */ - WM_MANIPULATORMAP_DRAWSTEP_2D = 0, - /** Draw 3D manipulator-groups (#WM_MANIPULATORGROUPTYPE_3D set). */ - WM_MANIPULATORMAP_DRAWSTEP_3D, -} eWM_ManipulatorMapDrawStep; -#define WM_MANIPULATORMAP_DRAWSTEP_MAX 2 +typedef enum eWM_GizmoFlagMapDrawStep { + /** Draw 2D gizmo-groups (#WM_GIZMOGROUPTYPE_3D not set). */ + WM_GIZMOMAP_DRAWSTEP_2D = 0, + /** Draw 3D gizmo-groups (#WM_GIZMOGROUPTYPE_3D set). */ + WM_GIZMOMAP_DRAWSTEP_3D, +} eWM_GizmoFlagMapDrawStep; +#define WM_GIZMOMAP_DRAWSTEP_MAX 2 #endif /* __WM_GIZMO_TYPES_H__ */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c index bef193f6c56..da8b301b536 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo.c @@ -59,42 +59,42 @@ #include "BPY_extern.h" #endif -/* only for own init/exit calls (wm_manipulatortype_init/wm_manipulatortype_free) */ +/* only for own init/exit calls (wm_gizmotype_init/wm_gizmotype_free) */ #include "wm.h" /* own includes */ #include "wm_gizmo_wmapi.h" #include "wm_gizmo_intern.h" -static void wm_manipulator_register( - wmManipulatorGroup *mgroup, wmManipulator *mpr); +static void wm_gizmo_register( + wmGizmoGroup *mgroup, wmGizmo *mpr); /** * \note Follow #wm_operator_create convention. */ -static wmManipulator *wm_manipulator_create( - const wmManipulatorType *wt, +static wmGizmo *wm_gizmo_create( + const wmGizmoType *wt, PointerRNA *properties) { BLI_assert(wt != NULL); - BLI_assert(wt->struct_size >= sizeof(wmManipulator)); + BLI_assert(wt->struct_size >= sizeof(wmGizmo)); - wmManipulator *mpr = MEM_callocN( - wt->struct_size + (sizeof(wmManipulatorProperty) * wt->target_property_defs_len), __func__); + wmGizmo *mpr = MEM_callocN( + wt->struct_size + (sizeof(wmGizmoProperty) * wt->target_property_defs_len), __func__); mpr->type = wt; /* initialize properties, either copy or create */ - mpr->ptr = MEM_callocN(sizeof(PointerRNA), "wmManipulatorPtrRNA"); + mpr->ptr = MEM_callocN(sizeof(PointerRNA), "wmGizmoPtrRNA"); if (properties && properties->data) { mpr->properties = IDP_CopyProperty(properties->data); } else { IDPropertyTemplate val = {0}; - mpr->properties = IDP_New(IDP_GROUP, &val, "wmManipulatorProperties"); + mpr->properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties"); } RNA_pointer_create(G_MAIN->wm.first, wt->srna, mpr->properties, mpr->ptr); - WM_manipulator_properties_sanitize(mpr->ptr, 0); + WM_gizmo_properties_sanitize(mpr->ptr, 0); unit_m4(mpr->matrix_space); unit_m4(mpr->matrix_basis); @@ -105,13 +105,13 @@ static wmManipulator *wm_manipulator_create( return mpr; } -wmManipulator *WM_manipulator_new_ptr( - const wmManipulatorType *wt, wmManipulatorGroup *mgroup, +wmGizmo *WM_gizmo_new_ptr( + const wmGizmoType *wt, wmGizmoGroup *mgroup, PointerRNA *properties) { - wmManipulator *mpr = wm_manipulator_create(wt, properties); + wmGizmo *mpr = wm_gizmo_create(wt, properties); - wm_manipulator_register(mgroup, mpr); + wm_gizmo_register(mgroup, mpr); if (mpr->type->setup != NULL) { mpr->type->setup(mpr); @@ -122,21 +122,21 @@ wmManipulator *WM_manipulator_new_ptr( /** * \param wt: Must be valid, - * if you need to check it exists use #WM_manipulator_new_ptr + * if you need to check it exists use #WM_gizmo_new_ptr * because callers of this function don't NULL check the return value. */ -wmManipulator *WM_manipulator_new( - const char *idname, wmManipulatorGroup *mgroup, +wmGizmo *WM_gizmo_new( + const char *idname, wmGizmoGroup *mgroup, PointerRNA *properties) { - const wmManipulatorType *wt = WM_manipulatortype_find(idname, false); - return WM_manipulator_new_ptr(wt, mgroup, properties); + const wmGizmoType *wt = WM_gizmotype_find(idname, false); + return WM_gizmo_new_ptr(wt, mgroup, properties); } /** * Initialize default values and allocate needed memory for members. */ -static void manipulator_init(wmManipulator *mpr) +static void gizmo_init(wmGizmo *mpr) { const float color_default[4] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -149,24 +149,24 @@ static void manipulator_init(wmManipulator *mpr) } /** - * Register \a manipulator. + * Register \a gizmo. * - * \param name: name used to create a unique idname for \a manipulator in \a mgroup + * \param name: name used to create a unique idname for \a gizmo in \a mgroup * * \note Not to be confused with type registration from RNA. */ -static void wm_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *mpr) +static void wm_gizmo_register(wmGizmoGroup *mgroup, wmGizmo *mpr) { - manipulator_init(mpr); - wm_manipulatorgroup_manipulator_register(mgroup, mpr); + gizmo_init(mpr); + wm_gizmogroup_gizmo_register(mgroup, mpr); } /** - * \warning this doesn't check #wmManipulatorMap (highlight, selection etc). + * \warning this doesn't check #wmGizmoMap (highlight, selection etc). * Typical use is when freeing the windowing data, * where caller can manage clearing selection, highlight... etc. */ -void WM_manipulator_free(wmManipulator *mpr) +void WM_gizmo_free(wmGizmo *mpr) { if (mpr->type->free != NULL) { mpr->type->free(mpr); @@ -188,14 +188,14 @@ void WM_manipulator_free(wmManipulator *mpr) } if (mpr->ptr != NULL) { - WM_manipulator_properties_free(mpr->ptr); + WM_gizmo_properties_free(mpr->ptr); MEM_freeN(mpr->ptr); } if (mpr->type->target_property_defs_len != 0) { - wmManipulatorProperty *mpr_prop_array = WM_manipulator_target_property_array(mpr); + wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr); for (int i = 0; i < mpr->type->target_property_defs_len; i++) { - wmManipulatorProperty *mpr_prop = &mpr_prop_array[i]; + wmGizmoProperty *mpr_prop = &mpr_prop_array[i]; if (mpr_prop->custom_func.free_fn) { mpr_prop->custom_func.free_fn(mpr, mpr_prop); } @@ -206,41 +206,41 @@ void WM_manipulator_free(wmManipulator *mpr) } /** - * Free \a manipulator and unlink from \a manipulatorlist. - * \a manipulatorlist is allowed to be NULL. + * Free \a gizmo and unlink from \a gizmolist. + * \a gizmolist is allowed to be NULL. */ -void WM_manipulator_unlink(ListBase *manipulatorlist, wmManipulatorMap *mmap, wmManipulator *mpr, bContext *C) +void WM_gizmo_unlink(ListBase *gizmolist, wmGizmoMap *mmap, wmGizmo *mpr, bContext *C) { - if (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) { - wm_manipulatormap_highlight_set(mmap, C, NULL, 0); + if (mpr->state & WM_GIZMO_STATE_HIGHLIGHT) { + wm_gizmomap_highlight_set(mmap, C, NULL, 0); } - if (mpr->state & WM_MANIPULATOR_STATE_MODAL) { - wm_manipulatormap_modal_set(mmap, C, mpr, NULL, false); + if (mpr->state & WM_GIZMO_STATE_MODAL) { + wm_gizmomap_modal_set(mmap, C, mpr, NULL, false); } /* Unlink instead of setting so we don't run callbacks. */ - if (mpr->state & WM_MANIPULATOR_STATE_SELECT) { - WM_manipulator_select_unlink(mmap, mpr); + if (mpr->state & WM_GIZMO_STATE_SELECT) { + WM_gizmo_select_unlink(mmap, mpr); } - if (manipulatorlist) { - BLI_remlink(manipulatorlist, mpr); + if (gizmolist) { + BLI_remlink(gizmolist, mpr); } BLI_assert(mmap->mmap_context.highlight != mpr); BLI_assert(mmap->mmap_context.modal != mpr); - WM_manipulator_free(mpr); + WM_gizmo_free(mpr); } /* -------------------------------------------------------------------- */ -/** \name Manipulator Creation API +/** \name Gizmo Creation API * - * API for defining data on manipulator creation. + * API for defining data on gizmo creation. * * \{ */ -struct wmManipulatorOpElem *WM_manipulator_operator_get( - wmManipulator *mpr, int part_index) +struct wmGizmoOpElem *WM_gizmo_operator_get( + wmGizmo *mpr, int part_index) { if (mpr->op_data && ((part_index >= 0) && (part_index < mpr->op_data_len))) { return &mpr->op_data[part_index]; @@ -248,8 +248,8 @@ struct wmManipulatorOpElem *WM_manipulator_operator_get( return NULL; } -PointerRNA *WM_manipulator_operator_set( - wmManipulator *mpr, int part_index, +PointerRNA *WM_gizmo_operator_set( + wmGizmo *mpr, int part_index, wmOperatorType *ot, IDProperty *properties) { BLI_assert(part_index < 255); @@ -258,7 +258,7 @@ PointerRNA *WM_manipulator_operator_set( mpr->op_data_len = part_index + 1; mpr->op_data = MEM_recallocN(mpr->op_data, sizeof(*mpr->op_data) * mpr->op_data_len); } - wmManipulatorOpElem *mpop = &mpr->op_data[part_index]; + wmGizmoOpElem *mpop = &mpr->op_data[part_index]; mpop->type = ot; if (mpop->ptr.data) { @@ -273,7 +273,7 @@ PointerRNA *WM_manipulator_operator_set( return &mpop->ptr; } -static void wm_manipulator_set_matrix_rotation_from_z_axis__internal( +static void wm_gizmo_set_matrix_rotation_from_z_axis__internal( float matrix[4][4], const float z_axis[3]) { /* old code, seems we can use simpler method */ @@ -292,7 +292,7 @@ static void wm_manipulator_set_matrix_rotation_from_z_axis__internal( } -static void wm_manipulator_set_matrix_rotation_from_yz_axis__internal( +static void wm_gizmo_set_matrix_rotation_from_yz_axis__internal( float matrix[4][4], const float y_axis[3], const float z_axis[3]) { normalize_v3_v3(matrix[1], y_axis); @@ -302,42 +302,42 @@ static void wm_manipulator_set_matrix_rotation_from_yz_axis__internal( } /** - * wmManipulator.matrix utils. + * wmGizmo.matrix utils. */ -void WM_manipulator_set_matrix_rotation_from_z_axis( - wmManipulator *mpr, const float z_axis[3]) +void WM_gizmo_set_matrix_rotation_from_z_axis( + wmGizmo *mpr, const float z_axis[3]) { - wm_manipulator_set_matrix_rotation_from_z_axis__internal(mpr->matrix_basis, z_axis); + wm_gizmo_set_matrix_rotation_from_z_axis__internal(mpr->matrix_basis, z_axis); } -void WM_manipulator_set_matrix_rotation_from_yz_axis( - wmManipulator *mpr, const float y_axis[3], const float z_axis[3]) +void WM_gizmo_set_matrix_rotation_from_yz_axis( + wmGizmo *mpr, const float y_axis[3], const float z_axis[3]) { - wm_manipulator_set_matrix_rotation_from_yz_axis__internal(mpr->matrix_basis, y_axis, z_axis); + wm_gizmo_set_matrix_rotation_from_yz_axis__internal(mpr->matrix_basis, y_axis, z_axis); } -void WM_manipulator_set_matrix_location(wmManipulator *mpr, const float origin[3]) +void WM_gizmo_set_matrix_location(wmGizmo *mpr, const float origin[3]) { copy_v3_v3(mpr->matrix_basis[3], origin); } /** - * wmManipulator.matrix_offset utils. + * wmGizmo.matrix_offset utils. */ -void WM_manipulator_set_matrix_offset_rotation_from_z_axis( - wmManipulator *mpr, const float z_axis[3]) +void WM_gizmo_set_matrix_offset_rotation_from_z_axis( + wmGizmo *mpr, const float z_axis[3]) { - wm_manipulator_set_matrix_rotation_from_z_axis__internal(mpr->matrix_offset, z_axis); + wm_gizmo_set_matrix_rotation_from_z_axis__internal(mpr->matrix_offset, z_axis); } -void WM_manipulator_set_matrix_offset_rotation_from_yz_axis( - wmManipulator *mpr, const float y_axis[3], const float z_axis[3]) +void WM_gizmo_set_matrix_offset_rotation_from_yz_axis( + wmGizmo *mpr, const float y_axis[3], const float z_axis[3]) { - wm_manipulator_set_matrix_rotation_from_yz_axis__internal(mpr->matrix_offset, y_axis, z_axis); + wm_gizmo_set_matrix_rotation_from_yz_axis__internal(mpr->matrix_offset, y_axis, z_axis); } -void WM_manipulator_set_matrix_offset_location(wmManipulator *mpr, const float offset[3]) +void WM_gizmo_set_matrix_offset_location(wmGizmo *mpr, const float offset[3]) { copy_v3_v3(mpr->matrix_offset[3], offset); } -void WM_manipulator_set_flag(wmManipulator *mpr, const int flag, const bool enable) +void WM_gizmo_set_flag(wmGizmo *mpr, const int flag, const bool enable) { if (enable) { mpr->flag |= flag; @@ -347,50 +347,50 @@ void WM_manipulator_set_flag(wmManipulator *mpr, const int flag, const bool enab } } -void WM_manipulator_set_scale(wmManipulator *mpr, const float scale) +void WM_gizmo_set_scale(wmGizmo *mpr, const float scale) { mpr->scale_basis = scale; } -void WM_manipulator_set_line_width(wmManipulator *mpr, const float line_width) +void WM_gizmo_set_line_width(wmGizmo *mpr, const float line_width) { mpr->line_width = line_width; } /** - * Set manipulator rgba colors. + * Set gizmo rgba colors. * * \param col Normal state color. * \param col_hi Highlighted state color. */ -void WM_manipulator_get_color(const wmManipulator *mpr, float color[4]) +void WM_gizmo_get_color(const wmGizmo *mpr, float color[4]) { copy_v4_v4(color, mpr->color); } -void WM_manipulator_set_color(wmManipulator *mpr, const float color[4]) +void WM_gizmo_set_color(wmGizmo *mpr, const float color[4]) { copy_v4_v4(mpr->color, color); } -void WM_manipulator_get_color_highlight(const wmManipulator *mpr, float color_hi[4]) +void WM_gizmo_get_color_highlight(const wmGizmo *mpr, float color_hi[4]) { copy_v4_v4(color_hi, mpr->color_hi); } -void WM_manipulator_set_color_highlight(wmManipulator *mpr, const float color_hi[4]) +void WM_gizmo_set_color_highlight(wmGizmo *mpr, const float color_hi[4]) { copy_v4_v4(mpr->color_hi, color_hi); } -/** \} */ // Manipulator Creation API +/** \} */ // Gizmo Creation API /* -------------------------------------------------------------------- */ -/** \name Manipulator Callback Assignment +/** \name Gizmo Callback Assignment * * \{ */ -void WM_manipulator_set_fn_custom_modal(struct wmManipulator *mpr, wmManipulatorFnModal fn) +void WM_gizmo_set_fn_custom_modal(struct wmGizmo *mpr, wmGizmoFnModal fn) { mpr->custom_modal = fn; } @@ -401,32 +401,32 @@ void WM_manipulator_set_fn_custom_modal(struct wmManipulator *mpr, wmManipulator /* -------------------------------------------------------------------- */ /** - * Add/Remove \a manipulator to selection. - * Reallocates memory for selected manipulators so better not call for selecting multiple ones. + * Add/Remove \a gizmo to selection. + * Reallocates memory for selected gizmos so better not call for selecting multiple ones. * * \return if the selection has changed. */ -bool wm_manipulator_select_set_ex( - wmManipulatorMap *mmap, wmManipulator *mpr, bool select, +bool wm_gizmo_select_set_ex( + wmGizmoMap *mmap, wmGizmo *mpr, bool select, bool use_array, bool use_callback) { bool changed = false; if (select) { - if ((mpr->state & WM_MANIPULATOR_STATE_SELECT) == 0) { + if ((mpr->state & WM_GIZMO_STATE_SELECT) == 0) { if (use_array) { - wm_manipulatormap_select_array_push_back(mmap, mpr); + wm_gizmomap_select_array_push_back(mmap, mpr); } - mpr->state |= WM_MANIPULATOR_STATE_SELECT; + mpr->state |= WM_GIZMO_STATE_SELECT; changed = true; } } else { - if (mpr->state & WM_MANIPULATOR_STATE_SELECT) { + if (mpr->state & WM_GIZMO_STATE_SELECT) { if (use_array) { - wm_manipulatormap_select_array_remove(mmap, mpr); + wm_gizmomap_select_array_remove(mmap, mpr); } - mpr->state &= ~WM_MANIPULATOR_STATE_SELECT; + mpr->state &= ~WM_GIZMO_STATE_SELECT; changed = true; } } @@ -443,25 +443,25 @@ bool wm_manipulator_select_set_ex( } /* Remove from selection array without running callbacks. */ -bool WM_manipulator_select_unlink(wmManipulatorMap *mmap, wmManipulator *mpr) +bool WM_gizmo_select_unlink(wmGizmoMap *mmap, wmGizmo *mpr) { - return wm_manipulator_select_set_ex(mmap, mpr, false, true, false); + return wm_gizmo_select_set_ex(mmap, mpr, false, true, false); } -bool WM_manipulator_select_set(wmManipulatorMap *mmap, wmManipulator *mpr, bool select) +bool WM_gizmo_select_set(wmGizmoMap *mmap, wmGizmo *mpr, bool select) { - return wm_manipulator_select_set_ex(mmap, mpr, select, true, true); + return wm_gizmo_select_set_ex(mmap, mpr, select, true, true); } -void WM_manipulator_highlight_set(wmManipulatorMap *mmap, wmManipulator *mpr) +void WM_gizmo_highlight_set(wmGizmoMap *mmap, wmGizmo *mpr) { - wm_manipulatormap_highlight_set(mmap, NULL, mpr, mpr ? mpr->highlight_part : 0); + wm_gizmomap_highlight_set(mmap, NULL, mpr, mpr ? mpr->highlight_part : 0); } -bool wm_manipulator_select_and_highlight(bContext *C, wmManipulatorMap *mmap, wmManipulator *mpr) +bool wm_gizmo_select_and_highlight(bContext *C, wmGizmoMap *mmap, wmGizmo *mpr) { - if (WM_manipulator_select_set(mmap, mpr, true)) { - wm_manipulatormap_highlight_set(mmap, C, mpr, mpr->highlight_part); + if (WM_gizmo_select_set(mmap, mpr, true)) { + wm_gizmomap_highlight_set(mmap, C, mpr, mpr->highlight_part); return true; } else { @@ -470,32 +470,32 @@ bool wm_manipulator_select_and_highlight(bContext *C, wmManipulatorMap *mmap, wm } /** - * Special function to run from setup so manipulators start out interactive. + * Special function to run from setup so gizmos start out interactive. * * We could do this when linking them, but this complicates things since the window update code needs to run first. */ -void WM_manipulator_modal_set_from_setup( - struct wmManipulatorMap *mmap, struct bContext *C, - struct wmManipulator *mpr, int part_index, const wmEvent *event) +void WM_gizmo_modal_set_from_setup( + struct wmGizmoMap *mmap, struct bContext *C, + struct wmGizmo *mpr, int part_index, const wmEvent *event) { mpr->highlight_part = part_index; - WM_manipulator_highlight_set(mmap, mpr); + WM_gizmo_highlight_set(mmap, mpr); if (false) { - wm_manipulatormap_modal_set(mmap, C, mpr, event, true); + wm_gizmomap_modal_set(mmap, C, mpr, event, true); } else { /* WEAK: but it works. */ - WM_operator_name_call(C, "MANIPULATORGROUP_OT_manipulator_tweak", WM_OP_INVOKE_DEFAULT, NULL); + WM_operator_name_call(C, "GIZMOGROUP_OT_gizmo_tweak", WM_OP_INVOKE_DEFAULT, NULL); } } -void wm_manipulator_calculate_scale(wmManipulator *mpr, const bContext *C) +void wm_gizmo_calculate_scale(wmGizmo *mpr, const bContext *C) { const RegionView3D *rv3d = CTX_wm_region_view3d(C); float scale = UI_DPI_FAC; - if ((mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_SCALE) == 0) { - scale *= U.manipulator_size; + if ((mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_SCALE) == 0) { + scale *= U.gizmo_size; if (rv3d) { /* 'ED_view3d_pixel_size' includes 'U.pixelsize', remove it. */ float matrix_world[4][4]; @@ -519,53 +519,53 @@ void wm_manipulator_calculate_scale(wmManipulator *mpr, const bContext *C) mpr->scale_final = mpr->scale_basis * scale; } -static void manipulator_update_prop_data(wmManipulator *mpr) +static void gizmo_update_prop_data(wmGizmo *mpr) { - /* manipulator property might have been changed, so update manipulator */ + /* gizmo property might have been changed, so update gizmo */ if (mpr->type->property_update) { - wmManipulatorProperty *mpr_prop_array = WM_manipulator_target_property_array(mpr); + wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr); for (int i = 0; i < mpr->type->target_property_defs_len; i++) { - wmManipulatorProperty *mpr_prop = &mpr_prop_array[i]; - if (WM_manipulator_target_property_is_valid(mpr_prop)) { + wmGizmoProperty *mpr_prop = &mpr_prop_array[i]; + if (WM_gizmo_target_property_is_valid(mpr_prop)) { mpr->type->property_update(mpr, mpr_prop); } } } } -void wm_manipulator_update(wmManipulator *mpr, const bContext *C, const bool refresh_map) +void wm_gizmo_update(wmGizmo *mpr, const bContext *C, const bool refresh_map) { if (refresh_map) { - manipulator_update_prop_data(mpr); + gizmo_update_prop_data(mpr); } - wm_manipulator_calculate_scale(mpr, C); + wm_gizmo_calculate_scale(mpr, C); } -int wm_manipulator_is_visible(wmManipulator *mpr) +int wm_gizmo_is_visible(wmGizmo *mpr) { - if (mpr->flag & WM_MANIPULATOR_HIDDEN) { + if (mpr->flag & WM_GIZMO_HIDDEN) { return 0; } - if ((mpr->state & WM_MANIPULATOR_STATE_MODAL) && - !(mpr->flag & (WM_MANIPULATOR_DRAW_MODAL | WM_MANIPULATOR_DRAW_VALUE))) + if ((mpr->state & WM_GIZMO_STATE_MODAL) && + !(mpr->flag & (WM_GIZMO_DRAW_MODAL | WM_GIZMO_DRAW_VALUE))) { /* don't draw while modal (dragging) */ return 0; } - if ((mpr->flag & WM_MANIPULATOR_DRAW_HOVER) && - !(mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) && - !(mpr->state & WM_MANIPULATOR_STATE_SELECT)) /* still draw selected manipulators */ + if ((mpr->flag & WM_GIZMO_DRAW_HOVER) && + !(mpr->state & WM_GIZMO_STATE_HIGHLIGHT) && + !(mpr->state & WM_GIZMO_STATE_SELECT)) /* still draw selected gizmos */ { /* update but don't draw */ - return WM_MANIPULATOR_IS_VISIBLE_UPDATE; + return WM_GIZMO_IS_VISIBLE_UPDATE; } - return WM_MANIPULATOR_IS_VISIBLE_UPDATE | WM_MANIPULATOR_IS_VISIBLE_DRAW; + return WM_GIZMO_IS_VISIBLE_UPDATE | WM_GIZMO_IS_VISIBLE_DRAW; } -void WM_manipulator_calc_matrix_final_params( - const wmManipulator *mpr, - const struct WM_ManipulatorMatrixParams *params, +void WM_gizmo_calc_matrix_final_params( + const wmGizmo *mpr, + const struct WM_GizmoMatrixParams *params, float r_mat[4][4]) { const float (* const matrix_space)[4] = params->matrix_space ? params->matrix_space : mpr->matrix_space; @@ -581,11 +581,11 @@ void WM_manipulator_calc_matrix_final_params( copy_m4_m4(final_matrix, matrix_basis); } - if (mpr->flag & WM_MANIPULATOR_DRAW_NO_SCALE) { + if (mpr->flag & WM_GIZMO_DRAW_NO_SCALE) { mul_m4_m4m4(final_matrix, final_matrix, matrix_offset); } else { - if (mpr->flag & WM_MANIPULATOR_DRAW_OFFSET_SCALE) { + if (mpr->flag & WM_GIZMO_DRAW_OFFSET_SCALE) { mul_mat3_m4_fl(final_matrix, *scale_final); mul_m4_m4m4(final_matrix, final_matrix, matrix_offset); } @@ -598,14 +598,14 @@ void WM_manipulator_calc_matrix_final_params( mul_m4_m4m4(r_mat, matrix_space, final_matrix); } -void WM_manipulator_calc_matrix_final_no_offset(const wmManipulator *mpr, float r_mat[4][4]) +void WM_gizmo_calc_matrix_final_no_offset(const wmGizmo *mpr, float r_mat[4][4]) { float mat_identity[4][4]; unit_m4(mat_identity); - WM_manipulator_calc_matrix_final_params( + WM_gizmo_calc_matrix_final_params( mpr, - &((struct WM_ManipulatorMatrixParams) { + &((struct WM_GizmoMatrixParams) { .matrix_space = NULL, .matrix_basis = NULL, .matrix_offset = mat_identity, @@ -614,11 +614,11 @@ void WM_manipulator_calc_matrix_final_no_offset(const wmManipulator *mpr, float ); } -void WM_manipulator_calc_matrix_final(const wmManipulator *mpr, float r_mat[4][4]) +void WM_gizmo_calc_matrix_final(const wmGizmo *mpr, float r_mat[4][4]) { - WM_manipulator_calc_matrix_final_params( + WM_gizmo_calc_matrix_final_params( mpr, - &((struct WM_ManipulatorMatrixParams) { + &((struct WM_GizmoMatrixParams) { .matrix_space = NULL, .matrix_basis = NULL, .matrix_offset = NULL, @@ -627,31 +627,31 @@ void WM_manipulator_calc_matrix_final(const wmManipulator *mpr, float r_mat[4][4 ); } -/** \name Manipulator Propery Access +/** \name Gizmo Propery Access * * Matches `WM_operator_properties` conventions. * * \{ */ -void WM_manipulator_properties_create_ptr(PointerRNA *ptr, wmManipulatorType *wt) +void WM_gizmo_properties_create_ptr(PointerRNA *ptr, wmGizmoType *wt) { RNA_pointer_create(NULL, wt->srna, NULL, ptr); } -void WM_manipulator_properties_create(PointerRNA *ptr, const char *wtstring) +void WM_gizmo_properties_create(PointerRNA *ptr, const char *wtstring) { - const wmManipulatorType *wt = WM_manipulatortype_find(wtstring, false); + const wmGizmoType *wt = WM_gizmotype_find(wtstring, false); if (wt) - WM_manipulator_properties_create_ptr(ptr, (wmManipulatorType *)wt); + WM_gizmo_properties_create_ptr(ptr, (wmGizmoType *)wt); else - RNA_pointer_create(NULL, &RNA_ManipulatorProperties, NULL, ptr); + RNA_pointer_create(NULL, &RNA_GizmoProperties, NULL, ptr); } /* similar to the function above except its uses ID properties * used for keymaps and macros */ -void WM_manipulator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *wtstring) +void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *wtstring) { if (*properties == NULL) { IDPropertyTemplate val = {0}; @@ -660,14 +660,14 @@ void WM_manipulator_properties_alloc(PointerRNA **ptr, IDProperty **properties, if (*ptr == NULL) { *ptr = MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr"); - WM_manipulator_properties_create(*ptr, wtstring); + WM_gizmo_properties_create(*ptr, wtstring); } (*ptr)->data = *properties; } -void WM_manipulator_properties_sanitize(PointerRNA *ptr, const bool no_context) +void WM_gizmo_properties_sanitize(PointerRNA *ptr, const bool no_context) { RNA_STRUCT_BEGIN (ptr, prop) { @@ -682,10 +682,10 @@ void WM_manipulator_properties_sanitize(PointerRNA *ptr, const bool no_context) { StructRNA *ptype = RNA_property_pointer_type(ptr, prop); - /* recurse into manipulator properties */ - if (RNA_struct_is_a(ptype, &RNA_ManipulatorProperties)) { + /* recurse into gizmo properties */ + if (RNA_struct_is_a(ptype, &RNA_GizmoProperties)) { PointerRNA opptr = RNA_property_pointer_get(ptr, prop); - WM_manipulator_properties_sanitize(&opptr, no_context); + WM_gizmo_properties_sanitize(&opptr, no_context); } break; } @@ -700,10 +700,10 @@ void WM_manipulator_properties_sanitize(PointerRNA *ptr, const bool no_context) /** set all props to their default, * \param do_update Only update un-initialized props. * - * \note, theres nothing specific to manipulators here. + * \note, theres nothing specific to gizmos here. * this could be made a general function. */ -bool WM_manipulator_properties_default(PointerRNA *ptr, const bool do_update) +bool WM_gizmo_properties_default(PointerRNA *ptr, const bool do_update) { bool changed = false; RNA_STRUCT_BEGIN (ptr, prop) @@ -714,7 +714,7 @@ bool WM_manipulator_properties_default(PointerRNA *ptr, const bool do_update) StructRNA *ptype = RNA_property_pointer_type(ptr, prop); if (ptype != &RNA_Struct) { PointerRNA opptr = RNA_property_pointer_get(ptr, prop); - changed |= WM_manipulator_properties_default(&opptr, do_update); + changed |= WM_gizmo_properties_default(&opptr, do_update); } break; } @@ -733,7 +733,7 @@ bool WM_manipulator_properties_default(PointerRNA *ptr, const bool do_update) } /* remove all props without PROP_SKIP_SAVE */ -void WM_manipulator_properties_reset(wmManipulator *mpr) +void WM_gizmo_properties_reset(wmGizmo *mpr) { if (mpr->ptr->data) { PropertyRNA *iterprop; @@ -752,7 +752,7 @@ void WM_manipulator_properties_reset(wmManipulator *mpr) } } -void WM_manipulator_properties_clear(PointerRNA *ptr) +void WM_gizmo_properties_clear(PointerRNA *ptr) { IDProperty *properties = ptr->data; @@ -761,7 +761,7 @@ void WM_manipulator_properties_clear(PointerRNA *ptr) } } -void WM_manipulator_properties_free(PointerRNA *ptr) +void WM_gizmo_properties_free(PointerRNA *ptr) { IDProperty *properties = ptr->data; @@ -778,14 +778,14 @@ void WM_manipulator_properties_free(PointerRNA *ptr) * * \{ */ -bool WM_manipulator_context_check_drawstep(const struct bContext *C, eWM_ManipulatorMapDrawStep step) +bool WM_gizmo_context_check_drawstep(const struct bContext *C, eWM_GizmoFlagMapDrawStep step) { switch (step) { - case WM_MANIPULATORMAP_DRAWSTEP_2D: + case WM_GIZMOMAP_DRAWSTEP_2D: { break; } - case WM_MANIPULATORMAP_DRAWSTEP_3D: + case WM_GIZMOMAP_DRAWSTEP_3D: { wmWindowManager *wm = CTX_wm_manager(C); if (ED_screen_animation_playing(wm)) { diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c index 83af1a71163..f30744859aa 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c @@ -26,9 +26,9 @@ /** \file blender/windowmanager/gizmo/intern/wm_gizmo_group.c * \ingroup wm * - * \name Manipulator-Group + * \name Gizmo-Group * - * Manipulator-groups store and manage groups of manipulators. They can be + * Gizmo-groups store and manage groups of gizmos. They can be * attached to modal handlers and have own keymaps. */ @@ -64,22 +64,22 @@ # include "BPY_extern.h" #endif -/* Allow manipulator part's to be single click only, +/* Allow gizmo part's to be single click only, * dragging falls back to activating their 'drag_part' action. */ #define USE_DRAG_DETECT /* -------------------------------------------------------------------- */ -/** \name wmManipulatorGroup +/** \name wmGizmoGroup * * \{ */ /** - * Create a new manipulator-group from \a wgt. + * Create a new gizmo-group from \a wgt. */ -wmManipulatorGroup *wm_manipulatorgroup_new_from_type( - wmManipulatorMap *mmap, wmManipulatorGroupType *wgt) +wmGizmoGroup *wm_gizmogroup_new_from_type( + wmGizmoMap *mmap, wmGizmoGroupType *wgt) { - wmManipulatorGroup *mgroup = MEM_callocN(sizeof(*mgroup), "manipulator-group"); + wmGizmoGroup *mgroup = MEM_callocN(sizeof(*mgroup), "gizmo-group"); mgroup->type = wgt; /* keep back-link */ @@ -90,27 +90,27 @@ wmManipulatorGroup *wm_manipulatorgroup_new_from_type( return mgroup; } -void wm_manipulatorgroup_free(bContext *C, wmManipulatorGroup *mgroup) +void wm_gizmogroup_free(bContext *C, wmGizmoGroup *mgroup) { - wmManipulatorMap *mmap = mgroup->parent_mmap; + wmGizmoMap *mmap = mgroup->parent_mmap; - /* Similar to WM_manipulator_unlink, but only to keep mmap state correct, + /* Similar to WM_gizmo_unlink, but only to keep mmap state correct, * we don't want to run callbacks. */ if (mmap->mmap_context.highlight && mmap->mmap_context.highlight->parent_mgroup == mgroup) { - wm_manipulatormap_highlight_set(mmap, C, NULL, 0); + wm_gizmomap_highlight_set(mmap, C, NULL, 0); } if (mmap->mmap_context.modal && mmap->mmap_context.modal->parent_mgroup == mgroup) { - wm_manipulatormap_modal_set(mmap, C, mmap->mmap_context.modal, NULL, false); + wm_gizmomap_modal_set(mmap, C, mmap->mmap_context.modal, NULL, false); } - for (wmManipulator *mpr = mgroup->manipulators.first, *mpr_next; mpr; mpr = mpr_next) { + for (wmGizmo *mpr = mgroup->gizmos.first, *mpr_next; mpr; mpr = mpr_next) { mpr_next = mpr->next; if (mmap->mmap_context.select.len) { - WM_manipulator_select_unlink(mmap, mpr); + WM_gizmo_select_unlink(mmap, mpr); } - WM_manipulator_free(mpr); + WM_gizmo_free(mpr); } - BLI_listbase_clear(&mgroup->manipulators); + BLI_listbase_clear(&mgroup->gizmos); #ifdef WITH_PYTHON if (mgroup->py_instance) { @@ -138,21 +138,21 @@ void wm_manipulatorgroup_free(bContext *C, wmManipulatorGroup *mgroup) } /** - * Add \a manipulator to \a mgroup and make sure its name is unique within the group. + * Add \a gizmo to \a mgroup and make sure its name is unique within the group. */ -void wm_manipulatorgroup_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *mpr) +void wm_gizmogroup_gizmo_register(wmGizmoGroup *mgroup, wmGizmo *mpr) { - BLI_assert(BLI_findindex(&mgroup->manipulators, mpr) == -1); - BLI_addtail(&mgroup->manipulators, mpr); + BLI_assert(BLI_findindex(&mgroup->gizmos, mpr) == -1); + BLI_addtail(&mgroup->gizmos, mpr); mpr->parent_mgroup = mgroup; } -wmManipulator *wm_manipulatorgroup_find_intersected_manipulator( - const wmManipulatorGroup *mgroup, bContext *C, const wmEvent *event, +wmGizmo *wm_gizmogroup_find_intersected_gizmo( + const wmGizmoGroup *mgroup, bContext *C, const wmEvent *event, int *r_part) { - for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { - if (mpr->type->test_select && (mpr->flag & WM_MANIPULATOR_HIDDEN) == 0) { + for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { + if (mpr->type->test_select && (mpr->flag & WM_GIZMO_HIDDEN) == 0) { if ((*r_part = mpr->type->test_select(C, mpr, event)) != -1) { return mpr; } @@ -163,14 +163,14 @@ wmManipulator *wm_manipulatorgroup_find_intersected_manipulator( } /** - * Adds all manipulators of \a mgroup that can be selected to the head of \a listbase. Added items need freeing! + * Adds all gizmos of \a mgroup that can be selected to the head of \a listbase. Added items need freeing! */ -void wm_manipulatorgroup_intersectable_manipulators_to_list(const wmManipulatorGroup *mgroup, ListBase *listbase) +void wm_gizmogroup_intersectable_gizmos_to_list(const wmGizmoGroup *mgroup, ListBase *listbase) { - for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { - if ((mpr->flag & WM_MANIPULATOR_HIDDEN) == 0) { - if (((mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) && mpr->type->draw_select) || - ((mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) == 0 && mpr->type->test_select)) + for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { + if ((mpr->flag & WM_GIZMO_HIDDEN) == 0) { + if (((mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) && mpr->type->draw_select) || + ((mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0 && mpr->type->test_select)) { BLI_addhead(listbase, BLI_genericNodeN(mpr)); } @@ -178,32 +178,32 @@ void wm_manipulatorgroup_intersectable_manipulators_to_list(const wmManipulatorG } } -void wm_manipulatorgroup_ensure_initialized(wmManipulatorGroup *mgroup, const bContext *C) +void wm_gizmogroup_ensure_initialized(wmGizmoGroup *mgroup, const bContext *C) { /* prepare for first draw */ - if (UNLIKELY((mgroup->init_flag & WM_MANIPULATORGROUP_INIT_SETUP) == 0)) { + if (UNLIKELY((mgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0)) { mgroup->type->setup(C, mgroup); - /* Not ideal, initialize keymap here, needed for RNA runtime generated manipulators. */ - wmManipulatorGroupType *wgt = mgroup->type; + /* Not ideal, initialize keymap here, needed for RNA runtime generated gizmos. */ + wmGizmoGroupType *wgt = mgroup->type; if (wgt->keymap == NULL) { wmWindowManager *wm = CTX_wm_manager(C); - wm_manipulatorgrouptype_setup_keymap(wgt, wm->defaultconf); + wm_gizmogrouptype_setup_keymap(wgt, wm->defaultconf); BLI_assert(wgt->keymap != NULL); } - mgroup->init_flag |= WM_MANIPULATORGROUP_INIT_SETUP; + mgroup->init_flag |= WM_GIZMOGROUP_INIT_SETUP; } /* refresh may be called multiple times, this just ensures its called at least once before we draw. */ - if (UNLIKELY((mgroup->init_flag & WM_MANIPULATORGROUP_INIT_REFRESH) == 0)) { + if (UNLIKELY((mgroup->init_flag & WM_GIZMOGROUP_INIT_REFRESH) == 0)) { if (mgroup->type->refresh) { mgroup->type->refresh(C, mgroup); } - mgroup->init_flag |= WM_MANIPULATORGROUP_INIT_REFRESH; + mgroup->init_flag |= WM_GIZMOGROUP_INIT_REFRESH; } } -bool WM_manipulator_group_type_poll(const bContext *C, const struct wmManipulatorGroupType *wgt) +bool WM_gizmo_group_type_poll(const bContext *C, const struct wmGizmoGroupType *wgt) { /* If we're tagged, only use compatible. */ if (wgt->owner_id[0] != '\0') { @@ -212,29 +212,29 @@ bool WM_manipulator_group_type_poll(const bContext *C, const struct wmManipulato return false; } } - /* Check for poll function, if manipulator-group belongs to an operator, also check if the operator is running. */ - return (!wgt->poll || wgt->poll(C, (wmManipulatorGroupType *)wgt)); + /* Check for poll function, if gizmo-group belongs to an operator, also check if the operator is running. */ + return (!wgt->poll || wgt->poll(C, (wmGizmoGroupType *)wgt)); } -bool wm_manipulatorgroup_is_visible_in_drawstep( - const wmManipulatorGroup *mgroup, const eWM_ManipulatorMapDrawStep drawstep) +bool wm_gizmogroup_is_visible_in_drawstep( + const wmGizmoGroup *mgroup, const eWM_GizmoFlagMapDrawStep drawstep) { switch (drawstep) { - case WM_MANIPULATORMAP_DRAWSTEP_2D: - return (mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) == 0; - case WM_MANIPULATORMAP_DRAWSTEP_3D: - return (mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D); + case WM_GIZMOMAP_DRAWSTEP_2D: + return (mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) == 0; + case WM_GIZMOMAP_DRAWSTEP_3D: + return (mgroup->type->flag & WM_GIZMOGROUPTYPE_3D); default: BLI_assert(0); return false; } } -bool wm_manipulatorgroup_is_any_selected(const wmManipulatorGroup *mgroup) +bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *mgroup) { - if (mgroup->type->flag & WM_MANIPULATORGROUPTYPE_SELECT) { - for (const wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { - if (mpr->state & WM_MANIPULATOR_STATE_SELECT) { + if (mgroup->type->flag & WM_GIZMOGROUPTYPE_SELECT) { + for (const wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { + if (mpr->state & WM_GIZMO_STATE_SELECT) { return true; } } @@ -244,18 +244,18 @@ bool wm_manipulatorgroup_is_any_selected(const wmManipulatorGroup *mgroup) /** \} */ -/** \name Manipulator operators +/** \name Gizmo operators * - * Basic operators for manipulator interaction with user configurable keymaps. + * Basic operators for gizmo interaction with user configurable keymaps. * * \{ */ -static int manipulator_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { ARegion *ar = CTX_wm_region(C); - wmManipulatorMap *mmap = ar->manipulator_map; - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; - wmManipulator *highlight = mmap->mmap_context.highlight; + wmGizmoMap *mmap = ar->gizmo_map; + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; + wmGizmo *highlight = mmap->mmap_context.highlight; bool extend = RNA_boolean_get(op->ptr, "extend"); bool deselect = RNA_boolean_get(op->ptr, "deselect"); @@ -263,13 +263,13 @@ static int manipulator_select_invoke(bContext *C, wmOperator *op, const wmEvent /* deselect all first */ if (extend == false && deselect == false && toggle == false) { - wm_manipulatormap_deselect_all(mmap); + wm_gizmomap_deselect_all(mmap); BLI_assert(msel->items == NULL && msel->len == 0); UNUSED_VARS_NDEBUG(msel); } if (highlight) { - const bool is_selected = (highlight->state & WM_MANIPULATOR_STATE_SELECT); + const bool is_selected = (highlight->state & WM_GIZMO_STATE_SELECT); bool redraw = false; if (toggle) { @@ -278,11 +278,11 @@ static int manipulator_select_invoke(bContext *C, wmOperator *op, const wmEvent } if (deselect) { - if (is_selected && WM_manipulator_select_set(mmap, highlight, false)) { + if (is_selected && WM_gizmo_select_set(mmap, highlight, false)) { redraw = true; } } - else if (wm_manipulator_select_and_highlight(C, mmap, highlight)) { + else if (wm_gizmo_select_and_highlight(C, mmap, highlight)) { redraw = true; } @@ -300,32 +300,32 @@ static int manipulator_select_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_PASS_THROUGH; } -void MANIPULATORGROUP_OT_manipulator_select(wmOperatorType *ot) +void GIZMOGROUP_OT_gizmo_select(wmOperatorType *ot) { /* identifiers */ ot->name = "Gizmo Select"; - ot->description = "Select the currently highlighted manipulator"; - ot->idname = "MANIPULATORGROUP_OT_manipulator_select"; + ot->description = "Select the currently highlighted gizmo"; + ot->idname = "GIZMOGROUP_OT_gizmo_select"; /* api callbacks */ - ot->invoke = manipulator_select_invoke; + ot->invoke = gizmo_select_invoke; ot->flag = OPTYPE_UNDO; WM_operator_properties_mouse_select(ot); } -typedef struct ManipulatorTweakData { - wmManipulatorMap *mmap; - wmManipulatorGroup *mgroup; - wmManipulator *mpr_modal; +typedef struct GizmoTweakData { + wmGizmoMap *mmap; + wmGizmoGroup *mgroup; + wmGizmo *mpr_modal; int init_event; /* initial event type */ int flag; /* tweak flags */ #ifdef USE_DRAG_DETECT /* True until the mouse is moved (only use when the operator has no modal). - * this allows some manipulators to be click-only. */ + * this allows some gizmos to be click-only. */ enum { /* Don't detect dragging. */ DRAG_NOP = 0, @@ -333,27 +333,27 @@ typedef struct ManipulatorTweakData { DRAG_DETECT, /* Drag has started, idle until there is no active modal operator. * This is needed because finishing the modal operator also exits - * the modal manipulator state (un-grabbs the cursor). + * the modal gizmo state (un-grabbs the cursor). * Ideally this workaround could be removed later. */ DRAG_IDLE, } drag_state; #endif -} ManipulatorTweakData; +} GizmoTweakData; -static bool manipulator_tweak_start( - bContext *C, wmManipulatorMap *mmap, wmManipulator *mpr, const wmEvent *event) +static bool gizmo_tweak_start( + bContext *C, wmGizmoMap *mmap, wmGizmo *mpr, const wmEvent *event) { - /* activate highlighted manipulator */ - wm_manipulatormap_modal_set(mmap, C, mpr, event, true); + /* activate highlighted gizmo */ + wm_gizmomap_modal_set(mmap, C, mpr, event, true); - return (mpr->state & WM_MANIPULATOR_STATE_MODAL); + return (mpr->state & WM_GIZMO_STATE_MODAL); } -static bool manipulator_tweak_start_and_finish( - bContext *C, wmManipulatorMap *mmap, wmManipulator *mpr, const wmEvent *event, bool *r_is_modal) +static bool gizmo_tweak_start_and_finish( + bContext *C, wmGizmoMap *mmap, wmGizmo *mpr, const wmEvent *event, bool *r_is_modal) { - wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, mpr->highlight_part); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, mpr->highlight_part); if (r_is_modal) { *r_is_modal = false; } @@ -364,7 +364,7 @@ static bool manipulator_tweak_start_and_finish( wmWindowManager *wm = CTX_wm_manager(C); wmOperator *op = WM_operator_last_redo(C); - /* We may want to enable this, for now the manipulator can manage it's own properties. */ + /* We may want to enable this, for now the gizmo can manage it's own properties. */ #if 0 IDP_MergeGroup(mpop->ptr.data, op->properties, false); #endif @@ -373,17 +373,17 @@ static bool manipulator_tweak_start_and_finish( ED_undo_pop_op(C, op); } - /* XXX temporary workaround for modal manipulator operator - * conflicting with modal operator attached to manipulator */ + /* XXX temporary workaround for modal gizmo operator + * conflicting with modal operator attached to gizmo */ if (mpop->type->modal) { - /* activate highlighted manipulator */ - wm_manipulatormap_modal_set(mmap, C, mpr, event, true); + /* activate highlighted gizmo */ + wm_gizmomap_modal_set(mmap, C, mpr, event, true); if (r_is_modal) { *r_is_modal = true; } } else { - /* Allow for 'button' manipulators, single click to run an action. */ + /* Allow for 'button' gizmos, single click to run an action. */ WM_operator_name_call_ptr(C, mpop->type, WM_OP_INVOKE_DEFAULT, &mpop->ptr); } return true; @@ -393,27 +393,27 @@ static bool manipulator_tweak_start_and_finish( } } -static void manipulator_tweak_finish(bContext *C, wmOperator *op, const bool cancel, bool clear_modal) +static void gizmo_tweak_finish(bContext *C, wmOperator *op, const bool cancel, bool clear_modal) { - ManipulatorTweakData *mtweak = op->customdata; + GizmoTweakData *mtweak = op->customdata; if (mtweak->mpr_modal->type->exit) { mtweak->mpr_modal->type->exit(C, mtweak->mpr_modal, cancel); } if (clear_modal) { - /* The manipulator may have been removed. */ + /* The gizmo may have been removed. */ if ((BLI_findindex(&mtweak->mmap->groups, mtweak->mgroup) != -1) && - (BLI_findindex(&mtweak->mgroup->manipulators, mtweak->mpr_modal) != -1)) + (BLI_findindex(&mtweak->mgroup->gizmos, mtweak->mpr_modal) != -1)) { - wm_manipulatormap_modal_set(mtweak->mmap, C, mtweak->mpr_modal, NULL, false); + wm_gizmomap_modal_set(mtweak->mmap, C, mtweak->mpr_modal, NULL, false); } } MEM_freeN(mtweak); } -static int manipulator_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event) +static int gizmo_tweak_modal(bContext *C, wmOperator *op, const wmEvent *event) { - ManipulatorTweakData *mtweak = op->customdata; - wmManipulator *mpr = mtweak->mpr_modal; + GizmoTweakData *mtweak = op->customdata; + wmGizmo *mpr = mtweak->mpr_modal; int retval = OPERATOR_PASS_THROUGH; bool clear_modal = true; @@ -423,7 +423,7 @@ static int manipulator_tweak_modal(bContext *C, wmOperator *op, const wmEvent *e } #ifdef USE_DRAG_DETECT - wmManipulatorMap *mmap = mtweak->mmap; + wmGizmoMap *mmap = mtweak->mmap; if (mtweak->drag_state == DRAG_DETECT) { if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { if (len_manhattan_v2v2_int(&event->x, mmap->mmap_context.event_xy) > 2) { @@ -437,15 +437,15 @@ static int manipulator_tweak_modal(bContext *C, wmOperator *op, const wmEvent *e } if (mtweak->drag_state != DRAG_DETECT) { - /* Follow logic in 'manipulator_tweak_invoke' */ + /* Follow logic in 'gizmo_tweak_invoke' */ bool is_modal = false; - if (manipulator_tweak_start_and_finish(C, mmap, mpr, event, &is_modal)) { + if (gizmo_tweak_start_and_finish(C, mmap, mpr, event, &is_modal)) { if (is_modal) { clear_modal = false; } } else { - if (!manipulator_tweak_start(C, mmap, mpr, event)) { + if (!gizmo_tweak_start(C, mmap, mpr, event)) { retval = OPERATOR_FINISHED; } } @@ -456,7 +456,7 @@ static int manipulator_tweak_modal(bContext *C, wmOperator *op, const wmEvent *e return OPERATOR_PASS_THROUGH; } else { - manipulator_tweak_finish(C, op, false, false); + gizmo_tweak_finish(C, op, false, false); return OPERATOR_FINISHED; } } @@ -477,51 +477,51 @@ static int manipulator_tweak_modal(bContext *C, wmOperator *op, const wmEvent *e retval = OPERATOR_FINISHED; break; case TWEAK_MODAL_PRECISION_ON: - mtweak->flag |= WM_MANIPULATOR_TWEAK_PRECISE; + mtweak->flag |= WM_GIZMO_TWEAK_PRECISE; break; case TWEAK_MODAL_PRECISION_OFF: - mtweak->flag &= ~WM_MANIPULATOR_TWEAK_PRECISE; + mtweak->flag &= ~WM_GIZMO_TWEAK_PRECISE; break; case TWEAK_MODAL_SNAP_ON: - mtweak->flag |= WM_MANIPULATOR_TWEAK_SNAP; + mtweak->flag |= WM_GIZMO_TWEAK_SNAP; break; case TWEAK_MODAL_SNAP_OFF: - mtweak->flag &= ~WM_MANIPULATOR_TWEAK_SNAP; + mtweak->flag &= ~WM_GIZMO_TWEAK_SNAP; break; } } if (retval != OPERATOR_PASS_THROUGH) { - manipulator_tweak_finish(C, op, retval != OPERATOR_FINISHED, clear_modal); + gizmo_tweak_finish(C, op, retval != OPERATOR_FINISHED, clear_modal); return retval; } - /* handle manipulator */ - wmManipulatorFnModal modal_fn = mpr->custom_modal ? mpr->custom_modal : mpr->type->modal; + /* handle gizmo */ + wmGizmoFnModal modal_fn = mpr->custom_modal ? mpr->custom_modal : mpr->type->modal; if (modal_fn) { int modal_retval = modal_fn(C, mpr, event, mtweak->flag); if ((modal_retval & OPERATOR_RUNNING_MODAL) == 0) { - manipulator_tweak_finish(C, op, (modal_retval & OPERATOR_CANCELLED) != 0, true); + gizmo_tweak_finish(C, op, (modal_retval & OPERATOR_CANCELLED) != 0, true); return OPERATOR_FINISHED; } - /* Ugly hack to send manipulator events */ - ((wmEvent *)event)->type = EVT_MANIPULATOR_UPDATE; + /* Ugly hack to send gizmo events */ + ((wmEvent *)event)->type = EVT_GIZMO_UPDATE; } /* always return PASS_THROUGH so modal handlers - * with manipulators attached can update */ + * with gizmos attached can update */ BLI_assert(retval == OPERATOR_PASS_THROUGH); return OPERATOR_PASS_THROUGH; } -static int manipulator_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static int gizmo_tweak_invoke(bContext *C, wmOperator *op, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); - wmManipulatorMap *mmap = ar->manipulator_map; - wmManipulator *mpr = mmap->mmap_context.highlight; + wmGizmoMap *mmap = ar->gizmo_map; + wmGizmo *mpr = mmap->mmap_context.highlight; /* Needed for single click actions which don't enter modal state. */ WM_tooltip_clear(C, CTX_wm_window(C)); @@ -539,7 +539,7 @@ static int manipulator_tweak_invoke(bContext *C, wmOperator *op, const wmEvent * #endif if (use_drag_fallback == false) { - if (manipulator_tweak_start_and_finish(C, mmap, mpr, event, NULL)) { + if (gizmo_tweak_start_and_finish(C, mmap, mpr, event, NULL)) { return OPERATOR_FINISHED; } } @@ -547,7 +547,7 @@ static int manipulator_tweak_invoke(bContext *C, wmOperator *op, const wmEvent * bool use_drag_detect = false; #ifdef USE_DRAG_DETECT if (use_drag_fallback) { - wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, mpr->highlight_part); + wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, mpr->highlight_part); if (mpop && mpop->type) { if (mpop->type->modal == NULL) { use_drag_detect = true; @@ -557,13 +557,13 @@ static int manipulator_tweak_invoke(bContext *C, wmOperator *op, const wmEvent * #endif if (use_drag_detect == false) { - if (!manipulator_tweak_start(C, mmap, mpr, event)) { + if (!gizmo_tweak_start(C, mmap, mpr, event)) { /* failed to start */ return OPERATOR_PASS_THROUGH; } } - ManipulatorTweakData *mtweak = MEM_mallocN(sizeof(ManipulatorTweakData), __func__); + GizmoTweakData *mtweak = MEM_mallocN(sizeof(GizmoTweakData), __func__); mtweak->init_event = WM_userdef_event_type_from_keymap_type(event->type); mtweak->mpr_modal = mmap->mmap_context.highlight; @@ -582,16 +582,16 @@ static int manipulator_tweak_invoke(bContext *C, wmOperator *op, const wmEvent * return OPERATOR_RUNNING_MODAL; } -void MANIPULATORGROUP_OT_manipulator_tweak(wmOperatorType *ot) +void GIZMOGROUP_OT_gizmo_tweak(wmOperatorType *ot) { /* identifiers */ ot->name = "Gizmo Tweak"; ot->description = "Tweak the active gizmo"; - ot->idname = "MANIPULATORGROUP_OT_manipulator_tweak"; + ot->idname = "GIZMOGROUP_OT_gizmo_tweak"; /* api callbacks */ - ot->invoke = manipulator_tweak_invoke; - ot->modal = manipulator_tweak_modal; + ot->invoke = gizmo_tweak_invoke; + ot->modal = gizmo_tweak_modal; /* TODO(campbell) This causes problems tweaking settings for operators, * need to find a way to support this. */ @@ -603,7 +603,7 @@ void MANIPULATORGROUP_OT_manipulator_tweak(wmOperatorType *ot) /** \} */ -static wmKeyMap *manipulatorgroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char *mgroupname) +static wmKeyMap *gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf, const char *mgroupname) { wmKeyMap *keymap; char name[KMAP_MAX_NAME]; @@ -646,44 +646,44 @@ static wmKeyMap *manipulatorgroup_tweak_modal_keymap(wmKeyConfig *keyconf, const WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TWEAK_MODAL_SNAP_ON); WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, TWEAK_MODAL_SNAP_OFF); - WM_modalkeymap_assign(keymap, "MANIPULATORGROUP_OT_manipulator_tweak"); + WM_modalkeymap_assign(keymap, "GIZMOGROUP_OT_gizmo_tweak"); return keymap; } /** - * Common default keymap for manipulator groups + * Common default keymap for gizmo groups */ -wmKeyMap *WM_manipulatorgroup_keymap_common( - const wmManipulatorGroupType *wgt, wmKeyConfig *config) +wmKeyMap *WM_gizmogroup_keymap_common( + const wmGizmoGroupType *wgt, wmKeyConfig *config) { - /* Use area and region id since we might have multiple manipulators with the same name in different areas/regions */ + /* Use area and region id since we might have multiple gizmos with the same name in different areas/regions */ wmKeyMap *km = WM_keymap_find(config, wgt->name, wgt->mmap_params.spaceid, wgt->mmap_params.regionid); - WM_keymap_add_item(km, "MANIPULATORGROUP_OT_manipulator_tweak", LEFTMOUSE, KM_PRESS, KM_ANY, 0); - manipulatorgroup_tweak_modal_keymap(config, wgt->name); + WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", LEFTMOUSE, KM_PRESS, KM_ANY, 0); + gizmogroup_tweak_modal_keymap(config, wgt->name); return km; } /** - * Variation of #WM_manipulatorgroup_keymap_common but with keymap items for selection + * Variation of #WM_gizmogroup_keymap_common but with keymap items for selection */ -wmKeyMap *WM_manipulatorgroup_keymap_common_select( - const wmManipulatorGroupType *wgt, wmKeyConfig *config) +wmKeyMap *WM_gizmogroup_keymap_common_select( + const wmGizmoGroupType *wgt, wmKeyConfig *config) { - /* Use area and region id since we might have multiple manipulators with the same name in different areas/regions */ + /* Use area and region id since we might have multiple gizmos with the same name in different areas/regions */ wmKeyMap *km = WM_keymap_find(config, wgt->name, wgt->mmap_params.spaceid, wgt->mmap_params.regionid); - WM_keymap_add_item(km, "MANIPULATORGROUP_OT_manipulator_tweak", ACTIONMOUSE, KM_PRESS, KM_ANY, 0); - WM_keymap_add_item(km, "MANIPULATORGROUP_OT_manipulator_tweak", EVT_TWEAK_S, KM_ANY, 0, 0); - manipulatorgroup_tweak_modal_keymap(config, wgt->name); + WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", ACTIONMOUSE, KM_PRESS, KM_ANY, 0); + WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_tweak", EVT_TWEAK_S, KM_ANY, 0, 0); + gizmogroup_tweak_modal_keymap(config, wgt->name); - wmKeyMapItem *kmi = WM_keymap_add_item(km, "MANIPULATORGROUP_OT_manipulator_select", SELECTMOUSE, KM_PRESS, 0, 0); + wmKeyMapItem *kmi = WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_select", SELECTMOUSE, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "extend", false); RNA_boolean_set(kmi->ptr, "deselect", false); RNA_boolean_set(kmi->ptr, "toggle", false); - kmi = WM_keymap_add_item(km, "MANIPULATORGROUP_OT_manipulator_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); + kmi = WM_keymap_add_item(km, "GIZMOGROUP_OT_gizmo_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "extend", false); RNA_boolean_set(kmi->ptr, "deselect", false); RNA_boolean_set(kmi->ptr, "toggle", true); @@ -691,19 +691,19 @@ wmKeyMap *WM_manipulatorgroup_keymap_common_select( return km; } -/** \} */ /* wmManipulatorGroup */ +/** \} */ /* wmGizmoGroup */ /* -------------------------------------------------------------------- */ -/** \name wmManipulatorGroupType +/** \name wmGizmoGroupType * * \{ */ -struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_find_ptr( - struct wmManipulatorMapType *mmap_type, - const wmManipulatorGroupType *wgt) +struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find_ptr( + struct wmGizmoMapType *mmap_type, + const wmGizmoGroupType *wgt) { /* could use hash lookups as operator types do, for now simple search. */ - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { @@ -714,12 +714,12 @@ struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_find_ptr( return NULL; } -struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_find( - struct wmManipulatorMapType *mmap_type, +struct wmGizmoGroupTypeRef *WM_gizmomaptype_group_find( + struct wmGizmoMapType *mmap_type, const char *idname) { /* could use hash lookups as operator types do, for now simple search. */ - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { @@ -731,49 +731,49 @@ struct wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_find( } /** - * Use this for registering manipulators on startup. For runtime, use #WM_manipulatormaptype_group_link_runtime. + * Use this for registering gizmos on startup. For runtime, use #WM_gizmomaptype_group_link_runtime. */ -wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_link( - wmManipulatorMapType *mmap_type, const char *idname) +wmGizmoGroupTypeRef *WM_gizmomaptype_group_link( + wmGizmoMapType *mmap_type, const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); BLI_assert(wgt != NULL); - return WM_manipulatormaptype_group_link_ptr(mmap_type, wgt); + return WM_gizmomaptype_group_link_ptr(mmap_type, wgt); } -wmManipulatorGroupTypeRef *WM_manipulatormaptype_group_link_ptr( - wmManipulatorMapType *mmap_type, wmManipulatorGroupType *wgt) +wmGizmoGroupTypeRef *WM_gizmomaptype_group_link_ptr( + wmGizmoMapType *mmap_type, wmGizmoGroupType *wgt) { - wmManipulatorGroupTypeRef *wgt_ref = MEM_callocN(sizeof(wmManipulatorGroupTypeRef), "manipulator-group-ref"); + wmGizmoGroupTypeRef *wgt_ref = MEM_callocN(sizeof(wmGizmoGroupTypeRef), "gizmo-group-ref"); wgt_ref->type = wgt; BLI_addtail(&mmap_type->grouptype_refs, wgt_ref); return wgt_ref; } -void WM_manipulatormaptype_group_init_runtime_keymap( +void WM_gizmomaptype_group_init_runtime_keymap( const Main *bmain, - wmManipulatorGroupType *wgt) + wmGizmoGroupType *wgt) { - /* init keymap - on startup there's an extra call to init keymaps for 'permanent' manipulator-groups */ - wm_manipulatorgrouptype_setup_keymap(wgt, ((wmWindowManager *)bmain->wm.first)->defaultconf); + /* init keymap - on startup there's an extra call to init keymaps for 'permanent' gizmo-groups */ + wm_gizmogrouptype_setup_keymap(wgt, ((wmWindowManager *)bmain->wm.first)->defaultconf); } -void WM_manipulatormaptype_group_init_runtime( - const Main *bmain, wmManipulatorMapType *mmap_type, - wmManipulatorGroupType *wgt) +void WM_gizmomaptype_group_init_runtime( + const Main *bmain, wmGizmoMapType *mmap_type, + wmGizmoGroupType *wgt) { - /* now create a manipulator for all existing areas */ + /* now create a gizmo for all existing areas */ for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) { for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) { for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; for (ARegion *ar = lb->first; ar; ar = ar->next) { - wmManipulatorMap *mmap = ar->manipulator_map; + wmGizmoMap *mmap = ar->gizmo_map; if (mmap && mmap->type == mmap_type) { - wm_manipulatorgroup_new_from_type(mmap, wgt); + wm_gizmogroup_new_from_type(mmap, wgt); /* just add here, drawing will occur on next update */ - wm_manipulatormap_highlight_set(mmap, NULL, NULL, 0); + wm_gizmomap_highlight_set(mmap, NULL, NULL, 0); ED_region_tag_redraw(ar); } } @@ -784,16 +784,16 @@ void WM_manipulatormaptype_group_init_runtime( /** - * Unlike #WM_manipulatormaptype_group_unlink this doesn't maintain correct state, simply free. + * Unlike #WM_gizmomaptype_group_unlink this doesn't maintain correct state, simply free. */ -void WM_manipulatormaptype_group_free(wmManipulatorGroupTypeRef *wgt_ref) +void WM_gizmomaptype_group_free(wmGizmoGroupTypeRef *wgt_ref) { MEM_freeN(wgt_ref); } -void WM_manipulatormaptype_group_unlink( - bContext *C, Main *bmain, wmManipulatorMapType *mmap_type, - const wmManipulatorGroupType *wgt) +void WM_gizmomaptype_group_unlink( + bContext *C, Main *bmain, wmGizmoMapType *mmap_type, + const wmGizmoGroupType *wgt) { /* Free instances. */ for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) { @@ -801,14 +801,14 @@ void WM_manipulatormaptype_group_unlink( for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; for (ARegion *ar = lb->first; ar; ar = ar->next) { - wmManipulatorMap *mmap = ar->manipulator_map; + wmGizmoMap *mmap = ar->gizmo_map; if (mmap && mmap->type == mmap_type) { - wmManipulatorGroup *mgroup, *mgroup_next; + wmGizmoGroup *mgroup, *mgroup_next; for (mgroup = mmap->groups.first; mgroup; mgroup = mgroup_next) { mgroup_next = mgroup->next; if (mgroup->type == wgt) { BLI_assert(mgroup->parent_mmap == mmap); - wm_manipulatorgroup_free(C, mgroup); + wm_gizmogroup_free(C, mgroup); ED_region_tag_redraw(ar); } } @@ -819,131 +819,131 @@ void WM_manipulatormaptype_group_unlink( } /* Free types. */ - wmManipulatorGroupTypeRef *wgt_ref = WM_manipulatormaptype_group_find_ptr(mmap_type, wgt); + wmGizmoGroupTypeRef *wgt_ref = WM_gizmomaptype_group_find_ptr(mmap_type, wgt); if (wgt_ref) { BLI_remlink(&mmap_type->grouptype_refs, wgt_ref); - WM_manipulatormaptype_group_free(wgt_ref); + WM_gizmomaptype_group_free(wgt_ref); } /* Note, we may want to keep this keymap for editing */ WM_keymap_remove(wgt->keyconf, wgt->keymap); - BLI_assert(WM_manipulatormaptype_group_find_ptr(mmap_type, wgt) == NULL); + BLI_assert(WM_gizmomaptype_group_find_ptr(mmap_type, wgt) == NULL); } -void wm_manipulatorgrouptype_setup_keymap( - wmManipulatorGroupType *wgt, wmKeyConfig *keyconf) +void wm_gizmogrouptype_setup_keymap( + wmGizmoGroupType *wgt, wmKeyConfig *keyconf) { /* Use flag since setup_keymap may return NULL, * in that case we better not keep calling it. */ - if (wgt->type_update_flag & WM_MANIPULATORMAPTYPE_KEYMAP_INIT) { + if (wgt->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) { wgt->keymap = wgt->setup_keymap(wgt, keyconf); wgt->keyconf = keyconf; - wgt->type_update_flag &= ~WM_MANIPULATORMAPTYPE_KEYMAP_INIT; + wgt->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT; } } -/** \} */ /* wmManipulatorGroupType */ +/** \} */ /* wmGizmoGroupType */ /* -------------------------------------------------------------------- */ /** \name High Level Add/Remove API * * For use directly from operators & RNA registration. * - * \note In context of manipulator API these names are a bit misleading, + * \note In context of gizmo API these names are a bit misleading, * but for general use terms its OK. - * `WM_manipulator_group_type_add` would be more correctly called: - * `WM_manipulatormaptype_grouptype_reference_link` + * `WM_gizmo_group_type_add` would be more correctly called: + * `WM_gizmomaptype_grouptype_reference_link` * but for general purpose API this is too detailed & annoying. * * \note We may want to return a value if there is nothing to remove. * * \{ */ -void WM_manipulator_group_type_add_ptr_ex( - wmManipulatorGroupType *wgt, - wmManipulatorMapType *mmap_type) +void WM_gizmo_group_type_add_ptr_ex( + wmGizmoGroupType *wgt, + wmGizmoMapType *mmap_type) { - WM_manipulatormaptype_group_link_ptr(mmap_type, wgt); + WM_gizmomaptype_group_link_ptr(mmap_type, wgt); - WM_manipulatorconfig_update_tag_init(mmap_type, wgt); + WM_gizmoconfig_update_tag_init(mmap_type, wgt); } -void WM_manipulator_group_type_add_ptr( - wmManipulatorGroupType *wgt) +void WM_gizmo_group_type_add_ptr( + wmGizmoGroupType *wgt) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); - WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params); + WM_gizmo_group_type_add_ptr_ex(wgt, mmap_type); } -void WM_manipulator_group_type_add(const char *idname) +void WM_gizmo_group_type_add(const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); BLI_assert(wgt != NULL); - WM_manipulator_group_type_add_ptr(wgt); + WM_gizmo_group_type_add_ptr(wgt); } -void WM_manipulator_group_type_ensure_ptr_ex( - wmManipulatorGroupType *wgt, - wmManipulatorMapType *mmap_type) +void WM_gizmo_group_type_ensure_ptr_ex( + wmGizmoGroupType *wgt, + wmGizmoMapType *mmap_type) { - wmManipulatorGroupTypeRef *wgt_ref = WM_manipulatormaptype_group_find_ptr(mmap_type, wgt); + wmGizmoGroupTypeRef *wgt_ref = WM_gizmomaptype_group_find_ptr(mmap_type, wgt); if (wgt_ref == NULL) { - WM_manipulator_group_type_add_ptr_ex(wgt, mmap_type); + WM_gizmo_group_type_add_ptr_ex(wgt, mmap_type); } } -void WM_manipulator_group_type_ensure_ptr( - wmManipulatorGroupType *wgt) +void WM_gizmo_group_type_ensure_ptr( + wmGizmoGroupType *wgt) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); - WM_manipulator_group_type_ensure_ptr_ex(wgt, mmap_type); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params); + WM_gizmo_group_type_ensure_ptr_ex(wgt, mmap_type); } -void WM_manipulator_group_type_ensure(const char *idname) +void WM_gizmo_group_type_ensure(const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); BLI_assert(wgt != NULL); - WM_manipulator_group_type_ensure_ptr(wgt); + WM_gizmo_group_type_ensure_ptr(wgt); } -void WM_manipulator_group_type_remove_ptr_ex( - struct Main *bmain, wmManipulatorGroupType *wgt, - wmManipulatorMapType *mmap_type) +void WM_gizmo_group_type_remove_ptr_ex( + struct Main *bmain, wmGizmoGroupType *wgt, + wmGizmoMapType *mmap_type) { - WM_manipulatormaptype_group_unlink(NULL, bmain, mmap_type, wgt); - WM_manipulatorgrouptype_free_ptr(wgt); + WM_gizmomaptype_group_unlink(NULL, bmain, mmap_type, wgt); + WM_gizmogrouptype_free_ptr(wgt); } -void WM_manipulator_group_type_remove_ptr( - struct Main *bmain, wmManipulatorGroupType *wgt) +void WM_gizmo_group_type_remove_ptr( + struct Main *bmain, wmGizmoGroupType *wgt) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); - WM_manipulator_group_type_remove_ptr_ex(bmain, wgt, mmap_type); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params); + WM_gizmo_group_type_remove_ptr_ex(bmain, wgt, mmap_type); } -void WM_manipulator_group_type_remove(struct Main *bmain, const char *idname) +void WM_gizmo_group_type_remove(struct Main *bmain, const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); BLI_assert(wgt != NULL); - WM_manipulator_group_type_remove_ptr(bmain, wgt); + WM_gizmo_group_type_remove_ptr(bmain, wgt); } /* delayed versions */ -void WM_manipulator_group_type_unlink_delayed_ptr_ex( - wmManipulatorGroupType *wgt, - wmManipulatorMapType *mmap_type) +void WM_gizmo_group_type_unlink_delayed_ptr_ex( + wmGizmoGroupType *wgt, + wmGizmoMapType *mmap_type) { - WM_manipulatorconfig_update_tag_remove(mmap_type, wgt); + WM_gizmoconfig_update_tag_remove(mmap_type, wgt); } -void WM_manipulator_group_type_unlink_delayed_ptr( - wmManipulatorGroupType *wgt) +void WM_gizmo_group_type_unlink_delayed_ptr( + wmGizmoGroupType *wgt) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); - WM_manipulator_group_type_unlink_delayed_ptr_ex(wgt, mmap_type); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params); + WM_gizmo_group_type_unlink_delayed_ptr_ex(wgt, mmap_type); } -void WM_manipulator_group_type_unlink_delayed(const char *idname) +void WM_gizmo_group_type_unlink_delayed(const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); BLI_assert(wgt != NULL); - WM_manipulator_group_type_unlink_delayed_ptr(wgt); + WM_gizmo_group_type_unlink_delayed_ptr(wgt); } /** \} */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c index f93beb0ac9f..44f5fac4cd4 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group_type.c @@ -36,7 +36,7 @@ #include "WM_api.h" #include "WM_types.h" -/* only for own init/exit calls (wm_manipulatorgrouptype_init/wm_manipulatorgrouptype_free) */ +/* only for own init/exit calls (wm_gizmogrouptype_init/wm_gizmogrouptype_free) */ #include "wm.h" /* own includes */ @@ -44,30 +44,30 @@ #include "wm_gizmo_intern.h" -/** \name ManipulatorGroup Type Append +/** \name GizmoGroup Type Append * * \note This follows conventions from #WM_operatortype_find #WM_operatortype_append & friends. * \{ */ -static GHash *global_manipulatorgrouptype_hash = NULL; +static GHash *global_gizmogrouptype_hash = NULL; -wmManipulatorGroupType *WM_manipulatorgrouptype_find(const char *idname, bool quiet) +wmGizmoGroupType *WM_gizmogrouptype_find(const char *idname, bool quiet) { if (idname[0]) { - wmManipulatorGroupType *wgt; + wmGizmoGroupType *wgt; - wgt = BLI_ghash_lookup(global_manipulatorgrouptype_hash, idname); + wgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname); if (wgt) { return wgt; } if (!quiet) { - printf("search for unknown manipulator group '%s'\n", idname); + printf("search for unknown gizmo group '%s'\n", idname); } } else { if (!quiet) { - printf("search for empty manipulator group\n"); + printf("search for empty gizmo group\n"); } } @@ -75,123 +75,123 @@ wmManipulatorGroupType *WM_manipulatorgrouptype_find(const char *idname, bool qu } /* caller must free */ -void WM_manipulatorgrouptype_iter(GHashIterator *ghi) +void WM_gizmogrouptype_iter(GHashIterator *ghi) { - BLI_ghashIterator_init(ghi, global_manipulatorgrouptype_hash); + BLI_ghashIterator_init(ghi, global_gizmogrouptype_hash); } -static wmManipulatorGroupType *wm_manipulatorgrouptype_append__begin(void) +static wmGizmoGroupType *wm_gizmogrouptype_append__begin(void) { - wmManipulatorGroupType *wgt = MEM_callocN(sizeof(wmManipulatorGroupType), "manipulatorgrouptype"); + wmGizmoGroupType *wgt = MEM_callocN(sizeof(wmGizmoGroupType), "gizmogrouptype"); return wgt; } -static void wm_manipulatorgrouptype_append__end(wmManipulatorGroupType *wgt) +static void wm_gizmogrouptype_append__end(wmGizmoGroupType *wgt) { BLI_assert(wgt->name != NULL); BLI_assert(wgt->idname != NULL); - wgt->type_update_flag |= WM_MANIPULATORMAPTYPE_KEYMAP_INIT; + wgt->type_update_flag |= WM_GIZMOMAPTYPE_KEYMAP_INIT; /* if not set, use default */ if (wgt->setup_keymap == NULL) { - if (wgt->flag & WM_MANIPULATORGROUPTYPE_SELECT) { - wgt->setup_keymap = WM_manipulatorgroup_keymap_common_select; + if (wgt->flag & WM_GIZMOGROUPTYPE_SELECT) { + wgt->setup_keymap = WM_gizmogroup_keymap_common_select; } else { - wgt->setup_keymap = WM_manipulatorgroup_keymap_common; + wgt->setup_keymap = WM_gizmogroup_keymap_common; } } - BLI_ghash_insert(global_manipulatorgrouptype_hash, (void *)wgt->idname, wgt); + BLI_ghash_insert(global_gizmogrouptype_hash, (void *)wgt->idname, wgt); } -wmManipulatorGroupType *WM_manipulatorgrouptype_append( - void (*wtfunc)(struct wmManipulatorGroupType *)) +wmGizmoGroupType *WM_gizmogrouptype_append( + void (*wtfunc)(struct wmGizmoGroupType *)) { - wmManipulatorGroupType *wgt = wm_manipulatorgrouptype_append__begin(); + wmGizmoGroupType *wgt = wm_gizmogrouptype_append__begin(); wtfunc(wgt); - wm_manipulatorgrouptype_append__end(wgt); + wm_gizmogrouptype_append__end(wgt); return wgt; } -wmManipulatorGroupType *WM_manipulatorgrouptype_append_ptr( - void (*wtfunc)(struct wmManipulatorGroupType *, void *), void *userdata) +wmGizmoGroupType *WM_gizmogrouptype_append_ptr( + void (*wtfunc)(struct wmGizmoGroupType *, void *), void *userdata) { - wmManipulatorGroupType *wgt = wm_manipulatorgrouptype_append__begin(); + wmGizmoGroupType *wgt = wm_gizmogrouptype_append__begin(); wtfunc(wgt, userdata); - wm_manipulatorgrouptype_append__end(wgt); + wm_gizmogrouptype_append__end(wgt); return wgt; } /** - * Append and insert into a manipulator typemap. - * This is most common for C manipulators which are enabled by default. + * Append and insert into a gizmo typemap. + * This is most common for C gizmos which are enabled by default. */ -wmManipulatorGroupTypeRef *WM_manipulatorgrouptype_append_and_link( - wmManipulatorMapType *mmap_type, - void (*wtfunc)(struct wmManipulatorGroupType *)) +wmGizmoGroupTypeRef *WM_gizmogrouptype_append_and_link( + wmGizmoMapType *mmap_type, + void (*wtfunc)(struct wmGizmoGroupType *)) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_append(wtfunc); + wmGizmoGroupType *wgt = WM_gizmogrouptype_append(wtfunc); wgt->mmap_params.spaceid = mmap_type->spaceid; wgt->mmap_params.regionid = mmap_type->regionid; - return WM_manipulatormaptype_group_link_ptr(mmap_type, wgt); + return WM_gizmomaptype_group_link_ptr(mmap_type, wgt); } /** * Free but don't remove from ghash. */ -static void manipulatorgrouptype_free(wmManipulatorGroupType *wgt) +static void gizmogrouptype_free(wmGizmoGroupType *wgt) { - if (wgt->ext.srna) { /* python manipulator group, allocs own string */ + if (wgt->ext.srna) { /* python gizmo group, allocs own string */ MEM_freeN((void *)wgt->idname); } MEM_freeN(wgt); } -void WM_manipulatorgrouptype_free_ptr(wmManipulatorGroupType *wgt) +void WM_gizmogrouptype_free_ptr(wmGizmoGroupType *wgt) { - BLI_assert(wgt == WM_manipulatorgrouptype_find(wgt->idname, false)); + BLI_assert(wgt == WM_gizmogrouptype_find(wgt->idname, false)); - BLI_ghash_remove(global_manipulatorgrouptype_hash, wgt->idname, NULL, NULL); + BLI_ghash_remove(global_gizmogrouptype_hash, wgt->idname, NULL, NULL); - manipulatorgrouptype_free(wgt); + gizmogrouptype_free(wgt); /* XXX, TODO, update the world! */ } -bool WM_manipulatorgrouptype_free(const char *idname) +bool WM_gizmogrouptype_free(const char *idname) { - wmManipulatorGroupType *wgt = BLI_ghash_lookup(global_manipulatorgrouptype_hash, idname); + wmGizmoGroupType *wgt = BLI_ghash_lookup(global_gizmogrouptype_hash, idname); if (wgt == NULL) { return false; } - WM_manipulatorgrouptype_free_ptr(wgt); + WM_gizmogrouptype_free_ptr(wgt); return true; } -static void wm_manipulatorgrouptype_ghash_free_cb(wmManipulatorGroupType *wgt) +static void wm_gizmogrouptype_ghash_free_cb(wmGizmoGroupType *wgt) { - manipulatorgrouptype_free(wgt); + gizmogrouptype_free(wgt); } -void wm_manipulatorgrouptype_free(void) +void wm_gizmogrouptype_free(void) { - BLI_ghash_free(global_manipulatorgrouptype_hash, NULL, (GHashValFreeFP)wm_manipulatorgrouptype_ghash_free_cb); - global_manipulatorgrouptype_hash = NULL; + BLI_ghash_free(global_gizmogrouptype_hash, NULL, (GHashValFreeFP)wm_gizmogrouptype_ghash_free_cb); + global_gizmogrouptype_hash = NULL; } /* called on initialize WM_init() */ -void wm_manipulatorgrouptype_init(void) +void wm_gizmogrouptype_init(void) { /* reserve size is set based on blender default setup */ - global_manipulatorgrouptype_hash = BLI_ghash_str_new_ex("wm_manipulatorgrouptype_init gh", 128); + global_gizmogrouptype_hash = BLI_ghash_str_new_ex("wm_gizmogrouptype_init gh", 128); } /** \} */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h index 7a007a8a909..5eed4f2bda2 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h @@ -29,32 +29,32 @@ #define __WM_GIZMO_INTERN_H__ struct wmKeyConfig; -struct wmManipulatorMap; -struct ManipulatorGeomInfo; +struct wmGizmoMap; +struct GizmoGeomInfo; struct GHashIterator; #include "wm_gizmo_fn.h" /* -------------------------------------------------------------------- */ -/* wmManipulator */ +/* wmGizmo */ -bool wm_manipulator_select_set_ex( - struct wmManipulatorMap *mmap, struct wmManipulator *mpr, bool select, +bool wm_gizmo_select_set_ex( + struct wmGizmoMap *mmap, struct wmGizmo *mpr, bool select, bool use_array, bool use_callback); -bool wm_manipulator_select_and_highlight(bContext *C, struct wmManipulatorMap *mmap, struct wmManipulator *mpr); +bool wm_gizmo_select_and_highlight(bContext *C, struct wmGizmoMap *mmap, struct wmGizmo *mpr); -void wm_manipulator_calculate_scale(struct wmManipulator *mpr, const bContext *C); -void wm_manipulator_update(struct wmManipulator *mpr, const bContext *C, const bool refresh_map); +void wm_gizmo_calculate_scale(struct wmGizmo *mpr, const bContext *C); +void wm_gizmo_update(struct wmGizmo *mpr, const bContext *C, const bool refresh_map); -int wm_manipulator_is_visible(struct wmManipulator *mpr); +int wm_gizmo_is_visible(struct wmGizmo *mpr); enum { - WM_MANIPULATOR_IS_VISIBLE_UPDATE = (1 << 0), - WM_MANIPULATOR_IS_VISIBLE_DRAW = (1 << 1), + WM_GIZMO_IS_VISIBLE_UPDATE = (1 << 0), + WM_GIZMO_IS_VISIBLE_DRAW = (1 << 1), }; /* -------------------------------------------------------------------- */ -/* wmManipulatorGroup */ +/* wmGizmoGroup */ enum { TWEAK_MODAL_CANCEL = 1, @@ -65,53 +65,53 @@ enum { TWEAK_MODAL_SNAP_OFF, }; -struct wmManipulatorGroup *wm_manipulatorgroup_new_from_type( - struct wmManipulatorMap *mmap, struct wmManipulatorGroupType *wgt); -void wm_manipulatorgroup_free(bContext *C, struct wmManipulatorGroup *mgroup); -void wm_manipulatorgroup_manipulator_register(struct wmManipulatorGroup *mgroup, struct wmManipulator *mpr); -struct wmManipulator *wm_manipulatorgroup_find_intersected_manipulator( - const struct wmManipulatorGroup *mgroup, struct bContext *C, const struct wmEvent *event, +struct wmGizmoGroup *wm_gizmogroup_new_from_type( + struct wmGizmoMap *mmap, struct wmGizmoGroupType *wgt); +void wm_gizmogroup_free(bContext *C, struct wmGizmoGroup *mgroup); +void wm_gizmogroup_gizmo_register(struct wmGizmoGroup *mgroup, struct wmGizmo *mpr); +struct wmGizmo *wm_gizmogroup_find_intersected_gizmo( + const struct wmGizmoGroup *mgroup, struct bContext *C, const struct wmEvent *event, int *r_part); -void wm_manipulatorgroup_intersectable_manipulators_to_list( - const struct wmManipulatorGroup *mgroup, struct ListBase *listbase); -void wm_manipulatorgroup_ensure_initialized(struct wmManipulatorGroup *mgroup, const struct bContext *C); -bool wm_manipulatorgroup_is_visible_in_drawstep( - const struct wmManipulatorGroup *mgroup, const eWM_ManipulatorMapDrawStep drawstep); +void wm_gizmogroup_intersectable_gizmos_to_list( + const struct wmGizmoGroup *mgroup, struct ListBase *listbase); +void wm_gizmogroup_ensure_initialized(struct wmGizmoGroup *mgroup, const struct bContext *C); +bool wm_gizmogroup_is_visible_in_drawstep( + const struct wmGizmoGroup *mgroup, const eWM_GizmoFlagMapDrawStep drawstep); -void wm_manipulatorgrouptype_setup_keymap( - struct wmManipulatorGroupType *wgt, struct wmKeyConfig *keyconf); +void wm_gizmogrouptype_setup_keymap( + struct wmGizmoGroupType *wgt, struct wmKeyConfig *keyconf); /* -------------------------------------------------------------------- */ -/* wmManipulatorMap */ +/* wmGizmoMap */ -typedef struct wmManipulatorMapSelectState { - struct wmManipulator **items; +typedef struct wmGizmoMapSelectState { + struct wmGizmo **items; int len, len_alloc; -} wmManipulatorMapSelectState; +} wmGizmoMapSelectState; -struct wmManipulatorMap { +struct wmGizmoMap { - struct wmManipulatorMapType *type; - ListBase groups; /* wmManipulatorGroup */ + struct wmGizmoMapType *type; + ListBase groups; /* wmGizmoGroup */ /* private, update tagging (enum defined in C source). */ - char update_flag[WM_MANIPULATORMAP_DRAWSTEP_MAX]; + char update_flag[WM_GIZMOMAP_DRAWSTEP_MAX]; /** - * \brief Manipulator map runtime context + * \brief Gizmo map runtime context * - * Contains information about this manipulator-map. Currently - * highlighted manipulator, currently selected manipulators, ... + * Contains information about this gizmo-map. Currently + * highlighted gizmo, currently selected gizmos, ... */ struct { - /* we redraw the manipulator-map when this changes */ - struct wmManipulator *highlight; - /* User has clicked this manipulator and it gets all input. */ - struct wmManipulator *modal; - /* array for all selected manipulators */ - struct wmManipulatorMapSelectState select; - /* cursor location at point of entering modal (see: WM_MANIPULATOR_GRAB_CURSOR) */ + /* we redraw the gizmo-map when this changes */ + struct wmGizmo *highlight; + /* User has clicked this gizmo and it gets all input. */ + struct wmGizmo *modal; + /* array for all selected gizmos */ + struct wmGizmoMapSelectState select; + /* cursor location at point of entering modal (see: WM_GIZMO_GRAB_CURSOR) */ int event_xy[2]; short event_grabcursor; /* until we have nice cursor push/pop API. */ @@ -120,25 +120,25 @@ struct wmManipulatorMap { }; /** - * This is a container for all manipulator types that can be instantiated in a region. + * This is a container for all gizmo types that can be instantiated in a region. * (similar to dropboxes). * * \note There is only ever one of these for every (area, region) combination. */ -struct wmManipulatorMapType { - struct wmManipulatorMapType *next, *prev; +struct wmGizmoMapType { + struct wmGizmoMapType *next, *prev; short spaceid, regionid; - /* types of manipulator-groups for this manipulator-map type */ + /* types of gizmo-groups for this gizmo-map type */ ListBase grouptype_refs; - /* eManipulatorMapTypeUpdateFlags */ - eWM_ManipulatorMapTypeUpdateFlag type_update_flag; + /* eGizmoMapTypeUpdateFlags */ + eWM_GizmoFlagMapTypeUpdateFlag type_update_flag; }; -void wm_manipulatormap_select_array_clear(struct wmManipulatorMap *mmap); -bool wm_manipulatormap_deselect_all(struct wmManipulatorMap *mmap); -void wm_manipulatormap_select_array_shrink(struct wmManipulatorMap *mmap, int len_subtract); -void wm_manipulatormap_select_array_push_back(struct wmManipulatorMap *mmap, wmManipulator *mpr); -void wm_manipulatormap_select_array_remove(struct wmManipulatorMap *mmap, wmManipulator *mpr); +void wm_gizmomap_select_array_clear(struct wmGizmoMap *mmap); +bool wm_gizmomap_deselect_all(struct wmGizmoMap *mmap); +void wm_gizmomap_select_array_shrink(struct wmGizmoMap *mmap, int len_subtract); +void wm_gizmomap_select_array_push_back(struct wmGizmoMap *mmap, wmGizmo *mpr); +void wm_gizmomap_select_array_remove(struct wmGizmoMap *mmap, wmGizmo *mpr); #endif diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c index 94db6b45887..9da1591d535 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c @@ -61,42 +61,42 @@ #include "wm_gizmo_intern.h" /** - * Store all manipulator-maps here. Anyone who wants to register a manipulator for a certain - * area type can query the manipulator-map to do so. + * Store all gizmo-maps here. Anyone who wants to register a gizmo for a certain + * area type can query the gizmo-map to do so. */ -static ListBase manipulatormaptypes = {NULL, NULL}; +static ListBase gizmomaptypes = {NULL, NULL}; /** - * Update when manipulator-map types change. + * Update when gizmo-map types change. */ /* so operator removal can trigger update */ -typedef enum eWM_ManipulatorGroupTypeGlobalFlag { - WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_INIT = (1 << 0), - WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_REMOVE = (1 << 1), -} eWM_ManipulatorGroupTypeGlobalFlag; +typedef enum eWM_GizmoFlagGroupTypeGlobalFlag { + WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT = (1 << 0), + WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE = (1 << 1), +} eWM_GizmoFlagGroupTypeGlobalFlag; -static eWM_ManipulatorGroupTypeGlobalFlag wm_mmap_type_update_flag = 0; +static eWM_GizmoFlagGroupTypeGlobalFlag wm_mmap_type_update_flag = 0; /** - * Manipulator-map update tagging. + * Gizmo-map update tagging. */ enum { - /** #manipulatormap_prepare_drawing has run */ - MANIPULATORMAP_IS_PREPARE_DRAW = (1 << 0), - MANIPULATORMAP_IS_REFRESH_CALLBACK = (1 << 1), + /** #gizmomap_prepare_drawing has run */ + GIZMOMAP_IS_PREPARE_DRAW = (1 << 0), + GIZMOMAP_IS_REFRESH_CALLBACK = (1 << 1), }; /* -------------------------------------------------------------------- */ -/** \name wmManipulatorMap Selection Array API +/** \name wmGizmoMap Selection Array API * - * Just handle ``wm_manipulatormap_select_array_*``, not flags or callbacks. + * Just handle ``wm_gizmomap_select_array_*``, not flags or callbacks. * * \{ */ -static void wm_manipulatormap_select_array_ensure_len_alloc(wmManipulatorMap *mmap, int len) +static void wm_gizmomap_select_array_ensure_len_alloc(wmGizmoMap *mmap, int len) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; if (len <= msel->len_alloc) { return; } @@ -104,20 +104,20 @@ static void wm_manipulatormap_select_array_ensure_len_alloc(wmManipulatorMap *mm msel->len_alloc = len; } -void wm_manipulatormap_select_array_clear(wmManipulatorMap *mmap) +void wm_gizmomap_select_array_clear(wmGizmoMap *mmap) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; MEM_SAFE_FREE(msel->items); msel->len = 0; msel->len_alloc = 0; } -void wm_manipulatormap_select_array_shrink(wmManipulatorMap *mmap, int len_subtract) +void wm_gizmomap_select_array_shrink(wmGizmoMap *mmap, int len_subtract) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; msel->len -= len_subtract; if (msel->len <= 0) { - wm_manipulatormap_select_array_clear(mmap); + wm_gizmomap_select_array_clear(mmap); } else { if (msel->len < msel->len_alloc / 2) { @@ -127,9 +127,9 @@ void wm_manipulatormap_select_array_shrink(wmManipulatorMap *mmap, int len_subtr } } -void wm_manipulatormap_select_array_push_back(wmManipulatorMap *mmap, wmManipulator *mpr) +void wm_gizmomap_select_array_push_back(wmGizmoMap *mmap, wmGizmo *mpr) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; BLI_assert(msel->len <= msel->len_alloc); if (msel->len == msel->len_alloc) { msel->len_alloc = (msel->len + 1) * 2; @@ -138,16 +138,16 @@ void wm_manipulatormap_select_array_push_back(wmManipulatorMap *mmap, wmManipula msel->items[msel->len++] = mpr; } -void wm_manipulatormap_select_array_remove(wmManipulatorMap *mmap, wmManipulator *mpr) +void wm_gizmomap_select_array_remove(wmGizmoMap *mmap, wmGizmo *mpr) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; - /* remove manipulator from selected_manipulators array */ + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; + /* remove gizmo from selected_gizmos array */ for (int i = 0; i < msel->len; i++) { if (msel->items[i] == mpr) { for (int j = i; j < (msel->len - 1); j++) { msel->items[j] = msel->items[j + 1]; } - wm_manipulatormap_select_array_shrink(mmap, 1); + wm_gizmomap_select_array_shrink(mmap, 1); break; } } @@ -158,41 +158,41 @@ void wm_manipulatormap_select_array_remove(wmManipulatorMap *mmap, wmManipulator /* -------------------------------------------------------------------- */ -/** \name wmManipulatorMap +/** \name wmGizmoMap * * \{ */ /** - * Creates a manipulator-map with all registered manipulators for that type + * Creates a gizmo-map with all registered gizmos for that type */ -wmManipulatorMap *WM_manipulatormap_new_from_type( - const struct wmManipulatorMapType_Params *mmap_params) +wmGizmoMap *WM_gizmomap_new_from_type( + const struct wmGizmoMapType_Params *mmap_params) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(mmap_params); - wmManipulatorMap *mmap; + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(mmap_params); + wmGizmoMap *mmap; - mmap = MEM_callocN(sizeof(wmManipulatorMap), "ManipulatorMap"); + mmap = MEM_callocN(sizeof(wmGizmoMap), "GizmoMap"); mmap->type = mmap_type; - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); - /* create all manipulator-groups for this manipulator-map. We may create an empty one - * too in anticipation of manipulators from operators etc */ - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { - wm_manipulatorgroup_new_from_type(mmap, wgt_ref->type); + /* create all gizmo-groups for this gizmo-map. We may create an empty one + * too in anticipation of gizmos from operators etc */ + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { + wm_gizmogroup_new_from_type(mmap, wgt_ref->type); } return mmap; } -void wm_manipulatormap_remove(wmManipulatorMap *mmap) +void wm_gizmomap_remove(wmGizmoMap *mmap) { /* Clear first so further calls don't waste time trying to maintain correct array state. */ - wm_manipulatormap_select_array_clear(mmap); + wm_gizmomap_select_array_clear(mmap); - for (wmManipulatorGroup *mgroup = mmap->groups.first, *mgroup_next; mgroup; mgroup = mgroup_next) { + for (wmGizmoGroup *mgroup = mmap->groups.first, *mgroup_next; mgroup; mgroup = mgroup_next) { mgroup_next = mgroup->next; BLI_assert(mgroup->parent_mmap == mmap); - wm_manipulatorgroup_free(NULL, mgroup); + wm_gizmogroup_free(NULL, mgroup); } BLI_assert(BLI_listbase_is_empty(&mmap->groups)); @@ -200,22 +200,22 @@ void wm_manipulatormap_remove(wmManipulatorMap *mmap) } -wmManipulatorGroup *WM_manipulatormap_group_find( - struct wmManipulatorMap *mmap, +wmGizmoGroup *WM_gizmomap_group_find( + struct wmGizmoMap *mmap, const char *idname) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); if (wgt) { - return WM_manipulatormap_group_find_ptr(mmap, wgt); + return WM_gizmomap_group_find_ptr(mmap, wgt); } return NULL; } -wmManipulatorGroup *WM_manipulatormap_group_find_ptr( - struct wmManipulatorMap *mmap, - const struct wmManipulatorGroupType *wgt) +wmGizmoGroup *WM_gizmomap_group_find_ptr( + struct wmGizmoMap *mmap, + const struct wmGizmoGroupType *wgt) { - for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { + for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { if (mgroup->type == wgt) { return mgroup; } @@ -223,12 +223,12 @@ wmManipulatorGroup *WM_manipulatormap_group_find_ptr( return NULL; } -const ListBase *WM_manipulatormap_group_list(wmManipulatorMap *mmap) +const ListBase *WM_gizmomap_group_list(wmGizmoMap *mmap) { return &mmap->groups; } -bool WM_manipulatormap_is_any_selected(const wmManipulatorMap *mmap) +bool WM_gizmomap_is_any_selected(const wmGizmoMap *mmap) { return mmap->mmap_context.select.len != 0; } @@ -236,8 +236,8 @@ bool WM_manipulatormap_is_any_selected(const wmManipulatorMap *mmap) /** * \note We could use a callback to define bounds, for now just use matrix location. */ -bool WM_manipulatormap_minmax( - const wmManipulatorMap *mmap, bool UNUSED(use_hidden), bool use_select, +bool WM_gizmomap_minmax( + const wmGizmoMap *mmap, bool UNUSED(use_hidden), bool use_select, float r_min[3], float r_max[3]) { if (use_select) { @@ -255,26 +255,26 @@ bool WM_manipulatormap_minmax( } /** - * Creates and returns idname hash table for (visible) manipulators in \a mmap + * Creates and returns idname hash table for (visible) gizmos in \a mmap * - * \param poll Polling function for excluding manipulators. + * \param poll Polling function for excluding gizmos. * \param data Custom data passed to \a poll * * TODO(campbell): this uses unreliable order, * best we use an iterator function instead of a hash. */ -static GHash *WM_manipulatormap_manipulator_hash_new( - const bContext *C, wmManipulatorMap *mmap, - bool (*poll)(const wmManipulator *, void *), +static GHash *WM_gizmomap_gizmo_hash_new( + const bContext *C, wmGizmoMap *mmap, + bool (*poll)(const wmGizmo *, void *), void *data, const bool include_hidden) { GHash *hash = BLI_ghash_ptr_new(__func__); - /* collect manipulators */ - for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { - if (WM_manipulator_group_type_poll(C, mgroup->type)) { - for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { - if ((include_hidden || (mpr->flag & WM_MANIPULATOR_HIDDEN) == 0) && + /* collect gizmos */ + for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { + if (WM_gizmo_group_type_poll(C, mgroup->type)) { + for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { + if ((include_hidden || (mpr->flag & WM_GIZMO_HIDDEN) == 0) && (!poll || poll(mpr, data))) { BLI_ghash_insert(hash, mpr, mpr); @@ -286,35 +286,35 @@ static GHash *WM_manipulatormap_manipulator_hash_new( return hash; } -void WM_manipulatormap_tag_refresh(wmManipulatorMap *mmap) +void WM_gizmomap_tag_refresh(wmGizmoMap *mmap) { if (mmap) { /* We might want only to refresh some, for tag all steps. */ - for (int i = 0; i < WM_MANIPULATORMAP_DRAWSTEP_MAX; i++) { + for (int i = 0; i < WM_GIZMOMAP_DRAWSTEP_MAX; i++) { mmap->update_flag[i] |= ( - MANIPULATORMAP_IS_PREPARE_DRAW | - MANIPULATORMAP_IS_REFRESH_CALLBACK); + GIZMOMAP_IS_PREPARE_DRAW | + GIZMOMAP_IS_REFRESH_CALLBACK); } } } -static bool manipulator_prepare_drawing( - wmManipulatorMap *mmap, wmManipulator *mpr, - const bContext *C, ListBase *draw_manipulators, - const eWM_ManipulatorMapDrawStep drawstep) +static bool gizmo_prepare_drawing( + wmGizmoMap *mmap, wmGizmo *mpr, + const bContext *C, ListBase *draw_gizmos, + const eWM_GizmoFlagMapDrawStep drawstep) { - int do_draw = wm_manipulator_is_visible(mpr); + int do_draw = wm_gizmo_is_visible(mpr); if (do_draw == 0) { /* skip */ } else { /* Ensure we get RNA updates */ - if (do_draw & WM_MANIPULATOR_IS_VISIBLE_UPDATE) { - /* hover manipulators need updating, even if we don't draw them */ - wm_manipulator_update(mpr, C, (mmap->update_flag[drawstep] & MANIPULATORMAP_IS_PREPARE_DRAW) != 0); + if (do_draw & WM_GIZMO_IS_VISIBLE_UPDATE) { + /* hover gizmos need updating, even if we don't draw them */ + wm_gizmo_update(mpr, C, (mmap->update_flag[drawstep] & GIZMOMAP_IS_PREPARE_DRAW) != 0); } - if (do_draw & WM_MANIPULATOR_IS_VISIBLE_DRAW) { - BLI_addhead(draw_manipulators, BLI_genericNodeN(mpr)); + if (do_draw & WM_GIZMO_IS_VISIBLE_DRAW) { + BLI_addhead(draw_gizmos, BLI_genericNodeN(mpr)); } return true; } @@ -323,67 +323,67 @@ static bool manipulator_prepare_drawing( } /** - * Update manipulators of \a mmap to prepare for drawing. Adds all manipulators that - * should be drawn to list \a draw_manipulators, note that added items need freeing. + * Update gizmos of \a mmap to prepare for drawing. Adds all gizmos that + * should be drawn to list \a draw_gizmos, note that added items need freeing. */ -static void manipulatormap_prepare_drawing( - wmManipulatorMap *mmap, const bContext *C, ListBase *draw_manipulators, - const eWM_ManipulatorMapDrawStep drawstep) +static void gizmomap_prepare_drawing( + wmGizmoMap *mmap, const bContext *C, ListBase *draw_gizmos, + const eWM_GizmoFlagMapDrawStep drawstep) { if (!mmap || BLI_listbase_is_empty(&mmap->groups)) return; - wmManipulator *mpr_modal = mmap->mmap_context.modal; + wmGizmo *mpr_modal = mmap->mmap_context.modal; - /* only active manipulator needs updating */ + /* only active gizmo needs updating */ if (mpr_modal) { - if ((mpr_modal->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL) == 0) { - if (wm_manipulatorgroup_is_visible_in_drawstep(mpr_modal->parent_mgroup, drawstep)) { - if (manipulator_prepare_drawing(mmap, mpr_modal, C, draw_manipulators, drawstep)) { - mmap->update_flag[drawstep] &= ~MANIPULATORMAP_IS_PREPARE_DRAW; + if ((mpr_modal->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL) == 0) { + if (wm_gizmogroup_is_visible_in_drawstep(mpr_modal->parent_mgroup, drawstep)) { + if (gizmo_prepare_drawing(mmap, mpr_modal, C, draw_gizmos, drawstep)) { + mmap->update_flag[drawstep] &= ~GIZMOMAP_IS_PREPARE_DRAW; } } - /* don't draw any other manipulators */ + /* don't draw any other gizmos */ return; } } - for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { + for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { /* check group visibility - drawstep first to avoid unnecessary call of group poll callback */ - if (!wm_manipulatorgroup_is_visible_in_drawstep(mgroup, drawstep) || - !WM_manipulator_group_type_poll(C, mgroup->type)) + if (!wm_gizmogroup_is_visible_in_drawstep(mgroup, drawstep) || + !WM_gizmo_group_type_poll(C, mgroup->type)) { continue; } /* needs to be initialized on first draw */ - /* XXX weak: Manipulator-group may skip refreshing if it's invisible (map gets untagged nevertheless) */ - if (mmap->update_flag[drawstep] & MANIPULATORMAP_IS_REFRESH_CALLBACK) { + /* XXX weak: Gizmo-group may skip refreshing if it's invisible (map gets untagged nevertheless) */ + if (mmap->update_flag[drawstep] & GIZMOMAP_IS_REFRESH_CALLBACK) { /* force refresh again. */ - mgroup->init_flag &= ~WM_MANIPULATORGROUP_INIT_REFRESH; + mgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH; } /* Calls `setup`, `setup_keymap` and `refresh` if they're defined. */ - wm_manipulatorgroup_ensure_initialized(mgroup, C); + wm_gizmogroup_ensure_initialized(mgroup, C); /* prepare drawing */ if (mgroup->type->draw_prepare) { mgroup->type->draw_prepare(C, mgroup); } - for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { - manipulator_prepare_drawing(mmap, mpr, C, draw_manipulators, drawstep); + for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { + gizmo_prepare_drawing(mmap, mpr, C, draw_gizmos, drawstep); } } mmap->update_flag[drawstep] &= - ~(MANIPULATORMAP_IS_REFRESH_CALLBACK | - MANIPULATORMAP_IS_PREPARE_DRAW); + ~(GIZMOMAP_IS_REFRESH_CALLBACK | + GIZMOMAP_IS_PREPARE_DRAW); } /** - * Draw all visible manipulators in \a mmap. - * Uses global draw_manipulators listbase. + * Draw all visible gizmos in \a mmap. + * Uses global draw_gizmos listbase. */ -static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext *C, ListBase *draw_manipulators) +static void gizmos_draw_list(const wmGizmoMap *mmap, const bContext *C, ListBase *draw_gizmos) { /* Can be empty if we're dynamically added and removed. */ if ((mmap == NULL) || BLI_listbase_is_empty(&mmap->groups)) { @@ -391,19 +391,19 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext } /* TODO this will need it own shader probably? don't think it can be handled from that point though. */ -/* const bool use_lighting = (U.manipulator_flag & V3D_MANIPULATOR_SHADED) != 0; */ +/* const bool use_lighting = (U.gizmo_flag & V3D_GIZMO_SHADED) != 0; */ bool is_depth_prev = false; - /* draw_manipulators contains all visible manipulators - draw them */ - for (LinkData *link = draw_manipulators->first, *link_next; link; link = link_next) { - wmManipulator *mpr = link->data; + /* draw_gizmos contains all visible gizmos - draw them */ + for (LinkData *link = draw_gizmos->first, *link_next; link; link = link_next) { + wmGizmo *mpr = link->data; link_next = link->next; - bool is_depth = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_DEPTH_3D) != 0; + bool is_depth = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0; /* Weak! since we don't 100% support depth yet (select ignores depth) always show highlighted */ - if (is_depth && (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT)) { + if (is_depth && (mpr->state & WM_GIZMO_STATE_HIGHLIGHT)) { is_depth = false; } @@ -420,7 +420,7 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext is_depth_prev = is_depth; } - /* XXX force AntiAlias Manipulators. */ + /* XXX force AntiAlias Gizmos. */ glEnable(GL_LINE_SMOOTH); glEnable(GL_POLYGON_SMOOTH); @@ -429,8 +429,8 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext glDisable(GL_LINE_SMOOTH); glDisable(GL_POLYGON_SMOOTH); - /* free/remove manipulator link after drawing */ - BLI_freelinkN(draw_manipulators, link); + /* free/remove gizmo link after drawing */ + BLI_freelinkN(draw_gizmos, link); } if (is_depth_prev) { @@ -438,34 +438,34 @@ static void manipulators_draw_list(const wmManipulatorMap *mmap, const bContext } } -void WM_manipulatormap_draw( - wmManipulatorMap *mmap, const bContext *C, - const eWM_ManipulatorMapDrawStep drawstep) +void WM_gizmomap_draw( + wmGizmoMap *mmap, const bContext *C, + const eWM_GizmoFlagMapDrawStep drawstep) { - if (!WM_manipulator_context_check_drawstep(C, drawstep)) { + if (!WM_gizmo_context_check_drawstep(C, drawstep)) { return; } - ListBase draw_manipulators = {NULL}; + ListBase draw_gizmos = {NULL}; - manipulatormap_prepare_drawing(mmap, C, &draw_manipulators, drawstep); - manipulators_draw_list(mmap, C, &draw_manipulators); - BLI_assert(BLI_listbase_is_empty(&draw_manipulators)); + gizmomap_prepare_drawing(mmap, C, &draw_gizmos, drawstep); + gizmos_draw_list(mmap, C, &draw_gizmos); + BLI_assert(BLI_listbase_is_empty(&draw_gizmos)); } -static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible_manipulators) +static void gizmo_draw_select_3D_loop(const bContext *C, ListBase *visible_gizmos) { int select_id = 0; - wmManipulator *mpr; + wmGizmo *mpr; /* TODO(campbell): this depends on depth buffer being written to, currently broken for the 3D view. */ bool is_depth_prev = false; bool is_depth_skip_prev = false; - for (LinkData *link = visible_manipulators->first; link; link = link->next) { + for (LinkData *link = visible_gizmos->first; link; link = link->next) { mpr = link->data; - bool is_depth = (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_DEPTH_3D) != 0; + bool is_depth = (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_DEPTH_3D) != 0; if (is_depth == is_depth_prev) { /* pass */ } @@ -478,7 +478,7 @@ static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible } is_depth_prev = is_depth; } - bool is_depth_skip = (mpr->flag & WM_MANIPULATOR_SELECT_BACKGROUND) != 0; + bool is_depth_skip = (mpr->flag & WM_GIZMO_SELECT_BACKGROUND) != 0; if (is_depth_skip == is_depth_skip_prev) { /* pass */ } @@ -487,7 +487,7 @@ static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible is_depth_skip_prev = is_depth_skip; } - /* pass the selection id shifted by 8 bits. Last 8 bits are used for selected manipulator part id */ + /* pass the selection id shifted by 8 bits. Last 8 bits are used for selected gizmo part id */ mpr->type->draw_select(C, mpr, select_id << 8); @@ -503,15 +503,15 @@ static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible } } -static int manipulator_find_intersected_3d_intern( - ListBase *visible_manipulators, const bContext *C, const int co[2], +static int gizmo_find_intersected_3d_intern( + ListBase *visible_gizmos, const bContext *C, const int co[2], const int hotspot) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = sa->spacedata.first; rcti rect; - /* Almost certainly overkill, but allow for many custom manipulators. */ + /* Almost certainly overkill, but allow for many custom gizmos. */ GLuint buffer[MAXPICKBUF]; short hits; const bool do_passes = GPU_select_query_check_active(); @@ -525,13 +525,13 @@ static int manipulator_find_intersected_3d_intern( else GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_ALL, 0); /* do the drawing */ - manipulator_draw_select_3D_loop(C, visible_manipulators); + gizmo_draw_select_3D_loop(C, visible_gizmos); hits = GPU_select_end(); if (do_passes && (hits > 0)) { GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits); - manipulator_draw_select_3D_loop(C, visible_manipulators); + gizmo_draw_select_3D_loop(C, visible_gizmos); GPU_select_end(); } @@ -543,13 +543,13 @@ static int manipulator_find_intersected_3d_intern( } /** - * Try to find a 3D manipulator at screen-space coordinate \a co. Uses OpenGL picking. + * Try to find a 3D gizmo at screen-space coordinate \a co. Uses OpenGL picking. */ -static wmManipulator *manipulator_find_intersected_3d( - bContext *C, const int co[2], ListBase *visible_manipulators, +static wmGizmo *gizmo_find_intersected_3d( + bContext *C, const int co[2], ListBase *visible_gizmos, int *r_part) { - wmManipulator *result = NULL; + wmGizmo *result = NULL; int hit = -1; int hotspot_radii[] = { @@ -566,20 +566,20 @@ static wmManipulator *manipulator_find_intersected_3d( hit = -1; for (int i = 0; i < ARRAY_SIZE(hotspot_radii); i++) { - hit = manipulator_find_intersected_3d_intern(visible_manipulators, C, co, hotspot_radii[i]); + hit = gizmo_find_intersected_3d_intern(visible_gizmos, C, co, hotspot_radii[i]); if (hit != -1) { break; } } if (hit != -1) { - LinkData *link = BLI_findlink(visible_manipulators, hit >> 8); + LinkData *link = BLI_findlink(visible_gizmos, hit >> 8); if (link != NULL) { *r_part = hit & 255; result = link->data; } else { - /* All manipulators should use selection ID they're given as part of the callback, + /* All gizmos should use selection ID they're given as part of the callback, * if they don't it will attempt tp lookup non-existing index. */ BLI_assert(0); } @@ -589,51 +589,51 @@ static wmManipulator *manipulator_find_intersected_3d( } /** - * Try to find a manipulator under the mouse position. 2D intersections have priority over + * Try to find a gizmo under the mouse position. 2D intersections have priority over * 3D ones (could check for smallest screen-space distance but not needed right now). */ -wmManipulator *wm_manipulatormap_highlight_find( - wmManipulatorMap *mmap, bContext *C, const wmEvent *event, +wmGizmo *wm_gizmomap_highlight_find( + wmGizmoMap *mmap, bContext *C, const wmEvent *event, int *r_part) { - wmManipulator *mpr = NULL; - ListBase visible_3d_manipulators = {NULL}; - bool do_step[WM_MANIPULATORMAP_DRAWSTEP_MAX]; + wmGizmo *mpr = NULL; + ListBase visible_3d_gizmos = {NULL}; + bool do_step[WM_GIZMOMAP_DRAWSTEP_MAX]; for (int i = 0; i < ARRAY_SIZE(do_step); i++) { - do_step[i] = WM_manipulator_context_check_drawstep(C, i); + do_step[i] = WM_gizmo_context_check_drawstep(C, i); } - for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { + for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { /* If it were important we could initialize here, * but this only happens when events are handled before drawing, - * just skip to keep code-path for initializing manipulators simple. */ - if ((mgroup->init_flag & WM_MANIPULATORGROUP_INIT_SETUP) == 0) { + * just skip to keep code-path for initializing gizmos simple. */ + if ((mgroup->init_flag & WM_GIZMOGROUP_INIT_SETUP) == 0) { continue; } - if (WM_manipulator_group_type_poll(C, mgroup->type)) { - eWM_ManipulatorMapDrawStep step; - if (mgroup->type->flag & WM_MANIPULATORGROUPTYPE_3D) { - step = WM_MANIPULATORMAP_DRAWSTEP_3D; + if (WM_gizmo_group_type_poll(C, mgroup->type)) { + eWM_GizmoFlagMapDrawStep step; + if (mgroup->type->flag & WM_GIZMOGROUPTYPE_3D) { + step = WM_GIZMOMAP_DRAWSTEP_3D; } else { - step = WM_MANIPULATORMAP_DRAWSTEP_2D; + step = WM_GIZMOMAP_DRAWSTEP_2D; } if (do_step[step]) { - if ((mmap->update_flag[step] & MANIPULATORMAP_IS_REFRESH_CALLBACK) && + if ((mmap->update_flag[step] & GIZMOMAP_IS_REFRESH_CALLBACK) && (mgroup->type->refresh != NULL)) { mgroup->type->refresh(C, mgroup); /* cleared below */ } - if (step == WM_MANIPULATORMAP_DRAWSTEP_3D) { - wm_manipulatorgroup_intersectable_manipulators_to_list(mgroup, &visible_3d_manipulators); + if (step == WM_GIZMOMAP_DRAWSTEP_3D) { + wm_gizmogroup_intersectable_gizmos_to_list(mgroup, &visible_3d_gizmos); } - else if (step == WM_MANIPULATORMAP_DRAWSTEP_2D) { - if ((mpr = wm_manipulatorgroup_find_intersected_manipulator(mgroup, C, event, r_part))) { + else if (step == WM_GIZMOMAP_DRAWSTEP_2D) { + if ((mpr = wm_gizmogroup_find_intersected_gizmo(mgroup, C, event, r_part))) { break; } } @@ -641,62 +641,62 @@ wmManipulator *wm_manipulatormap_highlight_find( } } - if (!BLI_listbase_is_empty(&visible_3d_manipulators)) { - /* 2D manipulators get priority. */ + if (!BLI_listbase_is_empty(&visible_3d_gizmos)) { + /* 2D gizmos get priority. */ if (mpr == NULL) { - mpr = manipulator_find_intersected_3d(C, event->mval, &visible_3d_manipulators, r_part); + mpr = gizmo_find_intersected_3d(C, event->mval, &visible_3d_gizmos, r_part); } - BLI_freelistN(&visible_3d_manipulators); + BLI_freelistN(&visible_3d_gizmos); } - mmap->update_flag[WM_MANIPULATORMAP_DRAWSTEP_3D] &= ~MANIPULATORMAP_IS_REFRESH_CALLBACK; - mmap->update_flag[WM_MANIPULATORMAP_DRAWSTEP_2D] &= ~MANIPULATORMAP_IS_REFRESH_CALLBACK; + mmap->update_flag[WM_GIZMOMAP_DRAWSTEP_3D] &= ~GIZMOMAP_IS_REFRESH_CALLBACK; + mmap->update_flag[WM_GIZMOMAP_DRAWSTEP_2D] &= ~GIZMOMAP_IS_REFRESH_CALLBACK; return mpr; } -void WM_manipulatormap_add_handlers(ARegion *ar, wmManipulatorMap *mmap) +void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *mmap) { wmEventHandler *handler; for (handler = ar->handlers.first; handler; handler = handler->next) { - if (handler->manipulator_map == mmap) { + if (handler->gizmo_map == mmap) { return; } } - handler = MEM_callocN(sizeof(wmEventHandler), "manipulator handler"); + handler = MEM_callocN(sizeof(wmEventHandler), "gizmo handler"); - BLI_assert(mmap == ar->manipulator_map); - handler->manipulator_map = mmap; + BLI_assert(mmap == ar->gizmo_map); + handler->gizmo_map = mmap; BLI_addtail(&ar->handlers, handler); } -void wm_manipulatormaps_handled_modal_update( +void wm_gizmomaps_handled_modal_update( bContext *C, wmEvent *event, wmEventHandler *handler) { const bool modal_running = (handler->op != NULL); /* happens on render or when joining areas */ - if (!handler->op_region || !handler->op_region->manipulator_map) { + if (!handler->op_region || !handler->op_region->gizmo_map) { return; } - wmManipulatorMap *mmap = handler->op_region->manipulator_map; - wmManipulator *mpr = wm_manipulatormap_modal_get(mmap); + wmGizmoMap *mmap = handler->op_region->gizmo_map; + wmGizmo *mpr = wm_gizmomap_modal_get(mmap); ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - wm_manipulatormap_handler_context(C, handler); + wm_gizmomap_handler_context(C, handler); /* regular update for running operator */ if (modal_running) { - wmManipulatorOpElem *mpop = mpr ? WM_manipulator_operator_get(mpr, mpr->highlight_part) : NULL; + wmGizmoOpElem *mpop = mpr ? WM_gizmo_operator_get(mpr, mpr->highlight_part) : NULL; if (mpr && mpop && (mpop->type != NULL) && (mpop->type == handler->op->type)) { - wmManipulatorFnModal modal_fn = mpr->custom_modal ? mpr->custom_modal : mpr->type->modal; + wmGizmoFnModal modal_fn = mpr->custom_modal ? mpr->custom_modal : mpr->type->modal; if (modal_fn != NULL) { int retval = modal_fn(C, mpr, event, 0); - /* The manipulator is tried to the operator, we can't choose when to exit. */ + /* The gizmo is tried to the operator, we can't choose when to exit. */ BLI_assert(retval & OPERATOR_RUNNING_MODAL); UNUSED_VARS_NDEBUG(retval); } @@ -704,14 +704,14 @@ void wm_manipulatormaps_handled_modal_update( } /* operator not running anymore */ else { - wm_manipulatormap_highlight_set(mmap, C, NULL, 0); + wm_gizmomap_highlight_set(mmap, C, NULL, 0); if (mpr) { /* This isn't defined if it ends because of success of cancel, we may want to change. */ bool cancel = true; if (mpr->type->exit) { mpr->type->exit(C, mpr, cancel); } - wm_manipulatormap_modal_set(mmap, C, mpr, NULL, false); + wm_gizmomap_modal_set(mmap, C, mpr, NULL, false); } } @@ -721,58 +721,58 @@ void wm_manipulatormaps_handled_modal_update( } /** - * Deselect all selected manipulators in \a mmap. + * Deselect all selected gizmos in \a mmap. * \return if selection has changed. */ -bool wm_manipulatormap_deselect_all(wmManipulatorMap *mmap) +bool wm_gizmomap_deselect_all(wmGizmoMap *mmap) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; if (msel->items == NULL || msel->len == 0) { return false; } for (int i = 0; i < msel->len; i++) { - wm_manipulator_select_set_ex(mmap, msel->items[i], false, false, true); + wm_gizmo_select_set_ex(mmap, msel->items[i], false, false, true); } - wm_manipulatormap_select_array_clear(mmap); + wm_gizmomap_select_array_clear(mmap); /* always return true, we already checked * if there's anything to deselect */ return true; } -BLI_INLINE bool manipulator_selectable_poll(const wmManipulator *mpr, void *UNUSED(data)) +BLI_INLINE bool gizmo_selectable_poll(const wmGizmo *mpr, void *UNUSED(data)) { - return (mpr->parent_mgroup->type->flag & WM_MANIPULATORGROUPTYPE_SELECT); + return (mpr->parent_mgroup->type->flag & WM_GIZMOGROUPTYPE_SELECT); } /** - * Select all selectable manipulators in \a mmap. + * Select all selectable gizmos in \a mmap. * \return if selection has changed. */ -static bool wm_manipulatormap_select_all_intern( - bContext *C, wmManipulatorMap *mmap) +static bool wm_gizmomap_select_all_intern( + bContext *C, wmGizmoMap *mmap) { - wmManipulatorMapSelectState *msel = &mmap->mmap_context.select; - /* GHash is used here to avoid having to loop over all manipulators twice (once to + wmGizmoMapSelectState *msel = &mmap->mmap_context.select; + /* GHash is used here to avoid having to loop over all gizmos twice (once to * get tot_sel for allocating, once for actually selecting). Instead we collect - * selectable manipulators in hash table and use this to get tot_sel and do selection */ + * selectable gizmos in hash table and use this to get tot_sel and do selection */ - GHash *hash = WM_manipulatormap_manipulator_hash_new(C, mmap, manipulator_selectable_poll, NULL, true); + GHash *hash = WM_gizmomap_gizmo_hash_new(C, mmap, gizmo_selectable_poll, NULL, true); GHashIterator gh_iter; int i; bool changed = false; - wm_manipulatormap_select_array_ensure_len_alloc(mmap, BLI_ghash_len(hash)); + wm_gizmomap_select_array_ensure_len_alloc(mmap, BLI_ghash_len(hash)); GHASH_ITER_INDEX (gh_iter, hash, i) { - wmManipulator *mpr_iter = BLI_ghashIterator_getValue(&gh_iter); - WM_manipulator_select_set(mmap, mpr_iter, true); + wmGizmo *mpr_iter = BLI_ghashIterator_getValue(&gh_iter); + WM_gizmo_select_set(mmap, mpr_iter, true); } - /* highlight first manipulator */ - wm_manipulatormap_highlight_set(mmap, C, msel->items[0], msel->items[0]->highlight_part); + /* highlight first gizmo */ + wm_gizmomap_highlight_set(mmap, C, msel->items[0], msel->items[0]->highlight_part); BLI_assert(BLI_ghash_len(hash) == msel->len); @@ -781,21 +781,21 @@ static bool wm_manipulatormap_select_all_intern( } /** - * Select/Deselect all selectable manipulators in \a mmap. + * Select/Deselect all selectable gizmos in \a mmap. * \return if selection has changed. * * TODO select all by type */ -bool WM_manipulatormap_select_all(bContext *C, wmManipulatorMap *mmap, const int action) +bool WM_gizmomap_select_all(bContext *C, wmGizmoMap *mmap, const int action) { bool changed = false; switch (action) { case SEL_SELECT: - changed = wm_manipulatormap_select_all_intern(C, mmap); + changed = wm_gizmomap_select_all_intern(C, mmap); break; case SEL_DESELECT: - changed = wm_manipulatormap_deselect_all(mmap); + changed = wm_gizmomap_deselect_all(mmap); break; default: BLI_assert(0); @@ -809,10 +809,10 @@ bool WM_manipulatormap_select_all(bContext *C, wmManipulatorMap *mmap, const int } /** - * Prepare context for manipulator handling (but only if area/region is - * part of screen). Version of #wm_handler_op_context for manipulators. + * Prepare context for gizmo handling (but only if area/region is + * part of screen). Version of #wm_handler_op_context for gizmos. */ -void wm_manipulatormap_handler_context(bContext *C, wmEventHandler *handler) +void wm_gizmomap_handler_context(bContext *C, wmEventHandler *handler) { bScreen *screen = CTX_wm_screen(C); @@ -829,8 +829,8 @@ void wm_manipulatormap_handler_context(bContext *C, wmEventHandler *handler) if (sa == NULL) { /* when changing screen layouts with running modal handlers (like render display), this * is not an error to print */ - if (handler->manipulator_map == NULL) - printf("internal error: modal manipulator-map handler has invalid area\n"); + if (handler->gizmo_map == NULL) + printf("internal error: modal gizmo-map handler has invalid area\n"); } else { ARegion *ar; @@ -846,9 +846,9 @@ void wm_manipulatormap_handler_context(bContext *C, wmEventHandler *handler) } } -bool WM_manipulatormap_cursor_set(const wmManipulatorMap *mmap, wmWindow *win) +bool WM_gizmomap_cursor_set(const wmGizmoMap *mmap, wmWindow *win) { - wmManipulator *mpr = mmap->mmap_context.highlight; + wmGizmo *mpr = mmap->mmap_context.highlight; if (mpr && mpr->type->cursor_get) { WM_cursor_set(win, mpr->type->cursor_get(mpr)); return true; @@ -857,21 +857,21 @@ bool WM_manipulatormap_cursor_set(const wmManipulatorMap *mmap, wmWindow *win) return false; } -bool wm_manipulatormap_highlight_set( - wmManipulatorMap *mmap, const bContext *C, wmManipulator *mpr, int part) +bool wm_gizmomap_highlight_set( + wmGizmoMap *mmap, const bContext *C, wmGizmo *mpr, int part) { if ((mpr != mmap->mmap_context.highlight) || (mpr && part != mpr->highlight_part)) { if (mmap->mmap_context.highlight) { - mmap->mmap_context.highlight->state &= ~WM_MANIPULATOR_STATE_HIGHLIGHT; + mmap->mmap_context.highlight->state &= ~WM_GIZMO_STATE_HIGHLIGHT; mmap->mmap_context.highlight->highlight_part = -1; } mmap->mmap_context.highlight = mpr; if (mpr) { - mpr->state |= WM_MANIPULATOR_STATE_HIGHLIGHT; + mpr->state |= WM_GIZMO_STATE_HIGHLIGHT; mpr->highlight_part = part; mmap->mmap_context.last_cursor = -1; @@ -900,7 +900,7 @@ bool wm_manipulatormap_highlight_set( return false; } -wmManipulator *wm_manipulatormap_highlight_get(wmManipulatorMap *mmap) +wmGizmo *wm_gizmomap_highlight_get(wmGizmoMap *mmap) { return mmap->mmap_context.highlight; } @@ -908,8 +908,8 @@ wmManipulator *wm_manipulatormap_highlight_get(wmManipulatorMap *mmap) /** * Caller should call exit when (enable == False). */ -void wm_manipulatormap_modal_set( - wmManipulatorMap *mmap, bContext *C, wmManipulator *mpr, const wmEvent *event, bool enable) +void wm_gizmomap_modal_set( + wmGizmoMap *mmap, bContext *C, wmGizmo *mpr, const wmEvent *event, bool enable) { if (enable) { BLI_assert(mmap->mmap_context.modal == NULL); @@ -926,10 +926,10 @@ void wm_manipulatormap_modal_set( } } - mpr->state |= WM_MANIPULATOR_STATE_MODAL; + mpr->state |= WM_GIZMO_STATE_MODAL; mmap->mmap_context.modal = mpr; - if ((mpr->flag & WM_MANIPULATOR_GRAB_CURSOR) && + if ((mpr->flag & WM_GIZMO_GRAB_CURSOR) && (event->is_motion_absolute == false)) { WM_cursor_grab_enable(win, true, true, NULL); @@ -940,16 +940,16 @@ void wm_manipulatormap_modal_set( mmap->mmap_context.event_xy[0] = INT_MAX; } - struct wmManipulatorOpElem *mpop = WM_manipulator_operator_get(mpr, mpr->highlight_part); + struct wmGizmoOpElem *mpop = WM_gizmo_operator_get(mpr, mpr->highlight_part); if (mpop && mpop->type) { const int retval = WM_operator_name_call_ptr(C, mpop->type, WM_OP_INVOKE_DEFAULT, &mpop->ptr); if ((retval & OPERATOR_RUNNING_MODAL) == 0) { - wm_manipulatormap_modal_set(mmap, C, mpr, event, false); + wm_gizmomap_modal_set(mmap, C, mpr, event, false); } - /* we failed to hook the manipulator to the operator handler or operator was cancelled, return */ + /* we failed to hook the gizmo to the operator handler or operator was cancelled, return */ if (!mmap->mmap_context.modal) { - mpr->state &= ~WM_MANIPULATOR_STATE_MODAL; + mpr->state &= ~WM_GIZMO_STATE_MODAL; MEM_SAFE_FREE(mpr->interaction_data); } return; @@ -958,9 +958,9 @@ void wm_manipulatormap_modal_set( else { BLI_assert(ELEM(mmap->mmap_context.modal, NULL, mpr)); - /* deactivate, manipulator but first take care of some stuff */ + /* deactivate, gizmo but first take care of some stuff */ if (mpr) { - mpr->state &= ~WM_MANIPULATOR_STATE_MODAL; + mpr->state &= ~WM_GIZMO_STATE_MODAL; MEM_SAFE_FREE(mpr->interaction_data); } mmap->mmap_context.modal = NULL; @@ -986,34 +986,34 @@ void wm_manipulatormap_modal_set( } } -wmManipulator *wm_manipulatormap_modal_get(wmManipulatorMap *mmap) +wmGizmo *wm_gizmomap_modal_get(wmGizmoMap *mmap) { return mmap->mmap_context.modal; } -wmManipulator **wm_manipulatormap_selected_get(wmManipulatorMap *mmap, int *r_selected_len) +wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *mmap, int *r_selected_len) { *r_selected_len = mmap->mmap_context.select.len; return mmap->mmap_context.select.items; } -ListBase *wm_manipulatormap_groups_get(wmManipulatorMap *mmap) +ListBase *wm_gizmomap_groups_get(wmGizmoMap *mmap) { return &mmap->groups; } -void WM_manipulatormap_message_subscribe( - bContext *C, wmManipulatorMap *mmap, ARegion *ar, struct wmMsgBus *mbus) +void WM_gizmomap_message_subscribe( + bContext *C, wmGizmoMap *mmap, ARegion *ar, struct wmMsgBus *mbus) { - for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { - if (!WM_manipulator_group_type_poll(C, mgroup->type)) { + for (wmGizmoGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { + if (!WM_gizmo_group_type_poll(C, mgroup->type)) { continue; } - for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) { - if (mpr->flag & WM_MANIPULATOR_HIDDEN) { + for (wmGizmo *mpr = mgroup->gizmos.first; mpr; mpr = mpr->next) { + if (mpr->flag & WM_GIZMO_HIDDEN) { continue; } - WM_manipulator_target_property_subscribe_all(mpr, mbus, ar); + WM_gizmo_target_property_subscribe_all(mpr, mbus, ar); } if (mgroup->type->message_subscribe != NULL) { mgroup->type->message_subscribe(C, mgroup, mbus); @@ -1021,7 +1021,7 @@ void WM_manipulatormap_message_subscribe( } } -/** \} */ /* wmManipulatorMap */ +/** \} */ /* wmGizmoMap */ /* -------------------------------------------------------------------- */ @@ -1029,31 +1029,31 @@ void WM_manipulatormap_message_subscribe( * * \{ */ -struct ARegion *WM_manipulatormap_tooltip_init( +struct ARegion *WM_gizmomap_tooltip_init( struct bContext *C, struct ARegion *ar, bool *r_exit_on_event) { - wmManipulatorMap *mmap = ar->manipulator_map; + wmGizmoMap *mmap = ar->gizmo_map; *r_exit_on_event = true; if (mmap) { - wmManipulator *mpr = mmap->mmap_context.highlight; + wmGizmo *mpr = mmap->mmap_context.highlight; if (mpr) { - return UI_tooltip_create_from_manipulator(C, mpr); + return UI_tooltip_create_from_gizmo(C, mpr); } } return NULL; } -/** \} */ /* wmManipulatorMapType */ +/** \} */ /* wmGizmoMapType */ /* -------------------------------------------------------------------- */ -/** \name wmManipulatorMapType +/** \name wmGizmoMapType * * \{ */ -wmManipulatorMapType *WM_manipulatormaptype_find( - const struct wmManipulatorMapType_Params *mmap_params) +wmGizmoMapType *WM_gizmomaptype_find( + const struct wmGizmoMapType_Params *mmap_params) { - for (wmManipulatorMapType *mmap_type = manipulatormaptypes.first; mmap_type; mmap_type = mmap_type->next) { + for (wmGizmoMapType *mmap_type = gizmomaptypes.first; mmap_type; mmap_type = mmap_type->next) { if (mmap_type->spaceid == mmap_params->spaceid && mmap_type->regionid == mmap_params->regionid) { @@ -1064,57 +1064,57 @@ wmManipulatorMapType *WM_manipulatormaptype_find( return NULL; } -wmManipulatorMapType *WM_manipulatormaptype_ensure( - const struct wmManipulatorMapType_Params *mmap_params) +wmGizmoMapType *WM_gizmomaptype_ensure( + const struct wmGizmoMapType_Params *mmap_params) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_find(mmap_params); + wmGizmoMapType *mmap_type = WM_gizmomaptype_find(mmap_params); if (mmap_type) { return mmap_type; } - mmap_type = MEM_callocN(sizeof(wmManipulatorMapType), "manipulatortype list"); + mmap_type = MEM_callocN(sizeof(wmGizmoMapType), "gizmotype list"); mmap_type->spaceid = mmap_params->spaceid; mmap_type->regionid = mmap_params->regionid; - BLI_addhead(&manipulatormaptypes, mmap_type); + BLI_addhead(&gizmomaptypes, mmap_type); return mmap_type; } -void wm_manipulatormaptypes_free(void) +void wm_gizmomaptypes_free(void) { - for (wmManipulatorMapType *mmap_type = manipulatormaptypes.first, *mmap_type_next; + for (wmGizmoMapType *mmap_type = gizmomaptypes.first, *mmap_type_next; mmap_type; mmap_type = mmap_type_next) { mmap_type_next = mmap_type->next; - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first, *wgt_next; + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first, *wgt_next; wgt_ref; wgt_ref = wgt_next) { wgt_next = wgt_ref->next; - WM_manipulatormaptype_group_free(wgt_ref); + WM_gizmomaptype_group_free(wgt_ref); } MEM_freeN(mmap_type); } } /** - * Initialize keymaps for all existing manipulator-groups + * Initialize keymaps for all existing gizmo-groups */ -void wm_manipulators_keymap(wmKeyConfig *keyconf) +void wm_gizmos_keymap(wmKeyConfig *keyconf) { - /* we add this item-less keymap once and use it to group manipulator-group keymaps into it */ - WM_keymap_find(keyconf, "Manipulators", 0, 0); + /* we add this item-less keymap once and use it to group gizmo-group keymaps into it */ + WM_keymap_find(keyconf, "Gizmos", 0, 0); - for (wmManipulatorMapType *mmap_type = manipulatormaptypes.first; mmap_type; mmap_type = mmap_type->next) { - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { - wm_manipulatorgrouptype_setup_keymap(wgt_ref->type, keyconf); + for (wmGizmoMapType *mmap_type = gizmomaptypes.first; mmap_type; mmap_type = mmap_type->next) { + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { + wm_gizmogrouptype_setup_keymap(wgt_ref->type, keyconf); } } } -/** \} */ /* wmManipulatorMapType */ +/** \} */ /* wmGizmoMapType */ /* -------------------------------------------------------------------- */ /** \name Updates for Dynamic Type Registraion @@ -1122,31 +1122,31 @@ void wm_manipulators_keymap(wmKeyConfig *keyconf) * \{ */ -void WM_manipulatorconfig_update_tag_init( - wmManipulatorMapType *mmap_type, wmManipulatorGroupType *wgt) +void WM_gizmoconfig_update_tag_init( + wmGizmoMapType *mmap_type, wmGizmoGroupType *wgt) { /* tag for update on next use */ - mmap_type->type_update_flag |= (WM_MANIPULATORMAPTYPE_UPDATE_INIT | WM_MANIPULATORMAPTYPE_KEYMAP_INIT); - wgt->type_update_flag |= (WM_MANIPULATORMAPTYPE_UPDATE_INIT | WM_MANIPULATORMAPTYPE_KEYMAP_INIT); + mmap_type->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT); + wgt->type_update_flag |= (WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT); - wm_mmap_type_update_flag |= WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_INIT; + wm_mmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT; } -void WM_manipulatorconfig_update_tag_remove( - wmManipulatorMapType *mmap_type, wmManipulatorGroupType *wgt) +void WM_gizmoconfig_update_tag_remove( + wmGizmoMapType *mmap_type, wmGizmoGroupType *wgt) { /* tag for update on next use */ - mmap_type->type_update_flag |= WM_MANIPULATORMAPTYPE_UPDATE_REMOVE; - wgt->type_update_flag |= WM_MANIPULATORMAPTYPE_UPDATE_REMOVE; + mmap_type->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE; + wgt->type_update_flag |= WM_GIZMOMAPTYPE_UPDATE_REMOVE; - wm_mmap_type_update_flag |= WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_REMOVE; + wm_mmap_type_update_flag |= WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE; } /** * Run incase new types have been added (runs often, early exit where possible). * Follows #WM_keyconfig_update concentions. */ -void WM_manipulatorconfig_update(struct Main *bmain) +void WM_gizmoconfig_update(struct Main *bmain) { if (G.background) return; @@ -1154,55 +1154,55 @@ void WM_manipulatorconfig_update(struct Main *bmain) if (wm_mmap_type_update_flag == 0) return; - if (wm_mmap_type_update_flag & WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_REMOVE) { - for (wmManipulatorMapType *mmap_type = manipulatormaptypes.first; + if (wm_mmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) { + for (wmGizmoMapType *mmap_type = gizmomaptypes.first; mmap_type; mmap_type = mmap_type->next) { - if (mmap_type->type_update_flag & WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_REMOVE) { - mmap_type->type_update_flag &= ~WM_MANIPULATORMAPTYPE_UPDATE_REMOVE; - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first, *wgt_ref_next; + if (mmap_type->type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE) { + mmap_type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE; + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first, *wgt_ref_next; wgt_ref; wgt_ref = wgt_ref_next) { wgt_ref_next = wgt_ref->next; - if (wgt_ref->type->type_update_flag & WM_MANIPULATORMAPTYPE_UPDATE_REMOVE) { - wgt_ref->type->type_update_flag &= ~WM_MANIPULATORMAPTYPE_UPDATE_REMOVE; - WM_manipulatormaptype_group_unlink(NULL, bmain, mmap_type, wgt_ref->type); + if (wgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_REMOVE) { + wgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_REMOVE; + WM_gizmomaptype_group_unlink(NULL, bmain, mmap_type, wgt_ref->type); } } } } - wm_mmap_type_update_flag &= ~WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_REMOVE; + wm_mmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_REMOVE; } - if (wm_mmap_type_update_flag & WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_INIT) { - for (wmManipulatorMapType *mmap_type = manipulatormaptypes.first; + if (wm_mmap_type_update_flag & WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT) { + for (wmGizmoMapType *mmap_type = gizmomaptypes.first; mmap_type; mmap_type = mmap_type->next) { - const uchar type_update_all = WM_MANIPULATORMAPTYPE_UPDATE_INIT | WM_MANIPULATORMAPTYPE_KEYMAP_INIT; + const uchar type_update_all = WM_GIZMOMAPTYPE_UPDATE_INIT | WM_GIZMOMAPTYPE_KEYMAP_INIT; if (mmap_type->type_update_flag & type_update_all) { mmap_type->type_update_flag &= ~type_update_all; - for (wmManipulatorGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; + for (wmGizmoGroupTypeRef *wgt_ref = mmap_type->grouptype_refs.first; wgt_ref; wgt_ref = wgt_ref->next) { - if (wgt_ref->type->type_update_flag & WM_MANIPULATORMAPTYPE_KEYMAP_INIT) { - WM_manipulatormaptype_group_init_runtime_keymap(bmain, wgt_ref->type); - wgt_ref->type->type_update_flag &= ~WM_MANIPULATORMAPTYPE_KEYMAP_INIT; + if (wgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_KEYMAP_INIT) { + WM_gizmomaptype_group_init_runtime_keymap(bmain, wgt_ref->type); + wgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_KEYMAP_INIT; } - if (wgt_ref->type->type_update_flag & WM_MANIPULATORMAPTYPE_UPDATE_INIT) { - WM_manipulatormaptype_group_init_runtime(bmain, mmap_type, wgt_ref->type); - wgt_ref->type->type_update_flag &= ~WM_MANIPULATORMAPTYPE_UPDATE_INIT; + if (wgt_ref->type->type_update_flag & WM_GIZMOMAPTYPE_UPDATE_INIT) { + WM_gizmomaptype_group_init_runtime(bmain, mmap_type, wgt_ref->type); + wgt_ref->type->type_update_flag &= ~WM_GIZMOMAPTYPE_UPDATE_INIT; } } } } - wm_mmap_type_update_flag &= ~WM_MANIPULATORMAPTYPE_GLOBAL_UPDATE_INIT; + wm_mmap_type_update_flag &= ~WM_GIZMOMAPTYPE_GLOBAL_UPDATE_INIT; } } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c index 78d12e4e4ba..f3df001af55 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c @@ -51,43 +51,43 @@ /** \name Property Definition * \{ */ -BLI_INLINE wmManipulatorProperty *wm_manipulator_target_property_array(wmManipulator *mpr) +BLI_INLINE wmGizmoProperty *wm_gizmo_target_property_array(wmGizmo *mpr) { - return (wmManipulatorProperty *)(POINTER_OFFSET(mpr, mpr->type->struct_size)); + return (wmGizmoProperty *)(POINTER_OFFSET(mpr, mpr->type->struct_size)); } -wmManipulatorProperty *WM_manipulator_target_property_array(wmManipulator *mpr) +wmGizmoProperty *WM_gizmo_target_property_array(wmGizmo *mpr) { - return wm_manipulator_target_property_array(mpr); + return wm_gizmo_target_property_array(mpr); } -wmManipulatorProperty *WM_manipulator_target_property_at_index(wmManipulator *mpr, int index) +wmGizmoProperty *WM_gizmo_target_property_at_index(wmGizmo *mpr, int index) { BLI_assert(index < mpr->type->target_property_defs_len); BLI_assert(index != -1); - wmManipulatorProperty *mpr_prop_array = wm_manipulator_target_property_array(mpr); + wmGizmoProperty *mpr_prop_array = wm_gizmo_target_property_array(mpr); return &mpr_prop_array[index]; } -wmManipulatorProperty *WM_manipulator_target_property_find(wmManipulator *mpr, const char *idname) +wmGizmoProperty *WM_gizmo_target_property_find(wmGizmo *mpr, const char *idname) { int index = BLI_findstringindex( - &mpr->type->target_property_defs, idname, offsetof(wmManipulatorPropertyType, idname)); + &mpr->type->target_property_defs, idname, offsetof(wmGizmoPropertyType, idname)); if (index != -1) { - return WM_manipulator_target_property_at_index(mpr, index); + return WM_gizmo_target_property_at_index(mpr, index); } else { return NULL; } } -void WM_manipulator_target_property_def_rna_ptr( - wmManipulator *mpr, const wmManipulatorPropertyType *mpr_prop_type, +void WM_gizmo_target_property_def_rna_ptr( + wmGizmo *mpr, const wmGizmoPropertyType *mpr_prop_type, PointerRNA *ptr, PropertyRNA *prop, int index) { - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_at_index(mpr, mpr_prop_type->index_in_type); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_at_index(mpr, mpr_prop_type->index_in_type); - /* if manipulator evokes an operator we cannot use it for property manipulation */ + /* if gizmo evokes an operator we cannot use it for property manipulation */ BLI_assert(mpr->op_data == NULL); mpr_prop->type = mpr_prop_type; @@ -101,22 +101,22 @@ void WM_manipulator_target_property_def_rna_ptr( } } -void WM_manipulator_target_property_def_rna( - wmManipulator *mpr, const char *idname, +void WM_gizmo_target_property_def_rna( + wmGizmo *mpr, const char *idname, PointerRNA *ptr, const char *propname, int index) { - const wmManipulatorPropertyType *mpr_prop_type = WM_manipulatortype_target_property_find(mpr->type, idname); + const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(mpr->type, idname); PropertyRNA *prop = RNA_struct_find_property(ptr, propname); - WM_manipulator_target_property_def_rna_ptr(mpr, mpr_prop_type, ptr, prop, index); + WM_gizmo_target_property_def_rna_ptr(mpr, mpr_prop_type, ptr, prop, index); } -void WM_manipulator_target_property_def_func_ptr( - wmManipulator *mpr, const wmManipulatorPropertyType *mpr_prop_type, - const wmManipulatorPropertyFnParams *params) +void WM_gizmo_target_property_def_func_ptr( + wmGizmo *mpr, const wmGizmoPropertyType *mpr_prop_type, + const wmGizmoPropertyFnParams *params) { - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_at_index(mpr, mpr_prop_type->index_in_type); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_at_index(mpr, mpr_prop_type->index_in_type); - /* if manipulator evokes an operator we cannot use it for property manipulation */ + /* if gizmo evokes an operator we cannot use it for property manipulation */ BLI_assert(mpr->op_data == NULL); mpr_prop->type = mpr_prop_type; @@ -132,20 +132,20 @@ void WM_manipulator_target_property_def_func_ptr( } } -void WM_manipulator_target_property_def_func( - wmManipulator *mpr, const char *idname, - const wmManipulatorPropertyFnParams *params) +void WM_gizmo_target_property_def_func( + wmGizmo *mpr, const char *idname, + const wmGizmoPropertyFnParams *params) { - const wmManipulatorPropertyType *mpr_prop_type = WM_manipulatortype_target_property_find(mpr->type, idname); - WM_manipulator_target_property_def_func_ptr(mpr, mpr_prop_type, params); + const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(mpr->type, idname); + WM_gizmo_target_property_def_func_ptr(mpr, mpr_prop_type, params); } -void WM_manipulator_target_property_clear_rna_ptr( - wmManipulator *mpr, const wmManipulatorPropertyType *mpr_prop_type) +void WM_gizmo_target_property_clear_rna_ptr( + wmGizmo *mpr, const wmGizmoPropertyType *mpr_prop_type) { - wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_at_index(mpr, mpr_prop_type->index_in_type); + wmGizmoProperty *mpr_prop = WM_gizmo_target_property_at_index(mpr, mpr_prop_type->index_in_type); - /* if manipulator evokes an operator we cannot use it for property manipulation */ + /* if gizmo evokes an operator we cannot use it for property manipulation */ BLI_assert(mpr->op_data == NULL); mpr_prop->type = NULL; @@ -155,11 +155,11 @@ void WM_manipulator_target_property_clear_rna_ptr( mpr_prop->index = -1; } -void WM_manipulator_target_property_clear_rna( - wmManipulator *mpr, const char *idname) +void WM_gizmo_target_property_clear_rna( + wmGizmo *mpr, const char *idname) { - const wmManipulatorPropertyType *mpr_prop_type = WM_manipulatortype_target_property_find(mpr->type, idname); - WM_manipulator_target_property_clear_rna_ptr(mpr, mpr_prop_type); + const wmGizmoPropertyType *mpr_prop_type = WM_gizmotype_target_property_find(mpr->type, idname); + WM_gizmo_target_property_clear_rna_ptr(mpr, mpr_prop_type); } @@ -171,26 +171,26 @@ void WM_manipulator_target_property_clear_rna( /** \name Property Access * \{ */ -bool WM_manipulator_target_property_is_valid_any(wmManipulator *mpr) +bool WM_gizmo_target_property_is_valid_any(wmGizmo *mpr) { - wmManipulatorProperty *mpr_prop_array = wm_manipulator_target_property_array(mpr); + wmGizmoProperty *mpr_prop_array = wm_gizmo_target_property_array(mpr); for (int i = 0; i < mpr->type->target_property_defs_len; i++) { - wmManipulatorProperty *mpr_prop = &mpr_prop_array[i]; - if (WM_manipulator_target_property_is_valid(mpr_prop)) { + wmGizmoProperty *mpr_prop = &mpr_prop_array[i]; + if (WM_gizmo_target_property_is_valid(mpr_prop)) { return true; } } return false; } -bool WM_manipulator_target_property_is_valid(const wmManipulatorProperty *mpr_prop) +bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *mpr_prop) { return ((mpr_prop->prop != NULL) || (mpr_prop->custom_func.value_get_fn && mpr_prop->custom_func.value_set_fn)); } -float WM_manipulator_target_property_value_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop) +float WM_gizmo_target_property_value_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop) { if (mpr_prop->custom_func.value_get_fn) { float value = 0.0f; @@ -207,9 +207,9 @@ float WM_manipulator_target_property_value_get( } } -void WM_manipulator_target_property_value_set( - bContext *C, const wmManipulator *mpr, - wmManipulatorProperty *mpr_prop, const float value) +void WM_gizmo_target_property_value_set( + bContext *C, const wmGizmo *mpr, + wmGizmoProperty *mpr_prop, const float value) { if (mpr_prop->custom_func.value_set_fn) { BLI_assert(mpr_prop->type->array_length == 1); @@ -227,8 +227,8 @@ void WM_manipulator_target_property_value_set( RNA_property_update(C, &mpr_prop->ptr, mpr_prop->prop); } -void WM_manipulator_target_property_value_get_array( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +void WM_gizmo_target_property_value_get_array( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, float *value) { if (mpr_prop->custom_func.value_get_fn) { @@ -238,8 +238,8 @@ void WM_manipulator_target_property_value_get_array( RNA_property_float_get_array(&mpr_prop->ptr, mpr_prop->prop, value); } -void WM_manipulator_target_property_value_set_array( - bContext *C, const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +void WM_gizmo_target_property_value_set_array( + bContext *C, const wmGizmo *mpr, wmGizmoProperty *mpr_prop, const float *value) { if (mpr_prop->custom_func.value_set_fn) { @@ -251,8 +251,8 @@ void WM_manipulator_target_property_value_set_array( RNA_property_update(C, &mpr_prop->ptr, mpr_prop->prop); } -bool WM_manipulator_target_property_range_get( - const wmManipulator *mpr, wmManipulatorProperty *mpr_prop, +bool WM_gizmo_target_property_range_get( + const wmGizmo *mpr, wmGizmoProperty *mpr_prop, float range[2]) { if (mpr_prop->custom_func.value_get_fn) { @@ -271,8 +271,8 @@ bool WM_manipulator_target_property_range_get( return true; } -int WM_manipulator_target_property_array_length( - const wmManipulator *UNUSED(mpr), wmManipulatorProperty *mpr_prop) +int WM_gizmo_target_property_array_length( + const wmGizmo *UNUSED(mpr), wmGizmoProperty *mpr_prop) { if (mpr_prop->custom_func.value_get_fn) { return mpr_prop->type->array_length; @@ -288,21 +288,21 @@ int WM_manipulator_target_property_array_length( /** \name Property Define * \{ */ -const wmManipulatorPropertyType *WM_manipulatortype_target_property_find( - const wmManipulatorType *wt, const char *idname) +const wmGizmoPropertyType *WM_gizmotype_target_property_find( + const wmGizmoType *wt, const char *idname) { - return BLI_findstring(&wt->target_property_defs, idname, offsetof(wmManipulatorPropertyType, idname)); + return BLI_findstring(&wt->target_property_defs, idname, offsetof(wmGizmoPropertyType, idname)); } -void WM_manipulatortype_target_property_def( - wmManipulatorType *wt, const char *idname, int data_type, int array_length) +void WM_gizmotype_target_property_def( + wmGizmoType *wt, const char *idname, int data_type, int array_length) { - wmManipulatorPropertyType *mpt; + wmGizmoPropertyType *mpt; - BLI_assert(WM_manipulatortype_target_property_find(wt, idname) == NULL); + BLI_assert(WM_gizmotype_target_property_find(wt, idname) == NULL); const uint idname_size = strlen(idname) + 1; - mpt = MEM_callocN(sizeof(wmManipulatorPropertyType) + idname_size, __func__); + mpt = MEM_callocN(sizeof(wmGizmoPropertyType) + idname_size, __func__); memcpy(mpt->idname, idname, idname_size); mpt->data_type = data_type; mpt->array_length = array_length; @@ -318,28 +318,28 @@ void WM_manipulatortype_target_property_def( /** \name Property Utilities * \{ */ -void WM_manipulator_do_msg_notify_tag_refresh( +void WM_gizmo_do_msg_notify_tag_refresh( bContext *UNUSED(C), wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val) { ARegion *ar = msg_val->owner; - wmManipulatorMap *mmap = msg_val->user_data; + wmGizmoMap *mmap = msg_val->user_data; ED_region_tag_redraw(ar); - WM_manipulatormap_tag_refresh(mmap); + WM_gizmomap_tag_refresh(mmap); } /** * Runs on the "prepare draw" pass, * drawing the region clears. */ -void WM_manipulator_target_property_subscribe_all( - wmManipulator *mpr, struct wmMsgBus *mbus, ARegion *ar) +void WM_gizmo_target_property_subscribe_all( + wmGizmo *mpr, struct wmMsgBus *mbus, ARegion *ar) { if (mpr->type->target_property_defs_len) { - wmManipulatorProperty *mpr_prop_array = WM_manipulator_target_property_array(mpr); + wmGizmoProperty *mpr_prop_array = WM_gizmo_target_property_array(mpr); for (int i = 0; i < mpr->type->target_property_defs_len; i++) { - wmManipulatorProperty *mpr_prop = &mpr_prop_array[i]; - if (WM_manipulator_target_property_is_valid(mpr_prop)) { + wmGizmoProperty *mpr_prop = &mpr_prop_array[i]; + if (WM_gizmo_target_property_is_valid(mpr_prop)) { if (mpr_prop->prop) { WM_msg_subscribe_rna( mbus, &mpr_prop->ptr, mpr_prop->prop, @@ -353,7 +353,7 @@ void WM_manipulator_target_property_subscribe_all( &(const wmMsgSubscribeValue){ .owner = ar, .user_data = mpr->parent_mgroup->parent_mmap, - .notify = WM_manipulator_do_msg_notify_tag_refresh, + .notify = WM_gizmo_do_msg_notify_tag_refresh, }, __func__); } } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c index 4f31afb5b56..ba145af9582 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c @@ -44,7 +44,7 @@ #include "ED_screen.h" -/* only for own init/exit calls (wm_manipulatortype_init/wm_manipulatortype_free) */ +/* only for own init/exit calls (wm_gizmotype_init/wm_gizmotype_free) */ #include "wm.h" /* own includes */ @@ -52,30 +52,30 @@ #include "wm_gizmo_intern.h" -/** \name Manipulator Type Append +/** \name Gizmo Type Append * * \note This follows conventions from #WM_operatortype_find #WM_operatortype_append & friends. * \{ */ -static GHash *global_manipulatortype_hash = NULL; +static GHash *global_gizmotype_hash = NULL; -const wmManipulatorType *WM_manipulatortype_find(const char *idname, bool quiet) +const wmGizmoType *WM_gizmotype_find(const char *idname, bool quiet) { if (idname[0]) { - wmManipulatorType *wt; + wmGizmoType *wt; - wt = BLI_ghash_lookup(global_manipulatortype_hash, idname); + wt = BLI_ghash_lookup(global_gizmotype_hash, idname); if (wt) { return wt; } if (!quiet) { - printf("search for unknown manipulator '%s'\n", idname); + printf("search for unknown gizmo '%s'\n", idname); } } else { if (!quiet) { - printf("search for empty manipulator\n"); + printf("search for empty gizmo\n"); } } @@ -83,15 +83,15 @@ const wmManipulatorType *WM_manipulatortype_find(const char *idname, bool quiet) } /* caller must free */ -void WM_manipulatortype_iter(GHashIterator *ghi) +void WM_gizmotype_iter(GHashIterator *ghi) { - BLI_ghashIterator_init(ghi, global_manipulatortype_hash); + BLI_ghashIterator_init(ghi, global_gizmotype_hash); } -static wmManipulatorType *wm_manipulatortype_append__begin(void) +static wmGizmoType *wm_gizmotype_append__begin(void) { - wmManipulatorType *wt = MEM_callocN(sizeof(wmManipulatorType), "manipulatortype"); - wt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_ManipulatorProperties); + wmGizmoType *wt = MEM_callocN(sizeof(wmGizmoType), "gizmotype"); + wt->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_GizmoProperties); #if 0 /* Set the default i18n context now, so that opfunc can redefine it if needed! */ RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); @@ -99,35 +99,35 @@ static wmManipulatorType *wm_manipulatortype_append__begin(void) #endif return wt; } -static void wm_manipulatortype_append__end(wmManipulatorType *wt) +static void wm_gizmotype_append__end(wmGizmoType *wt) { - BLI_assert(wt->struct_size >= sizeof(wmManipulator)); + BLI_assert(wt->struct_size >= sizeof(wmGizmo)); RNA_def_struct_identifier(&BLENDER_RNA, wt->srna, wt->idname); - BLI_ghash_insert(global_manipulatortype_hash, (void *)wt->idname, wt); + BLI_ghash_insert(global_gizmotype_hash, (void *)wt->idname, wt); } -void WM_manipulatortype_append(void (*wtfunc)(struct wmManipulatorType *)) +void WM_gizmotype_append(void (*wtfunc)(struct wmGizmoType *)) { - wmManipulatorType *wt = wm_manipulatortype_append__begin(); + wmGizmoType *wt = wm_gizmotype_append__begin(); wtfunc(wt); - wm_manipulatortype_append__end(wt); + wm_gizmotype_append__end(wt); } -void WM_manipulatortype_append_ptr(void (*wtfunc)(struct wmManipulatorType *, void *), void *userdata) +void WM_gizmotype_append_ptr(void (*wtfunc)(struct wmGizmoType *, void *), void *userdata) { - wmManipulatorType *mt = wm_manipulatortype_append__begin(); + wmGizmoType *mt = wm_gizmotype_append__begin(); wtfunc(mt, userdata); - wm_manipulatortype_append__end(mt); + wm_gizmotype_append__end(mt); } /** * Free but don't remove from ghash. */ -static void manipulatortype_free(wmManipulatorType *wt) +static void gizmotype_free(wmGizmoType *wt) { - if (wt->ext.srna) { /* python manipulator, allocs own string */ + if (wt->ext.srna) { /* python gizmo, allocs own string */ MEM_freeN((void *)wt->idname); } @@ -138,8 +138,8 @@ static void manipulatortype_free(wmManipulatorType *wt) /** * \param C: May be NULL. */ -static void manipulatortype_unlink( - bContext *C, Main *bmain, wmManipulatorType *wt) +static void gizmotype_unlink( + bContext *C, Main *bmain, wmGizmoType *wt) { /* Free instances. */ for (bScreen *sc = bmain->screen.first; sc; sc = sc->id.next) { @@ -147,15 +147,15 @@ static void manipulatortype_unlink( for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; for (ARegion *ar = lb->first; ar; ar = ar->next) { - wmManipulatorMap *mmap = ar->manipulator_map; + wmGizmoMap *mmap = ar->gizmo_map; if (mmap) { - wmManipulatorGroup *mgroup; + wmGizmoGroup *mgroup; for (mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) { - for (wmManipulator *mpr = mgroup->manipulators.first, *mpr_next; mpr; mpr = mpr_next) { + for (wmGizmo *mpr = mgroup->gizmos.first, *mpr_next; mpr; mpr = mpr_next) { mpr_next = mpr->next; BLI_assert(mgroup->parent_mmap == mmap); if (mpr->type == wt) { - WM_manipulator_unlink(&mgroup->manipulators, mgroup->parent_mmap, mpr, C); + WM_gizmo_unlink(&mgroup->gizmos, mgroup->parent_mmap, mpr, C); ED_region_tag_redraw(ar); } } @@ -167,46 +167,46 @@ static void manipulatortype_unlink( } } -void WM_manipulatortype_remove_ptr(bContext *C, Main *bmain, wmManipulatorType *wt) +void WM_gizmotype_remove_ptr(bContext *C, Main *bmain, wmGizmoType *wt) { - BLI_assert(wt == WM_manipulatortype_find(wt->idname, false)); + BLI_assert(wt == WM_gizmotype_find(wt->idname, false)); - BLI_ghash_remove(global_manipulatortype_hash, wt->idname, NULL, NULL); + BLI_ghash_remove(global_gizmotype_hash, wt->idname, NULL, NULL); - manipulatortype_unlink(C, bmain, wt); + gizmotype_unlink(C, bmain, wt); - manipulatortype_free(wt); + gizmotype_free(wt); } -bool WM_manipulatortype_remove(bContext *C, Main *bmain, const char *idname) +bool WM_gizmotype_remove(bContext *C, Main *bmain, const char *idname) { - wmManipulatorType *wt = BLI_ghash_lookup(global_manipulatortype_hash, idname); + wmGizmoType *wt = BLI_ghash_lookup(global_gizmotype_hash, idname); if (wt == NULL) { return false; } - WM_manipulatortype_remove_ptr(C, bmain, wt); + WM_gizmotype_remove_ptr(C, bmain, wt); return true; } -static void wm_manipulatortype_ghash_free_cb(wmManipulatorType *mt) +static void wm_gizmotype_ghash_free_cb(wmGizmoType *mt) { - manipulatortype_free(mt); + gizmotype_free(mt); } -void wm_manipulatortype_free(void) +void wm_gizmotype_free(void) { - BLI_ghash_free(global_manipulatortype_hash, NULL, (GHashValFreeFP)wm_manipulatortype_ghash_free_cb); - global_manipulatortype_hash = NULL; + BLI_ghash_free(global_gizmotype_hash, NULL, (GHashValFreeFP)wm_gizmotype_ghash_free_cb); + global_gizmotype_hash = NULL; } /* called on initialize WM_init() */ -void wm_manipulatortype_init(void) +void wm_gizmotype_init(void) { /* reserve size is set based on blender default setup */ - global_manipulatortype_hash = BLI_ghash_str_new_ex("wm_manipulatortype_init gh", 128); + global_gizmotype_hash = BLI_ghash_str_new_ex("wm_gizmotype_init gh", 128); } /** \} */ diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h index 8d28febbd5d..a94f1e994e9 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_fn.h +++ b/source/blender/windowmanager/gizmo/wm_gizmo_fn.h @@ -29,60 +29,60 @@ #include "BLI_compiler_attrs.h" -/* wmManipulatorGroup */ -typedef bool (*wmManipulatorGroupFnPoll)( - const struct bContext *, struct wmManipulatorGroupType *) +/* wmGizmoGroup */ +typedef bool (*wmGizmoGroupFnPoll)( + const struct bContext *, struct wmGizmoGroupType *) ATTR_WARN_UNUSED_RESULT; -typedef void (*wmManipulatorGroupFnInit)( - const struct bContext *, struct wmManipulatorGroup *); -typedef void (*wmManipulatorGroupFnRefresh)( - const struct bContext *, struct wmManipulatorGroup *); -typedef void (*wmManipulatorGroupFnDrawPrepare)( - const struct bContext *, struct wmManipulatorGroup *); -typedef struct wmKeyMap *(*wmManipulatorGroupFnSetupKeymap)( - const struct wmManipulatorGroupType *, struct wmKeyConfig *) +typedef void (*wmGizmoGroupFnInit)( + const struct bContext *, struct wmGizmoGroup *); +typedef void (*wmGizmoGroupFnRefresh)( + const struct bContext *, struct wmGizmoGroup *); +typedef void (*wmGizmoGroupFnDrawPrepare)( + const struct bContext *, struct wmGizmoGroup *); +typedef struct wmKeyMap *(*wmGizmoGroupFnSetupKeymap)( + const struct wmGizmoGroupType *, struct wmKeyConfig *) ATTR_WARN_UNUSED_RESULT; -typedef void (*wmManipulatorGroupFnMsgBusSubscribe)( - const struct bContext *, struct wmManipulatorGroup *, struct wmMsgBus *); +typedef void (*wmGizmoGroupFnMsgBusSubscribe)( + const struct bContext *, struct wmGizmoGroup *, struct wmMsgBus *); -/* wmManipulator */ -/* See: wmManipulatorType for docs on each type. */ +/* wmGizmo */ +/* See: wmGizmoType for docs on each type. */ -typedef void (*wmManipulatorFnSetup)(struct wmManipulator *); -typedef void (*wmManipulatorFnDraw)(const struct bContext *, struct wmManipulator *); -typedef void (*wmManipulatorFnDrawSelect)(const struct bContext *, struct wmManipulator *, int); -typedef int (*wmManipulatorFnTestSelect)(struct bContext *, struct wmManipulator *, const struct wmEvent *); -typedef int (*wmManipulatorFnModal)(struct bContext *, struct wmManipulator *, const struct wmEvent *, eWM_ManipulatorTweak); -typedef void (*wmManipulatorFnPropertyUpdate)(struct wmManipulator *, struct wmManipulatorProperty *); -typedef void (*wmManipulatorFnMatrixBasisGet)(const struct wmManipulator *, float[4][4]); -typedef int (*wmManipulatorFnInvoke)(struct bContext *, struct wmManipulator *, const struct wmEvent *); -typedef void (*wmManipulatorFnExit)(struct bContext *, struct wmManipulator *, const bool); -typedef int (*wmManipulatorFnCursorGet)(struct wmManipulator *); -typedef void (*wmManipulatorFnSelectRefresh)(struct wmManipulator *); -typedef void (*wmManipulatorFnFree)(struct wmManipulator *); +typedef void (*wmGizmoFnSetup)(struct wmGizmo *); +typedef void (*wmGizmoFnDraw)(const struct bContext *, struct wmGizmo *); +typedef void (*wmGizmoFnDrawSelect)(const struct bContext *, struct wmGizmo *, int); +typedef int (*wmGizmoFnTestSelect)(struct bContext *, struct wmGizmo *, const struct wmEvent *); +typedef int (*wmGizmoFnModal)(struct bContext *, struct wmGizmo *, const struct wmEvent *, eWM_GizmoFlagTweak); +typedef void (*wmGizmoFnPropertyUpdate)(struct wmGizmo *, struct wmGizmoProperty *); +typedef void (*wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4]); +typedef int (*wmGizmoFnInvoke)(struct bContext *, struct wmGizmo *, const struct wmEvent *); +typedef void (*wmGizmoFnExit)(struct bContext *, struct wmGizmo *, const bool); +typedef int (*wmGizmoFnCursorGet)(struct wmGizmo *); +typedef void (*wmGizmoFnSelectRefresh)(struct wmGizmo *); +typedef void (*wmGizmoFnFree)(struct wmGizmo *); -/* wmManipulatorProperty ('value' type defined by 'wmManipulatorProperty.data_type') */ -typedef void (*wmManipulatorPropertyFnGet)( - const struct wmManipulator *, struct wmManipulatorProperty *, +/* wmGizmoProperty ('value' type defined by 'wmGizmoProperty.data_type') */ +typedef void (*wmGizmoPropertyFnGet)( + const struct wmGizmo *, struct wmGizmoProperty *, /* typically 'float *' */ void *value); -typedef void (*wmManipulatorPropertyFnSet)( - const struct wmManipulator *, struct wmManipulatorProperty *, +typedef void (*wmGizmoPropertyFnSet)( + const struct wmGizmo *, struct wmGizmoProperty *, /* typically 'const float *' */ const void *value); -typedef void (*wmManipulatorPropertyFnRangeGet)( - const struct wmManipulator *, struct wmManipulatorProperty *, +typedef void (*wmGizmoPropertyFnRangeGet)( + const struct wmGizmo *, struct wmGizmoProperty *, /* typically 'float[2]' */ void *range); -typedef void (*wmManipulatorPropertyFnFree)( - const struct wmManipulator *, struct wmManipulatorProperty *); +typedef void (*wmGizmoPropertyFnFree)( + const struct wmGizmo *, struct wmGizmoProperty *); -typedef struct wmManipulatorPropertyFnParams { - wmManipulatorPropertyFnGet value_get_fn; - wmManipulatorPropertyFnSet value_set_fn; - wmManipulatorPropertyFnRangeGet range_get_fn; - wmManipulatorPropertyFnFree free_fn; +typedef struct wmGizmoPropertyFnParams { + wmGizmoPropertyFnGet value_get_fn; + wmGizmoPropertyFnSet value_set_fn; + wmGizmoPropertyFnRangeGet range_get_fn; + wmGizmoPropertyFnFree free_fn; void *user_data; -} wmManipulatorPropertyFnParams; +} wmGizmoPropertyFnParams; #endif /* __WM_GIZMO_FN_H__ */ diff --git a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h index 80418cbfeb3..5b1085db4a1 100644 --- a/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h +++ b/source/blender/windowmanager/gizmo/wm_gizmo_wmapi.h @@ -26,10 +26,10 @@ /** \file blender/windowmanager/gizmo/wm_gizmo_wmapi.h * \ingroup wm * - * \name Manipulators Window Manager API + * \name Gizmos Window Manager API * API for usage in window manager code only. It should contain all functionality - * needed to hook up the manipulator system with Blender's window manager. It's - * mostly the event system that needs to communicate with manipulator code. + * needed to hook up the gizmo system with Blender's window manager. It's + * mostly the event system that needs to communicate with gizmo code. * * Only included in wm.h and lower level files. */ @@ -39,59 +39,59 @@ #define __WM_GIZMO_WMAPI_H__ struct wmEventHandler; -struct wmManipulatorMap; +struct wmGizmoMap; struct wmOperatorType; struct wmOperator; /* -------------------------------------------------------------------- */ -/* wmManipulator */ +/* wmGizmo */ -/* wm_manipulator_type.c, for init/exit */ -void wm_manipulatortype_free(void); -void wm_manipulatortype_init(void); +/* wm_gizmo_type.c, for init/exit */ +void wm_gizmotype_free(void); +void wm_gizmotype_init(void); -/* wm_manipulatorgroup_type.c, for init/exit */ -void wm_manipulatorgrouptype_free(void); -void wm_manipulatorgrouptype_init(void); +/* wm_gizmogroup_type.c, for init/exit */ +void wm_gizmogrouptype_free(void); +void wm_gizmogrouptype_init(void); /* -------------------------------------------------------------------- */ -/* wmManipulatorGroup */ +/* wmGizmoGroup */ -void MANIPULATORGROUP_OT_manipulator_select(struct wmOperatorType *ot); -void MANIPULATORGROUP_OT_manipulator_tweak(struct wmOperatorType *ot); +void GIZMOGROUP_OT_gizmo_select(struct wmOperatorType *ot); +void GIZMOGROUP_OT_gizmo_tweak(struct wmOperatorType *ot); -bool wm_manipulatorgroup_is_any_selected(const struct wmManipulatorGroup *mgroup); +bool wm_gizmogroup_is_any_selected(const struct wmGizmoGroup *mgroup); /* -------------------------------------------------------------------- */ -/* wmManipulatorMap */ +/* wmGizmoMap */ -void wm_manipulatormap_remove(struct wmManipulatorMap *mmap); +void wm_gizmomap_remove(struct wmGizmoMap *mmap); -void wm_manipulators_keymap(struct wmKeyConfig *keyconf); +void wm_gizmos_keymap(struct wmKeyConfig *keyconf); -void wm_manipulatormaps_handled_modal_update( +void wm_gizmomaps_handled_modal_update( bContext *C, struct wmEvent *event, struct wmEventHandler *handler); -void wm_manipulatormap_handler_context(bContext *C, struct wmEventHandler *handler); +void wm_gizmomap_handler_context(bContext *C, struct wmEventHandler *handler); -struct wmManipulator *wm_manipulatormap_highlight_find( - struct wmManipulatorMap *mmap, bContext *C, const struct wmEvent *event, +struct wmGizmo *wm_gizmomap_highlight_find( + struct wmGizmoMap *mmap, bContext *C, const struct wmEvent *event, int *r_part); -bool wm_manipulatormap_highlight_set( - struct wmManipulatorMap *mmap, const bContext *C, - struct wmManipulator *mpr, int part); -struct wmManipulator *wm_manipulatormap_highlight_get(struct wmManipulatorMap *mmap); -void wm_manipulatormap_modal_set( - struct wmManipulatorMap *mmap, bContext *C, struct wmManipulator *mpr, +bool wm_gizmomap_highlight_set( + struct wmGizmoMap *mmap, const bContext *C, + struct wmGizmo *mpr, int part); +struct wmGizmo *wm_gizmomap_highlight_get(struct wmGizmoMap *mmap); +void wm_gizmomap_modal_set( + struct wmGizmoMap *mmap, bContext *C, struct wmGizmo *mpr, const struct wmEvent *event, bool enable); -struct wmManipulator *wm_manipulatormap_modal_get(struct wmManipulatorMap *mmap); -struct wmManipulator **wm_manipulatormap_selected_get(wmManipulatorMap *mmap, int *r_selected_len); -struct ListBase *wm_manipulatormap_groups_get(wmManipulatorMap *mmap); +struct wmGizmo *wm_gizmomap_modal_get(struct wmGizmoMap *mmap); +struct wmGizmo **wm_gizmomap_selected_get(wmGizmoMap *mmap, int *r_selected_len); +struct ListBase *wm_gizmomap_groups_get(wmGizmoMap *mmap); /* -------------------------------------------------------------------- */ -/* wmManipulatorMapType */ +/* wmGizmoMapType */ -void wm_manipulatormaptypes_free(void); +void wm_gizmomaptypes_free(void); #endif /* __WM_GIZMO_WMAPI_H__ */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 8469dc9da0e..bc24b7698e2 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2004,8 +2004,8 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand CTX_wm_region_set(C, NULL); } - /* update manipulators during modal handlers */ - wm_manipulatormaps_handled_modal_update(C, event, handler); + /* update gizmos during modal handlers */ + wm_gizmomaps_handled_modal_update(C, event, handler); /* remove modal handler, operator itself should have been canceled and freed */ if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) { @@ -2392,32 +2392,32 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers } } } - else if (handler->manipulator_map) { + else if (handler->gizmo_map) { ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); - wmManipulatorMap *mmap = handler->manipulator_map; - wmManipulator *mpr = wm_manipulatormap_highlight_get(mmap); + wmGizmoMap *mmap = handler->gizmo_map; + wmGizmo *mpr = wm_gizmomap_highlight_get(mmap); - if (region->manipulator_map != handler->manipulator_map) { - WM_manipulatormap_tag_refresh(handler->manipulator_map); + if (region->gizmo_map != handler->gizmo_map) { + WM_gizmomap_tag_refresh(handler->gizmo_map); } - wm_manipulatormap_handler_context(C, handler); + wm_gizmomap_handler_context(C, handler); wm_region_mouse_co(C, event); - /* handle manipulator highlighting */ - if (event->type == MOUSEMOVE && !wm_manipulatormap_modal_get(mmap)) { + /* handle gizmo highlighting */ + if (event->type == MOUSEMOVE && !wm_gizmomap_modal_get(mmap)) { int part; - mpr = wm_manipulatormap_highlight_find(mmap, C, event, &part); - if (wm_manipulatormap_highlight_set(mmap, C, mpr, part) && mpr != NULL) { - WM_tooltip_timer_init(C, CTX_wm_window(C), region, WM_manipulatormap_tooltip_init); + mpr = wm_gizmomap_highlight_find(mmap, C, event, &part); + if (wm_gizmomap_highlight_set(mmap, C, mpr, part) && mpr != NULL) { + WM_tooltip_timer_init(C, CTX_wm_window(C), region, WM_gizmomap_tooltip_init); } } else { /* Either we operate on a single highlighted item - * or groups attached to the selected manipulators. + * or groups attached to the selected gizmos. * To simplify things both cases loop over an array of items. */ - wmManipulatorGroup *mgroup_first; + wmGizmoGroup *mgroup_first; bool is_mgroup_single; if (ISMOUSE(event->type)) { @@ -2431,8 +2431,8 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers is_mgroup_single = true; } else { - if (WM_manipulatormap_is_any_selected(mmap)) { - const ListBase *groups = WM_manipulatormap_group_list(mmap); + if (WM_gizmomap_is_any_selected(mmap)) { + const ListBase *groups = WM_gizmomap_group_list(mmap); mgroup_first = groups->first; } else { @@ -2444,13 +2444,13 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers /* Don't use from now on. */ mpr = NULL; - for (wmManipulatorGroup *mgroup = mgroup_first; mgroup; mgroup = mgroup->next) { + for (wmGizmoGroup *mgroup = mgroup_first; mgroup; mgroup = mgroup->next) { /* get user customized keymap from default one */ if ((is_mgroup_single == false) && - /* We might want to change the logic here and use some kind of manipulator edit-mode. + /* We might want to change the logic here and use some kind of gizmo edit-mode. * For now just use keymap when a selection exists. */ - wm_manipulatorgroup_is_any_selected(mgroup) == false) + wm_gizmogroup_is_any_selected(mgroup) == false) { continue; } @@ -2472,14 +2472,14 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers /* weak, but allows interactive callback to not use rawkey */ event->keymap_idname = kmi->idname; - CTX_wm_manipulator_group_set(C, mgroup); + CTX_wm_gizmo_group_set(C, mgroup); /* handler->op is called later, we want keymap op to be triggered here */ handler->op = NULL; action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr); handler->op = op; - CTX_wm_manipulator_group_set(C, NULL); + CTX_wm_gizmo_group_set(C, NULL); if (action & WM_HANDLER_BREAK) { if (keymap_callback.handle_post_fn != NULL) { @@ -2804,7 +2804,7 @@ static bool wm_event_pie_filter(wmWindow *win, const wmEvent *event) } #ifdef USE_WORKSPACE_TOOL -static void wm_event_manipulator_temp_handler_apply( +static void wm_event_gizmo_temp_handler_apply( bContext *C, ScrArea *sa, ARegion *ar, wmEventHandler *sneaky_handler) { if (ar->regiontype == RGN_TYPE_WINDOW) { @@ -2818,17 +2818,17 @@ static void wm_event_manipulator_temp_handler_apply( /* Handle widgets first. */ wmEventHandler *handler_last = ar->handlers.last; - while (handler_last && handler_last->manipulator_map == NULL) { + while (handler_last && handler_last->gizmo_map == NULL) { handler_last = handler_last->prev; } - /* Head of list or after last manipulator. */ + /* Head of list or after last gizmo. */ BLI_insertlinkafter(&ar->handlers, handler_last, sneaky_handler); } } } } -static void wm_event_manipulator_temp_handler_clear( +static void wm_event_gizmo_temp_handler_clear( bContext *UNUSED(C), ScrArea *UNUSED(sa), ARegion *ar, wmEventHandler *sneaky_handler) { if (sneaky_handler->keymap) { @@ -2846,7 +2846,7 @@ void wm_event_do_handlers(bContext *C) /* update key configuration before handling events */ WM_keyconfig_update(wm); - WM_manipulatorconfig_update(CTX_data_main(C)); + WM_gizmoconfig_update(CTX_data_main(C)); for (win = wm->windows.first; win; win = win->next) { bScreen *screen = WM_window_get_active_screen(win); @@ -3021,13 +3021,13 @@ void wm_event_do_handlers(bContext *C) * to fetch its current keymap. */ wmEventHandler sneaky_handler = {NULL}; - wm_event_manipulator_temp_handler_apply(C, sa, ar, &sneaky_handler); + wm_event_gizmo_temp_handler_apply(C, sa, ar, &sneaky_handler); #endif /* USE_WORKSPACE_TOOL */ action |= wm_handlers_do(C, event, &ar->handlers); #ifdef USE_WORKSPACE_TOOL - wm_event_manipulator_temp_handler_clear(C, sa, ar, &sneaky_handler); + wm_event_gizmo_temp_handler_clear(C, sa, ar, &sneaky_handler); #endif /* USE_WORKSPACE_TOOL */ /* fileread case (python), [#29489] */ @@ -3094,7 +3094,7 @@ void wm_event_do_handlers(bContext *C) /* update key configuration after handling events */ WM_keyconfig_update(wm); - WM_manipulatorconfig_update(CTX_data_main(C)); + WM_gizmoconfig_update(CTX_data_main(C)); } /* ********** filesector handling ************ */ @@ -4470,7 +4470,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) #ifdef USE_WORKSPACE_TOOL wmEventHandler sneaky_handler = {NULL}; - wm_event_manipulator_temp_handler_apply(C, sa, ar, &sneaky_handler); + wm_event_gizmo_temp_handler_apply(C, sa, ar, &sneaky_handler); #endif ListBase *handlers[] = { @@ -4503,7 +4503,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win) } #ifdef USE_WORKSPACE_TOOL - wm_event_manipulator_temp_handler_clear(C, sa, ar, &sneaky_handler); + wm_event_gizmo_temp_handler_clear(C, sa, ar, &sneaky_handler); #endif if (memcmp(&cd_prev.text, &cd->text, sizeof(cd_prev.text)) != 0) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 463508674d5..0c7c85e0d94 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -212,15 +212,15 @@ void WM_init(bContext *C, int argc, const char **argv) WM_paneltype_init(); /* Lookup table only. */ WM_menutype_init(); WM_uilisttype_init(); - wm_manipulatortype_init(); - wm_manipulatorgrouptype_init(); + wm_gizmotype_init(); + wm_gizmogrouptype_init(); ED_undosys_type_init(); BKE_library_callback_free_window_manager_set(wm_close_and_free); /* library.c */ BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference); /* library.c */ - BKE_region_callback_free_manipulatormap_set(wm_manipulatormap_remove); /* screen.c */ - BKE_region_callback_refresh_tag_manipulatormap_set(WM_manipulatormap_tag_refresh); + BKE_region_callback_free_gizmomap_set(wm_gizmomap_remove); /* screen.c */ + BKE_region_callback_refresh_tag_gizmomap_set(WM_gizmomap_tag_refresh); BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference); /* library.c */ BKE_blender_callback_test_break_set(wm_window_testbreak); /* blender.c */ BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */ @@ -507,10 +507,10 @@ void WM_exit_ext(bContext *C, const bool do_python) ED_gpencil_strokes_copybuf_free(); BKE_node_clipboard_clear(); - /* free manipulator-maps after freeing blender, so no deleted data get accessed during cleaning up of areas */ - wm_manipulatormaptypes_free(); - wm_manipulatorgrouptype_free(); - wm_manipulatortype_free(); + /* free gizmo-maps after freeing blender, so no deleted data get accessed during cleaning up of areas */ + wm_gizmomaptypes_free(); + wm_gizmogrouptype_free(); + wm_gizmotype_free(); BLF_exit(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index dd9b8324b11..5cf9ac625c3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3248,9 +3248,9 @@ void wm_operatortypes_register(void) WM_operatortype_append(WM_OT_previews_clear); WM_operatortype_append(WM_OT_doc_view_manual_ui_context); - /* manipulators */ - WM_operatortype_append(MANIPULATORGROUP_OT_manipulator_select); - WM_operatortype_append(MANIPULATORGROUP_OT_manipulator_tweak); + /* gizmos */ + WM_operatortype_append(GIZMOGROUP_OT_gizmo_select); + WM_operatortype_append(GIZMOGROUP_OT_gizmo_tweak); } /* circleselect-like modal operators */ @@ -3580,7 +3580,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) RNA_float_set(kmi->ptr, "value", 1.0f / 1.5f); #endif /* WITH_INPUT_NDOF */ - wm_manipulators_keymap(keyconf); + wm_gizmos_keymap(keyconf); gesture_circle_modal_keymap(keyconf); gesture_border_modal_keymap(keyconf); gesture_zoom_border_modal_keymap(keyconf); diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c index d06cc21ec21..350327e8590 100644 --- a/source/blender/windowmanager/intern/wm_toolsystem.c +++ b/source/blender/windowmanager/intern/wm_toolsystem.c @@ -131,8 +131,8 @@ static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *t { bToolRef_Runtime *tref_rt = tref->runtime; - if (tref_rt->manipulator_group[0]) { - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(tref_rt->manipulator_group, false); + if (tref_rt->gizmo_group[0]) { + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(tref_rt->gizmo_group, false); if (wgt != NULL) { bool found = false; @@ -144,7 +144,7 @@ static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *t for (wmWindow *win = wm->windows.first; win; win = win->next) { const WorkSpace *workspace_iter = WM_window_get_active_workspace(win); if (workspace != workspace_iter) { - if (STREQ(workspace->tool.manipulator_group, workspace_iter->tool.manipulator_group)) { + if (STREQ(workspace->tool.gizmo_group, workspace_iter->tool.gizmo_group)) { found = true; break; } @@ -154,8 +154,8 @@ static void toolsystem_unlink_ref(bContext *C, WorkSpace *workspace, bToolRef *t UNUSED_VARS(workspace); #endif if (!found) { - wmManipulatorMapType *mmap_type = WM_manipulatormaptype_ensure(&wgt->mmap_params); - WM_manipulatormaptype_group_unlink(C, bmain, mmap_type, wgt); + wmGizmoMapType *mmap_type = WM_gizmomaptype_ensure(&wgt->mmap_params); + WM_gizmomaptype_group_unlink(C, bmain, mmap_type, wgt); } } } @@ -171,11 +171,11 @@ void WM_toolsystem_unlink(bContext *C, WorkSpace *workspace, const bToolKey *tke static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tref) { bToolRef_Runtime *tref_rt = tref->runtime; - if (tref_rt->manipulator_group[0]) { - const char *idname = tref_rt->manipulator_group; - wmManipulatorGroupType *wgt = WM_manipulatorgrouptype_find(idname, false); + if (tref_rt->gizmo_group[0]) { + const char *idname = tref_rt->gizmo_group; + wmGizmoGroupType *wgt = WM_gizmogrouptype_find(idname, false); if (wgt != NULL) { - WM_manipulator_group_type_ensure_ptr(wgt); + WM_gizmo_group_type_ensure_ptr(wgt); } else { CLOG_WARN(WM_LOG_TOOLS, "'%s' widget not found", idname); diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index d191fe4a9c2..1dcd0cb62d0 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -77,8 +77,8 @@ typedef struct wmEventHandler { /* drop box handler */ ListBase *dropboxes; - /* manipulator handler */ - struct wmManipulatorMap *manipulator_map; + /* gizmo handler */ + struct wmGizmoMap *gizmo_map; } wmEventHandler; /* custom types for handlers, for signaling, freeing */ diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 3f98b6ef512..6a0e4882830 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -339,8 +339,8 @@ enum { EVT_DROP = 0x5023, EVT_BUT_CANCEL = 0x5024, - /* could become manipulator callback */ - EVT_MANIPULATOR_UPDATE = 0x5025, + /* could become gizmo callback */ + EVT_GIZMO_UPDATE = 0x5025, /* ********** End of Blender internal events. ********** */ }; -- cgit v1.2.3