Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-03-06 18:56:42 +0300
committerJulian Eisel <julian@blender.org>2020-03-06 19:19:23 +0300
commitb2ee1770d4c31078518f4ec9edd5196a41345162 (patch)
tree6b7f6ff9057322245fc3b3407bece3f1c0cb3eb5 /source/blender
parentb825a95ec311a169d33fe21e28418f11a516c82f (diff)
Cleanup: Rename ARegion variables from ar to region
The old convention was easy to confuse with ScrArea. Part of https://developer.blender.org/T74432. This is mostly a batch rename with some manual fixing. Only single word variable names are changed, no prefixed/suffixed names. Brecht van Lommel and Campbell Barton both gave me a green light for this convention change. Also ran clan clang format on affected files.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_node.h2
-rw-r--r--source/blender/blenkernel/BKE_screen.h20
-rw-r--r--source/blender/blenkernel/intern/context.c24
-rw-r--r--source/blender/blenkernel/intern/screen.c150
-rw-r--r--source/blender/blenloader/intern/readfile.c88
-rw-r--r--source/blender/blenloader/intern/versioning_250.c417
-rw-r--r--source/blender/blenloader/intern/versioning_260.c40
-rw-r--r--source/blender/blenloader/intern/versioning_270.c54
-rw-r--r--source/blender/blenloader/intern/versioning_280.c102
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c34
-rw-r--r--source/blender/blenloader/intern/writefile.c12
-rw-r--r--source/blender/draw/DRW_engine.h18
-rw-r--r--source/blender/draw/DRW_select_buffer.h12
-rw-r--r--source/blender/draw/engines/eevee/eevee_lookdev.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_motion_blur.c12
-rw-r--r--source/blender/draw/engines/external/external_engine.c8
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c26
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c2
-rw-r--r--source/blender/draw/engines/overlay/overlay_edit_mesh.c2
-rw-r--r--source/blender/draw/engines/select/select_engine.c2
-rw-r--r--source/blender/draw/intern/DRW_render.h2
-rw-r--r--source/blender/draw/intern/draw_manager.c78
-rw-r--r--source/blender/draw/intern/draw_manager_text.c14
-rw-r--r--source/blender/draw/intern/draw_manager_text.h4
-rw-r--r--source/blender/draw/intern/draw_select_buffer.c32
-rw-r--r--source/blender/draw/intern/draw_view.c20
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c22
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c18
-rw-r--r--source/blender/editors/animation/anim_draw.c18
-rw-r--r--source/blender/editors/animation/anim_filter.c6
-rw-r--r--source/blender/editors/animation/anim_markers.c18
-rw-r--r--source/blender/editors/animation/anim_ops.c6
-rw-r--r--source/blender/editors/animation/time_scrub_ui.c34
-rw-r--r--source/blender/editors/armature/armature_add.c6
-rw-r--r--source/blender/editors/armature/pose_slide.c8
-rw-r--r--source/blender/editors/curve/editcurve.c4
-rw-r--r--source/blender/editors/curve/editcurve_paint.c31
-rw-r--r--source/blender/editors/curve/editfont.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_utils.c10
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c19
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c12
-rw-r--r--source/blender/editors/gpencil/annotate_draw.c38
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c87
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c12
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c28
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c16
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c8
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c81
-rw-r--r--source/blender/editors/gpencil/gpencil_intern.h8
-rw-r--r--source/blender/editors/gpencil/gpencil_interpolate.c18
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c83
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c29
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c89
-rw-r--r--source/blender/editors/include/ED_anim_api.h6
-rw-r--r--source/blender/editors/include/ED_clip.h18
-rw-r--r--source/blender/editors/include/ED_fileselect.h6
-rw-r--r--source/blender/editors/include/ED_gpencil.h4
-rw-r--r--source/blender/editors/include/ED_image.h12
-rw-r--r--source/blender/editors/include/ED_mask.h16
-rw-r--r--source/blender/editors/include/ED_mesh.h4
-rw-r--r--source/blender/editors/include/ED_node.h7
-rw-r--r--source/blender/editors/include/ED_screen.h115
-rw-r--r--source/blender/editors/include/ED_screen_types.h4
-rw-r--r--source/blender/editors/include/ED_sculpt.h2
-rw-r--r--source/blender/editors/include/ED_space_api.h4
-rw-r--r--source/blender/editors/include/ED_text.h2
-rw-r--r--source/blender/editors/include/ED_time_scrub_ui.h6
-rw-r--r--source/blender/editors/include/ED_transform_snap_object_context.h2
-rw-r--r--source/blender/editors/include/ED_uvedit.h2
-rw-r--r--source/blender/editors/include/ED_view3d.h103
-rw-r--r--source/blender/editors/include/ED_view3d_offscreen.h4
-rw-r--r--source/blender/editors/include/UI_interface.h58
-rw-r--r--source/blender/editors/include/UI_view2d.h22
-rw-r--r--source/blender/editors/interface/interface.c144
-rw-r--r--source/blender/editors/interface/interface_align.c4
-rw-r--r--source/blender/editors/interface/interface_context_menu.c22
-rw-r--r--source/blender/editors/interface/interface_draw.c18
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c12
-rw-r--r--source/blender/editors/interface/interface_eyedropper_color.c24
-rw-r--r--source/blender/editors/interface/interface_eyedropper_datablock.c18
-rw-r--r--source/blender/editors/interface/interface_eyedropper_depth.c22
-rw-r--r--source/blender/editors/interface/interface_eyedropper_intern.h2
-rw-r--r--source/blender/editors/interface/interface_handlers.c351
-rw-r--r--source/blender/editors/interface/interface_intern.h102
-rw-r--r--source/blender/editors/interface/interface_layout.c6
-rw-r--r--source/blender/editors/interface/interface_ops.c30
-rw-r--r--source/blender/editors/interface/interface_panel.c302
-rw-r--r--source/blender/editors/interface/interface_query.c80
-rw-r--r--source/blender/editors/interface/interface_region_hud.c172
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c16
-rw-r--r--source/blender/editors/interface/interface_region_popover.c10
-rw-r--r--source/blender/editors/interface/interface_region_popup.c78
-rw-r--r--source/blender/editors/interface/interface_region_search.c113
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.c42
-rw-r--r--source/blender/editors/interface/interface_regions.c26
-rw-r--r--source/blender/editors/interface/interface_regions_intern.h2
-rw-r--r--source/blender/editors/interface/interface_templates.c76
-rw-r--r--source/blender/editors/interface/interface_widgets.c20
-rw-r--r--source/blender/editors/interface/view2d.c72
-rw-r--r--source/blender/editors/interface/view2d_draw.c42
-rw-r--r--source/blender/editors/interface/view2d_gizmo_navigate.c4
-rw-r--r--source/blender/editors/interface/view2d_ops.c153
-rw-r--r--source/blender/editors/mask/mask_add.c16
-rw-r--r--source/blender/editors/mask/mask_draw.c21
-rw-r--r--source/blender/editors/mask/mask_edit.c35
-rw-r--r--source/blender/editors/mask/mask_ops.c18
-rw-r--r--source/blender/editors/mask/mask_select.c24
-rw-r--r--source/blender/editors/mesh/editmesh_add_gizmo.c12
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c8
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c10
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c12
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c20
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c8
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c54
-rw-r--r--source/blender/editors/mesh/editmesh_knife_project.c6
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c36
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c14
-rw-r--r--source/blender/editors/mesh/editmesh_preselect_elem.c4
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c50
-rw-r--r--source/blender/editors/mesh/editmesh_rip_edge.c12
-rw-r--r--source/blender/editors/mesh/editmesh_select.c18
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c22
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c8
-rw-r--r--source/blender/editors/mesh/meshtools.c35
-rw-r--r--source/blender/editors/object/object_add.c8
-rw-r--r--source/blender/editors/object/object_transform.c16
-rw-r--r--source/blender/editors/physics/particle_edit.c36
-rw-r--r--source/blender/editors/render/render_opengl.c10
-rw-r--r--source/blender/editors/render/render_update.c20
-rw-r--r--source/blender/editors/screen/area.c1026
-rw-r--r--source/blender/editors/screen/area_query.c94
-rw-r--r--source/blender/editors/screen/area_utils.c11
-rw-r--r--source/blender/editors/screen/screen_edit.c146
-rw-r--r--source/blender/editors/screen/screen_intern.h2
-rw-r--r--source/blender/editors/screen/screen_ops.c369
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c71
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c24
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c44
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c22
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h8
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c34
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c23
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c24
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c18
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c80
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h5
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c12
-rw-r--r--source/blender/editors/space_action/action_draw.c10
-rw-r--r--source/blender/editors/space_action/action_edit.c2
-rw-r--r--source/blender/editors/space_action/action_intern.h6
-rw-r--r--source/blender/editors/space_action/action_select.c14
-rw-r--r--source/blender/editors/space_action/space_action.c219
-rw-r--r--source/blender/editors/space_api/spacetypes.c6
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c97
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c16
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c15
-rw-r--r--source/blender/editors/space_clip/clip_draw.c67
-rw-r--r--source/blender/editors/space_clip/clip_editor.c35
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c4
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c28
-rw-r--r--source/blender/editors/space_clip/clip_intern.h12
-rw-r--r--source/blender/editors/space_clip/clip_ops.c64
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c14
-rw-r--r--source/blender/editors/space_clip/space_clip.c367
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c30
-rw-r--r--source/blender/editors/space_clip/tracking_ops_plane.c8
-rw-r--r--source/blender/editors/space_clip/tracking_select.c22
-rw-r--r--source/blender/editors/space_console/console_draw.c28
-rw-r--r--source/blender/editors/space_console/console_intern.h8
-rw-r--r--source/blender/editors/space_console/console_ops.c88
-rw-r--r--source/blender/editors/space_console/space_console.c81
-rw-r--r--source/blender/editors/space_file/file_draw.c25
-rw-r--r--source/blender/editors/space_file/file_intern.h8
-rw-r--r--source/blender/editors/space_file/file_ops.c124
-rw-r--r--source/blender/editors/space_file/file_utils.c4
-rw-r--r--source/blender/editors/space_file/filesel.c14
-rw-r--r--source/blender/editors/space_file/space_file.c162
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c4
-rw-r--r--source/blender/editors/space_graph/graph_draw.c39
-rw-r--r--source/blender/editors/space_graph/graph_edit.c22
-rw-r--r--source/blender/editors/space_graph/graph_intern.h8
-rw-r--r--source/blender/editors/space_graph/graph_ops.c6
-rw-r--r--source/blender/editors/space_graph/graph_select.c8
-rw-r--r--source/blender/editors/space_graph/space_graph.c159
-rw-r--r--source/blender/editors/space_image/image_draw.c97
-rw-r--r--source/blender/editors/space_image/image_edit.c31
-rw-r--r--source/blender/editors/space_image/image_intern.h4
-rw-r--r--source/blender/editors/space_image/image_ops.c175
-rw-r--r--source/blender/editors/space_image/space_image.c228
-rw-r--r--source/blender/editors/space_info/info_draw.c31
-rw-r--r--source/blender/editors/space_info/info_intern.h6
-rw-r--r--source/blender/editors/space_info/info_report.c10
-rw-r--r--source/blender/editors/space_info/space_info.c85
-rw-r--r--source/blender/editors/space_nla/nla_channels.c8
-rw-r--r--source/blender/editors/space_nla/nla_draw.c10
-rw-r--r--source/blender/editors/space_nla/nla_edit.c2
-rw-r--r--source/blender/editors/space_nla/nla_intern.h4
-rw-r--r--source/blender/editors/space_nla/nla_select.c8
-rw-r--r--source/blender/editors/space_nla/space_nla.c184
-rw-r--r--source/blender/editors/space_node/drawnode.c24
-rw-r--r--source/blender/editors/space_node/node_add.c8
-rw-r--r--source/blender/editors/space_node/node_draw.c80
-rw-r--r--source/blender/editors/space_node/node_edit.c24
-rw-r--r--source/blender/editors/space_node/node_gizmo.c29
-rw-r--r--source/blender/editors/space_node/node_intern.h10
-rw-r--r--source/blender/editors/space_node/node_relationships.c31
-rw-r--r--source/blender/editors/space_node/node_select.c44
-rw-r--r--source/blender/editors/space_node/node_view.c66
-rw-r--r--source/blender/editors/space_node/space_node.c142
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c26
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c167
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c129
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h6
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c41
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c16
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c22
-rw-r--r--source/blender/editors/space_outliner/outliner_utils.c28
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c108
-rw-r--r--source/blender/editors/space_script/script_edit.c4
-rw-r--r--source/blender/editors/space_script/space_script.c36
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c87
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c14
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c248
-rw-r--r--source/blender/editors/space_statusbar/space_statusbar.c28
-rw-r--r--source/blender/editors/space_text/space_text.c76
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c10
-rw-r--r--source/blender/editors/space_text/text_draw.c158
-rw-r--r--source/blender/editors/space_text/text_header.c26
-rw-r--r--source/blender/editors/space_text/text_intern.h18
-rw-r--r--source/blender/editors/space_text/text_ops.c175
-rw-r--r--source/blender/editors/space_topbar/space_topbar.c58
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c80
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c327
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c261
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c446
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c25
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c22
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c50
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h26
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c51
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c212
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c30
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c148
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c102
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c52
-rw-r--r--source/blender/editors/transform/transform.c76
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c6
-rw-r--r--source/blender/editors/transform/transform_convert.c8
-rw-r--r--source/blender/editors/transform/transform_convert_action.c6
-rw-r--r--source/blender/editors/transform/transform_convert_graph.c4
-rw-r--r--source/blender/editors/transform/transform_convert_mask.c4
-rw-r--r--source/blender/editors/transform/transform_convert_tracking.c4
-rw-r--r--source/blender/editors/transform/transform_draw_cursors.c8
-rw-r--r--source/blender/editors/transform/transform_generics.c48
-rw-r--r--source/blender/editors/transform/transform_gizmo_2d.c40
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c52
-rw-r--r--source/blender/editors/transform/transform_gizmo_extrude_3d.c4
-rw-r--r--source/blender/editors/transform/transform_input.c12
-rw-r--r--source/blender/editors/transform/transform_mode_bend.c2
-rw-r--r--source/blender/editors/transform/transform_mode_edge_slide.c26
-rw-r--r--source/blender/editors/transform/transform_mode_vert_slide.c16
-rw-r--r--source/blender/editors/transform/transform_ops.c4
-rw-r--r--source/blender/editors/transform/transform_orientations.c4
-rw-r--r--source/blender/editors/transform/transform_snap.c32
-rw-r--r--source/blender/editors/transform/transform_snap_object.c18
-rw-r--r--source/blender/editors/util/ed_util.c6
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c35
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c13
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c5
-rw-r--r--source/blender/makesdna/DNA_screen_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_space.c105
-rw-r--r--source/blender/makesrna/intern/rna_space_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c6
-rw-r--r--source/blender/python/gpu/gpu_py_offscreen.c10
-rw-r--r--source/blender/python/intern/bpy_rna_callback.c2
-rw-r--r--source/blender/windowmanager/WM_api.h30
-rw-r--r--source/blender/windowmanager/WM_types.h2
-rw-r--r--source/blender/windowmanager/gizmo/WM_gizmo_api.h15
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c44
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c52
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c15
-rw-r--r--source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c6
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c4
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c4
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c358
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c152
-rw-r--r--source/blender/windowmanager/intern/wm_files.c18
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c4
-rw-r--r--source/blender/windowmanager/intern/wm_gesture_ops.c20
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c30
-rw-r--r--source/blender/windowmanager/intern/wm_operator_type.c12
-rw-r--r--source/blender/windowmanager/intern/wm_operator_utils.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c36
-rw-r--r--source/blender/windowmanager/intern/wm_splash_screen.c6
-rw-r--r--source/blender/windowmanager/intern/wm_stereo.c20
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c4
-rw-r--r--source/blender/windowmanager/intern/wm_tooltip.c12
-rw-r--r--source/blender/windowmanager/wm.h4
-rw-r--r--source/blender/windowmanager/wm_draw.h8
-rw-r--r--source/blender/windowmanager/wm_event_system.h2
314 files changed, 7544 insertions, 7272 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index ad8a1b82fd1..6f1f68e1ef2 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -198,7 +198,7 @@ typedef struct bNodeType {
/* Main draw function for the node */
void (*draw_nodetype)(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct SpaceNode *snode,
struct bNodeTree *ntree,
struct bNode *node,
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 9db60ced3e0..a6ed1274f19 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -133,19 +133,19 @@ typedef struct ARegionType {
int regionid; /* unique identifier within this space, defines RGN_TYPE_xxxx */
/* add handlers, stuff you only do once or on area/region type/size changes */
- void (*init)(struct wmWindowManager *wm, struct ARegion *ar);
+ void (*init)(struct wmWindowManager *wm, struct ARegion *region);
/* exit is called when the region is hidden or removed */
- void (*exit)(struct wmWindowManager *wm, struct ARegion *ar);
+ void (*exit)(struct wmWindowManager *wm, struct ARegion *region);
/* draw entirely, view changes should be handled here */
- void (*draw)(const struct bContext *C, struct ARegion *ar);
+ void (*draw)(const struct bContext *C, struct ARegion *region);
/* optional, compute button layout before drawing for dynamic size */
- void (*layout)(const struct bContext *C, struct ARegion *ar);
+ void (*layout)(const struct bContext *C, struct ARegion *region);
/* snap the size of the region (can be NULL for no snapping). */
- int (*snap_size)(const struct ARegion *ar, int size, int axis);
+ int (*snap_size)(const struct ARegion *region, int size, int axis);
/* contextual changes should be handled here */
void (*listener)(struct wmWindow *win,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmNotifier *wmn,
const struct Scene *scene);
/* Optional callback to generate subscriptions. */
@@ -154,7 +154,7 @@ typedef struct ARegionType {
struct Scene *scene,
struct bScreen *sc,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus);
void (*free)(struct ARegion *);
@@ -167,7 +167,7 @@ typedef struct ARegionType {
/* add own items to keymap */
void (*keymap)(struct wmKeyConfig *keyconf);
/* allows default cursor per region */
- void (*cursor)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar);
+ void (*cursor)(struct wmWindow *win, struct ScrArea *sa, struct ARegion *region);
/* return context data */
int (*context)(const struct bContext *C, const char *member, struct bContextDataResult *result);
@@ -340,8 +340,8 @@ void BKE_spacedata_callback_id_remap_set(
void BKE_spacedata_id_unref(struct ScrArea *sa, struct SpaceLink *sl, struct ID *id);
/* area/regions */
-struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar);
-void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar);
+struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *region);
+void BKE_area_region_free(struct SpaceType *st, struct ARegion *region);
void BKE_area_region_panels_free(struct ListBase *panels);
void BKE_screen_area_free(struct ScrArea *sa);
/* Gizmo-maps of a region need to be freed with the region.
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index e3d95bb660f..48985932d87 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -280,7 +280,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
{
bScreen *sc;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
int done = 0, recursion = C->data.recursion;
int ret = 0;
@@ -318,10 +318,10 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
done = 1;
}
}
- if (done != 1 && recursion < 2 && (ar = CTX_wm_region(C))) {
+ if (done != 1 && recursion < 2 && (region = CTX_wm_region(C))) {
C->data.recursion = 2;
- if (ar->type && ar->type->context) {
- ret = ar->type->context(C, member, result);
+ if (region->type && region->type->context) {
+ ret = region->type->context(C, member, result);
if (ret) {
done = -(-ret | -done);
}
@@ -545,7 +545,7 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
ListBase lb;
bScreen *sc;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
int a;
memset(&lb, 0, sizeof(lb));
@@ -578,9 +578,9 @@ ListBase CTX_data_dir_get_ex(const bContext *C,
data_dir_add(&lb, entry->name, use_all);
}
}
- if ((ar = CTX_wm_region(C)) && ar->type && ar->type->context) {
+ if ((region = CTX_wm_region(C)) && region->type && region->type->context) {
memset(&result, 0, sizeof(result));
- ar->type->context(C, "", &result);
+ region->type->context(C, "", &result);
if (result.dir) {
for (a = 0; result.dir[a]; a++) {
@@ -727,8 +727,8 @@ ARegion *CTX_wm_region(const bContext *C)
void *CTX_wm_region_data(const bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
- return (ar) ? ar->regiondata : NULL;
+ ARegion *region = CTX_wm_region(C);
+ return (region) ? region->regiondata : NULL;
}
struct ARegion *CTX_wm_menu(const bContext *C)
@@ -767,11 +767,11 @@ View3D *CTX_wm_view3d(const bContext *C)
RegionView3D *CTX_wm_region_view3d(const bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (sa && sa->spacetype == SPACE_VIEW3D) {
- if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
- return ar->regiondata;
+ if (region && region->regiontype == RGN_TYPE_WINDOW) {
+ return region->regiondata;
}
}
return NULL;
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 6285aee0ffa..3815cb9f59a 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -54,12 +54,12 @@
static void screen_free_data(ID *id)
{
bScreen *screen = (bScreen *)id;
- ARegion *ar;
+ ARegion *region;
/* No animdata here. */
- for (ar = screen->regionbase.first; ar; ar = ar->next) {
- BKE_area_region_free(NULL, ar);
+ for (region = screen->regionbase.first; region; region = region->next) {
+ BKE_area_region_free(NULL, region);
}
BLI_freelistN(&screen->regionbase);
@@ -204,14 +204,14 @@ bool BKE_spacetype_exists(int spaceid)
void BKE_spacedata_freelist(ListBase *lb)
{
SpaceLink *sl;
- ARegion *ar;
+ ARegion *region;
for (sl = lb->first; sl; sl = sl->next) {
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
/* free regions for pushed spaces */
- for (ar = sl->regionbase.first; ar; ar = ar->next) {
- BKE_area_region_free(st, ar);
+ for (region = sl->regionbase.first; region; region = region->next) {
+ BKE_area_region_free(st, region);
}
BLI_freelistN(&sl->regionbase);
@@ -238,9 +238,9 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
}
}
-ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
+ARegion *BKE_area_region_copy(SpaceType *st, ARegion *region)
{
- ARegion *newar = MEM_dupallocN(ar);
+ ARegion *newar = MEM_dupallocN(region);
newar->prev = newar->next = NULL;
BLI_listbase_clear(&newar->handlers);
@@ -255,28 +255,28 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
newar->draw_buffer = NULL;
/* use optional regiondata callback */
- if (ar->regiondata) {
- ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
+ if (region->regiondata) {
+ ARegionType *art = BKE_regiontype_from_id(st, region->regiontype);
if (art && art->duplicate) {
- newar->regiondata = art->duplicate(ar->regiondata);
+ newar->regiondata = art->duplicate(region->regiondata);
}
- else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
+ else if (region->flag & RGN_FLAG_TEMP_REGIONDATA) {
newar->regiondata = NULL;
}
else {
- newar->regiondata = MEM_dupallocN(ar->regiondata);
+ newar->regiondata = MEM_dupallocN(region->regiondata);
}
}
- if (ar->v2d.tab_offset) {
- newar->v2d.tab_offset = MEM_dupallocN(ar->v2d.tab_offset);
+ if (region->v2d.tab_offset) {
+ newar->v2d.tab_offset = MEM_dupallocN(region->v2d.tab_offset);
}
- panel_list_copy(&newar->panels, &ar->panels);
+ panel_list_copy(&newar->panels, &region->panels);
BLI_listbase_clear(&newar->ui_previews);
- BLI_duplicatelist(&newar->ui_previews, &ar->ui_previews);
+ BLI_duplicatelist(&newar->ui_previews, &region->ui_previews);
return newar;
}
@@ -284,13 +284,13 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
/* from lb2 to lb1, lb1 is supposed to be freed */
static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
{
- ARegion *ar;
+ ARegion *region;
/* to be sure */
BLI_listbase_clear(lb1);
- for (ar = lb2->first; ar; ar = ar->next) {
- ARegion *arnew = BKE_area_region_copy(st, ar);
+ for (region = lb2->first; region; region = region->next) {
+ ARegion *arnew = BKE_area_region_copy(st, region);
BLI_addtail(lb1, arnew);
}
}
@@ -344,19 +344,19 @@ ARegion *BKE_spacedata_find_region_type(const SpaceLink *slink, const ScrArea *s
{
const bool is_slink_active = slink == sa->spacedata.first;
const ListBase *regionbase = (is_slink_active) ? &sa->regionbase : &slink->regionbase;
- ARegion *ar = NULL;
+ ARegion *region = NULL;
BLI_assert(BLI_findindex(&sa->spacedata, slink) != -1);
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == region_type) {
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == region_type) {
break;
}
}
/* Should really unit test this instead. */
- BLI_assert(!is_slink_active || ar == BKE_area_find_region_type(sa, region_type));
+ BLI_assert(!is_slink_active || region == BKE_area_find_region_type(sa, region_type));
- return ar;
+ return region;
}
static void (*spacedata_id_remap_cb)(struct ScrArea *sa,
@@ -394,11 +394,11 @@ void BKE_screen_gizmo_tag_refresh(struct bScreen *sc)
}
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
for (sa = sc->areabase.first; sa; sa = sa->next) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->gizmo_map != NULL) {
- region_refresh_tag_gizmomap_callback(ar->gizmo_map);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->gizmo_map != NULL) {
+ region_refresh_tag_gizmomap_callback(region->gizmo_map);
}
}
}
@@ -429,33 +429,33 @@ void BKE_area_region_panels_free(ListBase *lb)
}
/* not region itself */
-void BKE_area_region_free(SpaceType *st, ARegion *ar)
+void BKE_area_region_free(SpaceType *st, ARegion *region)
{
uiList *uilst;
if (st) {
- ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
+ ARegionType *art = BKE_regiontype_from_id(st, region->regiontype);
if (art && art->free) {
- art->free(ar);
+ art->free(region);
}
- if (ar->regiondata) {
+ if (region->regiondata) {
printf("regiondata free error\n");
}
}
- else if (ar->type && ar->type->free) {
- ar->type->free(ar);
+ else if (region->type && region->type->free) {
+ region->type->free(region);
}
- if (ar->v2d.tab_offset) {
- MEM_freeN(ar->v2d.tab_offset);
- ar->v2d.tab_offset = NULL;
+ if (region->v2d.tab_offset) {
+ MEM_freeN(region->v2d.tab_offset);
+ region->v2d.tab_offset = NULL;
}
- BKE_area_region_panels_free(&ar->panels);
+ BKE_area_region_panels_free(&region->panels);
- for (uilst = ar->ui_lists.first; uilst; uilst = uilst->next) {
+ for (uilst = region->ui_lists.first; uilst; uilst = uilst->next) {
if (uilst->dyn_data) {
uiListDyn *dyn_data = uilst->dyn_data;
if (dyn_data->items_filter_flags) {
@@ -471,24 +471,24 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar)
}
}
- if (ar->gizmo_map != NULL) {
- region_free_gizmomap_callback(ar->gizmo_map);
+ if (region->gizmo_map != NULL) {
+ region_free_gizmomap_callback(region->gizmo_map);
}
- BLI_freelistN(&ar->ui_lists);
- BLI_freelistN(&ar->ui_previews);
- BLI_freelistN(&ar->panels_category);
- BLI_freelistN(&ar->panels_category_active);
+ BLI_freelistN(&region->ui_lists);
+ BLI_freelistN(&region->ui_previews);
+ BLI_freelistN(&region->panels_category);
+ BLI_freelistN(&region->panels_category_active);
}
/* not area itself */
void BKE_screen_area_free(ScrArea *sa)
{
SpaceType *st = BKE_spacetype_from_id(sa->spacetype);
- ARegion *ar;
+ ARegion *region;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- BKE_area_region_free(st, ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ BKE_area_region_free(st, region);
}
MEM_SAFE_FREE(sa->global);
@@ -722,9 +722,9 @@ void BKE_screen_remove_unused_scrverts(bScreen *sc)
ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type)
{
if (sa) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == region_type) {
- return ar;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == region_type) {
+ return region;
}
}
}
@@ -735,9 +735,9 @@ ARegion *BKE_area_find_region_type(const ScrArea *sa, int region_type)
ARegion *BKE_area_find_region_active_win(ScrArea *sa)
{
if (sa) {
- ARegion *ar = BLI_findlink(&sa->regionbase, sa->region_active_win);
- if (ar && (ar->regiontype == RGN_TYPE_WINDOW)) {
- return ar;
+ ARegion *region = BLI_findlink(&sa->regionbase, sa->region_active_win);
+ if (region && (region->regiontype == RGN_TYPE_WINDOW)) {
+ return region;
}
/* fallback to any */
@@ -750,11 +750,11 @@ ARegion *BKE_area_find_region_xy(ScrArea *sa, const int regiontype, int x, int y
{
ARegion *ar_found = NULL;
if (sa) {
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if ((regiontype == RGN_TYPE_ANY) || (ar->regiontype == regiontype)) {
- if (BLI_rcti_isect_pt(&ar->winrct, x, y)) {
- ar_found = ar;
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) {
+ if (BLI_rcti_isect_pt(&region->winrct, x, y)) {
+ ar_found = region;
break;
}
}
@@ -769,10 +769,10 @@ ARegion *BKE_area_find_region_xy(ScrArea *sa, const int regiontype, int x, int y
ARegion *BKE_screen_find_region_xy(bScreen *sc, const int regiontype, int x, int y)
{
ARegion *ar_found = NULL;
- for (ARegion *ar = sc->regionbase.first; ar; ar = ar->next) {
- if ((regiontype == RGN_TYPE_ANY) || (ar->regiontype == regiontype)) {
- if (BLI_rcti_isect_pt(&ar->winrct, x, y)) {
- ar_found = ar;
+ for (ARegion *region = sc->regionbase.first; region; region = region->next) {
+ if ((regiontype == RGN_TYPE_ANY) || (region->regiontype == regiontype)) {
+ if (BLI_rcti_isect_pt(&region->winrct, x, y)) {
+ ar_found = region;
break;
}
}
@@ -847,11 +847,11 @@ void BKE_screen_view3d_sync(View3D *v3d, struct Scene *scene)
v3d->camera = scene->camera;
if (v3d->camera == NULL) {
- ARegion *ar;
+ ARegion *region;
- for (ar = v3d->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = v3d->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
rv3d->persp = RV3D_PERSP;
}
@@ -914,20 +914,20 @@ void BKE_screen_header_alignment_reset(bScreen *screen)
{
int alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) {
- ar->alignment = RGN_ALIGN_TOP;
+ region->alignment = RGN_ALIGN_TOP;
continue;
}
- ar->alignment = alignment;
+ region->alignment = alignment;
}
- if (ar->regiontype == RGN_TYPE_FOOTER) {
+ if (region->regiontype == RGN_TYPE_FOOTER) {
if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_PROPERTIES)) {
- ar->alignment = RGN_ALIGN_BOTTOM;
+ region->alignment = RGN_ALIGN_BOTTOM;
continue;
}
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
}
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a0d661632f4..6cf8c968ed4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7001,38 +7001,38 @@ static void direct_link_panel_list(FileData *fd, ListBase *lb)
}
}
-static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
+static void direct_link_region(FileData *fd, ARegion *region, int spacetype)
{
uiList *ui_list;
- direct_link_panel_list(fd, &ar->panels);
+ direct_link_panel_list(fd, &region->panels);
- link_list(fd, &ar->panels_category_active);
+ link_list(fd, &region->panels_category_active);
- link_list(fd, &ar->ui_lists);
+ link_list(fd, &region->ui_lists);
- for (ui_list = ar->ui_lists.first; ui_list; ui_list = ui_list->next) {
+ for (ui_list = region->ui_lists.first; ui_list; ui_list = ui_list->next) {
ui_list->type = NULL;
ui_list->dyn_data = NULL;
ui_list->properties = newdataadr(fd, ui_list->properties);
IDP_DirectLinkGroup_OrFree(&ui_list->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
- link_list(fd, &ar->ui_previews);
+ link_list(fd, &region->ui_previews);
if (spacetype == SPACE_EMPTY) {
/* unknown space type, don't leak regiondata */
- ar->regiondata = NULL;
+ region->regiondata = NULL;
}
- else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
+ else if (region->flag & RGN_FLAG_TEMP_REGIONDATA) {
/* Runtime data, don't use. */
- ar->regiondata = NULL;
+ region->regiondata = NULL;
}
else {
- ar->regiondata = newdataadr(fd, ar->regiondata);
- if (ar->regiondata) {
+ region->regiondata = newdataadr(fd, region->regiondata);
+ if (region->regiondata) {
if (spacetype == SPACE_VIEW3D) {
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
rv3d->localvd = newdataadr(fd, rv3d->localvd);
rv3d->clipbb = newdataadr(fd, rv3d->clipbb);
@@ -7047,28 +7047,28 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
}
}
- ar->v2d.tab_offset = NULL;
- ar->v2d.tab_num = 0;
- ar->v2d.tab_cur = 0;
- ar->v2d.sms = NULL;
- ar->v2d.alpha_hor = ar->v2d.alpha_vert = 255; /* visible by default */
- BLI_listbase_clear(&ar->panels_category);
- BLI_listbase_clear(&ar->handlers);
- BLI_listbase_clear(&ar->uiblocks);
- ar->headerstr = NULL;
- ar->visible = 0;
- ar->type = NULL;
- ar->do_draw = 0;
- ar->gizmo_map = NULL;
- ar->regiontimer = NULL;
- ar->draw_buffer = NULL;
- memset(&ar->drawrct, 0, sizeof(ar->drawrct));
+ region->v2d.tab_offset = NULL;
+ region->v2d.tab_num = 0;
+ region->v2d.tab_cur = 0;
+ region->v2d.sms = NULL;
+ region->v2d.alpha_hor = region->v2d.alpha_vert = 255; /* visible by default */
+ BLI_listbase_clear(&region->panels_category);
+ BLI_listbase_clear(&region->handlers);
+ BLI_listbase_clear(&region->uiblocks);
+ region->headerstr = NULL;
+ region->visible = 0;
+ region->type = NULL;
+ region->do_draw = 0;
+ region->gizmo_map = NULL;
+ region->regiontimer = NULL;
+ region->draw_buffer = NULL;
+ memset(&region->drawrct, 0, sizeof(region->drawrct));
}
static void direct_link_area(FileData *fd, ScrArea *area)
{
SpaceLink *sl;
- ARegion *ar;
+ ARegion *region;
link_list(fd, &(area->spacedata));
link_list(fd, &(area->regionbase));
@@ -7094,8 +7094,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
area->spacetype = SPACE_EMPTY;
}
- for (ar = area->regionbase.first; ar; ar = ar->next) {
- direct_link_region(fd, ar, area->spacetype);
+ for (region = area->regionbase.first; region; region = region->next) {
+ direct_link_region(fd, region, area->spacetype);
}
/* accident can happen when read/save new file with older version */
@@ -7119,8 +7119,8 @@ static void direct_link_area(FileData *fd, ScrArea *area)
sl->spacetype = SPACE_EMPTY;
}
- for (ar = sl->regionbase.first; ar; ar = ar->next) {
- direct_link_region(fd, ar, sl->spacetype);
+ for (region = sl->regionbase.first; region; region = region->next) {
+ direct_link_region(fd, region, sl->spacetype);
}
if (sl->spacetype == SPACE_VIEW3D) {
@@ -7800,9 +7800,9 @@ static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene, View
/* Regionbase storage is different depending if the space is active. */
ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
&sl->regionbase;
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->localvd) {
MEM_freeN(rv3d->localvd);
rv3d->localvd = NULL;
@@ -7828,16 +7828,16 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map,
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
- ARegion *ar;
+ ARegion *region;
v3d->camera = restore_pointer_by_name(id_map, (ID *)v3d->camera, USER_REAL);
v3d->ob_centre = restore_pointer_by_name(id_map, (ID *)v3d->ob_centre, USER_REAL);
/* Free render engines for now. */
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d && rv3d->render_engine) {
RE_engine_free(rv3d->render_engine);
rv3d->render_engine = NULL;
@@ -8115,13 +8115,13 @@ void blo_lib_link_restore(Main *oldmain,
/* and as patch for 2.48 and older */
void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
{
- ARegion *ar;
+ ARegion *region;
- for (ar = regions->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW && ar->regiondata == NULL) {
+ for (region = regions->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW && region->regiondata == NULL) {
RegionView3D *rv3d;
- rv3d = ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch");
+ rv3d = region->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch");
rv3d->persp = (char)v3d->persp;
rv3d->view = (char)v3d->view;
rv3d->dist = v3d->dist;
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index cf4924eeb6d..6ff0f709361 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -90,119 +90,119 @@
/* 2.50 patch */
static void area_add_header_region(ScrArea *sa, ListBase *lb)
{
- ARegion *ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ ARegion *region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_HEADER;
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_HEADER;
if (sa->headertype == 1) {
- ar->alignment = RGN_ALIGN_BOTTOM;
+ region->alignment = RGN_ALIGN_BOTTOM;
}
else {
- ar->alignment = RGN_ALIGN_TOP;
+ region->alignment = RGN_ALIGN_TOP;
}
/* initialize view2d data for header region, to allow panning */
/* is copy from ui_view2d.c */
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
- ar->v2d.keepofs = V2D_LOCKOFS_Y;
- ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
- ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y;
- ar->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.keepofs = V2D_LOCKOFS_Y;
+ region->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ region->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y;
+ region->v2d.flag = (V2D_PIXELOFS_X | V2D_PIXELOFS_Y);
}
-static void sequencer_init_preview_region(ARegion *ar)
+static void sequencer_init_preview_region(ARegion *region)
{
// XXX a bit ugly still, copied from space_sequencer
/* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */
- ar->regiontype = RGN_TYPE_PREVIEW;
- ar->alignment = RGN_ALIGN_TOP;
- ar->flag |= RGN_FLAG_HIDDEN;
- ar->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM;
- ar->v2d.minzoom = 0.00001f;
- ar->v2d.maxzoom = 100000.0f;
- ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
- ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
- ar->v2d.tot.xmax = 960.0f;
- ar->v2d.tot.ymax = 540.0f;
- ar->v2d.min[0] = 0.0f;
- ar->v2d.min[1] = 0.0f;
- ar->v2d.max[0] = 12000.0f;
- ar->v2d.max[1] = 12000.0f;
- ar->v2d.cur = ar->v2d.tot;
- ar->v2d.align = V2D_ALIGN_FREE; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
- ar->v2d.keeptot = V2D_KEEPTOT_FREE;
+ region->regiontype = RGN_TYPE_PREVIEW;
+ region->alignment = RGN_ALIGN_TOP;
+ region->flag |= RGN_FLAG_HIDDEN;
+ region->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM;
+ region->v2d.minzoom = 0.00001f;
+ region->v2d.maxzoom = 100000.0f;
+ region->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+ region->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+ region->v2d.tot.xmax = 960.0f;
+ region->v2d.tot.ymax = 540.0f;
+ region->v2d.min[0] = 0.0f;
+ region->v2d.min[1] = 0.0f;
+ region->v2d.max[0] = 12000.0f;
+ region->v2d.max[1] = 12000.0f;
+ region->v2d.cur = region->v2d.tot;
+ region->v2d.align = V2D_ALIGN_FREE; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+ region->v2d.keeptot = V2D_KEEPTOT_FREE;
}
static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
{
- ARegion *ar;
+ ARegion *region;
ARegion *ar_main;
if (sl) {
/* first channels for ipo action nla... */
switch (sl->spacetype) {
case SPACE_GRAPH:
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
/* for some reason, this doesn't seem to go auto like for NLA... */
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->v2d.scroll = V2D_SCROLL_RIGHT;
- ar->v2d.flag = RGN_FLAG_HIDDEN;
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->v2d.scroll = V2D_SCROLL_RIGHT;
+ region->v2d.flag = RGN_FLAG_HIDDEN;
break;
case SPACE_ACTION:
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
break;
case SPACE_NLA:
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* for some reason, some files still don't get this auto */
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->v2d.scroll = V2D_SCROLL_RIGHT;
- ar->v2d.flag = RGN_FLAG_HIDDEN;
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->v2d.scroll = V2D_SCROLL_RIGHT;
+ region->v2d.flag = RGN_FLAG_HIDDEN;
break;
case SPACE_NODE:
- ar = MEM_callocN(sizeof(ARegion), "nodetree area for node");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region = MEM_callocN(sizeof(ARegion), "nodetree area for node");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* temporarily hide it */
- ar->flag = RGN_FLAG_HIDDEN;
+ region->flag = RGN_FLAG_HIDDEN;
break;
case SPACE_FILE:
- ar = MEM_callocN(sizeof(ARegion), "nodetree area for node");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
-
- ar = MEM_callocN(sizeof(ARegion), "ui area for file");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_TOP;
+ region = MEM_callocN(sizeof(ARegion), "nodetree area for node");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
+
+ region = MEM_callocN(sizeof(ARegion), "ui area for file");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_TOP;
break;
case SPACE_SEQ:
ar_main = (ARegion *)lb->first;
@@ -211,41 +211,41 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
break;
}
}
- ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
- BLI_insertlinkbefore(lb, ar_main, ar);
- sequencer_init_preview_region(ar);
+ region = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
+ BLI_insertlinkbefore(lb, ar_main, region);
+ sequencer_init_preview_region(region);
break;
case SPACE_VIEW3D:
/* toolbar */
- ar = MEM_callocN(sizeof(ARegion), "toolbar for view3d");
+ region = MEM_callocN(sizeof(ARegion), "toolbar for view3d");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->flag = RGN_FLAG_HIDDEN;
/* tool properties */
- ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
+ region = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_TOOL_PROPS;
- ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_TOOL_PROPS;
+ region->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
+ region->flag = RGN_FLAG_HIDDEN;
/* buttons/list view */
- ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
+ region = MEM_callocN(sizeof(ARegion), "buttons for view3d");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
#if 0
case SPACE_PROPERTIES:
/* context UI region */
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
break;
#endif
@@ -253,12 +253,12 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
}
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ region = MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->winrct = sa->totrct;
+ BLI_addtail(lb, region);
+ region->winrct = sa->totrct;
- ar->regiontype = RGN_TYPE_WINDOW;
+ region->regiontype = RGN_TYPE_WINDOW;
if (sl) {
/* if active spacetype has view2d data, copy that over to main region */
@@ -271,45 +271,45 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
case SPACE_OUTLINER: {
SpaceOutliner *soops = (SpaceOutliner *)sl;
- memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
+ memcpy(&region->v2d, &soops->v2d, sizeof(View2D));
- ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom |= (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
- // ar->v2d.flag |= V2D_IS_INITIALISED;
+ region->v2d.scroll &= ~V2D_SCROLL_LEFT;
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+ region->v2d.keepzoom |= (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
+ // region->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_GRAPH: {
SpaceGraph *sipo = (SpaceGraph *)sl;
- memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
+ memcpy(&region->v2d, &sipo->v2d, sizeof(View2D));
/* init mainarea view2d */
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
- ar->v2d.min[0] = FLT_MIN;
- ar->v2d.min[1] = FLT_MIN;
+ region->v2d.min[0] = FLT_MIN;
+ region->v2d.min[1] = FLT_MIN;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = FLT_MAX;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = FLT_MAX;
- // ar->v2d.flag |= V2D_IS_INITIALISED;
+ // region->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_NLA: {
SpaceNla *snla = (SpaceNla *)sl;
- memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
+ memcpy(&region->v2d, &snla->v2d, sizeof(View2D));
- ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
- ar->v2d.tot.ymax = 0.0f;
+ region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ region->v2d.tot.ymax = 0.0f;
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.align = V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.align = V2D_ALIGN_NO_POS_Y;
+ region->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
break;
}
case SPACE_ACTION: {
@@ -317,26 +317,26 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
/* We totally reinit the view for the Action Editor,
* as some old instances had some weird cruft set. */
- ar->v2d.tot.xmin = -20.0f;
- ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
- ar->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120);
- ar->v2d.tot.ymax = 0.0f;
+ region->v2d.tot.xmin = -20.0f;
+ region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ region->v2d.tot.xmax = (float)((sa->winx > 120) ? (sa->winx) : 120);
+ region->v2d.tot.ymax = 0.0f;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = 0.0f;
- ar->v2d.min[1] = 0.0f;
+ region->v2d.min[0] = 0.0f;
+ region->v2d.min[1] = 0.0f;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = FLT_MAX;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = FLT_MAX;
- ar->v2d.minzoom = 0.01f;
- ar->v2d.maxzoom = 50;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
- ar->v2d.align = V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.minzoom = 0.01f;
+ region->v2d.maxzoom = 50;
+ region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.keepzoom = V2D_LOCKZOOM_Y;
+ region->v2d.align = V2D_ALIGN_NO_POS_Y;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* for old files with ShapeKey editors open + an action set, clear the action as
* it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
@@ -349,39 +349,39 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
}
case SPACE_SEQ: {
SpaceSeq *sseq = (SpaceSeq *)sl;
- memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
+ memcpy(&region->v2d, &sseq->v2d, sizeof(View2D));
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
- ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
- ar->v2d.flag |= V2D_IS_INITIALISED;
+ region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_VERTICAL_HANDLES);
+ region->v2d.align = V2D_ALIGN_NO_NEG_Y;
+ region->v2d.flag |= V2D_IS_INITIALISED;
break;
}
case SPACE_NODE: {
SpaceNode *snode = (SpaceNode *)sl;
- memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
+ memcpy(&region->v2d, &snode->v2d, sizeof(View2D));
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
break;
}
case SPACE_PROPERTIES: {
SpaceProperties *sbuts = (SpaceProperties *)sl;
- memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
+ memcpy(&region->v2d, &sbuts->v2d, sizeof(View2D));
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
break;
}
case SPACE_FILE: {
// SpaceFile *sfile = (SpaceFile *)sl;
- ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0;
- ar->v2d.tot.xmax = ar->winx;
- ar->v2d.tot.ymax = ar->winy;
- ar->v2d.cur = ar->v2d.tot;
- ar->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.tot.xmin = region->v2d.tot.ymin = 0;
+ region->v2d.tot.xmax = region->winx;
+ region->v2d.tot.ymax = region->winy;
+ region->v2d.cur = region->v2d.tot;
+ region->regiontype = RGN_TYPE_WINDOW;
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
break;
}
case SPACE_TEXT: {
@@ -389,7 +389,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
st->flags |= ST_FIND_WRAP;
}
// case SPACE_XXX: // FIXME... add other ones
- // memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
+ // memcpy(&region->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
// break;
}
}
@@ -1196,7 +1196,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype != SPACE_SEQ) {
- ARegion *ar;
+ ARegion *region;
ListBase *regionbase;
if (sl == sa->spacedata.first) {
@@ -1206,16 +1206,16 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
regionbase = &sl->regionbase;
}
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
break;
}
}
- if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
+ if (region && (region->regiontype == RGN_TYPE_PREVIEW)) {
SpaceType *st = BKE_spacetype_from_id(SPACE_SEQ);
- BKE_area_region_free(st, ar);
- BLI_freelinkN(regionbase, ar);
+ BKE_area_region_free(st, region);
+ BLI_freelinkN(regionbase, region);
}
}
}
@@ -1234,7 +1234,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_SEQ) {
- ARegion *ar;
+ ARegion *region;
ARegion *ar_main;
ListBase *regionbase;
SpaceSeq *sseq = (SpaceSeq *)sl;
@@ -1259,9 +1259,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
break;
}
}
- ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
- BLI_insertlinkbefore(regionbase, ar_main, ar);
- sequencer_init_preview_region(ar);
+ region = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
+ BLI_insertlinkbefore(regionbase, ar_main, region);
+ sequencer_init_preview_region(region);
}
}
}
@@ -1367,7 +1367,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase;
- ARegion *ar;
+ ARegion *region;
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
@@ -1377,10 +1377,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
}
if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
- for (ar = (ARegion *)regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
- ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ for (region = (ARegion *)regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ region->v2d.cur.ymax = region->v2d.tot.ymax = 0.0f;
+ region->v2d.cur.ymin = region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
}
}
}
@@ -1582,7 +1582,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if (sl->spacetype == SPACE_NODE) {
SpaceNode *snode = (SpaceNode *)sl;
ListBase *regionbase;
- ARegion *ar;
+ ARegion *region;
if (sl == sa->spacedata.first) {
regionbase = &sa->regionbase;
@@ -1598,13 +1598,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
snode->v2d.maxzoom = 2.31f;
}
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->v2d.minzoom > 0.09f) {
- ar->v2d.minzoom = 0.09f;
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ if (region->v2d.minzoom > 0.09f) {
+ region->v2d.minzoom = 0.09f;
}
- if (ar->v2d.maxzoom < 2.31f) {
- ar->v2d.maxzoom = 2.31f;
+ if (region->v2d.maxzoom < 2.31f) {
+ region->v2d.maxzoom = 2.31f;
}
}
}
@@ -1857,19 +1857,20 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_INFO) {
SpaceInfo *sinfo = (SpaceInfo *)sl;
- ARegion *ar;
+ ARegion *region;
sinfo->rpt_mask = INFO_RPT_OP;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- ar->v2d.scroll = (V2D_SCROLL_RIGHT);
- ar->v2d.align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
- ar->v2d.keepofs = V2D_LOCKOFS_X;
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM |
- V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ region->v2d.scroll = (V2D_SCROLL_RIGHT);
+ region->v2d.align = V2D_ALIGN_NO_NEG_X |
+ V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ region->v2d.keepofs = V2D_LOCKOFS_X;
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM |
+ V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
}
}
}
@@ -2121,10 +2122,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sa = screen->areabase.first; sa; sa = sa->next) {
SpaceLink *sl = sa->spacedata.first;
if (sl->spacetype == SPACE_IMAGE) {
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- View2D *v2d = &ar->v2d;
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ View2D *v2d = &region->v2d;
v2d->minzoom = v2d->maxzoom = v2d->scroll = v2d->keeptot = v2d->keepzoom =
v2d->keepofs = v2d->align = 0;
}
@@ -2133,10 +2134,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMAGE) {
- ARegion *ar;
- for (ar = sl->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- View2D *v2d = &ar->v2d;
+ ARegion *region;
+ for (region = sl->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ View2D *v2d = &region->v2d;
v2d->minzoom = v2d->maxzoom = v2d->scroll = v2d->keeptot = v2d->keepzoom =
v2d->keepofs = v2d->align = 0;
}
@@ -2179,22 +2180,22 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (sa = screen->areabase.first; sa; sa = sa->next) {
SpaceLink *sl = sa->spacedata.first;
if (sl->spacetype == SPACE_SEQ) {
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->v2d.min[1] == 4.0f) {
- ar->v2d.min[1] = 0.5f;
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ if (region->v2d.min[1] == 4.0f) {
+ region->v2d.min[1] = 0.5f;
}
}
}
}
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_SEQ) {
- ARegion *ar;
- for (ar = sl->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->v2d.min[1] == 4.0f) {
- ar->v2d.min[1] = 0.5f;
+ ARegion *region;
+ for (region = sl->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ if (region->v2d.min[1] == 4.0f) {
+ region->v2d.min[1] = 0.5f;
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c
index 7c70728e50c..8a55ccf78b9 100644
--- a/source/blender/blenloader/intern/versioning_260.c
+++ b/source/blender/blenloader/intern/versioning_260.c
@@ -1198,15 +1198,15 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_CLIP) {
SpaceClip *sclip = (SpaceClip *)sl;
- ARegion *ar;
+ ARegion *region;
bool hide = false;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
- if (ar->alignment != RGN_ALIGN_NONE) {
- ar->flag |= RGN_FLAG_HIDDEN;
- ar->v2d.flag &= ~V2D_IS_INITIALISED;
- ar->alignment = RGN_ALIGN_NONE;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
+ if (region->alignment != RGN_ALIGN_NONE) {
+ region->flag |= RGN_FLAG_HIDDEN;
+ region->v2d.flag &= ~V2D_IS_INITIALISED;
+ region->alignment = RGN_ALIGN_NONE;
hide = true;
}
@@ -2263,26 +2263,26 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* add missing (+) expander in node editor */
for (sc = bmain->screens.first; sc; sc = sc->id.next) {
for (sa = sc->areabase.first; sa; sa = sa->next) {
- ARegion *ar, *arnew;
+ ARegion *region, *arnew;
if (sa->spacetype == SPACE_NODE) {
- ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
- if (ar) {
+ if (region) {
continue;
}
/* add subdiv level; after header */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar == NULL) {
+ if (region == NULL) {
continue;
}
arnew = MEM_callocN(sizeof(ARegion), "node tools");
- BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ BLI_insertlinkafter(&sa->regionbase, region, arnew);
arnew->regiontype = RGN_TYPE_TOOLS;
arnew->alignment = RGN_ALIGN_LEFT;
@@ -2551,7 +2551,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (space_link = sa->spacedata.first; space_link; space_link = space_link->next) {
if (space_link->spacetype == SPACE_IMAGE) {
- ARegion *ar;
+ ARegion *region;
ListBase *lb;
if (space_link == sa->spacedata.first) {
@@ -2561,13 +2561,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
lb = &space_link->regionbase;
}
- for (ar = lb->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
+ for (region = lb->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
}
- else if (ar->regiontype == RGN_TYPE_UI) {
- ar->alignment = RGN_ALIGN_RIGHT;
+ else if (region->regiontype == RGN_TYPE_UI) {
+ region->alignment = RGN_ALIGN_RIGHT;
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index f421f31814c..df946168056 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -233,18 +233,18 @@ static void do_version_constraints_stretch_to_limits(ListBase *lb)
static void do_version_action_editor_properties_region(ListBase *regionbase)
{
- ARegion *ar;
+ ARegion *region;
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_UI) {
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_UI) {
/* already exists */
return;
}
- else if (ar->regiontype == RGN_TYPE_WINDOW) {
+ else if (region->regiontype == RGN_TYPE_WINDOW) {
/* add new region here */
ARegion *arnew = MEM_callocN(sizeof(ARegion), "buttons for action");
- BLI_insertlinkbefore(regionbase, ar, arnew);
+ BLI_insertlinkbefore(regionbase, region, arnew);
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_RIGHT;
@@ -527,11 +527,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
- ARegion *ar;
+ ARegion *region;
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- for (ar = lb->first; ar; ar = ar->next) {
- BLI_listbase_clear(&ar->ui_previews);
+ for (region = lb->first; region; region = region->next) {
+ BLI_listbase_clear(&region->ui_previews);
}
}
}
@@ -855,18 +855,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
bScreen *scr;
ScrArea *sa;
SpaceLink *sl;
- ARegion *ar;
+ ARegion *region;
/* Make sure sequencer preview area limits zoom */
for (scr = bmain->screens.first; scr; scr = scr->id.next) {
for (sa = scr->areabase.first; sa; sa = sa->next) {
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_SEQ) {
- for (ar = sl->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
- ar->v2d.keepzoom |= V2D_LIMITZOOM;
- ar->v2d.minzoom = 0.001f;
- ar->v2d.maxzoom = 1000.0f;
+ for (region = sl->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
+ region->v2d.keepzoom |= V2D_LIMITZOOM;
+ region->v2d.minzoom = 0.001f;
+ region->v2d.maxzoom = 1000.0f;
break;
}
}
@@ -1069,12 +1069,12 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
- ARegion *ar;
+ ARegion *region;
ListBase *lb = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- for (ar = lb->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->regiondata) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = lb->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiondata) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->view == RV3D_VIEW_PERSPORTHO) {
rv3d->view = RV3D_VIEW_USER;
}
@@ -1256,11 +1256,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (sl->spacetype == SPACE_SEQ) {
SpaceSeq *sseq = (SpaceSeq *)sl;
if (sseq->view == SEQ_VIEW_SEQUENCE) {
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
+ for (ARegion *region = regionbase->first; region; region = region->next) {
/* remove preview region for sequencer-only view! */
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
- ar->flag |= RGN_FLAG_HIDDEN;
- ar->alignment = RGN_ALIGN_NONE;
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
+ region->flag |= RGN_FLAG_HIDDEN;
+ region->alignment = RGN_ALIGN_NONE;
break;
}
}
@@ -1268,11 +1268,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* Remove old deprecated region from filebrowsers */
else if (sl->spacetype == SPACE_FILE) {
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_CHANNELS) {
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_CHANNELS) {
/* Free old deprecated 'channel' region... */
- BKE_area_region_free(NULL, ar);
- BLI_freelinkN(regionbase, ar);
+ BKE_area_region_free(NULL, region);
+ BLI_freelinkN(regionbase, region);
break;
}
}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 300880a5839..e29c4f8658f 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -595,27 +595,27 @@ static void do_versions_fix_annotations(bGPdata *gpd)
}
}
-static void do_versions_remove_region(ListBase *regionbase, ARegion *ar)
+static void do_versions_remove_region(ListBase *regionbase, ARegion *region)
{
- BLI_freelinkN(regionbase, ar);
+ BLI_freelinkN(regionbase, region);
}
static void do_versions_remove_regions_by_type(ListBase *regionbase, int regiontype)
{
- ARegion *ar, *ar_next;
- for (ar = regionbase->first; ar; ar = ar_next) {
- ar_next = ar->next;
- if (ar->regiontype == regiontype) {
- do_versions_remove_region(regionbase, ar);
+ ARegion *region, *ar_next;
+ for (region = regionbase->first; region; region = ar_next) {
+ ar_next = region->next;
+ if (region->regiontype == regiontype) {
+ do_versions_remove_region(regionbase, region);
}
}
}
static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype)
{
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == regiontype) {
- return ar;
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == regiontype) {
+ return region;
}
}
return NULL;
@@ -623,18 +623,18 @@ static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int region
static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype)
{
- ARegion *ar = do_versions_find_region_or_null(regionbase, regiontype);
- if (ar == NULL) {
+ ARegion *region = do_versions_find_region_or_null(regionbase, regiontype);
+ if (region == NULL) {
BLI_assert(!"Did not find expected region in versioning");
}
- return ar;
+ return region;
}
static ARegion *do_versions_add_region(int regiontype, const char *name)
{
- ARegion *ar = MEM_callocN(sizeof(ARegion), name);
- ar->regiontype = regiontype;
- return ar;
+ ARegion *region = MEM_callocN(sizeof(ARegion), name);
+ region->regiontype = regiontype;
+ return region;
}
static void do_versions_area_ensure_tool_region(Main *bmain,
@@ -646,13 +646,13 @@ static void do_versions_area_ensure_tool_region(Main *bmain,
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == space_type) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
- if (!ar) {
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
+ if (!region) {
ARegion *header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
- ar = do_versions_add_region(RGN_TYPE_TOOLS, "tools region");
- BLI_insertlinkafter(regionbase, header, ar);
- ar->alignment = RGN_ALIGN_LEFT;
- ar->flag = region_flag;
+ region = do_versions_add_region(RGN_TYPE_TOOLS, "tools region");
+ BLI_insertlinkafter(regionbase, header, region);
+ region->alignment = RGN_ALIGN_LEFT;
+ region->flag = region_flag;
}
}
}
@@ -2899,9 +2899,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
* fine to always insert headers first. */
BLI_assert(!do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER));
- ARegion *ar = do_versions_add_region(RGN_TYPE_HEADER, "header 2.83.1 versioning");
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
- BLI_addhead(regionbase, ar);
+ ARegion *region = do_versions_add_region(RGN_TYPE_HEADER,
+ "header 2.83.1 versioning");
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM :
+ RGN_ALIGN_TOP;
+ BLI_addhead(regionbase, region);
}
}
}
@@ -2913,7 +2915,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_PROPERTIES) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- ARegion *ar = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
+ ARegion *region = MEM_callocN(sizeof(ARegion), "navigation bar for properties");
ARegion *ar_header = NULL;
for (ar_header = regionbase->first; ar_header; ar_header = ar_header->next) {
@@ -2923,10 +2925,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
BLI_assert(ar_header);
- BLI_insertlinkafter(regionbase, ar_header, ar);
+ BLI_insertlinkafter(regionbase, ar_header, region);
- ar->regiontype = RGN_TYPE_NAV_BAR;
- ar->alignment = RGN_ALIGN_LEFT;
+ region->regiontype = RGN_TYPE_NAV_BAR;
+ region->alignment = RGN_ALIGN_LEFT;
}
}
}
@@ -3698,11 +3700,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
do_versions_remove_regions_by_type(regionbase, RGN_TYPE_FOOTER);
/* Add footer. */
- ARegion *ar = do_versions_add_region(RGN_TYPE_FOOTER, "footer for text");
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
+ ARegion *region = do_versions_add_region(RGN_TYPE_FOOTER, "footer for text");
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER);
- BLI_insertlinkafter(regionbase, ar_header, ar);
+ BLI_insertlinkafter(regionbase, ar_header, region);
}
}
}
@@ -3788,20 +3790,22 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
/* All spaces that use tools must be eventually added. */
- ARegion *ar = NULL;
+ ARegion *region = NULL;
if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_SEQ) &&
- ((ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER)) == NULL)) {
+ ((region = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER)) ==
+ NULL)) {
/* Add tool header. */
- ar = do_versions_add_region(RGN_TYPE_TOOL_HEADER, "tool header");
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ region = do_versions_add_region(RGN_TYPE_TOOL_HEADER, "tool header");
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER);
- BLI_insertlinkbefore(regionbase, ar_header, ar);
+ BLI_insertlinkbefore(regionbase, ar_header, region);
/* Hide by default, enable for painting workspaces (startup only). */
- ar->flag |= RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
+ region->flag |= RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
}
- if (ar != NULL) {
- SET_FLAG_FROM_TEST(ar->flag, ar->flag & RGN_FLAG_HIDDEN_BY_USER, RGN_FLAG_HIDDEN);
+ if (region != NULL) {
+ SET_FLAG_FROM_TEST(
+ region->flag, region->flag & RGN_FLAG_HIDDEN_BY_USER, RGN_FLAG_HIDDEN);
}
}
}
@@ -3898,19 +3902,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (ELEM(sl->spacetype, SPACE_CLIP, SPACE_GRAPH, SPACE_SEQ)) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- ARegion *ar = NULL;
+ ARegion *region = NULL;
if (sl->spacetype == SPACE_CLIP) {
if (((SpaceClip *)sl)->view == SC_VIEW_GRAPH) {
- ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_PREVIEW);
+ region = do_versions_find_region_or_null(regionbase, RGN_TYPE_PREVIEW);
}
}
else {
- ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_WINDOW);
+ region = do_versions_find_region_or_null(regionbase, RGN_TYPE_WINDOW);
}
- if (ar != NULL) {
- ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
- ar->v2d.scroll |= V2D_SCROLL_RIGHT;
+ if (region != NULL) {
+ region->v2d.scroll &= ~V2D_SCROLL_LEFT;
+ region->v2d.scroll |= V2D_SCROLL_RIGHT;
}
}
}
@@ -4049,9 +4053,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_TEXT) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- ARegion *ar = do_versions_find_region_or_null(regionbase, RGN_TYPE_UI);
- if (ar) {
- ar->alignment = RGN_ALIGN_RIGHT;
+ ARegion *region = do_versions_find_region_or_null(regionbase, RGN_TYPE_UI);
+ if (region) {
+ region->alignment = RGN_ALIGN_RIGHT;
}
}
/* Mark outliners as dirty for syncing and enable synced selection */
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 6d074661dcc..00276f9c4a9 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -101,11 +101,11 @@ static void blo_update_defaults_screen(bScreen *screen,
{
/* For all app templates. */
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
/* Some toolbars have been saved as initialized,
* we don't want them to have odd zoom-level or scrolling set, see: T47047 */
- if (ELEM(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
- ar->v2d.flag &= ~V2D_IS_INITIALISED;
+ if (ELEM(region->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
+ region->v2d.flag &= ~V2D_IS_INITIALISED;
}
}
@@ -130,15 +130,15 @@ static void blo_update_defaults_screen(bScreen *screen,
}
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
/* Remove all stored panels, we want to use defaults
* (order, open/closed) as defined by UI code here! */
- BKE_area_region_panels_free(&ar->panels);
- BLI_freelistN(&ar->panels_category_active);
+ BKE_area_region_panels_free(&region->panels);
+ BLI_freelistN(&region->panels_category_active);
/* Reset size so it uses consistent defaults from the region types. */
- ar->sizex = 0;
- ar->sizey = 0;
+ region->sizex = 0;
+ region->sizey = 0;
}
if (sa->spacetype == SPACE_IMAGE) {
@@ -156,9 +156,9 @@ static void blo_update_defaults_screen(bScreen *screen,
if (saction->mode == SACTCONT_TIMELINE) {
saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_CHANNELS) {
- ar->flag |= RGN_FLAG_HIDDEN;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_CHANNELS) {
+ region->flag |= RGN_FLAG_HIDDEN;
}
}
}
@@ -213,13 +213,13 @@ static void blo_update_defaults_screen(bScreen *screen,
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
if ((sl->spacetype == SPACE_IMAGE) && hide_image_tool_header) {
- ar->flag |= RGN_FLAG_HIDDEN;
+ region->flag |= RGN_FLAG_HIDDEN;
}
else {
- ar->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
+ region->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
}
}
}
@@ -229,7 +229,7 @@ static void blo_update_defaults_screen(bScreen *screen,
/* 2D animation template. */
if (app_template && STREQ(app_template, "2D_Animation")) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
if (sa->spacetype == SPACE_ACTION) {
SpaceAction *saction = sa->spacedata.first;
/* Enable Sliders. */
@@ -266,7 +266,7 @@ void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_templat
bScreen *screen = layout->screen;
if (screen) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
if (sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
v3d->shading.flag &= ~V3D_SHADING_CAVITY;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 88fc6a2a930..0c9363043ee 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2756,19 +2756,19 @@ static void write_gpencil(WriteData *wd, bGPdata *gpd)
}
}
-static void write_region(WriteData *wd, ARegion *ar, int spacetype)
+static void write_region(WriteData *wd, ARegion *region, int spacetype)
{
- writestruct(wd, DATA, ARegion, 1, ar);
+ writestruct(wd, DATA, ARegion, 1, region);
- if (ar->regiondata) {
- if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
+ if (region->regiondata) {
+ if (region->flag & RGN_FLAG_TEMP_REGIONDATA) {
return;
}
switch (spacetype) {
case SPACE_VIEW3D:
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
writestruct(wd, DATA, RegionView3D, 1, rv3d);
if (rv3d->localvd) {
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 2462603632f..c6aedd40afb 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -63,7 +63,7 @@ typedef struct DRWUpdateContext {
struct Depsgraph *depsgraph;
struct Scene *scene;
struct ViewLayer *view_layer;
- struct ARegion *ar;
+ struct ARegion *region;
struct View3D *v3d;
struct RenderEngineType *engine_type;
} DRWUpdateContext;
@@ -81,24 +81,24 @@ void DRW_draw_region_engine_info(int xoffset, int yoffset);
void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
struct RenderEngineType *engine_type,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
struct GPUViewport *viewport,
const struct bContext *evil_C);
void DRW_draw_render_loop(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
struct GPUViewport *viewport);
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
struct RenderEngineType *engine_type,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const bool draw_background,
const bool do_color_management,
struct GPUOffScreen *ofs,
struct GPUViewport *viewport);
void DRW_draw_select_loop(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
bool use_obedit_skip,
bool draw_surface,
@@ -109,20 +109,20 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
DRW_ObjectFilterFn object_filter_fn,
void *object_filter_user_data);
void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
struct GPUViewport *viewport,
bool use_opengl_context);
void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
struct GPUViewport *viewport);
-void DRW_draw_depth_object(struct ARegion *ar,
+void DRW_draw_depth_object(struct ARegion *region,
struct View3D *v3d,
struct GPUViewport *viewport,
struct Object *object);
void DRW_draw_select_id(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const struct rcti *rect);
diff --git a/source/blender/draw/DRW_select_buffer.h b/source/blender/draw/DRW_select_buffer.h
index 0ad13af81ba..6ebc30d0382 100644
--- a/source/blender/draw/DRW_select_buffer.h
+++ b/source/blender/draw/DRW_select_buffer.h
@@ -90,34 +90,34 @@ uint DRW_select_buffer_context_offset_for_object_elem(struct Depsgraph *depsgrap
struct Object *object,
char elem_type);
uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const rcti *rect,
uint *r_buf_len);
uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const struct rcti *rect,
uint *r_bitmap_len);
uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int center[2],
const int radius,
uint *r_bitmap_len);
uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int poly[][2],
const int poly_len,
const struct rcti *rect,
uint *r_bitmap_len);
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int center[2]);
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int center[2],
const uint id_min,
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index b5ec5ce21a9..7be6fc2d030 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -88,7 +88,7 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
rect = &fallback_rect;
}
else {
- rect = ED_region_visible_rect(draw_ctx->ar);
+ rect = ED_region_visible_rect(draw_ctx->region);
}
/* Make the viewport width scale the lookdev spheres a bit.
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index fc5af62d45f..80c38839b71 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -48,7 +48,7 @@ static struct {
extern char datatoc_effect_motion_blur_frag_glsl[];
static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene,
- ARegion *ar,
+ ARegion *region,
RegionView3D *rv3d,
View3D *v3d,
Object *camera,
@@ -83,7 +83,7 @@ static void eevee_motion_blur_camera_get_matrix_at_time(Scene *scene,
if (v3d != NULL) {
BKE_camera_params_from_view3d(&params, draw_ctx->depsgraph, v3d, rv3d);
- BKE_camera_params_compute_viewplane(&params, ar->winx, ar->winy, 1.0f, 1.0f);
+ BKE_camera_params_compute_viewplane(&params, region->winx, region->winy, 1.0f, 1.0f);
}
else {
BKE_camera_params_from_object(&params, &cam_cpy);
@@ -115,7 +115,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
View3D *v3d = draw_ctx->v3d;
RegionView3D *rv3d = draw_ctx->rv3d;
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
if (scene_eval->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) {
/* Update Motion Blur Matrices */
@@ -151,7 +151,7 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
/* Current matrix */
if (effects->motion_blur_mat_cached == false) {
eevee_motion_blur_camera_get_matrix_at_time(
- scene, ar, rv3d, v3d, ob_camera_eval, ctime, effects->current_world_to_ndc);
+ scene, region, rv3d, v3d, ob_camera_eval, ctime, effects->current_world_to_ndc);
}
/* Only continue if camera is not being keyed */
@@ -160,12 +160,12 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
/* Past matrix */
if (effects->motion_blur_mat_cached == false) {
eevee_motion_blur_camera_get_matrix_at_time(
- scene, ar, rv3d, v3d, ob_camera_eval, ctime - delta, effects->past_world_to_ndc);
+ scene, region, rv3d, v3d, ob_camera_eval, ctime - delta, effects->past_world_to_ndc);
#if 0 /* for future high quality blur */
/* Future matrix */
eevee_motion_blur_camera_get_matrix_at_time(
- scene, ar, rv3d, v3d, ob_camera_eval, ctime + delta, effects->future_world_to_ndc);
+ scene, region, rv3d, v3d, ob_camera_eval, ctime + delta, effects->future_world_to_ndc);
#endif
invert_m4_m4(effects->current_ndc_to_world, effects->current_world_to_ndc);
}
diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c
index ac3e5550030..bef49efd3f9 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -100,7 +100,7 @@ static void external_engine_init(void *vedata)
{
EXTERNAL_StorageList *stl = ((EXTERNAL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
/* Depth prepass */
if (!e_data.depth_sh) {
@@ -117,7 +117,7 @@ static void external_engine_init(void *vedata)
/* Progressive render samples are tagged with no rebuild, in that case we
* can skip updating the depth buffer */
- if (ar && (ar->do_draw & RGN_DRAW_NO_REBUILD)) {
+ if (region && (region->do_draw & RGN_DRAW_NO_REBUILD)) {
stl->g_data->update_depth = false;
}
}
@@ -182,7 +182,7 @@ static void external_draw_scene_do(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
RegionView3D *rv3d = draw_ctx->rv3d;
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
RenderEngineType *type;
DRW_state_reset_ex(DRW_STATE_DEFAULT & ~DRW_STATE_DEPTH_LESS_EQUAL);
@@ -205,7 +205,7 @@ static void external_draw_scene_do(void *vedata)
/* Rendered draw. */
GPU_matrix_push_projection();
GPU_matrix_push();
- ED_region_pixelspace(ar);
+ ED_region_pixelspace(region);
/* Render result draw. */
type = rv3d->render_engine->type;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 51a63a00c24..a2016b9c1e6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -379,7 +379,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
RegionView3D *rv3d = draw_ctx->rv3d;
ToolSettings *ts = scene->toolsettings;
Object *ob = draw_ctx->obact;
@@ -413,13 +413,13 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
for (int i = 0; i < totpoints; i++, tpt++) {
- ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
+ ED_gpencil_tpoint_to_point(region, origin, tpt, &pt);
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt);
/* first point for adjacency (not drawn) */
if (i == 0) {
if (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC && totpoints > 2) {
- ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 1], &pt2);
+ ED_gpencil_tpoint_to_point(region, origin, &points[totpoints - 1], &pt2);
gpencil_set_stroke_point(vbo,
&pt2,
idx,
@@ -432,7 +432,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
idx++;
}
else {
- ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt2);
+ ED_gpencil_tpoint_to_point(region, origin, &points[1], &pt2);
gpencil_set_stroke_point(vbo,
&pt2,
idx,
@@ -455,19 +455,19 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
/* last adjacency point (not drawn) */
if (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC && totpoints > 2) {
/* draw line to first point to complete the cycle */
- ED_gpencil_tpoint_to_point(ar, origin, &points[0], &pt2);
+ ED_gpencil_tpoint_to_point(region, origin, &points[0], &pt2);
gpencil_set_stroke_point(
vbo, &pt2, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
idx++;
/* now add adjacency point (not drawn) */
- ED_gpencil_tpoint_to_point(ar, origin, &points[1], &pt3);
+ ED_gpencil_tpoint_to_point(region, origin, &points[1], &pt3);
gpencil_set_stroke_point(
vbo, &pt3, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
idx++;
}
/* last adjacency point (not drawn) */
else {
- ED_gpencil_tpoint_to_point(ar, origin, &points[totpoints - 2], &pt2);
+ ED_gpencil_tpoint_to_point(region, origin, &points[totpoints - 2], &pt2);
gpencil_set_stroke_point(
vbo, &pt2, idx, pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
idx++;
@@ -481,7 +481,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
RegionView3D *rv3d = draw_ctx->rv3d;
ToolSettings *ts = scene->toolsettings;
Object *ob = draw_ctx->obact;
@@ -513,7 +513,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, origin);
for (int i = 0; i < totpoints; i++, tpt++) {
- ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
+ ED_gpencil_tpoint_to_point(region, origin, tpt, &pt);
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt);
/* use previous point to determine stroke direction (drawing path) */
@@ -524,7 +524,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
if (totpoints > 1) {
/* extrapolate a point before first point */
tGPspoint *tpt2 = &points[1];
- ED_gpencil_tpoint_to_point(ar, origin, tpt2, &pt2);
+ ED_gpencil_tpoint_to_point(region, origin, tpt2, &pt2);
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt2);
interp_v3_v3v3(ref_pt, &pt2.x, &pt.x, 1.5f);
@@ -535,7 +535,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
}
else {
tGPspoint *tpt2 = &points[i - 1];
- ED_gpencil_tpoint_to_point(ar, origin, tpt2, &pt2);
+ ED_gpencil_tpoint_to_point(region, origin, tpt2, &pt2);
ED_gp_project_point_to_plane(scene, ob, rv3d, origin, ts->gp_sculpt.lock_axis - 1, &pt2);
copy_v3_v3(ref_pt, &pt2.x);
@@ -638,7 +638,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
ToolSettings *ts = scene->toolsettings;
Object *ob = draw_ctx->obact;
@@ -684,7 +684,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
for (int i = 0; i < tot_triangles; i++) {
for (int j = 0; j < 3; j++) {
tpt = &points[tmp_triangles[i][j]];
- ED_gpencil_tpoint_to_point(ar, origin, tpt, &pt);
+ ED_gpencil_tpoint_to_point(region, origin, tpt, &pt);
GPU_vertbuf_attr_set(vbo, pos_id, idx, &pt.x);
GPU_vertbuf_attr_set(vbo, color_id, idx, gpd->runtime.sfill);
idx++;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index fc5f04e658d..96560d986a0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -739,7 +739,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&gpd->id);
if ((draw_ctx->obact == ob) &&
- ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->ar))) {
+ ((gpd_orig->runtime.ar == NULL) || (gpd_orig->runtime.ar == draw_ctx->region))) {
gpencil_populate_buffer_strokes(&e_data, vedata, ts, ob);
}
diff --git a/source/blender/draw/engines/overlay/overlay_edit_mesh.c b/source/blender/draw/engines/overlay/overlay_edit_mesh.c
index ee1b606bee5..6c838568260 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_mesh.c
+++ b/source/blender/draw/engines/overlay/overlay_edit_mesh.c
@@ -333,7 +333,7 @@ void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob)
if (DRW_state_show_text() && (pd->edit_mesh.flag & OVERLAY_EDIT_TEXT)) {
const DRWContextState *draw_ctx = DRW_context_state_get();
- DRW_text_edit_mesh_measure_stats(draw_ctx->ar, draw_ctx->v3d, ob, &draw_ctx->scene->unit);
+ DRW_text_edit_mesh_measure_stats(draw_ctx->region, draw_ctx->v3d, ob, &draw_ctx->scene->unit);
}
}
diff --git a/source/blender/draw/engines/select/select_engine.c b/source/blender/draw/engines/select/select_engine.c
index f56482235b3..389133b0d84 100644
--- a/source/blender/draw/engines/select/select_engine.c
+++ b/source/blender/draw/engines/select/select_engine.c
@@ -136,7 +136,7 @@ static void select_engine_init(void *vedata)
DRW_view_viewmat_get(view_default, viewmat, false);
DRW_view_winmat_get(view_default, winmat, false);
projmat_from_subregion(winmat,
- (int[2]){draw_ctx->ar->winx, draw_ctx->ar->winy},
+ (int[2]){draw_ctx->region->winx, draw_ctx->region->winy},
e_data.context.last_rect.xmin,
e_data.context.last_rect.xmax,
e_data.context.last_rect.ymin,
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 4f7554006cb..fc7ca6c7d67 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -634,7 +634,7 @@ bool DRW_state_draw_background(void);
/* Avoid too many lookups while drawing */
typedef struct DRWContextState {
- struct ARegion *ar; /* 'CTX_wm_region(C)' */
+ struct ARegion *region; /* 'CTX_wm_region(C)' */
struct RegionView3D *rv3d; /* 'CTX_wm_region_view3d(C)' */
struct View3D *v3d; /* 'CTX_wm_view3d(C)' */
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index cd9420feb77..4ec49536211 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1061,7 +1061,7 @@ static void drw_engines_draw_text(void)
PROFILE_START(stime);
if (data->text_draw_cache) {
- DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar, DST.draw_ctx.v3d);
+ DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.region, DST.draw_ctx.v3d);
}
PROFILE_END_UPDATE(data->render_time, stime);
@@ -1226,9 +1226,9 @@ static bool drw_gpencil_engine_needed(Depsgraph *depsgraph, View3D *v3d)
void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
{
RenderEngineType *engine_type = update_ctx->engine_type;
- ARegion *ar = update_ctx->ar;
+ ARegion *region = update_ctx->region;
View3D *v3d = update_ctx->v3d;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
Depsgraph *depsgraph = update_ctx->depsgraph;
Scene *scene = update_ctx->scene;
ViewLayer *view_layer = update_ctx->view_layer;
@@ -1237,7 +1237,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
/* Separate update for each stereo view. */
for (int view = 0; view < 2; view++) {
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, view);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, view);
if (!viewport) {
continue;
}
@@ -1252,7 +1252,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
DST.viewport = viewport;
DST.draw_ctx = (DRWContextState){
- .ar = ar,
+ .region = region,
.rv3d = rv3d,
.v3d = v3d,
.scene = scene,
@@ -1297,7 +1297,7 @@ void DRW_draw_callbacks_pre_scene(void)
GPU_matrix_set(rv3d->viewmat);
if (DST.draw_ctx.evil_C) {
- ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_PRE_VIEW);
DRW_state_reset();
}
}
@@ -1305,7 +1305,7 @@ void DRW_draw_callbacks_pre_scene(void)
void DRW_draw_callbacks_post_scene(void)
{
RegionView3D *rv3d = DST.draw_ctx.rv3d;
- ARegion *ar = DST.draw_ctx.ar;
+ ARegion *region = DST.draw_ctx.region;
View3D *v3d = DST.draw_ctx.v3d;
Depsgraph *depsgraph = DST.draw_ctx.depsgraph;
@@ -1330,14 +1330,14 @@ void DRW_draw_callbacks_post_scene(void)
if (do_annotations) {
GPU_depth_test(false);
/* XXX: as scene->gpd is not copied for COW yet */
- ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, true);
+ ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, true);
GPU_depth_test(true);
}
drw_debug_draw();
GPU_depth_test(false);
- ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.region, REGION_DRAW_POST_VIEW);
/* Callback can be nasty and do whatever they want with the state.
* Don't trust them! */
@@ -1359,7 +1359,7 @@ void DRW_draw_callbacks_post_scene(void)
if (((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) && (do_annotations)) {
GPU_depth_test(false);
/* XXX: as scene->gpd is not copied for COW yet */
- ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, false);
+ ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, region, false);
}
if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
@@ -1372,7 +1372,7 @@ void DRW_draw_callbacks_post_scene(void)
if (G.debug_value > 20 && G.debug_value < 30) {
GPU_depth_test(false);
/* local coordinate visible rect inside region, to accommodate overlapping ui */
- const rcti *rect = ED_region_visible_rect(DST.draw_ctx.ar);
+ const rcti *rect = ED_region_visible_rect(DST.draw_ctx.region);
DRW_stats_draw(rect);
}
@@ -1401,11 +1401,11 @@ struct DRWTextStore *DRW_text_cache_ensure(void)
void DRW_draw_view(const bContext *C)
{
Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = DEG_get_evaluated_scene(depsgraph);
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
- GPUViewport *viewport = WM_draw_region_get_bound_viewport(ar);
+ GPUViewport *viewport = WM_draw_region_get_bound_viewport(region);
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
@@ -1414,7 +1414,7 @@ void DRW_draw_view(const bContext *C)
DST.options.draw_background = (scene->r.alphamode == R_ADDSKY) ||
(v3d->shading.type != OB_RENDER);
DST.options.do_color_management = true;
- DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C);
+ DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, viewport, C);
}
/**
@@ -1423,7 +1423,7 @@ void DRW_draw_view(const bContext *C)
*/
void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
RenderEngineType *engine_type,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
GPUViewport *viewport,
const bContext *evil_C)
@@ -1431,14 +1431,14 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
DST.draw_ctx.evil_C = evil_C;
DST.viewport = viewport;
/* Setup viewport */
DST.draw_ctx = (DRWContextState){
- .ar = ar,
+ .region = region,
.rv3d = rv3d,
.v3d = v3d,
.scene = scene,
@@ -1535,7 +1535,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
DRW_draw_callbacks_post_scene();
- if (WM_draw_region_get_bound_viewport(ar)) {
+ if (WM_draw_region_get_bound_viewport(region)) {
/* Don't unbind the framebuffer yet in this case and let
* GPU_viewport_unbind do it, so that we can still do further
* drawing of action zones on top. */
@@ -1556,7 +1556,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
}
void DRW_draw_render_loop(struct Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
GPUViewport *viewport)
{
@@ -1566,7 +1566,7 @@ void DRW_draw_render_loop(struct Depsgraph *depsgraph,
Scene *scene = DEG_get_evaluated_scene(depsgraph);
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
- DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, NULL);
+ DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, viewport, NULL);
}
/**
@@ -1574,7 +1574,7 @@ void DRW_draw_render_loop(struct Depsgraph *depsgraph,
*/
void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
RenderEngineType *engine_type,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
const bool draw_background,
const bool do_color_management,
@@ -1594,7 +1594,7 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
DST.options.is_image_render = true;
DST.options.do_color_management = do_color_management;
DST.options.draw_background = draw_background;
- DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, render_viewport, NULL);
+ DRW_draw_render_loop_ex(depsgraph, engine_type, region, v3d, render_viewport, NULL);
if (draw_background) {
/* HACK(fclem): In this case we need to make sure the final alpha is 1.
@@ -2005,7 +2005,7 @@ void DRW_render_instance_buffer_finish(void)
* object mode select-loop, see: ED_view3d_draw_select_loop (legacy drawing).
*/
void DRW_draw_select_loop(struct Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
bool UNUSED(use_obedit_skip),
bool draw_surface,
@@ -2022,9 +2022,9 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
Object *obact = OBACT(view_layer);
Object *obedit = OBEDIT_FROM_OBACT(obact);
#ifndef USE_GPU_SELECT
- UNUSED_VARS(scene, view_layer, v3d, ar, rect);
+ UNUSED_VARS(scene, view_layer, v3d, region, rect);
#else
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
@@ -2102,7 +2102,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
DST.draw_ctx = (DRWContextState){
- .ar = ar,
+ .region = region,
.rv3d = rv3d,
.v3d = v3d,
.scene = scene,
@@ -2242,7 +2242,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
* object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing).
*/
static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
GPUViewport *viewport,
const bool use_opengl_context)
@@ -2250,7 +2250,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
Scene *scene = DEG_get_evaluated_scene(depsgraph);
RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type);
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (use_opengl_context) {
DRW_opengl_context_enable();
@@ -2261,7 +2261,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
DST.draw_ctx = (DRWContextState){
- .ar = ar,
+ .region = region,
.rv3d = rv3d,
.v3d = v3d,
.scene = scene,
@@ -2347,7 +2347,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
* object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing).
*/
void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
GPUViewport *viewport,
bool use_opengl_context)
@@ -2366,14 +2366,14 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
}
}
- drw_draw_depth_loop_imp(depsgraph, ar, v3d, viewport, use_opengl_context);
+ drw_draw_depth_loop_imp(depsgraph, region, v3d, viewport, use_opengl_context);
}
/**
* Converted from ED_view3d_draw_depth_gpencil (legacy drawing).
*/
void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
GPUViewport *viewport)
{
@@ -2382,10 +2382,10 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
use_drw_engine(&draw_engine_gpencil_type);
- drw_draw_depth_loop_imp(depsgraph, ar, v3d, viewport, true);
+ drw_draw_depth_loop_imp(depsgraph, region, v3d, viewport, true);
}
-void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rcti *rect)
+void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
@@ -2395,8 +2395,8 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rc
/* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */
DST.draw_ctx = (DRWContextState){
- .ar = ar,
- .rv3d = ar->regiondata,
+ .region = region,
+ .rv3d = region->regiondata,
.v3d = v3d,
.scene = scene,
.view_layer = view_layer,
@@ -2407,7 +2407,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, const rc
drw_context_state_init();
/* Setup viewport */
- DST.viewport = WM_draw_region_get_viewport(ar, 0);
+ DST.viewport = WM_draw_region_get_viewport(region, 0);
drw_viewport_var_init();
/* Update ubos */
@@ -2463,9 +2463,9 @@ static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_
/**
* Clears the Depth Buffer and draws only the specified object.
*/
-void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, Object *object)
+void DRW_draw_depth_object(ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
DRW_opengl_context_enable();
GPU_matrix_projection_set(rv3d->winmat);
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c
index 92095791ef7..b74aacb3283 100644
--- a/source/blender/draw/intern/draw_manager_text.c
+++ b/source/blender/draw/intern/draw_manager_text.c
@@ -119,9 +119,9 @@ void DRW_text_cache_add(DRWTextStore *dt,
}
}
-void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
+void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, struct View3D *v3d)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
ViewCachedString *vos;
int tot = 0;
@@ -130,7 +130,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
BLI_memiter_iter_init(dt->cache_strings, &it);
while ((vos = BLI_memiter_iter_step(&it))) {
if (ED_view3d_project_short_ex(
- ar,
+ region,
(vos->flag & DRW_TEXT_CACHE_GLOBALSPACE) ? rv3d->persmat : rv3d->persmatob,
(vos->flag & DRW_TEXT_CACHE_LOCALCLIP) != 0,
vos->vec,
@@ -153,7 +153,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
float original_proj[4][4];
GPU_matrix_projection_get(original_proj);
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
GPU_matrix_push();
GPU_matrix_identity_set();
@@ -192,7 +192,7 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar, struct View3D *v3d)
}
/* Copied from drawobject.c */
-void DRW_text_edit_mesh_measure_stats(ARegion *ar,
+void DRW_text_edit_mesh_measure_stats(ARegion *region,
View3D *v3d,
Object *ob,
const UnitSettings *unit)
@@ -251,9 +251,9 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
if (v3d->overlay.edit_flag &
(V3D_OVERLAY_EDIT_EDGE_LEN | V3D_OVERLAY_EDIT_EDGE_ANG | V3D_OVERLAY_EDIT_INDICES)) {
BoundBox bb;
- const rcti rect = {0, ar->winx, 0, ar->winy};
+ const rcti rect = {0, region->winx, 0, region->winy};
- ED_view3d_clipping_calc(&bb, clip_planes, ar, ob, &rect);
+ ED_view3d_clipping_calc(&bb, clip_planes, region, ob, &rect);
}
if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) {
diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h
index 393645e614a..66ef2379e38 100644
--- a/source/blender/draw/intern/draw_manager_text.h
+++ b/source/blender/draw/intern/draw_manager_text.h
@@ -41,9 +41,9 @@ void DRW_text_cache_add(struct DRWTextStore *dt,
short flag,
const uchar col[4]);
-void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar, struct View3D *v3d);
+void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *region, struct View3D *v3d);
-void DRW_text_edit_mesh_measure_stats(struct ARegion *ar,
+void DRW_text_edit_mesh_measure_stats(struct ARegion *region,
struct View3D *v3d,
struct Object *ob,
const struct UnitSettings *unit);
diff --git a/source/blender/draw/intern/draw_select_buffer.c b/source/blender/draw/intern/draw_select_buffer.c
index 6454fc71e56..81c9f400f6e 100644
--- a/source/blender/draw/intern/draw_select_buffer.c
+++ b/source/blender/draw/intern/draw_select_buffer.c
@@ -48,7 +48,7 @@
/* Main function to read a block of pixels from the select frame buffer. */
uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const rcti *rect,
uint *r_buf_len)
@@ -59,9 +59,9 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
/* Clamp rect. */
rcti r = {
.xmin = 0,
- .xmax = ar->winx,
+ .xmax = region->winx,
.ymin = 0,
- .ymax = ar->winy,
+ .ymax = region->winy,
};
/* Make sure that the rect is within the bounds of the viewport.
@@ -72,11 +72,11 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
DRW_opengl_context_enable();
/* Update the drawing. */
- DRW_draw_select_id(depsgraph, ar, v3d, rect);
+ DRW_draw_select_id(depsgraph, region, v3d, rect);
if (select_ctx->index_drawn_len > 1) {
- BLI_assert(ar->winx == GPU_texture_width(DRW_engine_select_texture_get()) &&
- ar->winy == GPU_texture_height(DRW_engine_select_texture_get()));
+ BLI_assert(region->winx == GPU_texture_width(DRW_engine_select_texture_get()) &&
+ region->winy == GPU_texture_height(DRW_engine_select_texture_get()));
/* Read the UI32 pixels. */
buf_len = BLI_rcti_size_x(rect) * BLI_rcti_size_y(rect);
@@ -126,7 +126,7 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
* \returns a #BLI_bitmap the length of \a bitmap_len or NULL on failure.
*/
uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const rcti *rect,
uint *r_bitmap_len)
@@ -138,7 +138,7 @@ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
rect_px.ymax += 1;
uint buf_len;
- uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect_px, &buf_len);
+ uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len);
if (buf == NULL) {
return NULL;
}
@@ -171,7 +171,7 @@ uint *DRW_select_buffer_bitmap_from_rect(struct Depsgraph *depsgraph,
* \returns a #BLI_bitmap the length of \a bitmap_len or NULL on failure.
*/
uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int center[2],
const int radius,
@@ -186,7 +186,7 @@ uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph,
.ymax = center[1] + radius + 1,
};
- const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, NULL);
+ const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, NULL);
if (buf == NULL) {
return NULL;
@@ -241,7 +241,7 @@ static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data)
* \returns a #BLI_bitmap.
*/
uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int poly[][2],
const int poly_len,
@@ -255,7 +255,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
rect_px.ymax += 1;
uint buf_len;
- uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect_px, &buf_len);
+ uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect_px, &buf_len);
if (buf == NULL) {
return NULL;
}
@@ -312,7 +312,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph,
* Samples a single pixel.
*/
uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int center[2])
{
@@ -326,7 +326,7 @@ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
};
uint buf_len;
- uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len);
+ uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len);
if (buf) {
BLI_assert(0 != buf_len);
ret = buf[0];
@@ -342,7 +342,7 @@ uint DRW_select_buffer_sample_point(struct Depsgraph *depsgraph,
* when found, this value is set to the distance of the selection that's returned.
*/
uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int center[2],
const uint id_min,
@@ -369,7 +369,7 @@ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph,
/* Read from selection framebuffer. */
uint buf_len;
- const uint *buf = DRW_select_buffer_read(depsgraph, ar, v3d, &rect, &buf_len);
+ const uint *buf = DRW_select_buffer_read(depsgraph, region, v3d, &rect, &buf_len);
if (buf == NULL) {
return index;
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index 80a7760a571..08f5d3ac463 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -50,11 +50,11 @@
void DRW_draw_region_info(void)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
DRW_draw_cursor();
- view3d_draw_region_info(draw_ctx->evil_C, ar);
+ view3d_draw_region_info(draw_ctx->evil_C, region);
}
/* **************************** 3D Cursor ******************************** */
@@ -99,7 +99,7 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie
void DRW_draw_cursor(void)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
Scene *scene = draw_ctx->scene;
ViewLayer *view_layer = draw_ctx->view_layer;
@@ -114,9 +114,9 @@ void DRW_draw_cursor(void)
const View3DCursor *cursor = &scene->cursor;
if (ED_view3d_project_int_global(
- ar, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) ==
+ region, cursor->location, co, V3D_PROJ_TEST_NOP | V3D_PROJ_TEST_CLIP_NEAR) ==
V3D_PROJ_RET_OK) {
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float cursor_quat[4];
BKE_scene_cursor_rot_to_quat(cursor, cursor_quat);
@@ -178,7 +178,7 @@ void DRW_draw_cursor(void)
float original_proj[4][4];
GPU_matrix_projection_get(original_proj);
GPU_matrix_push();
- ED_region_pixelspace(ar);
+ ED_region_pixelspace(region);
GPU_matrix_translate_2f(co[0] + 0.5f, co[1] + 0.5f);
GPU_matrix_scale_2f(U.widget_unit, U.widget_unit);
@@ -202,20 +202,20 @@ void DRW_draw_cursor(void)
void DRW_draw_gizmo_3d(void)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
/* 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_gizmomap_draw(ar->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D);
+ WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D);
}
void DRW_draw_gizmo_2d(void)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
- ARegion *ar = draw_ctx->ar;
+ ARegion *region = draw_ctx->region;
- WM_gizmomap_draw(ar->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_2D);
+ WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_2D);
glDepthMask(GL_TRUE);
}
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 95165e35fd9..d1fd1ebd06f 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -114,7 +114,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac,
float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
@@ -145,7 +145,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac,
float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
@@ -253,7 +253,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac,
float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
@@ -466,7 +466,7 @@ static void acf_summary_color(bAnimContext *UNUSED(ac),
static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
float color[3];
/* set backdrop drawing color */
@@ -874,7 +874,7 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[
static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
@@ -1147,7 +1147,7 @@ static void acf_nla_controls_backdrop(bAnimContext *ac,
float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[3];
@@ -3580,7 +3580,7 @@ static void acf_nlaaction_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, fl
static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
AnimData *adt = ale->adt;
short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
float color[4];
@@ -4010,7 +4010,7 @@ void ANIM_channel_draw(
bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short selected, offset;
float y, ymid, ytext;
@@ -4741,7 +4741,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
size_t channel_index)
{
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
float ymid;
const short channel_height = round_fl_to_int(BLI_rctf_size_y(rect));
const bool is_being_renamed = achannel_is_being_renamed(ac, acf, channel_index);
@@ -4871,7 +4871,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
*/
if (acf->name_prop(ale, &ptr, &prop)) {
const short margin_x = 3 * round_fl_to_int(UI_DPI_FAC);
- const short width = ac->ar->winx - offset - (margin_x * 2);
+ const short width = ac->region->winx - offset - (margin_x * 2);
uiBut *but;
UI_block_emboss_set(block, UI_EMBOSS);
@@ -4894,7 +4894,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
NULL);
/* copy what outliner does here, see outliner_buttons */
- if (UI_but_active_only(C, ac->ar, block, but) == false) {
+ if (UI_but_active_only(C, ac->region, block, but) == false) {
ac->ads->renameIndex = 0;
/* send notifiers */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 0d811ef31e9..20f565990e9 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2553,7 +2553,7 @@ static void box_select_anim_channels(bAnimContext *ac, rcti *rect, short selectm
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
rctf rectf;
/* convert border-region to view coordinates */
@@ -2736,20 +2736,20 @@ static bool rename_anim_channels(bAnimContext *ac, int channel_index)
/* free temp data and tag for refresh */
ANIM_animdata_freelist(&anim_data);
- ED_region_tag_redraw(ac->ar);
+ ED_region_tag_redraw(ac->region);
return success;
}
static int animchannels_channel_get(bAnimContext *ac, const int mval[2])
{
- ARegion *ar;
+ ARegion *region;
View2D *v2d;
int channel_index;
float x, y;
/* get useful pointers from animation context data */
- ar = ac->ar;
- v2d = &ar->v2d;
+ region = ac->region;
+ v2d = &region->v2d;
/* Figure out which channel user clicked in. */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
@@ -3194,7 +3194,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
bAnimContext ac;
- ARegion *ar;
+ ARegion *region;
View2D *v2d;
int channel_index;
int notifierFlags = 0;
@@ -3207,8 +3207,8 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmE
}
/* get useful pointers from animation context data */
- ar = ac.ar;
- v2d = &ar->v2d;
+ region = ac.region;
+ v2d = &region->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend")) {
@@ -3327,7 +3327,7 @@ static bool select_anim_channel_keys(bAnimContext *ac, int channel_index, bool e
}
/* free temp data and tag for refresh */
- ED_region_tag_redraw(ac->ar);
+ ED_region_tag_redraw(ac->region);
return success;
}
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 40b2706cc75..abcc2fe5291 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -615,9 +615,9 @@ static bool find_prev_next_keyframes(struct bContext *C, int *nextfra, int *prev
void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
- float w = BLI_rctf_size_x(&ar->v2d.cur);
+ float w = BLI_rctf_size_x(&region->v2d.cur);
rctf newrct;
int nextfra, prevfra;
@@ -626,8 +626,8 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
const float fps = FPS;
newrct.xmax = scene->r.cfra + U.view_frame_seconds * fps + 1;
newrct.xmin = scene->r.cfra - U.view_frame_seconds * fps - 1;
- newrct.ymax = ar->v2d.cur.ymax;
- newrct.ymin = ar->v2d.cur.ymin;
+ newrct.ymax = region->v2d.cur.ymax;
+ newrct.ymin = region->v2d.cur.ymin;
break;
}
@@ -636,8 +636,8 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
if (find_prev_next_keyframes(C, &nextfra, &prevfra)) {
newrct.xmax = nextfra;
newrct.xmin = prevfra;
- newrct.ymax = ar->v2d.cur.ymax;
- newrct.ymin = ar->v2d.cur.ymin;
+ newrct.ymax = region->v2d.cur.ymax;
+ newrct.ymin = region->v2d.cur.ymin;
break;
}
/* else drop through, keep range instead */
@@ -647,11 +647,11 @@ void ANIM_center_frame(struct bContext *C, int smooth_viewtx)
default:
newrct.xmax = scene->r.cfra + (w / 2);
newrct.xmin = scene->r.cfra - (w / 2);
- newrct.ymax = ar->v2d.cur.ymax;
- newrct.ymin = ar->v2d.cur.ymin;
+ newrct.ymax = region->v2d.cur.ymax;
+ newrct.ymin = region->v2d.cur.ymin;
break;
}
- UI_view2d_smooth_view(C, ar, &newrct, smooth_viewtx);
+ UI_view2d_smooth_view(C, region, &newrct, smooth_viewtx);
}
/* *************************************************** */
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 5a0e60f8d58..dcf0377ffc0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -397,7 +397,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
{
Main *bmain = CTX_data_main(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceLink *sl = CTX_wm_space_data(C);
Scene *scene = CTX_data_scene(C);
@@ -416,10 +416,10 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
ac->view_layer = CTX_data_view_layer(C);
ac->obact = (ac->view_layer->basact) ? ac->view_layer->basact->object : NULL;
ac->sa = sa;
- ac->ar = ar;
+ ac->region = region;
ac->sl = sl;
ac->spacetype = (sa) ? sa->spacetype : 0;
- ac->regiontype = (ar) ? ar->regiontype : 0;
+ ac->regiontype = (region) ? region->regiontype : 0;
/* initialise default y-scale factor */
animedit_get_yscale_factor(ac);
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 4f1cab40463..93cb2d1e306 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -575,7 +575,7 @@ void ED_markers_draw(const bContext *C, int flag)
return;
}
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View2D *v2d = UI_view2d_fromcontext(C);
int cfra = CTX_data_scene(C)->r.cfra;
@@ -599,14 +599,14 @@ void ED_markers_draw(const bContext *C, int flag)
for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
if ((marker->flag & SELECT) == 0) {
if (marker_is_in_frame_range(marker, clip_frame_range)) {
- draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, ar->winy);
+ draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, region->winy);
}
}
}
for (TimeMarker *marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
if (marker_is_in_frame_range(marker, clip_frame_range)) {
- draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, ar->winy);
+ draw_marker(fstyle, marker, cfra, marker->frame * xscale, flag, region->winy);
}
}
}
@@ -870,10 +870,10 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve
{
bool tweak = RNA_boolean_get(op->ptr, "tweak");
if (tweak) {
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
ListBase *markers = ED_context_get_markers(C);
- if (!region_position_is_over_marker(v2d, markers, event->x - ar->winrct.xmin)) {
+ if (!region_position_is_over_marker(v2d, markers, event->x - region->winrct.xmin)) {
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
}
@@ -1337,11 +1337,11 @@ static void MARKER_OT_select(wmOperatorType *ot)
static int ed_marker_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
ListBase *markers = ED_context_get_markers(C);
- bool over_marker = region_position_is_over_marker(v2d, markers, event->x - ar->winrct.xmin);
+ bool over_marker = region_position_is_over_marker(v2d, markers, event->x - region->winrct.xmin);
bool tweak = RNA_boolean_get(op->ptr, "tweak");
if (tweak && over_marker) {
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 9e3f91bc971..fb045abe016 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -403,7 +403,7 @@ static void ANIM_OT_end_frame_set(wmOperatorType *ot)
static int previewrange_define_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float sfra, efra;
rcti rect;
@@ -411,8 +411,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
WM_operator_properties_border_to_rcti(op, &rect);
/* convert min/max values to frames (i.e. region to 'tot' rect) */
- sfra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmin);
- efra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmax);
+ sfra = UI_view2d_region_to_view_x(&region->v2d, rect.xmin);
+ efra = UI_view2d_region_to_view_x(&region->v2d, rect.xmax);
/* set start/end frames for preview-range
* - must clamp within allowable limits
diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c
index 84ef28744b3..74c359737b0 100644
--- a/source/blender/editors/animation/time_scrub_ui.c
+++ b/source/blender/editors/animation/time_scrub_ui.c
@@ -46,11 +46,11 @@
#include "RNA_access.h"
-static void get_time_scrub_region_rect(const ARegion *ar, rcti *rect)
+static void get_time_scrub_region_rect(const ARegion *region, rcti *rect)
{
rect->xmin = 0;
- rect->xmax = ar->winx;
- rect->ymax = ar->winy;
+ rect->xmax = region->winx;
+ rect->ymax = region->winy;
rect->ymin = rect->ymax - UI_TIME_SCRUB_MARGIN_Y;
}
@@ -134,18 +134,18 @@ static void draw_current_frame(const Scene *scene,
color);
}
-void ED_time_scrub_draw(const ARegion *ar,
+void ED_time_scrub_draw(const ARegion *region,
const Scene *scene,
bool display_seconds,
bool discrete_frames)
{
- const View2D *v2d = &ar->v2d;
+ const View2D *v2d = &region->v2d;
GPU_matrix_push_projection();
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
rcti scrub_region_rect;
- get_time_scrub_region_rect(ar, &scrub_region_rect);
+ get_time_scrub_region_rect(region, &scrub_region_rect);
draw_background(&scrub_region_rect);
@@ -153,11 +153,11 @@ void ED_time_scrub_draw(const ARegion *ar,
numbers_rect.ymin = get_centered_text_y(&scrub_region_rect) - 4 * UI_DPI_FAC;
if (discrete_frames) {
UI_view2d_draw_scale_x__discrete_frames_or_seconds(
- ar, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
+ region, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
}
else {
UI_view2d_draw_scale_x__frames_or_seconds(
- ar, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
+ region, v2d, &numbers_rect, scene, display_seconds, TH_TEXT);
}
draw_current_frame(scene, display_seconds, v2d, &scrub_region_rect, scene->r.cfra);
@@ -165,23 +165,23 @@ void ED_time_scrub_draw(const ARegion *ar,
GPU_matrix_pop_projection();
}
-bool ED_time_scrub_event_in_region(const ARegion *ar, const wmEvent *event)
+bool ED_time_scrub_event_in_region(const ARegion *region, const wmEvent *event)
{
- rcti rect = ar->winrct;
+ rcti rect = region->winrct;
rect.ymin = rect.ymax - UI_TIME_SCRUB_MARGIN_Y;
return BLI_rcti_isect_pt(&rect, event->x, event->y);
}
-void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *ar, bDopeSheet *dopesheet)
+void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *region, bDopeSheet *dopesheet)
{
GPU_matrix_push_projection();
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
rcti rect;
rect.xmin = 0;
- rect.xmax = ar->winx;
- rect.ymin = ar->winy - UI_TIME_SCRUB_MARGIN_Y;
- rect.ymax = ar->winy;
+ rect.xmax = region->winx;
+ rect.ymin = region->winy - UI_TIME_SCRUB_MARGIN_Y;
+ rect.ymax = region->winy;
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -189,7 +189,7 @@ void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *ar, bDopeShee
immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
immUnbindProgram();
- uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
PointerRNA ptr;
RNA_pointer_create(&CTX_wm_screen(C)->id, &RNA_DopeSheet, dopesheet, &ptr);
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index 7a14de2b240..2ebe7d6f144 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -228,13 +228,13 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
/* temporarily change 3d cursor position */
Scene *scene;
- ARegion *ar;
+ ARegion *region;
View3D *v3d;
float tvec[3], oldcurs[3], mval_f[2];
int retv;
scene = CTX_data_scene(C);
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
v3d = CTX_wm_view3d(C);
View3DCursor *cursor = &scene->cursor;
@@ -242,7 +242,7 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv
copy_v3_v3(oldcurs, cursor->location);
copy_v2fl_v2i(mval_f, event->mval);
- ED_view3d_win_to_3d(v3d, ar, cursor->location, mval_f, tvec);
+ ED_view3d_win_to_3d(v3d, region, cursor->location, mval_f, tvec);
copy_v3_v3(cursor->location, tvec);
/* extrude to the where new cursor is and store the operation result */
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 4c64f9c7248..8463f0ef827 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -88,7 +88,7 @@ typedef struct tPoseSlideOp {
/** area that we're operating in (needed for modal()) */
ScrArea *sa;
/** region that we're operating in (needed for modal()) */
- ARegion *ar;
+ ARegion *region;
/** len of the PoseSlideObject array. */
uint objects_len;
@@ -197,8 +197,8 @@ static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
/* get info from context */
pso->scene = CTX_data_scene(C);
- pso->sa = CTX_wm_area(C); /* only really needed when doing modal() */
- pso->ar = CTX_wm_region(C); /* only really needed when doing modal() */
+ pso->sa = CTX_wm_area(C); /* only really needed when doing modal() */
+ pso->region = CTX_wm_region(C); /* only really needed when doing modal() */
pso->cframe = pso->scene->r.cfra;
pso->mode = mode;
@@ -1004,7 +1004,7 @@ static void pose_slide_mouse_update_percentage(tPoseSlideOp *pso,
wmOperator *op,
const wmEvent *event)
{
- pso->percentage = (event->x - pso->ar->winrct.xmin) / ((float)pso->ar->winx);
+ pso->percentage = (event->x - pso->region->winrct.xmin) / ((float)pso->region->winx);
RNA_float_set(op->ptr, "percentage", pso->percentage);
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index a37063a076d..ee1a48e9f1e 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5671,13 +5671,13 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
copy_v3_v3(location, vc.scene->cursor.location);
}
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, location, event->mval, location);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, location, event->mval, location);
if (use_proj) {
const float mval[2] = {UNPACK2(event->mval)};
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
- vc.bmain, vc.scene, vc.depsgraph, 0, vc.ar, vc.v3d);
+ vc.bmain, vc.scene, vc.depsgraph, 0, vc.region, vc.v3d);
ED_transform_snap_object_project_view3d(
snap_context,
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 5486d60d5d7..f97214991ef 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -187,7 +187,7 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd,
float r_location_world[3],
float r_normal_world[3])
{
- ARegion *ar = cdd->vc.ar;
+ ARegion *region = cdd->vc.region;
RegionView3D *rv3d = cdd->vc.rv3d;
bool is_location_world_set = false;
@@ -195,7 +195,8 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd,
/* project to 'location_world' */
if (cdd->project.use_plane) {
/* get the view vector to 'location' */
- if (ED_view3d_win_to_3d_on_plane(ar, cdd->project.plane, mval_fl, true, r_location_world)) {
+ if (ED_view3d_win_to_3d_on_plane(
+ region, cdd->project.plane, mval_fl, true, r_location_world)) {
if (r_normal_world) {
zero_v3(r_normal_world);
}
@@ -207,7 +208,7 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd,
if (depths && ((unsigned int)mval_i[0] < depths->w) && ((unsigned int)mval_i[1] < depths->h)) {
const double depth = (double)ED_view3d_depth_read_cached(&cdd->vc, mval_i);
if ((depth > depths->depth_range[0]) && (depth < depths->depth_range[1])) {
- if (ED_view3d_depth_unproject(ar, mval_i, depth, r_location_world)) {
+ if (ED_view3d_depth_unproject(region, mval_i, depth, r_location_world)) {
is_location_world_set = true;
if (r_normal_world) {
zero_v3(r_normal_world);
@@ -252,7 +253,7 @@ static bool stroke_elem_project_fallback(const struct CurveDrawData *cdd,
cdd, mval_i, mval_fl, surface_offset, radius, r_location_world, r_normal_world);
if (is_depth_found == false) {
ED_view3d_win_to_3d(
- cdd->vc.v3d, cdd->vc.ar, location_fallback_depth, mval_fl, r_location_world);
+ cdd->vc.v3d, cdd->vc.region, location_fallback_depth, mval_fl, r_location_world);
zero_v3(r_normal_local);
}
mul_v3_m4v3(r_location_local, cdd->vc.obedit->imat, r_location_world);
@@ -345,7 +346,9 @@ static void curve_draw_stroke_from_operator(wmOperator *op)
/** \name Operator Callbacks & Helpers
* \{ */
-static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
+static void curve_draw_stroke_3d(const struct bContext *UNUSED(C),
+ ARegion *UNUSED(region),
+ void *arg)
{
wmOperator *op = arg;
struct CurveDrawData *cdd = op->customdata;
@@ -502,7 +505,7 @@ static void curve_draw_event_add(wmOperator *op, const wmEvent *event)
cdd->prev.selem = selem;
- ED_region_tag_redraw(cdd->vc.ar);
+ ED_region_tag_redraw(cdd->vc.region);
}
static void curve_draw_event_add_first(wmOperator *op, const wmEvent *event)
@@ -572,7 +575,7 @@ static bool curve_draw_init(bContext *C, wmOperator *op, bool is_invoke)
if (is_invoke) {
ED_view3d_viewcontext_init(C, &cdd->vc, depsgraph);
- if (ELEM(NULL, cdd->vc.ar, cdd->vc.rv3d, cdd->vc.v3d, cdd->vc.win, cdd->vc.scene)) {
+ if (ELEM(NULL, cdd->vc.region, cdd->vc.rv3d, cdd->vc.v3d, cdd->vc.win, cdd->vc.scene)) {
MEM_freeN(cdd);
BKE_report(op->reports, RPT_ERROR, "Unable to access 3D viewport");
return false;
@@ -610,7 +613,7 @@ static void curve_draw_exit(wmOperator *op)
struct CurveDrawData *cdd = op->customdata;
if (cdd) {
if (cdd->draw_handle_view) {
- ED_region_draw_cb_exit(cdd->vc.ar->type, cdd->draw_handle_view);
+ ED_region_draw_cb_exit(cdd->vc.region->type, cdd->draw_handle_view);
WM_cursor_modal_restore(cdd->vc.win);
}
@@ -1052,12 +1055,12 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const float mval_fl[2] = {UNPACK2(event->mval)};
float center[3];
negate_v3_v3(center, cdd->vc.rv3d->ofs);
- ED_view3d_win_to_3d(cdd->vc.v3d, cdd->vc.ar, center, mval_fl, cdd->prev.location_world);
+ ED_view3d_win_to_3d(cdd->vc.v3d, cdd->vc.region, center, mval_fl, cdd->prev.location_world);
copy_v3_v3(cdd->prev.location_world_valid, cdd->prev.location_world);
}
cdd->draw_handle_view = ED_region_draw_cb_activate(
- cdd->vc.ar->type, curve_draw_stroke_3d, op, REGION_DRAW_POST_VIEW);
+ cdd->vc.region->type, curve_draw_stroke_3d, op, REGION_DRAW_POST_VIEW);
WM_cursor_modal_set(cdd->vc.win, WM_CURSOR_PAINT_BRUSH);
{
@@ -1080,13 +1083,13 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* needed or else the draw matrix can be incorrect */
view3d_operator_needs_opengl(C);
- ED_view3d_autodist_init(cdd->vc.depsgraph, cdd->vc.ar, cdd->vc.v3d, 0);
+ ED_view3d_autodist_init(cdd->vc.depsgraph, cdd->vc.region, cdd->vc.v3d, 0);
if (cdd->vc.rv3d->depths) {
cdd->vc.rv3d->depths->damaged = true;
}
- ED_view3d_depth_update(cdd->vc.ar);
+ ED_view3d_depth_update(cdd->vc.region);
if (cdd->vc.rv3d->depths != NULL) {
cdd->project.use_depth = true;
@@ -1140,7 +1143,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (event->type == cdd->init_event_type) {
if (event->val == KM_RELEASE) {
- ED_region_tag_redraw(cdd->vc.ar);
+ ED_region_tag_redraw(cdd->vc.region);
curve_draw_exec_precalc(op);
@@ -1152,7 +1155,7 @@ static int curve_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
else if (ELEM(event->type, ESCKEY, RIGHTMOUSE)) {
- ED_region_tag_redraw(cdd->vc.ar);
+ ED_region_tag_redraw(cdd->vc.region);
curve_draw_cancel(C, op);
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index d1ff4cec763..1f57c6cfe0a 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -2256,7 +2256,7 @@ bool ED_curve_editfont_select_pick(
for (j = 0; j < 4; j++) {
if (ED_view3d_project_float_object(
- vc.ar, obedit_co[j], screen_co[j], V3D_PROJ_TEST_CLIP_BB) == V3D_PROJ_RET_OK) {
+ vc.region, obedit_co[j], screen_co[j], V3D_PROJ_TEST_CLIP_BB) == V3D_PROJ_RET_OK) {
project_ok |= (1 << j);
}
}
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index 1f61c45eb80..1964a2ff1a3 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -196,12 +196,12 @@ bool gizmo_window_project_2d(bContext *C,
/* rotate mouse in relation to the center and relocate it */
if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
/* For 3d views, transform 2D mouse pos onto plane. */
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float plane[4], co[3];
plane_from_point_normal_v3(plane, mat[3], mat[2]);
- bool clip_ray = ((RegionView3D *)ar->regiondata)->is_persp;
- if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, clip_ray, co)) {
+ bool clip_ray = ((RegionView3D *)region->regiondata)->is_persp;
+ if (ED_view3d_win_to_3d_on_plane(region, plane, mval, clip_ray, co)) {
float imat[4][4];
invert_m4_m4(imat, mat);
mul_m4_v3(imat, co);
@@ -237,10 +237,10 @@ bool gizmo_window_project_3d(
if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* Note: we might want a custom reference point passed in,
* instead of the gizmo center. */
- ED_view3d_win_to_3d(v3d, ar, mat[3], mval, r_co);
+ ED_view3d_win_to_3d(v3d, region, mat[3], mval, r_co);
invert_m4(mat);
mul_m4_v3(mat, r_co);
return true;
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 99ac683747f..5a256c24c59 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -274,8 +274,8 @@ static int gizmo_arrow_modal(bContext *C,
}
ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz;
GizmoInteraction *inter = gz->interaction_data;
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
float offset[3];
float facdir = 1.0f;
@@ -298,7 +298,7 @@ static int gizmo_arrow_modal(bContext *C,
int ok = 0;
for (int j = 0; j < 2; j++) {
- ED_view3d_win_to_ray(ar, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction);
+ ED_view3d_win_to_ray(region, proj[j].mval, proj[j].ray_origin, proj[j].ray_direction);
/* Force Y axis if we're view aligned */
if (j == 0) {
if (RAD2DEGF(acosf(dot_v3v3(proj[j].ray_direction, arrow->gizmo.matrix_basis[2]))) < 5.0f) {
@@ -353,7 +353,7 @@ static int gizmo_arrow_modal(bContext *C,
}
/* tag the region for redraw */
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_RUNNING_MODAL;
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 6f424252b91..cc69ad8f671 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -402,15 +402,15 @@ static void gizmo_cage3d_draw_intern(
*/
static void gizmo_cage3d_draw_select(const bContext *C, wmGizmo *gz, int select_id)
{
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
gizmo_cage3d_draw_intern(rv3d, gz, true, false, select_id);
}
static void gizmo_cage3d_draw(const bContext *C, wmGizmo *gz)
{
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0;
gizmo_cage3d_draw_intern(rv3d, gz, false, is_highlight, -1);
}
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 6dc81e26bf1..0a2f0738a01 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
@@ -287,15 +287,15 @@ static void dial_ghostarc_draw(const float angle_ofs,
static void dial_ghostarc_get_angles(const wmGizmo *gz,
const wmEvent *event,
- const ARegion *ar,
+ const ARegion *region,
const float mat[4][4],
const float co_outer[3],
float *r_start,
float *r_delta)
{
DialInteraction *inter = gz->interaction_data;
- const RegionView3D *rv3d = ar->regiondata;
- const float mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
+ const RegionView3D *rv3d = region->regiondata;
+ const float mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin};
/* We might need to invert the direction of the angles. */
float view_vec[3], axis_vec[3];
@@ -312,12 +312,13 @@ static void dial_ghostarc_get_angles(const wmGizmo *gz,
plane_from_point_normal_v3(dial_plane, gz->matrix_basis[3], axis_vec);
- if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
+ if (!ED_view3d_win_to_3d_on_plane(
+ region, dial_plane, inter->init.mval, false, proj_mval_init_rel)) {
goto fail;
}
sub_v3_v3(proj_mval_init_rel, gz->matrix_basis[3]);
- if (!ED_view3d_win_to_3d_on_plane(ar, dial_plane, mval, false, proj_mval_new_rel)) {
+ if (!ED_view3d_win_to_3d_on_plane(region, dial_plane, mval, false, proj_mval_new_rel)) {
goto fail;
}
sub_v3_v3(proj_mval_new_rel, gz->matrix_basis[3]);
@@ -440,8 +441,8 @@ static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id
float *clip_plane = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_CLIP) ? clip_plane_buf : NULL;
if (clip_plane) {
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
copy_v3_v3(clip_plane, rv3d->viewinv[2]);
clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
@@ -467,8 +468,8 @@ static void gizmo_dial_draw(const bContext *C, wmGizmo *gz)
NULL;
if (clip_plane) {
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
copy_v3_v3(clip_plane, rv3d->viewinv[2]);
clip_plane[3] = -dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[3]);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
index e7264d2c9bd..f7b51a7a0cb 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c
@@ -148,7 +148,7 @@ static void move_geom_draw(const wmGizmo *gz,
static void move3d_get_translate(const wmGizmo *gz,
const wmEvent *event,
- const ARegion *ar,
+ const ARegion *region,
float co_delta[3])
{
MoveInteraction *inter = gz->interaction_data;
@@ -157,12 +157,12 @@ static void move3d_get_translate(const wmGizmo *gz,
event->mval[1] - inter->init.mval[1],
};
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float co_ref[3];
mul_v3_mat3_m4v3(co_ref, gz->matrix_space, inter->init.prop_co);
const float zfac = ED_view3d_calc_zfac(rv3d, co_ref, NULL);
- ED_view3d_win_to_delta(ar, mval_delta, co_delta, zfac);
+ ED_view3d_win_to_delta(region, mval_delta, co_delta, zfac);
float matrix_space_inv[3][3];
copy_m3_m4(matrix_space_inv, gz->matrix_space);
@@ -246,11 +246,11 @@ static int gizmo_move_modal(bContext *C,
return OPERATOR_RUNNING_MODAL;
}
MoveGizmo3D *move = (MoveGizmo3D *)gz;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float prop_delta[3];
if (CTX_wm_area(C)->spacetype == SPACE_VIEW3D) {
- move3d_get_translate(gz, event, ar, prop_delta);
+ move3d_get_translate(gz, event, region, prop_delta);
}
else {
float mval_proj_init[2], mval_proj_curr[2];
@@ -303,7 +303,7 @@ static int gizmo_move_modal(bContext *C,
zero_v3(move->prop_co);
}
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
inter->prev.tweak_flag = tweak_flag;
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index 6e91be862a9..1a30555a584 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -933,7 +933,7 @@ static void annotation_draw_data_layers(
}
/* draw a short status message in the top-right corner */
-static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
+static void annotation_draw_status_text(const bGPdata *gpd, ARegion *region)
{
/* Cannot draw any status text when drawing OpenGL Renders */
@@ -942,7 +942,7 @@ static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
}
/* Get bounds of region - Necessary to avoid problems with region overlap */
- const rcti *rect = ED_region_visible_rect(ar);
+ const rcti *rect = ED_region_visible_rect(region);
/* for now, this should only be used to indicate when we are in stroke editmode */
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
@@ -1050,7 +1050,7 @@ void ED_annotation_draw_2dimage(const bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int offsx, offsy, sizex, sizey;
@@ -1071,10 +1071,11 @@ void ED_annotation_draw_2dimage(const bContext *C)
* so disabled. */
offsx = 0;
offsy = 0;
- sizex = ar->winx;
- sizey = ar->winy;
+ sizex = region->winx;
+ sizey = region->winy;
- wmOrtho2(ar->v2d.cur.xmin, ar->v2d.cur.xmax, ar->v2d.cur.ymin, ar->v2d.cur.ymax);
+ wmOrtho2(
+ region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, region->v2d.cur.ymax);
dflag |= GP_DRAWDATA_ONLYV2D | GP_DRAWDATA_IEDITHACK;
break;
@@ -1084,8 +1085,8 @@ void ED_annotation_draw_2dimage(const bContext *C)
/* just draw using standard scaling (settings here are currently ignored anyways) */
offsx = 0;
offsy = 0;
- sizex = ar->winx;
- sizey = ar->winy;
+ sizex = region->winx;
+ sizey = region->winy;
/* NOTE: I2D was used in 2.4x, but the old settings for that have been deprecated
* and everything moved to standard View2d
@@ -1096,8 +1097,8 @@ void ED_annotation_draw_2dimage(const bContext *C)
default: /* for spacetype not yet handled */
offsx = 0;
offsy = 0;
- sizex = ar->winx;
- sizey = ar->winy;
+ sizex = region->winx;
+ sizey = region->winy;
dflag |= GP_DRAWDATA_ONLYI2D;
break;
@@ -1124,7 +1125,7 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
{
wmWindowManager *wm = CTX_wm_manager(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int dflag = 0;
@@ -1152,11 +1153,12 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
dflag |= GP_DRAWDATA_NO_ONIONS;
}
- annotation_draw_data_all(scene, gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag, sa->spacetype);
+ annotation_draw_data_all(
+ scene, gpd, 0, 0, region->winx, region->winy, CFRA, dflag, sa->spacetype);
/* draw status text (if in screen/pixel-space) */
if (!onlyv2d) {
- annotation_draw_status_text(gpd, ar);
+ annotation_draw_status_text(gpd, region);
}
}
@@ -1164,10 +1166,10 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
* Note: this gets called twice - first time with only3d=true to draw 3d-strokes,
* second time with only3d=false for screen-aligned strokes */
void ED_annotation_draw_view3d(
- Scene *scene, struct Depsgraph *depsgraph, View3D *v3d, ARegion *ar, bool only3d)
+ Scene *scene, struct Depsgraph *depsgraph, View3D *v3d, ARegion *region, bool only3d)
{
int dflag = 0;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
int offsx, offsy, winx, winy;
/* check that we have grease-pencil stuff to draw */
@@ -1181,7 +1183,7 @@ void ED_annotation_draw_view3d(
* deal with the camera border, otherwise map the coords to the camera border. */
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_FLAG_RENDER_VIEWPORT)) {
rctf rectf;
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &rectf, true); /* no shift */
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &rectf, true); /* no shift */
offsx = round_fl_to_int(rectf.xmin);
offsy = round_fl_to_int(rectf.ymin);
@@ -1191,8 +1193,8 @@ void ED_annotation_draw_view3d(
else {
offsx = 0;
offsy = 0;
- winx = ar->winx;
- winy = ar->winy;
+ winx = region->winx;
+ winy = region->winy;
}
/* set flags */
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index f8eee8a8d39..fe163e5b6e5 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -116,7 +116,7 @@ typedef struct tGPsdata {
/** area where painting originated. */
ScrArea *sa;
/** region where painting originated. */
- ARegion *ar;
+ ARegion *region;
/** needed for GP_STROKE_2DSPACE. */
View2D *v2d;
/** for using the camera rect within the 3d view. */
@@ -306,7 +306,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
int mval_i[2];
round_v2i_v2fl(mval_i, mval);
- if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval_i, out, 0, depth))) {
+ if (gpencil_project_check(p) &&
+ (ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) {
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
@@ -326,13 +327,13 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
*/
gp_get_3d_reference(p, rvec);
- zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
+ zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL);
- if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
+ if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
float mval_f[2];
sub_v2_v2v2(mval_f, mval_prj, mval);
- ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(p->region, mval_f, dvec, zfac);
sub_v3_v3v3(out, rvec, dvec);
}
else {
@@ -350,8 +351,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
/* 2d - relative to screen (viewport area) */
else {
if (p->subrect == NULL) { /* normal 3D view */
- out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100;
- out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
+ out[0] = (float)(mval[0]) / (float)(p->region->winx) * 100;
+ out[1] = (float)(mval[1]) / (float)(p->region->winy) * 100;
}
else { /* camera view, use subrect */
out[0] = ((mval[0] - p->subrect->xmin) / BLI_rctf_size_x(p->subrect)) * 100;
@@ -522,9 +523,11 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
if (gpencil_project_check(p)) {
View3D *v3d = p->sa->spacedata.first;
- view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(
- p->depsgraph, p->ar, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+ view3d_region_operator_needs_opengl(p->win, p->region);
+ ED_view3d_autodist_init(p->depsgraph,
+ p->region,
+ v3d,
+ (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
}
/* convert screen-coordinates to appropriate coordinates (and store them) */
@@ -676,9 +679,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
for (i = 0, ptc = gpd->runtime.sbuffer; i < gpd->runtime.sbuffer_used; i++, ptc++, pt++) {
round_v2i_v2fl(mval_i, &ptc->x);
- if ((ED_view3d_autodist_depth(p->ar, mval_i, depth_margin, depth_arr + i) == 0) &&
+ if ((ED_view3d_autodist_depth(p->region, mval_i, depth_margin, depth_arr + i) == 0) &&
(i && (ED_view3d_autodist_depth_seg(
- p->ar, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
+ p->region, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
interp_depth = true;
}
else {
@@ -794,11 +797,11 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
const int y)
{
if ((p->sa->spacetype == SPACE_VIEW3D) && (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH)) {
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
const int mval_i[2] = {x, y};
float mval_3d[3];
- if (ED_view3d_autodist_simple(p->ar, mval_i, mval_3d, 0, NULL)) {
+ if (ED_view3d_autodist_simple(p->region, mval_i, mval_3d, 0, NULL)) {
const float depth_mval = view3d_point_depth(rv3d, mval_3d);
const float depth_pt = view3d_point_depth(rv3d, &pt->x);
@@ -924,8 +927,8 @@ static void gp_stroke_doeraser(tGPsdata *p)
if (p->sa->spacetype == SPACE_VIEW3D) {
if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) {
View3D *v3d = p->sa->spacedata.first;
- view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(p->depsgraph, p->ar, v3d, 0);
+ view3d_region_operator_needs_opengl(p->win, p->region);
+ ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0);
}
}
@@ -967,7 +970,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
Main *bmain = CTX_data_main(C);
bGPdata **gpd_ptr = NULL;
ScrArea *curarea = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ToolSettings *ts = CTX_data_tool_settings(C);
/* make sure the active view (at the starting time) is a 3d-view */
@@ -992,17 +995,17 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* supported views first */
case SPACE_VIEW3D: {
/* View3D *v3d = curarea->spacedata.first; */
- /* RegionView3D *rv3d = ar->regiondata; */
+ /* RegionView3D *rv3d = region->regiondata; */
/* set current area
* - must verify that region data is 3D-view (and not something else)
*/
/* CAUTION: If this is the "toolbar", then this will change on the first stroke */
p->sa = curarea;
- p->ar = ar;
+ p->region = region;
p->align_flag = &ts->annotate_v3d_align;
- if (ar->regiondata == NULL) {
+ if (region->regiondata == NULL) {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG) {
printf(
@@ -1018,8 +1021,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* set current area */
p->sa = curarea;
- p->ar = ar;
- p->v2d = &ar->v2d;
+ p->region = region;
+ p->v2d = &region->v2d;
p->align_flag = &ts->gpencil_v2d_align;
break;
}
@@ -1028,8 +1031,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* set current area */
p->sa = curarea;
- p->ar = ar;
- p->v2d = &ar->v2d;
+ p->region = region;
+ p->v2d = &region->v2d;
p->align_flag = &ts->gpencil_seq_align;
/* check that gpencil data is allowed to be drawn */
@@ -1047,8 +1050,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* set the current area */
p->sa = curarea;
- p->ar = ar;
- p->v2d = &ar->v2d;
+ p->region = region;
+ p->v2d = &region->v2d;
p->align_flag = &ts->gpencil_ima_align;
break;
}
@@ -1063,8 +1066,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* set the current area */
p->sa = curarea;
- p->ar = ar;
- p->v2d = &ar->v2d;
+ p->region = region;
+ p->v2d = &region->v2d;
p->align_flag = &ts->gpencil_v2d_align;
invert_m4_m4(p->imat, sc->unistabmat);
@@ -1305,13 +1308,13 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) {
if (p->sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = p->sa->spacedata.first;
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
/* no shift */
ED_view3d_calc_camera_border(
- p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
+ p->scene, depsgraph, p->region, v3d, rv3d, &p->subrect_data, true);
p->subrect = &p->subrect_data;
}
}
@@ -1322,7 +1325,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
p->gsc.gpl = p->gpl;
p->gsc.sa = p->sa;
- p->gsc.ar = p->ar;
+ p->gsc.region = p->region;
p->gsc.v2d = p->v2d;
p->gsc.subrect_data = p->subrect_data;
@@ -1359,9 +1362,9 @@ static void gp_paint_strokeend(tGPsdata *p)
View3D *v3d = p->sa->spacedata.first;
/* need to restore the original projection settings before packing up */
- view3d_region_operator_needs_opengl(p->win, p->ar);
+ view3d_region_operator_needs_opengl(p->win, p->region);
ED_view3d_autodist_init(
- p->depsgraph, p->ar, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+ p->depsgraph, p->region, v3d, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
}
/* check if doing eraser or not */
@@ -1776,7 +1779,7 @@ static void annotation_draw_apply_event(
/* force refresh */
/* just active area for now, since doing whole screen is too slow */
- ED_region_tag_redraw(p->ar);
+ ED_region_tag_redraw(p->region);
}
/* ------------------------------- */
@@ -2043,8 +2046,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
*/
if (p->status == GP_STATUS_IDLING) {
- ARegion *ar = CTX_wm_region(C);
- p->ar = ar;
+ ARegion *region = CTX_wm_region(C);
+ p->region = region;
}
/* We don't pass on key events, GP is used with key-modifiers -
@@ -2151,14 +2154,14 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
* NOTE: An exception here is that if launched from the toolbar,
* whatever region we're now in should become the new region
*/
- if ((p->ar) && (p->ar->regiontype == RGN_TYPE_TOOLS)) {
+ if ((p->region) && (p->region->regiontype == RGN_TYPE_TOOLS)) {
/* Change to whatever region is now under the mouse */
ARegion *current_region = BKE_area_find_region_xy(p->sa, RGN_TYPE_ANY, event->x, event->y);
if (G.debug & G_DEBUG) {
printf("found alternative region %p (old was %p) - at %d %d (sa: %d %d -> %d %d)\n",
current_region,
- p->ar,
+ p->region,
event->x,
event->y,
p->sa->totrct.xmin,
@@ -2171,7 +2174,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Assume that since we found the cursor in here, it is in bounds
* and that this should be the region that we begin drawing in
*/
- p->ar = current_region;
+ p->region = current_region;
in_bounds = true;
}
else {
@@ -2184,9 +2187,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
}
- else if (p->ar) {
+ else if (p->region) {
/* Perform bounds check. */
- const rcti *region_rect = ED_region_visible_rect(p->ar);
+ const rcti *region_rect = ED_region_visible_rect(p->region);
in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval);
}
else {
@@ -2284,7 +2287,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* force refresh */
/* just active area for now, since doing whole screen is too slow */
- ED_region_tag_redraw(p->ar);
+ ED_region_tag_redraw(p->region);
/* event handled, so just tag as running modal */
estate = OPERATOR_RUNNING_MODAL;
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 9fef1e4948b..4d879306cec 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1120,8 +1120,8 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const int type)
{
tGPDdraw tgpw;
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
tGPDinterpolate_layer *tgpil;
Object *obact = CTX_data_active_object(C);
/* Drawing code is expected to run with fully evaluated depsgraph. */
@@ -1143,8 +1143,8 @@ void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const in
tgpw.gpd = tgpi->gpd;
tgpw.offsx = 0;
tgpw.offsy = 0;
- tgpw.winx = tgpi->ar->winx;
- tgpw.winy = tgpi->ar->winy;
+ tgpw.winx = tgpi->region->winx;
+ tgpw.winy = tgpi->region->winy;
tgpw.dflag = dflag;
/* turn on alpha-blending */
@@ -1180,7 +1180,7 @@ void ED_gp_draw_fill(tGPDdraw *tgpw)
}
/* draw a short status message in the top-right corner */
-static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar)
+static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *region)
{
/* Cannot draw any status text when drawing OpenGL Renders */
@@ -1189,7 +1189,7 @@ static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar
}
/* Get bounds of region - Necessary to avoid problems with region overlap. */
- const rcti *rect = ED_region_visible_rect(ar);
+ const rcti *rect = ED_region_visible_rect(region);
/* for now, this should only be used to indicate when we are in stroke editmode */
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 0c3e3294428..14354ff38f4 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -89,7 +89,7 @@ typedef struct tGP_BrushEditData {
Object *object;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
/* Current GPencil datablock */
bGPdata *gpd;
@@ -537,7 +537,7 @@ static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
// TODO: incorporate pressure into this?
// XXX: screen-space strokes in 3D space will suffer!
if (gso->sa->spacetype == SPACE_VIEW3D) {
- RegionView3D *rv3d = gso->ar->regiondata;
+ RegionView3D *rv3d = gso->region->regiondata;
float *rvec = gso->object->loc;
float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL);
@@ -557,7 +557,7 @@ static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
copy_v2_v2(mval_f, r);
}
- ED_view3d_win_to_delta(gso->ar, mval_f, gso->dvec, zfac);
+ ED_view3d_win_to_delta(gso->region, mval_f, gso->dvec, zfac);
}
else {
/* 2D - just copy */
@@ -662,7 +662,7 @@ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso)
/* Convert mouse position to 3D space
* See: gpencil_paint.c :: gp_stroke_convertcoords()
*/
- RegionView3D *rv3d = gso->ar->regiondata;
+ RegionView3D *rv3d = gso->region->regiondata;
const float *rvec = gso->object->loc;
float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL);
@@ -671,10 +671,10 @@ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso)
float mval_prj[2];
float dvec[3];
- if (ED_view3d_project_float_global(gso->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
+ if (ED_view3d_project_float_global(gso->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
sub_v2_v2v2(mval_f, mval_prj, mval_f);
- ED_view3d_win_to_delta(gso->ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(gso->region, mval_f, dvec, zfac);
sub_v3_v3v3(gso->dvec, rvec, dvec);
}
else {
@@ -774,7 +774,7 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
/* Rotate in 2D or 3D space? */
if (gps->flag & GP_STROKE_3DSPACE) {
/* Perform rotation in 3D space... */
- RegionView3D *rv3d = gso->ar->regiondata;
+ RegionView3D *rv3d = gso->region->regiondata;
float rmat[3][3];
float axis[3];
float vec[3];
@@ -888,11 +888,11 @@ static bool gp_brush_randomize_apply(tGP_BrushEditData *gso,
/* 3D: Project to 3D space */
if (gso->sa->spacetype == SPACE_VIEW3D) {
bool flip;
- RegionView3D *rv3d = gso->ar->regiondata;
+ RegionView3D *rv3d = gso->region->regiondata;
float zfac = ED_view3d_calc_zfac(rv3d, &pt->x, &flip);
if (flip == false) {
float dvec[3];
- ED_view3d_win_to_delta(gso->gsc.ar, svec, dvec, zfac);
+ ED_view3d_win_to_delta(gso->gsc.region, svec, dvec, zfac);
add_v3_v3(&pt->x, dvec);
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
@@ -1343,7 +1343,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
}
gso->sa = CTX_wm_area(C);
- gso->ar = CTX_wm_region(C);
+ gso->region = CTX_wm_region(C);
/* save mask */
gso->mask = ts->gpencil_selectmode_sculpt;
@@ -2094,7 +2094,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
/* start drawing immediately? */
if (is_modal == false) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* ensure that we'll have a new frame to draw on */
gpsculpt_brush_init_stroke(C, gso);
@@ -2104,7 +2104,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
gpsculpt_brush_apply_event(C, op, event);
/* redraw view with feedback */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
return OPERATOR_RUNNING_MODAL;
@@ -2297,8 +2297,8 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
/* Redraw region? */
if (redraw_region) {
- ARegion *ar = CTX_wm_region(C);
- ED_region_tag_redraw(ar);
+ ARegion *region = CTX_wm_region(C);
+ ED_region_tag_redraw(region);
}
/* Redraw toolsettings (brush settings)? */
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index 296b4707c4b..255f17f13cc 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -161,7 +161,7 @@ static void gp_strokepoint_convertcoords(bContext *C,
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* TODO(sergey): This function might be called from a loop, but no tagging is happening in it,
* so it's not that expensive to ensure evaluated depsgraph here. However, ideally all the
* parameters are to wrapped into a context style struct and queried from Context once.*/
@@ -188,7 +188,7 @@ static void gp_strokepoint_convertcoords(bContext *C,
/* get screen coordinate */
if (gps->flag & GP_STROKE_2DSPACE) {
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
UI_view2d_view_to_region_fl(v2d, pt->x, pt->y, &mvalf[0], &mvalf[1]);
}
else {
@@ -197,12 +197,12 @@ static void gp_strokepoint_convertcoords(bContext *C,
mvalf[1] = (((float)pt->y / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin;
}
else {
- mvalf[0] = (float)pt->x / 100.0f * ar->winx;
- mvalf[1] = (float)pt->y / 100.0f * ar->winy;
+ mvalf[0] = (float)pt->x / 100.0f * region->winx;
+ mvalf[1] = (float)pt->y / 100.0f * region->winy;
}
}
- ED_view3d_win_to_3d(v3d, ar, fp, mvalf, p3d);
+ ED_view3d_win_to_3d(v3d, region, fp, mvalf, p3d);
}
}
@@ -1236,16 +1236,16 @@ static void gp_stroke_norm_curve_weights(Curve *cu, const float minmax_weights[2
static int gp_camera_view_subrect(bContext *C, rctf *subrect)
{
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (v3d) {
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, subrect, true);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, subrect, true);
return 1;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 1931f35922a..a7e28fe1f87 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3410,8 +3410,8 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
ToolSettings *ts = CTX_data_tool_settings(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Object *ob = CTX_data_active_object(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
SnapObjectContext *sctx = NULL;
int oldframe = (int)DEG_get_ctime(depsgraph);
@@ -3426,7 +3426,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
int cfra_prv = INT_MIN;
/* init snap context for geometry projection */
sctx = ED_transform_snap_object_context_create_view3d(
- bmain, scene, depsgraph, 0, ar, CTX_wm_view3d(C));
+ bmain, scene, depsgraph, 0, region, CTX_wm_view3d(C));
/* Go through each editable + selected stroke, adjusting each of its points one by one... */
GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
@@ -3515,7 +3515,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
float location[3] = {0.0f, 0.0f, 0.0f};
float normal[3] = {0.0f, 0.0f, 0.0f};
- ED_view3d_win_to_ray(ar, xy, &ray_start[0], &ray_normal[0]);
+ ED_view3d_win_to_ray(region, xy, &ray_start[0], &ray_normal[0]);
if (ED_transform_snap_object_project_ray(sctx,
&(const struct SnapObjectParams){
.snap_select = SNAP_ALL,
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index cf4ca80a331..d76ab85ad31 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -97,7 +97,7 @@ typedef struct tGPDfill {
/** view3 where painting originated */
struct View3D *v3d;
/** region where painting originated */
- struct ARegion *ar;
+ struct ARegion *region;
/** current GP datablock */
struct bGPdata *gpd;
/** current material */
@@ -237,8 +237,8 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
tgpw.gpd = gpd;
tgpw.offsx = 0;
tgpw.offsy = 0;
- tgpw.winx = tgpf->ar->winx;
- tgpw.winy = tgpf->ar->winy;
+ tgpw.winx = tgpf->region->winx;
+ tgpw.winy = tgpf->region->winy;
tgpw.dflag = 0;
tgpw.disable_fill = 1;
tgpw.dflag |= (GP_DRAWFILLS_ONLY3D | GP_DRAWFILLS_NOSTATUS);
@@ -328,26 +328,26 @@ static bool gp_render_offscreen(tGPDfill *tgpf)
}
/* set temporary new size */
- tgpf->bwinx = tgpf->ar->winx;
- tgpf->bwiny = tgpf->ar->winy;
- tgpf->brect = tgpf->ar->winrct;
-
- /* resize ar */
- tgpf->ar->winrct.xmin = 0;
- tgpf->ar->winrct.ymin = 0;
- tgpf->ar->winrct.xmax = (int)tgpf->ar->winx * tgpf->fill_factor;
- tgpf->ar->winrct.ymax = (int)tgpf->ar->winy * tgpf->fill_factor;
- tgpf->ar->winx = (short)abs(tgpf->ar->winrct.xmax - tgpf->ar->winrct.xmin);
- tgpf->ar->winy = (short)abs(tgpf->ar->winrct.ymax - tgpf->ar->winrct.ymin);
+ tgpf->bwinx = tgpf->region->winx;
+ tgpf->bwiny = tgpf->region->winy;
+ tgpf->brect = tgpf->region->winrct;
+
+ /* resize region */
+ tgpf->region->winrct.xmin = 0;
+ tgpf->region->winrct.ymin = 0;
+ tgpf->region->winrct.xmax = (int)tgpf->region->winx * tgpf->fill_factor;
+ tgpf->region->winrct.ymax = (int)tgpf->region->winy * tgpf->fill_factor;
+ tgpf->region->winx = (short)abs(tgpf->region->winrct.xmax - tgpf->region->winrct.xmin);
+ tgpf->region->winy = (short)abs(tgpf->region->winrct.ymax - tgpf->region->winrct.ymin);
/* save new size */
- tgpf->sizex = (int)tgpf->ar->winx;
- tgpf->sizey = (int)tgpf->ar->winy;
+ tgpf->sizex = (int)tgpf->region->winx;
+ tgpf->sizey = (int)tgpf->region->winy;
/* adjust center */
float center[2];
- center[0] = (float)tgpf->center[0] * ((float)tgpf->ar->winx / (float)tgpf->bwinx);
- center[1] = (float)tgpf->center[1] * ((float)tgpf->ar->winy / (float)tgpf->bwiny);
+ center[0] = (float)tgpf->center[0] * ((float)tgpf->region->winx / (float)tgpf->bwinx);
+ center[1] = (float)tgpf->center[1] * ((float)tgpf->region->winy / (float)tgpf->bwiny);
round_v2i_v2fl(tgpf->center, center);
char err_out[256] = "unknown";
@@ -402,7 +402,7 @@ static bool gp_render_offscreen(tGPDfill *tgpf)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ED_view3d_update_viewmat(
- tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->ar, NULL, winmat, NULL, true);
+ tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->region, NULL, winmat, NULL, true);
/* set for opengl */
GPU_matrix_projection_set(tgpf->rv3d->winmat);
GPU_matrix_set(tgpf->rv3d->viewmat);
@@ -930,8 +930,8 @@ static void gpencil_get_depth_array(tGPDfill *tgpf)
*/
if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) {
/* need to restore the original projection settings before packing up */
- view3d_region_operator_needs_opengl(tgpf->win, tgpf->ar);
- ED_view3d_autodist_init(tgpf->depsgraph, tgpf->ar, tgpf->v3d, 0);
+ view3d_region_operator_needs_opengl(tgpf->win, tgpf->region);
+ ED_view3d_autodist_init(tgpf->depsgraph, tgpf->region, tgpf->v3d, 0);
/* Since strokes are so fine, when using their depth we need a margin
* otherwise they might get missed. */
@@ -949,9 +949,11 @@ static void gpencil_get_depth_array(tGPDfill *tgpf)
int mval_i[2];
round_v2i_v2fl(mval_i, &ptc->x);
- if ((ED_view3d_autodist_depth(tgpf->ar, mval_i, depth_margin, tgpf->depth_arr + i) == 0) &&
- (i && (ED_view3d_autodist_depth_seg(
- tgpf->ar, mval_i, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) {
+ if ((ED_view3d_autodist_depth(tgpf->region, mval_i, depth_margin, tgpf->depth_arr + i) ==
+ 0) &&
+ (i &&
+ (ED_view3d_autodist_depth_seg(
+ tgpf->region, mval_i, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) {
interp_depth = true;
}
else {
@@ -1080,7 +1082,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
for (int i = 0; i < tgpf->sbuffer_used && point2D; i++, point2D++, pt++) {
/* convert screen-coordinates to 3D coordinates */
gp_stroke_convertcoords_tpoint(tgpf->scene,
- tgpf->ar,
+ tgpf->region,
tgpf->ob,
tgpf->gpl,
point2D,
@@ -1164,12 +1166,12 @@ static void gpencil_draw_boundary_lines(const bContext *UNUSED(C), tGPDfill *tgp
}
/* Drawing callback for modal operator in 3d mode */
-static void gpencil_fill_draw_3d(const bContext *C, ARegion *UNUSED(ar), void *arg)
+static void gpencil_fill_draw_3d(const bContext *C, ARegion *UNUSED(region), void *arg)
{
tGPDfill *tgpf = (tGPDfill *)arg;
/* draw only in the region that originated operator. This is required for multiwindow */
- ARegion *ar = CTX_wm_region(C);
- if (ar != tgpf->ar) {
+ ARegion *region = CTX_wm_region(C);
+ if (region != tgpf->region) {
return;
}
@@ -1218,8 +1220,8 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op))
tgpf->scene = CTX_data_scene(C);
tgpf->ob = CTX_data_active_object(C);
tgpf->sa = CTX_wm_area(C);
- tgpf->ar = CTX_wm_region(C);
- tgpf->rv3d = tgpf->ar->regiondata;
+ tgpf->region = CTX_wm_region(C);
+ tgpf->rv3d = tgpf->region->regiondata;
tgpf->v3d = tgpf->sa->spacedata.first;
tgpf->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
tgpf->win = CTX_wm_window(C);
@@ -1290,7 +1292,7 @@ static void gpencil_fill_exit(bContext *C, wmOperator *op)
/* remove drawing handler */
if (tgpf->draw_handle_3d) {
- ED_region_draw_cb_exit(tgpf->ar->type, tgpf->draw_handle_3d);
+ ED_region_draw_cb_exit(tgpf->region->type, tgpf->draw_handle_3d);
}
/* delete temp image */
@@ -1394,7 +1396,7 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
/* Enable custom drawing handlers to show help lines */
if (tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) {
tgpf->draw_handle_3d = ED_region_draw_cb_activate(
- tgpf->ar->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW);
+ tgpf->region->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW);
}
WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_PAINT_BRUSH);
@@ -1426,14 +1428,15 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
tgpf->on_back = RNA_boolean_get(op->ptr, "on_back");
/* first time the event is not enabled to show help lines */
if ((tgpf->oldkey != -1) || ((tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) == 0)) {
- ARegion *ar = BKE_area_find_region_xy(CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y);
- if (ar) {
+ ARegion *region = BKE_area_find_region_xy(
+ CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y);
+ if (region) {
bool in_bounds = false;
/* Perform bounds check */
- in_bounds = BLI_rcti_isect_pt(&ar->winrct, event->x, event->y);
+ in_bounds = BLI_rcti_isect_pt(&region->winrct, event->x, event->y);
- if ((in_bounds) && (ar->regiontype == RGN_TYPE_WINDOW)) {
+ if ((in_bounds) && (region->regiontype == RGN_TYPE_WINDOW)) {
/* TODO GPXX: Verify the mouse click is right for any window size */
tgpf->center[0] = event->mval[0];
tgpf->center[1] = event->mval[1];
@@ -1461,9 +1464,9 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
/* restore size */
- tgpf->ar->winx = (short)tgpf->bwinx;
- tgpf->ar->winy = (short)tgpf->bwiny;
- tgpf->ar->winrct = tgpf->brect;
+ tgpf->region->winx = (short)tgpf->bwinx;
+ tgpf->region->winy = (short)tgpf->bwiny;
+ tgpf->region->winrct = tgpf->brect;
/* free temp stack data */
if (tgpf->stack) {
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 69ec11685fb..077b5b88118 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -116,7 +116,7 @@ typedef struct tGPDinterpolate {
/** area where painting originated */
struct ScrArea *sa;
/** region where painting originated */
- struct ARegion *ar;
+ struct ARegion *region;
/** current GP datablock */
struct bGPdata *gpd;
/** current material */
@@ -162,7 +162,7 @@ typedef struct tGPDprimitive {
/** view3d where painting originated */
struct View3D *v3d;
/** region where painting originated */
- struct ARegion *ar;
+ struct ARegion *region;
/** current GP datablock */
struct bGPdata *gpd;
/** current material */
@@ -252,7 +252,7 @@ typedef struct GP_SpaceConversion {
struct bGPDlayer *gpl;
struct ScrArea *sa;
- struct ARegion *ar;
+ struct ARegion *region;
struct View2D *v2d;
rctf *subrect; /* for using the camera rect within the 3d view */
@@ -308,7 +308,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
/* helper to convert 2d to 3d */
void gp_stroke_convertcoords_tpoint(struct Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
struct Object *ob,
bGPDlayer *gpl,
const struct tGPspoint *point2D,
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index ec26006eb06..940fb85f91a 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -335,7 +335,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
/* Drawing callback for modal operator in screen mode */
static void gpencil_interpolate_draw_screen(const struct bContext *C,
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
void *arg)
{
tGPDinterpolate *tgpi = (tGPDinterpolate *)arg;
@@ -343,7 +343,7 @@ static void gpencil_interpolate_draw_screen(const struct bContext *C,
}
/* Drawing callback for modal operator in 3d mode */
-static void gpencil_interpolate_draw_3d(const bContext *C, ARegion *UNUSED(ar), void *arg)
+static void gpencil_interpolate_draw_3d(const bContext *C, ARegion *UNUSED(region), void *arg)
{
tGPDinterpolate *tgpi = (tGPDinterpolate *)arg;
ED_gp_draw_interpolation(C, tgpi, REGION_DRAW_POST_VIEW);
@@ -356,8 +356,8 @@ static void gpencil_interpolate_draw_3d(const bContext *C, ARegion *UNUSED(ar),
*/
static void gpencil_mouse_update_shift(tGPDinterpolate *tgpi, wmOperator *op, const wmEvent *event)
{
- float mid = (float)(tgpi->ar->winx - tgpi->ar->winrct.xmin) / 2.0f;
- float mpos = event->x - tgpi->ar->winrct.xmin;
+ float mid = (float)(tgpi->region->winx - tgpi->region->winrct.xmin) / 2.0f;
+ float mpos = event->x - tgpi->region->winrct.xmin;
if (mpos >= mid) {
tgpi->shift = ((mpos - mid) * tgpi->high_limit) / mid;
@@ -422,10 +422,10 @@ static void gpencil_interpolate_exit(bContext *C, wmOperator *op)
if (tgpi) {
/* remove drawing handler */
if (tgpi->draw_handle_screen) {
- ED_region_draw_cb_exit(tgpi->ar->type, tgpi->draw_handle_screen);
+ ED_region_draw_cb_exit(tgpi->region->type, tgpi->draw_handle_screen);
}
if (tgpi->draw_handle_3d) {
- ED_region_draw_cb_exit(tgpi->ar->type, tgpi->draw_handle_3d);
+ ED_region_draw_cb_exit(tgpi->region->type, tgpi->draw_handle_3d);
}
/* clear status message area */
@@ -457,7 +457,7 @@ static bool gp_interpolate_set_init_values(bContext *C, wmOperator *op, tGPDinte
/* set current scene and window */
tgpi->scene = CTX_data_scene(C);
tgpi->sa = CTX_wm_area(C);
- tgpi->ar = CTX_wm_region(C);
+ tgpi->region = CTX_wm_region(C);
tgpi->flag = ts->gp_interpolate.flag;
/* set current frame number */
@@ -555,9 +555,9 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
* and each handler use different coord system
*/
tgpi->draw_handle_screen = ED_region_draw_cb_activate(
- tgpi->ar->type, gpencil_interpolate_draw_screen, tgpi, REGION_DRAW_POST_PIXEL);
+ tgpi->region->type, gpencil_interpolate_draw_screen, tgpi, REGION_DRAW_POST_PIXEL);
tgpi->draw_handle_3d = ED_region_draw_cb_activate(
- tgpi->ar->type, gpencil_interpolate_draw_3d, tgpi, REGION_DRAW_POST_VIEW);
+ tgpi->region->type, gpencil_interpolate_draw_3d, tgpi, REGION_DRAW_POST_VIEW);
/* set cursor to indicate modal */
WM_cursor_modal_set(win, WM_CURSOR_EW_SCROLL);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index cad31ed18e5..afc0e66a8a6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -154,7 +154,7 @@ typedef struct tGPsdata {
/** area where painting originated. */
ScrArea *sa;
/** region where painting originated. */
- ARegion *ar;
+ ARegion *region;
/** needed for GP_STROKE_2DSPACE. */
View2D *v2d;
/** for using the camera rect within the 3d view. */
@@ -411,7 +411,7 @@ static void gp_reproject_toplane(tGPsdata *p, bGPDstroke *gps)
Object *obact = (Object *)p->ownerPtr.data;
float origin[3];
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
/* verify the stroke mode is CURSOR 3d space mode */
if ((gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) == 0) {
@@ -446,7 +446,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
int mval_i[2];
round_v2i_v2fl(mval_i, mval);
- if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval_i, out, 0, depth))) {
+ if (gpencil_project_check(p) &&
+ (ED_view3d_autodist_simple(p->region, mval_i, out, 0, depth))) {
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
@@ -468,12 +469,12 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
* works OK, but it could of course be improved. */
gp_get_3d_reference(p, rvec);
- zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
+ zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL);
- if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
+ if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
sub_v2_v2v2(mval_f, mval_prj, mval);
- ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(p->region, mval_f, dvec, zfac);
sub_v3_v3v3(out, rvec, dvec);
}
else {
@@ -789,7 +790,7 @@ static short gp_stroke_addpoint(
ToolSettings *ts = p->scene->toolsettings;
Object *obact = (Object *)p->ownerPtr.data;
Depsgraph *depsgraph = p->depsgraph;
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
View3D *v3d = p->sa->spacedata.first;
MaterialGPencilStyle *gp_style = p->material->gp_style;
const int def_nr = obact->actdef - 1;
@@ -954,11 +955,11 @@ static short gp_stroke_addpoint(
float origin[3];
gp_get_3d_reference(p, origin);
/* reproject current */
- ED_gpencil_tpoint_to_point(p->ar, origin, pt, &spt);
+ ED_gpencil_tpoint_to_point(p->region, origin, pt, &spt);
ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt);
/* reproject previous */
- ED_gpencil_tpoint_to_point(p->ar, origin, ptb, &spt2);
+ ED_gpencil_tpoint_to_point(p->region, origin, ptb, &spt2);
ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt2);
p->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize;
pt->uv_fac = p->totpixlen;
@@ -1029,9 +1030,11 @@ static short gp_stroke_addpoint(
* so initialize depth buffer before converting coordinates
*/
if (gpencil_project_check(p)) {
- view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(
- p->depsgraph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+ view3d_region_operator_needs_opengl(p->win, p->region);
+ ED_view3d_autodist_init(p->depsgraph,
+ p->region,
+ v3d,
+ (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
}
/* convert screen-coordinates to appropriate coordinates (and store them) */
@@ -1092,7 +1095,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
ToolSettings *ts = p->scene->toolsettings;
Depsgraph *depsgraph = p->depsgraph;
Object *obact = (Object *)p->ownerPtr.data;
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
const int def_nr = obact->actdef - 1;
const bool have_weight = (bool)BLI_findlink(&obact->defbase, def_nr);
const char *align_flag = &ts->gpencil_v3d_align;
@@ -1306,9 +1309,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
round_v2i_v2fl(mval_i, &ptc->x);
- if ((ED_view3d_autodist_depth(p->ar, mval_i, depth_margin, depth_arr + i) == 0) &&
+ if ((ED_view3d_autodist_depth(p->region, mval_i, depth_margin, depth_arr + i) == 0) &&
(i && (ED_view3d_autodist_depth_seg(
- p->ar, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
+ p->region, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
interp_depth = true;
}
else {
@@ -1528,7 +1531,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
if ((gp_settings != NULL) && (p->sa->spacetype == SPACE_VIEW3D) &&
(gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
bGPDlayer *gpl = p->gpl;
const int mval_i[2] = {x, y};
@@ -1539,7 +1542,7 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p,
/* calculate difference matrix if parent object */
ED_gpencil_parent_location(p->depsgraph, obact, p->gpd, gpl, diff_mat);
- if (ED_view3d_autodist_simple(p->ar, mval_i, mval_3d, 0, NULL)) {
+ if (ED_view3d_autodist_simple(p->region, mval_i, mval_3d, 0, NULL)) {
const float depth_mval = view3d_point_depth(rv3d, mval_3d);
mul_v3_m4v3(fpt, diff_mat, &pt->x);
@@ -1891,8 +1894,8 @@ static void gp_stroke_doeraser(tGPsdata *p)
if (p->sa->spacetype == SPACE_VIEW3D) {
if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) {
View3D *v3d = p->sa->spacedata.first;
- view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(p->depsgraph, p->ar, v3d, 0);
+ view3d_region_operator_needs_opengl(p->win, p->region);
+ ED_view3d_autodist_init(p->depsgraph, p->region, v3d, 0);
}
}
@@ -2101,7 +2104,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
Main *bmain = CTX_data_main(C);
bGPdata **gpd_ptr = NULL;
ScrArea *curarea = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ToolSettings *ts = CTX_data_tool_settings(C);
Object *obact = CTX_data_active_object(C);
@@ -2129,17 +2132,17 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p)
/* supported views first */
case SPACE_VIEW3D: {
/* View3D *v3d = curarea->spacedata.first; */
- /* RegionView3D *rv3d = ar->regiondata; */
+ /* RegionView3D *rv3d = region->regiondata; */
/* set current area
* - must verify that region data is 3D-view (and not something else)
*/
/* CAUTION: If this is the "toolbar", then this will change on the first stroke */
p->sa = curarea;
- p->ar = ar;
+ p->region = region;
p->align_flag = &ts->gpencil_v3d_align;
- if (ar->regiondata == NULL) {
+ if (region->regiondata == NULL) {
p->status = GP_STATUS_ERROR;
if (G.debug & G_DEBUG) {
printf(
@@ -2406,13 +2409,13 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
if ((*p->align_flag & GP_PROJECT_VIEWSPACE) == 0) {
if (p->sa->spacetype == SPACE_VIEW3D) {
View3D *v3d = p->sa->spacedata.first;
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
/* no shift */
ED_view3d_calc_camera_border(
- p->scene, depsgraph, p->ar, v3d, rv3d, &p->subrect_data, true);
+ p->scene, depsgraph, p->region, v3d, rv3d, &p->subrect_data, true);
p->subrect = &p->subrect_data;
}
}
@@ -2423,7 +2426,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
p->gsc.gpl = p->gpl;
p->gsc.sa = p->sa;
- p->gsc.ar = p->ar;
+ p->gsc.region = p->region;
p->gsc.v2d = p->v2d;
p->gsc.subrect_data = p->subrect_data;
@@ -2453,9 +2456,9 @@ static void gp_paint_strokeend(tGPsdata *p)
View3D *v3d = p->sa->spacedata.first;
/* need to restore the original projection settings before packing up */
- view3d_region_operator_needs_opengl(p->win, p->ar);
+ view3d_region_operator_needs_opengl(p->win, p->region);
ED_view3d_autodist_init(
- p->depsgraph, p->ar, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
+ p->depsgraph, p->region, v3d, (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
}
/* check if doing eraser or not */
@@ -2910,7 +2913,7 @@ static void gp_origin_get(tGPsdata *p, float origin[2])
static void gpencil_speed_guide_init(tGPsdata *p, GP_Sculpt_Guide *guide)
{
/* calculate initial guide values */
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
float scale = 1.0f;
if (rv3d->is_persp) {
float vec[3];
@@ -3193,7 +3196,7 @@ static void gpencil_draw_apply_event(bContext *C,
/* force refresh */
/* just active area for now, since doing whole screen is too slow */
- ED_region_tag_redraw(p->ar);
+ ED_region_tag_redraw(p->region);
}
/* ------------------------------- */
@@ -3584,7 +3587,7 @@ static bool gpencil_add_fake_events(bContext *C, wmOperator *op, const wmEvent *
return added_events;
}
- RegionView3D *rv3d = p->ar->regiondata;
+ RegionView3D *rv3d = p->region->regiondata;
float defaultpixsize = rv3d->pixsize * 1000.0f;
int samples = (GP_MAX_INPUT_SAMPLES - input_samples + 1);
float thickness = (float)brush->size;
@@ -3672,8 +3675,8 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
*/
if (p->status == GP_STATUS_IDLING) {
- ARegion *ar = CTX_wm_region(C);
- p->ar = ar;
+ ARegion *region = CTX_wm_region(C);
+ p->region = region;
}
/* special mode for editing control points */
@@ -3851,14 +3854,14 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
* NOTE: An exception here is that if launched from the toolbar,
* whatever region we're now in should become the new region
*/
- if ((p->ar) && (p->ar->regiontype == RGN_TYPE_TOOLS)) {
+ if ((p->region) && (p->region->regiontype == RGN_TYPE_TOOLS)) {
/* Change to whatever region is now under the mouse */
ARegion *current_region = BKE_area_find_region_xy(p->sa, RGN_TYPE_ANY, event->x, event->y);
if (G.debug & G_DEBUG) {
printf("found alternative region %p (old was %p) - at %d %d (sa: %d %d -> %d %d)\n",
current_region,
- p->ar,
+ p->region,
event->x,
event->y,
p->sa->totrct.xmin,
@@ -3871,7 +3874,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* Assume that since we found the cursor in here, it is in bounds
* and that this should be the region that we begin drawing in
*/
- p->ar = current_region;
+ p->region = current_region;
in_bounds = true;
}
else {
@@ -3884,9 +3887,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
}
- else if (p->ar) {
+ else if (p->region) {
/* Perform bounds check using */
- const rcti *region_rect = ED_region_visible_rect(p->ar);
+ const rcti *region_rect = ED_region_visible_rect(p->region);
in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval);
}
else {
@@ -3942,7 +3945,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
else if (event->val == KM_RELEASE) {
p->status = GP_STATUS_IDLING;
op->flag |= OP_IS_MODAL_CURSOR_REGION;
- ED_region_tag_redraw(p->ar);
+ ED_region_tag_redraw(p->region);
}
}
@@ -4008,7 +4011,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* force refresh */
/* just active area for now, since doing whole screen is too slow */
- ED_region_tag_redraw(p->ar);
+ ED_region_tag_redraw(p->region);
/* event handled, so just tag as running modal */
estate = OPERATOR_RUNNING_MODAL;
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 77f2f5b7353..3ec14ee43b9 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -774,9 +774,9 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
bool found_depth = false;
/* need to restore the original projection settings before packing up */
- view3d_region_operator_needs_opengl(tgpi->win, tgpi->ar);
+ view3d_region_operator_needs_opengl(tgpi->win, tgpi->region);
ED_view3d_autodist_init(tgpi->depsgraph,
- tgpi->ar,
+ tgpi->region,
tgpi->v3d,
(ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 1 : 0);
@@ -784,9 +784,9 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
tGPspoint *ptc = &points2D[0];
for (i = 0; i < gps->totpoints; i++, ptc++) {
round_v2i_v2fl(mval_i, &ptc->x);
- if ((ED_view3d_autodist_depth(tgpi->ar, mval_i, depth_margin, depth_arr + i) == 0) &&
+ if ((ED_view3d_autodist_depth(tgpi->region, mval_i, depth_margin, depth_arr + i) == 0) &&
(i && (ED_view3d_autodist_depth_seg(
- tgpi->ar, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
+ tgpi->region, mval_i, mval_prev, depth_margin + 1, depth_arr + i) == 0))) {
interp_depth = true;
}
else {
@@ -982,12 +982,12 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
float origin[3];
ED_gp_get_drawing_reference(tgpi->scene, tgpi->ob, tgpi->gpl, ts->gpencil_v3d_align, origin);
/* reproject current */
- ED_gpencil_tpoint_to_point(tgpi->ar, origin, tpt, &spt);
+ ED_gpencil_tpoint_to_point(tgpi->region, origin, tpt, &spt);
ED_gp_project_point_to_plane(
tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt);
/* reproject previous */
- ED_gpencil_tpoint_to_point(tgpi->ar, origin, tptb, &spt2);
+ ED_gpencil_tpoint_to_point(tgpi->region, origin, tptb, &spt2);
ED_gp_project_point_to_plane(
tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt2);
tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x) / pixsize;
@@ -1015,8 +1015,13 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
}
/* convert screen-coordinates to 3D coordinates */
- gp_stroke_convertcoords_tpoint(
- tgpi->scene, tgpi->ar, tgpi->ob, tgpi->gpl, p2d, depth_arr ? depth_arr + i : NULL, &pt->x);
+ gp_stroke_convertcoords_tpoint(tgpi->scene,
+ tgpi->region,
+ tgpi->ob,
+ tgpi->gpl,
+ p2d,
+ depth_arr ? depth_arr + i : NULL,
+ &pt->x);
pt->pressure = pressure;
pt->strength = strength;
@@ -1040,7 +1045,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
for (int i = 0; i < tgpi->gpd->runtime.tot_cp_points; i++) {
bGPDcontrolpoint *cp = &cps[i];
gp_stroke_convertcoords_tpoint(
- tgpi->scene, tgpi->ar, tgpi->ob, tgpi->gpl, (tGPspoint *)cp, NULL, &cp->x);
+ tgpi->scene, tgpi->region, tgpi->ob, tgpi->gpl, (tGPspoint *)cp, NULL, &cp->x);
}
}
@@ -1160,8 +1165,8 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
tgpi->scene = scene;
tgpi->ob = CTX_data_active_object(C);
tgpi->sa = CTX_wm_area(C);
- tgpi->ar = CTX_wm_region(C);
- tgpi->rv3d = tgpi->ar->regiondata;
+ tgpi->region = CTX_wm_region(C);
+ tgpi->rv3d = tgpi->region->regiondata;
tgpi->v3d = tgpi->sa->spacedata.first;
tgpi->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
tgpi->win = CTX_wm_window(C);
@@ -1175,7 +1180,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
/* set GP datablock */
tgpi->gpd = gpd;
/* region where paint was originated */
- tgpi->gpd->runtime.ar = tgpi->ar;
+ tgpi->gpd->runtime.ar = tgpi->region;
/* if brush doesn't exist, create a new set (fix damaged files from old versions) */
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index d4eb157bf3c..9c2e0f100cc 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -575,7 +575,7 @@ bool ED_gpencil_stroke_color_use(Object *ob, const bGPDlayer *gpl, const bGPDstr
void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* zero out the storage (just in case) */
memset(r_gsc, 0, sizeof(GP_SpaceConversion));
@@ -586,8 +586,8 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
r_gsc->ob = CTX_data_active_object(C);
r_gsc->sa = sa;
- r_gsc->ar = ar;
- r_gsc->v2d = &ar->v2d;
+ r_gsc->region = region;
+ r_gsc->v2d = &region->v2d;
/* init region-specific stuff */
if (sa->spacetype == SPACE_VIEW3D) {
@@ -595,17 +595,18 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
Scene *scene = CTX_data_scene(C);
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
View3D *v3d = (View3D *)CTX_wm_space_data(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* init 3d depth buffers */
view3d_operator_needs_opengl(C);
- view3d_region_operator_needs_opengl(win, ar);
- ED_view3d_autodist_init(depsgraph, ar, v3d, 0);
+ view3d_region_operator_needs_opengl(win, region);
+ ED_view3d_autodist_init(depsgraph, region, v3d, 0);
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &r_gsc->subrect_data, true);
+ ED_view3d_calc_camera_border(
+ scene, depsgraph, region, v3d, rv3d, &r_gsc->subrect_data, true);
r_gsc->subrect = &r_gsc->subrect_data;
}
}
@@ -680,7 +681,7 @@ void gp_apply_parent_point(
void gp_point_to_xy(
const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, int *r_x, int *r_y)
{
- const ARegion *ar = gsc->ar;
+ const ARegion *region = gsc->region;
const View2D *v2d = gsc->v2d;
const rctf *subrect = gsc->subrect;
int xyval[2];
@@ -690,7 +691,8 @@ void gp_point_to_xy(
BLI_assert(!(gps->flag & GP_STROKE_2DSPACE) || (gsc->sa->spacetype != SPACE_VIEW3D));
if (gps->flag & GP_STROKE_3DSPACE) {
- if (ED_view3d_project_int_global(ar, &pt->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_int_global(region, &pt->x, xyval, V3D_PROJ_TEST_NOP) ==
+ V3D_PROJ_RET_OK) {
*r_x = xyval[0];
*r_y = xyval[1];
}
@@ -707,8 +709,8 @@ void gp_point_to_xy(
else {
if (subrect == NULL) {
/* normal 3D view (or view space) */
- *r_x = (int)(pt->x / 100 * ar->winx);
- *r_y = (int)(pt->y / 100 * ar->winy);
+ *r_x = (int)(pt->x / 100 * region->winx);
+ *r_y = (int)(pt->y / 100 * region->winy);
}
else {
/* camera view, use subrect */
@@ -737,7 +739,7 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
float *r_x,
float *r_y)
{
- const ARegion *ar = gsc->ar;
+ const ARegion *region = gsc->region;
const View2D *v2d = gsc->v2d;
const rctf *subrect = gsc->subrect;
float xyval[2];
@@ -747,7 +749,8 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
BLI_assert(!(gps->flag & GP_STROKE_2DSPACE) || (gsc->sa->spacetype != SPACE_VIEW3D));
if (gps->flag & GP_STROKE_3DSPACE) {
- if (ED_view3d_project_float_global(ar, &pt->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_global(region, &pt->x, xyval, V3D_PROJ_TEST_NOP) ==
+ V3D_PROJ_RET_OK) {
*r_x = xyval[0];
*r_y = xyval[1];
}
@@ -776,8 +779,8 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc,
else {
if (subrect == NULL) {
/* normal 3D view (or view space) */
- *r_x = (pt->x / 100.0f * ar->winx);
- *r_y = (pt->y / 100.0f * ar->winy);
+ *r_x = (pt->x / 100.0f * region->winx);
+ *r_y = (pt->y / 100.0f * region->winy);
}
else {
/* camera view, use subrect */
@@ -795,7 +798,7 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
const float pt[3],
float xy[2])
{
- const ARegion *ar = gsc->ar;
+ const ARegion *region = gsc->region;
const View2D *v2d = gsc->v2d;
const rctf *subrect = gsc->subrect;
float xyval[2];
@@ -804,7 +807,7 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
BLI_assert((gsc->sa->spacetype == SPACE_VIEW3D));
if (flag & GP_STROKE_3DSPACE) {
- if (ED_view3d_project_float_global(ar, pt, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_global(region, pt, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
xy[0] = xyval[0];
xy[1] = xyval[1];
}
@@ -833,8 +836,8 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc,
else {
if (subrect == NULL) {
/* normal 3D view (or view space) */
- xy[0] = (pt[0] / 100.0f * ar->winx);
- xy[1] = (pt[1] / 100.0f * ar->winy);
+ xy[0] = (pt[0] / 100.0f * region->winx);
+ xy[1] = (pt[1] / 100.0f * region->winy);
}
else {
/* camera view, use subrect */
@@ -864,7 +867,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
const float screen_co[2],
float r_out[3])
{
- const RegionView3D *rv3d = gsc->ar->regiondata;
+ const RegionView3D *rv3d = gsc->region->regiondata;
float rvec[3];
ED_gp_get_drawing_reference(
@@ -877,10 +880,10 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
copy_v2_v2(mval_f, screen_co);
- if (ED_view3d_project_float_global(gsc->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
+ if (ED_view3d_project_float_global(gsc->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
sub_v2_v2v2(mval_f, mval_prj, mval_f);
- ED_view3d_win_to_delta(gsc->ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(gsc->region, mval_f, dvec, zfac);
sub_v3_v3v3(r_out, rvec, dvec);
return true;
@@ -901,7 +904,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc,
* \param[out] r_out: The resulting 2D point data.
*/
void gp_stroke_convertcoords_tpoint(Scene *scene,
- ARegion *ar,
+ ARegion *region,
Object *ob,
bGPDlayer *gpl,
const tGPspoint *point2D,
@@ -913,7 +916,7 @@ void gp_stroke_convertcoords_tpoint(Scene *scene,
int mval_i[2];
round_v2i_v2fl(mval_i, &point2D->x);
- if ((depth != NULL) && (ED_view3d_autodist_simple(ar, mval_i, r_out, 0, depth))) {
+ if ((depth != NULL) && (ED_view3d_autodist_simple(region, mval_i, r_out, 0, depth))) {
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
@@ -928,11 +931,12 @@ void gp_stroke_convertcoords_tpoint(Scene *scene,
* 3D-coordinates using the 3D-cursor as reference.
*/
ED_gp_get_drawing_reference(scene, ob, gpl, ts->gpencil_v3d_align, rvec);
- zfac = ED_view3d_calc_zfac(ar->regiondata, rvec, NULL);
+ zfac = ED_view3d_calc_zfac(region->regiondata, rvec, NULL);
- if (ED_view3d_project_float_global(ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_global(region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
+ V3D_PROJ_RET_OK) {
sub_v2_v2v2(mval_f, mval_prj, mval_f);
- ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
sub_v3_v3v3(r_out, rvec, dvec);
}
else {
@@ -1668,7 +1672,7 @@ void ED_gpencil_vgroup_deselect(bContext *C, Object *ob)
/* check if cursor is in drawing region */
static bool gp_check_cursor_region(bContext *C, int mval_i[2])
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
Object *ob = CTX_data_active_object(C);
@@ -1681,11 +1685,11 @@ static bool gp_check_cursor_region(bContext *C, int mval_i[2])
if (!ELEM(sa->spacetype, SPACE_VIEW3D)) {
return false;
}
- if ((ar) && (ar->regiontype != RGN_TYPE_WINDOW)) {
+ if ((region) && (region->regiontype != RGN_TYPE_WINDOW)) {
return false;
}
- else if (ar) {
- return BLI_rcti_isect_pt_v(&ar->winrct, mval_i);
+ else if (region) {
+ return BLI_rcti_isect_pt_v(&region->winrct, mval_i);
}
else {
return false;
@@ -1748,7 +1752,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
bGPdata *gpd = ED_gpencil_data_get_active(C);
@@ -1879,8 +1883,9 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, x, y);
- immVertex2f(
- pos, last_mouse_position[0] + ar->winrct.xmin, last_mouse_position[1] + ar->winrct.ymin);
+ immVertex2f(pos,
+ last_mouse_position[0] + region->winrct.xmin,
+ last_mouse_position[1] + region->winrct.ymin);
immEnd();
GPU_blend(false);
@@ -1992,7 +1997,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode)
}
/* helper to convert 2d to 3d for simple drawing buffer */
-static void gpencil_stroke_convertcoords(ARegion *ar,
+static void gpencil_stroke_convertcoords(ARegion *region,
const tGPspoint *point2D,
const float origin[3],
float out[3])
@@ -2004,11 +2009,12 @@ static void gpencil_stroke_convertcoords(ARegion *ar,
copy_v3_v3(rvec, origin);
- zfac = ED_view3d_calc_zfac(ar->regiondata, rvec, NULL);
+ zfac = ED_view3d_calc_zfac(region->regiondata, rvec, NULL);
- if (ED_view3d_project_float_global(ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_global(region, rvec, mval_prj, V3D_PROJ_TEST_NOP) ==
+ V3D_PROJ_RET_OK) {
sub_v2_v2v2(mval_f, mval_prj, mval_f);
- ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
sub_v3_v3v3(out, rvec, dvec);
}
else {
@@ -2017,11 +2023,14 @@ static void gpencil_stroke_convertcoords(ARegion *ar,
}
/* convert 2d tGPspoint to 3d bGPDspoint */
-void ED_gpencil_tpoint_to_point(ARegion *ar, float origin[3], const tGPspoint *tpt, bGPDspoint *pt)
+void ED_gpencil_tpoint_to_point(ARegion *region,
+ float origin[3],
+ const tGPspoint *tpt,
+ bGPDspoint *pt)
{
float p3d[3];
/* conversion to 3d format */
- gpencil_stroke_convertcoords(ar, tpt, origin, p3d);
+ gpencil_stroke_convertcoords(region, tpt, origin, p3d);
copy_v3_v3(&pt->x, p3d);
pt->pressure = tpt->pressure;
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index f8d0300cb46..2e810297138 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -84,7 +84,7 @@ typedef struct bAnimContext {
/** editor data */
struct SpaceLink *sl;
/** region within editor */
- struct ARegion *ar;
+ struct ARegion *region;
/** dopesheet data for editor (or which is being used) */
struct bDopeSheet *ads;
@@ -407,7 +407,7 @@ typedef enum eAnimFilter_Flags {
/* channel heights */
#define ACHANNEL_FIRST_TOP(ac) \
- (UI_view2d_scale_get_y(&(ac)->ar->v2d) * -UI_TIME_SCRUB_MARGIN_Y - ACHANNEL_SKIP)
+ (UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - ACHANNEL_SKIP)
#define ACHANNEL_HEIGHT(ac) (0.8f * (ac)->yscale_fac * U.widget_unit)
#define ACHANNEL_SKIP (0.1f * U.widget_unit)
#define ACHANNEL_STEP(ac) (ACHANNEL_HEIGHT(ac) + ACHANNEL_SKIP)
@@ -425,7 +425,7 @@ typedef enum eAnimFilter_Flags {
/* NLA channel heights */
#define NLACHANNEL_FIRST_TOP(ac) \
- (UI_view2d_scale_get_y(&(ac)->ar->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP)
+ (UI_view2d_scale_get_y(&(ac)->region->v2d) * -UI_TIME_SCRUB_MARGIN_Y - NLACHANNEL_SKIP)
#define NLACHANNEL_HEIGHT(snla) \
((snla && (snla->flag & SNLA_NOSTRIPCURVES)) ? (0.8f * U.widget_unit) : (1.2f * U.widget_unit))
#define NLACHANNEL_SKIP (0.1f * U.widget_unit)
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 064e957225e..f270a0324f9 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -50,7 +50,10 @@ bool ED_space_clip_maskedit_mask_poll(struct bContext *C);
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height);
void ED_space_clip_get_size_fl(struct SpaceClip *sc, float size[2]);
-void ED_space_clip_get_zoom(struct SpaceClip *sc, struct ARegion *ar, float *zoomx, float *zoomy);
+void ED_space_clip_get_zoom(struct SpaceClip *sc,
+ struct ARegion *region,
+ float *zoomx,
+ float *zoomy);
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
@@ -63,24 +66,27 @@ struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc,
float *angle);
bool ED_space_clip_color_sample(struct SpaceClip *sc,
- struct ARegion *ar,
+ struct ARegion *region,
int mval[2],
float r_col[3]);
void ED_clip_update_frame(const struct Main *mainp, int cfra);
-bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool fit);
+bool ED_clip_view_selection(const struct bContext *C, struct ARegion *region, bool fit);
void ED_clip_select_all(struct SpaceClip *sc, int action, bool *r_has_selection);
bool ED_clip_can_select(struct bContext *C);
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(
- struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr);
+ struct SpaceClip *sc, struct ARegion *region, float x, float y, float *xr, float *yr);
void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc,
- struct ARegion *ar,
+ struct ARegion *region,
const float co[2],
float r_co[2]);
-void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, const int mval[2], float co[2]);
+void ED_clip_mouse_pos(struct SpaceClip *sc,
+ struct ARegion *region,
+ const int mval[2],
+ float co[2]);
bool ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
bool ED_space_clip_check_show_maskedit(struct SpaceClip *sc);
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index 1aed57943e6..06af48cd476 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -110,11 +110,11 @@ void ED_fileselect_params_to_userdef(struct SpaceFile *sfile,
void ED_fileselect_reset_params(struct SpaceFile *sfile);
-void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar);
+void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *region);
-FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *ar);
+FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, struct ARegion *region);
-int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *ar);
+int ED_fileselect_layout_numfiles(FileLayout *layout, struct ARegion *region);
int ED_fileselect_layout_offset(FileLayout *layout, int x, int y);
FileSelection ED_fileselect_layout_offset_rect(FileLayout *layout, const struct rcti *rect);
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index d8088dd8454..8d2d9b934d4 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -150,7 +150,7 @@ void ED_annotation_draw_view2d(const struct bContext *C, bool onlyv2d);
void ED_annotation_draw_view3d(struct Scene *scene,
struct Depsgraph *depsgraph,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
bool only3d);
void ED_annotation_draw_ex(struct Scene *scene,
struct bGPdata *gpd,
@@ -273,7 +273,7 @@ void ED_gpencil_vgroup_deselect(struct bContext *C, struct Object *ob);
int ED_gpencil_join_objects_exec(struct bContext *C, struct wmOperator *op);
/* texture coordinate utilities */
-void ED_gpencil_tpoint_to_point(struct ARegion *ar,
+void ED_gpencil_tpoint_to_point(struct ARegion *region,
float origin[3],
const struct tGPspoint *tpt,
struct bGPDspoint *pt);
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index 6cf633b477c..0e820a1c2d6 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -57,7 +57,7 @@ struct Mask *ED_space_image_get_mask(struct SpaceImage *sima);
void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask);
bool ED_space_image_color_sample(struct SpaceImage *sima,
- struct ARegion *ar,
+ struct ARegion *region,
int mval[2],
float r_col[3]);
struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile);
@@ -68,7 +68,7 @@ void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]);
void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
void ED_space_image_get_zoom(struct SpaceImage *sima,
- struct ARegion *ar,
+ struct ARegion *region,
float *zoomx,
float *zoomy);
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
@@ -84,14 +84,14 @@ void ED_space_image_paint_update(struct Main *bmain,
void ED_image_get_uv_aspect(struct Image *ima, struct ImageUser *iuser, float *aspx, float *aspy);
void ED_image_mouse_pos(struct SpaceImage *sima,
- struct ARegion *ar,
+ struct ARegion *region,
const int mval[2],
float co[2]);
void ED_image_view_center_to_point(struct SpaceImage *sima, float x, float y);
void ED_image_point_pos(
- struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr);
+ struct SpaceImage *sima, struct ARegion *region, float x, float y, float *xr, float *yr);
void ED_image_point_pos__reverse(struct SpaceImage *sima,
- struct ARegion *ar,
+ struct ARegion *region,
const float co[2],
float r_co[2]);
bool ED_image_slot_cycle(struct Image *image, int direction);
@@ -108,7 +108,7 @@ bool ED_space_image_maskedit_mask_poll(struct bContext *C);
bool ED_space_image_cursor_poll(struct bContext *C);
void ED_image_draw_info(struct Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
bool color_manage,
bool use_default_view,
int channels,
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h
index 852bc8a1394..6abefa98c1a 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -37,19 +37,19 @@ struct wmKeyConfig;
/* mask_edit.c */
void ED_mask_get_size(struct ScrArea *sa, int *width, int *height);
-void ED_mask_zoom(struct ScrArea *sa, struct ARegion *ar, float *zoomx, float *zoomy);
-void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *ar, float *aspx, float *aspy);
+void ED_mask_zoom(struct ScrArea *sa, struct ARegion *region, float *zoomx, float *zoomy);
+void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *region, float *aspx, float *aspy);
void ED_mask_pixelspace_factor(struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
float *scalex,
float *scaley);
-void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, const int mval[2], float co[2]);
+void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *region, const int mval[2], float co[2]);
void ED_mask_point_pos(
- struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr);
+ struct ScrArea *sa, struct ARegion *region, float x, float y, float *xr, float *yr);
void ED_mask_point_pos__reverse(
- struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr);
+ struct ScrArea *sa, struct ARegion *region, float x, float y, float *xr, float *yr);
void ED_mask_cursor_location_get(struct ScrArea *sa, float cursor[2]);
bool ED_mask_selected_minmax(const struct bContext *C, float min[2], float max[2]);
@@ -64,7 +64,7 @@ void ED_operatormacros_mask(void);
void ED_mask_draw(const struct bContext *C, const char draw_flag, const char draw_type);
void ED_mask_draw_region(struct Depsgraph *depsgraph,
struct Mask *mask,
- struct ARegion *ar,
+ struct ARegion *region,
const char draw_flag,
const char draw_type,
const char overlay_mode,
@@ -78,7 +78,7 @@ void ED_mask_draw_region(struct Depsgraph *depsgraph,
const struct bContext *C);
void ED_mask_draw_frames(
- struct Mask *mask, struct ARegion *ar, const int cfra, const int sfra, const int efra);
+ struct Mask *mask, struct ARegion *region, const int cfra, const int sfra, const int efra);
/* mask_shapekey.c */
void ED_mask_layer_shape_auto_key(struct MaskLayer *mask_layer, const int frame);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 95d6d5cab3b..6d3396bb393 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -135,7 +135,7 @@ void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
struct BMEdge *e,
struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
struct Object *obedit);
@@ -296,7 +296,7 @@ void ED_keymap_mesh(struct wmKeyConfig *keyconf);
/* editmesh_tools.c (could be moved) */
void EDBM_project_snap_verts(struct bContext *C,
struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct Object *obedit,
struct BMEditMesh *em);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index eedee9d5280..ae2b4989069 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -111,8 +111,11 @@ void ED_node_composite_job(const struct bContext *C,
void ED_operatormacros_node(void);
/* node_view.c */
-bool ED_space_node_color_sample(
- struct Main *bmain, struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]);
+bool ED_space_node_color_sample(struct Main *bmain,
+ struct SpaceNode *snode,
+ struct ARegion *region,
+ int mval[2],
+ float r_col[3]);
#ifdef __cplusplus
}
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 08efc99c5d6..1dd40f27fbb 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -64,75 +64,75 @@ struct wmWindowManager;
/* regions */
void ED_region_do_listen(struct wmWindow *win,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmNotifier *note,
const Scene *scene);
-void ED_region_do_layout(struct bContext *C, struct ARegion *ar);
-void ED_region_do_draw(struct bContext *C, struct ARegion *ar);
-void ED_region_exit(struct bContext *C, struct ARegion *ar);
-void ED_region_remove(struct bContext *C, struct ScrArea *sa, struct ARegion *ar);
-void ED_region_pixelspace(struct ARegion *ar);
-void ED_region_update_rect(struct ARegion *ar);
-void ED_region_floating_initialize(struct ARegion *ar);
-void ED_region_tag_redraw(struct ARegion *ar);
-void ED_region_tag_redraw_partial(struct ARegion *ar, const struct rcti *rct, bool rebuild);
-void ED_region_tag_redraw_cursor(struct ARegion *ar);
-void ED_region_tag_redraw_no_rebuild(struct ARegion *ar);
-void ED_region_tag_refresh_ui(struct ARegion *ar);
-void ED_region_tag_redraw_editor_overlays(struct ARegion *ar);
-
-void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *ar);
+void ED_region_do_layout(struct bContext *C, struct ARegion *region);
+void ED_region_do_draw(struct bContext *C, struct ARegion *region);
+void ED_region_exit(struct bContext *C, struct ARegion *region);
+void ED_region_remove(struct bContext *C, struct ScrArea *sa, struct ARegion *region);
+void ED_region_pixelspace(struct ARegion *region);
+void ED_region_update_rect(struct ARegion *region);
+void ED_region_floating_initialize(struct ARegion *region);
+void ED_region_tag_redraw(struct ARegion *region);
+void ED_region_tag_redraw_partial(struct ARegion *region, const struct rcti *rct, bool rebuild);
+void ED_region_tag_redraw_cursor(struct ARegion *region);
+void ED_region_tag_redraw_no_rebuild(struct ARegion *region);
+void ED_region_tag_refresh_ui(struct ARegion *region);
+void ED_region_tag_redraw_editor_overlays(struct ARegion *region);
+
+void ED_region_panels_init(struct wmWindowManager *wm, struct ARegion *region);
void ED_region_panels_ex(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
const char *contexts[],
int contextnr,
const bool vertical);
-void ED_region_panels(const struct bContext *C, struct ARegion *ar);
+void ED_region_panels(const struct bContext *C, struct ARegion *region);
void ED_region_panels_layout_ex(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct ListBase *paneltypes,
const char *contexts[],
int contextnr,
const bool vertical,
const char *category_override);
-void ED_region_panels_layout(const struct bContext *C, struct ARegion *ar);
-void ED_region_panels_draw(const struct bContext *C, struct ARegion *ar);
+void ED_region_panels_layout(const struct bContext *C, struct ARegion *region);
+void ED_region_panels_draw(const struct bContext *C, struct ARegion *region);
-void ED_region_header_init(struct ARegion *ar);
-void ED_region_header(const struct bContext *C, struct ARegion *ar);
-void ED_region_header_layout(const struct bContext *C, struct ARegion *ar);
-void ED_region_header_draw(const struct bContext *C, struct ARegion *ar);
+void ED_region_header_init(struct ARegion *region);
+void ED_region_header(const struct bContext *C, struct ARegion *region);
+void ED_region_header_layout(const struct bContext *C, struct ARegion *region);
+void ED_region_header_draw(const struct bContext *C, struct ARegion *region);
-void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar);
-void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
+void ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *region);
+void ED_region_toggle_hidden(struct bContext *C, struct ARegion *region);
void ED_region_visibility_change_update(struct bContext *C,
struct ScrArea *sa,
- struct ARegion *ar);
+ struct ARegion *region);
/* screen_ops.c */
void ED_region_visibility_change_update_animated(struct bContext *C,
struct ScrArea *sa,
- struct ARegion *ar);
+ struct ARegion *region);
-void ED_region_info_draw(struct ARegion *ar,
+void ED_region_info_draw(struct ARegion *region,
const char *text,
float fill_color[4],
const bool full_redraw);
-void ED_region_info_draw_multiline(ARegion *ar,
+void ED_region_info_draw_multiline(ARegion *region,
const char *text_array[],
float fill_color[4],
const bool full_redraw);
void ED_region_image_metadata_draw(
int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy);
void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout);
-void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy, float x0, float y0);
-float ED_region_blend_alpha(struct ARegion *ar);
-void ED_region_visible_rect_calc(struct ARegion *ar, struct rcti *rect);
-const rcti *ED_region_visible_rect(ARegion *ar);
+void ED_region_grid_draw(struct ARegion *region, float zoomx, float zoomy, float x0, float y0);
+float ED_region_blend_alpha(struct ARegion *region);
+void ED_region_visible_rect_calc(struct ARegion *region, struct rcti *rect);
+const rcti *ED_region_visible_rect(ARegion *region);
bool ED_region_is_overlap(int spacetype, int regiontype);
-int ED_region_snap_size_test(const struct ARegion *ar);
-bool ED_region_snap_size_apply(struct ARegion *ar, int snap_flag);
+int ED_region_snap_size_test(const struct ARegion *region);
+bool ED_region_snap_size_apply(struct ARegion *region, int snap_flag);
/* message_bus callbacks */
void ED_region_do_msg_notify_tag_redraw(struct bContext *C,
@@ -147,14 +147,14 @@ void ED_area_do_mgs_subscribe_for_tool_header(const struct bContext *C,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus);
void ED_area_do_mgs_subscribe_for_tool_ui(const struct bContext *C,
struct WorkSpace *workspace,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus);
/* message bus */
@@ -163,7 +163,7 @@ void ED_region_message_subscribe(struct bContext *C,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus);
/* spaces */
@@ -409,10 +409,13 @@ void ED_screen_user_menu_register(void);
/* Cache display helpers */
-void ED_region_cache_draw_background(struct ARegion *ar);
+void ED_region_cache_draw_background(struct ARegion *region);
void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y);
-void ED_region_cache_draw_cached_segments(
- struct ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra);
+void ED_region_cache_draw_cached_segments(struct ARegion *region,
+ const int num_segments,
+ const int *points,
+ const int sfra,
+ const int efra);
/* area_utils.c */
void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
@@ -420,24 +423,28 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *C,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus);
-int ED_region_generic_tools_region_snap_size(const struct ARegion *ar, int size, int axis);
+int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis);
/* area_query.c */
-bool ED_region_overlap_isect_x(const ARegion *ar, const int event_x);
-bool ED_region_overlap_isect_y(const ARegion *ar, const int event_y);
-bool ED_region_overlap_isect_xy(const ARegion *ar, const int event_xy[2]);
-bool ED_region_overlap_isect_x_with_margin(const ARegion *ar, const int event_x, const int margin);
-bool ED_region_overlap_isect_y_with_margin(const ARegion *ar, const int event_y, const int margin);
-bool ED_region_overlap_isect_xy_with_margin(const ARegion *ar,
+bool ED_region_overlap_isect_x(const ARegion *region, const int event_x);
+bool ED_region_overlap_isect_y(const ARegion *region, const int event_y);
+bool ED_region_overlap_isect_xy(const ARegion *region, const int event_xy[2]);
+bool ED_region_overlap_isect_x_with_margin(const ARegion *region,
+ const int event_x,
+ const int margin);
+bool ED_region_overlap_isect_y_with_margin(const ARegion *region,
+ const int event_y,
+ const int margin);
+bool ED_region_overlap_isect_xy_with_margin(const ARegion *region,
const int event_xy[2],
const int margin);
-bool ED_region_panel_category_gutter_calc_rect(const ARegion *ar, rcti *r_ar_gutter);
-bool ED_region_panel_category_gutter_isect_xy(const ARegion *ar, const int event_xy[2]);
+bool ED_region_panel_category_gutter_calc_rect(const ARegion *region, rcti *r_ar_gutter);
+bool ED_region_panel_category_gutter_isect_xy(const ARegion *region, const int event_xy[2]);
-bool ED_region_contains_xy(const struct ARegion *ar, const int event_xy[2]);
+bool ED_region_contains_xy(const struct ARegion *region, const int event_xy[2]);
/* interface_region_hud.c */
struct ARegionType *ED_area_type_hud(int space_type);
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 2c2c1f8b27d..06c2c3039f5 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -32,7 +32,7 @@ extern "C" {
/* for animplayer */
typedef struct ScreenAnimData {
- ARegion *ar; /* do not read from this, only for comparing if region exists */
+ ARegion *region; /* do not read from this, only for comparing if region exists */
short redraws;
short flag; /* flags for playback */
int sfra; /* frame that playback was started from */
@@ -95,7 +95,7 @@ typedef enum {
/* for editing areas/regions */
typedef struct AZone {
struct AZone *next, *prev;
- ARegion *ar;
+ ARegion *region;
int type;
union {
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index cac1621962e..26871cf8dd0 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -37,7 +37,7 @@ struct rcti;
/* sculpt.c */
void ED_operatortypes_sculpt(void);
-void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, struct Object *ob);
+void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *region, struct Object *ob);
bool ED_sculpt_mask_box_select(struct bContext *C,
struct ViewContext *vc,
const struct rcti *rect,
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 9005ce1b3a5..ae4add2fca2 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -76,7 +76,9 @@ void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int);
void ED_region_draw_cb_exit(struct ARegionType *, void *);
/* generic callbacks */
/* ed_util.c */
-void ED_region_draw_mouse_line_cb(const struct bContext *C, struct ARegion *ar, void *arg_info);
+void ED_region_draw_mouse_line_cb(const struct bContext *C,
+ struct ARegion *region,
+ void *arg_info);
#ifdef __cplusplus
}
diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h
index 98370b34665..4f7b76675f0 100644
--- a/source/blender/editors/include/ED_text.h
+++ b/source/blender/editors/include/ED_text.h
@@ -36,7 +36,7 @@ struct UndoType;
struct bContext;
bool ED_text_region_location_from_cursor(struct SpaceText *st,
- struct ARegion *ar,
+ struct ARegion *region,
const int cursor_co[2],
int r_pixel_co[2]);
diff --git a/source/blender/editors/include/ED_time_scrub_ui.h b/source/blender/editors/include/ED_time_scrub_ui.h
index 0bcc39847c4..d5b9fa2a553 100644
--- a/source/blender/editors/include/ED_time_scrub_ui.h
+++ b/source/blender/editors/include/ED_time_scrub_ui.h
@@ -32,15 +32,15 @@ struct bContext;
struct bDopeSheet;
struct wmEvent;
-void ED_time_scrub_draw(const struct ARegion *ar,
+void ED_time_scrub_draw(const struct ARegion *region,
const struct Scene *scene,
bool display_seconds,
bool discrete_frames);
-bool ED_time_scrub_event_in_region(const struct ARegion *ar, const struct wmEvent *event);
+bool ED_time_scrub_event_in_region(const struct ARegion *region, const struct wmEvent *event);
void ED_time_scrub_channel_search_draw(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct bDopeSheet *dopesheet);
#ifdef __cplusplus
diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h
index 1277e01859d..34f2bf8361a 100644
--- a/source/blender/editors/include/ED_transform_snap_object_context.h
+++ b/source/blender/editors/include/ED_transform_snap_object_context.h
@@ -86,7 +86,7 @@ SnapObjectContext *ED_transform_snap_object_context_create_view3d(struct Main *b
struct Depsgraph *depsgraph,
int flag,
/* extra args for view3d */
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d);
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx);
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 1671d220d81..511b33bacc5 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -199,7 +199,7 @@ void ED_uvedit_live_unwrap(const struct Scene *scene, struct Object **objects, i
void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, struct Object *ob);
/* uvedit_draw.c */
-void ED_image_draw_cursor(struct ARegion *ar, const float cursor[2]);
+void ED_image_draw_cursor(struct ARegion *region, const float cursor[2]);
void ED_uvedit_draw_main(struct SpaceImage *sima,
const struct Scene *scene,
struct ViewLayer *view_layer,
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 9627e7d7617..7b9e4cfe7bf 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -83,7 +83,7 @@ typedef struct ViewContext {
struct ViewLayer *view_layer;
struct Object *obact;
struct Object *obedit;
- struct ARegion *ar;
+ struct ARegion *region;
struct View3D *v3d;
struct wmWindow *win;
struct RegionView3D *rv3d;
@@ -93,7 +93,7 @@ typedef struct ViewContext {
typedef struct ViewDepths {
unsigned short w, h;
- short x, y; /* only for temp use for sub-rects, added to ar->winx/y */
+ short x, y; /* only for temp use for sub-rects, added to region->winx/y */
float *depths;
double depth_range[2];
@@ -105,7 +105,7 @@ typedef struct ViewDrawOffscreenContext {
struct Scene *scene;
int drawtype;
struct View3D *v3d;
- struct ARegion *ar;
+ struct ARegion *region;
int winx;
int winy;
float viewmat[4][4];
@@ -160,12 +160,12 @@ void ED_view3d_to_object(const struct Depsgraph *depsgraph,
void ED_view3d_lastview_store(struct RegionView3D *rv3d);
/* Depth buffer */
-void ED_view3d_depth_update(struct ARegion *ar);
+void ED_view3d_depth_update(struct ARegion *region);
float ED_view3d_depth_read_cached(const struct ViewContext *vc, const int mval[2]);
bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
const int mval[2],
float r_normal[3]);
-bool ED_view3d_depth_unproject(const struct ARegion *ar,
+bool ED_view3d_depth_unproject(const struct ARegion *region,
const int mval[2],
const double depth,
float r_location_world[3]);
@@ -278,61 +278,61 @@ void pose_foreachScreenBone(struct ViewContext *vc,
/* *** end iterators *** */
/* view3d_project.c */
-void ED_view3d_project_float_v2_m4(const struct ARegion *ar,
+void ED_view3d_project_float_v2_m4(const struct ARegion *region,
const float co[3],
float r_co[2],
float mat[4][4]);
-void ED_view3d_project_float_v3_m4(const struct ARegion *ar,
+void ED_view3d_project_float_v3_m4(const struct ARegion *region,
const float co[3],
float r_co[3],
float mat[4][4]);
-eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *base);
+eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct Base *base);
/* *** short *** */
-eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *region,
float perspmat[4][4],
const bool is_local,
const float co[3],
short r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *region,
const float co[3],
short r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *region,
const float co[3],
short r_co[2],
const eV3DProjTest flag);
/* *** int *** */
-eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *region,
float perspmat[4][4],
const bool is_local,
const float co[3],
int r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *region,
const float co[3],
int r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *region,
const float co[3],
int r_co[2],
const eV3DProjTest flag);
/* *** float *** */
-eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *region,
float perspmat[4][4],
const bool is_local,
const float co[3],
float r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region,
const float co[3],
float r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region,
const float co[3],
float r_co[2],
const eV3DProjTest flag);
@@ -343,21 +343,21 @@ float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const fl
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip);
bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]);
bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const float mval[2],
float ray_start[3],
float ray_normal[3],
const bool do_clip);
bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const float mval[2],
float r_ray_co[3],
float r_ray_normal[3],
float r_ray_start[3],
bool do_clip);
-void ED_view3d_win_to_ray(const struct ARegion *ar,
+void ED_view3d_win_to_ray(const struct ARegion *region,
const float mval[2],
float r_ray_start[3],
float r_ray_normal[3]);
@@ -365,33 +365,33 @@ void ED_view3d_global_to_vector(const struct RegionView3D *rv3d,
const float coord[3],
float vec[3]);
void ED_view3d_win_to_3d(const struct View3D *v3d,
- const struct ARegion *ar,
+ const struct ARegion *region,
const float depth_pt[3],
const float mval[2],
float r_out[3]);
void ED_view3d_win_to_3d_int(const struct View3D *v3d,
- const struct ARegion *ar,
+ const struct ARegion *region,
const float depth_pt[3],
const int mval[2],
float r_out[3]);
-bool ED_view3d_win_to_3d_on_plane(const struct ARegion *ar,
+bool ED_view3d_win_to_3d_on_plane(const struct ARegion *region,
const float plane[4],
const float mval[2],
const bool do_clip,
float r_out[3]);
-bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *ar,
+bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *region,
const float plane[4],
const int mval[2],
const bool do_clip,
float r_out[3]);
-void ED_view3d_win_to_delta(const struct ARegion *ar,
+void ED_view3d_win_to_delta(const struct ARegion *region,
const float mval[2],
float out[3],
const float zfac);
-void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]);
-void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
+void ED_view3d_win_to_origin(const struct ARegion *region, const float mval[2], float out[3]);
+void ED_view3d_win_to_vector(const struct ARegion *region, const float mval[2], float out[3]);
bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct View3D *v3d,
const float mval[2],
float r_ray_start[3],
@@ -404,9 +404,9 @@ void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d,
float obmat[4][4],
float pmat[4][4]);
-void ED_view3d_project(const struct ARegion *ar, const float world[3], float region[3]);
+void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3]);
bool ED_view3d_unproject(
- const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]);
+ const struct ARegion *region, float regionx, float regiony, float regionz, float world[3]);
/* end */
@@ -431,21 +431,21 @@ void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist)
void ED_view3d_calc_camera_border(const struct Scene *scene,
struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const struct RegionView3D *rv3d,
struct rctf *r_viewborder,
const bool no_shift);
void ED_view3d_calc_camera_border_size(const struct Scene *scene,
struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const struct RegionView3D *rv3d,
float r_size[2]);
bool ED_view3d_calc_render_border(const struct Scene *scene,
struct Depsgraph *depsgraph,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
struct rcti *rect);
void ED_view3d_clipping_calc_from_boundbox(float clip[6][4],
@@ -453,7 +453,7 @@ void ED_view3d_clipping_calc_from_boundbox(float clip[6][4],
const bool is_flip);
void ED_view3d_clipping_calc(struct BoundBox *bb,
float planes[4][4],
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct Object *ob,
const struct rcti *rect);
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
@@ -467,7 +467,7 @@ void ED_view3d_clipping_disable(void);
float ED_view3d_radius_to_dist_persp(const float angle, const float radius);
float ED_view3d_radius_to_dist_ortho(const float lens, const float radius);
float ED_view3d_radius_to_dist(const struct View3D *v3d,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct Depsgraph *depsgraph,
const char persp,
const bool use_aspect,
@@ -477,12 +477,12 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un
/* backbuffer select and draw support */
void ED_view3d_backbuf_depth_validate(struct ViewContext *vc);
-int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
+int ED_view3d_backbuf_sample_size_clamp(struct ARegion *region, const float dist);
void ED_view3d_select_id_validate(struct ViewContext *vc);
bool ED_view3d_autodist(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int mval[2],
float mouse_worldloc[3],
@@ -491,17 +491,20 @@ bool ED_view3d_autodist(struct Depsgraph *depsgraph,
/* only draw so ED_view3d_autodist_simple can be called many times after */
void ED_view3d_autodist_init(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
int mode);
-bool ED_view3d_autodist_simple(struct ARegion *ar,
+bool ED_view3d_autodist_simple(struct ARegion *region,
const int mval[2],
float mouse_worldloc[3],
int margin,
float *force_depth);
-bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
-bool ED_view3d_autodist_depth_seg(
- struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
+bool ED_view3d_autodist_depth(struct ARegion *region, const int mval[2], int margin, float *depth);
+bool ED_view3d_autodist_depth_seg(struct ARegion *region,
+ const int mval_sta[2],
+ const int mval_end[2],
+ int margin,
+ float *depth);
/* select */
#define MAXPICKELEMS 2500
@@ -545,7 +548,7 @@ void ED_view3d_viewcontext_init(struct bContext *C,
struct Depsgraph *depsgraph);
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact);
void view3d_operator_needs_opengl(const struct bContext *C);
-void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
+void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *region);
/* XXX should move to BLI_math */
bool edge_inside_circle(const float cent[2],
@@ -584,7 +587,7 @@ bool ED_view3d_context_activate(struct bContext *C);
void ED_view3d_draw_setup_view(struct wmWindow *win,
struct Depsgraph *depsgraph,
struct Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
float viewmat[4][4],
float winmat[4][4],
@@ -593,11 +596,11 @@ void ED_view3d_draw_setup_view(struct wmWindow *win,
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
struct Object *ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2]);
bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2]);
-void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
+void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *region, bool do_clip);
void ED_view3d_update_viewmat(struct Depsgraph *depsgraph,
struct Scene *scene,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const struct rcti *rect,
@@ -628,7 +631,7 @@ void ED_view3d_persp_switch_from_camera(const struct Depsgraph *depsgraph,
const char persp);
bool ED_view3d_persp_ensure(const struct Depsgraph *depsgraph,
struct View3D *v3d,
- struct ARegion *ar);
+ struct ARegion *region);
/* camera lock functions */
bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
@@ -692,7 +695,7 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op,
#endif
/* render */
-void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
+void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *region);
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
#define XRAY_ALPHA(v3d) \
@@ -707,7 +710,7 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr
/* Try avoid using these more move out of legacy. */
void ED_view3d_draw_bgpic_test(struct Scene *scene,
struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const bool do_foreground,
const bool do_camera_frame);
@@ -720,7 +723,7 @@ void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C,
/* space_view3d.c */
void ED_view3d_buttons_region_layout_ex(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
const char *category_override);
/* view3d_view.c */
diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h
index 7d51a8c7ece..359c55d89a5 100644
--- a/source/blender/editors/include/ED_view3d_offscreen.h
+++ b/source/blender/editors/include/ED_view3d_offscreen.h
@@ -46,7 +46,7 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
struct Scene *scene,
eDrawType drawtype,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
int winx,
int winy,
float viewmat[4][4],
@@ -62,7 +62,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph,
struct Scene *scene,
eDrawType drawtype,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
int sizex,
int sizey,
eImBufFlags imbuf_flag,
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index e83582b19d0..277f330ad50 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -604,7 +604,7 @@ struct uiLayout *UI_pie_menu_layout(struct uiPieMenu *pie);
*
* Functions used to create popup blocks. These are like popup menus
* but allow using all button types and creating an own layout. */
-typedef uiBlock *(*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
+typedef uiBlock *(*uiBlockCreateFunc)(struct bContext *C, struct ARegion *region, void *arg1);
typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void UI_popup_block_invoke(struct bContext *C,
@@ -728,16 +728,19 @@ void UI_but_type_set_menu_from_pulldown(uiBut *but);
/* special button case, only draw it when used actively, for outliner etc */
bool UI_but_active_only_ex(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
uiBlock *block,
uiBut *but,
const bool remove_on_failure);
-bool UI_but_active_only(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but);
+bool UI_but_active_only(const struct bContext *C,
+ struct ARegion *region,
+ uiBlock *block,
+ uiBut *but);
bool UI_block_active_only_flagged_buttons(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct uiBlock *block);
-void UI_but_execute(const struct bContext *C, struct ARegion *ar, uiBut *but);
+void UI_but_execute(const struct bContext *C, struct ARegion *region, uiBut *but);
bool UI_but_online_manual_id(const uiBut *but,
char *r_str,
@@ -1599,7 +1602,7 @@ void UI_but_tooltip_refresh(struct bContext *C, uiBut *but);
void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but);
bool UI_textbutton_activate_rna(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
const void *rna_poin_data,
const char *rna_prop_id);
bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but);
@@ -1637,42 +1640,43 @@ int UI_autocomplete_end(AutoComplete *autocpl, char *autoname);
* could use a good cleanup, though how they will function in 2.5 is
* not clear yet so we postpone that. */
-void UI_panels_begin(const struct bContext *C, struct ARegion *ar);
-void UI_panels_end(const struct bContext *C, struct ARegion *ar, int *r_x, int *r_y);
-void UI_panels_draw(const struct bContext *C, struct ARegion *ar);
+void UI_panels_begin(const struct bContext *C, struct ARegion *region);
+void UI_panels_end(const struct bContext *C, struct ARegion *region, int *r_x, int *r_y);
+void UI_panels_draw(const struct bContext *C, struct ARegion *region);
struct Panel *UI_panel_find_by_type(struct ListBase *lb, struct PanelType *pt);
struct Panel *UI_panel_begin(struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct ListBase *lb,
uiBlock *block,
struct PanelType *pt,
struct Panel *pa,
bool *r_open);
void UI_panel_end(const struct ScrArea *sa,
- const struct ARegion *ar,
+ const struct ARegion *region,
uiBlock *block,
int width,
int height,
bool open);
-void UI_panels_scale(struct ARegion *ar, float new_width);
+void UI_panels_scale(struct ARegion *region, float new_width);
void UI_panel_label_offset(struct uiBlock *block, int *r_x, int *r_y);
int UI_panel_size_y(const struct Panel *pa);
-bool UI_panel_category_is_visible(const struct ARegion *ar);
-void UI_panel_category_add(struct ARegion *ar, const char *name);
-struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *ar, const char *idname);
-struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *ar, const char *idname);
-const char *UI_panel_category_active_get(struct ARegion *ar, bool set_fallback);
-void UI_panel_category_active_set(struct ARegion *ar, const char *idname);
-void UI_panel_category_active_set_default(struct ARegion *ar, const char *idname);
-struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *ar,
+bool UI_panel_category_is_visible(const struct ARegion *region);
+void UI_panel_category_add(struct ARegion *region, const char *name);
+struct PanelCategoryDyn *UI_panel_category_find(struct ARegion *region, const char *idname);
+struct PanelCategoryStack *UI_panel_category_active_find(struct ARegion *region,
+ const char *idname);
+const char *UI_panel_category_active_get(struct ARegion *region, bool set_fallback);
+void UI_panel_category_active_set(struct ARegion *region, const char *idname);
+void UI_panel_category_active_set_default(struct ARegion *region, const char *idname);
+struct PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(struct ARegion *region,
const int x,
const int y);
-struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *ar,
+struct PanelCategoryDyn *UI_panel_category_find_mouse_over(struct ARegion *region,
const struct wmEvent *event);
-void UI_panel_category_clear_all(struct ARegion *ar);
-void UI_panel_category_draw_all(struct ARegion *ar, const char *category_id_active);
+void UI_panel_category_clear_all(struct ARegion *region);
+void UI_panel_category_draw_all(struct ARegion *region, const char *category_id_active);
struct PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname);
@@ -1805,7 +1809,7 @@ uiLayout *UI_block_layout(uiBlock *block,
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout);
void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y);
-void UI_region_message_subscribe(struct ARegion *ar, struct wmMsgBus *mbus);
+void UI_region_message_subscribe(struct ARegion *region, struct wmMsgBus *mbus);
uiBlock *uiLayoutGetBlock(uiLayout *layout);
@@ -2376,8 +2380,8 @@ void UI_context_active_but_prop_get_templateID(struct bContext *C,
struct PropertyRNA **r_prop);
struct ID *UI_context_active_but_get_tab_ID(struct bContext *C);
-uiBut *UI_region_active_but_get(struct ARegion *ar);
-uiBut *UI_region_but_find_rect_over(const struct ARegion *ar, const struct rcti *isect);
+uiBut *UI_region_active_but_get(struct ARegion *region);
+uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct rcti *isect);
/* uiFontStyle.align */
typedef enum eFontStyle_Align {
@@ -2454,7 +2458,7 @@ struct ARegion *UI_tooltip_create_from_button(struct bContext *C,
uiBut *but,
bool is_label);
struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz);
-void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *ar);
+void UI_tooltip_free(struct bContext *C, struct bScreen *sc, struct ARegion *region);
/* How long before a tool-tip shows. */
#define UI_TOOLTIP_DELAY 0.5
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 17d950f5e40..ecdae3ead6b 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -133,7 +133,7 @@ void UI_view2d_zoom_cache_reset(void);
/* view matrix operations */
void UI_view2d_view_ortho(const struct View2D *v2d);
-void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, const bool xaxis);
+void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, const bool xaxis);
void UI_view2d_view_restore(const struct bContext *C);
/* grid drawing */
@@ -158,21 +158,21 @@ float UI_view2d_grid_resolution_x__frames_or_seconds(const struct View2D *v2d,
float UI_view2d_grid_resolution_y__values(const struct View2D *v2d);
/* scale indicator text drawing */
-void UI_view2d_draw_scale_y__values(const struct ARegion *ar,
+void UI_view2d_draw_scale_y__values(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
int colorid);
-void UI_view2d_draw_scale_y__block(const struct ARegion *ar,
+void UI_view2d_draw_scale_y__block(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
int colorid);
-void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar,
+void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
const struct Scene *scene,
bool display_seconds,
int colorid);
-void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar,
+void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
const struct Scene *scene,
@@ -236,16 +236,16 @@ void UI_view2d_center_set(struct View2D *v2d, float x, float y);
void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac);
char UI_view2d_mouse_in_scrollers_ex(
- const struct ARegion *ar, const struct View2D *v2d, int x, int y, int *r_scroll);
-char UI_view2d_mouse_in_scrollers(const struct ARegion *ar,
+ const struct ARegion *region, const struct View2D *v2d, int x, int y, int *r_scroll);
+char UI_view2d_mouse_in_scrollers(const struct ARegion *region,
const struct View2D *v2d,
int x,
int y);
-char UI_view2d_rect_in_scrollers_ex(const struct ARegion *ar,
+char UI_view2d_rect_in_scrollers_ex(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
int *r_scroll);
-char UI_view2d_rect_in_scrollers(const struct ARegion *ar,
+char UI_view2d_rect_in_scrollers(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect);
@@ -257,14 +257,14 @@ void UI_view2d_text_cache_add_rectf(struct View2D *v2d,
const char *str,
size_t str_len,
const char col[4]);
-void UI_view2d_text_cache_draw(struct ARegion *ar);
+void UI_view2d_text_cache_draw(struct ARegion *region);
/* operators */
void ED_operatortypes_view2d(void);
void ED_keymap_view2d(struct wmKeyConfig *keyconf);
void UI_view2d_smooth_view(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
const struct rctf *cur,
const int smooth_viewtx);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 6a5aa59801c..165a53203f3 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -83,7 +83,7 @@
/* prototypes. */
static void ui_but_to_pixelrect(struct rcti *rect,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct uiBlock *block,
struct uiBut *but);
static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *but_p);
@@ -124,15 +124,15 @@ static bool ui_but_is_unit_radians(const uiBut *but)
/* ************* window matrix ************** */
-void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
+void ui_block_to_window_fl(const ARegion *region, uiBlock *block, float *x, float *y)
{
float gx, gy;
int sx, sy, getsizex, getsizey;
- getsizex = BLI_rcti_size_x(&ar->winrct) + 1;
- getsizey = BLI_rcti_size_y(&ar->winrct) + 1;
- sx = ar->winrct.xmin;
- sy = ar->winrct.ymin;
+ getsizex = BLI_rcti_size_x(&region->winrct) + 1;
+ getsizey = BLI_rcti_size_y(&region->winrct) + 1;
+ sx = region->winrct.xmin;
+ sy = region->winrct.ymin;
gx = *x;
gy = *y;
@@ -150,48 +150,51 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
block->winmat[3][1]));
}
-void ui_block_to_window(const ARegion *ar, uiBlock *block, int *x, int *y)
+void ui_block_to_window(const ARegion *region, uiBlock *block, int *x, int *y)
{
float fx, fy;
fx = *x;
fy = *y;
- ui_block_to_window_fl(ar, block, &fx, &fy);
+ ui_block_to_window_fl(region, block, &fx, &fy);
*x = (int)(fx + 0.5f);
*y = (int)(fy + 0.5f);
}
-void ui_block_to_window_rctf(const ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src)
+void ui_block_to_window_rctf(const ARegion *region,
+ uiBlock *block,
+ rctf *rct_dst,
+ const rctf *rct_src)
{
*rct_dst = *rct_src;
- ui_block_to_window_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin);
- ui_block_to_window_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
+ ui_block_to_window_fl(region, block, &rct_dst->xmin, &rct_dst->ymin);
+ ui_block_to_window_fl(region, block, &rct_dst->xmax, &rct_dst->ymax);
}
-float ui_block_to_window_scale(const ARegion *ar, uiBlock *block)
+float ui_block_to_window_scale(const ARegion *region, uiBlock *block)
{
/* We could have function for this to avoid dummy arg. */
float dummy_x;
float min_y = 0, max_y = 1;
dummy_x = 0.0f;
- ui_block_to_window_fl(ar, block, &dummy_x, &min_y);
+ ui_block_to_window_fl(region, block, &dummy_x, &min_y);
dummy_x = 0.0f;
- ui_block_to_window_fl(ar, block, &dummy_x, &max_y);
+ ui_block_to_window_fl(region, block, &dummy_x, &max_y);
return max_y - min_y;
}
/* for mouse cursor */
-void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)
+void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *x, float *y)
{
float a, b, c, d, e, f, px, py;
int sx, sy, getsizex, getsizey;
- getsizex = BLI_rcti_size_x(&ar->winrct) + 1;
- getsizey = BLI_rcti_size_y(&ar->winrct) + 1;
- sx = ar->winrct.xmin;
- sy = ar->winrct.ymin;
+ getsizex = BLI_rcti_size_x(&region->winrct) + 1;
+ getsizey = BLI_rcti_size_y(&region->winrct) + 1;
+ sx = region->winrct.xmin;
+ sy = region->winrct.ymin;
a = 0.5f * ((float)getsizex) * block->winmat[0][0];
b = 0.5f * ((float)getsizex) * block->winmat[1][0];
@@ -213,47 +216,47 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
}
}
-void ui_window_to_block_rctf(const struct ARegion *ar,
+void ui_window_to_block_rctf(const struct ARegion *region,
uiBlock *block,
rctf *rct_dst,
const rctf *rct_src)
{
*rct_dst = *rct_src;
- ui_window_to_block_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin);
- ui_window_to_block_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
+ ui_window_to_block_fl(region, block, &rct_dst->xmin, &rct_dst->ymin);
+ ui_window_to_block_fl(region, block, &rct_dst->xmax, &rct_dst->ymax);
}
-void ui_window_to_block(const ARegion *ar, uiBlock *block, int *x, int *y)
+void ui_window_to_block(const ARegion *region, uiBlock *block, int *x, int *y)
{
float fx, fy;
fx = *x;
fy = *y;
- ui_window_to_block_fl(ar, block, &fx, &fy);
+ ui_window_to_block_fl(region, block, &fx, &fy);
*x = (int)(fx + 0.5f);
*y = (int)(fy + 0.5f);
}
-void ui_window_to_region(const ARegion *ar, int *x, int *y)
+void ui_window_to_region(const ARegion *region, int *x, int *y)
{
- *x -= ar->winrct.xmin;
- *y -= ar->winrct.ymin;
+ *x -= region->winrct.xmin;
+ *y -= region->winrct.ymin;
}
-void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src)
+void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src)
{
- rect_dst->xmin = rct_src->xmin - ar->winrct.xmin;
- rect_dst->xmax = rct_src->xmax - ar->winrct.xmin;
- rect_dst->ymin = rct_src->ymin - ar->winrct.ymin;
- rect_dst->ymax = rct_src->ymax - ar->winrct.ymin;
+ rect_dst->xmin = rct_src->xmin - region->winrct.xmin;
+ rect_dst->xmax = rct_src->xmax - region->winrct.xmin;
+ rect_dst->ymin = rct_src->ymin - region->winrct.ymin;
+ rect_dst->ymax = rct_src->ymax - region->winrct.ymin;
}
-void ui_region_to_window(const ARegion *ar, int *x, int *y)
+void ui_region_to_window(const ARegion *region, int *x, int *y)
{
- *x += ar->winrct.xmin;
- *y += ar->winrct.ymin;
+ *x += region->winrct.xmin;
+ *y += region->winrct.ymin;
}
static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
@@ -336,15 +339,15 @@ static void ui_update_window_matrix(const wmWindow *window, const ARegion *regio
* Popups will add a margin to #ARegion.winrct for shadow,
* for interactivity (point-inside tests for eg), we want the winrct without the margin added.
*/
-void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect)
+void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect)
{
- uiBlock *block = ar->uiblocks.first;
+ uiBlock *block = region->uiblocks.first;
if (block && (block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_RADIAL) == 0) {
BLI_rcti_rctf_copy_floor(r_rect, &block->rect);
- BLI_rcti_translate(r_rect, ar->winrct.xmin, ar->winrct.ymin);
+ BLI_rcti_translate(r_rect, region->winrct.xmin, region->winrct.ymin);
}
else {
- *r_rect = ar->winrct;
+ *r_rect = region->winrct;
}
}
@@ -850,7 +853,7 @@ static bool ui_but_update_from_old_block(const bContext *C,
* they should keep calling uiDefButs to keep them alive */
/* returns 0 when button removed */
bool UI_but_active_only_ex(
- const bContext *C, ARegion *ar, uiBlock *block, uiBut *but, const bool remove_on_failure)
+ const bContext *C, ARegion *region, uiBlock *block, uiBut *but, const bool remove_on_failure)
{
uiBlock *oldblock;
uiBut *oldbut;
@@ -871,7 +874,7 @@ bool UI_but_active_only_ex(
}
}
if ((activate == true) || (found == false)) {
- ui_but_activate_event((bContext *)C, ar, but);
+ ui_but_activate_event((bContext *)C, region, but);
}
else if ((found == true) && (isactive == false)) {
if (remove_on_failure) {
@@ -884,23 +887,23 @@ bool UI_but_active_only_ex(
return true;
}
-bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but)
+bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBut *but)
{
- return UI_but_active_only_ex(C, ar, block, but, true);
+ return UI_but_active_only_ex(C, region, block, but, true);
}
/**
* \warning This must run after other handlers have been added,
* otherwise the handler wont be removed, see: T71112.
*/
-bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBlock *block)
+bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block)
{
bool done = false;
for (uiBut *but = block->buttons.first; but; but = but->next) {
if (but->flag & UI_BUT_ACTIVATE_ON_INIT) {
but->flag &= ~UI_BUT_ACTIVATE_ON_INIT;
if (ui_but_is_editable(but)) {
- if (UI_but_active_only_ex(C, ar, block, but, false)) {
+ if (UI_but_active_only_ex(C, region, block, but, false)) {
done = true;
break;
}
@@ -920,12 +923,12 @@ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBloc
}
/* simulate button click */
-void UI_but_execute(const bContext *C, ARegion *ar, uiBut *but)
+void UI_but_execute(const bContext *C, ARegion *region, uiBut *but)
{
void *active_back;
- ui_but_execute_begin((bContext *)C, ar, but, &active_back);
+ ui_but_execute_begin((bContext *)C, region, but, &active_back);
/* Value is applied in begin. No further action required. */
- ui_but_execute_end((bContext *)C, ar, but, active_back);
+ ui_but_execute_end((bContext *)C, region, but, active_back);
}
/* use to check if we need to disable undo, but don't make any changes
@@ -1827,27 +1830,27 @@ void ui_fontscale(short *points, float aspect)
}
/* project button or block (but==NULL) to pixels in regionspace */
-static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, uiBut *but)
+static void ui_but_to_pixelrect(rcti *rect, const ARegion *region, uiBlock *block, uiBut *but)
{
rctf rectf;
- ui_block_to_window_rctf(ar, block, &rectf, (but) ? &but->rect : &block->rect);
+ ui_block_to_window_rctf(region, block, &rectf, (but) ? &but->rect : &block->rect);
BLI_rcti_rctf_copy_round(rect, &rectf);
- BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
+ BLI_rcti_translate(rect, -region->winrct.xmin, -region->winrct.ymin);
}
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
void UI_block_draw(const bContext *C, uiBlock *block)
{
uiStyle style = *UI_style_get_dpi(); /* XXX pass on as arg */
- ARegion *ar;
+ ARegion *region;
uiBut *but;
rcti rect;
/* get menu region or area region */
- ar = CTX_wm_menu(C);
- if (!ar) {
- ar = CTX_wm_region(C);
+ region = CTX_wm_menu(C);
+ if (!region) {
+ region = CTX_wm_region(C);
}
if (!block->endblock) {
@@ -1865,40 +1868,41 @@ void UI_block_draw(const bContext *C, uiBlock *block)
ui_fontscale(&style.widget.points, block->aspect);
/* scale block min/max to rect */
- ui_but_to_pixelrect(&rect, ar, block, NULL);
+ ui_but_to_pixelrect(&rect, region, block, NULL);
/* pixel space for AA widgets */
GPU_matrix_push_projection();
GPU_matrix_push();
GPU_matrix_identity_set();
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
/* back */
if (block->flag & UI_BLOCK_RADIAL) {
ui_draw_pie_center(block);
}
else if (block->flag & UI_BLOCK_POPOVER) {
- ui_draw_popover_back(ar, &style, block, &rect);
+ ui_draw_popover_back(region, &style, block, &rect);
}
else if (block->flag & UI_BLOCK_LOOP) {
ui_draw_menu_back(&style, block, &rect);
}
else if (block->panel) {
- bool show_background = ar->alignment != RGN_ALIGN_FLOAT;
+ bool show_background = region->alignment != RGN_ALIGN_FLOAT;
if (show_background) {
if (block->panel->type && (block->panel->type->flag & PNL_NO_HEADER)) {
- if (ar->regiontype == RGN_TYPE_TOOLS) {
+ if (region->regiontype == RGN_TYPE_TOOLS) {
/* We never want a background around active tools. */
show_background = false;
}
else {
/* Without a header there is no background except for region overlap. */
- show_background = ar->overlap != 0;
+ show_background = region->overlap != 0;
}
}
}
- ui_draw_aligned_panel(&style, block, &rect, UI_panel_category_is_visible(ar), show_background);
+ ui_draw_aligned_panel(
+ &style, block, &rect, UI_panel_category_is_visible(region), show_background);
}
BLF_batch_draw_begin();
@@ -1908,12 +1912,12 @@ void UI_block_draw(const bContext *C, uiBlock *block)
/* widgets */
for (but = block->buttons.first; but; but = but->next) {
if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) {
- ui_but_to_pixelrect(&rect, ar, block, but);
+ ui_but_to_pixelrect(&rect, region, block, but);
/* XXX: figure out why invalid coordinates happen when closing render window */
/* and material preview is redrawn in main window (temp fix for bug #23848) */
if (rect.xmin < rect.xmax && rect.ymin < rect.ymax) {
- ui_draw_but(C, ar, &style, but, &rect);
+ ui_draw_but(C, region, &style, but, &rect);
}
}
}
@@ -1927,7 +1931,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
GPU_matrix_pop();
}
-static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block)
+static void ui_block_message_subscribe(ARegion *region, struct wmMsgBus *mbus, uiBlock *block)
{
uiBut *but_prev = NULL;
/* possibly we should keep the region this block is contained in? */
@@ -1943,8 +1947,8 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo
&but->rnapoin,
but->rnaprop,
&(const wmMsgSubscribeValue){
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
},
__func__);
@@ -1954,10 +1958,10 @@ static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlo
}
}
-void UI_region_message_subscribe(ARegion *ar, struct wmMsgBus *mbus)
+void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus)
{
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
- ui_block_message_subscribe(ar, mbus, block);
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
+ ui_block_message_subscribe(region, mbus, block);
}
}
diff --git a/source/blender/editors/interface/interface_align.c b/source/blender/editors/interface/interface_align.c
index c058fefb4fa..09811fab52d 100644
--- a/source/blender/editors/interface/interface_align.c
+++ b/source/blender/editors/interface/interface_align.c
@@ -122,9 +122,9 @@ bool ui_but_can_align(const uiBut *but)
(BLI_rctf_size_y(&but->rect) > 0.0f));
}
-int ui_but_align_opposite_to_area_align_get(const ARegion *ar)
+int ui_but_align_opposite_to_area_align_get(const ARegion *region)
{
- switch (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment)) {
+ switch (RGN_ALIGN_ENUM_FROM_MASK(region->alignment)) {
case RGN_ALIGN_TOP:
return UI_BUT_ALIGN_DOWN;
case RGN_ALIGN_BOTTOM:
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index ae6a71f17e6..c9a46e00520 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -160,7 +160,7 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
shortcut_free_operator_property(prop);
}
-static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
+static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg)
{
wmWindowManager *wm = CTX_wm_manager(C);
uiBlock *block;
@@ -186,7 +186,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
UI_block_func_handle_set(block, but_shortcut_name_func, but);
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
UI_block_direction_set(block, UI_DIR_CENTER_Y);
@@ -216,7 +216,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
static int g_kmi_id_hack;
#endif
-static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
+static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg)
{
wmWindowManager *wm = CTX_wm_manager(C);
uiBlock *block;
@@ -248,7 +248,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
UI_block_func_handle_set(block, but_shortcut_name_func, but);
UI_block_direction_set(block, UI_DIR_CENTER_Y);
@@ -1194,22 +1194,22 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
/* Show header tools for header buttons. */
if (ui_block_is_popup_any(but->block) == false) {
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
- if (!ar) {
+ if (!region) {
/* skip */
}
- else if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ else if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL);
}
- else if (ar->regiontype == RGN_TYPE_NAV_BAR) {
+ else if (region->regiontype == RGN_TYPE_NAV_BAR) {
uiItemMenuF(layout,
IFACE_("Navigation Bar"),
ICON_NONE,
ED_screens_navigation_bar_tools_menu_create,
NULL);
}
- else if (ar->regiontype == RGN_TYPE_FOOTER) {
+ else if (region->regiontype == RGN_TYPE_FOOTER) {
uiItemMenuF(layout, IFACE_("Footer"), ICON_NONE, ED_screens_footer_tools_menu_create, NULL);
}
}
@@ -1231,10 +1231,10 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
/**
* menu to show when right clicking on the panel header
*/
-void ui_popup_context_menu_for_panel(bContext *C, ARegion *ar, Panel *pa)
+void ui_popup_context_menu_for_panel(bContext *C, ARegion *region, Panel *pa)
{
bScreen *sc = CTX_wm_screen(C);
- const bool has_panel_category = UI_panel_category_is_visible(ar);
+ const bool has_panel_category = UI_panel_category_is_visible(region);
const bool any_item_visible = has_panel_category;
PointerRNA ptr;
uiPopupMenu *pup;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index b6351ac74af..e8e74e77425 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -692,7 +692,7 @@ void ui_draw_but_TAB_outline(const rcti *rect,
immUnbindProgram();
}
-void ui_draw_but_IMAGE(ARegion *UNUSED(ar),
+void ui_draw_but_IMAGE(ARegion *UNUSED(region),
uiBut *but,
const uiWidgetColors *UNUSED(wcol),
const rcti *rect)
@@ -872,7 +872,7 @@ static void histogram_draw_one(float r,
#define HISTOGRAM_TOT_GRID_LINES 4
-void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar),
+void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
uiBut *but,
const uiWidgetColors *UNUSED(wcol),
const rcti *recti)
@@ -985,7 +985,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3])
GPU_batch_discard(batch);
}
-void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar),
+void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
uiBut *but,
const uiWidgetColors *UNUSED(wcol),
const rcti *recti)
@@ -1330,7 +1330,7 @@ static void vectorscope_draw_target(
immEnd();
}
-void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar),
+void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
uiBut *but,
const uiWidgetColors *UNUSED(wcol),
const rcti *recti)
@@ -1848,7 +1848,7 @@ static void gl_shaded_color(const uchar *color, int shade)
immUniformColor3ubv(color_shaded);
}
-void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
+void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
{
CurveMapping *cumap;
@@ -1889,7 +1889,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
.xmax = rect->xmax,
.ymax = rect->ymax,
};
- rcti scissor_region = {0, ar->winx, 0, ar->winy};
+ rcti scissor_region = {0, region->winx, 0, region->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
GPU_scissor(scissor_new.xmin,
scissor_new.ymin,
@@ -2124,7 +2124,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
}
/** Used to draw a curve profile widget. Somewhat similar to ui_draw_but_CURVE */
-void ui_draw_but_CURVEPROFILE(ARegion *ar,
+void ui_draw_but_CURVEPROFILE(ARegion *region,
uiBut *but,
const uiWidgetColors *wcol,
const rcti *rect)
@@ -2159,7 +2159,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *ar,
.xmax = rect->xmax,
.ymax = rect->ymax,
};
- rcti scissor_region = {0, ar->winx, 0, ar->winy};
+ rcti scissor_region = {0, region->winx, 0, region->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
GPU_scissor(scissor_new.xmin,
scissor_new.ymin,
@@ -2348,7 +2348,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *ar,
immUnbindProgram();
}
-void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar),
+void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
uiBut *but,
const uiWidgetColors *UNUSED(wcol),
const rcti *recti)
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 988dea270f5..cb7868d2988 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -106,7 +106,7 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf)
/** \name Generic Shared Functions
* \{ */
-void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, const char *name)
+void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *region, const char *name)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
wmWindow *win = CTX_wm_window(C);
@@ -115,12 +115,12 @@ void eyedropper_draw_cursor_text(const struct bContext *C, const ARegion *ar, co
const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
- if ((name[0] == '\0') || (BLI_rcti_isect_pt(&ar->winrct, x, y) == false)) {
+ if ((name[0] == '\0') || (BLI_rcti_isect_pt(&region->winrct, x, y) == false)) {
return;
}
- x = x - ar->winrct.xmin;
- y = y - ar->winrct.ymin;
+ x = x - region->winrct.xmin;
+ y = y - region->winrct.ymin;
y += U.widget_unit;
@@ -140,9 +140,9 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y);
- ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y);
+ ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_ANY, event->x, event->y);
- uiBut *but = ui_but_find_mouse_over(ar, event);
+ uiBut *but = ui_but_find_mouse_over(region, event);
if (ELEM(NULL, but, but->rnapoin.data, but->rnaprop)) {
return NULL;
diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c
index 2b5cf2ed6b9..0dabe453ce4 100644
--- a/source/blender/editors/interface/interface_eyedropper_color.c
+++ b/source/blender/editors/interface/interface_eyedropper_color.c
@@ -143,34 +143,34 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3])
if (sa) {
if (sa->spacetype == SPACE_IMAGE) {
- ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
- if (ar) {
+ ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
+ if (region) {
SpaceImage *sima = sa->spacedata.first;
- int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
+ int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
- if (ED_space_image_color_sample(sima, ar, mval, r_col)) {
+ if (ED_space_image_color_sample(sima, region, mval, r_col)) {
return;
}
}
}
else if (sa->spacetype == SPACE_NODE) {
- ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
- if (ar) {
+ ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
+ if (region) {
SpaceNode *snode = sa->spacedata.first;
- int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
+ int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
- if (ED_space_node_color_sample(bmain, snode, ar, mval, r_col)) {
+ if (ED_space_node_color_sample(bmain, snode, region, mval, r_col)) {
return;
}
}
}
else if (sa->spacetype == SPACE_CLIP) {
- ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
- if (ar) {
+ ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
+ if (region) {
SpaceClip *sc = sa->spacedata.first;
- int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
+ int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
- if (ED_space_clip_color_sample(sc, ar, mval, r_col)) {
+ if (ED_space_clip_color_sample(sc, region, mval, r_col)) {
return;
}
}
diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c
index 0220f3f5afd..5cf1a21d09c 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -74,10 +74,10 @@ typedef struct DataDropper {
char name[200];
} DataDropper;
-static void datadropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg)
+static void datadropper_draw_cb(const struct bContext *C, ARegion *region, void *arg)
{
DataDropper *ddr = arg;
- eyedropper_draw_cursor_text(C, ar, ddr->name);
+ eyedropper_draw_cursor_text(C, region, ddr->name);
}
static int datadropper_init(bContext *C, wmOperator *op)
@@ -161,16 +161,16 @@ static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int
if (sa) {
if (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_OUTLINER)) {
- ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
- if (ar) {
- const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
+ ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
+ if (region) {
+ const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
Base *base;
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
/* grr, always draw else we leave stale text */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (sa->spacetype == SPACE_VIEW3D) {
base = ED_view3d_give_base_under_cursor(C, mval);
@@ -259,8 +259,8 @@ static void datadropper_set_draw_callback_region(bContext *C,
ED_region_draw_cb_exit(ddr->art, ddr->draw_handle_pixel);
/* Redraw old area */
- ARegion *ar = BKE_area_find_region_type(ddr->cursor_area, RGN_TYPE_WINDOW);
- ED_region_tag_redraw(ar);
+ ARegion *region = BKE_area_find_region_type(ddr->cursor_area, RGN_TYPE_WINDOW);
+ ED_region_tag_redraw(region);
/* Set draw callback in new region */
ARegionType *art = BKE_regiontype_from_id(sa->type, RGN_TYPE_WINDOW);
diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c
index 8a48ca19db2..15a9d2d9f50 100644
--- a/source/blender/editors/interface/interface_eyedropper_depth.c
+++ b/source/blender/editors/interface/interface_eyedropper_depth.c
@@ -77,10 +77,10 @@ typedef struct DepthDropper {
char name[200];
} DepthDropper;
-static void depthdropper_draw_cb(const struct bContext *C, ARegion *ar, void *arg)
+static void depthdropper_draw_cb(const struct bContext *C, ARegion *region, void *arg)
{
DepthDropper *ddr = arg;
- eyedropper_draw_cursor_text(C, ar, ddr->name);
+ eyedropper_draw_cursor_text(C, region, ddr->name);
}
static int depthdropper_init(bContext *C, wmOperator *op)
@@ -166,30 +166,30 @@ static void depthdropper_depth_sample_pt(
if (sa) {
if (sa->spacetype == SPACE_VIEW3D) {
- ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
- if (ar) {
+ ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
+ if (region) {
struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
View3D *v3d = sa->spacedata.first;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* weak, we could pass in some reference point */
const float *view_co = v3d->camera ? v3d->camera->obmat[3] : rv3d->viewinv[3];
- const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
+ const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
float co[3];
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
/* grr, always draw else we leave stale text */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
view3d_operator_needs_opengl(C);
- if (ED_view3d_autodist(depsgraph, ar, v3d, mval, co, true, NULL)) {
- const float mval_center_fl[2] = {(float)ar->winx / 2, (float)ar->winy / 2};
+ if (ED_view3d_autodist(depsgraph, region, v3d, mval, co, true, NULL)) {
+ const float mval_center_fl[2] = {(float)region->winx / 2, (float)region->winy / 2};
float co_align[3];
/* quick way to get view-center aligned point */
- ED_view3d_win_to_3d(v3d, ar, co, mval_center_fl, co_align);
+ ED_view3d_win_to_3d(v3d, region, co, mval_center_fl, co_align);
*r_depth = len_v3v3(view_co, co_align);
diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h
index d9ec0657bfe..cabf997b725 100644
--- a/source/blender/editors/interface/interface_eyedropper_intern.h
+++ b/source/blender/editors/interface/interface_eyedropper_intern.h
@@ -25,7 +25,7 @@
/* interface_eyedropper.c */
void eyedropper_draw_cursor_text(const struct bContext *C,
- const struct ARegion *ar,
+ const struct ARegion *region,
const char *name);
uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *event);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index cf736d65596..e2909af47f3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -425,13 +425,16 @@ typedef struct uiAfterFunc {
char undostr[BKE_UNDO_STR_MAX];
} uiAfterFunc;
-static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
+static void button_activate_init(bContext *C,
+ ARegion *region,
+ uiBut *but,
+ uiButtonActivateType type);
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
static void button_activate_exit(
bContext *C, uiBut *but, uiHandleButtonData *data, const bool mousemove, const bool onfree);
static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *userdata);
static void ui_handle_button_activate(bContext *C,
- ARegion *ar,
+ ARegion *region,
uiBut *but,
uiButtonActivateType type);
@@ -1275,7 +1278,7 @@ static void ui_multibut_states_create(uiBut *but_active, uiHandleButtonData *dat
static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBlock *block)
{
- ARegion *ar = data->region;
+ ARegion *region = data->region;
const double value_delta = data->value - data->origvalue;
const double value_scale = data->multi_data.is_proportional ? (data->value / data->origvalue) :
0.0;
@@ -1292,7 +1295,7 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl
if (mbut_state) {
void *active_back;
- ui_but_execute_begin(C, ar, but, &active_back);
+ ui_but_execute_begin(C, region, but, &active_back);
# ifdef USE_ALLSELECT
if (data->select_others.is_enabled) {
@@ -1330,7 +1333,7 @@ static void ui_multibut_states_apply(bContext *C, uiHandleButtonData *data, uiBl
/* clamp based on soft limits, see: T40154 */
CLAMP(but->active->value, (double)but->softmin, (double)but->softmax);
}
- ui_but_execute_end(C, ar, but, active_back);
+ ui_but_execute_end(C, region, but, active_back);
}
else {
/* highly unlikely */
@@ -1406,21 +1409,21 @@ typedef struct uiDragToggleHandle {
} uiDragToggleHandle;
static bool ui_drag_toggle_set_xy_xy(
- bContext *C, ARegion *ar, const int pushed_state, const int xy_src[2], const int xy_dst[2])
+ bContext *C, ARegion *region, const int pushed_state, const int xy_src[2], const int xy_dst[2])
{
/* popups such as layers won't re-evaluate on redraw */
- const bool do_check = (ar->regiontype == RGN_TYPE_TEMPORARY);
+ const bool do_check = (region->regiontype == RGN_TYPE_TEMPORARY);
bool changed = false;
uiBlock *block;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
uiBut *but;
float xy_a_block[2] = {UNPACK2(xy_src)};
float xy_b_block[2] = {UNPACK2(xy_dst)};
- ui_window_to_block_fl(ar, block, &xy_a_block[0], &xy_a_block[1]);
- ui_window_to_block_fl(ar, block, &xy_b_block[0], &xy_b_block[1]);
+ ui_window_to_block_fl(region, block, &xy_a_block[0], &xy_a_block[1]);
+ ui_window_to_block_fl(region, block, &xy_b_block[0], &xy_b_block[1]);
for (but = block->buttons.first; but; but = but->next) {
/* Note: ctrl is always true here because (at least for now)
@@ -1433,7 +1436,7 @@ static bool ui_drag_toggle_set_xy_xy(
/* is it pressed? */
int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but);
if (pushed_state_but != pushed_state) {
- UI_but_execute(C, ar, but);
+ UI_but_execute(C, region, but);
if (do_check) {
ui_but_update_edited(but);
}
@@ -1458,7 +1461,7 @@ static bool ui_drag_toggle_set_xy_xy(
static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const int xy_input[2])
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bool do_draw = false;
int xy[2];
@@ -1470,7 +1473,7 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
*/
if (drag_info->is_xy_lock_init == false) {
/* first store the buttons original coords */
- uiBut *but = ui_but_find_mouse_over_ex(ar, xy_input[0], xy_input[1], true);
+ uiBut *but = ui_but_find_mouse_over_ex(region, xy_input[0], xy_input[1], true);
if (but) {
if (but->flag & UI_BUT_DRAG_LOCK) {
@@ -1503,10 +1506,10 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
xy[1] = (drag_info->xy_lock[1] == false) ? xy_input[1] : drag_info->xy_last[1];
/* touch all buttons between last mouse coord and this one */
- do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->pushed_state, drag_info->xy_last, xy);
+ do_draw = ui_drag_toggle_set_xy_xy(C, region, drag_info->pushed_state, drag_info->xy_last, xy);
if (do_draw) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
copy_v2_v2_int(drag_info->xy_last, xy);
@@ -1538,8 +1541,9 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
if (done) {
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
- uiBut *but = ui_but_find_mouse_over_ex(ar, drag_info->xy_init[0], drag_info->xy_init[1], true);
+ ARegion *region = CTX_wm_region(C);
+ uiBut *but = ui_but_find_mouse_over_ex(
+ region, drag_info->xy_init[0], drag_info->xy_init[1], true);
if (but) {
ui_apply_but_undo(but);
@@ -4068,8 +4072,8 @@ static uiBut *ui_but_list_row_text_activate(bContext *C,
const wmEvent *event,
uiButtonActivateType activate_type)
{
- ARegion *ar = CTX_wm_region(C);
- uiBut *labelbut = ui_but_find_mouse_over_ex(ar, event->x, event->y, true);
+ ARegion *region = CTX_wm_region(C);
+ uiBut *labelbut = ui_but_find_mouse_over_ex(region, event->x, event->y, true);
if (labelbut && labelbut->type == UI_BTYPE_TEXT && !(labelbut->flag & UI_BUT_DISABLED)) {
/* exit listrow */
@@ -4077,7 +4081,7 @@ static uiBut *ui_but_list_row_text_activate(bContext *C,
button_activate_exit(C, but, data, false, false);
/* Activate the text button. */
- button_activate_init(C, ar, labelbut, activate_type);
+ button_activate_init(C, region, labelbut, activate_type);
return labelbut;
}
@@ -4450,20 +4454,20 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, cons
if (but_select) {
uiBut *but_other = (direction == -1) ? but_select->next : but_select->prev;
if (but_other && ui_but_find_select_in_enum__cmp(but, but_other)) {
- ARegion *ar = data->region;
+ ARegion *region = data->region;
data->cancel = true;
button_activate_exit(C, but, data, false, false);
/* Activate the text button. */
- button_activate_init(C, ar, but_other, BUTTON_ACTIVATE_OVER);
+ button_activate_init(C, region, but_other, BUTTON_ACTIVATE_OVER);
data = but_other->active;
if (data) {
ui_apply_but(C, but->block, but_other, but_other->active, true);
button_activate_exit(C, but_other, data, false, false);
/* restore active button */
- button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
}
else {
/* shouldn't happen */
@@ -7657,17 +7661,17 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
/** \name Button Tool Tip
* \{ */
-static void ui_blocks_set_tooltips(ARegion *ar, const bool enable)
+static void ui_blocks_set_tooltips(ARegion *region, const bool enable)
{
uiBlock *block;
- if (!ar) {
+ if (!region) {
return;
}
/* we disabled buttons when when they were already shown, and
* re-enable them on mouse move */
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
block->tooltipdisabled = !enable;
}
}
@@ -7708,7 +7712,7 @@ void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
}
static ARegion *ui_but_tooltip_init(
- bContext *C, ARegion *ar, int *pass, double *r_pass_delay, bool *r_exit_on_event)
+ bContext *C, ARegion *region, int *pass, double *r_pass_delay, bool *r_exit_on_event)
{
bool is_label = false;
if (*pass == 1) {
@@ -7717,10 +7721,10 @@ static ARegion *ui_but_tooltip_init(
(*r_pass_delay) = UI_TOOLTIP_DELAY - UI_TOOLTIP_DELAY_LABEL;
}
- uiBut *but = UI_region_active_but_get(ar);
+ uiBut *but = UI_region_active_but_get(region);
*r_exit_on_event = false;
if (but) {
- return UI_tooltip_create_from_button(C, ar, but, is_label);
+ return UI_tooltip_create_from_button(C, region, but, is_label);
}
return NULL;
}
@@ -7936,7 +7940,10 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
ED_region_tag_redraw(data->region);
}
-static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type)
+static void button_activate_init(bContext *C,
+ ARegion *region,
+ uiBut *but,
+ uiButtonActivateType type)
{
uiHandleButtonData *data;
@@ -7945,8 +7952,8 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data->wm = CTX_wm_manager(C);
data->window = CTX_wm_window(C);
data->area = CTX_wm_area(C);
- BLI_assert(ar != NULL);
- data->region = ar;
+ BLI_assert(region != NULL);
+ data->region = region;
#ifdef USE_CONT_MOUSE_CORRECT
copy_v2_fl(data->ungrab_mval, FLT_MAX);
@@ -8027,7 +8034,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
/* Show a label for this button. */
bScreen *sc = WM_window_get_active_screen(data->window);
if ((PIL_check_seconds_timer() - WM_tooltip_time_closed()) < 0.1) {
- WM_tooltip_immediate_init(C, CTX_wm_window(C), data->area, ar, ui_but_tooltip_init);
+ WM_tooltip_immediate_init(C, CTX_wm_window(C), data->area, region, ui_but_tooltip_init);
if (sc->tool_tip) {
sc->tool_tip->pass = 1;
}
@@ -8179,16 +8186,16 @@ void ui_but_active_free(const bContext *C, uiBut *but)
}
/* returns the active button with an optional checking function */
-static uiBut *ui_context_button_active(ARegion *ar, bool (*but_check_cb)(uiBut *))
+static uiBut *ui_context_button_active(ARegion *region, bool (*but_check_cb)(uiBut *))
{
uiBut *but_found = NULL;
- while (ar) {
+ while (region) {
uiBlock *block;
uiBut *but, *activebut = NULL;
/* find active button */
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
if (but->active) {
activebut = but;
@@ -8205,8 +8212,8 @@ static uiBut *ui_context_button_active(ARegion *ar, bool (*but_check_cb)(uiBut *
but_found = activebut;
/* recurse into opened menu, like colorpicker case */
- if (data && data->menu && (ar != data->menu->region)) {
- ar = data->menu->region;
+ if (data && data->menu && (region != data->menu->region)) {
+ region = data->menu->region;
}
else {
return but_found;
@@ -8235,14 +8242,14 @@ uiBut *UI_context_active_but_get(const struct bContext *C)
return ui_context_button_active(CTX_wm_region(C), NULL);
}
-uiBut *UI_region_active_but_get(ARegion *ar)
+uiBut *UI_region_active_but_get(ARegion *region)
{
- return ui_context_button_active(ar, NULL);
+ return ui_context_button_active(region, NULL);
}
-uiBut *UI_region_but_find_rect_over(const ARegion *ar, const rcti *rect_px)
+uiBut *UI_region_but_find_rect_over(const ARegion *region, const rcti *rect_px)
{
- return ui_but_find_rect_over(ar, rect_px);
+ return ui_but_find_rect_over(region, rect_px);
}
/**
@@ -8306,13 +8313,13 @@ wmOperator *UI_context_active_operator_get(const struct bContext *C)
/* scan popups */
{
bScreen *sc = CTX_wm_screen(C);
- ARegion *ar;
+ ARegion *region;
- for (ar = sc->regionbase.first; ar; ar = ar->next) {
- if (ar == ar_ctx) {
+ for (region = sc->regionbase.first; region; region = region->next) {
+ if (region == ar_ctx) {
continue;
}
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
if (block->ui_operator) {
return block->ui_operator;
}
@@ -8327,15 +8334,15 @@ wmOperator *UI_context_active_operator_get(const struct bContext *C)
void UI_context_update_anim_flag(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
uiBlock *block;
uiBut *but, *activebut;
- while (ar) {
+ while (region) {
/* find active button */
activebut = NULL;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
ui_but_override_flag(but);
@@ -8343,7 +8350,7 @@ void UI_context_update_anim_flag(const bContext *C)
ui_but_anim_decorate_update_from_flag(but);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (but->active) {
activebut = but;
@@ -8358,7 +8365,7 @@ void UI_context_update_anim_flag(const bContext *C)
/* always recurse into opened menu, so all buttons update (like colorpicker) */
uiHandleButtonData *data = activebut->active;
if (data && data->menu) {
- ar = data->menu->region;
+ region = data->menu->region;
}
else {
return;
@@ -8377,12 +8384,12 @@ void UI_context_update_anim_flag(const bContext *C)
/** \name Button Activation Handling
* \{ */
-static uiBut *ui_but_find_open_event(ARegion *ar, const wmEvent *event)
+static uiBut *ui_but_find_open_event(ARegion *region, const wmEvent *event)
{
uiBlock *block;
uiBut *but;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
if (but == event->customdata) {
return but;
@@ -8392,14 +8399,14 @@ static uiBut *ui_but_find_open_event(ARegion *ar, const wmEvent *event)
return NULL;
}
-static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
+static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *region)
{
uiBut *but;
if (event->type == MOUSEMOVE) {
- but = ui_but_find_mouse_over(ar, event);
+ but = ui_but_find_mouse_over(region, event);
if (but) {
- button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
if (event->alt && but->active) {
/* display tooltips if holding alt on mouseover when tooltips are off in prefs */
@@ -8408,9 +8415,9 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
}
}
else if (event->type == EVT_BUT_OPEN) {
- but = ui_but_find_open_event(ar, event);
+ but = ui_but_find_open_event(region, event);
if (but) {
- button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
ui_do_button(C, but->block, but, event);
}
}
@@ -8419,12 +8426,12 @@ static int ui_handle_button_over(bContext *C, const wmEvent *event, ARegion *ar)
}
/* exported to interface.c: UI_but_active_only() */
-void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but)
+void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but)
{
wmWindow *win = CTX_wm_window(C);
wmEvent event;
- button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
wm_event_init_from_window(win, &event);
event.type = EVT_BUT_OPEN;
@@ -8433,7 +8440,7 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but)
event.customdatafree = false;
ARegion *ar_ctx = CTX_wm_region(C);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
ui_do_button(C, but->block, but, &event);
CTX_wm_region_set(C, ar_ctx);
}
@@ -8444,30 +8451,30 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but)
* exported so menus can start with a highlighted button,
* even if the mouse isnt over it
*/
-void ui_but_activate_over(bContext *C, ARegion *ar, uiBut *but)
+void ui_but_activate_over(bContext *C, ARegion *region, uiBut *but)
{
- button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
}
void ui_but_execute_begin(struct bContext *UNUSED(C),
- struct ARegion *ar,
+ struct ARegion *region,
uiBut *but,
void **active_back)
{
- BLI_assert(ar != NULL);
- BLI_assert(BLI_findindex(&ar->uiblocks, but->block) != -1);
+ BLI_assert(region != NULL);
+ BLI_assert(BLI_findindex(&region->uiblocks, but->block) != -1);
/* note: ideally we would not have to change 'but->active' however
* some functions we call don't use data (as they should be doing) */
uiHandleButtonData *data;
*active_back = but->active;
data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData_Fake");
but->active = data;
- BLI_assert(ar != NULL);
- data->region = ar;
+ BLI_assert(region != NULL);
+ data->region = region;
}
void ui_but_execute_end(struct bContext *C,
- struct ARegion *UNUSED(ar),
+ struct ARegion *UNUSED(region),
uiBut *but,
void *active_back)
{
@@ -8482,39 +8489,39 @@ void ui_but_execute_end(struct bContext *C,
}
static void ui_handle_button_activate(bContext *C,
- ARegion *ar,
+ ARegion *region,
uiBut *but,
uiButtonActivateType type)
{
uiBut *oldbut;
uiHandleButtonData *data;
- oldbut = ui_region_find_active_but(ar);
+ oldbut = ui_region_find_active_but(region);
if (oldbut) {
data = oldbut->active;
data->cancel = true;
button_activate_exit(C, oldbut, data, false, false);
}
- button_activate_init(C, ar, but, type);
+ button_activate_init(C, region, but, type);
}
/**
* Use for key accelerator or default key to activate the button even if its not active.
*/
-static bool ui_handle_button_activate_by_type(bContext *C, ARegion *ar, uiBut *but)
+static bool ui_handle_button_activate_by_type(bContext *C, ARegion *region, uiBut *but)
{
if (but->type == UI_BTYPE_BUT_MENU) {
/* mainly for operator buttons */
- ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
+ ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_APPLY);
}
else if (ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) {
/* open sub-menus (like right arrow key) */
- ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
+ ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_OPEN);
}
else if (but->type == UI_BTYPE_MENU) {
/* activate menu items */
- ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
+ ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE);
}
else {
#ifdef DEBUG
@@ -8569,11 +8576,11 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
uiHandleButtonData *data = but->active;
const uiHandleButtonState state_orig = data->state;
uiBlock *block;
- ARegion *ar;
+ ARegion *region;
int retval;
block = but->block;
- ar = data->region;
+ region = data->region;
retval = WM_UI_HANDLER_CONTINUE;
@@ -8600,7 +8607,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
block->handle->menuretval = UI_RETURN_CANCEL;
}
else if (ui_but_is_editable_as_text(but)) {
- ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_TEXT_EDITING);
+ ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_TEXT_EDITING);
retval = WM_UI_HANDLER_BREAK;
}
}
@@ -8610,13 +8617,13 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
#endif
case MOUSEMOVE: {
- uiBut *but_other = ui_but_find_mouse_over(ar, event);
+ uiBut *but_other = ui_but_find_mouse_over(region, event);
bool exit = false;
/* always deactivate button for pie menus,
* else moving to blank space will leave activated */
if ((!ui_block_is_menu(block) || ui_block_is_pie_menu(block)) &&
- !ui_but_contains_point_px(but, ar, event->x, event->y)) {
+ !ui_but_contains_point_px(but, region, event->x, event->y)) {
exit = true;
}
else if (but_other && ui_but_is_editable(but_other) && (but_other != but)) {
@@ -8629,7 +8636,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
else if (event->x != event->prevx || event->y != event->prevy) {
/* re-enable tooltip on mouse move */
- ui_blocks_set_tooltips(ar, true);
+ ui_blocks_set_tooltips(region, true);
button_tooltip_timer_reset(C, but);
}
@@ -8641,7 +8648,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
data->autoopentimer = NULL;
- if (ui_but_contains_point_px(but, ar, event->x, event->y) || but->active) {
+ if (ui_but_contains_point_px(but, region, event->x, event->y) || but->active) {
button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
}
}
@@ -8691,7 +8698,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
case MOUSEMOVE: {
/* deselect the button when moving the mouse away */
/* also de-activate for buttons that only show highlights */
- if (ui_but_contains_point_px(but, ar, event->x, event->y)) {
+ if (ui_but_contains_point_px(but, region, event->x, event->y)) {
/* Drag on a hold button (used in the toolbar) now opens it immediately. */
if (data->hold_action_timer) {
@@ -8754,7 +8761,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
}
- bt = ui_but_find_mouse_over(ar, event);
+ bt = ui_but_find_mouse_over(region, event);
if (bt && bt->active != data) {
if (but->type != UI_BTYPE_COLOR) { /* exception */
@@ -8766,7 +8773,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
}
case RIGHTMOUSE: {
if (event->val == KM_PRESS) {
- uiBut *bt = ui_but_find_mouse_over(ar, event);
+ uiBut *bt = ui_but_find_mouse_over(region, event);
if (bt && bt->active == data) {
button_activate_state(C, bt, BUTTON_STATE_HIGHLIGHT);
}
@@ -8815,7 +8822,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
/* for jumping to the next button with tab while text editing */
if (post_but) {
- button_activate_init(C, ar, post_but, post_type);
+ button_activate_init(C, region, post_but, post_type);
}
else {
/* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable,
@@ -8825,8 +8832,8 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
* it stays active while the mouse is over it.
* This avoids adding mousemoves, see: [#33466] */
if (ELEM(state_orig, BUTTON_STATE_INIT, BUTTON_STATE_HIGHLIGHT)) {
- if (ui_but_find_mouse_over(ar, event) == but) {
- button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ if (ui_but_find_mouse_over(region, event) == but) {
+ button_activate_init(C, region, but, BUTTON_ACTIVATE_OVER);
}
}
}
@@ -8835,7 +8842,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
return retval;
}
-static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar, uiBut *listbox)
+static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *region, uiBut *listbox)
{
uiList *ui_list;
uiListDyn *dyn_data;
@@ -8852,7 +8859,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
mx = event->x;
my = event->y;
- ui_window_to_block(ar, listbox->block, &mx, &my);
+ ui_window_to_block(region, listbox->block, &mx, &my);
/* convert pan to scrollwheel */
if (type == MOUSEPAN) {
@@ -8960,8 +8967,8 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
}
if (redraw) {
- ED_region_tag_redraw(ar);
- ED_region_tag_refresh_ui(ar);
+ ED_region_tag_redraw(region);
+ ED_region_tag_refresh_ui(region);
}
return retval;
@@ -9089,13 +9096,13 @@ static bool ui_mouse_motion_towards_check(uiBlock *block,
* if this causes problems we could remove it and check on a different fix - campbell */
if (menu->region->next) {
/* am I the last menu (test) */
- ARegion *ar = menu->region->next;
+ ARegion *region = menu->region->next;
do {
- uiBlock *block_iter = ar->uiblocks.first;
+ uiBlock *block_iter = region->uiblocks.first;
if (block_iter && ui_block_is_menu(block_iter)) {
return true;
}
- } while ((ar = ar->next));
+ } while ((region = region->next));
}
/* annoying fix end! */
@@ -9194,7 +9201,7 @@ static char ui_menu_scroll_test(uiBlock *block, int my)
return 0;
}
-static void ui_menu_scroll_apply_offset_y(ARegion *ar, uiBlock *block, float dy)
+static void ui_menu_scroll_apply_offset_y(ARegion *region, uiBlock *block, float dy)
{
BLI_assert(dy != 0.0f);
@@ -9233,11 +9240,11 @@ static void ui_menu_scroll_apply_offset_y(ARegion *ar, uiBlock *block, float dy)
/* set flags again */
ui_popup_block_scrolltest(block);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
/** Scroll to activated button. */
-static bool ui_menu_scroll_to_but(ARegion *ar, uiBlock *block, uiBut *but_target)
+static bool ui_menu_scroll_to_but(ARegion *region, uiBlock *block, uiBut *but_target)
{
float dy = 0.0;
if (block->flag & UI_BLOCK_CLIPTOP) {
@@ -9251,14 +9258,14 @@ static bool ui_menu_scroll_to_but(ARegion *ar, uiBlock *block, uiBut *but_target
}
}
if (dy != 0.0f) {
- ui_menu_scroll_apply_offset_y(ar, block, dy);
+ ui_menu_scroll_apply_offset_y(region, block, dy);
return true;
}
return false;
}
/** Scroll to y location (in block space, see #ui_window_to_block). */
-static bool ui_menu_scroll_to_y(ARegion *ar, uiBlock *block, int y)
+static bool ui_menu_scroll_to_y(ARegion *region, uiBlock *block, int y)
{
const char test = ui_menu_scroll_test(block, y);
float dy = 0.0f;
@@ -9269,13 +9276,13 @@ static bool ui_menu_scroll_to_y(ARegion *ar, uiBlock *block, int y)
dy = UI_UNIT_Y; /* scroll to the bottom */
}
if (dy != 0.0f) {
- ui_menu_scroll_apply_offset_y(ar, block, dy);
+ ui_menu_scroll_apply_offset_y(region, block, dy);
return true;
}
return false;
}
-static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_dir)
+static bool ui_menu_scroll_step(ARegion *region, uiBlock *block, const int scroll_dir)
{
int my;
if (scroll_dir == 1) {
@@ -9295,7 +9302,7 @@ static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_di
return false;
}
- return ui_menu_scroll_to_y(ar, block, my);
+ return ui_menu_scroll_to_y(region, block, my);
}
/** \} */
@@ -9304,9 +9311,9 @@ static bool ui_menu_scroll_step(ARegion *ar, uiBlock *block, const int scroll_di
/** \name Menu Event Handling
* \{ */
-static void ui_region_auto_open_clear(ARegion *ar)
+static void ui_region_auto_open_clear(ARegion *region)
{
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
block->auto_open = false;
}
}
@@ -9338,8 +9345,8 @@ static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu,
static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
{
- ARegion *ar = menu->region;
- uiBut *but = ui_region_find_active_but(ar);
+ ARegion *region = menu->region;
+ uiBut *but = ui_region_find_active_but(region);
int retval;
if (but) {
@@ -9384,7 +9391,7 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock
}
}
else {
- retval = ui_handle_button_over(C, event, ar);
+ retval = ui_handle_button_over(C, event, region);
}
return retval;
@@ -9425,28 +9432,28 @@ static int ui_handle_menu_event(bContext *C,
const bool is_parent_menu,
const bool is_floating)
{
- ARegion *ar;
+ ARegion *region;
uiBlock *block;
uiBut *but;
int mx, my, retval;
bool inside;
bool inside_title; /* check for title dragging */
- ar = menu->region;
- block = ar->uiblocks.first;
+ region = menu->region;
+ block = region->uiblocks.first;
retval = WM_UI_HANDLER_CONTINUE;
mx = event->x;
my = event->y;
- ui_window_to_block(ar, block, &mx, &my);
+ ui_window_to_block(region, block, &mx, &my);
/* check if mouse is inside block */
inside = BLI_rctf_isect_pt(&block->rect, mx, my);
inside_title = inside && ((my + (UI_UNIT_Y * 1.5f)) > block->rect.ymax);
/* if there's an active modal button, don't check events or outside, except for search menu */
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
#ifdef USE_DRAG_POPUP
if (menu->is_grab) {
@@ -9463,7 +9470,7 @@ static int ui_handle_menu_event(bContext *C,
add_v2_v2v2_int(menu->popup_create_vars.event_xy, menu->popup_create_vars.event_xy, mdiff);
- ui_popup_translate(ar, mdiff);
+ ui_popup_translate(region, mdiff);
}
return retval;
@@ -9481,7 +9488,7 @@ static int ui_handle_menu_event(bContext *C,
}
else if (event->type == TIMER) {
if (event->customdata == menu->scrolltimer) {
- ui_menu_scroll_to_y(ar, block, my);
+ ui_menu_scroll_to_y(region, block, my);
}
}
else {
@@ -9550,7 +9557,7 @@ static int ui_handle_menu_event(bContext *C,
break;
}
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
if (!but) {
/* no item active, we make first active */
@@ -9563,7 +9570,7 @@ static int ui_handle_menu_event(bContext *C,
}
if (but && ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) {
- ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
+ ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE_OPEN);
}
}
@@ -9587,7 +9594,7 @@ static int ui_handle_menu_event(bContext *C,
if (type != MOUSEPAN) {
const int scroll_dir = (type == WHEELUPMOUSE) ? 1 : -1;
- if (ui_menu_scroll_step(ar, block, scroll_dir)) {
+ if (ui_menu_scroll_step(region, block, scroll_dir)) {
if (but) {
but->active->cancel = true;
button_activate_exit(C, but, but->active, false, false);
@@ -9644,7 +9651,7 @@ static int ui_handle_menu_event(bContext *C,
ui_mouse_motion_keynav_init(&menu->keynav_state, event);
#endif
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
if (but) {
/* Apply scroll operation. */
if (scrolltype == MENU_SCROLL_DOWN) {
@@ -9668,8 +9675,8 @@ static int ui_handle_menu_event(bContext *C,
}
if (but) {
- ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
- ui_menu_scroll_to_but(ar, block, but);
+ ui_handle_button_activate(C, region, but, BUTTON_ACTIVATE);
+ ui_menu_scroll_to_but(region, block, but);
}
}
@@ -9782,7 +9789,7 @@ static int ui_handle_menu_event(bContext *C,
activate = BUTTON_ACTIVATE_APPLY;
}
- ui_handle_button_activate(C, ar, but, activate);
+ ui_handle_button_activate(C, region, but, activate);
break;
}
}
@@ -9827,10 +9834,10 @@ static int ui_handle_menu_event(bContext *C,
for (but = block->buttons.first; but; but = but->next) {
if (!(but->flag & UI_BUT_DISABLED) && but->menu_key == event->type) {
if (but->type == UI_BTYPE_BUT) {
- UI_but_execute(C, ar, but);
+ UI_but_execute(C, region, but);
}
else {
- ui_handle_button_activate_by_type(C, ar, but);
+ ui_handle_button_activate_by_type(C, region, but);
}
break;
}
@@ -9905,17 +9912,17 @@ static int ui_handle_menu_event(bContext *C,
}
else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) {
uiBut *but_default = ui_region_find_first_but_test_flag(
- ar, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN);
+ region, UI_BUT_ACTIVE_DEFAULT, UI_HIDDEN);
if ((but_default != NULL) && (but_default->active == NULL)) {
if (but_default->type == UI_BTYPE_BUT) {
- UI_but_execute(C, ar, but_default);
+ UI_but_execute(C, region, but_default);
}
else {
- ui_handle_button_activate_by_type(C, ar, but_default);
+ ui_handle_button_activate_by_type(C, region, but_default);
}
}
else {
- uiBut *but_active = ui_region_find_active_but(ar);
+ uiBut *but_active = ui_region_find_active_but(region);
/* enter will always close this block, we let the event
* get handled by the button if it is activated, otherwise we cancel */
@@ -9927,7 +9934,7 @@ static int ui_handle_menu_event(bContext *C,
#ifdef USE_DRAG_POPUP
else if ((event->type == LEFTMOUSE) && (event->val == KM_PRESS) &&
(inside && is_floating && inside_title)) {
- if (!but || !ui_but_contains_point_px(but, ar, event->x, event->y)) {
+ if (!but || !ui_but_contains_point_px(but, region, event->x, event->y)) {
if (but) {
UI_but_tooltip_timer_remove(C, but);
}
@@ -10022,16 +10029,16 @@ static int ui_handle_menu_return_submenu(bContext *C,
const wmEvent *event,
uiPopupBlockHandle *menu)
{
- ARegion *ar;
+ ARegion *region;
uiBut *but;
uiBlock *block;
uiHandleButtonData *data;
uiPopupBlockHandle *submenu;
- ar = menu->region;
- block = ar->uiblocks.first;
+ region = menu->region;
+ block = region->uiblocks.first;
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
BLI_assert(but);
@@ -10155,7 +10162,7 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl
static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
{
- ARegion *ar;
+ ARegion *region;
uiBlock *block;
uiBut *but;
float event_xy[2];
@@ -10173,13 +10180,13 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
retval = WM_UI_HANDLER_CONTINUE;
}
- ar = menu->region;
- block = ar->uiblocks.first;
+ region = menu->region;
+ block = region->uiblocks.first;
is_click_style = (block->pie_data.flags & UI_PIE_CLICK_STYLE);
/* if there's an active modal button, don't check events or outside, except for search menu */
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
if (menu->scrolltimer == NULL) {
menu->scrolltimer = WM_event_add_timer(
@@ -10192,7 +10199,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
event_xy[0] = event->x;
event_xy[1] = event->y;
- ui_window_to_block_fl(ar, block, &event_xy[0], &event_xy[1]);
+ ui_window_to_block_fl(region, block, &event_xy[0], &event_xy[1]);
/* Distance from initial point. */
dist = ui_block_calc_pie_segment(block, event_xy);
@@ -10242,7 +10249,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
}
block->pie_data.alphafac = fac;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
@@ -10276,7 +10283,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
}
/* why redraw here? It's simple, we are getting many double click events here.
* Those operate like mouse move events almost */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else {
if ((duration < 0.01 * U.pie_tap_timeout) &&
@@ -10322,7 +10329,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
ui_handle_menu_button(C, event, menu);
/* mouse move should always refresh the area for pie menus */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case LEFTMOUSE:
@@ -10541,26 +10548,26 @@ void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool
static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(userdata))
{
- ARegion *ar;
+ ARegion *region;
uiBut *but, *listbox;
int retval;
/* here we handle buttons at the region level, non-modal */
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
retval = WM_UI_HANDLER_CONTINUE;
- if (ar == NULL || BLI_listbase_is_empty(&ar->uiblocks)) {
+ if (region == NULL || BLI_listbase_is_empty(&region->uiblocks)) {
return retval;
}
/* either handle events for already activated button or try to activate */
- but = ui_region_find_active_but(ar);
- listbox = ui_list_find_mouse_over(ar, event);
+ but = ui_region_find_active_but(region);
+ listbox = ui_list_find_mouse_over(region, event);
- retval = ui_handler_panel_region(C, event, ar, listbox ? listbox : but);
+ retval = ui_handler_panel_region(C, event, region, listbox ? listbox : but);
if (retval == WM_UI_HANDLER_CONTINUE && listbox) {
- retval = ui_handle_list_event(C, event, ar, listbox);
+ retval = ui_handle_list_event(C, event, region, listbox);
/* interactions with the listbox should disable tips */
if (retval == WM_UI_HANDLER_BREAK) {
@@ -10575,13 +10582,13 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use
retval = ui_handle_button_event(C, event, but);
}
else {
- retval = ui_handle_button_over(C, event, ar);
+ retval = ui_handle_button_over(C, event, region);
}
}
/* re-enable tooltips */
if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) {
- ui_blocks_set_tooltips(ar, true);
+ ui_blocks_set_tooltips(region, true);
}
/* delayed apply callbacks */
@@ -10593,14 +10600,14 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use
static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata))
{
bScreen *sc;
- ARegion *ar;
+ ARegion *region;
- ar = CTX_wm_region(C);
- if (ar == NULL) {
+ region = CTX_wm_region(C);
+ if (region == NULL) {
return;
}
- UI_blocklist_free(C, &ar->uiblocks);
+ UI_blocklist_free(C, &region->uiblocks);
sc = CTX_wm_screen(C);
if (sc == NULL) {
@@ -10610,7 +10617,7 @@ static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata))
/* delayed apply callbacks, but not for screen level regions, those
* we rather do at the very end after closing them all, which will
* be done in ui_region_handler/window */
- if (BLI_findindex(&sc->regionbase, ar) == -1) {
+ if (BLI_findindex(&sc->regionbase, region) == -1) {
ui_apply_but_funcs_after(C);
}
}
@@ -10620,11 +10627,11 @@ static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata))
static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSED(userdata))
{
ARegion *menu_region = CTX_wm_menu(C);
- ARegion *ar = menu_region ? menu_region : CTX_wm_region(C);
+ ARegion *region = menu_region ? menu_region : CTX_wm_region(C);
uiBut *but;
int retval = WM_UI_HANDLER_CONTINUE;
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
if (but) {
bScreen *screen = CTX_wm_screen(C);
@@ -10641,7 +10648,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
/* make sure mouse isn't inside another menu (see T43247) */
(ui_screen_region_find_mouse_over(screen, event) == NULL) &&
(ELEM(but->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) &&
- (but_other = ui_but_find_mouse_over(ar, event)) && (but != but_other) &&
+ (but_other = ui_but_find_mouse_over(region, event)) && (but != but_other) &&
(ELEM(but_other->type, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER, UI_BTYPE_MENU)) &&
/* Hover-opening menu's doesn't work well for buttons over one another
* along the same axis the menu is opening on (see T71719). */
@@ -10652,7 +10659,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
/* if mouse moves to a different root-level menu button,
* open it to replace the current menu */
if ((but_other->flag & UI_BUT_DISABLED) == 0) {
- ui_handle_button_activate(C, ar, but_other, BUTTON_ACTIVATE_OVER);
+ ui_handle_button_activate(C, region, but_other, BUTTON_ACTIVATE_OVER);
button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
retval = WM_UI_HANDLER_BREAK;
}
@@ -10683,7 +10690,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
/* re-enable tooltips */
if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) {
- ui_blocks_set_tooltips(ar, true);
+ ui_blocks_set_tooltips(region, true);
}
if (but && but->active && but->active->menu) {
@@ -10865,14 +10872,14 @@ void UI_popup_handlers_remove_all(bContext *C, ListBase *handlers)
}
bool UI_textbutton_activate_rna(const bContext *C,
- ARegion *ar,
+ ARegion *region,
const void *rna_poin_data,
const char *rna_prop_id)
{
uiBlock *block;
uiBut *but = NULL;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
if (but->type == UI_BTYPE_TEXT) {
if (but->rnaprop && but->rnapoin.data == rna_poin_data) {
@@ -10888,7 +10895,7 @@ bool UI_textbutton_activate_rna(const bContext *C,
}
if (but) {
- UI_but_active_only(C, ar, block, but);
+ UI_but_active_only(C, region, block, but);
return true;
}
else {
@@ -10898,11 +10905,11 @@ bool UI_textbutton_activate_rna(const bContext *C,
bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
uiBlock *block;
uiBut *but = NULL;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
if (but == actbut && but->type == UI_BTYPE_TEXT) {
break;
@@ -10915,7 +10922,7 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
}
if (but) {
- UI_but_active_only(C, ar, block, but);
+ UI_but_active_only(C, region, block, but);
return true;
}
else {
@@ -10955,8 +10962,8 @@ void UI_screen_free_active_but(const bContext *C, bScreen *screen)
/* called in region context */
bool UI_but_active_drop_name(bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
- uiBut *but = ui_region_find_active_but(ar);
+ ARegion *region = CTX_wm_region(C);
+ uiBut *but = ui_region_find_active_but(region);
if (but) {
if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
@@ -10969,10 +10976,10 @@ bool UI_but_active_drop_name(bContext *C)
bool UI_but_active_drop_color(bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar) {
- uiBut *but = ui_region_find_active_but(ar);
+ if (region) {
+ uiBut *but = ui_region_find_active_but(region);
if (but && but->type == UI_BTYPE_COLOR) {
return true;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 3fe2750e070..248979e1ae7 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -456,23 +456,29 @@ typedef struct uiSafetyRct {
void ui_fontscale(short *points, float aspect);
-extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
-extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
-extern void ui_block_to_window_rctf(const struct ARegion *ar,
+extern void ui_block_to_window_fl(const struct ARegion *region,
+ uiBlock *block,
+ float *x,
+ float *y);
+extern void ui_block_to_window(const struct ARegion *region, uiBlock *block, int *x, int *y);
+extern void ui_block_to_window_rctf(const struct ARegion *region,
uiBlock *block,
rctf *rct_dst,
const rctf *rct_src);
-extern float ui_block_to_window_scale(const struct ARegion *ar, uiBlock *block);
-extern void ui_window_to_block_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
-extern void ui_window_to_block(const struct ARegion *ar, uiBlock *block, int *x, int *y);
-extern void ui_window_to_block_rctf(const struct ARegion *ar,
+extern float ui_block_to_window_scale(const struct ARegion *region, uiBlock *block);
+extern void ui_window_to_block_fl(const struct ARegion *region,
+ uiBlock *block,
+ float *x,
+ float *y);
+extern void ui_window_to_block(const struct ARegion *region, uiBlock *block, int *x, int *y);
+extern void ui_window_to_block_rctf(const struct ARegion *region,
uiBlock *block,
rctf *rct_dst,
const rctf *rct_src);
-extern void ui_window_to_region(const ARegion *ar, int *x, int *y);
-extern void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src);
-extern void ui_region_to_window(const struct ARegion *ar, int *x, int *y);
-extern void ui_region_winrct_get_no_margin(const struct ARegion *ar, struct rcti *r_rect);
+extern void ui_window_to_region(const ARegion *region, int *x, int *y);
+extern void ui_window_to_region_rcti(const ARegion *region, rcti *rect_dst, const rcti *rct_src);
+extern void ui_region_to_window(const struct ARegion *region, int *x, int *y);
+extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect);
extern double ui_but_value_get(uiBut *but);
extern void ui_but_value_set(uiBut *but, double value);
@@ -642,16 +648,16 @@ ColorPicker *ui_block_colorpicker_create(struct uiBlock *block);
/* Searchbox for string button */
ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, uiBut *but);
ARegion *ui_searchbox_create_operator(struct bContext *C, struct ARegion *butregion, uiBut *but);
-bool ui_searchbox_inside(struct ARegion *ar, int x, int y);
-int ui_searchbox_find_index(struct ARegion *ar, const char *name);
-void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, const bool reset);
-int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *ar, uiBut *but, char *str);
+bool ui_searchbox_inside(struct ARegion *region, int x, int y);
+int ui_searchbox_find_index(struct ARegion *region, const char *name);
+void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, const bool reset);
+int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *region, uiBut *but, char *str);
void ui_searchbox_event(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
uiBut *but,
const struct wmEvent *event);
-bool ui_searchbox_apply(uiBut *but, struct ARegion *ar);
-void ui_searchbox_free(struct bContext *C, struct ARegion *ar);
+bool ui_searchbox_apply(uiBut *but, struct ARegion *region);
+void ui_searchbox_free(struct bContext *C, struct ARegion *region);
void ui_but_search_refresh(uiBut *but);
/* interface_region_menu_popup.c */
@@ -696,7 +702,7 @@ void ui_pie_menu_level_create(uiBlock *block,
int flag);
/* interface_region_popup.c */
-void ui_popup_translate(struct ARegion *ar, const int mdiff[2]);
+void ui_popup_translate(struct ARegion *region, const int mdiff[2]);
void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle);
void ui_popup_block_scrolltest(struct uiBlock *block);
@@ -705,7 +711,7 @@ void ui_popup_block_scrolltest(struct uiBlock *block);
/* interface_panel.c */
extern int ui_handler_panel_region(struct bContext *C,
const struct wmEvent *event,
- struct ARegion *ar,
+ struct ARegion *region,
const uiBut *active_but);
extern void ui_draw_aligned_panel(struct uiStyle *style,
uiBlock *block,
@@ -723,33 +729,33 @@ void ui_draw_but_TAB_outline(const rcti *rect,
float rad,
uchar highlight[3],
uchar highlight_fade[3]);
-void ui_draw_but_HISTOGRAM(ARegion *ar,
+void ui_draw_but_HISTOGRAM(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
-void ui_draw_but_WAVEFORM(ARegion *ar,
+void ui_draw_but_WAVEFORM(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
-void ui_draw_but_VECTORSCOPE(ARegion *ar,
+void ui_draw_but_VECTORSCOPE(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
void ui_draw_but_COLORBAND(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
void ui_draw_but_UNITVEC(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect);
-void ui_draw_but_CURVE(ARegion *ar,
+void ui_draw_but_CURVE(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
-void ui_draw_but_CURVEPROFILE(ARegion *ar,
+void ui_draw_but_CURVEPROFILE(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
-void ui_draw_but_IMAGE(ARegion *ar,
+void ui_draw_but_IMAGE(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
-void ui_draw_but_TRACKPREVIEW(ARegion *ar,
+void ui_draw_but_TRACKPREVIEW(ARegion *region,
uiBut *but,
const struct uiWidgetColors *wcol,
const rcti *rect);
@@ -759,14 +765,14 @@ PointerRNA *ui_handle_afterfunc_add_operator(struct wmOperatorType *ot,
int opcontext,
bool create_props);
extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
-extern void ui_but_activate_event(struct bContext *C, struct ARegion *ar, uiBut *but);
-extern void ui_but_activate_over(struct bContext *C, struct ARegion *ar, uiBut *but);
+extern void ui_but_activate_event(struct bContext *C, struct ARegion *region, uiBut *but);
+extern void ui_but_activate_over(struct bContext *C, struct ARegion *region, uiBut *but);
extern void ui_but_execute_begin(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
uiBut *but,
void **active_back);
extern void ui_but_execute_end(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
uiBut *but,
void *active_back);
extern void ui_but_active_free(const struct bContext *C, uiBut *but);
@@ -826,7 +832,7 @@ struct GPUBatch *ui_batch_roundbox_shadow_get(void);
void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
-void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
+void ui_draw_popover_back(ARegion *region, struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_pie_center(uiBlock *block);
const struct uiWidgetColors *ui_tooltip_get_theme(void);
@@ -835,7 +841,7 @@ void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow);
void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
extern void ui_draw_but(
- const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
+ const struct bContext *C, ARegion *region, struct uiStyle *style, uiBut *but, rcti *rect);
void ui_draw_menu_item(const struct uiFontStyle *fstyle,
rcti *rect,
@@ -884,7 +890,7 @@ void ui_item_paneltype_func(struct bContext *C, struct uiLayout *layout, void *a
/* interface_align.c */
bool ui_but_can_align(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
-int ui_but_align_opposite_to_area_align_get(const ARegion *ar) ATTR_WARN_UNUSED_RESULT;
+int ui_but_align_opposite_to_area_align_get(const ARegion *region) ATTR_WARN_UNUSED_RESULT;
void ui_block_align_calc(uiBlock *block, const ARegion *region);
/* interface_anim.c */
@@ -913,24 +919,24 @@ bool ui_but_is_cursor_warp(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
bool ui_but_contains_pt(const uiBut *but, float mx, float my) ATTR_WARN_UNUSED_RESULT;
bool ui_but_contains_rect(const uiBut *but, const rctf *rect);
bool ui_but_contains_point_px_icon(const uiBut *but,
- struct ARegion *ar,
+ struct ARegion *region,
const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT;
-bool ui_but_contains_point_px(const uiBut *but, const struct ARegion *ar, int x, int y)
+bool ui_but_contains_point_px(const uiBut *but, const struct ARegion *region, int x, int y)
ATTR_WARN_UNUSED_RESULT;
-uiBut *ui_list_find_mouse_over(struct ARegion *ar,
+uiBut *ui_list_find_mouse_over(struct ARegion *region,
const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT;
-uiBut *ui_but_find_mouse_over_ex(struct ARegion *ar,
+uiBut *ui_but_find_mouse_over_ex(struct ARegion *region,
const int x,
const int y,
const bool labeledit) ATTR_WARN_UNUSED_RESULT;
-uiBut *ui_but_find_mouse_over(struct ARegion *ar,
+uiBut *ui_but_find_mouse_over(struct ARegion *region,
const struct wmEvent *event) ATTR_WARN_UNUSED_RESULT;
-uiBut *ui_but_find_rect_over(const struct ARegion *ar,
+uiBut *ui_but_find_rect_over(const struct ARegion *region,
const rcti *rect_px) ATTR_WARN_UNUSED_RESULT;
-uiBut *ui_list_find_mouse_over_ex(struct ARegion *ar, int x, int y) ATTR_WARN_UNUSED_RESULT;
+uiBut *ui_list_find_mouse_over_ex(struct ARegion *region, int x, int y) ATTR_WARN_UNUSED_RESULT;
bool ui_but_contains_password(const uiBut *but) ATTR_WARN_UNUSED_RESULT;
@@ -944,17 +950,21 @@ bool ui_block_is_popover(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
bool ui_block_is_popup_any(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
-uiBut *ui_region_find_first_but_test_flag(struct ARegion *ar, int flag_include, int flag_exclude);
-uiBut *ui_region_find_active_but(struct ARegion *ar) ATTR_WARN_UNUSED_RESULT;
-bool ui_region_contains_point_px(const struct ARegion *ar, int x, int y) ATTR_WARN_UNUSED_RESULT;
-bool ui_region_contains_rect_px(const struct ARegion *ar, const rcti *rect_px);
+uiBut *ui_region_find_first_but_test_flag(struct ARegion *region,
+ int flag_include,
+ int flag_exclude);
+uiBut *ui_region_find_active_but(struct ARegion *region) ATTR_WARN_UNUSED_RESULT;
+bool ui_region_contains_point_px(const struct ARegion *region,
+ int x,
+ int y) ATTR_WARN_UNUSED_RESULT;
+bool ui_region_contains_rect_px(const struct ARegion *region, const rcti *rect_px);
ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y);
ARegion *ui_screen_region_find_mouse_over(bScreen *screen, const struct wmEvent *event);
/* interface_context_menu.c */
bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but);
-void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *ar, struct Panel *pa);
+void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *region, struct Panel *pa);
/* interface_eyedropper.c */
struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index a797316cc98..8e65b818314 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1067,7 +1067,7 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C,
PropertyRNA **r_prop,
bool *r_is_undo)
{
- ARegion *ar = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
+ ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
uiBlock *block;
uiBut *but, *prevbut = NULL;
@@ -1075,11 +1075,11 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C,
*r_prop = NULL;
*r_is_undo = false;
- if (!ar) {
+ if (!region) {
return;
}
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
for (but = block->buttons.first; but; but = but->next) {
if (but && but->rnapoin.data) {
if (RNA_property_type(but->rnaprop) == PROP_STRING) {
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 9de2824e3a3..dce584b4ae5 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1329,7 +1329,7 @@ static int editsource_exec(bContext *C, wmOperator *op)
GHashIterator ghi;
struct uiEditSourceButStore *but_store = NULL;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
int ret;
/* needed else the active button does not get tested */
@@ -1341,9 +1341,9 @@ static int editsource_exec(bContext *C, wmOperator *op)
ui_editsource_active_but_set(but);
/* redraw and get active button python info */
- ED_region_do_layout(C, ar);
- ED_region_do_draw(C, ar);
- ar->do_draw = false;
+ ED_region_do_layout(C, region);
+ ED_region_do_draw(C, region);
+ region->do_draw = false;
for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
BLI_ghashIterator_done(&ghi) == false;
@@ -1620,17 +1620,17 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev
bScreen *sc = CTX_wm_screen(C);
const bool skip_depressed = RNA_boolean_get(op->ptr, "skip_depressed");
ARegion *ar_prev = CTX_wm_region(C);
- ARegion *ar = sc ? BKE_screen_find_region_xy(sc, RGN_TYPE_ANY, event->x, event->y) : NULL;
+ ARegion *region = sc ? BKE_screen_find_region_xy(sc, RGN_TYPE_ANY, event->x, event->y) : NULL;
- if (ar == NULL) {
- ar = ar_prev;
+ if (region == NULL) {
+ region = ar_prev;
}
- if (ar == NULL) {
+ if (region == NULL) {
return OPERATOR_PASS_THROUGH;
}
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
uiBut *but = UI_context_active_but_get(C);
CTX_wm_region_set(C, ar_prev);
@@ -1645,7 +1645,7 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev
* having this avoids a minor drawing glitch. */
void *but_optype = but->optype;
- UI_but_execute(C, ar, but);
+ UI_but_execute(C, region, but);
but->optype = but_optype;
@@ -1709,14 +1709,14 @@ bool UI_drop_color_poll(struct bContext *C,
* return true always */
if (drag->type == WM_DRAG_COLOR) {
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (UI_but_active_drop_color(C)) {
return 1;
}
if (sima && (sima->mode == SI_MODE_PAINT) && sima->image &&
- (ar && ar->regiontype == RGN_TYPE_WINDOW)) {
+ (region && region->regiontype == RGN_TYPE_WINDOW)) {
return 1;
}
}
@@ -1734,7 +1734,7 @@ void UI_drop_color_copy(wmDrag *drag, wmDropBox *drop)
static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
uiBut *but = NULL;
float color[4];
bool gamma;
@@ -1744,7 +1744,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* find button under mouse, check if it has RNA color property and
* if it does copy the data */
- but = ui_region_find_active_but(ar);
+ but = ui_region_find_active_but(region);
if (but && but->type == UI_BTYPE_COLOR && but->rnaprop) {
const int color_len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
@@ -1778,7 +1778,7 @@ static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ED_imapaint_bucket_fill(C, color, op, event->mval);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 17c1455bd81..70d64ff26ab 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -131,21 +131,21 @@ typedef enum eSpaceButtons_Align {
BUT_AUTO = 2,
} eSpaceButtons_Align;
-static int panel_aligned(const ScrArea *sa, const ARegion *ar)
+static int panel_aligned(const ScrArea *sa, const ARegion *region)
{
- if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
return BUT_VERTICAL;
}
- else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW) {
+ else if (sa->spacetype == SPACE_USERPREF && region->regiontype == RGN_TYPE_WINDOW) {
return BUT_VERTICAL;
}
- else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) {
+ else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) {
return BUT_VERTICAL;
}
- else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {
+ else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) {
return BUT_VERTICAL;
}
- else if (ELEM(ar->regiontype,
+ else if (ELEM(region->regiontype,
RGN_TYPE_UI,
RGN_TYPE_TOOLS,
RGN_TYPE_TOOL_PROPS,
@@ -196,28 +196,28 @@ static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, b
return false;
}
-static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate)
+static bool panels_need_realign(ScrArea *sa, ARegion *region, Panel **r_pa_animate)
{
*r_pa_animate = NULL;
- if (sa->spacetype == SPACE_PROPERTIES && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (sa->spacetype == SPACE_PROPERTIES && region->regiontype == RGN_TYPE_WINDOW) {
SpaceProperties *sbuts = sa->spacedata.first;
if (sbuts->mainbo != sbuts->mainb) {
return true;
}
}
- else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) {
+ else if (sa->spacetype == SPACE_IMAGE && region->regiontype == RGN_TYPE_PREVIEW) {
return true;
}
- else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) {
+ else if (sa->spacetype == SPACE_FILE && region->regiontype == RGN_TYPE_CHANNELS) {
return true;
}
/* Detect if a panel was added or removed. */
Panel *pa_animation = NULL;
bool no_animation = false;
- if (panel_active_animation_changed(&ar->panels, &pa_animation, &no_animation)) {
+ if (panel_active_animation_changed(&region->panels, &pa_animation, &no_animation)) {
return true;
}
@@ -234,15 +234,15 @@ static bool panels_need_realign(ScrArea *sa, ARegion *ar, Panel **r_pa_animate)
/****************************** panels ******************************/
-static void panels_collapse_all(ScrArea *sa, ARegion *ar, const Panel *from_pa)
+static void panels_collapse_all(ScrArea *sa, ARegion *region, const Panel *from_pa)
{
- const bool has_category_tabs = UI_panel_category_is_visible(ar);
- const char *category = has_category_tabs ? UI_panel_category_active_get(ar, false) : NULL;
- const int flag = ((panel_aligned(sa, ar) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
+ const bool has_category_tabs = UI_panel_category_is_visible(region);
+ const char *category = has_category_tabs ? UI_panel_category_active_get(region, false) : NULL;
+ const int flag = ((panel_aligned(sa, region) == BUT_HORIZONTAL) ? PNL_CLOSEDX : PNL_CLOSEDY);
const PanelType *from_pt = from_pa->type;
Panel *pa;
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
PanelType *pt = pa->type;
/* close panels with headers in the same context */
@@ -274,14 +274,19 @@ Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt)
/**
* \note \a pa should be return value from #UI_panel_find_by_type and can be NULL.
*/
-Panel *UI_panel_begin(
- ScrArea *sa, ARegion *ar, ListBase *lb, uiBlock *block, PanelType *pt, Panel *pa, bool *r_open)
+Panel *UI_panel_begin(ScrArea *sa,
+ ARegion *region,
+ ListBase *lb,
+ uiBlock *block,
+ PanelType *pt,
+ Panel *pa,
+ bool *r_open)
{
Panel *palast, *panext;
const char *drawname = CTX_IFACE_(pt->translation_context, pt->label);
const char *idname = pt->idname;
const bool newpanel = (pa == NULL);
- int align = panel_aligned(sa, ar);
+ int align = panel_aligned(sa, region);
if (!newpanel) {
pa->type = pt;
@@ -352,7 +357,7 @@ Panel *UI_panel_begin(
/* assign to block */
block->panel = pa;
pa->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED;
- if (ar->alignment == RGN_ALIGN_FLOAT) {
+ if (region->alignment == RGN_ALIGN_FLOAT) {
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
}
@@ -367,10 +372,11 @@ Panel *UI_panel_begin(
return pa;
}
-static float panel_region_offset_x_get(const ARegion *ar, int align)
+static float panel_region_offset_x_get(const ARegion *region, int align)
{
- if (UI_panel_category_is_visible(ar)) {
- if (align == BUT_VERTICAL && (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT)) {
+ if (UI_panel_category_is_visible(region)) {
+ if (align == BUT_VERTICAL &&
+ (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) != RGN_ALIGN_RIGHT)) {
return UI_PANEL_CATEGORY_MARGIN_WIDTH;
}
}
@@ -379,7 +385,7 @@ static float panel_region_offset_x_get(const ARegion *ar, int align)
}
void UI_panel_end(
- const ScrArea *sa, const ARegion *ar, uiBlock *block, int width, int height, bool open)
+ const ScrArea *sa, const ARegion *region, uiBlock *block, int width, int height, bool open)
{
Panel *pa = block->panel;
@@ -419,8 +425,8 @@ void UI_panel_end(
pa->ofsy += old_sizey - pa->sizey;
}
- int align = panel_aligned(sa, ar);
- if (old_region_ofsx != panel_region_offset_x_get(ar, align)) {
+ int align = panel_aligned(sa, region);
+ if (old_region_ofsx != panel_region_offset_x_get(region, align)) {
pa->runtime_flag |= PNL_ANIM_ALIGN;
}
}
@@ -1015,16 +1021,16 @@ static void align_sub_panels(Panel *pa)
/* this doesn't draw */
/* returns 1 when it did something */
-static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bool drag)
+static bool uiAlignPanelStep(ScrArea *sa, ARegion *region, const float fac, const bool drag)
{
Panel *pa;
PanelSort *ps, *panelsort, *psnext;
int a, tot = 0;
bool done;
- int align = panel_aligned(sa, ar);
+ int align = panel_aligned(sa, region);
/* count active, not tabbed panels */
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
if (pa->runtime_flag & PNL_ACTIVE) {
tot++;
}
@@ -1035,7 +1041,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
}
/* extra; change close direction? */
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
if (pa->runtime_flag & PNL_ACTIVE) {
if ((pa->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL)) {
pa->flag ^= PNL_CLOSED;
@@ -1050,7 +1056,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort");
ps = panelsort;
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
if (pa->runtime_flag & PNL_ACTIVE) {
ps->pa = MEM_dupallocN(pa);
ps->orig = pa;
@@ -1078,7 +1084,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
ps = panelsort;
- ps->pa->runtime.region_ofsx = panel_region_offset_x_get(ar, align);
+ ps->pa->runtime.region_ofsx = panel_region_offset_x_get(region, align);
ps->pa->ofsx = 0;
ps->pa->ofsy = -get_panel_size_y(ps->pa);
ps->pa->ofsx += ps->pa->runtime.region_ofsx;
@@ -1112,7 +1118,7 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
}
/* set locations for tabbed and sub panels */
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
if (pa->runtime_flag & PNL_ACTIVE) {
if (pa->children.first) {
align_sub_panels(pa);
@@ -1129,15 +1135,15 @@ static bool uiAlignPanelStep(ScrArea *sa, ARegion *ar, const float fac, const bo
return done;
}
-static void ui_panels_size(ScrArea *sa, ARegion *ar, int *r_x, int *r_y)
+static void ui_panels_size(ScrArea *sa, ARegion *region, int *r_x, int *r_y)
{
Panel *pa;
- int align = panel_aligned(sa, ar);
+ int align = panel_aligned(sa, region);
int sizex = 0;
int sizey = 0;
/* compute size taken up by panels, for setting in view2d */
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
if (pa->runtime_flag & PNL_ACTIVE) {
int pa_sizex, pa_sizey;
@@ -1170,15 +1176,15 @@ static void ui_do_animate(const bContext *C, Panel *panel)
{
uiHandlePanelData *data = panel->activedata;
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float fac;
fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME;
fac = min_ff(sqrtf(fac), 1.0f);
/* for max 1 second, interpolate positions */
- if (uiAlignPanelStep(sa, ar, fac, false)) {
- ED_region_tag_redraw(ar);
+ if (uiAlignPanelStep(sa, region, fac, false)) {
+ ED_region_tag_redraw(region);
}
else {
fac = 1.0f;
@@ -1206,38 +1212,38 @@ static void panel_list_clear_active(ListBase *lb)
}
}
-void UI_panels_begin(const bContext *UNUSED(C), ARegion *ar)
+void UI_panels_begin(const bContext *UNUSED(C), ARegion *region)
{
- panel_list_clear_active(&ar->panels);
+ panel_list_clear_active(&region->panels);
}
/* only draws blocks with panels */
-void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
+void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)
{
ScrArea *sa = CTX_wm_area(C);
uiBlock *block;
Panel *pa, *firstpa;
/* offset contents */
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
if (block->active && block->panel) {
ui_offset_panel_block(block);
}
}
/* re-align, possibly with animation */
- if (panels_need_realign(sa, ar, &pa)) {
+ if (panels_need_realign(sa, region, &pa)) {
if (pa) {
panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
}
else {
- uiAlignPanelStep(sa, ar, 1.0, false);
+ uiAlignPanelStep(sa, region, 1.0, false);
}
}
/* tag first panel */
firstpa = NULL;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
if (block->active && block->panel) {
if (!firstpa || block->panel->sortorder < firstpa->sortorder) {
firstpa = block->panel;
@@ -1250,39 +1256,39 @@ void UI_panels_end(const bContext *C, ARegion *ar, int *r_x, int *r_y)
}
/* compute size taken up by panel */
- ui_panels_size(sa, ar, r_x, r_y);
+ ui_panels_size(sa, region, r_x, r_y);
}
-void UI_panels_draw(const bContext *C, ARegion *ar)
+void UI_panels_draw(const bContext *C, ARegion *region)
{
uiBlock *block;
- if (ar->alignment != RGN_ALIGN_FLOAT) {
+ if (region->alignment != RGN_ALIGN_FLOAT) {
UI_ThemeClearColor(TH_BACK);
}
/* Draw panels, selected on top. Also in reverse order, because
* UI blocks are added in reverse order and we need child panels
* to draw on top. */
- for (block = ar->uiblocks.last; block; block = block->prev) {
+ for (block = region->uiblocks.last; block; block = block->prev) {
if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
UI_block_draw(C, block);
}
}
- for (block = ar->uiblocks.last; block; block = block->prev) {
+ for (block = region->uiblocks.last; block; block = block->prev) {
if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
UI_block_draw(C, block);
}
}
}
-void UI_panels_scale(ARegion *ar, float new_width)
+void UI_panels_scale(ARegion *region, float new_width)
{
uiBlock *block;
uiBut *but;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
if (block->panel) {
float fac = new_width / (float)block->panel->sizex;
block->panel->sizex = new_width;
@@ -1297,13 +1303,13 @@ void UI_panels_scale(ARegion *ar, float new_width)
/* ------------ panel merging ---------------- */
-static void check_panel_overlap(ARegion *ar, Panel *panel)
+static void check_panel_overlap(ARegion *region, Panel *panel)
{
Panel *pa;
/* also called with (panel == NULL) for clear */
- for (pa = ar->panels.first; pa; pa = pa->next) {
+ for (pa = region->panels.first; pa; pa = pa->next) {
pa->flag &= ~PNL_OVERLAP;
if (panel && (pa != panel)) {
if (pa->runtime_flag & PNL_ACTIVE) {
@@ -1342,19 +1348,19 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
{
uiHandlePanelData *data = panel->activedata;
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- short align = panel_aligned(sa, ar), dx = 0, dy = 0;
+ ARegion *region = CTX_wm_region(C);
+ short align = panel_aligned(sa, region), dx = 0, dy = 0;
/* first clip for window, no dragging outside */
- if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) {
+ if (!BLI_rcti_isect_pt_v(&region->winrct, &event->x)) {
return;
}
dx = (event->x - data->startx) & ~(PNL_GRID - 1);
dy = (event->y - data->starty) & ~(PNL_GRID - 1);
- dx *= (float)BLI_rctf_size_x(&ar->v2d.cur) / (float)BLI_rcti_size_x(&ar->winrct);
- dy *= (float)BLI_rctf_size_y(&ar->v2d.cur) / (float)BLI_rcti_size_y(&ar->winrct);
+ dx *= (float)BLI_rctf_size_x(&region->v2d.cur) / (float)BLI_rcti_size_x(&region->winrct);
+ dy *= (float)BLI_rctf_size_y(&region->v2d.cur) / (float)BLI_rcti_size_y(&region->winrct);
if (data->state == PANEL_STATE_DRAG_SCALE) {
panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX);
@@ -1372,14 +1378,14 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
panel->ofsx = data->startofsx + dx;
panel->ofsy = data->startofsy + dy;
- check_panel_overlap(ar, panel);
+ check_panel_overlap(region, panel);
if (align) {
- uiAlignPanelStep(sa, ar, 0.2, true);
+ uiAlignPanelStep(sa, region, 0.2, true);
}
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
/******************* region level panel interaction *****************/
@@ -1436,16 +1442,16 @@ static void ui_panel_drag_collapse(bContext *C,
const int xy_dst[2])
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
uiBlock *block;
Panel *pa;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
float xy_a_block[2] = {UNPACK2(dragcol_data->xy_init)};
float xy_b_block[2] = {UNPACK2(xy_dst)};
rctf rect = block->rect;
int oldflag;
- const bool is_horizontal = (panel_aligned(sa, ar) == BUT_HORIZONTAL);
+ const bool is_horizontal = (panel_aligned(sa, region) == BUT_HORIZONTAL);
if ((pa = block->panel) == 0 || (pa->type && (pa->type->flag & PNL_NO_HEADER))) {
continue;
@@ -1461,8 +1467,8 @@ static void ui_panel_drag_collapse(bContext *C,
}
/* use cursor coords in block space */
- ui_window_to_block_fl(ar, block, &xy_a_block[0], &xy_a_block[1]);
- ui_window_to_block_fl(ar, block, &xy_b_block[0], &xy_b_block[1]);
+ ui_window_to_block_fl(region, block, &xy_a_block[0], &xy_a_block[1]);
+ ui_window_to_block_fl(region, block, &xy_b_block[0], &xy_b_block[1]);
/* set up rect to match header size */
rect.ymin = rect.ymax;
@@ -1548,17 +1554,18 @@ static void ui_handle_panel_header(
const bContext *C, uiBlock *block, int mx, int my, int event, short ctrl, short shift)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
#ifdef USE_PIN_HIDDEN
- const bool show_pin = UI_panel_category_is_visible(ar) && (block->panel->type->parent == NULL) &&
- (block->panel->flag & PNL_PIN);
+ const bool show_pin = UI_panel_category_is_visible(region) &&
+ (block->panel->type->parent == NULL) && (block->panel->flag & PNL_PIN);
#else
- const bool show_pin = UI_panel_category_is_visible(ar) && (block->panel->type->parent == NULL);
+ const bool show_pin = UI_panel_category_is_visible(region) &&
+ (block->panel->type->parent == NULL);
#endif
const bool is_subpanel = (block->panel->type && block->panel->type->parent);
const bool show_drag = !is_subpanel;
- int align = panel_aligned(sa, ar), button = 0;
+ int align = panel_aligned(sa, region), button = 0;
rctf rect_drag, rect_pin;
float rect_leftmost;
@@ -1609,14 +1616,14 @@ static void ui_handle_panel_header(
if (button) {
if (button == 2) { /* close */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else { /* collapse */
if (ctrl) {
- panels_collapse_all(sa, ar, block->panel);
+ panels_collapse_all(sa, region, block->panel);
/* reset the view - we don't want to display a view without content */
- UI_view2d_offset(&ar->v2d, 0.0f, 1.0f);
+ UI_view2d_offset(&region->v2d, 0.0f, 1.0f);
}
if (block->panel->flag & PNL_CLOSED) {
@@ -1657,42 +1664,44 @@ static void ui_handle_panel_header(
/* FIXME: this doesn't update the panel drawing, assert to avoid debugging why this is.
* We could fix this in the future if it's ever needed. */
BLI_assert(0);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
else if (show_drag && BLI_rctf_isect_x(&rect_drag, mx)) {
/* XXX, for now don't allow dragging in floating windows yet. */
- if (ar->alignment == RGN_ALIGN_FLOAT) {
+ if (region->alignment == RGN_ALIGN_FLOAT) {
return;
}
panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
}
else if (show_pin && BLI_rctf_isect_x(&rect_pin, mx)) {
block->panel->flag ^= PNL_PIN;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
-bool UI_panel_category_is_visible(const ARegion *ar)
+bool UI_panel_category_is_visible(const ARegion *region)
{
/* more than one */
- return ar->panels_category.first && ar->panels_category.first != ar->panels_category.last;
+ return region->panels_category.first &&
+ region->panels_category.first != region->panels_category.last;
}
-PanelCategoryDyn *UI_panel_category_find(ARegion *ar, const char *idname)
+PanelCategoryDyn *UI_panel_category_find(ARegion *region, const char *idname)
{
- return BLI_findstring(&ar->panels_category, idname, offsetof(PanelCategoryDyn, idname));
+ return BLI_findstring(&region->panels_category, idname, offsetof(PanelCategoryDyn, idname));
}
-PanelCategoryStack *UI_panel_category_active_find(ARegion *ar, const char *idname)
+PanelCategoryStack *UI_panel_category_active_find(ARegion *region, const char *idname)
{
- return BLI_findstring(&ar->panels_category_active, idname, offsetof(PanelCategoryStack, idname));
+ return BLI_findstring(
+ &region->panels_category_active, idname, offsetof(PanelCategoryStack, idname));
}
-static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool fallback)
+static void ui_panel_category_active_set(ARegion *region, const char *idname, bool fallback)
{
- ListBase *lb = &ar->panels_category_active;
- PanelCategoryStack *pc_act = UI_panel_category_active_find(ar, idname);
+ ListBase *lb = &region->panels_category_active;
+ PanelCategoryStack *pc_act = UI_panel_category_active_find(region, idname);
if (pc_act) {
BLI_remlink(lb, pc_act);
@@ -1719,7 +1728,8 @@ static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool f
pc_act_next = pc_act->next;
while ((pc_act = pc_act_next)) {
pc_act_next = pc_act->next;
- if (!BLI_findstring(&ar->type->paneltypes, pc_act->idname, offsetof(PanelType, category))) {
+ if (!BLI_findstring(
+ &region->type->paneltypes, pc_act->idname, offsetof(PanelType, category))) {
BLI_remlink(lb, pc_act);
MEM_freeN(pc_act);
}
@@ -1727,32 +1737,32 @@ static void ui_panel_category_active_set(ARegion *ar, const char *idname, bool f
}
}
-void UI_panel_category_active_set(ARegion *ar, const char *idname)
+void UI_panel_category_active_set(ARegion *region, const char *idname)
{
- ui_panel_category_active_set(ar, idname, false);
+ ui_panel_category_active_set(region, idname, false);
}
-void UI_panel_category_active_set_default(ARegion *ar, const char *idname)
+void UI_panel_category_active_set_default(ARegion *region, const char *idname)
{
- if (!UI_panel_category_active_find(ar, idname)) {
- ui_panel_category_active_set(ar, idname, true);
+ if (!UI_panel_category_active_find(region, idname)) {
+ ui_panel_category_active_set(region, idname, true);
}
}
-const char *UI_panel_category_active_get(ARegion *ar, bool set_fallback)
+const char *UI_panel_category_active_get(ARegion *region, bool set_fallback)
{
PanelCategoryStack *pc_act;
- for (pc_act = ar->panels_category_active.first; pc_act; pc_act = pc_act->next) {
- if (UI_panel_category_find(ar, pc_act->idname)) {
+ for (pc_act = region->panels_category_active.first; pc_act; pc_act = pc_act->next) {
+ if (UI_panel_category_find(region, pc_act->idname)) {
return pc_act->idname;
}
}
if (set_fallback) {
- PanelCategoryDyn *pc_dyn = ar->panels_category.first;
+ PanelCategoryDyn *pc_dyn = region->panels_category.first;
if (pc_dyn) {
- ui_panel_category_active_set(ar, pc_dyn->idname, true);
+ ui_panel_category_active_set(region, pc_dyn->idname, true);
return pc_dyn->idname;
}
}
@@ -1760,11 +1770,11 @@ const char *UI_panel_category_active_get(ARegion *ar, bool set_fallback)
return NULL;
}
-PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x, const int y)
+PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *region, const int x, const int y)
{
PanelCategoryDyn *ptd;
- for (ptd = ar->panels_category.first; ptd; ptd = ptd->next) {
+ for (ptd = region->panels_category.first; ptd; ptd = ptd->next) {
if (BLI_rcti_isect_pt(&ptd->rect, x, y)) {
return ptd;
}
@@ -1773,24 +1783,24 @@ PanelCategoryDyn *UI_panel_category_find_mouse_over_ex(ARegion *ar, const int x,
return NULL;
}
-PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *ar, const wmEvent *event)
+PanelCategoryDyn *UI_panel_category_find_mouse_over(ARegion *region, const wmEvent *event)
{
- return UI_panel_category_find_mouse_over_ex(ar, event->mval[0], event->mval[1]);
+ return UI_panel_category_find_mouse_over_ex(region, event->mval[0], event->mval[1]);
}
-void UI_panel_category_add(ARegion *ar, const char *name)
+void UI_panel_category_add(ARegion *region, const char *name)
{
PanelCategoryDyn *pc_dyn = MEM_callocN(sizeof(*pc_dyn), __func__);
- BLI_addtail(&ar->panels_category, pc_dyn);
+ BLI_addtail(&region->panels_category, pc_dyn);
BLI_strncpy(pc_dyn->idname, name, sizeof(pc_dyn->idname));
/* 'pc_dyn->rect' must be set on draw */
}
-void UI_panel_category_clear_all(ARegion *ar)
+void UI_panel_category_clear_all(ARegion *region)
{
- BLI_freelistN(&ar->panels_category);
+ BLI_freelistN(&region->panels_category);
}
static void imm_buf_append(
@@ -1922,18 +1932,18 @@ static void ui_panel_category_draw_tab(bool filled,
* Draw vertical tabs on the left side of the region,
* one tab per category.
*/
-void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
+void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
{
/* no tab outlines for */
// #define USE_FLAT_INACTIVE
- const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment != RGN_ALIGN_RIGHT);
- View2D *v2d = &ar->v2d;
+ const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT);
+ View2D *v2d = &region->v2d;
uiStyle *style = UI_style_get();
const uiFontStyle *fstyle = &style->widget;
const int fontid = fstyle->uifont_id;
short fstyle_points = fstyle->points;
PanelCategoryDyn *pc_dyn;
- const float aspect = ((uiBlock *)ar->uiblocks.first)->aspect;
+ const float aspect = ((uiBlock *)region->uiblocks.first)->aspect;
const float zoom = 1.0f / aspect;
const int px = max_ii(1, round_fl_to_int(U.pixelsize));
const int px_x_sign = is_left ? px : -px;
@@ -1990,7 +2000,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
interp_v3_v3v3_uchar(
theme_col_tab_highlight_inactive, theme_col_tab_inactive, theme_col_text_hi, 0.12f);
- is_alpha = (ar->overlap && (theme_col_back[3] != 255));
+ is_alpha = (region->overlap && (theme_col_back[3] != 255));
if (fstyle->kerning == 1) {
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
@@ -2004,12 +2014,12 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* Check the region type supports categories to avoid an assert
* for showing 3D view panels in the properties space. */
- if ((1 << ar->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) {
- BLI_assert(UI_panel_category_is_visible(ar));
+ if ((1 << region->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) {
+ BLI_assert(UI_panel_category_is_visible(region));
}
/* calculate tab rect's and check if we need to scale down */
- for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
+ for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
rcti *rct = &pc_dyn->rect;
const char *category_id = pc_dyn->idname;
const char *category_id_draw = IFACE_(category_id);
@@ -2027,7 +2037,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
if (y_ofs > BLI_rcti_size_y(&v2d->mask)) {
scaletabs = (float)BLI_rcti_size_y(&v2d->mask) / (float)y_ofs;
- for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
+ for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
rcti *rct = &pc_dyn->rect;
rct->ymin = ((rct->ymin - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax;
rct->ymax = ((rct->ymax - v2d->mask.ymax) * scaletabs) + v2d->mask.ymax;
@@ -2072,7 +2082,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
const int divider_xmax = is_left ? (v2d->mask.xmin + category_tabs_width) :
(v2d->mask.xmax - (category_tabs_width + px)) + px;
- for (pc_dyn = ar->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
+ for (pc_dyn = region->panels_category.first; pc_dyn; pc_dyn = pc_dyn->next) {
const rcti *rct = &pc_dyn->rect;
const char *category_id = pc_dyn->idname;
const char *category_id_draw = IFACE_(category_id);
@@ -2209,14 +2219,14 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
}
static int ui_handle_panel_category_cycling(const wmEvent *event,
- ARegion *ar,
+ ARegion *region,
const uiBut *active_but)
{
const bool is_mousewheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
const bool inside_tabregion =
- ((RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) != RGN_ALIGN_RIGHT) ?
- (event->mval[0] < ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmax) :
- (event->mval[0] > ((PanelCategoryDyn *)ar->panels_category.first)->rect.xmin));
+ ((RGN_ALIGN_ENUM_FROM_MASK(region->alignment) != RGN_ALIGN_RIGHT) ?
+ (event->mval[0] < ((PanelCategoryDyn *)region->panels_category.first)->rect.xmax) :
+ (event->mval[0] > ((PanelCategoryDyn *)region->panels_category.first)->rect.xmin));
/* if mouse is inside non-tab region, ctrl key is required */
if (is_mousewheel && !event->ctrl && !inside_tabregion) {
@@ -2228,9 +2238,9 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
* using ctrl+mousewheel work in tabbed regions */
}
else {
- const char *category = UI_panel_category_active_get(ar, false);
+ const char *category = UI_panel_category_active_get(region, false);
if (LIKELY(category)) {
- PanelCategoryDyn *pc_dyn = UI_panel_category_find(ar, category);
+ PanelCategoryDyn *pc_dyn = UI_panel_category_find(region, category);
if (LIKELY(pc_dyn)) {
if (is_mousewheel) {
/* we can probably get rid of this and only allow ctrl+tabbing */
@@ -2242,15 +2252,15 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
if (!pc_dyn) {
/* proper cyclic behavior,
* back to first/last category (only used for ctrl+tab) */
- pc_dyn = backwards ? ar->panels_category.last : ar->panels_category.first;
+ pc_dyn = backwards ? region->panels_category.last : region->panels_category.first;
}
}
if (pc_dyn) {
/* intentionally don't reset scroll in this case,
* this allows for quick browsing between tabs */
- UI_panel_category_active_set(ar, pc_dyn->idname);
- ED_region_tag_redraw(ar);
+ UI_panel_category_active_set(region, pc_dyn->idname);
+ ED_region_tag_redraw(region);
}
}
}
@@ -2265,18 +2275,18 @@ static int ui_handle_panel_category_cycling(const wmEvent *event,
int ui_handler_panel_region(bContext *C,
const wmEvent *event,
- ARegion *ar,
+ ARegion *region,
const uiBut *active_but)
{
uiBlock *block;
Panel *pa;
int retval, mx, my;
- bool has_category_tabs = UI_panel_category_is_visible(ar);
+ bool has_category_tabs = UI_panel_category_is_visible(region);
retval = WM_UI_HANDLER_CONTINUE;
/* Scrollbars can overlap panels now, they have handling priority. */
- if (UI_view2d_mouse_in_scrollers(ar, &ar->v2d, event->x, event->y)) {
+ if (UI_view2d_mouse_in_scrollers(region, &region->v2d, event->x, event->y)) {
return retval;
}
@@ -2284,13 +2294,13 @@ int ui_handler_panel_region(bContext *C,
if (has_category_tabs) {
if (event->val == KM_PRESS) {
if (event->type == LEFTMOUSE) {
- PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(ar, event);
+ PanelCategoryDyn *pc_dyn = UI_panel_category_find_mouse_over(region, event);
if (pc_dyn) {
- UI_panel_category_active_set(ar, pc_dyn->idname);
- ED_region_tag_redraw(ar);
+ UI_panel_category_active_set(region, pc_dyn->idname);
+ ED_region_tag_redraw(region);
/* reset scroll to the top [#38348] */
- UI_view2d_offset(&ar->v2d, -1.0f, 1.0f);
+ UI_view2d_offset(&region->v2d, -1.0f, 1.0f);
retval = WM_UI_HANDLER_BREAK;
}
@@ -2298,7 +2308,7 @@ int ui_handler_panel_region(bContext *C,
else if ((event->type == TABKEY && event->ctrl) ||
ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
/* cycle tabs */
- retval = ui_handle_panel_category_cycling(event, ar, active_but);
+ retval = ui_handle_panel_category_cycling(event, region, active_but);
}
}
}
@@ -2307,12 +2317,12 @@ int ui_handler_panel_region(bContext *C,
return retval;
}
- for (block = ar->uiblocks.last; block; block = block->prev) {
+ for (block = region->uiblocks.last; block; block = block->prev) {
uiPanelMouseState mouse_state;
mx = event->x;
my = event->y;
- ui_window_to_block(ar, block, &mx, &my);
+ ui_window_to_block(region, block, &mx, &my);
/* checks for mouse position inside */
pa = block->panel;
@@ -2347,7 +2357,7 @@ int ui_handler_panel_region(bContext *C,
}
/* on active button, do not handle panels */
- if (ui_region_find_active_but(ar) != NULL) {
+ if (ui_region_find_active_but(region) != NULL) {
continue;
}
@@ -2380,7 +2390,7 @@ int ui_handler_panel_region(bContext *C,
}
else if (event->type == RIGHTMOUSE) {
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
- ui_popup_context_menu_for_panel(C, ar, block->panel);
+ ui_popup_context_menu_for_panel(C, region, block->panel);
retval = WM_UI_HANDLER_BREAK;
break;
}
@@ -2390,7 +2400,7 @@ int ui_handler_panel_region(bContext *C,
#if 0
if (block->handler) {
rem_blockhandler(sa, block->handler);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
retval = WM_UI_HANDLER_BREAK;
}
#endif
@@ -2423,7 +2433,7 @@ int ui_handler_panel_region(bContext *C,
}
CLAMP(sl->blockscale, 0.6, 1.0);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
retval = WM_UI_HANDLER_BREAK;
}
}
@@ -2448,8 +2458,8 @@ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata)
/* verify if we can stop */
if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- int align = panel_aligned(sa, ar);
+ ARegion *region = CTX_wm_region(C);
+ int align = panel_aligned(sa, region);
if (align) {
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
@@ -2493,7 +2503,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
{
uiHandlePanelData *data = pa->activedata;
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (data && data->state == state) {
return;
@@ -2507,8 +2517,8 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
* is very hard to control and use, and has no real benefit." - BillRey
* Aligorith, 2009Sep
*/
- // test_add_new_tabs(ar); // also copies locations of tabs in dragged panel
- check_panel_overlap(ar, NULL); /* clears */
+ // test_add_new_tabs(region); // also copies locations of tabs in dragged panel
+ check_panel_overlap(region, NULL); /* clears */
}
pa->flag &= ~PNL_SELECT;
@@ -2552,7 +2562,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
data->starttime = PIL_check_seconds_timer();
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
PanelType *UI_paneltype_find(int space_id, int region_id, const char *idname)
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
index ab20b5ac520..03434b12ddb 100644
--- a/source/blender/editors/interface/interface_query.c
+++ b/source/blender/editors/interface/interface_query.c
@@ -206,15 +206,15 @@ bool ui_but_contains_rect(const uiBut *but, const rctf *rect)
return BLI_rctf_isect(&but->rect, rect, NULL);
}
-bool ui_but_contains_point_px(const uiBut *but, const ARegion *ar, int x, int y)
+bool ui_but_contains_point_px(const uiBut *but, const ARegion *region, int x, int y)
{
uiBlock *block = but->block;
- if (!ui_region_contains_point_px(ar, x, y)) {
+ if (!ui_region_contains_point_px(region, x, y)) {
return false;
}
float mx = x, my = y;
- ui_window_to_block_fl(ar, block, &mx, &my);
+ ui_window_to_block_fl(region, block, &mx, &my);
if (but->pie_dir != UI_RADIAL_NONE) {
if (!ui_but_isect_pie_seg(block, but)) {
@@ -228,12 +228,12 @@ bool ui_but_contains_point_px(const uiBut *but, const ARegion *ar, int x, int y)
return true;
}
-bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *ar, const wmEvent *event)
+bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *region, const wmEvent *event)
{
rcti rect;
int x = event->x, y = event->y;
- ui_window_to_block(ar, but->block, &x, &y);
+ ui_window_to_block(region, but->block, &x, &y);
BLI_rcti_rctf_copy(&rect, &but->rect);
@@ -253,16 +253,16 @@ bool ui_but_contains_point_px_icon(const uiBut *but, ARegion *ar, const wmEvent
}
/* x and y are only used in case event is NULL... */
-uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bool labeledit)
+uiBut *ui_but_find_mouse_over_ex(ARegion *region, const int x, const int y, const bool labeledit)
{
uiBut *butover = NULL;
- if (!ui_region_contains_point_px(ar, x, y)) {
+ if (!ui_region_contains_point_px(region, x, y)) {
return NULL;
}
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
float mx = x, my = y;
- ui_window_to_block_fl(ar, block, &mx, &my);
+ ui_window_to_block_fl(region, block, &mx, &my);
for (uiBut *but = block->buttons.last; but; but = but->prev) {
if (ui_but_is_interactive(but, labeledit)) {
@@ -291,14 +291,14 @@ uiBut *ui_but_find_mouse_over_ex(ARegion *ar, const int x, const int y, const bo
return butover;
}
-uiBut *ui_but_find_mouse_over(ARegion *ar, const wmEvent *event)
+uiBut *ui_but_find_mouse_over(ARegion *region, const wmEvent *event)
{
- return ui_but_find_mouse_over_ex(ar, event->x, event->y, event->ctrl != 0);
+ return ui_but_find_mouse_over_ex(region, event->x, event->y, event->ctrl != 0);
}
-uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px)
+uiBut *ui_but_find_rect_over(const struct ARegion *region, const rcti *rect_px)
{
- if (!ui_region_contains_rect_px(ar, rect_px)) {
+ if (!ui_region_contains_rect_px(region, rect_px)) {
return NULL;
}
@@ -308,9 +308,9 @@ uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px)
BLI_rctf_rcti_copy(&rect_px_fl, rect_px);
uiBut *butover = NULL;
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
rctf rect_block;
- ui_window_to_block_rctf(ar, block, &rect_block, &rect_px_fl);
+ ui_window_to_block_rctf(region, block, &rect_block, &rect_px_fl);
for (uiBut *but = block->buttons.last; but; but = but->prev) {
if (ui_but_is_interactive(but, labeledit)) {
@@ -334,14 +334,14 @@ uiBut *ui_but_find_rect_over(const struct ARegion *ar, const rcti *rect_px)
return butover;
}
-uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y)
+uiBut *ui_list_find_mouse_over_ex(ARegion *region, int x, int y)
{
- if (!ui_region_contains_point_px(ar, x, y)) {
+ if (!ui_region_contains_point_px(region, x, y)) {
return NULL;
}
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
float mx = x, my = y;
- ui_window_to_block_fl(ar, block, &mx, &my);
+ ui_window_to_block_fl(region, block, &mx, &my);
for (uiBut *but = block->buttons.last; but; but = but->prev) {
if (but->type == UI_BTYPE_LISTBOX && ui_but_contains_pt(but, mx, my)) {
return but;
@@ -352,9 +352,9 @@ uiBut *ui_list_find_mouse_over_ex(ARegion *ar, int x, int y)
return NULL;
}
-uiBut *ui_list_find_mouse_over(ARegion *ar, const wmEvent *event)
+uiBut *ui_list_find_mouse_over(ARegion *region, const wmEvent *event)
{
- return ui_list_find_mouse_over_ex(ar, event->x, event->y);
+ return ui_list_find_mouse_over_ex(region, event->x, event->y);
}
/** \} */
@@ -508,9 +508,9 @@ bool UI_block_can_add_separator(const uiBlock *block)
/** \name Region (#ARegion) State
* \{ */
-uiBut *ui_region_find_active_but(ARegion *ar)
+uiBut *ui_region_find_active_but(ARegion *region)
{
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
for (uiBut *but = block->buttons.first; but; but = but->next) {
if (but->active) {
return but;
@@ -521,9 +521,9 @@ uiBut *ui_region_find_active_but(ARegion *ar)
return NULL;
}
-uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int flag_exclude)
+uiBut *ui_region_find_first_but_test_flag(ARegion *region, int flag_include, int flag_exclude)
{
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
for (uiBut *but = block->buttons.first; but; but = but->next) {
if (((but->flag & flag_include) == flag_include) && ((but->flag & flag_exclude) == 0)) {
return but;
@@ -540,10 +540,10 @@ uiBut *ui_region_find_first_but_test_flag(ARegion *ar, int flag_include, int fla
/** \name Region (#ARegion) Spatial
* \{ */
-bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
+bool ui_region_contains_point_px(const ARegion *region, int x, int y)
{
rcti winrct;
- ui_region_winrct_get_no_margin(ar, &winrct);
+ ui_region_winrct_get_no_margin(region, &winrct);
if (!BLI_rcti_isect_pt(&winrct, x, y)) {
return false;
}
@@ -553,13 +553,13 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
* even when they are not visible, so we need to make a copy of the mask to
* use to check
*/
- if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) {
- const View2D *v2d = &ar->v2d;
+ if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
+ const View2D *v2d = &region->v2d;
int mx = x, my = y;
- ui_window_to_region(ar, &mx, &my);
+ ui_window_to_region(region, &mx, &my);
if (!BLI_rcti_isect_pt(&v2d->mask, mx, my) ||
- UI_view2d_mouse_in_scrollers(ar, &ar->v2d, x, y)) {
+ UI_view2d_mouse_in_scrollers(region, &region->v2d, x, y)) {
return false;
}
}
@@ -567,21 +567,21 @@ bool ui_region_contains_point_px(const ARegion *ar, int x, int y)
return true;
}
-bool ui_region_contains_rect_px(const ARegion *ar, const rcti *rect_px)
+bool ui_region_contains_rect_px(const ARegion *region, const rcti *rect_px)
{
rcti winrct;
- ui_region_winrct_get_no_margin(ar, &winrct);
+ ui_region_winrct_get_no_margin(region, &winrct);
if (!BLI_rcti_isect(&winrct, rect_px, NULL)) {
return false;
}
/* See comment in 'ui_region_contains_point_px' */
- if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) {
- const View2D *v2d = &ar->v2d;
+ if (region->v2d.mask.xmin != region->v2d.mask.xmax) {
+ const View2D *v2d = &region->v2d;
rcti rect_region;
- ui_window_to_region_rcti(ar, &rect_region, rect_px);
+ ui_window_to_region_rcti(region, &rect_region, rect_px);
if (!BLI_rcti_isect(&v2d->mask, &rect_region, NULL) ||
- UI_view2d_rect_in_scrollers(ar, &ar->v2d, rect_px)) {
+ UI_view2d_rect_in_scrollers(region, &region->v2d, rect_px)) {
return false;
}
}
@@ -598,13 +598,13 @@ bool ui_region_contains_rect_px(const ARegion *ar, const rcti *rect_px)
/** Check if the cursor is over any popups. */
ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, int x, int y)
{
- for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = screen->regionbase.first; region; region = region->next) {
rcti winrct;
- ui_region_winrct_get_no_margin(ar, &winrct);
+ ui_region_winrct_get_no_margin(region, &winrct);
if (BLI_rcti_isect_pt(&winrct, x, y)) {
- return ar;
+ return region;
}
}
return NULL;
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index d32cd5c17e2..04e6c5c24c2 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -87,12 +87,12 @@ static bool last_redo_poll(const bContext *C, short region_type)
return success;
}
-static void hud_region_hide(ARegion *ar)
+static void hud_region_hide(ARegion *region)
{
- ar->flag |= RGN_FLAG_HIDDEN;
+ region->flag |= RGN_FLAG_HIDDEN;
/* Avoids setting 'AREA_FLAG_REGION_SIZE_UPDATE'
* since other regions don't depend on this. */
- BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
+ BLI_rcti_init(&region->winrct, 0, 0, 0, 0);
}
/** \} */
@@ -104,9 +104,9 @@ static void hud_region_hide(ARegion *ar)
static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
- if (ar != NULL) {
- struct HudRegionData *hrd = ar->regiondata;
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
+ if (region != NULL) {
+ struct HudRegionData *hrd = region->regiondata;
if (hrd != NULL) {
return last_redo_poll(C, hrd->regionid);
}
@@ -156,76 +156,76 @@ static void hud_panels_register(ARegionType *art, int space_type, int region_typ
/** \name Callbacks for Floating Region
* \{ */
-static void hud_region_init(wmWindowManager *wm, ARegion *ar)
+static void hud_region_init(wmWindowManager *wm, ARegion *region)
{
- ED_region_panels_init(wm, ar);
- UI_region_handlers_add(&ar->handlers);
- ar->flag |= RGN_FLAG_TEMP_REGIONDATA;
+ ED_region_panels_init(wm, region);
+ UI_region_handlers_add(&region->handlers);
+ region->flag |= RGN_FLAG_TEMP_REGIONDATA;
}
-static void hud_region_free(ARegion *ar)
+static void hud_region_free(ARegion *region)
{
- MEM_SAFE_FREE(ar->regiondata);
+ MEM_SAFE_FREE(region->regiondata);
}
-static void hud_region_layout(const bContext *C, ARegion *ar)
+static void hud_region_layout(const bContext *C, ARegion *region)
{
- struct HudRegionData *hrd = ar->regiondata;
+ struct HudRegionData *hrd = region->regiondata;
if (hrd == NULL || !last_redo_poll(C, hrd->regionid)) {
- ED_region_tag_redraw(ar);
- hud_region_hide(ar);
+ ED_region_tag_redraw(region);
+ hud_region_hide(region);
return;
}
- int size_y = ar->sizey;
+ int size_y = region->sizey;
- ED_region_panels_layout(C, ar);
+ ED_region_panels_layout(C, region);
- if (ar->panels.first && (ar->sizey != size_y)) {
- int winx_new = UI_DPI_FAC * (ar->sizex + 0.5f);
- int winy_new = UI_DPI_FAC * (ar->sizey + 0.5f);
- View2D *v2d = &ar->v2d;
+ if (region->panels.first && (region->sizey != size_y)) {
+ int winx_new = UI_DPI_FAC * (region->sizex + 0.5f);
+ int winy_new = UI_DPI_FAC * (region->sizey + 0.5f);
+ View2D *v2d = &region->v2d;
- if (ar->flag & RGN_FLAG_SIZE_CLAMP_X) {
- CLAMP_MAX(winx_new, ar->winx);
+ if (region->flag & RGN_FLAG_SIZE_CLAMP_X) {
+ CLAMP_MAX(winx_new, region->winx);
}
- if (ar->flag & RGN_FLAG_SIZE_CLAMP_Y) {
- CLAMP_MAX(winy_new, ar->winy);
+ if (region->flag & RGN_FLAG_SIZE_CLAMP_Y) {
+ CLAMP_MAX(winy_new, region->winy);
}
- ar->winx = winx_new;
- ar->winy = winy_new;
+ region->winx = winx_new;
+ region->winy = winy_new;
- ar->winrct.xmax = (ar->winrct.xmin + ar->winx) - 1;
- ar->winrct.ymax = (ar->winrct.ymin + ar->winy) - 1;
+ region->winrct.xmax = (region->winrct.xmin + region->winx) - 1;
+ region->winrct.ymax = (region->winrct.ymin + region->winy) - 1;
- UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
+ UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_PANELS_UI, region->winx, region->winy);
/* Weak, but needed to avoid glitches, especially with hi-dpi
* (where resizing the view glitches often).
* Fortunately this only happens occasionally. */
- ED_region_panels_layout(C, ar);
+ ED_region_panels_layout(C, region);
}
/* restore view matrix */
UI_view2d_view_restore(C);
}
-static void hud_region_draw(const bContext *C, ARegion *ar)
+static void hud_region_draw(const bContext *C, ARegion *region)
{
- UI_view2d_view_ortho(&ar->v2d);
- wmOrtho2_region_pixelspace(ar);
+ UI_view2d_view_ortho(&region->v2d);
+ wmOrtho2_region_pixelspace(region);
GPU_clear_color(0, 0, 0, 0.0f);
GPU_clear(GPU_COLOR_BIT);
- if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
+ if ((region->flag & RGN_FLAG_HIDDEN) == 0) {
ui_draw_menu_back(NULL,
NULL,
&(rcti){
- .xmax = ar->winx,
- .ymax = ar->winy,
+ .xmax = region->winx,
+ .ymax = region->winy,
});
- ED_region_panels_draw(C, ar);
+ ED_region_panels_draw(C, region);
}
}
@@ -252,28 +252,28 @@ ARegionType *ED_area_type_hud(int space_type)
static ARegion *hud_region_add(ScrArea *sa)
{
- ARegion *ar = MEM_callocN(sizeof(ARegion), "area region");
+ ARegion *region = MEM_callocN(sizeof(ARegion), "area region");
ARegion *ar_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
if (ar_win) {
- BLI_insertlinkbefore(&sa->regionbase, ar_win, ar);
+ BLI_insertlinkbefore(&sa->regionbase, ar_win, region);
}
else {
- BLI_addtail(&sa->regionbase, ar);
+ BLI_addtail(&sa->regionbase, region);
}
- ar->regiontype = RGN_TYPE_HUD;
- ar->alignment = RGN_ALIGN_FLOAT;
- ar->overlap = true;
- ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
+ region->regiontype = RGN_TYPE_HUD;
+ region->alignment = RGN_ALIGN_FLOAT;
+ region->overlap = true;
+ region->flag |= RGN_FLAG_DYNAMIC_SIZE;
if (ar_win) {
float x, y;
UI_view2d_scroller_size_get(&ar_win->v2d, &x, &y);
- ar->runtime.offset_x = x;
- ar->runtime.offset_y = y;
+ region->runtime.offset_x = x;
+ region->runtime.offset_y = y;
}
- return ar;
+ return region;
}
void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep)
@@ -282,11 +282,11 @@ void ED_area_type_hud_clear(wmWindowManager *wm, ScrArea *sa_keep)
bScreen *screen = WM_window_get_active_screen(win);
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
if (sa != sa_keep) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_HUD) {
- if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
- hud_region_hide(ar);
- ED_region_tag_redraw(ar);
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_HUD) {
+ if ((region->flag & RGN_FLAG_HIDDEN) == 0) {
+ hud_region_hide(region);
+ ED_region_tag_redraw(region);
ED_area_tag_redraw(sa);
}
}
@@ -306,49 +306,49 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
return;
}
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
- if (ar && (ar->flag & RGN_FLAG_HIDDEN_BY_USER)) {
+ if (region && (region->flag & RGN_FLAG_HIDDEN_BY_USER)) {
/* The region is intentionally hidden by the user, don't show it. */
- hud_region_hide(ar);
+ hud_region_hide(region);
return;
}
bool init = false;
- bool was_hidden = ar == NULL || ar->visible == false;
+ bool was_hidden = region == NULL || region->visible == false;
ARegion *ar_op = CTX_wm_region(C);
BLI_assert((ar_op == NULL) || (ar_op->regiontype != RGN_TYPE_HUD));
if (!last_redo_poll(C, ar_op ? ar_op->regiontype : -1)) {
- if (ar) {
- ED_region_tag_redraw(ar);
- hud_region_hide(ar);
+ if (region) {
+ ED_region_tag_redraw(region);
+ hud_region_hide(region);
}
return;
}
- if (ar == NULL) {
+ if (region == NULL) {
init = true;
- ar = hud_region_add(sa);
- ar->type = art;
+ region = hud_region_add(sa);
+ region->type = art;
}
/* Let 'ED_area_update_region_sizes' do the work of placing the region.
- * Otherwise we could set the 'ar->winrct' & 'ar->winx/winy' here. */
+ * Otherwise we could set the 'region->winrct' & 'region->winx/winy' here. */
if (init) {
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
else {
- if (ar->flag & RGN_FLAG_HIDDEN) {
+ if (region->flag & RGN_FLAG_HIDDEN) {
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
- ar->flag &= ~RGN_FLAG_HIDDEN;
+ region->flag &= ~RGN_FLAG_HIDDEN;
}
{
- struct HudRegionData *hrd = ar->regiondata;
+ struct HudRegionData *hrd = region->regiondata;
if (hrd == NULL) {
hrd = MEM_callocN(sizeof(*hrd), __func__);
- ar->regiondata = hrd;
+ region->regiondata = hrd;
}
if (ar_op) {
hrd->regionid = ar_op->regiontype;
@@ -364,37 +364,37 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
ED_area_update_region_sizes(wm, win, sa);
}
- ED_region_floating_initialize(ar);
- ED_region_tag_redraw(ar);
+ ED_region_floating_initialize(region);
+ ED_region_tag_redraw(region);
/* Reset zoom level (not well supported). */
- ar->v2d.cur = ar->v2d.tot = (rctf){
- .xmax = ar->winx,
- .ymax = ar->winy,
+ region->v2d.cur = region->v2d.tot = (rctf){
+ .xmax = region->winx,
+ .ymax = region->winy,
};
- ar->v2d.minzoom = 1.0f;
- ar->v2d.maxzoom = 1.0f;
+ region->v2d.minzoom = 1.0f;
+ region->v2d.maxzoom = 1.0f;
- ar->visible = !(ar->flag & RGN_FLAG_HIDDEN);
+ region->visible = !(region->flag & RGN_FLAG_HIDDEN);
/* We shouldn't need to do this every time :S */
/* XXX, this is evil! - it also makes the menu show on first draw. :( */
- if (ar->visible) {
+ if (region->visible) {
ARegion *ar_prev = CTX_wm_region(C);
- CTX_wm_region_set((bContext *)C, ar);
- hud_region_layout(C, ar);
+ CTX_wm_region_set((bContext *)C, region);
+ hud_region_layout(C, region);
if (was_hidden) {
- ar->winx = ar->v2d.winx;
- ar->winy = ar->v2d.winy;
- ar->v2d.cur = ar->v2d.tot = (rctf){
- .xmax = ar->winx,
- .ymax = ar->winy,
+ region->winx = region->v2d.winx;
+ region->winy = region->v2d.winy;
+ region->v2d.cur = region->v2d.tot = (rctf){
+ .xmax = region->winx,
+ .ymax = region->winy,
};
}
CTX_wm_region_set((bContext *)C, ar_prev);
}
- ar->visible = !((ar->flag & RGN_FLAG_HIDDEN) || (ar->flag & RGN_FLAG_TOO_SMALL));
+ region->visible = !((region->flag & RGN_FLAG_HIDDEN) || (region->flag & RGN_FLAG_TOO_SMALL));
}
/** \} */
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index 2b6125fc193..1d066b6bbb1 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -277,15 +277,15 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
/* for a header menu we set the direction automatic */
if (!pup->slideout && flip) {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- if (sa && ar) {
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ ARegion *region = CTX_wm_region(C);
+ if (sa && region) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP);
UI_block_order_flip(block);
}
}
- if (ar->regiontype == RGN_TYPE_FOOTER) {
+ if (region->regiontype == RGN_TYPE_FOOTER) {
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP);
UI_block_order_flip(block);
@@ -669,8 +669,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
/* In the case we have nested popups,
* closing one may need to redraw another, see: T48874 */
- for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
- ED_region_tag_refresh_ui(ar);
+ for (ARegion *region = screen->regionbase.first; region; region = region->next) {
+ ED_region_tag_refresh_ui(region);
}
}
}
@@ -678,8 +678,8 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
bool UI_popup_block_name_exists(const bScreen *screen, const char *name)
{
- for (const ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
- for (const uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ for (const ARegion *region = screen->regionbase.first; region; region = region->next) {
+ for (const uiBlock *block = region->uiblocks.first; block; block = block->next) {
if (STREQ(block->name, name)) {
return true;
}
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index 5e88d48a787..4e4854c8209 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -172,21 +172,21 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
if (!slideout) {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar && ar->panels.first) {
+ if (region && region->panels.first) {
/* For regions with panels, prefer to open to top so we can
* see the values of the buttons below changing. */
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
}
/* Prefer popover from header to be positioned into the editor. */
- else if (sa && ar) {
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ else if (sa && region) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_header_alignment(sa)) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
}
}
- if (ar->regiontype == RGN_TYPE_FOOTER) {
+ if (region->regiontype == RGN_TYPE_FOOTER) {
if (RGN_ALIGN_ENUM_FROM_MASK(ED_area_footer_alignment(sa)) == RGN_ALIGN_BOTTOM) {
UI_block_direction_set(block, UI_DIR_UP | UI_DIR_CENTER_X);
}
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index 462f4871764..8db70d9a1cc 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -57,18 +57,18 @@
/**
* Translate any popup regions (so we can drag them).
*/
-void ui_popup_translate(ARegion *ar, const int mdiff[2])
+void ui_popup_translate(ARegion *region, const int mdiff[2])
{
uiBlock *block;
- BLI_rcti_translate(&ar->winrct, UNPACK2(mdiff));
+ BLI_rcti_translate(&region->winrct, UNPACK2(mdiff));
- ED_region_update_rect(ar);
+ ED_region_update_rect(region);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
/* update blocks */
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
uiPopupBlockHandle *handle = block->handle;
/* Make empty, will be initialized on next use, see T60608. */
BLI_rctf_init(&handle->prev_block_rect, 0, 0, 0, 0);
@@ -369,19 +369,19 @@ static void ui_popup_block_position(wmWindow *window,
/** \name Menu Block Creation
* \{ */
-static void ui_block_region_refresh(const bContext *C, ARegion *ar)
+static void ui_block_region_refresh(const bContext *C, ARegion *region)
{
ScrArea *ctx_area = CTX_wm_area(C);
ARegion *ctx_region = CTX_wm_region(C);
uiBlock *block;
- if (ar->do_draw & RGN_REFRESH_UI) {
+ if (region->do_draw & RGN_REFRESH_UI) {
ScrArea *handle_ctx_area;
ARegion *handle_ctx_region;
uiBlock *block_next;
- ar->do_draw &= ~RGN_REFRESH_UI;
- for (block = ar->uiblocks.first; block; block = block_next) {
+ region->do_draw &= ~RGN_REFRESH_UI;
+ for (block = region->uiblocks.first; block; block = block_next) {
block_next = block->next;
uiPopupBlockHandle *handle = block->handle;
@@ -407,11 +407,11 @@ static void ui_block_region_refresh(const bContext *C, ARegion *ar)
CTX_wm_region_set((bContext *)C, ctx_region);
}
-static void ui_block_region_draw(const bContext *C, ARegion *ar)
+static void ui_block_region_draw(const bContext *C, ARegion *region)
{
uiBlock *block;
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (block = region->uiblocks.first; block; block = block->next) {
UI_block_draw(C, block);
}
}
@@ -421,7 +421,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
*/
static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -430,7 +430,7 @@ static void ui_block_region_popup_window_listener(wmWindow *UNUSED(win),
switch (wmn->action) {
case NA_EDITED: {
/* window resize */
- ED_region_tag_refresh_ui(ar);
+ ED_region_tag_refresh_ui(region);
break;
}
}
@@ -573,13 +573,13 @@ uiBlock *ui_popup_block_refresh(bContext *C,
{
const int margin = UI_POPUP_MARGIN;
wmWindow *window = CTX_wm_window(C);
- ARegion *ar = handle->region;
+ ARegion *region = handle->region;
uiBlockCreateFunc create_func = handle->popup_create_vars.create_func;
uiBlockHandleCreateFunc handle_create_func = handle->popup_create_vars.handle_create_func;
void *arg = handle->popup_create_vars.arg;
- uiBlock *block_old = ar->uiblocks.first;
+ uiBlock *block_old = region->uiblocks.first;
uiBlock *block;
handle->refresh = (block_old != NULL);
@@ -592,7 +592,7 @@ uiBlock *ui_popup_block_refresh(bContext *C,
/* create ui block */
if (create_func) {
- block = create_func(C, ar, arg);
+ block = create_func(C, region, arg);
}
else {
block = handle_create_func(C, handle, arg);
@@ -615,7 +615,7 @@ uiBlock *ui_popup_block_refresh(bContext *C,
block->handle = handle;
}
- ar->regiondata = handle;
+ region->regiondata = handle;
/* set UI_BLOCK_NUMSELECT before UI_block_end() so we get alphanumeric keys assigned */
if (but == NULL) {
@@ -689,10 +689,10 @@ uiBlock *ui_popup_block_refresh(bContext *C,
}
}
- ar->winrct.xmin = 0;
- ar->winrct.xmax = winx;
- ar->winrct.ymin = 0;
- ar->winrct.ymax = winy;
+ region->winrct.xmin = 0;
+ region->winrct.xmax = winx;
+ region->winrct.ymin = 0;
+ region->winrct.ymax = winy;
ui_block_calc_pie_segment(block, block->pie_data.pie_center_init);
@@ -733,12 +733,12 @@ uiBlock *ui_popup_block_refresh(bContext *C,
/* the block and buttons were positioned in window space as in 2.4x, now
* these menu blocks are regions so we bring it back to region space.
* additionally we add some padding for the menu shadow or rounded menus */
- ar->winrct.xmin = block->rect.xmin - margin;
- ar->winrct.xmax = block->rect.xmax + margin;
- ar->winrct.ymin = block->rect.ymin - margin;
- ar->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP;
+ region->winrct.xmin = block->rect.xmin - margin;
+ region->winrct.xmax = block->rect.xmax + margin;
+ region->winrct.ymin = block->rect.ymin - margin;
+ region->winrct.ymax = block->rect.ymax + UI_POPUP_MENU_TOP;
- UI_block_translate(block, -ar->winrct.xmin, -ar->winrct.ymin);
+ UI_block_translate(block, -region->winrct.xmin, -region->winrct.ymin);
/* apply scroll offset */
if (handle->scrolloffset != 0.0f) {
@@ -752,22 +752,22 @@ uiBlock *ui_popup_block_refresh(bContext *C,
if (block_old) {
block->oldblock = block_old;
UI_block_update_from_old(C, block);
- UI_blocklist_free_inactive(C, &ar->uiblocks);
+ UI_blocklist_free_inactive(C, &region->uiblocks);
}
/* checks which buttons are visible, sets flags to prevent draw (do after region init) */
ui_popup_block_scrolltest(block);
/* adds subwindow */
- ED_region_floating_initialize(ar);
+ ED_region_floating_initialize(region);
/* get winmat now that we actually have the subwindow */
- wmGetProjectionMatrix(block->winmat, &ar->winrct);
+ wmGetProjectionMatrix(block->winmat, &region->winrct);
/* notify change and redraw */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
- ED_region_update_rect(ar);
+ ED_region_update_rect(region);
#ifdef DEBUG
window->eventstate = event_back;
@@ -787,7 +787,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
wmWindow *window = CTX_wm_window(C);
uiBut *activebut = UI_context_active_but_get(C);
static ARegionType type;
- ARegion *ar;
+ ARegion *region;
uiBlock *block;
uiPopupBlockHandle *handle;
@@ -818,16 +818,16 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
handle->can_refresh = false;
/* create area region */
- ar = ui_region_temp_add(CTX_wm_screen(C));
- handle->region = ar;
+ region = ui_region_temp_add(CTX_wm_screen(C));
+ handle->region = region;
memset(&type, 0, sizeof(ARegionType));
type.draw = ui_block_region_draw;
type.layout = ui_block_region_refresh;
type.regionid = RGN_TYPE_TEMPORARY;
- ar->type = &type;
+ region->type = &type;
- UI_region_handlers_add(&ar->handlers);
+ UI_region_handlers_add(&region->handlers);
block = ui_popup_block_refresh(C, handle, butregion, but);
handle = block->handle;
@@ -844,9 +844,9 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
/* If this popup is created from a popover which does NOT have keep-open flag set,
* then close the popover too. We could extend this to other popup types too. */
- ARegion *ar = handle->popup_create_vars.butregion;
- if (ar != NULL) {
- for (uiBlock *block = ar->uiblocks.first; block; block = block->next) {
+ ARegion *region = handle->popup_create_vars.butregion;
+ if (region != NULL) {
+ for (uiBlock *block = region->uiblocks.first; block; block = block->next) {
if (block->handle && (block->flag & UI_BLOCK_POPOVER) &&
(block->flag & UI_BLOCK_KEEP_OPEN) == 0) {
uiPopupBlockHandle *menu = block->handle;
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index 94bcd6ab37d..4481ad54d1a 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -161,10 +161,10 @@ int UI_search_items_find_index(uiSearchItems *items, const char *name)
return -1;
}
-/* ar is the search box itself */
-static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
+/* region is the search box itself */
+static void ui_searchbox_select(bContext *C, ARegion *region, uiBut *but, int step)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
/* apply step */
data->active += step;
@@ -176,7 +176,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
if (data->items.more) {
data->items.offset++;
data->active = data->items.totitem - 1;
- ui_searchbox_update(C, ar, but, false);
+ ui_searchbox_update(C, region, but, false);
}
else {
data->active = data->items.totitem - 1;
@@ -186,7 +186,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
if (data->items.offset) {
data->items.offset--;
data->active = 0;
- ui_searchbox_update(C, ar, but, false);
+ ui_searchbox_update(C, region, but, false);
}
else {
/* only let users step into an 'unset' state for unlink buttons */
@@ -194,7 +194,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
}
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr)
@@ -229,24 +229,24 @@ static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr
}
}
-int ui_searchbox_find_index(ARegion *ar, const char *name)
+int ui_searchbox_find_index(ARegion *region, const char *name)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
return UI_search_items_find_index(&data->items, name);
}
/* x and y in screencoords */
-bool ui_searchbox_inside(ARegion *ar, int x, int y)
+bool ui_searchbox_inside(ARegion *region, int x, int y)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
- return BLI_rcti_isect_pt(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin);
+ return BLI_rcti_isect_pt(&data->bbox, x - region->winrct.xmin, y - region->winrct.ymin);
}
/* string validated to be of correct length (but->hardmax) */
-bool ui_searchbox_apply(uiBut *but, ARegion *ar)
+bool ui_searchbox_apply(uiBut *but, ARegion *region)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
but->func_arg2 = NULL;
@@ -272,9 +272,9 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
}
}
-void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *event)
+void ui_searchbox_event(bContext *C, ARegion *region, uiBut *but, const wmEvent *event)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
int type = event->type, val = event->val;
if (type == MOUSEPAN) {
@@ -284,23 +284,24 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *eve
switch (type) {
case WHEELUPMOUSE:
case UPARROWKEY:
- ui_searchbox_select(C, ar, but, -1);
+ ui_searchbox_select(C, region, but, -1);
break;
case WHEELDOWNMOUSE:
case DOWNARROWKEY:
- ui_searchbox_select(C, ar, but, 1);
+ ui_searchbox_select(C, region, but, 1);
break;
case MOUSEMOVE:
- if (BLI_rcti_isect_pt(&ar->winrct, event->x, event->y)) {
+ if (BLI_rcti_isect_pt(&region->winrct, event->x, event->y)) {
rcti rect;
int a;
for (a = 0; a < data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
- if (BLI_rcti_isect_pt(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+ if (BLI_rcti_isect_pt(
+ &rect, event->x - region->winrct.xmin, event->y - region->winrct.ymin)) {
if (data->active != a) {
data->active = a;
- ui_searchbox_select(C, ar, but, 0);
+ ui_searchbox_select(C, region, but, 0);
break;
}
}
@@ -310,10 +311,10 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, const wmEvent *eve
}
}
-/* ar is the search box itself */
-void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
+/* region is the search box itself */
+void ui_searchbox_update(bContext *C, ARegion *region, uiBut *but, const bool reset)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
/* reset vars */
data->items.totitem = 0;
@@ -379,14 +380,14 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, const bool reset)
}
/* validate selected item */
- ui_searchbox_select(C, ar, but, 0);
+ ui_searchbox_select(C, region, but, 0);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
-int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
+int ui_searchbox_autocomplete(bContext *C, ARegion *region, uiBut *but, char *str)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
int match = AUTOCOMPLETE_NO_MATCH;
if (str[0]) {
@@ -401,12 +402,12 @@ int ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
return match;
}
-static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
+static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
/* pixel space */
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
if (data->noback == false) {
ui_draw_widget_menu_back(&data->bbox, true);
@@ -477,9 +478,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
}
}
-static void ui_searchbox_region_free_cb(ARegion *ar)
+static void ui_searchbox_region_free_cb(ARegion *region)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
int a;
/* free search data */
@@ -491,7 +492,7 @@ static void ui_searchbox_region_free_cb(ARegion *ar)
MEM_freeN(data->items.icons);
MEM_freeN(data);
- ar->regiondata = NULL;
+ region->regiondata = NULL;
}
ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but)
@@ -499,7 +500,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
wmWindow *win = CTX_wm_window(C);
uiStyle *style = UI_style_get();
static ARegionType type;
- ARegion *ar;
+ ARegion *region;
uiSearchboxData *data;
float aspect = but->block->aspect;
rctf rect_fl;
@@ -509,13 +510,13 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
int i;
/* create area region */
- ar = ui_region_temp_add(CTX_wm_screen(C));
+ region = ui_region_temp_add(CTX_wm_screen(C));
memset(&type, 0, sizeof(ARegionType));
type.draw = ui_searchbox_region_draw_cb;
type.free = ui_searchbox_region_free_cb;
type.regionid = RGN_TYPE_TEMPORARY;
- ar->type = &type;
+ region->type = &type;
/* create searchbox data */
data = MEM_callocN(sizeof(uiSearchboxData), "uiSearchboxData");
@@ -525,7 +526,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
ui_fontscale(&data->fstyle.points, aspect);
UI_fontstyle_set(&data->fstyle);
- ar->regiondata = data;
+ region->regiondata = data;
/* special case, hardcoded feature, not draw backdrop when called from menus,
* assume for design that popup already added it */
@@ -553,13 +554,13 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
/* this case is search menu inside other menu */
/* we copy region size */
- ar->winrct = butregion->winrct;
+ region->winrct = butregion->winrct;
/* widget rect, in region coords */
data->bbox.xmin = margin;
- data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - margin;
+ data->bbox.xmax = BLI_rcti_size_x(&region->winrct) - margin;
data->bbox.ymin = margin;
- data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - margin;
+ data->bbox.ymax = BLI_rcti_size_y(&region->winrct) - margin;
/* check if button is lower half */
if (but->rect.ymax < BLI_rctf_cent_y(&but->block->rect)) {
@@ -632,17 +633,17 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
data->bbox.ymax = BLI_rcti_size_y(&rect_i) + margin;
/* region bigger for shadow */
- ar->winrct.xmin = rect_i.xmin - margin;
- ar->winrct.xmax = rect_i.xmax + margin;
- ar->winrct.ymin = rect_i.ymin - margin;
- ar->winrct.ymax = rect_i.ymax;
+ region->winrct.xmin = rect_i.xmin - margin;
+ region->winrct.xmax = rect_i.xmax + margin;
+ region->winrct.ymin = rect_i.ymin - margin;
+ region->winrct.ymax = rect_i.ymax;
}
/* adds subwindow */
- ED_region_floating_initialize(ar);
+ ED_region_floating_initialize(region);
/* notify change and redraw */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
/* prepare search data */
if (data->preview) {
@@ -660,7 +661,7 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
data->items.names[i] = MEM_callocN(but->hardmax + 1, "search pointers");
}
- return ar;
+ return region;
}
/**
@@ -688,12 +689,12 @@ static void str_tolower_titlecaps_ascii(char *str, const size_t len)
}
}
-static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *ar)
+static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARegion *region)
{
- uiSearchboxData *data = ar->regiondata;
+ uiSearchboxData *data = region->regiondata;
/* pixel space */
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
if (data->noback == false) {
ui_draw_widget_menu_back(&data->bbox, true);
@@ -764,19 +765,19 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
ARegion *ui_searchbox_create_operator(bContext *C, ARegion *butregion, uiBut *but)
{
- ARegion *ar;
+ ARegion *region;
UI_but_drawflag_enable(but, UI_BUT_HAS_SHORTCUT);
- ar = ui_searchbox_create_generic(C, butregion, but);
+ region = ui_searchbox_create_generic(C, butregion, but);
- ar->type->draw = ui_searchbox_region_draw_cb__operator;
+ region->type->draw = ui_searchbox_region_draw_cb__operator;
- return ar;
+ return region;
}
-void ui_searchbox_free(bContext *C, ARegion *ar)
+void ui_searchbox_free(bContext *C, ARegion *region)
{
- ui_region_temp_remove(C, CTX_wm_screen(C), ar);
+ ui_region_temp_remove(C, CTX_wm_screen(C), region);
}
/* sets red alert if button holds a string it can't find */
diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c
index 7a0c04be356..c18c78c22a6 100644
--- a/source/blender/editors/interface/interface_region_tooltip.c
+++ b/source/blender/editors/interface/interface_region_tooltip.c
@@ -148,10 +148,10 @@ static void rgb_tint(float col[3], float h, float h_strength, float v, float v_s
hsv_to_rgb_v(col_hsv_to, col);
}
-static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
+static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region)
{
const float pad_px = UI_TIP_PADDING;
- uiTooltipData *data = ar->regiondata;
+ uiTooltipData *data = region->regiondata;
const uiWidgetColors *theme = ui_tooltip_get_theme();
rcti bbox = data->bbox;
float tip_colors[UI_TIP_LC_MAX][3];
@@ -168,7 +168,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
float tone_bg;
int i;
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
/* draw background */
ui_draw_tooltip_background(UI_style_get(), NULL, &bbox);
@@ -271,11 +271,11 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
BLF_disable(blf_mono_font, BLF_WORD_WRAP);
}
-static void ui_tooltip_region_free_cb(ARegion *ar)
+static void ui_tooltip_region_free_cb(ARegion *region)
{
uiTooltipData *data;
- data = ar->regiondata;
+ data = region->regiondata;
for (int i = 0; i < data->fields_len; i++) {
const uiTooltipField *field = &data->fields[i];
@@ -286,7 +286,7 @@ static void ui_tooltip_region_free_cb(ARegion *ar)
}
MEM_freeN(data->fields);
MEM_freeN(data);
- ar->regiondata = NULL;
+ region->regiondata = NULL;
}
/** \} */
@@ -1160,20 +1160,20 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
const int winy = WM_window_pixels_y(win);
uiStyle *style = UI_style_get();
static ARegionType type;
- ARegion *ar;
+ ARegion *region;
int fonth, fontw;
int h, i;
rcti rect_i;
int font_flag = 0;
/* create area region */
- ar = ui_region_temp_add(CTX_wm_screen(C));
+ region = ui_region_temp_add(CTX_wm_screen(C));
memset(&type, 0, sizeof(ARegionType));
type.draw = ui_tooltip_region_draw_cb;
type.free = ui_tooltip_region_free_cb;
type.regionid = RGN_TYPE_TEMPORARY;
- ar->type = &type;
+ region->type = &type;
/* set font, get bb */
data->fstyle = style->widget; /* copy struct */
@@ -1237,7 +1237,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
BLF_disable(data->fstyle.uifont_id, font_flag);
BLF_disable(blf_mono_font, font_flag);
- ar->regiondata = data;
+ region->regiondata = data;
data->toth = fonth;
data->lineh = h;
@@ -1384,19 +1384,19 @@ static ARegion *ui_tooltip_create_with_data(bContext *C,
data->bbox.ymax = BLI_rcti_size_y(&rect_i);
/* region bigger for shadow */
- ar->winrct.xmin = rect_i.xmin - margin;
- ar->winrct.xmax = rect_i.xmax + margin;
- ar->winrct.ymin = rect_i.ymin - margin;
- ar->winrct.ymax = rect_i.ymax + margin;
+ region->winrct.xmin = rect_i.xmin - margin;
+ region->winrct.xmax = rect_i.xmax + margin;
+ region->winrct.ymin = rect_i.ymin - margin;
+ region->winrct.ymax = rect_i.ymax + margin;
}
/* adds subwindow */
- ED_region_floating_initialize(ar);
+ ED_region_floating_initialize(region);
/* notify change and redraw */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
- return ar;
+ return region;
}
/** \} */
@@ -1457,10 +1457,10 @@ ARegion *UI_tooltip_create_from_button(bContext *C, ARegion *butregion, uiBut *b
}
}
- ARegion *ar = ui_tooltip_create_with_data(
+ ARegion *region = ui_tooltip_create_with_data(
C, data, init_position, is_no_overlap ? &init_rect : NULL, aspect);
- return ar;
+ return region;
}
ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
@@ -1480,9 +1480,9 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
return ui_tooltip_create_with_data(C, data, init_position, NULL, aspect);
}
-void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *ar)
+void UI_tooltip_free(bContext *C, bScreen *sc, ARegion *region)
{
- ui_region_temp_remove(C, sc, ar);
+ ui_region_temp_remove(C, sc, region);
}
/** \} */
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 5ba4dcd7439..6150cc43554 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -41,28 +41,28 @@
ARegion *ui_region_temp_add(bScreen *sc)
{
- ARegion *ar;
+ ARegion *region;
- ar = MEM_callocN(sizeof(ARegion), "area region");
- BLI_addtail(&sc->regionbase, ar);
+ region = MEM_callocN(sizeof(ARegion), "area region");
+ BLI_addtail(&sc->regionbase, region);
- ar->regiontype = RGN_TYPE_TEMPORARY;
- ar->alignment = RGN_ALIGN_FLOAT;
+ region->regiontype = RGN_TYPE_TEMPORARY;
+ region->alignment = RGN_ALIGN_FLOAT;
- return ar;
+ return region;
}
-void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *ar)
+void ui_region_temp_remove(bContext *C, bScreen *sc, ARegion *region)
{
wmWindow *win = CTX_wm_window(C);
- BLI_assert(ar->regiontype == RGN_TYPE_TEMPORARY);
- BLI_assert(BLI_findindex(&sc->regionbase, ar) != -1);
+ BLI_assert(region->regiontype == RGN_TYPE_TEMPORARY);
+ BLI_assert(BLI_findindex(&sc->regionbase, region) != -1);
if (win) {
- wm_draw_region_clear(win, ar);
+ wm_draw_region_clear(win, region);
}
- ED_region_exit(C, ar);
- BKE_area_region_free(NULL, ar); /* NULL: no spacetype */
- BLI_freelinkN(&sc->regionbase, ar);
+ ED_region_exit(C, region);
+ BKE_area_region_free(NULL, region); /* NULL: no spacetype */
+ BLI_freelinkN(&sc->regionbase, region);
}
diff --git a/source/blender/editors/interface/interface_regions_intern.h b/source/blender/editors/interface/interface_regions_intern.h
index 31a0a0876a2..329ee3c08dc 100644
--- a/source/blender/editors/interface/interface_regions_intern.h
+++ b/source/blender/editors/interface/interface_regions_intern.h
@@ -28,6 +28,6 @@ uint ui_popup_menu_hash(const char *str);
/* interface_regions_intern.h */
ARegion *ui_region_temp_add(bScreen *sc);
-void ui_region_temp_remove(struct bContext *C, bScreen *sc, ARegion *ar);
+void ui_region_temp_remove(struct bContext *C, bScreen *sc, ARegion *region);
#endif /* __INTERFACE_REGIONS_INTERN_H__ */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 1566c9c4e88..c80c5317735 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -444,7 +444,7 @@ static void id_search_cb_objects_from_scene(const bContext *C,
}
/* ID Search browse menu, open */
-static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
+static uiBlock *id_search_menu(bContext *C, ARegion *region, void *arg_litem)
{
static TemplateID template_ui;
PointerRNA active_item_ptr;
@@ -464,7 +464,7 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
}
return template_common_search_menu(C,
- ar,
+ region,
id_search_cb_p,
&template_ui,
template_ID_set_property_cb,
@@ -2723,7 +2723,7 @@ void uiTemplatePreview(uiLayout *layout,
uiLayout *row, *col;
uiBlock *block;
uiPreview *ui_preview = NULL;
- ARegion *ar;
+ ARegion *region;
Material *ma = NULL;
Tex *tex = (Tex *)id;
@@ -2774,14 +2774,14 @@ void uiTemplatePreview(uiLayout *layout,
}
/* Find or add the uiPreview to the current Region. */
- ar = CTX_wm_region(C);
- ui_preview = BLI_findstring(&ar->ui_previews, preview_id, offsetof(uiPreview, preview_id));
+ region = CTX_wm_region(C);
+ ui_preview = BLI_findstring(&region->ui_previews, preview_id, offsetof(uiPreview, preview_id));
if (!ui_preview) {
ui_preview = MEM_callocN(sizeof(uiPreview), "uiPreview");
BLI_strncpy(ui_preview->preview_id, preview_id, sizeof(ui_preview->preview_id));
ui_preview->height = (short)(UI_UNIT_Y * 7.6f);
- BLI_addtail(&ar->ui_previews, ui_preview);
+ BLI_addtail(&region->ui_previews, ui_preview);
}
if (ui_preview->height < UI_UNIT_Y) {
@@ -3047,14 +3047,14 @@ static void colorband_tools_dofunc(bContext *C, void *coba_v, int event)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static uiBlock *colorband_tools_func(bContext *C, ARegion *ar, void *coba_v)
+static uiBlock *colorband_tools_func(bContext *C, ARegion *region, void *coba_v)
{
uiStyle *style = UI_style_get_dpi();
ColorBand *coba = coba_v;
uiBlock *block;
short yco = 0, menuwidth = 10 * UI_UNIT_X;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS_PULLDOWN);
UI_block_func_butmenu_set(block, colorband_tools_dofunc, coba);
uiLayout *layout = UI_block_layout(block,
@@ -3443,7 +3443,7 @@ typedef struct IconViewMenuArgs {
} IconViewMenuArgs;
/* ID Search browse menu, open */
-static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
+static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_litem)
{
static IconViewMenuArgs args;
uiBlock *block;
@@ -3459,7 +3459,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
w = UI_UNIT_X * (args.icon_scale);
h = UI_UNIT_X * (args.icon_scale + args.show_labels);
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS_PULLDOWN);
+ block = UI_block_begin(C, region, "_popup", UI_EMBOSS_PULLDOWN);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NO_FLIP);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
@@ -3867,14 +3867,14 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v)
}
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
+static uiBlock *curvemap_clipping_func(bContext *C, ARegion *region, void *cumap_v)
{
CurveMapping *cumap = cumap_v;
uiBlock *block;
uiBut *bt;
float width = 8 * UI_UNIT_X;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
@@ -4015,12 +4015,12 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
}
static uiBlock *curvemap_tools_func(
- bContext *C, ARegion *ar, CurveMapping *cumap, bool show_extend, int reset_mode)
+ bContext *C, ARegion *region, CurveMapping *cumap, bool show_extend, int reset_mode)
{
uiBlock *block;
short yco = 0, menuwidth = 10 * UI_UNIT_X;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_func_butmenu_set(block, curvemap_tools_dofunc, cumap);
{
@@ -4143,24 +4143,24 @@ static uiBlock *curvemap_tools_func(
return block;
}
-static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *ar, void *cumap_v)
+static uiBlock *curvemap_tools_posslope_func(bContext *C, ARegion *region, void *cumap_v)
{
- return curvemap_tools_func(C, ar, cumap_v, true, UICURVE_FUNC_RESET_POS);
+ return curvemap_tools_func(C, region, cumap_v, true, UICURVE_FUNC_RESET_POS);
}
-static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v)
+static uiBlock *curvemap_tools_negslope_func(bContext *C, ARegion *region, void *cumap_v)
{
- return curvemap_tools_func(C, ar, cumap_v, true, UICURVE_FUNC_RESET_NEG);
+ return curvemap_tools_func(C, region, cumap_v, true, UICURVE_FUNC_RESET_NEG);
}
-static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *ar, void *cumap_v)
+static uiBlock *curvemap_brush_tools_func(bContext *C, ARegion *region, void *cumap_v)
{
- return curvemap_tools_func(C, ar, cumap_v, false, UICURVE_FUNC_RESET_NEG);
+ return curvemap_tools_func(C, region, cumap_v, false, UICURVE_FUNC_RESET_NEG);
}
-static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *ar, void *cumap_v)
+static uiBlock *curvemap_brush_tools_negslope_func(bContext *C, ARegion *region, void *cumap_v)
{
- return curvemap_tools_func(C, ar, cumap_v, false, UICURVE_FUNC_RESET_POS);
+ return curvemap_tools_func(C, region, cumap_v, false, UICURVE_FUNC_RESET_POS);
}
static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
@@ -4563,14 +4563,14 @@ static void CurveProfile_presets_dofunc(bContext *C, void *profile_v, int event)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *ar, CurveProfile *profile)
+static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *region, CurveProfile *profile)
{
uiBlock *block;
short yco = 0;
short menuwidth = 12 * UI_UNIT_X;
menuwidth = 0;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_func_butmenu_set(block, CurveProfile_presets_dofunc, profile);
uiDefIconTextBut(block,
@@ -4655,9 +4655,9 @@ static uiBlock *CurveProfile_presets_func(bContext *C, ARegion *ar, CurveProfile
return block;
}
-static uiBlock *CurveProfile_buttons_presets(bContext *C, ARegion *ar, void *profile_v)
+static uiBlock *CurveProfile_buttons_presets(bContext *C, ARegion *region, void *profile_v)
{
- return CurveProfile_presets_func(C, ar, (CurveProfile *)profile_v);
+ return CurveProfile_presets_func(C, region, (CurveProfile *)profile_v);
}
/* Only for CurveProfile tools block */
@@ -4683,13 +4683,13 @@ static void CurveProfile_tools_dofunc(bContext *C, void *profile_v, int event)
ED_region_tag_redraw(CTX_wm_region(C));
}
-static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *ar, CurveProfile *profile)
+static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *region, CurveProfile *profile)
{
uiBlock *block;
short yco = 0;
short menuwidth = 10 * UI_UNIT_X;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_func_butmenu_set(block, CurveProfile_tools_dofunc, profile);
uiDefIconTextBut(block,
@@ -4729,9 +4729,9 @@ static uiBlock *CurveProfile_tools_func(bContext *C, ARegion *ar, CurveProfile *
return block;
}
-static uiBlock *CurveProfile_buttons_tools(bContext *C, ARegion *ar, void *profile_v)
+static uiBlock *CurveProfile_buttons_tools(bContext *C, ARegion *region, void *profile_v)
{
- return CurveProfile_tools_func(C, ar, (CurveProfile *)profile_v);
+ return CurveProfile_tools_func(C, region, (CurveProfile *)profile_v);
}
static void CurveProfile_buttons_zoom_in(bContext *C, void *profile_v, void *UNUSED(arg))
@@ -5934,7 +5934,7 @@ void uiTemplateList(uiLayout *layout,
uiListType *ui_list_type;
uiList *ui_list = NULL;
uiListDyn *dyn_data;
- ARegion *ar;
+ ARegion *region;
uiListDrawItemFunc draw_item;
uiListDrawFilterFunc draw_filter;
uiListFilterItemsFunc filter_items;
@@ -6026,16 +6026,16 @@ void uiTemplateList(uiLayout *layout,
ui_list_id, sizeof(ui_list_id), "%s_%s", ui_list_type->idname, list_id ? list_id : "");
/* Allows to work in popups. */
- ar = CTX_wm_menu(C);
- if (ar == NULL) {
- ar = CTX_wm_region(C);
+ region = CTX_wm_menu(C);
+ if (region == NULL) {
+ region = CTX_wm_region(C);
}
- ui_list = BLI_findstring(&ar->ui_lists, ui_list_id, offsetof(uiList, list_id));
+ ui_list = BLI_findstring(&region->ui_lists, ui_list_id, offsetof(uiList, list_id));
if (!ui_list) {
ui_list = MEM_callocN(sizeof(uiList), "uiList");
BLI_strncpy(ui_list->list_id, ui_list_id, sizeof(ui_list->list_id));
- BLI_addtail(&ar->ui_lists, ui_list);
+ BLI_addtail(&region->ui_lists, ui_list);
ui_list->list_grip = -UI_LIST_AUTO_SIZE_THRESHOLD; /* Force auto size by default. */
if (sort_reverse) {
ui_list->filter_sort_flag |= UILST_FLT_SORT_REVERSE;
@@ -7416,13 +7416,13 @@ typedef struct ComponentMenuArgs {
char propname[64]; /* XXX arbitrary */
} ComponentMenuArgs;
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
-static uiBlock *component_menu(bContext *C, ARegion *ar, void *args_v)
+static uiBlock *component_menu(bContext *C, ARegion *region, void *args_v)
{
ComponentMenuArgs *args = (ComponentMenuArgs *)args_v;
uiBlock *block;
uiLayout *layout;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN);
layout = uiLayoutColumn(UI_block_layout(block,
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8c28b29f5ab..31a1c150b12 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -4597,7 +4597,7 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
* \{ */
/* conversion from old to new buttons, so still messy */
-void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
+void ui_draw_but(const bContext *C, ARegion *region, uiStyle *style, uiBut *but, rcti *rect)
{
bTheme *btheme = UI_GetTheme();
const ThemeUI *tui = &btheme->tui;
@@ -4790,30 +4790,30 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case UI_BTYPE_IMAGE:
- ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_IMAGE(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_HISTOGRAM:
- ui_draw_but_HISTOGRAM(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_HISTOGRAM(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_WAVEFORM:
- ui_draw_but_WAVEFORM(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_WAVEFORM(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_VECTORSCOPE:
- ui_draw_but_VECTORSCOPE(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_VECTORSCOPE(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_CURVE:
/* do not draw right to edge of rect */
rect->xmin += (0.2f * UI_UNIT_X);
rect->xmax -= (0.2f * UI_UNIT_X);
- ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_CURVE(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_CURVEPROFILE:
- ui_draw_but_CURVEPROFILE(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_CURVEPROFILE(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_PROGRESS_BAR:
@@ -4830,7 +4830,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case UI_BTYPE_TRACK_PREVIEW:
- ui_draw_but_TRACKPREVIEW(ar, but, &tui->wcol_regular, rect);
+ ui_draw_but_TRACKPREVIEW(region, but, &tui->wcol_regular, rect);
break;
case UI_BTYPE_NODE_SOCKET:
@@ -5012,13 +5012,13 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol,
GPU_blend(false);
}
-void ui_draw_popover_back(ARegion *ar, uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
+void ui_draw_popover_back(ARegion *region, uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
{
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK);
if (block) {
float mval_origin[2] = {UNPACK2(block->bounds_offset)};
- ui_window_to_block_fl(ar, block, &mval_origin[0], &mval_origin[1]);
+ ui_window_to_block_fl(region, block, &mval_origin[0], &mval_origin[1]);
ui_draw_popover_back_impl(
wt->wcol_theme, rect, block->direction, U.widget_unit / block->aspect, mval_origin);
}
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index ac65ce2a28e..af32143df33 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -866,7 +866,7 @@ void UI_view2d_curRect_validate(View2D *v2d)
void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
/* don't continue if no view syncing to be done */
if ((v2dcur->flag & (V2D_VIEWSYNC_SCREEN_TIME | V2D_VIEWSYNC_AREA_VERTICAL)) == 0) {
@@ -875,24 +875,24 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
/* check if doing within area syncing (i.e. channels/vertical) */
if ((v2dcur->flag & V2D_VIEWSYNC_AREA_VERTICAL) && (area)) {
- for (ar = area->regionbase.first; ar; ar = ar->next) {
+ for (region = area->regionbase.first; region; region = region->next) {
/* don't operate on self */
- if (v2dcur != &ar->v2d) {
+ if (v2dcur != &region->v2d) {
/* only if view has vertical locks enabled */
- if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
+ if (region->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
if (flag == V2D_LOCK_COPY) {
/* other views with locks on must copy active */
- ar->v2d.cur.ymin = v2dcur->cur.ymin;
- ar->v2d.cur.ymax = v2dcur->cur.ymax;
+ region->v2d.cur.ymin = v2dcur->cur.ymin;
+ region->v2d.cur.ymax = v2dcur->cur.ymax;
}
else { /* V2D_LOCK_SET */
/* active must copy others */
- v2dcur->cur.ymin = ar->v2d.cur.ymin;
- v2dcur->cur.ymax = ar->v2d.cur.ymax;
+ v2dcur->cur.ymin = region->v2d.cur.ymin;
+ v2dcur->cur.ymax = region->v2d.cur.ymax;
}
/* region possibly changed, so refresh */
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
}
}
@@ -901,24 +901,24 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
/* check if doing whole screen syncing (i.e. time/horizontal) */
if ((v2dcur->flag & V2D_VIEWSYNC_SCREEN_TIME) && (screen)) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (region = sa->regionbase.first; region; region = region->next) {
/* don't operate on self */
- if (v2dcur != &ar->v2d) {
+ if (v2dcur != &region->v2d) {
/* only if view has horizontal locks enabled */
- if (ar->v2d.flag & V2D_VIEWSYNC_SCREEN_TIME) {
+ if (region->v2d.flag & V2D_VIEWSYNC_SCREEN_TIME) {
if (flag == V2D_LOCK_COPY) {
/* other views with locks on must copy active */
- ar->v2d.cur.xmin = v2dcur->cur.xmin;
- ar->v2d.cur.xmax = v2dcur->cur.xmax;
+ region->v2d.cur.xmin = v2dcur->cur.xmin;
+ region->v2d.cur.xmax = v2dcur->cur.xmax;
}
else { /* V2D_LOCK_SET */
/* active must copy others */
- v2dcur->cur.xmin = ar->v2d.cur.xmin;
- v2dcur->cur.xmax = ar->v2d.cur.xmax;
+ v2dcur->cur.xmin = region->v2d.cur.xmin;
+ v2dcur->cur.xmax = region->v2d.cur.xmax;
}
/* region possibly changed, so refresh */
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
}
}
@@ -1213,7 +1213,7 @@ void UI_view2d_view_ortho(const View2D *v2d)
* \param xaxis: if non-zero, only use cur x-axis,
* otherwise use cur-yaxis (mostly this will be used for x).
*/
-void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis)
+void UI_view2d_view_orthoSpecial(ARegion *region, View2D *v2d, const bool xaxis)
{
rctf curmasked;
float xofs, yofs;
@@ -1232,19 +1232,19 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, const bool xaxis)
/* only set matrix with 'cur' coordinates on relevant axes */
if (xaxis) {
- wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, -yofs, ar->winy - yofs);
+ wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, -yofs, region->winy - yofs);
}
else {
- wmOrtho2(-xofs, ar->winx - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs);
+ wmOrtho2(-xofs, region->winx - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs);
}
}
/* Restore view matrices after drawing */
void UI_view2d_view_restore(const bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
- int width = BLI_rcti_size_x(&ar->winrct) + 1;
- int height = BLI_rcti_size_y(&ar->winrct) + 1;
+ ARegion *region = CTX_wm_region(C);
+ int width = BLI_rcti_size_x(&region->winrct) + 1;
+ int height = BLI_rcti_size_y(&region->winrct) + 1;
wmOrtho2(0.0f, (float)width, 0.0f, (float)height);
GPU_matrix_identity_set();
@@ -1925,8 +1925,8 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C)
return NULL;
}
if (region->regiontype != RGN_TYPE_WINDOW) {
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- return ar ? &(ar->v2d) : NULL;
+ ARegion *region_win = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ return region_win ? &(region_win->v2d) : NULL;
}
return &(region->v2d);
}
@@ -2057,7 +2057,7 @@ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac)
* - 0 = not in scroller.
*/
char UI_view2d_mouse_in_scrollers_ex(
- const ARegion *ar, const View2D *v2d, int x, int y, int *r_scroll)
+ const ARegion *region, const View2D *v2d, int x, int y, int *r_scroll)
{
const int scroll = view2d_scroll_mapped(v2d->scroll);
*r_scroll = scroll;
@@ -2065,8 +2065,8 @@ char UI_view2d_mouse_in_scrollers_ex(
if (scroll) {
/* Move to region-coordinates. */
const int co[2] = {
- x - ar->winrct.xmin,
- y - ar->winrct.ymin,
+ x - region->winrct.xmin,
+ y - region->winrct.ymin,
};
if (scroll & V2D_SCROLL_HORIZONTAL) {
if (IN_2D_HORIZ_SCROLL(v2d, co)) {
@@ -2083,7 +2083,7 @@ char UI_view2d_mouse_in_scrollers_ex(
return 0;
}
-char UI_view2d_rect_in_scrollers_ex(const ARegion *ar,
+char UI_view2d_rect_in_scrollers_ex(const ARegion *region,
const View2D *v2d,
const rcti *rect,
int *r_scroll)
@@ -2094,7 +2094,7 @@ char UI_view2d_rect_in_scrollers_ex(const ARegion *ar,
if (scroll) {
/* Move to region-coordinates. */
rcti rect_region = *rect;
- BLI_rcti_translate(&rect_region, -ar->winrct.xmin, ar->winrct.ymin);
+ BLI_rcti_translate(&rect_region, -region->winrct.xmin, region->winrct.ymin);
if (scroll & V2D_SCROLL_HORIZONTAL) {
if (IN_2D_HORIZ_SCROLL_RECT(v2d, &rect_region)) {
return 'h';
@@ -2110,16 +2110,16 @@ char UI_view2d_rect_in_scrollers_ex(const ARegion *ar,
return 0;
}
-char UI_view2d_mouse_in_scrollers(const ARegion *ar, const View2D *v2d, int x, int y)
+char UI_view2d_mouse_in_scrollers(const ARegion *region, const View2D *v2d, int x, int y)
{
int scroll_dummy = 0;
- return UI_view2d_mouse_in_scrollers_ex(ar, v2d, x, y, &scroll_dummy);
+ return UI_view2d_mouse_in_scrollers_ex(region, v2d, x, y, &scroll_dummy);
}
-char UI_view2d_rect_in_scrollers(const ARegion *ar, const View2D *v2d, const rcti *rect)
+char UI_view2d_rect_in_scrollers(const ARegion *region, const View2D *v2d, const rcti *rect)
{
int scroll_dummy = 0;
- return UI_view2d_rect_in_scrollers_ex(ar, v2d, rect, &scroll_dummy);
+ return UI_view2d_rect_in_scrollers_ex(region, v2d, rect, &scroll_dummy);
}
/** \} */
@@ -2206,7 +2206,7 @@ void UI_view2d_text_cache_add_rectf(
}
}
-void UI_view2d_text_cache_draw(ARegion *ar)
+void UI_view2d_text_cache_draw(ARegion *region)
{
View2DString *v2s;
int col_pack_prev = 0;
@@ -2217,7 +2217,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
BLF_set_default();
const float default_height = g_v2d_strings ? BLF_height(font_id, "28", 3) : 0.0f;
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
for (v2s = g_v2d_strings; v2s; v2s = v2s->next) {
int xofs = 0, yofs;
diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c
index 43b49825219..b95dbe0b59d 100644
--- a/source/blender/editors/interface/view2d_draw.c
+++ b/source/blender/editors/interface/view2d_draw.c
@@ -259,7 +259,7 @@ static void view2d_draw_lines(const View2D *v2d,
typedef void (*PositionToString)(
void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str);
-static void draw_horizontal_scale_indicators(const ARegion *ar,
+static void draw_horizontal_scale_indicators(const ARegion *region,
const View2D *v2d,
float distance,
const rcti *rect,
@@ -272,7 +272,7 @@ static void draw_horizontal_scale_indicators(const ARegion *ar,
}
GPU_matrix_push_projection();
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
float start;
uint steps;
@@ -313,7 +313,7 @@ static void draw_horizontal_scale_indicators(const ARegion *ar,
GPU_matrix_pop_projection();
}
-static void draw_vertical_scale_indicators(const ARegion *ar,
+static void draw_vertical_scale_indicators(const ARegion *region,
const View2D *v2d,
float distance,
float display_offset,
@@ -327,7 +327,7 @@ static void draw_vertical_scale_indicators(const ARegion *ar,
}
GPU_matrix_push_projection();
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
float start;
uint steps;
@@ -479,51 +479,53 @@ void UI_view2d_draw_lines_x__frames_or_seconds(const View2D *v2d,
/* Scale indicator text drawing API
**************************************************/
-static void UI_view2d_draw_scale_x__discrete_values(const ARegion *ar,
+static void UI_view2d_draw_scale_x__discrete_values(const ARegion *region,
const View2D *v2d,
const rcti *rect,
int colorid)
{
float number_step = view2d_major_step_x__discrete(v2d);
draw_horizontal_scale_indicators(
- ar, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid);
+ region, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid);
}
static void UI_view2d_draw_scale_x__discrete_time(
- const ARegion *ar, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid)
+ const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, int colorid)
{
float step = view2d_major_step_x__time(v2d, scene);
draw_horizontal_scale_indicators(
- ar, v2d, step, rect, view_to_string__time, (void *)scene, colorid);
+ region, v2d, step, rect, view_to_string__time, (void *)scene, colorid);
}
-static void UI_view2d_draw_scale_x__values(const ARegion *ar,
+static void UI_view2d_draw_scale_x__values(const ARegion *region,
const View2D *v2d,
const rcti *rect,
int colorid)
{
float step = view2d_major_step_x__continuous(v2d);
- draw_horizontal_scale_indicators(ar, v2d, step, rect, view_to_string__value, NULL, colorid);
+ draw_horizontal_scale_indicators(region, v2d, step, rect, view_to_string__value, NULL, colorid);
}
-void UI_view2d_draw_scale_y__values(const ARegion *ar,
+void UI_view2d_draw_scale_y__values(const ARegion *region,
const View2D *v2d,
const rcti *rect,
int colorid)
{
float step = view2d_major_step_y__continuous(v2d);
- draw_vertical_scale_indicators(ar, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid);
+ draw_vertical_scale_indicators(
+ region, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid);
}
-void UI_view2d_draw_scale_y__block(const ARegion *ar,
+void UI_view2d_draw_scale_y__block(const ARegion *region,
const View2D *v2d,
const rcti *rect,
int colorid)
{
- draw_vertical_scale_indicators(ar, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid);
+ draw_vertical_scale_indicators(
+ region, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid);
}
-void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar,
+void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
const struct Scene *scene,
@@ -531,14 +533,14 @@ void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *ar
int colorid)
{
if (display_seconds) {
- UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene, colorid);
+ UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid);
}
else {
- UI_view2d_draw_scale_x__discrete_values(ar, v2d, rect, colorid);
+ UI_view2d_draw_scale_x__discrete_values(region, v2d, rect, colorid);
}
}
-void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar,
+void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *region,
const struct View2D *v2d,
const struct rcti *rect,
const struct Scene *scene,
@@ -546,9 +548,9 @@ void UI_view2d_draw_scale_x__frames_or_seconds(const struct ARegion *ar,
int colorid)
{
if (display_seconds) {
- UI_view2d_draw_scale_x__discrete_time(ar, v2d, rect, scene, colorid);
+ UI_view2d_draw_scale_x__discrete_time(region, v2d, rect, scene, colorid);
}
else {
- UI_view2d_draw_scale_x__values(ar, v2d, rect, colorid);
+ UI_view2d_draw_scale_x__values(region, v2d, rect, colorid);
}
}
diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c
index 09da9f077d4..a11ba0476e1 100644
--- a/source/blender/editors/interface/view2d_gizmo_navigate.c
+++ b/source/blender/editors/interface/view2d_gizmo_navigate.c
@@ -200,9 +200,9 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
struct NavigateWidgetGroup *navgroup = gzgroup->customdata;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
if ((navgroup->state.rect_visible.xmax == rect_visible->xmax) &&
(navgroup->state.rect_visible.ymax == rect_visible->ymax)) {
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 10d327cb2ba..7eea9e6a697 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -54,9 +54,9 @@
static bool view2d_poll(bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- return (ar != NULL) && (ar->v2d.flag & V2D_IS_INITIALISED);
+ return (region != NULL) && (region->v2d.flag & V2D_IS_INITIALISED);
}
/** \} */
@@ -83,7 +83,7 @@ typedef struct v2dViewPanData {
/** area where view pan was initiated */
ScrArea *sa;
/** region where view pan was initiated */
- ARegion *ar;
+ ARegion *region;
/** view2d we're operating in */
View2D *v2d;
@@ -105,18 +105,18 @@ typedef struct v2dViewPanData {
/* initialize panning customdata */
static int view_pan_init(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
v2dViewPanData *vpd;
View2D *v2d;
float winx, winy;
/* regions now have v2d-data by default, so check for region */
- if (ar == NULL) {
+ if (region == NULL) {
return 0;
}
/* check if panning is allowed at all */
- v2d = &ar->v2d;
+ v2d = &region->v2d;
if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y)) {
return 0;
}
@@ -129,11 +129,11 @@ static int view_pan_init(bContext *C, wmOperator *op)
vpd->sc = CTX_wm_screen(C);
vpd->sa = CTX_wm_area(C);
vpd->v2d = v2d;
- vpd->ar = ar;
+ vpd->region = region;
/* calculate translation factor - based on size of view */
- winx = (float)(BLI_rcti_size_x(&ar->winrct) + 1);
- winy = (float)(BLI_rcti_size_y(&ar->winrct) + 1);
+ winx = (float)(BLI_rcti_size_x(&region->winrct) + 1);
+ winy = (float)(BLI_rcti_size_y(&region->winrct) + 1);
vpd->facx = (BLI_rctf_size_x(&v2d->cur)) / winx;
vpd->facy = (BLI_rctf_size_y(&v2d->cur)) / winy;
@@ -143,14 +143,14 @@ static int view_pan_init(bContext *C, wmOperator *op)
#ifdef WITH_INPUT_NDOF
static bool view_pan_poll(bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View2D *v2d;
/* check if there's a region in context to work with */
- if (ar == NULL) {
+ if (region == NULL) {
return 0;
}
- v2d = &ar->v2d;
+ v2d = &region->v2d;
/* check that 2d-view can pan */
if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y)) {
@@ -185,7 +185,7 @@ static void view_pan_apply_ex(bContext *C, v2dViewPanData *vpd, float dx, float
UI_view2d_curRect_validate(v2d);
/* don't rebuild full tree in outliner, since we're just changing our view */
- ED_region_tag_redraw_no_rebuild(vpd->ar);
+ ED_region_tag_redraw_no_rebuild(vpd->region);
/* request updates to be done... */
WM_event_add_mousemove(CTX_wm_window(C));
@@ -461,8 +461,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
- ARegion *ar = CTX_wm_region(C);
- RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
+ ARegion *region = CTX_wm_region(C);
+ RNA_int_set(op->ptr, "deltay", region->v2d.mask.ymin - region->v2d.mask.ymax);
}
/* apply movement, then we're done */
@@ -511,8 +511,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
- ARegion *ar = CTX_wm_region(C);
- RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask));
+ ARegion *region = CTX_wm_region(C);
+ RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&region->v2d.mask));
}
/* apply movement, then we're done */
@@ -563,7 +563,7 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
/* temp customdata for operator */
typedef struct v2dViewZoomData {
View2D *v2d; /* view2d we're operating in */
- ARegion *ar;
+ ARegion *region;
/* needed for continuous zoom */
wmTimer *timer;
@@ -588,9 +588,9 @@ static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2])
/* default not to zoom the sequencer vertically */
if (sa && sa->spacetype == SPACE_SEQ) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region && region->regiontype == RGN_TYPE_WINDOW) {
r_do_zoom_xy[1] = false;
}
}
@@ -599,15 +599,15 @@ static void view_zoom_axis_lock_defaults(bContext *C, bool r_do_zoom_xy[2])
/* initialize panning customdata */
static int view_zoomdrag_init(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
v2dViewZoomData *vzd;
View2D *v2d;
/* regions now have v2d-data by default, so check for region */
- if (ar == NULL) {
+ if (region == NULL) {
return 0;
}
- v2d = &ar->v2d;
+ v2d = &region->v2d;
/* check that 2d-view is zoomable */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) {
@@ -620,7 +620,7 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op)
/* set pointers to owners */
vzd->v2d = v2d;
- vzd->ar = ar;
+ vzd->region = region;
return 1;
}
@@ -628,11 +628,11 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op)
/* check if step-zoom can be applied */
static bool view_zoom_poll(bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View2D *v2d;
/* check if there's a region in context to work with */
- if (ar == NULL) {
+ if (region == NULL) {
return false;
}
@@ -641,7 +641,7 @@ static bool view_zoom_poll(bContext *C)
return false;
}
- v2d = &ar->v2d;
+ v2d = &region->v2d;
/* check that 2d-view is zoomable */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y)) {
@@ -656,11 +656,11 @@ static bool view_zoom_poll(bContext *C)
static void view_zoomstep_apply_ex(
bContext *C, v2dViewZoomData *vzd, const bool zoom_to_pos, const float facx, const float facy)
{
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
const rctf cur_old = v2d->cur;
float dx, dy;
- const int snap_test = ED_region_snap_size_test(ar);
+ const int snap_test = ED_region_snap_size_test(region);
/* calculate amount to move view by, ensuring symmetry so the
* old zoom level is restored after zooming back the same amount
@@ -749,14 +749,14 @@ static void view_zoomstep_apply_ex(
/* validate that view is in valid configuration after this operation */
UI_view2d_curRect_validate(v2d);
- if (ED_region_snap_size_apply(ar, snap_test)) {
+ if (ED_region_snap_size_apply(region, snap_test)) {
ScrArea *sa = CTX_wm_area(C);
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
/* request updates to be done... */
- ED_region_tag_redraw_no_rebuild(vzd->ar);
+ ED_region_tag_redraw_no_rebuild(vzd->region);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
@@ -816,10 +816,11 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vzd = op->customdata;
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
}
return view_zoomin_exec(C, op);
@@ -883,10 +884,11 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event
vzd = op->customdata;
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
}
return view_zoomout_exec(C, op);
@@ -934,7 +936,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
v2dViewZoomData *vzd = op->customdata;
View2D *v2d = vzd->v2d;
float dx, dy;
- const int snap_test = ED_region_snap_size_test(vzd->ar);
+ const int snap_test = ED_region_snap_size_test(vzd->region);
const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
const bool zoom_to_pos = use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS);
@@ -1002,14 +1004,14 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
/* validate that view is in valid configuration after this operation */
UI_view2d_curRect_validate(v2d);
- if (ED_region_snap_size_apply(vzd->ar, snap_test)) {
+ if (ED_region_snap_size_apply(vzd->region, snap_test)) {
ScrArea *sa = CTX_wm_area(C);
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
/* request updates to be done... */
- ED_region_tag_redraw_no_rebuild(vzd->ar);
+ ED_region_tag_redraw_no_rebuild(vzd->region);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
@@ -1106,10 +1108,11 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
vzd->invoke_event = event->type;
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d);
}
if (v2d->keepofs & V2D_LOCKOFS_X) {
@@ -1163,16 +1166,16 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event
/* x-axis transform */
dist = BLI_rcti_size_x(&v2d->mask) / 2.0f;
- len_old[0] = fabsf(vzd->lastx - vzd->ar->winrct.xmin - dist);
- len_new[0] = fabsf(event->x - vzd->ar->winrct.xmin - dist);
+ len_old[0] = fabsf(vzd->lastx - vzd->region->winrct.xmin - dist);
+ len_new[0] = fabsf(event->x - vzd->region->winrct.xmin - dist);
len_old[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
len_new[0] *= zoomfac * BLI_rctf_size_x(&v2d->cur);
/* y-axis transform */
dist = BLI_rcti_size_y(&v2d->mask) / 2.0f;
- len_old[1] = fabsf(vzd->lasty - vzd->ar->winrct.ymin - dist);
- len_new[1] = fabsf(event->y - vzd->ar->winrct.ymin - dist);
+ len_old[1] = fabsf(vzd->lasty - vzd->region->winrct.ymin - dist);
+ len_new[1] = fabsf(event->y - vzd->region->winrct.ymin - dist);
len_old[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
len_new[1] *= zoomfac * BLI_rctf_size_y(&v2d->cur);
@@ -1317,8 +1320,8 @@ static void VIEW2D_OT_zoom(wmOperatorType *ot)
static int view_borderzoom_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
rctf rect;
rctf cur_new = v2d->cur;
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -1373,7 +1376,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
}
}
- UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
+ UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx);
return OPERATOR_FINISHED;
}
@@ -1524,12 +1527,12 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
/* will start timer if appropriate */
/* the arguments are the desired situation */
-void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int smooth_viewtx)
+void UI_view2d_smooth_view(bContext *C, ARegion *region, const rctf *cur, const int smooth_viewtx)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
struct SmoothView2DStore sms = {{0}};
bool ok = false;
float fac = 1.0f;
@@ -1584,7 +1587,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int
v2d->cur = sms.new_cur;
UI_view2d_curRect_validate(v2d);
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
}
@@ -1593,8 +1596,8 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int
static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
struct SmoothView2DStore *sms = v2d->sms;
float step;
@@ -1632,7 +1635,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
if (v2d->sms == NULL) {
UI_view2d_zoom_cache_reset();
@@ -1679,7 +1682,7 @@ typedef struct v2dScrollerMove {
/** View2D data that this operation affects */
View2D *v2d;
/** region that the scroller is in */
- ARegion *ar;
+ ARegion *region;
/** scroller that mouse is in ('h' or 'v') */
char scroller;
@@ -1793,12 +1796,12 @@ static bool scroller_activate_poll(bContext *C)
}
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
wmEvent *event = win->eventstate;
/* check if mouse in scrollbars, if they're enabled */
- return (UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y) != 0);
+ return (UI_view2d_mouse_in_scrollers(region, v2d, event->x, event->y) != 0);
}
/* initialize customdata for scroller manipulation operator */
@@ -1809,8 +1812,8 @@ static void scroller_activate_init(bContext *C,
{
v2dScrollerMove *vsm;
View2DScrollers *scrollers;
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
rctf tot_cur_union;
float mask_size;
@@ -1820,7 +1823,7 @@ static void scroller_activate_init(bContext *C,
/* set general data */
vsm->v2d = v2d;
- vsm->ar = ar;
+ vsm->region = region;
vsm->scroller = in_scroller;
/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */
@@ -1842,7 +1845,7 @@ static void scroller_activate_init(bContext *C,
vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size;
/* pixel rounding */
- vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1);
+ vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&region->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(
@@ -1854,7 +1857,7 @@ static void scroller_activate_init(bContext *C,
}
vsm->scrollbarwidth = scrollers->hor_max - scrollers->hor_min;
- vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + ar->winrct.xmin;
+ vsm->scrollbar_orig = ((scrollers->hor_max + scrollers->hor_min) / 2) + region->winrct.xmin;
}
else {
/* vertical scroller - calculate adjustment factor first */
@@ -1862,7 +1865,7 @@ static void scroller_activate_init(bContext *C,
vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size;
/* pixel rounding */
- vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1);
+ vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&region->winrct) + 1);
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(
@@ -1874,11 +1877,11 @@ static void scroller_activate_init(bContext *C,
}
vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min;
- vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + ar->winrct.ymin;
+ vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + region->winrct.ymin;
}
UI_view2d_scrollers_free(scrollers);
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
/* cleanup temp customdata */
@@ -1957,7 +1960,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
UI_view2d_curRect_validate(v2d);
/* request updates to be done... */
- ED_region_tag_redraw_no_rebuild(vsm->ar);
+ ED_region_tag_redraw_no_rebuild(vsm->region);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
@@ -2040,11 +2043,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
* should have occurred, so check if it happened in scrollbar */
static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
/* check if mouse in scrollbars, if they're enabled */
- const char in_scroller = UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y);
+ const char in_scroller = UI_view2d_mouse_in_scrollers(region, v2d, event->x, event->y);
/* if in a scroller, init customdata then set modal handler which will
* catch mouse-down to start doing useful stuff */
@@ -2153,10 +2156,10 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
static int reset_exec(bContext *C, wmOperator *UNUSED(op))
{
uiStyle *style = UI_style_get();
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
int winx, winy;
- const int snap_test = ED_region_snap_size_test(ar);
+ const int snap_test = ED_region_snap_size_test(region);
/* zoom 1.0 */
winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
@@ -2191,14 +2194,14 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
/* validate that view is in valid configuration after this operation */
UI_view2d_curRect_validate(v2d);
- if (ED_region_snap_size_apply(ar, snap_test)) {
+ if (ED_region_snap_size_apply(region, snap_test)) {
ScrArea *sa = CTX_wm_area(C);
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
/* request updates to be done... */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
UI_view2d_zoom_cache_reset();
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 5c730c74df7..6299d6761e0 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -62,7 +62,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
float *score_r)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MaskLayer *point_mask_layer;
MaskSpline *point_spline;
@@ -76,7 +76,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C,
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
ED_mask_get_size(sa, &width, &height);
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
co[0] = normal_co[0] * scalex;
co[1] = normal_co[1] * scaley;
@@ -598,10 +598,10 @@ static void mask_point_make_pixel_space(bContext *C,
float point_pixel[2])
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float scalex, scaley;
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
point_pixel[0] = point_normalized[0] * scalex;
point_pixel[1] = point_normalized[1] * scaley;
@@ -710,11 +710,11 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
@@ -802,11 +802,11 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op)
static int add_feather_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 71aa860d703..3f3bf8b7510 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -677,7 +677,7 @@ static float *mask_rasterize(Mask *mask, const int width, const int height)
void ED_mask_draw_region(
Depsgraph *depsgraph,
Mask *mask_,
- ARegion *ar,
+ ARegion *region,
const char draw_flag,
const char draw_type,
const char overlay_mode,
@@ -693,7 +693,7 @@ void ED_mask_draw_region(
/* optional - only used when do_post_draw is set or called from clip editor */
const bContext *C)
{
- struct View2D *v2d = &ar->v2d;
+ struct View2D *v2d = &region->v2d;
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_->id);
/* aspect always scales vertically in movie and image spaces */
@@ -708,13 +708,13 @@ void ED_mask_draw_region(
float xofs, yofs;
/* find window pixel coordinates of origin */
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
/* w = BLI_rctf_size_x(&v2d->tot); */
/* h = BLI_rctf_size_y(&v2d->tot); */
- zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / BLI_rctf_size_x(&ar->v2d.cur);
- zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / BLI_rctf_size_y(&ar->v2d.cur);
+ zoomx = (float)(BLI_rcti_size_x(&region->winrct) + 1) / BLI_rctf_size_x(&region->v2d.cur);
+ zoomy = (float)(BLI_rcti_size_y(&region->winrct) + 1) / BLI_rctf_size_y(&region->v2d.cur);
if (do_scale_applied) {
zoomx /= width;
@@ -780,22 +780,23 @@ void ED_mask_draw_region(
GPU_matrix_scale_2f(maxdim, maxdim);
if (do_draw_cb) {
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
}
/* draw! */
draw_mask_layers(C, mask_eval, draw_flag, draw_type, width, height);
if (do_draw_cb) {
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
}
GPU_matrix_pop();
}
-void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra, const int efra)
+void ED_mask_draw_frames(
+ Mask *mask, ARegion *region, const int cfra, const int sfra, const int efra)
{
- const float framelen = ar->winx / (float)(efra - sfra + 1);
+ const float framelen = region->winx / (float)(efra - sfra + 1);
MaskLayer *mask_layer = BKE_mask_layer_active(mask);
if (mask_layer == NULL) {
@@ -808,7 +809,7 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra
}
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
const int region_bottom = rect_visible->ymin;
uint pos = GPU_vertformat_attr_add(
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 56d8ef56160..88cc5e33617 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -84,23 +84,23 @@ bool ED_maskedit_mask_poll(bContext *C)
/********************** registration *********************/
/* takes event->mval */
-void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
+void ED_mask_mouse_pos(ScrArea *sa, ARegion *region, const int mval[2], float co[2])
{
if (sa) {
switch (sa->spacetype) {
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
- ED_clip_mouse_pos(sc, ar, mval, co);
+ ED_clip_mouse_pos(sc, region, mval, co);
BKE_mask_coord_from_movieclip(sc->clip, &sc->user, co, co);
break;
}
case SPACE_SEQ: {
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &co[0], &co[1]);
break;
}
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
- ED_image_mouse_pos(sima, ar, mval, co);
+ ED_image_mouse_pos(sima, region, mval, co);
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, co);
break;
}
@@ -119,7 +119,7 @@ void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
/* input: x/y - mval space
* output: xr/yr - mask point space */
-void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, float *yr)
+void ED_mask_point_pos(ScrArea *sa, ARegion *region, float x, float y, float *xr, float *yr)
{
float co[2];
@@ -127,7 +127,7 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
switch (sa->spacetype) {
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
- ED_clip_point_stable_pos(sc, ar, x, y, &co[0], &co[1]);
+ ED_clip_point_stable_pos(sc, region, x, y, &co[0], &co[1]);
BKE_mask_coord_from_movieclip(sc->clip, &sc->user, co, co);
break;
}
@@ -136,7 +136,7 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
break;
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
- ED_image_point_pos(sima, ar, x, y, &co[0], &co[1]);
+ ED_image_point_pos(sima, region, x, y, &co[0], &co[1]);
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, co);
break;
}
@@ -156,7 +156,8 @@ void ED_mask_point_pos(ScrArea *sa, ARegion *ar, float x, float y, float *xr, fl
*yr = co[1];
}
-void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, float *xr, float *yr)
+void ED_mask_point_pos__reverse(
+ ScrArea *sa, ARegion *region, float x, float y, float *xr, float *yr)
{
float co[2];
@@ -167,7 +168,7 @@ void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, floa
co[0] = x;
co[1] = y;
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, co, co);
- ED_clip_point_stable_pos__reverse(sc, ar, co, co);
+ ED_clip_point_stable_pos__reverse(sc, region, co, co);
break;
}
case SPACE_SEQ:
@@ -178,7 +179,7 @@ void ED_mask_point_pos__reverse(ScrArea *sa, ARegion *ar, float x, float y, floa
co[0] = x;
co[1] = y;
BKE_mask_coord_to_image(sima->image, &sima->iuser, co, co);
- ED_image_point_pos__reverse(sima, ar, co, co);
+ ED_image_point_pos__reverse(sima, region, co, co);
break;
}
default:
@@ -232,13 +233,13 @@ void ED_mask_get_size(ScrArea *sa, int *width, int *height)
}
}
-void ED_mask_zoom(ScrArea *sa, ARegion *ar, float *zoomx, float *zoomy)
+void ED_mask_zoom(ScrArea *sa, ARegion *region, float *zoomx, float *zoomy)
{
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
- ED_space_clip_get_zoom(sc, ar, zoomx, zoomy);
+ ED_space_clip_get_zoom(sc, region, zoomx, zoomy);
break;
}
case SPACE_SEQ: {
@@ -247,7 +248,7 @@ void ED_mask_zoom(ScrArea *sa, ARegion *ar, float *zoomx, float *zoomy)
}
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
- ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
+ ED_space_image_get_zoom(sima, region, zoomx, zoomy);
break;
}
default:
@@ -263,7 +264,7 @@ void ED_mask_zoom(ScrArea *sa, ARegion *ar, float *zoomx, float *zoomy)
}
}
-void ED_mask_get_aspect(ScrArea *sa, ARegion *UNUSED(ar), float *aspx, float *aspy)
+void ED_mask_get_aspect(ScrArea *sa, ARegion *UNUSED(region), float *aspx, float *aspy)
{
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
@@ -294,7 +295,7 @@ void ED_mask_get_aspect(ScrArea *sa, ARegion *UNUSED(ar), float *aspx, float *as
}
}
-void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *ar, float *scalex, float *scaley)
+void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *region, float *scalex, float *scaley)
{
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
@@ -302,7 +303,7 @@ void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *ar, float *scalex, float *s
SpaceClip *sc = sa->spacedata.first;
float aspx, aspy;
- UI_view2d_scale_get(&ar->v2d, scalex, scaley);
+ UI_view2d_scale_get(&region->v2d, scalex, scaley);
ED_space_clip_get_aspect(sc, &aspx, &aspy);
*scalex *= aspx;
@@ -317,7 +318,7 @@ void ED_mask_pixelspace_factor(ScrArea *sa, ARegion *ar, float *scalex, float *s
SpaceImage *sima = sa->spacedata.first;
float aspx, aspy;
- UI_view2d_scale_get(&ar->v2d, scalex, scaley);
+ UI_view2d_scale_get(&region->v2d, scalex, scaley);
ED_space_image_get_aspect(sima, &aspx, &aspy);
*scalex *= aspx;
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 3a982b255f0..cff0bcef38b 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -75,7 +75,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
float *score)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MaskLayer *point_mask_layer = NULL;
MaskSpline *point_spline = NULL;
@@ -90,7 +90,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C,
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
ED_mask_get_size(sa, &width, &height);
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
co[0] = normal_co[0] * scalex;
co[1] = normal_co[1] * scaley;
@@ -230,7 +230,7 @@ bool ED_mask_feather_find_nearest(const bContext *C,
float *score)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MaskLayer *point_mask_layer = NULL;
MaskSpline *point_spline = NULL;
@@ -245,7 +245,7 @@ bool ED_mask_feather_find_nearest(const bContext *C,
Mask *mask_eval = (Mask *)DEG_get_evaluated_id(depsgraph, &mask_orig->id);
ED_mask_get_size(sa, &width, &height);
- ED_mask_pixelspace_factor(sa, ar, &scalex, &scaley);
+ ED_mask_pixelspace_factor(sa, region, &scalex, &scaley);
co[0] = normal_co[0] * scalex;
co[1] = normal_co[1] * scaley;
@@ -714,7 +714,7 @@ static void check_sliding_handle_type(MaskSplinePoint *point, eMaskWhichHandle w
static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
SlidePointData *customdata = NULL;
@@ -728,7 +728,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *
const float threshold = 19;
eMaskWhichHandle which_handle;
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
ED_mask_get_size(sa, &width, &height);
cv_point = ED_mask_point_find_nearest(
@@ -827,7 +827,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *
}
customdata->which_handle = which_handle;
- ED_mask_mouse_pos(sa, ar, event->mval, customdata->prev_mouse_coord);
+ ED_mask_mouse_pos(sa, region, event->mval, customdata->prev_mouse_coord);
}
return customdata;
@@ -952,10 +952,10 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
ATTR_FALLTHROUGH; /* update CV position */
case MOUSEMOVE: {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float delta[2];
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
sub_v2_v2v2(delta, co, data->prev_mouse_coord);
if (data->is_accurate) {
mul_v2_fl(delta, 0.2f);
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 9e1aaa5e6f4..15b3ab047ee 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -387,11 +387,11 @@ static int select_exec(bContext *C, wmOperator *op)
static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
@@ -437,7 +437,7 @@ void MASK_OT_select(wmOperatorType *ot)
static int box_select_exec(bContext *C, wmOperator *op)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
@@ -455,8 +455,8 @@ static int box_select_exec(bContext *C, wmOperator *op)
/* get rectangle from operator */
WM_operator_properties_border_to_rcti(op, &rect);
- ED_mask_point_pos(sa, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
- ED_mask_point_pos(sa, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
+ ED_mask_point_pos(sa, region, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
+ ED_mask_point_pos(sa, region, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
/* do actual selection */
for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
@@ -527,7 +527,7 @@ static bool do_lasso_select_mask(bContext *C,
const eSelectOp sel_op)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
@@ -567,7 +567,7 @@ static bool do_lasso_select_mask(bContext *C,
/* point in screen coords */
ED_mask_point_pos__reverse(sa,
- ar,
+ region,
point_deform->bezt.vec[1][0],
point_deform->bezt.vec[1][1],
&screen_co[0],
@@ -653,7 +653,7 @@ static int mask_spline_point_inside_ellipse(BezTriple *bezt,
static int circle_select_exec(bContext *C, wmOperator *op)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
int i;
@@ -669,13 +669,13 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* compute ellipse and position in unified coordinates */
ED_mask_get_size(sa, &width, &height);
- ED_mask_zoom(sa, ar, &zoomx, &zoomy);
+ ED_mask_zoom(sa, region, &zoomx, &zoomy);
width = height = max_ii(width, height);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;
- ED_mask_point_pos(sa, ar, x, y, &offset[0], &offset[1]);
+ ED_mask_point_pos(sa, region, x, y, &offset[0], &offset[1]);
const eSelectOp sel_op = ED_select_op_modal(RNA_enum_get(op->ptr, "mode"),
WM_gesture_is_modal_first(op->customdata));
@@ -750,7 +750,7 @@ void MASK_OT_select_circle(wmOperatorType *ot)
static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *mask_layer;
@@ -761,7 +761,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
const float threshold = 19;
bool changed = false;
- ED_mask_mouse_pos(sa, ar, event->mval, co);
+ ED_mask_mouse_pos(sa, region, event->mval, co);
point = ED_mask_point_find_nearest(C, mask, co, threshold, &mask_layer, &spline, NULL, NULL);
diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c
index c748560ae1b..e7a99ca9e08 100644
--- a/source/blender/editors/mesh/editmesh_add_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_add_gizmo.c
@@ -69,8 +69,8 @@ static void calc_initial_placement_point_from_view(bContext *C,
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
bool use_mouse_project = true; /* TODO: make optional */
@@ -99,7 +99,7 @@ static void calc_initial_placement_point_from_view(bContext *C,
if (use_mouse_project) {
float plane[4];
plane_from_point_normal_v3(plane, cursor_matrix[3], orient_matrix[2]);
- if (ED_view3d_win_to_3d_on_plane(ar, plane, mval, true, r_location)) {
+ if (ED_view3d_win_to_3d_on_plane(region, plane, mval, true, r_location)) {
copy_m3_m3(r_rotation, orient_matrix);
return;
}
@@ -212,7 +212,7 @@ static void gizmo_mesh_placement_modal_from_setup(const bContext *C, wmGizmoGrou
/* Start off dragging. */
{
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmGizmo *gz = ggd->cage;
{
@@ -220,8 +220,8 @@ static void gizmo_mesh_placement_modal_from_setup(const bContext *C, wmGizmoGrou
float location[3];
calc_initial_placement_point_from_view((bContext *)C,
(float[2]){
- win->eventstate->x - ar->winrct.xmin,
- win->eventstate->y - ar->winrct.ymin,
+ win->eventstate->x - region->winrct.xmin,
+ win->eventstate->y - region->winrct.ymin,
},
location,
mat3);
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 42fa3db7c57..123672a977b 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -299,7 +299,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
/* avoid the cost of allocating a bm copy */
if (is_modal) {
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
Object *obedit = opdata->ob_store[ob_index].ob;
@@ -307,7 +307,7 @@ static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
opdata->ob_store[ob_index].mesh_backup = EDBM_redo_state_store(em);
}
opdata->draw_handle_pixel = ED_region_draw_cb_activate(
- ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
+ region->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
G.moving = G_TRANSFORM_EDIT;
if (v3d) {
@@ -433,11 +433,11 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
if (opdata->is_modal) {
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, NULL, false);
}
- ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel);
+ ED_region_draw_cb_exit(region->type, opdata->draw_handle_pixel);
if (v3d) {
v3d->gizmo_flag = opdata->gizmo_flag;
}
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index b2af58e47f2..e0a4195a668 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -81,8 +81,8 @@ static void mesh_bisect_interactive_calc(bContext *C,
float plane_no[3])
{
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
int x_start = RNA_int_get(op->ptr, "xstart");
int y_start = RNA_int_get(op->ptr, "ystart");
@@ -96,18 +96,18 @@ static void mesh_bisect_interactive_calc(bContext *C,
const float zfac = ED_view3d_calc_zfac(rv3d, co_ref, NULL);
/* view vector */
- ED_view3d_win_to_vector(ar, co_a_ss, co_a);
+ ED_view3d_win_to_vector(region, co_a_ss, co_a);
/* view delta */
sub_v2_v2v2(co_delta_ss, co_a_ss, co_b_ss);
- ED_view3d_win_to_delta(ar, co_delta_ss, co_b, zfac);
+ ED_view3d_win_to_delta(region, co_delta_ss, co_b, zfac);
/* cross both to get a normal */
cross_v3_v3v3(plane_no, co_a, co_b);
normalize_v3(plane_no); /* not needed but nicer for user */
/* point on plane, can use either start or endpoint */
- ED_view3d_win_to_3d(v3d, ar, co_ref, co_a_ss, plane_co);
+ ED_view3d_win_to_3d(v3d, region, co_ref, co_a_ss, plane_co);
}
static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index b653484322a..3e79b7f1b9d 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -746,9 +746,9 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
float co1[2], co2[2];
- if ((ED_view3d_project_float_object(vc.ar, eed->v1->co, co1, V3D_PROJ_TEST_NOP) ==
+ if ((ED_view3d_project_float_object(vc.region, eed->v1->co, co1, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) &&
- (ED_view3d_project_float_object(vc.ar, eed->v2->co, co2, V3D_PROJ_TEST_NOP) ==
+ (ED_view3d_project_float_object(vc.region, eed->v2->co, co2, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK)) {
/* 2D rotate by 90d while adding.
* (x, y) = (y, -x)
@@ -786,7 +786,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
copy_v3_v3(ofs, local_center);
mul_m4_v3(vc.obedit->obmat, ofs); /* view space */
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, ofs, event->mval, ofs);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, ofs, event->mval, ofs);
mul_m4_v3(vc.obedit->imat, ofs); // back in object space
sub_v3_v3(ofs, local_center);
@@ -820,7 +820,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
/* also project the source, for retopo workflow */
if (use_proj) {
- EDBM_project_snap_verts(C, depsgraph, vc.ar, vc.obedit, vc.em);
+ EDBM_project_snap_verts(C, depsgraph, vc.region, vc.obedit, vc.em);
}
}
@@ -836,7 +836,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
BMOIter oiter;
copy_v3_v3(local_center, cursor);
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, local_center, event->mval, local_center);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, local_center, event->mval, local_center);
mul_m4_v3(vc.obedit->imat, local_center); // back in object space
@@ -853,7 +853,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
}
if (use_proj) {
- EDBM_project_snap_verts(C, depsgraph, vc.ar, vc.obedit, vc.em);
+ EDBM_project_snap_verts(C, depsgraph, vc.region, vc.obedit, vc.em);
}
/* This normally happens when pushing undo but modal operators
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
index af46d83265e..979c59632e1 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c
@@ -429,11 +429,11 @@ static void gizmo_mesh_spin_init_message_subscribe(const bContext *C,
{
GizmoGroupData_SpinInit *ggd = gzgroup->customdata;
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
@@ -905,8 +905,8 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
* Initialize the orientation from the spin gizmo if possible.
*/
{
- ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *gzmap = ar->gizmo_map;
+ ARegion *region = CTX_wm_region(C);
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup_init = WM_gizmomap_group_find(gzmap, "MESH_GGT_spin");
if (gzgroup_init) {
GizmoGroupData_SpinInit *ggd_init = gzgroup_init->customdata;
@@ -926,7 +926,7 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
{
wmWindow *win = CTX_wm_window(C);
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const wmEvent *event = win->eventstate;
float plane_co[3], plane_no[3];
RNA_property_float_get_array(op->ptr, ggd->data.prop_axis_co, plane_co);
@@ -937,11 +937,11 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
/* Use cursor as fallback if it's not set by the 'ortho_axis_active'. */
if (is_zero_v3(ggd->data.orient_axis_relative)) {
float cursor_co[3];
- const int mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
+ const int mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin};
float plane[4];
plane_from_point_normal_v3(plane, plane_co, plane_no);
- if (UNLIKELY(!ED_view3d_win_to_3d_on_plane_int(ar, plane, mval, false, cursor_co))) {
- ED_view3d_win_to_3d_int(v3d, ar, plane, mval, cursor_co);
+ if (UNLIKELY(!ED_view3d_win_to_3d_on_plane_int(region, plane, mval, false, cursor_co))) {
+ ED_view3d_win_to_3d_int(v3d, region, plane, mval, cursor_co);
}
sub_v3_v3v3(ggd->data.orient_axis_relative, cursor_co, plane_co);
}
@@ -1010,8 +1010,8 @@ static void gizmo_mesh_spin_redo_setup(const bContext *C, wmGizmoGroup *gzgroup)
if (win && win->active) {
bScreen *screen = WM_window_get_active_screen(win);
if (screen->active_region) {
- ARegion *ar = CTX_wm_region(C);
- if (screen->active_region == ar) {
+ ARegion *region = CTX_wm_region(C);
+ if (screen->active_region == region) {
/* Become modal as soon as it's started. */
gizmo_mesh_spin_redo_modal_from_setup(C, gzgroup);
}
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index a1b1ea31ead..23a108e816a 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -166,7 +166,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
if (is_modal) {
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
Object *obedit = opdata->ob_store[ob_index].ob;
@@ -175,7 +175,7 @@ static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
}
opdata->draw_handle_pixel = ED_region_draw_cb_activate(
- ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
+ region->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
G.moving = G_TRANSFORM_EDIT;
if (v3d) {
opdata->gizmo_flag = v3d->gizmo_flag;
@@ -195,11 +195,11 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
if (opdata->is_modal) {
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, NULL, false);
}
- ED_region_draw_cb_exit(ar->type, opdata->draw_handle_pixel);
+ ED_region_draw_cb_exit(region->type, opdata->draw_handle_pixel);
if (v3d) {
v3d->gizmo_flag = opdata->gizmo_flag;
}
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 705ebd324eb..b951c06ba8c 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -153,7 +153,7 @@ typedef struct KnifePosData {
/* struct for properties used while drawing */
typedef struct KnifeTool_OpData {
- ARegion *ar; /* region that knifetool was activated in */
+ ARegion *region; /* region that knifetool was activated in */
void *draw_handle; /* for drawing preview loop */
ViewContext vc; /* note: _don't_ use 'mval', instead use the one we define below */
float mval[2]; /* mouse value with snapping applied */
@@ -307,7 +307,7 @@ static void knife_update_header(bContext *C, wmOperator *op, KnifeTool_OpData *k
static void knife_project_v2(const KnifeTool_OpData *kcd, const float co[3], float sco[2])
{
- ED_view3d_project_float_v2_m4(kcd->ar, co, sco, (float(*)[4])kcd->projmat);
+ ED_view3d_project_float_v2_m4(kcd->region, co, sco, (float(*)[4])kcd->projmat);
}
/* use when lambda is in screen-space */
@@ -997,7 +997,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
copy_v3_v3(co_depth, kcd->prev.cage);
mul_m4_v3(kcd->ob->obmat, co_depth);
- ED_view3d_win_to_3d(kcd->vc.v3d, kcd->ar, co_depth, kcd->curr.mval, curr_cage_adjust);
+ ED_view3d_win_to_3d(kcd->vc.v3d, kcd->region, co_depth, kcd->curr.mval, curr_cage_adjust);
mul_m4_v3(kcd->ob->imat, curr_cage_adjust);
sub_v3_v3v3(ray_dir, curr_cage_adjust, kcd->prev.cage);
@@ -1058,7 +1058,7 @@ static void knife_init_colors(KnifeColors *colors)
}
/* modal loop selection drawing callback */
-static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
+static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
{
const KnifeTool_OpData *kcd = arg;
GPU_depth_test(false);
@@ -1475,7 +1475,7 @@ static bool point_is_visible(KnifeTool_OpData *kcd,
float view[3], p_ofs[3];
/* TODO: I think there's a simpler way to get the required raycast ray */
- ED_view3d_unproject(kcd->vc.ar, s[0], s[1], 0.0f, view);
+ ED_view3d_unproject(kcd->vc.region, s[0], s[1], 0.0f, view);
mul_m4_v3(kcd->ob->imat, view);
@@ -1609,8 +1609,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd)
}
/* unproject screen line */
- ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s1, v1, v3, true);
- ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->ar, kcd->vc.v3d, s2, v2, v4, true);
+ ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->region, kcd->vc.v3d, s1, v1, v3, true);
+ ED_view3d_win_to_segment_clipped(kcd->vc.depsgraph, kcd->region, kcd->vc.v3d, s2, v2, v4, true);
mul_m4_v3(kcd->ob->imat, v1);
mul_m4_v3(kcd->ob->imat, v2);
@@ -1856,8 +1856,8 @@ static void knife_input_ray_segment(KnifeTool_OpData *kcd,
float r_origin_ofs[3])
{
/* unproject to find view ray */
- ED_view3d_unproject(kcd->vc.ar, mval[0], mval[1], 0.0f, r_origin);
- ED_view3d_unproject(kcd->vc.ar, mval[0], mval[1], ofs, r_origin_ofs);
+ ED_view3d_unproject(kcd->vc.region, mval[0], mval[1], 0.0f, r_origin);
+ ED_view3d_unproject(kcd->vc.region, mval[0], mval[1], ofs, r_origin_ofs);
/* transform into object space */
invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
@@ -2582,7 +2582,7 @@ static void knifetool_finish(wmOperator *op)
static void knife_recalc_projmat(KnifeTool_OpData *kcd)
{
invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
- ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, kcd->projmat);
+ ED_view3d_ob_project_mat_get(kcd->region->regiondata, kcd->ob, kcd->projmat);
invert_m4_m4(kcd->projmat_inv, kcd->projmat);
mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob->imat, kcd->vc.rv3d->viewinv[2]);
@@ -2603,7 +2603,7 @@ static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd)
WM_cursor_modal_restore(CTX_wm_window(C));
/* deactivate the extra drawing stuff in 3D-View */
- ED_region_draw_cb_exit(kcd->ar->type, kcd->draw_handle);
+ ED_region_draw_cb_exit(kcd->region->type, kcd->draw_handle);
}
/* free the custom data */
@@ -2623,7 +2623,7 @@ static void knifetool_exit_ex(bContext *C, KnifeTool_OpData *kcd)
BLI_gset_free(kcd->edgenet.edge_visit, NULL);
/* tag for redraw */
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
knifetool_free_bmbvh(kcd);
@@ -2647,7 +2647,7 @@ static void knifetool_update_mval(KnifeTool_OpData *kcd, const float mval[2])
copy_v2_v2(kcd->mval, mval);
if (knife_update_active(kcd)) {
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
}
}
@@ -2702,7 +2702,7 @@ static void knifetool_init(bContext *C,
/* assign the drawing handle for drawing preview line... */
kcd->scene = scene;
kcd->ob = obedit;
- kcd->ar = CTX_wm_region(C);
+ kcd->region = CTX_wm_region(C);
em_setup_viewcontext(C, &kcd->vc);
@@ -2726,7 +2726,7 @@ static void knifetool_init(bContext *C,
knife_recalc_projmat(kcd);
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
kcd->refs = BLI_mempool_create(sizeof(Ref), 0, 2048, 0);
kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 0, 512, BLI_MEMPOOL_ALLOW_ITER);
@@ -2745,7 +2745,7 @@ static void knifetool_init(bContext *C,
if (is_interactive) {
kcd->draw_handle = ED_region_draw_cb_activate(
- kcd->ar->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW);
+ kcd->region->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW);
knife_init_colors(&kcd->colors);
}
@@ -2851,7 +2851,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
em_setup_viewcontext(C, &kcd->vc);
- kcd->ar = kcd->vc.ar;
+ kcd->region = kcd->vc.region;
view3d_operator_needs_opengl(C);
ED_view3d_init_mats_rv3d(obedit, kcd->vc.rv3d); /* needed to initialize clipping */
@@ -2865,7 +2865,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->val) {
case KNF_MODAL_CANCEL:
/* finish */
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
knifetool_exit(C, op);
ED_workspace_status_text(C, NULL);
@@ -2873,7 +2873,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
case KNF_MODAL_CONFIRM:
/* finish */
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
knifetool_finish(op);
knifetool_exit(C, op);
@@ -2886,7 +2886,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
knife_recalc_projmat(kcd);
knife_update_active(kcd);
knife_update_header(C, op, kcd);
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
do_refresh = true;
break;
case KNF_MODAL_MIDPOINT_OFF:
@@ -2895,17 +2895,17 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
knife_recalc_projmat(kcd);
knife_update_active(kcd);
knife_update_header(C, op, kcd);
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
do_refresh = true;
break;
case KNF_MODEL_IGNORE_SNAP_ON:
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = true;
knife_update_header(C, op, kcd);
do_refresh = true;
break;
case KNF_MODEL_IGNORE_SNAP_OFF:
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = false;
knife_update_header(C, op, kcd);
do_refresh = true;
@@ -2921,7 +2921,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
do_refresh = true;
break;
case KNF_MODAL_NEW_CUT:
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
knife_finish_cut(kcd);
kcd->mode = MODE_IDLE;
break;
@@ -2951,7 +2951,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
knifetool_update_mval(kcd, kcd->curr.mval);
}
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
break;
case KNF_MODAL_ADD_CUT_CLOSED:
if (kcd->mode == MODE_DRAGGING) {
@@ -2986,7 +2986,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
kcd->mode = kcd->prevmode;
}
- ED_region_tag_redraw(kcd->ar);
+ ED_region_tag_redraw(kcd->region);
return OPERATOR_PASS_THROUGH;
}
}
@@ -3153,7 +3153,7 @@ void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_throug
knifetool_init_bmbvh(kcd);
}
- ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, projmat);
+ ED_view3d_ob_project_mat_get(kcd->region->regiondata, kcd->ob, projmat);
/* use face-loop tag to store if we have intersected */
#define F_ISECT_IS_UNKNOWN(f) BM_elem_flag_test(BM_FACE_FIRST_LOOP(f), BM_ELEM_TAG)
diff --git a/source/blender/editors/mesh/editmesh_knife_project.c b/source/blender/editors/mesh/editmesh_knife_project.c
index 21de89d33dd..ce0d5d9f7a7 100644
--- a/source/blender/editors/mesh/editmesh_knife_project.c
+++ b/source/blender/editors/mesh/editmesh_knife_project.c
@@ -58,7 +58,7 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C,
LinkNode *polys)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
struct Mesh *me_eval;
bool me_eval_needs_free;
@@ -87,7 +87,7 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C,
BKE_mesh_to_curve_nurblist(me_eval, &nurbslist, 0); /* wire */
BKE_mesh_to_curve_nurblist(me_eval, &nurbslist, 1); /* boundary */
- ED_view3d_ob_project_mat_get(ar->regiondata, ob, projmat);
+ ED_view3d_ob_project_mat_get(region->regiondata, ob, projmat);
if (nurbslist.first) {
Nurb *nu;
@@ -99,7 +99,7 @@ static LinkNode *knifeproject_poly_from_object(const bContext *C,
float(*mval)[2] = MEM_mallocN(sizeof(*mval) * (nu->pntsu + is_cyclic), __func__);
for (bp = nu->bp, a = 0; a < nu->pntsu; a++, bp++) {
- ED_view3d_project_float_v2_m4(ar, bp->vec, mval[a], projmat);
+ ED_view3d_project_float_v2_m4(region, bp->vec, mval[a], projmat);
}
if (is_cyclic) {
copy_v2_v2(mval[a], mval[0]);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index ef05eb4ffda..9509a0af2bc 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -66,7 +66,7 @@
/* struct for properties used while drawing */
typedef struct RingSelOpData {
- ARegion *ar; /* region that ringsel was activated in */
+ ARegion *region; /* region that ringsel was activated in */
void *draw_handle; /* for drawing preview loop */
struct EditMesh_PreSelEdgeRing *presel_edgering;
@@ -94,7 +94,7 @@ typedef struct RingSelOpData {
} RingSelOpData;
/* modal loop selection drawing callback */
-static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
+static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
{
RingSelOpData *lcd = arg;
EDBM_preselect_edgering_draw(lcd->presel_edgering, lcd->ob->obmat);
@@ -244,13 +244,13 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op)
RingSelOpData *lcd = op->customdata;
/* deactivate the extra drawing stuff in 3D-View */
- ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle);
+ ED_region_draw_cb_exit(lcd->region->type, lcd->draw_handle);
EDBM_preselect_edgering_destroy(lcd->presel_edgering);
MEM_freeN(lcd->bases);
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
/* free the custom data */
MEM_freeN(lcd);
@@ -271,9 +271,9 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
lcd->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
/* assign the drawing handle for drawing preview line... */
- lcd->ar = CTX_wm_region(C);
+ lcd->region = CTX_wm_region(C);
lcd->draw_handle = ED_region_draw_cb_activate(
- lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
+ lcd->region->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
lcd->presel_edgering = EDBM_preselect_edgering_create();
/* Initialize once the cursor is over a mesh. */
lcd->ob = NULL;
@@ -291,7 +291,7 @@ static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
lcd->num.unit_type[0] = B_UNIT_NONE;
lcd->num.unit_type[1] = B_UNIT_NONE;
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
return 1;
}
@@ -461,8 +461,8 @@ static int ringcut_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
/* When accessed as a tool, get the active edge from the preselection gizmo. */
{
- ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *gzmap = ar->gizmo_map;
+ ARegion *region = CTX_wm_region(C);
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap,
"VIEW3D_GGT_mesh_preselect_edgering") :
NULL;
@@ -491,7 +491,7 @@ static int loopcut_exec(bContext *C, wmOperator *op)
static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
{
/* finish */
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
ED_workspace_status_text(C, NULL);
if (lcd->eed) {
@@ -521,7 +521,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
const bool has_numinput = hasNumInput(&lcd->num);
em_setup_viewcontext(C, &lcd->vc);
- lcd->ar = lcd->vc.ar;
+ lcd->region = lcd->vc.region;
view3d_operator_needs_opengl(C);
@@ -543,11 +543,11 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
return loopcut_finish(lcd, C, op);
}
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
handled = true;
break;
case RIGHTMOUSE: /* abort */ // XXX hardcoded
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
ringsel_exit(C, op);
ED_workspace_status_text(C, NULL);
@@ -555,14 +555,14 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
case ESCKEY:
if (event->val == KM_RELEASE) {
/* cancel */
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
ED_workspace_status_text(C, NULL);
ringcut_cancel(C, op);
return OPERATOR_CANCELLED;
}
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
handled = true;
break;
case MOUSEPAN:
@@ -619,7 +619,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
lcd->vc.mval[1] = event->mval[1];
loopcut_mouse_move(lcd, (int)lcd->cuts);
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
handled = true;
} break;
}
@@ -640,14 +640,14 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
RNA_int_set(op->ptr, "number_cuts", (int)lcd->cuts);
ringsel_find_edge(lcd, (int)lcd->cuts);
show_cuts = true;
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
}
if (smoothness != lcd->smoothness) {
lcd->smoothness = clamp_f(smoothness, -SUBD_SMOOTH_MAX, SUBD_SMOOTH_MAX);
RNA_float_set(op->ptr, "smoothness", lcd->smoothness);
show_cuts = true;
- ED_region_tag_redraw(lcd->ar);
+ ED_region_tag_redraw(lcd->region);
}
if (show_cuts) {
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index c9438f43e04..fac0fc72c0b 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -87,10 +87,10 @@ static void edbm_flag_disable_all_multi(ViewLayer *view_layer, View3D *v3d, cons
/* When accessed as a tool, get the active edge from the preselection gizmo. */
static bool edbm_preselect_or_active(bContext *C, const View3D *v3d, Base **r_base, BMElem **r_ele)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const bool show_gizmo = !((v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)));
- wmGizmoMap *gzmap = show_gizmo ? ar->gizmo_map : NULL;
+ wmGizmoMap *gzmap = show_gizmo ? region->gizmo_map : NULL;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_mesh_preselect_elem") :
NULL;
if (gzgroup != NULL) {
@@ -296,7 +296,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
/* Just add vert */
copy_v3_v3(center, vc.scene->cursor.location);
mul_v3_m4v3(center, vc.obedit->obmat, center);
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
mul_m4_v3(vc.obedit->imat, center);
BMVert *v_new = BM_vert_create(bm, center, NULL, BM_CREATE_NOP);
@@ -311,7 +311,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co);
mul_m4_v3(vc.obedit->obmat, center);
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
mul_m4_v3(vc.obedit->imat, center);
if (f_reference->len == 3 && RNA_boolean_get(op->ptr, "create_quads")) {
const float fac = line_point_factor_v3(center, e_act->v1->co, e_act->v2->co);
@@ -366,7 +366,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
BMFace *f_reference = e_pair[0]->l ? e_pair[0]->l->f : NULL;
mul_v3_m4v3(center, vc.obedit->obmat, v_act->co);
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
mul_m4_v3(vc.obedit->imat, center);
BMVert *v_quad[4];
@@ -388,7 +388,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
else {
/* Just add edge */
mul_m4_v3(vc.obedit->obmat, center);
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, v_act->co, event->mval, center);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, v_act->co, event->mval, center);
mul_m4_v3(vc.obedit->imat, center);
BMVert *v_new = BM_vert_create(bm, center, NULL, BM_CREATE_NOP);
@@ -474,7 +474,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
BMEdge *e_act = (BMEdge *)ele_act;
mid_v3_v3v3(center, e_act->v1->co, e_act->v2->co);
mul_m4_v3(vc.obedit->obmat, center);
- ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center);
+ ED_view3d_win_to_3d_int(vc.v3d, vc.region, center, event->mval, center);
mul_m4_v3(vc.obedit->imat, center);
const float fac = line_point_factor_v3(center, e_act->v1->co, e_act->v2->co);
diff --git a/source/blender/editors/mesh/editmesh_preselect_elem.c b/source/blender/editors/mesh/editmesh_preselect_elem.c
index 05c4da68355..d53a1e2b55c 100644
--- a/source/blender/editors/mesh/editmesh_preselect_elem.c
+++ b/source/blender/editors/mesh/editmesh_preselect_elem.c
@@ -258,7 +258,7 @@ static void view3d_preselect_update_preview_triangle_from_vert(struct EditMesh_P
if (e_pair[1] != NULL) {
mul_v3_m4v3(center, vc->obedit->obmat, v_act->co);
- ED_view3d_win_to_3d_int(vc->v3d, vc->ar, center, mval, center);
+ ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center);
mul_m4_v3(vc->obedit->imat, center);
psel->preview_tris = MEM_mallocN(sizeof(*psel->preview_tris) * 2, __func__);
@@ -326,7 +326,7 @@ static void view3d_preselect_update_preview_triangle_from_edge(struct EditMesh_P
psel->preview_lines = MEM_mallocN(sizeof(*psel->preview_lines) * 3, __func__);
mid_v3_v3v3(center, eed->v1->co, eed->v2->co);
mul_m4_v3(vc->obedit->obmat, center);
- ED_view3d_win_to_3d_int(vc->v3d, vc->ar, center, mval, center);
+ ED_view3d_win_to_3d_int(vc->v3d, vc->region, center, mval, center);
mul_m4_v3(vc->obedit->imat, center);
copy_v3_v3(psel->preview_tris[0][0], eed->v1->co);
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 71bf77cc788..3fa6569e3e9 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -56,7 +56,7 @@
* point and would result in the same distance.
*/
#define INSET_DEFAULT 0.00001f
-static float edbm_rip_edgedist_squared(ARegion *ar,
+static float edbm_rip_edgedist_squared(ARegion *region,
float mat[4][4],
const float co1[3],
const float co2[3],
@@ -65,8 +65,8 @@ static float edbm_rip_edgedist_squared(ARegion *ar,
{
float vec1[2], vec2[2], dist_sq;
- ED_view3d_project_float_v2_m4(ar, co1, vec1, mat);
- ED_view3d_project_float_v2_m4(ar, co2, vec2, mat);
+ ED_view3d_project_float_v2_m4(region, co1, vec1, mat);
+ ED_view3d_project_float_v2_m4(region, co2, vec2, mat);
if (inset != 0.0f) {
const float dist_2d = len_v2v2(vec1, vec2);
@@ -86,12 +86,12 @@ static float edbm_rip_edgedist_squared(ARegion *ar,
#if 0
static float edbm_rip_linedist(
- ARegion *ar, float mat[4][4], const float co1[3], const float co2[3], const float mvalf[2])
+ ARegion *region, float mat[4][4], const float co1[3], const float co2[3], const float mvalf[2])
{
float vec1[2], vec2[2];
- ED_view3d_project_float_v2_m4(ar, co1, vec1, mat);
- ED_view3d_project_float_v2_m4(ar, co2, vec2, mat);
+ ED_view3d_project_float_v2_m4(region, co1, vec1, mat);
+ ED_view3d_project_float_v2_m4(region, co2, vec2, mat);
return dist_to_line_v2(mvalf, vec1, vec2);
}
@@ -110,7 +110,7 @@ static void edbm_calc_loop_co(BMLoop *l, float l_mid_co[3])
}
static float edbm_rip_edge_side_measure(
- BMEdge *e, BMLoop *e_l, ARegion *ar, float projectMat[4][4], const float fmval[2])
+ BMEdge *e, BMLoop *e_l, ARegion *region, float projectMat[4][4], const float fmval[2])
{
float cent[3] = {0, 0, 0}, mid[3];
@@ -137,11 +137,11 @@ static float edbm_rip_edge_side_measure(
mid_v3_v3v3(cent, v1_other->co, v2_other->co);
mid_v3_v3v3(mid, e->v1->co, e->v2->co);
- ED_view3d_project_float_v2_m4(ar, cent, cent, projectMat);
- ED_view3d_project_float_v2_m4(ar, mid, mid, projectMat);
+ ED_view3d_project_float_v2_m4(region, cent, cent, projectMat);
+ ED_view3d_project_float_v2_m4(region, mid, mid, projectMat);
- ED_view3d_project_float_v2_m4(ar, e->v1->co, e_v1_co, projectMat);
- ED_view3d_project_float_v2_m4(ar, e->v2->co, e_v2_co, projectMat);
+ ED_view3d_project_float_v2_m4(region, e->v1->co, e_v1_co, projectMat);
+ ED_view3d_project_float_v2_m4(region, e->v2->co, e_v2_co, projectMat);
sub_v2_v2v2(vec, cent, mid);
normalize_v2_length(vec, 0.01f);
@@ -346,7 +346,7 @@ static BMVert *edbm_ripsel_edloop_pair_start_vert(BMEdge *e)
}
static void edbm_ripsel_deselect_helper(
- BMesh *bm, EdgeLoopPair *eloop_pairs, ARegion *ar, float projectMat[4][4], float fmval[2])
+ BMesh *bm, EdgeLoopPair *eloop_pairs, ARegion *region, float projectMat[4][4], float fmval[2])
{
EdgeLoopPair *lp;
@@ -360,12 +360,12 @@ static void edbm_ripsel_deselect_helper(
e = lp->l_a->e;
v_prev = edbm_ripsel_edloop_pair_start_vert(e);
for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) {
- score_a += edbm_rip_edge_side_measure(e, e->l, ar, projectMat, fmval);
+ score_a += edbm_rip_edge_side_measure(e, e->l, region, projectMat, fmval);
}
e = lp->l_b->e;
v_prev = edbm_ripsel_edloop_pair_start_vert(e);
for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) {
- score_b += edbm_rip_edge_side_measure(e, e->l, ar, projectMat, fmval);
+ score_b += edbm_rip_edge_side_measure(e, e->l, region, projectMat, fmval);
}
e = (score_a > score_b) ? lp->l_a->e : lp->l_b->e;
@@ -514,7 +514,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
{
UnorderedLoopPair *fill_uloop_pairs = NULL;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
@@ -568,7 +568,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
if ((is_manifold_region == false) || BM_edge_is_manifold(e)) {
d = edbm_rip_edgedist_squared(
- ar, projectMat, e->v1->co, e->v2->co, fmval, INSET_DEFAULT);
+ region, projectMat, e->v1->co, e->v2->co, fmval, INSET_DEFAULT);
if ((e_best == NULL) || (d < dist_sq)) {
dist_sq = d;
e_best = e;
@@ -619,7 +619,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
float l_mid_co[3];
l = l_all[i1];
edbm_calc_loop_co(l, l_mid_co);
- d = edbm_rip_edgedist_squared(ar, projectMat, l->v->co, l_mid_co, fmval, INSET_DEFAULT);
+ d = edbm_rip_edgedist_squared(region, projectMat, l->v->co, l_mid_co, fmval, INSET_DEFAULT);
if ((e_best == NULL) || (d < dist_sq)) {
dist_sq = d;
@@ -678,7 +678,8 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
float l_mid_co[3];
edbm_calc_loop_co(l, l_mid_co);
- d = edbm_rip_edgedist_squared(ar, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT);
+ d = edbm_rip_edgedist_squared(
+ region, projectMat, v->co, l_mid_co, fmval, INSET_DEFAULT);
if (d < dist_sq) {
dist_sq = d;
@@ -695,7 +696,8 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
float e_mid_co[3];
mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co);
- d = edbm_rip_edgedist_squared(ar, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT);
+ d = edbm_rip_edgedist_squared(
+ region, projectMat, v->co, e_mid_co, fmval, INSET_DEFAULT);
if (d < dist_sq) {
dist_sq = d;
@@ -837,7 +839,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
/* check if v_best is null in the _rare_ case there are numeric issues */
edbm_calc_loop_co(l, l_corner_co);
d = edbm_rip_edgedist_squared(
- ar, projectMat, l->v->co, l_corner_co, fmval, INSET_DEFAULT);
+ region, projectMat, l->v->co, l_corner_co, fmval, INSET_DEFAULT);
if ((v_best == NULL) || (d < dist_sq)) {
v_best = v;
dist_sq = d;
@@ -872,7 +874,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
{
UnorderedLoopPair *fill_uloop_pairs = NULL;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
@@ -933,8 +935,8 @@ static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obed
/* find the best face to follow, this way the edge won't point away from
* the mouse when there are more than 4 (takes the shortest face fan around) */
- l = (edbm_rip_edge_side_measure(e_best, l_a, ar, projectMat, fmval) <
- edbm_rip_edge_side_measure(e_best, l_b, ar, projectMat, fmval)) ?
+ l = (edbm_rip_edge_side_measure(e_best, l_a, region, projectMat, fmval) <
+ edbm_rip_edge_side_measure(e_best, l_b, region, projectMat, fmval)) ?
l_a :
l_b;
@@ -977,7 +979,7 @@ static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obed
* edge did not split even though it was tagged which would not work
* as expected (but not crash), however there are checks to ensure
* tagged edges will split. So far its not been an issue. */
- edbm_ripsel_deselect_helper(bm, eloop_pairs, ar, projectMat, fmval);
+ edbm_ripsel_deselect_helper(bm, eloop_pairs, region, projectMat, fmval);
MEM_freeN(eloop_pairs);
/* deselect loose verts */
diff --git a/source/blender/editors/mesh/editmesh_rip_edge.c b/source/blender/editors/mesh/editmesh_rip_edge.c
index 5dd3c85f34f..e2aca1e6831 100644
--- a/source/blender/editors/mesh/editmesh_rip_edge.c
+++ b/source/blender/editors/mesh/editmesh_rip_edge.c
@@ -47,7 +47,7 @@
static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
@@ -86,7 +86,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
float v_sco[2];
- ED_view3d_project_float_v2_m4(ar, v->co, v_sco, projectMat);
+ ED_view3d_project_float_v2_m4(region, v->co, v_sco, projectMat);
add_v2_v2(cent_sco, v_sco);
cent_tot += 1;
@@ -108,8 +108,8 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
float cent_sco_test[2];
float dist_sq_test;
- ED_view3d_project_float_v2_m4(ar, e->v1->co, e_sco[0], projectMat);
- ED_view3d_project_float_v2_m4(ar, e->v2->co, e_sco[1], projectMat);
+ ED_view3d_project_float_v2_m4(region, e->v1->co, e_sco[0], projectMat);
+ ED_view3d_project_float_v2_m4(region, e->v2->co, e_sco[1], projectMat);
closest_to_line_segment_v2(cent_sco_test, mval_fl, e_sco[0], e_sco[1]);
dist_sq_test = len_squared_v2v2(cent_sco_test, mval_fl);
@@ -167,7 +167,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
goto found_edge;
}
#endif
- ED_view3d_project_float_v2_m4(ar, v->co, v_sco, projectMat);
+ ED_view3d_project_float_v2_m4(region, v->co, v_sco, projectMat);
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
@@ -175,7 +175,7 @@ static int edbm_rip_edge_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
float v_other_sco[2];
float angle_test;
- ED_view3d_project_float_v2_m4(ar, v_other->co, v_other_sco, projectMat);
+ ED_view3d_project_float_v2_m4(region, v_other->co, v_other_sco, projectMat);
/* avoid comparing with view-axis aligned edges (less than a pixel) */
if (len_squared_v2v2(v_sco, v_other_sco) > 1.0f) {
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 6eabb079f4e..1635aa72ee0 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -286,7 +286,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
uint base_index = 0;
if (!XRAY_FLAG_ENABLED(vc->v3d)) {
- uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
+ uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->region, *r_dist);
uint index;
BMVert *eve;
@@ -295,7 +295,7 @@ BMVert *EDBM_vert_find_nearest_ex(ViewContext *vc,
DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_VERTEX);
index = DRW_select_buffer_find_nearest_to_point(
- vc->depsgraph, vc->ar, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px);
+ vc->depsgraph, vc->region, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px);
if (index) {
eve = (BMVert *)edbm_select_id_bm_elem_get(bases, index, &base_index);
@@ -509,7 +509,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
uint base_index = 0;
if (!XRAY_FLAG_ENABLED(vc->v3d)) {
- uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->ar, *r_dist);
+ uint dist_px = (uint)ED_view3d_backbuf_sample_size_clamp(vc->region, *r_dist);
uint index;
BMEdge *eed;
@@ -518,7 +518,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc,
DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_EDGE);
index = DRW_select_buffer_find_nearest_to_point(
- vc->depsgraph, vc->ar, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px);
+ vc->depsgraph, vc->region, vc->v3d, vc->mval, 1, UINT_MAX, &dist_px);
if (index) {
eed = (BMEdge *)edbm_select_id_bm_elem_get(bases, index, &base_index);
@@ -724,7 +724,7 @@ BMFace *EDBM_face_find_nearest_ex(ViewContext *vc,
{
DRW_select_buffer_context_create(bases, bases_len, SCE_SELECT_FACE);
- index = DRW_select_buffer_sample_point(vc->depsgraph, vc->ar, vc->v3d, vc->mval);
+ index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, vc->mval);
if (index) {
efa = (BMFace *)edbm_select_id_bm_elem_get(bases, index, &base_index);
@@ -1042,7 +1042,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
} best_face = {0, NULL};
if (ED_view3d_win_to_ray_clipped(
- vc->depsgraph, vc->ar, vc->v3d, mval_fl, ray_origin, ray_direction, true)) {
+ vc->depsgraph, vc->region, vc->v3d, mval_fl, ray_origin, ray_direction, true)) {
float dist_sq_best = FLT_MAX;
float dist_sq_best_vert = FLT_MAX;
float dist_sq_best_edge = FLT_MAX;
@@ -1733,12 +1733,12 @@ static bool mouse_mesh_loop(
/* We can't be sure this has already been set... */
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
- if (ED_view3d_project_float_object(vc.ar, eed->v1->co, v1_co, V3D_PROJ_TEST_CLIP_NEAR) ==
+ if (ED_view3d_project_float_object(vc.region, eed->v1->co, v1_co, V3D_PROJ_TEST_CLIP_NEAR) ==
V3D_PROJ_RET_OK) {
length_1 = len_squared_v2v2(mvalf, v1_co);
}
- if (ED_view3d_project_float_object(vc.ar, eed->v2->co, v2_co, V3D_PROJ_TEST_CLIP_NEAR) ==
+ if (ED_view3d_project_float_object(vc.region, eed->v2->co, v2_co, V3D_PROJ_TEST_CLIP_NEAR) ==
V3D_PROJ_RET_OK) {
length_2 = len_squared_v2v2(mvalf, v2_co);
}
@@ -1768,7 +1768,7 @@ static bool mouse_mesh_loop(
float co[2], tdist;
BM_face_calc_center_median(f, cent);
- if (ED_view3d_project_float_object(vc.ar, cent, co, V3D_PROJ_TEST_CLIP_NEAR) ==
+ if (ED_view3d_project_float_object(vc.region, cent, co, V3D_PROJ_TEST_CLIP_NEAR) ==
V3D_PROJ_RET_OK) {
tdist = len_squared_v2v2(mvalf, co);
if (tdist < best_dist) {
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 91ffe0ce05c..e38bb90fd08 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -411,21 +411,21 @@ void MESH_OT_unsubdivide(wmOperatorType *ot)
}
void EDBM_project_snap_verts(
- bContext *C, Depsgraph *depsgraph, ARegion *ar, Object *obedit, BMEditMesh *em)
+ bContext *C, Depsgraph *depsgraph, ARegion *region, Object *obedit, BMEditMesh *em)
{
Main *bmain = CTX_data_main(C);
BMIter iter;
BMVert *eve;
- ED_view3d_init_mats_rv3d(obedit, ar->regiondata);
+ ED_view3d_init_mats_rv3d(obedit, region->regiondata);
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
- bmain, CTX_data_scene(C), depsgraph, 0, ar, CTX_wm_view3d(C));
+ bmain, CTX_data_scene(C), depsgraph, 0, region, CTX_wm_view3d(C));
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
float mval[2], co_proj[3];
- if (ED_view3d_project_float_object(ar, eve->co, mval, V3D_PROJ_TEST_NOP) ==
+ if (ED_view3d_project_float_object(region, eve->co, mval, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
if (ED_transform_snap_object_project_view3d(snap_context,
SCE_SNAP_MODE_FACE,
@@ -3750,7 +3750,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
BMVert *bv;
BMIter iter;
BMEdge *be;
@@ -3764,8 +3764,8 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
/* allocd vars */
float(*screen_vert_coords)[2], (*sco)[2], (*mouse_path)[2];
- /* edit-object needed for matrix, and ar->regiondata for projections to work */
- if (ELEM(NULL, obedit, ar, ar->regiondata)) {
+ /* edit-object needed for matrix, and region->regiondata for projections to work */
+ if (ELEM(NULL, obedit, region, region->regiondata)) {
return OPERATOR_CANCELLED;
}
@@ -3790,7 +3790,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
RNA_END;
/* for ED_view3d_project_float_object */
- ED_view3d_init_mats_rv3d(obedit, ar->regiondata);
+ ED_view3d_init_mats_rv3d(obedit, region->regiondata);
/* TODO, investigate using index lookup for screen_vert_coords() rather then a hash table */
@@ -3799,7 +3799,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__);
BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) {
- if (ED_view3d_project_float_object(ar, bv->co, *sco, V3D_PROJ_TEST_CLIP_NEAR) !=
+ if (ED_view3d_project_float_object(region, bv->co, *sco, V3D_PROJ_TEST_CLIP_NEAR) !=
V3D_PROJ_RET_OK) {
copy_v2_fl(*sco, FLT_MAX); /* set error value */
}
@@ -8020,12 +8020,12 @@ static int edbm_point_normals_modal(bContext *C, wmOperator *op, const wmEvent *
/* Only handle mousemove event in case we are in mouse mode. */
if (event->type == MOUSEMOVE || force_mousemove) {
if (mode == EDBM_CLNOR_POINTTO_MODE_MOUSE) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float center[3];
bmesh_selected_verts_center_calc(bm, center);
- ED_view3d_win_to_3d_int(v3d, ar, center, event->mval, target);
+ ED_view3d_win_to_3d_int(v3d, region, center, event->mval, target);
ret = OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index f7092a8c6ab..e5f436bbe48 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1577,7 +1577,7 @@ static void scale_point(float c1[3], const float p[3], const float s)
bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
BMEdge *e,
struct Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
Object *obedit)
{
@@ -1587,11 +1587,11 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree,
float epsilon = 0.01f;
float end[3];
const float mval_f[2] = {
- ar->winx / 2.0f,
- ar->winy / 2.0f,
+ region->winx / 2.0f,
+ region->winy / 2.0f,
};
- ED_view3d_win_to_segment_clipped(depsgraph, ar, v3d, mval_f, origin, end, false);
+ ED_view3d_win_to_segment_clipped(depsgraph, region, v3d, mval_f, origin, end, false);
invert_m4_m4(invmat, obedit->obmat);
mul_m4_v3(invmat, origin);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 3ba8780c18a..dc825871bb7 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -1167,11 +1167,11 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px,
/* sample rect to increase chances of selecting, so that when clicking
* on an edge in the backbuf, we can still select a face */
*r_index = DRW_select_buffer_find_nearest_to_point(
- vc.depsgraph, vc.ar, vc.v3d, mval, 1, me->totpoly + 1, &dist_px);
+ vc.depsgraph, vc.region, vc.v3d, mval, 1, me->totpoly + 1, &dist_px);
}
else {
/* sample only on the exact position */
- *r_index = DRW_select_buffer_sample_point(vc.depsgraph, vc.ar, vc.v3d, mval);
+ *r_index = DRW_select_buffer_sample_point(vc.depsgraph, vc.region, vc.v3d, mval);
}
if ((*r_index) == 0 || (*r_index) > (unsigned int)me->totpoly) {
@@ -1185,7 +1185,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px,
static void ed_mesh_pick_face_vert__mpoly_find(
/* context */
- struct ARegion *ar,
+ struct ARegion *region,
const float mval[2],
/* mesh data (evaluated) */
const MPoly *mp,
@@ -1201,7 +1201,7 @@ static void ed_mesh_pick_face_vert__mpoly_find(
float sco[2];
const int v_idx = ml->v;
const float *co = mvert[v_idx].co;
- if (ED_view3d_project_float_object(ar, co, sco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_object(region, co, sco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
const float len_test = len_manhattan_v2v2(mval, sco);
if (len_test < *r_len_best) {
*r_len_best = len_test;
@@ -1226,7 +1226,7 @@ bool ED_mesh_pick_face_vert(
if (ED_mesh_pick_face(C, ob, mval, dist_px, &poly_index)) {
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- struct ARegion *ar = CTX_wm_region(C);
+ struct ARegion *region = CTX_wm_region(C);
/* derived mesh to find deformed locations */
Mesh *me_eval = mesh_get_eval_final(
@@ -1258,14 +1258,19 @@ bool ED_mesh_pick_face_vert(
for (i = 0; i < me_eval_mpoly_len; i++) {
if (index_mp_to_orig[i] == poly_index) {
- ed_mesh_pick_face_vert__mpoly_find(
- ar, mval_f, &me_eval_mpoly[i], me_eval_mvert, me_eval_mloop, &len_best, &v_idx_best);
+ ed_mesh_pick_face_vert__mpoly_find(region,
+ mval_f,
+ &me_eval_mpoly[i],
+ me_eval_mvert,
+ me_eval_mloop,
+ &len_best,
+ &v_idx_best);
}
}
}
else {
if (poly_index < me_eval_mpoly_len) {
- ed_mesh_pick_face_vert__mpoly_find(ar,
+ ed_mesh_pick_face_vert__mpoly_find(region,
mval_f,
&me_eval_mpoly[poly_index],
me_eval_mvert,
@@ -1302,7 +1307,7 @@ bool ED_mesh_pick_face_vert(
typedef struct VertPickData {
const MVert *mvert;
const float *mval_f; /* [2] */
- ARegion *ar;
+ ARegion *region;
/* runtime */
float len_best;
@@ -1319,7 +1324,7 @@ static void ed_mesh_pick_vert__mapFunc(void *userData,
if ((data->mvert[index].flag & ME_HIDE) == 0) {
float sco[2];
- if (ED_view3d_project_float_object(data->ar, co, sco, V3D_PROJ_TEST_CLIP_DEFAULT) ==
+ if (ED_view3d_project_float_object(data->region, co, sco, V3D_PROJ_TEST_CLIP_DEFAULT) ==
V3D_PROJ_RET_OK) {
const float len = len_manhattan_v2v2(data->mval_f, sco);
if (len < data->len_best) {
@@ -1350,11 +1355,11 @@ bool ED_mesh_pick_vert(
/* sample rect to increase chances of selecting, so that when clicking
* on an face in the backbuf, we can still select a vert */
*r_index = DRW_select_buffer_find_nearest_to_point(
- vc.depsgraph, vc.ar, vc.v3d, mval, 1, me->totvert + 1, &dist_px);
+ vc.depsgraph, vc.region, vc.v3d, mval, 1, me->totvert + 1, &dist_px);
}
else {
/* sample only on the exact position */
- *r_index = DRW_select_buffer_sample_point(vc.depsgraph, vc.ar, vc.v3d, mval);
+ *r_index = DRW_select_buffer_sample_point(vc.depsgraph, vc.region, vc.v3d, mval);
}
if ((*r_index) == 0 || (*r_index) > (uint)me->totvert) {
@@ -1369,8 +1374,8 @@ bool ED_mesh_pick_vert(
/* derived mesh to find deformed locations */
Mesh *me_eval = mesh_get_eval_final(vc.depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
- ARegion *ar = vc.ar;
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = vc.region;
+ RegionView3D *rv3d = region->regiondata;
/* find the vert closest to 'mval' */
const float mval_f[2] = {(float)mval[0], (float)mval[1]};
@@ -1385,7 +1390,7 @@ bool ED_mesh_pick_vert(
/* setup data */
data.mvert = me->mvert;
- data.ar = ar;
+ data.region = region;
data.mval_f = mval_f;
data.len_best = FLT_MAX;
data.v_idx_best = -1;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index a8eaa663285..06f532f99e3 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1327,8 +1327,8 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
if (0 == RNA_struct_property_is_set(op->ptr, "location")) {
const wmEvent *event = CTX_wm_window(C)->eventstate;
- ARegion *ar = CTX_wm_region(C);
- const int mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
+ ARegion *region = CTX_wm_region(C);
+ const int mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin};
ED_object_location_from_view(C, loc);
ED_view3d_cursor3d_position(C, mval, false, loc);
RNA_float_set_array(op->ptr, "location", loc);
@@ -2762,8 +2762,8 @@ static int add_named_exec(bContext *C, wmOperator *op)
basen->object->restrictflag &= ~OB_RESTRICT_VIEWPORT;
if (event) {
- ARegion *ar = CTX_wm_region(C);
- const int mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin};
+ ARegion *region = CTX_wm_region(C);
+ const int mval[2] = {event->x - region->winrct.xmin, event->y - region->winrct.ymin};
ED_object_location_from_view(C, basen->object->loc);
ED_view3d_cursor3d_position(C, mval, false, basen->object->loc);
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index e35c806473a..039714ca3ec 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -1637,7 +1637,7 @@ static void object_transform_axis_target_calc_depth_init(struct XFormAxisData *x
struct XFormAxisItem *item = xfd->object_data;
float view_co_a[3], view_co_b[3];
const float mval_fl[2] = {UNPACK2(mval)};
- ED_view3d_win_to_ray(xfd->vc.ar, mval_fl, view_co_a, view_co_b);
+ ED_view3d_win_to_ray(xfd->vc.region, mval_fl, view_co_a, view_co_b);
add_v3_v3(view_co_b, view_co_a);
float center[3] = {0.0f};
int center_tot = 0;
@@ -1655,7 +1655,7 @@ static void object_transform_axis_target_calc_depth_init(struct XFormAxisData *x
if (center_tot) {
mul_v3_fl(center, 1.0f / center_tot);
float center_proj[3];
- ED_view3d_project(xfd->vc.ar, center, center_proj);
+ ED_view3d_project(xfd->vc.region, center, center_proj);
xfd->prev.depth = center_proj[2];
xfd->prev.is_depth_valid = true;
}
@@ -1777,12 +1777,12 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons
vc.v3d->flag2 |= V3D_HIDE_OVERLAYS;
#endif
- ED_view3d_autodist_init(vc.depsgraph, vc.ar, vc.v3d, 0);
+ ED_view3d_autodist_init(vc.depsgraph, vc.region, vc.v3d, 0);
if (vc.rv3d->depths != NULL) {
vc.rv3d->depths->damaged = true;
}
- ED_view3d_depth_update(vc.ar);
+ ED_view3d_depth_update(vc.region);
#ifdef USE_RENDER_OVERRIDE
vc.v3d->flag2 = flag2_prev;
@@ -1793,7 +1793,7 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons
return OPERATOR_CANCELLED;
}
- ED_region_tag_redraw(vc.ar);
+ ED_region_tag_redraw(vc.region);
struct XFormAxisData *xfd;
xfd = op->customdata = MEM_callocN(sizeof(struct XFormAxisData), __func__);
@@ -1850,7 +1850,7 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons
static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
struct XFormAxisData *xfd = op->customdata;
- ARegion *ar = xfd->vc.ar;
+ ARegion *region = xfd->vc.region;
view3d_operator_needs_opengl(C);
@@ -1884,7 +1884,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
if ((depth > depths->depth_range[0]) && (depth < depths->depth_range[1])) {
xfd->prev.depth = depth;
xfd->prev.is_depth_valid = true;
- if (ED_view3d_depth_unproject(ar, event->mval, depth, location_world)) {
+ if (ED_view3d_depth_unproject(region, event->mval, depth, location_world)) {
if (is_translate) {
float normal[3];
@@ -1984,7 +1984,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
}
xfd->is_translate = is_translate;
- ED_region_tag_redraw(xfd->vc.ar);
+ ED_region_tag_redraw(xfd->vc.region);
}
bool is_finished = false;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 99af9d094a9..d7ae1a15e1b 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -136,10 +136,10 @@ bool PE_hair_poll(bContext *C)
bool PE_poll_view3d(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
return (PE_poll(C) && (sa && sa->spacetype == SPACE_VIEW3D) &&
- (ar && ar->regiontype == RGN_TYPE_WINDOW));
+ (region && region->regiontype == RGN_TYPE_WINDOW));
}
void PE_free_ptcache_edit(PTCacheEdit *edit)
@@ -481,7 +481,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
/* we may need to force an update here by setting the rv3d as dirty
* for now it seems ok, but take care!:
* rv3d->depths->dirty = 1; */
- ED_view3d_depth_update(data->vc.ar);
+ ED_view3d_depth_update(data->vc.region);
}
}
}
@@ -536,7 +536,7 @@ static bool key_test_depth(const PEData *data, const float co[3], const int scre
/* used to calculate here but all callers have the screen_co already, so pass as arg */
#if 0
- if (ED_view3d_project_int_global(data->vc.ar,
+ if (ED_view3d_project_int_global(data->vc.region,
co,
screen_co,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN |
@@ -556,7 +556,7 @@ static bool key_test_depth(const PEData *data, const float co[3], const int scre
}
float win[3];
- ED_view3d_project(data->vc.ar, co, win);
+ ED_view3d_project(data->vc.region, co, win);
if (win[2] - 0.00001f > depth) {
return 0;
@@ -572,7 +572,7 @@ static bool key_inside_circle(const PEData *data, float rad, const float co[3],
int screen_co[2];
/* TODO, should this check V3D_PROJ_TEST_CLIP_BB too? */
- if (ED_view3d_project_int_global(data->vc.ar, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) !=
+ if (ED_view3d_project_int_global(data->vc.region, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) !=
V3D_PROJ_RET_OK) {
return 0;
}
@@ -600,7 +600,7 @@ static bool key_inside_rect(PEData *data, const float co[3])
{
int screen_co[2];
- if (ED_view3d_project_int_global(data->vc.ar, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) !=
+ if (ED_view3d_project_int_global(data->vc.region, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) !=
V3D_PROJ_RET_OK) {
return 0;
}
@@ -2261,7 +2261,7 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, const
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ParticleEditSettings *pset = PE_settings(scene);
PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob);
ParticleSystem *psys = edit->psys;
@@ -2298,7 +2298,7 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, const
mul_m4_v3(mat, co);
const bool is_select = key->flag & PEK_SELECT;
const bool is_inside =
- ((ED_view3d_project_int_global(ar, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) ==
+ ((ED_view3d_project_int_global(region, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) ==
V3D_PROJ_RET_OK) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], IS_CLIPPED) &&
key_test_depth(&data, co, screen_co));
@@ -2317,7 +2317,7 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, const
mul_m4_v3(mat, co);
const bool is_select = key->flag & PEK_SELECT;
const bool is_inside =
- ((ED_view3d_project_int_global(ar, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) ==
+ ((ED_view3d_project_int_global(region, co, screen_co, V3D_PROJ_TEST_CLIP_WIN) ==
V3D_PROJ_RET_OK) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], IS_CLIPPED) &&
key_test_depth(&data, co, screen_co));
@@ -3551,7 +3551,7 @@ static void brush_comb(PEData *data,
static void brush_cut(PEData *data, int pa_index)
{
PTCacheEdit *edit = data->edit;
- ARegion *ar = data->vc.ar;
+ ARegion *region = data->vc.region;
Object *ob = data->ob;
ParticleEditSettings *pset = PE_settings(data->scene);
ParticleCacheKey *key = edit->pathcache[pa_index];
@@ -3571,7 +3571,7 @@ static void brush_cut(PEData *data, int pa_index)
return;
}
- if (ED_view3d_project_int_global(ar, key->co, screen_co, V3D_PROJ_TEST_CLIP_NEAR) !=
+ if (ED_view3d_project_int_global(region, key->co, screen_co, V3D_PROJ_TEST_CLIP_NEAR) !=
V3D_PROJ_RET_OK) {
return;
}
@@ -3598,7 +3598,7 @@ static void brush_cut(PEData *data, int pa_index)
/* calculate path time closest to root that was inside the circle */
for (k = 1, key++; k <= keys; k++, key++) {
- if ((ED_view3d_project_int_global(ar, key->co, screen_co, V3D_PROJ_TEST_CLIP_NEAR) !=
+ if ((ED_view3d_project_int_global(region, key->co, screen_co, V3D_PROJ_TEST_CLIP_NEAR) !=
V3D_PROJ_RET_OK) ||
key_test_depth(data, key->co, screen_co) == 0) {
x0 = (float)screen_co[0];
@@ -4131,7 +4131,7 @@ static void brush_add_count_iter(void *__restrict iter_data_v,
mco[1] = data->mval[1] + dmy;
float co1[3], co2[3];
- ED_view3d_win_to_segment_clipped(depsgraph, data->vc.ar, data->vc.v3d, mco, co1, co2, true);
+ ED_view3d_win_to_segment_clipped(depsgraph, data->vc.region, data->vc.v3d, mco, co1, co2, true);
mul_m4_v3(iter_data->imat, co1);
mul_m4_v3(iter_data->imat, co2);
@@ -4487,7 +4487,7 @@ static int brush_edit_init(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = CTX_data_active_object(C);
PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
BrushEdit *bedit;
float min[3], max[3];
@@ -4509,7 +4509,7 @@ static int brush_edit_init(bContext *C, wmOperator *op)
bedit->ob = ob;
bedit->edit = edit;
- bedit->zfac = ED_view3d_calc_zfac(ar->regiondata, min, NULL);
+ bedit->zfac = ED_view3d_calc_zfac(region->regiondata, min, NULL);
/* cache view depths and settings for re-use */
PE_set_view3d_data(C, &bedit->data);
@@ -4528,7 +4528,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
ParticleEditSettings *pset = PE_settings(scene);
ParticleSystemModifierData *psmd_eval = edit->psmd_eval;
ParticleBrushData *brush = &pset->brush[pset->brushtype];
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float vec[3], mousef[2];
int mval[2];
int flip, mouse[2], removed = 0, added = 0, selected = 0, tot_steps = 1, step = 1;
@@ -4596,7 +4596,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
invert_m4_m4(ob->imat, ob->obmat);
- ED_view3d_win_to_delta(ar, mval_f, vec, bedit->zfac);
+ ED_view3d_win_to_delta(region, mval_f, vec, bedit->zfac);
data.dvec = vec;
foreach_mouse_hit_key(&data, brush_comb, selected);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index add023fe57a..4fa1903758f 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -105,7 +105,7 @@ typedef struct OGLRender {
View3D *v3d;
RegionView3D *rv3d;
- ARegion *ar;
+ ARegion *region;
ScrArea *prevsa;
ARegion *prevar;
@@ -287,7 +287,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = oglrender->scene;
- ARegion *ar = oglrender->ar;
+ ARegion *region = oglrender->region;
View3D *v3d = oglrender->v3d;
RegionView3D *rv3d = oglrender->rv3d;
Object *camera = NULL;
@@ -377,7 +377,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
scene,
v3d->shading.type,
v3d,
- ar,
+ region,
sizex,
sizey,
imbuf_flags,
@@ -806,9 +806,9 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
if (is_view_context) {
/* so quad view renders camera */
- ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar);
+ ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->region);
- oglrender->rv3d = oglrender->ar->regiondata;
+ oglrender->rv3d = oglrender->region->regiondata;
/* MUST be cleared on exit */
memset(&oglrender->scene->customdata_mask_modal,
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index 3918737d560..e494bd90d65 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -107,7 +107,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
for (win = wm->windows.first; win; win = win->next) {
bScreen *sc = WM_window_get_active_screen(win);
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
CTX_wm_window_set(C, win);
@@ -116,11 +116,11 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
continue;
}
View3D *v3d = sa->spacedata.first;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype != RGN_TYPE_WINDOW) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype != RGN_TYPE_WINDOW) {
continue;
}
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
RenderEngine *engine = rv3d->render_engine;
/* call update if the scene changed, or if the render engine
* tagged itself for update (e.g. because it was busy at the
@@ -129,7 +129,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
CTX_wm_screen_set(C, sc);
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
engine->flag &= ~RE_ENGINE_DO_UPDATE;
/* NOTE: Important to pass non-updated depsgraph, This is because this function is called
@@ -145,7 +145,7 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
.depsgraph = update_ctx->depsgraph,
.scene = scene,
.view_layer = view_layer,
- .ar = ar,
+ .region = region,
.v3d = (View3D *)sa->spacedata.first,
.engine_type = engine_type,
}));
@@ -163,18 +163,18 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update
void ED_render_engine_area_exit(Main *bmain, ScrArea *sa)
{
/* clear all render engines in this area */
- ARegion *ar;
+ ARegion *region;
wmWindowManager *wm = bmain->wm.first;
if (sa->spacetype != SPACE_VIEW3D) {
return;
}
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype != RGN_TYPE_WINDOW || !(ar->regiondata)) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype != RGN_TYPE_WINDOW || !(region->regiondata)) {
continue;
}
- ED_view3d_stop_render_preview(wm, ar);
+ ED_view3d_stop_render_preview(wm, region);
}
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index c6e7b9d382a..85d84ad6864 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -82,15 +82,15 @@ enum RegionEmbossSide {
/* general area and region code */
-static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides)
+static void region_draw_emboss(const ARegion *region, const rcti *scirct, int sides)
{
rcti rect;
/* translate scissor rect to region space */
- rect.xmin = scirct->xmin - ar->winrct.xmin;
- rect.ymin = scirct->ymin - ar->winrct.ymin;
- rect.xmax = scirct->xmax - ar->winrct.xmin;
- rect.ymax = scirct->ymax - ar->winrct.ymin;
+ rect.xmin = scirct->xmin - region->winrct.xmin;
+ rect.ymin = scirct->ymin - region->winrct.ymin;
+ rect.xmax = scirct->xmax - region->winrct.xmin;
+ rect.ymax = scirct->ymax - region->winrct.ymin;
/* set transp line */
GPU_blend(true);
@@ -138,30 +138,30 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
-void ED_region_pixelspace(ARegion *ar)
+void ED_region_pixelspace(ARegion *region)
{
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
GPU_matrix_identity_set();
}
/* only exported for WM */
void ED_region_do_listen(
- wmWindow *win, ScrArea *sa, ARegion *ar, wmNotifier *note, const Scene *scene)
+ wmWindow *win, ScrArea *sa, ARegion *region, wmNotifier *note, const Scene *scene)
{
/* generic notes first */
switch (note->category) {
case NC_WM:
if (note->data == ND_FILEREAD) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_WINDOW:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
- if (ar->type && ar->type->listener) {
- ar->type->listener(win, sa, ar, note, scene);
+ if (region->type && region->type->listener) {
+ region->type->listener(win, sa, region, note, scene);
}
}
@@ -299,7 +299,7 @@ static void area_azone_tag_update(ScrArea *sa)
sa->flag |= AREA_FLAG_ACTIONZONES_UPDATE;
}
-static void region_draw_azones(ScrArea *sa, ARegion *ar)
+static void region_draw_azones(ScrArea *sa, ARegion *region)
{
AZone *az;
@@ -313,21 +313,21 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
GPU_matrix_push();
- GPU_matrix_translate_2f(-ar->winrct.xmin, -ar->winrct.ymin);
+ GPU_matrix_translate_2f(-region->winrct.xmin, -region->winrct.ymin);
for (az = sa->actionzones.first; az; az = az->next) {
/* test if action zone is over this region */
rcti azrct;
BLI_rcti_init(&azrct, az->x1, az->x2, az->y1, az->y2);
- if (BLI_rcti_isect(&ar->drawrct, &azrct, NULL)) {
+ if (BLI_rcti_isect(&region->drawrct, &azrct, NULL)) {
if (az->type == AZONE_AREA) {
area_draw_azone(az->x1, az->y1, az->x2, az->y2);
}
else if (az->type == AZONE_REGION) {
- if (az->ar) {
+ if (az->region) {
/* only display tab or icons when the region is hidden */
- if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
+ if (az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
region_draw_azone_tab_arrow(az);
}
}
@@ -348,9 +348,9 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
GPU_blend(false);
}
-static void region_draw_status_text(ScrArea *sa, ARegion *ar)
+static void region_draw_status_text(ScrArea *sa, ARegion *region)
{
- bool overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
+ bool overlap = ED_region_is_overlap(sa->spacetype, region->regiontype);
if (overlap) {
GPU_clear_color(0.0, 0.0, 0.0, 0.0);
@@ -363,7 +363,7 @@ static void region_draw_status_text(ScrArea *sa, ARegion *ar)
int fontid = BLF_set_default();
- const float width = BLF_width(fontid, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
+ const float width = BLF_width(fontid, region->headerstr, BLF_DRAW_STR_DUMMY_MAX);
const float x = UI_UNIT_X;
const float y = 0.4f * UI_UNIT_Y;
@@ -372,7 +372,7 @@ static void region_draw_status_text(ScrArea *sa, ARegion *ar)
const float x1 = x - (UI_UNIT_X - pad);
const float x2 = x + width + (UI_UNIT_X - pad);
const float y1 = pad;
- const float y2 = ar->winy - pad;
+ const float y2 = region->winy - pad;
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
@@ -389,7 +389,7 @@ static void region_draw_status_text(ScrArea *sa, ARegion *ar)
}
BLF_position(fontid, x, y, 0.0f);
- BLF_draw(fontid, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
+ BLF_draw(fontid, region->headerstr, BLF_DRAW_STR_DUMMY_MAX);
}
void ED_region_do_msg_notify_tag_redraw(
@@ -398,18 +398,18 @@ void ED_region_do_msg_notify_tag_redraw(
wmMsgSubscribeKey *UNUSED(msg_key),
wmMsgSubscribeValue *msg_val)
{
- ARegion *ar = msg_val->owner;
- ED_region_tag_redraw(ar);
+ ARegion *region = msg_val->owner;
+ ED_region_tag_redraw(region);
/* This avoids _many_ situations where header/properties control display settings.
* the common case is space properties in the header */
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_UI)) {
- while (ar && ar->prev) {
- ar = ar->prev;
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_UI)) {
+ while (region && region->prev) {
+ region = region->prev;
}
- for (; ar; ar = ar->next) {
- if (ELEM(ar->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_CHANNELS)) {
- ED_region_tag_redraw(ar);
+ for (; region; region = region->next) {
+ if (ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_CHANNELS)) {
+ ED_region_tag_redraw(region);
}
}
}
@@ -432,13 +432,13 @@ void ED_area_do_mgs_subscribe_for_tool_header(
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(sa),
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
- BLI_assert(ar->regiontype == RGN_TYPE_TOOL_HEADER);
+ BLI_assert(region->regiontype == RGN_TYPE_TOOL_HEADER);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
WM_msg_subscribe_rna_prop(
@@ -452,15 +452,15 @@ void ED_area_do_mgs_subscribe_for_tool_ui(
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(sa),
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
- BLI_assert(ar->regiontype == RGN_TYPE_UI);
- const char *category = UI_panel_category_active_get(ar, false);
+ BLI_assert(region->regiontype == RGN_TYPE_UI);
+ const char *category = UI_panel_category_active_get(region, false);
if (category && STREQ(category, "Tool")) {
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
WM_msg_subscribe_rna_prop(
@@ -480,11 +480,11 @@ static bool area_is_pseudo_minimized(const ScrArea *area)
}
/* only exported for WM */
-void ED_region_do_layout(bContext *C, ARegion *ar)
+void ED_region_do_layout(bContext *C, ARegion *region)
{
/* This is optional, only needed for dynamically sized regions. */
ScrArea *sa = CTX_wm_area(C);
- ARegionType *at = ar->type;
+ ARegionType *at = region->type;
if (!at->layout) {
return;
@@ -494,30 +494,30 @@ void ED_region_do_layout(bContext *C, ARegion *ar)
return;
}
- ar->do_draw |= RGN_DRAWING;
+ region->do_draw |= RGN_DRAWING;
UI_SetTheme(sa ? sa->spacetype : 0, at->regionid);
- at->layout(C, ar);
+ at->layout(C, region);
}
/* only exported for WM */
-void ED_region_do_draw(bContext *C, ARegion *ar)
+void ED_region_do_draw(bContext *C, ARegion *region)
{
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
- ARegionType *at = ar->type;
+ ARegionType *at = region->type;
/* see BKE_spacedata_draw_locks() */
if (at->do_lock) {
return;
}
- ar->do_draw |= RGN_DRAWING;
+ region->do_draw |= RGN_DRAWING;
- /* Set viewport, scissor, ortho and ar->drawrct. */
- wmPartialViewport(&ar->drawrct, &ar->winrct, &ar->drawrct);
+ /* Set viewport, scissor, ortho and region->drawrct. */
+ wmPartialViewport(&region->drawrct, &region->winrct, &region->drawrct);
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
UI_SetTheme(sa ? sa->spacetype : 0, at->regionid);
@@ -527,20 +527,20 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
return;
}
/* optional header info instead? */
- else if (ar->headerstr) {
- region_draw_status_text(sa, ar);
+ else if (region->headerstr) {
+ region_draw_status_text(sa, region);
}
else if (at->draw) {
- at->draw(C, ar);
+ at->draw(C, region);
}
/* XXX test: add convention to end regions always in pixel space,
* for drawing of borders/gestures etc */
- ED_region_pixelspace(ar);
+ ED_region_pixelspace(region);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_PIXEL);
- region_draw_azones(sa, ar);
+ region_draw_azones(sa, region);
/* for debugging unneeded area redraws and partial redraw */
if (G.debug_value == 888) {
@@ -550,26 +550,26 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(BLI_thread_frand(0), BLI_thread_frand(0), BLI_thread_frand(0), 0.1f);
immRectf(pos,
- ar->drawrct.xmin - ar->winrct.xmin,
- ar->drawrct.ymin - ar->winrct.ymin,
- ar->drawrct.xmax - ar->winrct.xmin,
- ar->drawrct.ymax - ar->winrct.ymin);
+ region->drawrct.xmin - region->winrct.xmin,
+ region->drawrct.ymin - region->winrct.ymin,
+ region->drawrct.xmax - region->winrct.xmin,
+ region->drawrct.ymax - region->winrct.ymin);
immUnbindProgram();
GPU_blend(false);
}
- memset(&ar->drawrct, 0, sizeof(ar->drawrct));
+ memset(&region->drawrct, 0, sizeof(region->drawrct));
- UI_blocklist_free_inactive(C, &ar->uiblocks);
+ UI_blocklist_free_inactive(C, &region->uiblocks);
if (sa) {
const bScreen *screen = WM_window_get_active_screen(win);
/* Only region emboss for top-bar */
if ((screen->state != SCREENFULL) && ED_area_is_global(sa)) {
- region_draw_emboss(ar, &ar->winrct, (REGION_EMBOSS_LEFT | REGION_EMBOSS_RIGHT));
+ region_draw_emboss(region, &region->winrct, (REGION_EMBOSS_LEFT | REGION_EMBOSS_RIGHT));
}
- else if ((ar->regiontype == RGN_TYPE_WINDOW) && (ar->alignment == RGN_ALIGN_QSPLIT)) {
+ else if ((region->regiontype == RGN_TYPE_WINDOW) && (region->alignment == RGN_ALIGN_QSPLIT)) {
/* draw separating lines between the quad views */
@@ -580,8 +580,11 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(color);
GPU_line_width(1.0f);
- imm_draw_box_wire_2d(
- pos, 0, 0, ar->winrct.xmax - ar->winrct.xmin + 1, ar->winrct.ymax - ar->winrct.ymin + 1);
+ imm_draw_box_wire_2d(pos,
+ 0,
+ 0,
+ region->winrct.xmax - region->winrct.xmin + 1,
+ region->winrct.ymax - region->winrct.ymin + 1);
immUnbindProgram();
}
}
@@ -593,28 +596,29 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
bScreen *screen = WM_window_get_active_screen(win);
Scene *scene = CTX_data_scene(C);
struct wmMsgBus *mbus = wm->message_bus;
- WM_msgbus_clear_by_owner(mbus, ar);
+ WM_msgbus_clear_by_owner(mbus, region);
/* Cheat, always subscribe to this space type properties.
*
* This covers most cases and avoids copy-paste similar code for each space type.
*/
- if (ELEM(ar->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_CHANNELS, RGN_TYPE_UI, RGN_TYPE_TOOLS)) {
+ if (ELEM(
+ region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_CHANNELS, RGN_TYPE_UI, RGN_TYPE_TOOLS)) {
SpaceLink *sl = sa->spacedata.first;
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_Space, sl, &ptr);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
/* All properties for this space type. */
WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_region_tag_redraw, __func__);
}
- ED_region_message_subscribe(C, workspace, scene, screen, sa, ar, mbus);
+ ED_region_message_subscribe(C, workspace, scene, screen, sa, region, mbus);
}
}
@@ -623,38 +627,38 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
* to keep these tags protected
* ********************************** */
-void ED_region_tag_redraw(ARegion *ar)
+void ED_region_tag_redraw(ARegion *region)
{
/* don't tag redraw while drawing, it shouldn't happen normally
* but python scripts can cause this to happen indirectly */
- if (ar && !(ar->do_draw & RGN_DRAWING)) {
+ if (region && !(region->do_draw & RGN_DRAWING)) {
/* zero region means full region redraw */
- ar->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_NO_REBUILD | RGN_DRAW_EDITOR_OVERLAYS);
- ar->do_draw |= RGN_DRAW;
- memset(&ar->drawrct, 0, sizeof(ar->drawrct));
+ region->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_NO_REBUILD | RGN_DRAW_EDITOR_OVERLAYS);
+ region->do_draw |= RGN_DRAW;
+ memset(&region->drawrct, 0, sizeof(region->drawrct));
}
}
-void ED_region_tag_redraw_cursor(ARegion *ar)
+void ED_region_tag_redraw_cursor(ARegion *region)
{
- if (ar) {
- ar->do_draw_overlay = RGN_DRAW;
+ if (region) {
+ region->do_draw_overlay = RGN_DRAW;
}
}
-void ED_region_tag_redraw_no_rebuild(ARegion *ar)
+void ED_region_tag_redraw_no_rebuild(ARegion *region)
{
- if (ar && !(ar->do_draw & (RGN_DRAWING | RGN_DRAW))) {
- ar->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_EDITOR_OVERLAYS);
- ar->do_draw |= RGN_DRAW_NO_REBUILD;
- memset(&ar->drawrct, 0, sizeof(ar->drawrct));
+ if (region && !(region->do_draw & (RGN_DRAWING | RGN_DRAW))) {
+ region->do_draw &= ~(RGN_DRAW_PARTIAL | RGN_DRAW_EDITOR_OVERLAYS);
+ region->do_draw |= RGN_DRAW_NO_REBUILD;
+ memset(&region->drawrct, 0, sizeof(region->drawrct));
}
}
-void ED_region_tag_refresh_ui(ARegion *ar)
+void ED_region_tag_refresh_ui(ARegion *region)
{
- if (ar) {
- ar->do_draw |= RGN_REFRESH_UI;
+ if (region) {
+ region->do_draw |= RGN_REFRESH_UI;
}
}
@@ -662,40 +666,40 @@ void ED_region_tag_refresh_ui(ARegion *ar)
* Tag editor overlays to be redrawn. If in doubt about which parts need to be redrawn (partial
* clipping rectangle set), redraw everything.
*/
-void ED_region_tag_redraw_editor_overlays(struct ARegion *ar)
+void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
{
- if (ar && !(ar->do_draw & (RGN_DRAWING | RGN_DRAW))) {
- if (ar->do_draw & RGN_DRAW_PARTIAL) {
- ED_region_tag_redraw(ar);
+ if (region && !(region->do_draw & (RGN_DRAWING | RGN_DRAW))) {
+ if (region->do_draw & RGN_DRAW_PARTIAL) {
+ ED_region_tag_redraw(region);
}
else {
- ar->do_draw |= RGN_DRAW_EDITOR_OVERLAYS;
+ region->do_draw |= RGN_DRAW_EDITOR_OVERLAYS;
}
}
}
-void ED_region_tag_redraw_partial(ARegion *ar, const rcti *rct, bool rebuild)
+void ED_region_tag_redraw_partial(ARegion *region, const rcti *rct, bool rebuild)
{
- if (ar && !(ar->do_draw & RGN_DRAWING)) {
- if (ar->do_draw & RGN_DRAW_PARTIAL) {
+ if (region && !(region->do_draw & RGN_DRAWING)) {
+ if (region->do_draw & RGN_DRAW_PARTIAL) {
/* Partial redraw already set, expand region. */
- BLI_rcti_union(&ar->drawrct, rct);
+ BLI_rcti_union(&region->drawrct, rct);
if (rebuild) {
- ar->do_draw &= ~RGN_DRAW_NO_REBUILD;
+ region->do_draw &= ~RGN_DRAW_NO_REBUILD;
}
}
- else if (ar->do_draw & (RGN_DRAW | RGN_DRAW_NO_REBUILD)) {
+ else if (region->do_draw & (RGN_DRAW | RGN_DRAW_NO_REBUILD)) {
/* Full redraw already requested. */
if (rebuild) {
- ar->do_draw &= ~RGN_DRAW_NO_REBUILD;
+ region->do_draw &= ~RGN_DRAW_NO_REBUILD;
}
}
else {
/* No redraw set yet, set partial region. */
- ar->drawrct = *rct;
- ar->do_draw |= RGN_DRAW_PARTIAL;
+ region->drawrct = *rct;
+ region->do_draw |= RGN_DRAW_PARTIAL;
if (!rebuild) {
- ar->do_draw |= RGN_DRAW_NO_REBUILD;
+ region->do_draw |= RGN_DRAW_NO_REBUILD;
}
}
}
@@ -703,34 +707,34 @@ void ED_region_tag_redraw_partial(ARegion *ar, const rcti *rct, bool rebuild)
void ED_area_tag_redraw(ScrArea *sa)
{
- ARegion *ar;
+ ARegion *region;
if (sa) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ED_region_tag_redraw(ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ ED_region_tag_redraw(region);
}
}
}
void ED_area_tag_redraw_no_rebuild(ScrArea *sa)
{
- ARegion *ar;
+ ARegion *region;
if (sa) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ED_region_tag_redraw_no_rebuild(ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ ED_region_tag_redraw_no_rebuild(region);
}
}
}
void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
{
- ARegion *ar;
+ ARegion *region;
if (sa) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == regiontype) {
- ED_region_tag_redraw(ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == regiontype) {
+ ED_region_tag_redraw(region);
}
}
}
@@ -748,27 +752,27 @@ void ED_area_tag_refresh(ScrArea *sa)
/* use NULL to disable it */
void ED_area_status_text(ScrArea *sa, const char *str)
{
- ARegion *ar;
+ ARegion *region;
/* happens when running transform operators in background mode */
if (sa == NULL) {
return;
}
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_HEADER) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_HEADER) {
if (str) {
- if (ar->headerstr == NULL) {
- ar->headerstr = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
+ if (region->headerstr == NULL) {
+ region->headerstr = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
}
- BLI_strncpy(ar->headerstr, str, UI_MAX_DRAW_STR);
- BLI_str_rstrip(ar->headerstr);
+ BLI_strncpy(region->headerstr, str, UI_MAX_DRAW_STR);
+ BLI_str_rstrip(region->headerstr);
}
- else if (ar->headerstr) {
- MEM_freeN(ar->headerstr);
- ar->headerstr = NULL;
+ else if (region->headerstr) {
+ MEM_freeN(region->headerstr);
+ region->headerstr = NULL;
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
}
@@ -875,28 +879,28 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea
}
}
-static void fullscreen_azone_initialize(ScrArea *sa, ARegion *ar)
+static void fullscreen_azone_initialize(ScrArea *sa, ARegion *region)
{
AZone *az;
- if (ED_area_is_global(sa) || (ar->regiontype != RGN_TYPE_WINDOW)) {
+ if (ED_area_is_global(sa) || (region->regiontype != RGN_TYPE_WINDOW)) {
return;
}
az = (AZone *)MEM_callocN(sizeof(AZone), "fullscreen action zone");
BLI_addtail(&(sa->actionzones), az);
az->type = AZONE_FULLSCREEN;
- az->ar = ar;
+ az->region = region;
az->alpha = 0.0f;
if (U.uiflag2 & USER_REGION_OVERLAP) {
- const rcti *rect_visible = ED_region_visible_rect(ar);
- az->x2 = ar->winrct.xmin + rect_visible->xmax;
- az->y2 = ar->winrct.ymin + rect_visible->ymax;
+ const rcti *rect_visible = ED_region_visible_rect(region);
+ az->x2 = region->winrct.xmin + rect_visible->xmax;
+ az->y2 = region->winrct.ymin + rect_visible->ymax;
}
else {
- az->x2 = ar->winrct.xmax;
- az->y2 = ar->winrct.ymax;
+ az->x2 = region->winrct.xmax;
+ az->y2 = region->winrct.ymax;
}
az->x1 = az->x2 - AZONEFADEOUT;
az->y1 = az->y2 - AZONEFADEOUT;
@@ -906,39 +910,39 @@ static void fullscreen_azone_initialize(ScrArea *sa, ARegion *ar)
#define AZONEPAD_EDGE (0.1f * U.widget_unit)
#define AZONEPAD_ICON (0.45f * U.widget_unit)
-static void region_azone_edge(AZone *az, ARegion *ar)
+static void region_azone_edge(AZone *az, ARegion *region)
{
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- az->x1 = ar->winrct.xmin;
- az->y1 = ar->winrct.ymax - AZONEPAD_EDGE;
- az->x2 = ar->winrct.xmax;
- az->y2 = ar->winrct.ymax + AZONEPAD_EDGE;
+ az->x1 = region->winrct.xmin;
+ az->y1 = region->winrct.ymax - AZONEPAD_EDGE;
+ az->x2 = region->winrct.xmax;
+ az->y2 = region->winrct.ymax + AZONEPAD_EDGE;
break;
case AE_BOTTOM_TO_TOPLEFT:
- az->x1 = ar->winrct.xmin;
- az->y1 = ar->winrct.ymin + AZONEPAD_EDGE;
- az->x2 = ar->winrct.xmax;
- az->y2 = ar->winrct.ymin - AZONEPAD_EDGE;
+ az->x1 = region->winrct.xmin;
+ az->y1 = region->winrct.ymin + AZONEPAD_EDGE;
+ az->x2 = region->winrct.xmax;
+ az->y2 = region->winrct.ymin - AZONEPAD_EDGE;
break;
case AE_LEFT_TO_TOPRIGHT:
- az->x1 = ar->winrct.xmin - AZONEPAD_EDGE;
- az->y1 = ar->winrct.ymin;
- az->x2 = ar->winrct.xmin + AZONEPAD_EDGE;
- az->y2 = ar->winrct.ymax;
+ az->x1 = region->winrct.xmin - AZONEPAD_EDGE;
+ az->y1 = region->winrct.ymin;
+ az->x2 = region->winrct.xmin + AZONEPAD_EDGE;
+ az->y2 = region->winrct.ymax;
break;
case AE_RIGHT_TO_TOPLEFT:
- az->x1 = ar->winrct.xmax + AZONEPAD_EDGE;
- az->y1 = ar->winrct.ymin;
- az->x2 = ar->winrct.xmax - AZONEPAD_EDGE;
- az->y2 = ar->winrct.ymax;
+ az->x1 = region->winrct.xmax + AZONEPAD_EDGE;
+ az->y1 = region->winrct.ymin;
+ az->x2 = region->winrct.xmax - AZONEPAD_EDGE;
+ az->y2 = region->winrct.ymax;
break;
}
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
/* region already made zero sized, in shape of edge */
-static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
+static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *region)
{
AZone *azt;
int tot = 0, add;
@@ -956,43 +960,43 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
- add = (ar->winrct.ymax == sa->totrct.ymin) ? 1 : 0;
- az->x1 = ar->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x);
- az->y1 = ar->winrct.ymax - add;
- az->x2 = ar->winrct.xmax - (edge_offset * tab_size_x);
- az->y2 = ar->winrct.ymax - add + tab_size_y;
+ add = (region->winrct.ymax == sa->totrct.ymin) ? 1 : 0;
+ az->x1 = region->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x);
+ az->y1 = region->winrct.ymax - add;
+ az->x2 = region->winrct.xmax - (edge_offset * tab_size_x);
+ az->y2 = region->winrct.ymax - add + tab_size_y;
break;
case AE_BOTTOM_TO_TOPLEFT:
- az->x1 = ar->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x);
- az->y1 = ar->winrct.ymin - tab_size_y;
- az->x2 = ar->winrct.xmax - (edge_offset * tab_size_x);
- az->y2 = ar->winrct.ymin;
+ az->x1 = region->winrct.xmax - ((edge_offset + 1.0f) * tab_size_x);
+ az->y1 = region->winrct.ymin - tab_size_y;
+ az->x2 = region->winrct.xmax - (edge_offset * tab_size_x);
+ az->y2 = region->winrct.ymin;
break;
case AE_LEFT_TO_TOPRIGHT:
- az->x1 = ar->winrct.xmin - tab_size_y;
- az->y1 = ar->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x);
- az->x2 = ar->winrct.xmin;
- az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x);
+ az->x1 = region->winrct.xmin - tab_size_y;
+ az->y1 = region->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x);
+ az->x2 = region->winrct.xmin;
+ az->y2 = region->winrct.ymax - (edge_offset * tab_size_x);
break;
case AE_RIGHT_TO_TOPLEFT:
- az->x1 = ar->winrct.xmax;
- az->y1 = ar->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x);
- az->x2 = ar->winrct.xmax + tab_size_y;
- az->y2 = ar->winrct.ymax - (edge_offset * tab_size_x);
+ az->x1 = region->winrct.xmax;
+ az->y1 = region->winrct.ymax - ((edge_offset + 1.0f) * tab_size_x);
+ az->x2 = region->winrct.xmax + tab_size_y;
+ az->y2 = region->winrct.ymax - (edge_offset * tab_size_x);
break;
}
/* rect needed for mouse pointer test */
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
-static bool region_azone_edge_poll(const ARegion *ar, const bool is_fullscreen)
+static bool region_azone_edge_poll(const ARegion *region, const bool is_fullscreen)
{
- const bool is_hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
+ const bool is_hidden = (region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
if (is_hidden && is_fullscreen) {
return false;
}
- if (!is_hidden && ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ if (!is_hidden && ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
return false;
}
@@ -1000,51 +1004,51 @@ static bool region_azone_edge_poll(const ARegion *ar, const bool is_fullscreen)
}
static void region_azone_edge_initialize(ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
AZEdge edge,
const bool is_fullscreen)
{
AZone *az = NULL;
- const bool is_hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
+ const bool is_hidden = (region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
- if (!region_azone_edge_poll(ar, is_fullscreen)) {
+ if (!region_azone_edge_poll(region, is_fullscreen)) {
return;
}
az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
BLI_addtail(&(sa->actionzones), az);
az->type = AZONE_REGION;
- az->ar = ar;
+ az->region = region;
az->edge = edge;
if (is_hidden) {
- region_azone_tab_plus(sa, az, ar);
+ region_azone_tab_plus(sa, az, region);
}
else {
- region_azone_edge(az, ar);
+ region_azone_edge(az, region);
}
}
static void region_azone_scrollbar_initialize(ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
AZScrollDirection direction)
{
- rcti scroller_vert = (direction == AZ_SCROLL_VERT) ? ar->v2d.vert : ar->v2d.hor;
+ rcti scroller_vert = (direction == AZ_SCROLL_VERT) ? region->v2d.vert : region->v2d.hor;
AZone *az = MEM_callocN(sizeof(*az), __func__);
BLI_addtail(&sa->actionzones, az);
az->type = AZONE_REGION_SCROLL;
- az->ar = ar;
+ az->region = region;
az->direction = direction;
if (direction == AZ_SCROLL_VERT) {
- az->ar->v2d.alpha_vert = 0;
+ az->region->v2d.alpha_vert = 0;
}
else if (direction == AZ_SCROLL_HOR) {
- az->ar->v2d.alpha_hor = 0;
+ az->region->v2d.alpha_hor = 0;
}
- BLI_rcti_translate(&scroller_vert, ar->winrct.xmin, ar->winrct.ymin);
+ BLI_rcti_translate(&scroller_vert, region->winrct.xmin, region->winrct.ymin);
az->x1 = scroller_vert.xmin - AZONEFADEIN;
az->y1 = scroller_vert.ymin - AZONEFADEIN;
az->x2 = scroller_vert.xmax + AZONEFADEIN;
@@ -1053,64 +1057,65 @@ static void region_azone_scrollbar_initialize(ScrArea *sa,
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
-static void region_azones_scrollbars_initialize(ScrArea *sa, ARegion *ar)
+static void region_azones_scrollbars_initialize(ScrArea *sa, ARegion *region)
{
- const View2D *v2d = &ar->v2d;
+ const View2D *v2d = &region->v2d;
if ((v2d->scroll & V2D_SCROLL_VERTICAL) && ((v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) == 0)) {
- region_azone_scrollbar_initialize(sa, ar, AZ_SCROLL_VERT);
+ region_azone_scrollbar_initialize(sa, region, AZ_SCROLL_VERT);
}
if ((v2d->scroll & V2D_SCROLL_HORIZONTAL) &&
((v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) == 0)) {
- region_azone_scrollbar_initialize(sa, ar, AZ_SCROLL_HOR);
+ region_azone_scrollbar_initialize(sa, region, AZ_SCROLL_HOR);
}
}
/* *************************************************************** */
static void region_azones_add_edge(ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
const int alignment,
const bool is_fullscreen)
{
/* edge code (t b l r) is along which area edge azone will be drawn */
if (alignment == RGN_ALIGN_TOP) {
- region_azone_edge_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT, is_fullscreen);
+ region_azone_edge_initialize(sa, region, AE_BOTTOM_TO_TOPLEFT, is_fullscreen);
}
else if (alignment == RGN_ALIGN_BOTTOM) {
- region_azone_edge_initialize(sa, ar, AE_TOP_TO_BOTTOMRIGHT, is_fullscreen);
+ region_azone_edge_initialize(sa, region, AE_TOP_TO_BOTTOMRIGHT, is_fullscreen);
}
else if (alignment == RGN_ALIGN_RIGHT) {
- region_azone_edge_initialize(sa, ar, AE_LEFT_TO_TOPRIGHT, is_fullscreen);
+ region_azone_edge_initialize(sa, region, AE_LEFT_TO_TOPRIGHT, is_fullscreen);
}
else if (alignment == RGN_ALIGN_LEFT) {
- region_azone_edge_initialize(sa, ar, AE_RIGHT_TO_TOPLEFT, is_fullscreen);
+ region_azone_edge_initialize(sa, region, AE_RIGHT_TO_TOPLEFT, is_fullscreen);
}
}
-static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *ar)
+static void region_azones_add(const bScreen *screen, ScrArea *sa, ARegion *region)
{
const bool is_fullscreen = screen->state == SCREENFULL;
/* Only display tab or icons when the header region is hidden
* (not the tool header - they overlap). */
- if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
+ if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
return;
}
- region_azones_add_edge(sa, ar, RGN_ALIGN_ENUM_FROM_MASK(ar->alignment), is_fullscreen);
+ region_azones_add_edge(sa, region, RGN_ALIGN_ENUM_FROM_MASK(region->alignment), is_fullscreen);
/* For a split region also continue the azone edge from the next region if this region is aligned
* with the next */
- if ((ar->alignment & RGN_SPLIT_PREV) && ar->prev) {
- region_azones_add_edge(sa, ar, RGN_ALIGN_ENUM_FROM_MASK(ar->prev->alignment), is_fullscreen);
+ if ((region->alignment & RGN_SPLIT_PREV) && region->prev) {
+ region_azones_add_edge(
+ sa, region, RGN_ALIGN_ENUM_FROM_MASK(region->prev->alignment), is_fullscreen);
}
if (is_fullscreen) {
- fullscreen_azone_initialize(sa, ar);
+ fullscreen_azone_initialize(sa, region);
}
- region_azones_scrollbars_initialize(sa, ar);
+ region_azones_scrollbars_initialize(sa, region);
}
/* dir is direction to check, not the splitting edge direction! */
@@ -1126,16 +1131,16 @@ static int rct_fits(const rcti *rect, char dir, int size)
/* *************************************************************** */
-/* ar should be overlapping */
+/* region should be overlapping */
/* function checks if some overlapping region was defined before - on same place */
-static void region_overlap_fix(ScrArea *sa, ARegion *ar)
+static void region_overlap_fix(ScrArea *sa, ARegion *region)
{
ARegion *ar1;
- const int align = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment);
+ const int align = RGN_ALIGN_ENUM_FROM_MASK(region->alignment);
int align1 = 0;
/* find overlapping previous region on same place */
- for (ar1 = ar->prev; ar1; ar1 = ar1->prev) {
+ for (ar1 = region->prev; ar1; ar1 = ar1->prev) {
if (ar1->flag & (RGN_FLAG_HIDDEN)) {
continue;
}
@@ -1145,10 +1150,10 @@ static void region_overlap_fix(ScrArea *sa, ARegion *ar)
continue;
}
align1 = ar1->alignment;
- if (BLI_rcti_isect(&ar1->winrct, &ar->winrct, NULL)) {
+ if (BLI_rcti_isect(&ar1->winrct, &region->winrct, NULL)) {
if (align1 != align) {
/* Left overlapping right or vice-versa, forbid this! */
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ region->flag |= RGN_FLAG_TOO_SMALL;
return;
}
/* Else, we have our previous region on same side. */
@@ -1163,28 +1168,28 @@ static void region_overlap_fix(ScrArea *sa, ARegion *ar)
/* translate or close */
if (ar1) {
if (align1 == RGN_ALIGN_LEFT) {
- if (ar->winrct.xmax + ar1->winx > sa->winx - U.widget_unit) {
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ if (region->winrct.xmax + ar1->winx > sa->winx - U.widget_unit) {
+ region->flag |= RGN_FLAG_TOO_SMALL;
return;
}
else {
- BLI_rcti_translate(&ar->winrct, ar1->winx, 0);
+ BLI_rcti_translate(&region->winrct, ar1->winx, 0);
}
}
else if (align1 == RGN_ALIGN_RIGHT) {
- if (ar->winrct.xmin - ar1->winx < U.widget_unit) {
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ if (region->winrct.xmin - ar1->winx < U.widget_unit) {
+ region->flag |= RGN_FLAG_TOO_SMALL;
return;
}
else {
- BLI_rcti_translate(&ar->winrct, -ar1->winx, 0);
+ BLI_rcti_translate(&region->winrct, -ar1->winx, 0);
}
}
}
- /* At this point, 'ar' is in its final position and still open.
+ /* At this point, 'region' is in its final position and still open.
* Make a final check it does not overlap any previous 'other side' region. */
- for (ar1 = ar->prev; ar1; ar1 = ar1->prev) {
+ for (ar1 = region->prev; ar1; ar1 = ar1->prev) {
if (ar1->flag & (RGN_FLAG_HIDDEN)) {
continue;
}
@@ -1193,9 +1198,9 @@ static void region_overlap_fix(ScrArea *sa, ARegion *ar)
}
if (ar1->overlap && (ar1->alignment & RGN_SPLIT_PREV) == 0) {
- if ((ar1->alignment != align) && BLI_rcti_isect(&ar1->winrct, &ar->winrct, NULL)) {
+ if ((ar1->alignment != align) && BLI_rcti_isect(&ar1->winrct, &region->winrct, NULL)) {
/* Left overlapping right or vice-versa, forbid this! */
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ region->flag |= RGN_FLAG_TOO_SMALL;
return;
}
}
@@ -1230,36 +1235,36 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
}
static void region_rect_recursive(
- ScrArea *sa, ARegion *ar, rcti *remainder, rcti *overlap_remainder, int quad)
+ ScrArea *sa, ARegion *region, rcti *remainder, rcti *overlap_remainder, int quad)
{
rcti *remainder_prev = remainder;
- if (ar == NULL) {
+ if (region == NULL) {
return;
}
- int prev_winx = ar->winx;
- int prev_winy = ar->winy;
+ int prev_winx = region->winx;
+ int prev_winy = region->winy;
/* no returns in function, winrct gets set in the end again */
- BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
+ BLI_rcti_init(&region->winrct, 0, 0, 0, 0);
/* for test; allow split of previously defined region */
- if (ar->alignment & RGN_SPLIT_PREV) {
- if (ar->prev) {
- remainder = &ar->prev->winrct;
+ if (region->alignment & RGN_SPLIT_PREV) {
+ if (region->prev) {
+ remainder = &region->prev->winrct;
}
}
- int alignment = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment);
+ int alignment = RGN_ALIGN_ENUM_FROM_MASK(region->alignment);
/* set here, assuming userpref switching forces to call this again */
- ar->overlap = ED_region_is_overlap(sa->spacetype, ar->regiontype);
+ region->overlap = ED_region_is_overlap(sa->spacetype, region->regiontype);
/* clear state flags first */
- ar->flag &= ~(RGN_FLAG_TOO_SMALL | RGN_FLAG_SIZE_CLAMP_X | RGN_FLAG_SIZE_CLAMP_Y);
+ region->flag &= ~(RGN_FLAG_TOO_SMALL | RGN_FLAG_SIZE_CLAMP_X | RGN_FLAG_SIZE_CLAMP_Y);
/* user errors */
- if ((ar->next == NULL) && !ELEM(alignment, RGN_ALIGN_QSPLIT, RGN_ALIGN_FLOAT)) {
+ if ((region->next == NULL) && !ELEM(alignment, RGN_ALIGN_QSPLIT, RGN_ALIGN_FLOAT)) {
alignment = RGN_ALIGN_NONE;
}
@@ -1268,40 +1273,41 @@ static void region_rect_recursive(
* layout to be created despite the RGN_FLAG_TOO_SMALL flag being set. But there may still be
* regions that don't have a separate ARegionType.layout callback. For those, set a default
* prefsize so they can become visible. */
- if ((ar->flag & RGN_FLAG_DYNAMIC_SIZE) && !(ar->type->layout)) {
- if ((ar->sizex == 0) && (ar->type->prefsizex == 0)) {
- ar->type->prefsizex = AREAMINX;
+ if ((region->flag & RGN_FLAG_DYNAMIC_SIZE) && !(region->type->layout)) {
+ if ((region->sizex == 0) && (region->type->prefsizex == 0)) {
+ region->type->prefsizex = AREAMINX;
}
- if ((ar->sizey == 0) && (ar->type->prefsizey == 0)) {
- ar->type->prefsizey = HEADERY;
+ if ((region->sizey == 0) && (region->type->prefsizey == 0)) {
+ region->type->prefsizey = HEADERY;
}
}
/* prefsize, taking into account DPI */
- int prefsizex = UI_DPI_FAC * ((ar->sizex > 1) ? ar->sizex + 0.5f : ar->type->prefsizex);
+ int prefsizex = UI_DPI_FAC *
+ ((region->sizex > 1) ? region->sizex + 0.5f : region->type->prefsizex);
int prefsizey;
- if (ar->flag & RGN_FLAG_PREFSIZE_OR_HIDDEN) {
- prefsizex = UI_DPI_FAC * ar->type->prefsizex;
- prefsizey = UI_DPI_FAC * ar->type->prefsizey;
+ if (region->flag & RGN_FLAG_PREFSIZE_OR_HIDDEN) {
+ prefsizex = UI_DPI_FAC * region->type->prefsizex;
+ prefsizey = UI_DPI_FAC * region->type->prefsizey;
}
- else if (ar->regiontype == RGN_TYPE_HEADER) {
+ else if (region->regiontype == RGN_TYPE_HEADER) {
prefsizey = ED_area_headersize();
}
- else if (ar->regiontype == RGN_TYPE_TOOL_HEADER) {
+ else if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
prefsizey = ED_area_headersize();
}
- else if (ar->regiontype == RGN_TYPE_FOOTER) {
+ else if (region->regiontype == RGN_TYPE_FOOTER) {
prefsizey = ED_area_footersize();
}
else if (ED_area_is_global(sa)) {
prefsizey = ED_region_global_size_y();
}
else {
- prefsizey = UI_DPI_FAC * (ar->sizey > 1 ? ar->sizey + 0.5f : ar->type->prefsizey);
+ prefsizey = UI_DPI_FAC * (region->sizey > 1 ? region->sizey + 0.5f : region->type->prefsizey);
}
- if (ar->flag & RGN_FLAG_HIDDEN) {
+ if (region->flag & RGN_FLAG_HIDDEN) {
/* hidden is user flag */
}
else if (alignment == RGN_ALIGN_FLOAT) {
@@ -1317,47 +1323,47 @@ static void region_rect_recursive(
BLI_rcti_resize(&overlap_remainder_margin,
max_ii(0, BLI_rcti_size_x(overlap_remainder) - UI_UNIT_X / 2),
max_ii(0, BLI_rcti_size_y(overlap_remainder) - UI_UNIT_Y / 2));
- ar->winrct.xmin = overlap_remainder_margin.xmin + ar->runtime.offset_x;
- ar->winrct.ymin = overlap_remainder_margin.ymin + ar->runtime.offset_y;
- ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
- ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
+ region->winrct.xmin = overlap_remainder_margin.xmin + region->runtime.offset_x;
+ region->winrct.ymin = overlap_remainder_margin.ymin + region->runtime.offset_y;
+ region->winrct.xmax = region->winrct.xmin + prefsizex - 1;
+ region->winrct.ymax = region->winrct.ymin + prefsizey - 1;
- BLI_rcti_isect(&ar->winrct, &overlap_remainder_margin, &ar->winrct);
+ BLI_rcti_isect(&region->winrct, &overlap_remainder_margin, &region->winrct);
- if (BLI_rcti_size_x(&ar->winrct) != prefsizex - 1) {
- ar->flag |= RGN_FLAG_SIZE_CLAMP_X;
+ if (BLI_rcti_size_x(&region->winrct) != prefsizex - 1) {
+ region->flag |= RGN_FLAG_SIZE_CLAMP_X;
}
- if (BLI_rcti_size_y(&ar->winrct) != prefsizey - 1) {
- ar->flag |= RGN_FLAG_SIZE_CLAMP_Y;
+ if (BLI_rcti_size_y(&region->winrct) != prefsizey - 1) {
+ region->flag |= RGN_FLAG_SIZE_CLAMP_Y;
}
/* We need to use a test that wont have been previously clamped. */
rcti winrct_test = {
- .xmin = ar->winrct.xmin,
- .ymin = ar->winrct.ymin,
- .xmax = ar->winrct.xmin + size_min[0],
- .ymax = ar->winrct.ymin + size_min[1],
+ .xmin = region->winrct.xmin,
+ .ymin = region->winrct.ymin,
+ .xmax = region->winrct.xmin + size_min[0],
+ .ymax = region->winrct.ymin + size_min[1],
};
BLI_rcti_isect(&winrct_test, &overlap_remainder_margin, &winrct_test);
if (BLI_rcti_size_x(&winrct_test) < size_min[0] ||
BLI_rcti_size_y(&winrct_test) < size_min[1]) {
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ region->flag |= RGN_FLAG_TOO_SMALL;
}
}
else if (rct_fits(remainder, 'v', 1) < 0 || rct_fits(remainder, 'h', 1) < 0) {
/* remainder is too small for any usage */
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ region->flag |= RGN_FLAG_TOO_SMALL;
}
else if (alignment == RGN_ALIGN_NONE) {
/* typically last region */
- ar->winrct = *remainder;
+ region->winrct = *remainder;
BLI_rcti_init(remainder, 0, 0, 0, 0);
}
else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
- rcti *winrct = (ar->overlap) ? overlap_remainder : remainder;
+ rcti *winrct = (region->overlap) ? overlap_remainder : remainder;
if ((prefsizey == 0) || (rct_fits(winrct, 'v', prefsizey) < 0)) {
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ region->flag |= RGN_FLAG_TOO_SMALL;
}
else {
int fac = rct_fits(winrct, 'v', prefsizey);
@@ -1366,23 +1372,23 @@ static void region_rect_recursive(
prefsizey += fac;
}
- ar->winrct = *winrct;
+ region->winrct = *winrct;
if (alignment == RGN_ALIGN_TOP) {
- ar->winrct.ymin = ar->winrct.ymax - prefsizey + 1;
- winrct->ymax = ar->winrct.ymin - 1;
+ region->winrct.ymin = region->winrct.ymax - prefsizey + 1;
+ winrct->ymax = region->winrct.ymin - 1;
}
else {
- ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
- winrct->ymin = ar->winrct.ymax + 1;
+ region->winrct.ymax = region->winrct.ymin + prefsizey - 1;
+ winrct->ymin = region->winrct.ymax + 1;
}
}
}
else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) {
- rcti *winrct = (ar->overlap) ? overlap_remainder : remainder;
+ rcti *winrct = (region->overlap) ? overlap_remainder : remainder;
if ((prefsizex == 0) || (rct_fits(winrct, 'h', prefsizex) < 0)) {
- ar->flag |= RGN_FLAG_TOO_SMALL;
+ region->flag |= RGN_FLAG_TOO_SMALL;
}
else {
int fac = rct_fits(winrct, 'h', prefsizex);
@@ -1391,26 +1397,26 @@ static void region_rect_recursive(
prefsizex += fac;
}
- ar->winrct = *winrct;
+ region->winrct = *winrct;
if (alignment == RGN_ALIGN_RIGHT) {
- ar->winrct.xmin = ar->winrct.xmax - prefsizex + 1;
- winrct->xmax = ar->winrct.xmin - 1;
+ region->winrct.xmin = region->winrct.xmax - prefsizex + 1;
+ winrct->xmax = region->winrct.xmin - 1;
}
else {
- ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
- winrct->xmin = ar->winrct.xmax + 1;
+ region->winrct.xmax = region->winrct.xmin + prefsizex - 1;
+ winrct->xmin = region->winrct.xmax + 1;
}
}
}
else if (alignment == RGN_ALIGN_VSPLIT || alignment == RGN_ALIGN_HSPLIT) {
/* percentage subdiv*/
- ar->winrct = *remainder;
+ region->winrct = *remainder;
if (alignment == RGN_ALIGN_HSPLIT) {
if (rct_fits(remainder, 'h', prefsizex) > 4) {
- ar->winrct.xmax = BLI_rcti_cent_x(remainder);
- remainder->xmin = ar->winrct.xmax + 1;
+ region->winrct.xmax = BLI_rcti_cent_x(remainder);
+ remainder->xmin = region->winrct.xmax + 1;
}
else {
BLI_rcti_init(remainder, 0, 0, 0, 0);
@@ -1418,8 +1424,8 @@ static void region_rect_recursive(
}
else {
if (rct_fits(remainder, 'v', prefsizey) > 4) {
- ar->winrct.ymax = BLI_rcti_cent_y(remainder);
- remainder->ymin = ar->winrct.ymax + 1;
+ region->winrct.ymax = BLI_rcti_cent_y(remainder);
+ remainder->ymin = region->winrct.ymax + 1;
}
else {
BLI_rcti_init(remainder, 0, 0, 0, 0);
@@ -1427,11 +1433,11 @@ static void region_rect_recursive(
}
}
else if (alignment == RGN_ALIGN_QSPLIT) {
- ar->winrct = *remainder;
+ region->winrct = *remainder;
/* test if there's still 4 regions left */
if (quad == 0) {
- ARegion *artest = ar->next;
+ ARegion *artest = region->next;
int count = 1;
while (artest) {
@@ -1453,102 +1459,102 @@ static void region_rect_recursive(
}
if (quad) {
if (quad == 1) { /* left bottom */
- ar->winrct.xmax = BLI_rcti_cent_x(remainder);
- ar->winrct.ymax = BLI_rcti_cent_y(remainder);
+ region->winrct.xmax = BLI_rcti_cent_x(remainder);
+ region->winrct.ymax = BLI_rcti_cent_y(remainder);
}
else if (quad == 2) { /* left top */
- ar->winrct.xmax = BLI_rcti_cent_x(remainder);
- ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 1;
+ region->winrct.xmax = BLI_rcti_cent_x(remainder);
+ region->winrct.ymin = BLI_rcti_cent_y(remainder) + 1;
}
else if (quad == 3) { /* right bottom */
- ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 1;
- ar->winrct.ymax = BLI_rcti_cent_y(remainder);
+ region->winrct.xmin = BLI_rcti_cent_x(remainder) + 1;
+ region->winrct.ymax = BLI_rcti_cent_y(remainder);
}
else { /* right top */
- ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 1;
- ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 1;
+ region->winrct.xmin = BLI_rcti_cent_x(remainder) + 1;
+ region->winrct.ymin = BLI_rcti_cent_y(remainder) + 1;
BLI_rcti_init(remainder, 0, 0, 0, 0);
}
/* Fix any negative dimensions. This can happen when a quad split 3d view gets to small. (see
* T72200). */
- BLI_rcti_sanitize(&ar->winrct);
+ BLI_rcti_sanitize(&region->winrct);
quad++;
}
}
/* for speedup */
- ar->winx = BLI_rcti_size_x(&ar->winrct) + 1;
- ar->winy = BLI_rcti_size_y(&ar->winrct) + 1;
+ region->winx = BLI_rcti_size_x(&region->winrct) + 1;
+ region->winy = BLI_rcti_size_y(&region->winrct) + 1;
/* if region opened normally, we store this for hide/reveal usage */
/* prevent rounding errors for UI_DPI_FAC mult and divide */
- if (ar->winx > 1) {
- ar->sizex = (ar->winx + 0.5f) / UI_DPI_FAC;
+ if (region->winx > 1) {
+ region->sizex = (region->winx + 0.5f) / UI_DPI_FAC;
}
- if (ar->winy > 1) {
- ar->sizey = (ar->winy + 0.5f) / UI_DPI_FAC;
+ if (region->winy > 1) {
+ region->sizey = (region->winy + 0.5f) / UI_DPI_FAC;
}
/* exception for multiple overlapping regions on same spot */
- if (ar->overlap && (alignment != RGN_ALIGN_FLOAT)) {
- region_overlap_fix(sa, ar);
+ if (region->overlap && (alignment != RGN_ALIGN_FLOAT)) {
+ region_overlap_fix(sa, region);
}
/* set winrect for azones */
- if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
- ar->winrct = (ar->overlap) ? *overlap_remainder : *remainder;
+ if (region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
+ region->winrct = (region->overlap) ? *overlap_remainder : *remainder;
switch (alignment) {
case RGN_ALIGN_TOP:
- ar->winrct.ymin = ar->winrct.ymax;
+ region->winrct.ymin = region->winrct.ymax;
break;
case RGN_ALIGN_BOTTOM:
- ar->winrct.ymax = ar->winrct.ymin;
+ region->winrct.ymax = region->winrct.ymin;
break;
case RGN_ALIGN_RIGHT:
- ar->winrct.xmin = ar->winrct.xmax;
+ region->winrct.xmin = region->winrct.xmax;
break;
case RGN_ALIGN_LEFT:
- ar->winrct.xmax = ar->winrct.xmin;
+ region->winrct.xmax = region->winrct.xmin;
break;
default:
/* prevent winrct to be valid */
- ar->winrct.xmax = ar->winrct.xmin;
+ region->winrct.xmax = region->winrct.xmin;
break;
}
/* Size on one axis is now 0, the other axis may still be invalid (negative) though. */
- BLI_rcti_sanitize(&ar->winrct);
+ BLI_rcti_sanitize(&region->winrct);
}
/* restore prev-split exception */
- if (ar->alignment & RGN_SPLIT_PREV) {
- if (ar->prev) {
+ if (region->alignment & RGN_SPLIT_PREV) {
+ if (region->prev) {
remainder = remainder_prev;
- ar->prev->winx = BLI_rcti_size_x(&ar->prev->winrct) + 1;
- ar->prev->winy = BLI_rcti_size_y(&ar->prev->winrct) + 1;
+ region->prev->winx = BLI_rcti_size_x(&region->prev->winrct) + 1;
+ region->prev->winy = BLI_rcti_size_y(&region->prev->winrct) + 1;
}
}
/* After non-overlapping region, all following overlapping regions
* fit within the remaining space again. */
- if (!ar->overlap) {
+ if (!region->overlap) {
*overlap_remainder = *remainder;
}
- BLI_assert(BLI_rcti_is_valid(&ar->winrct));
+ BLI_assert(BLI_rcti_is_valid(&region->winrct));
- region_rect_recursive(sa, ar->next, remainder, overlap_remainder, quad);
+ region_rect_recursive(sa, region->next, remainder, overlap_remainder, quad);
/* Tag for redraw if size changes. */
- if (ar->winx != prev_winx || ar->winy != prev_winy) {
- ED_region_tag_redraw(ar);
+ if (region->winx != prev_winx || region->winy != prev_winy) {
+ ED_region_tag_redraw(region);
}
/* Clear, initialize on demand. */
- memset(&ar->runtime.visible_rect, 0, sizeof(ar->runtime.visible_rect));
+ memset(&region->runtime.visible_rect, 0, sizeof(region->runtime.visible_rect));
}
static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)
@@ -1590,31 +1596,31 @@ static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)
}
/* used for area initialize below */
-static void region_subwindow(ARegion *ar)
+static void region_subwindow(ARegion *region)
{
- bool hidden = (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) != 0;
+ bool hidden = (region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) != 0;
- if ((ar->alignment & RGN_SPLIT_PREV) && ar->prev) {
- hidden = hidden || (ar->prev->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
+ if ((region->alignment & RGN_SPLIT_PREV) && region->prev) {
+ hidden = hidden || (region->prev->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL));
}
- ar->visible = !hidden;
+ region->visible = !hidden;
}
-static bool event_in_markers_region(const ARegion *ar, const wmEvent *event)
+static bool event_in_markers_region(const ARegion *region, const wmEvent *event)
{
- rcti rect = ar->winrct;
+ rcti rect = region->winrct;
rect.ymax = rect.ymin + UI_MARKER_MARGIN_Y;
return BLI_rcti_isect_pt(&rect, event->x, event->y);
}
/**
- * \param ar: Region, may be NULL when adding handlers for \a sa.
+ * \param region: Region, may be NULL when adding handlers for \a sa.
*/
static void ed_default_handlers(
- wmWindowManager *wm, ScrArea *sa, ARegion *ar, ListBase *handlers, int flag)
+ wmWindowManager *wm, ScrArea *sa, ARegion *region, ListBase *handlers, int flag)
{
- BLI_assert(ar ? (&ar->handlers == handlers) : (&sa->handlers == handlers));
+ BLI_assert(region ? (&region->handlers == handlers) : (&sa->handlers == handlers));
/* note, add-handler checks if it already exists */
@@ -1627,15 +1633,15 @@ static void ed_default_handlers(
UI_region_handlers_add(handlers);
}
if (flag & ED_KEYMAP_GIZMO) {
- BLI_assert(ar && ELEM(ar->type->regionid, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW));
- if (ar) {
+ BLI_assert(region && ELEM(region->type->regionid, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW));
+ if (region) {
/* Anything else is confusing, only allow this. */
- BLI_assert(&ar->handlers == handlers);
- if (ar->gizmo_map == NULL) {
- ar->gizmo_map = WM_gizmomap_new_from_type(
- &(const struct wmGizmoMapType_Params){sa->spacetype, ar->type->regionid});
+ BLI_assert(&region->handlers == handlers);
+ if (region->gizmo_map == NULL) {
+ region->gizmo_map = WM_gizmomap_new_from_type(
+ &(const struct wmGizmoMapType_Params){sa->spacetype, region->type->regionid});
}
- WM_gizmomap_add_handlers(ar, ar->gizmo_map);
+ WM_gizmomap_add_handlers(region, region->gizmo_map);
}
}
if (flag & ED_KEYMAP_VIEW2D) {
@@ -1660,8 +1666,9 @@ static void ed_default_handlers(
}
if (flag & ED_KEYMAP_TOOL) {
WM_event_add_keymap_handler_dynamic(
- &ar->handlers, WM_event_get_keymap_from_toolsystem_fallback, sa);
- WM_event_add_keymap_handler_dynamic(&ar->handlers, WM_event_get_keymap_from_toolsystem, sa);
+ &region->handlers, WM_event_get_keymap_from_toolsystem_fallback, sa);
+ WM_event_add_keymap_handler_dynamic(
+ &region->handlers, WM_event_get_keymap_from_toolsystem, sa);
}
if (flag & ED_KEYMAP_FRAMES) {
/* frame changing/jumping (for all spaces) */
@@ -1681,7 +1688,7 @@ static void ed_default_handlers(
if (flag & ED_KEYMAP_NAVBAR) {
/* standard keymap for Navigation bar regions */
wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "Region Context Menu", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
/* Keep last because of LMB/RMB handling, see: T57527. */
@@ -1743,16 +1750,16 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
/* Dynamically sized regions may have changed region sizes, so we have to force azone update. */
area_azone_initialize(win, screen, area);
- for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
- region_subwindow(ar);
+ for (ARegion *region = area->regionbase.first; region; region = region->next) {
+ region_subwindow(region);
/* region size may have changed, init does necessary adjustments */
- if (ar->type->init) {
- ar->type->init(wm, ar);
+ if (region->type->init) {
+ region->type->init(wm, region);
}
/* Some AZones use View2D data which is only updated in region init, so call that first! */
- region_azones_add(screen, area, ar);
+ region_azones_add(screen, area, region);
}
ED_area_azones_update(area, &win->eventstate->x);
@@ -1765,7 +1772,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
WorkSpace *workspace = WM_window_get_active_workspace(win);
const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- ARegion *ar;
+ ARegion *region;
rcti rect, overlap_rect;
rcti window_rect;
@@ -1782,8 +1789,8 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
sa->type = BKE_spacetype_from_id(sa->spacetype);
}
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ar->type = BKE_regiontype_from_id_or_first(sa->type, ar->regiontype);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ region->type = BKE_regiontype_from_id_or_first(sa->type, region->regiontype);
}
/* area sizes */
@@ -1806,24 +1813,24 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
area_azone_initialize(win, screen, sa);
/* region windows, default and own handlers */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- region_subwindow(ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ region_subwindow(region);
- if (ar->visible) {
+ if (region->visible) {
/* default region handlers */
- ed_default_handlers(wm, sa, ar, &ar->handlers, ar->type->keymapflag);
+ ed_default_handlers(wm, sa, region, &region->handlers, region->type->keymapflag);
/* own handlers */
- if (ar->type->init) {
- ar->type->init(wm, ar);
+ if (region->type->init) {
+ region->type->init(wm, region);
}
}
else {
/* prevent uiblocks to run */
- UI_blocklist_free(NULL, &ar->uiblocks);
+ UI_blocklist_free(NULL, &region->uiblocks);
}
/* Some AZones use View2D data which is only updated in region init, so call that first! */
- region_azones_add(screen, sa, ar);
+ region_azones_add(screen, sa, region);
}
/* Avoid re-initializing tools while resizing the window. */
@@ -1839,47 +1846,47 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
}
}
-static void region_update_rect(ARegion *ar)
+static void region_update_rect(ARegion *region)
{
- ar->winx = BLI_rcti_size_x(&ar->winrct) + 1;
- ar->winy = BLI_rcti_size_y(&ar->winrct) + 1;
+ region->winx = BLI_rcti_size_x(&region->winrct) + 1;
+ region->winy = BLI_rcti_size_y(&region->winrct) + 1;
/* v2d mask is used to subtract scrollbars from a 2d view. Needs initialize here. */
- BLI_rcti_init(&ar->v2d.mask, 0, ar->winx - 1, 0, ar->winy - 1);
+ BLI_rcti_init(&region->v2d.mask, 0, region->winx - 1, 0, region->winy - 1);
}
/**
* Call to move a popup window (keep OpenGL context free!)
*/
-void ED_region_update_rect(ARegion *ar)
+void ED_region_update_rect(ARegion *region)
{
- region_update_rect(ar);
+ region_update_rect(region);
}
/* externally called for floating regions like menus */
-void ED_region_floating_initialize(ARegion *ar)
+void ED_region_floating_initialize(ARegion *region)
{
- BLI_assert(ar->alignment == RGN_ALIGN_FLOAT);
+ BLI_assert(region->alignment == RGN_ALIGN_FLOAT);
/* refresh can be called before window opened */
- region_subwindow(ar);
+ region_subwindow(region);
- region_update_rect(ar);
+ region_update_rect(region);
}
-void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar)
+void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *region)
{
- if (ar != NULL) {
- if ((ar->gizmo_map != NULL) && WM_gizmomap_cursor_set(ar->gizmo_map, win)) {
+ if (region != NULL) {
+ if ((region->gizmo_map != NULL) && WM_gizmomap_cursor_set(region->gizmo_map, win)) {
return;
}
- if (sa && ar->type && ar->type->cursor) {
- ar->type->cursor(win, sa, ar);
+ if (sa && region->type && region->type->cursor) {
+ region->type->cursor(win, sa, region);
return;
}
}
- if (WM_cursor_set_from_tool(win, sa, ar)) {
+ if (WM_cursor_set_from_tool(win, sa, region)) {
return;
}
@@ -1887,10 +1894,10 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar)
}
/* for use after changing visibility of regions */
-void ED_region_visibility_change_update(bContext *C, ScrArea *sa, ARegion *ar)
+void ED_region_visibility_change_update(bContext *C, ScrArea *sa, ARegion *region)
{
- if (ar->flag & RGN_FLAG_HIDDEN) {
- WM_event_remove_handlers(C, &ar->handlers);
+ if (region->flag & RGN_FLAG_HIDDEN) {
+ WM_event_remove_handlers(C, &region->handlers);
}
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
@@ -1898,25 +1905,25 @@ void ED_region_visibility_change_update(bContext *C, ScrArea *sa, ARegion *ar)
}
/* for quick toggle, can skip fades */
-void region_toggle_hidden(bContext *C, ARegion *ar, const bool do_fade)
+void region_toggle_hidden(bContext *C, ARegion *region, const bool do_fade)
{
ScrArea *sa = CTX_wm_area(C);
- ar->flag ^= RGN_FLAG_HIDDEN;
+ region->flag ^= RGN_FLAG_HIDDEN;
- if (do_fade && ar->overlap) {
+ if (do_fade && region->overlap) {
/* starts a timer, and in end calls the stuff below itself (region_sblend_invoke()) */
- ED_region_visibility_change_update_animated(C, sa, ar);
+ ED_region_visibility_change_update_animated(C, sa, region);
}
else {
- ED_region_visibility_change_update(C, sa, ar);
+ ED_region_visibility_change_update(C, sa, region);
}
}
/* exported to all editors, uses fading default */
-void ED_region_toggle_hidden(bContext *C, ARegion *ar)
+void ED_region_toggle_hidden(bContext *C, ARegion *region)
{
- region_toggle_hidden(C, ar, true);
+ region_toggle_hidden(C, region, true);
}
/**
@@ -1925,7 +1932,7 @@ void ED_region_toggle_hidden(bContext *C, ARegion *ar)
void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free)
{
SpaceType *st;
- ARegion *ar;
+ ARegion *region;
const char spacetype = sa_dst->spacetype;
const short flag_copy = HEADER_NO_PULLDOWN;
@@ -1945,14 +1952,14 @@ void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free)
/* regions */
if (do_free) {
st = BKE_spacetype_from_id(spacetype);
- for (ar = sa_dst->regionbase.first; ar; ar = ar->next) {
- BKE_area_region_free(st, ar);
+ for (region = sa_dst->regionbase.first; region; region = region->next) {
+ BKE_area_region_free(st, region);
}
BLI_freelistN(&sa_dst->regionbase);
}
st = BKE_spacetype_from_id(sa_src->spacetype);
- for (ar = sa_src->regionbase.first; ar; ar = ar->next) {
- ARegion *newar = BKE_area_region_copy(st, ar);
+ for (region = sa_src->regionbase.first; region; region = region->next) {
+ ARegion *newar = BKE_area_region_copy(st, region);
BLI_addtail(&sa_dst->regionbase, newar);
}
}
@@ -2095,22 +2102,22 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
if (sync_header_alignment) {
/* Spaces with footer. */
if (st->spaceid == SPACE_TEXT) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
- ar->alignment = header_alignment;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ region->alignment = header_alignment;
}
- if (ar->regiontype == RGN_TYPE_FOOTER) {
+ if (region->regiontype == RGN_TYPE_FOOTER) {
int footer_alignment = (header_alignment == RGN_ALIGN_BOTTOM) ? RGN_ALIGN_TOP :
RGN_ALIGN_BOTTOM;
- ar->alignment = footer_alignment;
+ region->alignment = footer_alignment;
break;
}
}
}
else {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
- ar->alignment = header_alignment;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ region->alignment = header_alignment;
break;
}
}
@@ -2230,12 +2237,12 @@ static ThemeColorID region_background_color_id(const bContext *C, const ARegion
}
}
-static void region_clear_color(const bContext *C, const ARegion *ar, ThemeColorID colorid)
+static void region_clear_color(const bContext *C, const ARegion *region, ThemeColorID colorid)
{
- if (ar->alignment == RGN_ALIGN_FLOAT) {
+ if (region->alignment == RGN_ALIGN_FLOAT) {
/* handle our own drawing. */
}
- else if (ar->overlap) {
+ else if (region->overlap) {
/* view should be in pixelspace */
UI_view2d_view_restore(C);
@@ -2262,7 +2269,7 @@ BLI_INLINE bool streq_array_any(const char *s, const char *arr[])
static void ed_panel_draw(const bContext *C,
ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
ListBase *lb,
PanelType *pt,
Panel *panel,
@@ -2273,10 +2280,10 @@ static void ed_panel_draw(const bContext *C,
uiStyle *style = UI_style_get_dpi();
/* draw panel */
- uiBlock *block = UI_block_begin(C, ar, pt->idname, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, pt->idname, UI_EMBOSS);
bool open;
- panel = UI_panel_begin(sa, ar, lb, block, pt, panel, &open);
+ panel = UI_panel_begin(sa, region, lb, block, pt, panel, &open);
/* bad fixed values */
int xco, yco, h = 0;
@@ -2327,7 +2334,7 @@ static void ed_panel_draw(const bContext *C,
if (pt->flag & PNL_LAYOUT_VERT_BAR) {
panelContext = UI_LAYOUT_VERT_BAR;
}
- else if (ar->regiontype == RGN_TYPE_TOOLS) {
+ else if (region->regiontype == RGN_TYPE_TOOLS) {
panelContext = UI_LAYOUT_TOOLBAR;
}
else {
@@ -2364,12 +2371,12 @@ static void ed_panel_draw(const bContext *C,
Panel *child_panel = UI_panel_find_by_type(&panel->children, child_pt);
if (child_pt->draw && (!child_pt->poll || child_pt->poll(C, child_pt))) {
- ed_panel_draw(C, sa, ar, &panel->children, child_pt, child_panel, w, em, vertical);
+ ed_panel_draw(C, sa, region, &panel->children, child_pt, child_panel, w, em, vertical);
}
}
}
- UI_panel_end(sa, ar, block, w, h, open);
+ UI_panel_end(sa, region, block, w, h, open);
}
/**
@@ -2378,7 +2385,7 @@ static void ed_panel_draw(const bContext *C,
* Can be NULL to skip context checks.
*/
void ED_region_panels_layout_ex(const bContext *C,
- ARegion *ar,
+ ARegion *region,
ListBase *paneltypes,
const char *contexts[],
int contextnr,
@@ -2416,22 +2423,23 @@ void ED_region_panels_layout_ex(const bContext *C,
}
}
- ar->runtime.category = NULL;
+ region->runtime.category = NULL;
ScrArea *sa = CTX_wm_area(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
int x, y, w, em;
/* XXX, should use some better check? */
/* For now also has hardcoded check for clip editor until it supports actual toolbar. */
bool use_category_tabs = (category_override == NULL) &&
- ((((1 << ar->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) ||
- (ar->regiontype == RGN_TYPE_TOOLS && sa->spacetype == SPACE_CLIP)));
+ ((((1 << region->regiontype) & RGN_TYPE_HAS_CATEGORY_MASK) ||
+ (region->regiontype == RGN_TYPE_TOOLS &&
+ sa->spacetype == SPACE_CLIP)));
/* offset panels for small vertical tab area */
const char *category = NULL;
const int category_tabs_width = UI_PANEL_CATEGORY_MARGIN_WIDTH;
int margin_x = 0;
- const bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE;
+ const bool region_layout_based = region->flag & RGN_FLAG_DYNAMIC_SIZE;
const bool is_context_new = (contextnr != -1) ? UI_view2d_tab_set(v2d, contextnr) : false;
/* before setting the view */
@@ -2454,47 +2462,47 @@ void ED_region_panels_layout_ex(const bContext *C,
/* collect categories */
if (use_category_tabs) {
- UI_panel_category_clear_all(ar);
+ UI_panel_category_clear_all(region);
/* gather unique categories */
for (LinkNode *pt_link = panel_types_stack; pt_link; pt_link = pt_link->next) {
PanelType *pt = pt_link->link;
if (pt->category[0]) {
- if (!UI_panel_category_find(ar, pt->category)) {
- UI_panel_category_add(ar, pt->category);
+ if (!UI_panel_category_find(region, pt->category)) {
+ UI_panel_category_add(region, pt->category);
}
}
}
- if (!UI_panel_category_is_visible(ar)) {
+ if (!UI_panel_category_is_visible(region)) {
use_category_tabs = false;
}
else {
- category = UI_panel_category_active_get(ar, true);
+ category = UI_panel_category_active_get(region, true);
margin_x = category_tabs_width;
}
}
if (vertical) {
w = BLI_rctf_size_x(&v2d->cur);
- em = (ar->type->prefsizex) ? 10 : 20; /* works out to 10*UI_UNIT_X or 20*UI_UNIT_X */
+ em = (region->type->prefsizex) ? 10 : 20; /* works out to 10*UI_UNIT_X or 20*UI_UNIT_X */
}
else {
w = UI_PANEL_WIDTH;
- em = (ar->type->prefsizex) ? 10 : 20;
+ em = (region->type->prefsizex) ? 10 : 20;
}
w -= margin_x;
/* create panels */
- UI_panels_begin(C, ar);
+ UI_panels_begin(C, region);
/* set view2d view matrix - UI_block_begin() stores it */
UI_view2d_view_ortho(v2d);
for (LinkNode *pt_link = panel_types_stack; pt_link; pt_link = pt_link->next) {
PanelType *pt = pt_link->link;
- Panel *panel = UI_panel_find_by_type(&ar->panels, pt);
+ Panel *panel = UI_panel_find_by_type(&region->panels, pt);
if (use_category_tabs && pt->category[0] && !STREQ(category, pt->category)) {
if ((panel == NULL) || ((panel->flag & PNL_PIN) == 0)) {
@@ -2502,30 +2510,30 @@ void ED_region_panels_layout_ex(const bContext *C,
}
}
- ed_panel_draw(C, sa, ar, &ar->panels, pt, panel, w, em, vertical);
+ ed_panel_draw(C, sa, region, &region->panels, pt, panel, w, em, vertical);
}
/* align panels and return size */
- UI_panels_end(C, ar, &x, &y);
+ UI_panels_end(C, region, &x, &y);
/* before setting the view */
if (region_layout_based) {
/* XXX, only single panel support atm.
* Can't use x/y values calculated above because they're not using the real height of panels,
* instead they calculate offsets for the next panel to start drawing. */
- Panel *panel = ar->panels.last;
+ Panel *panel = region->panels.last;
if (panel != NULL) {
const int size_dyn[2] = {
UI_UNIT_X * ((panel->flag & PNL_CLOSED) ? 8 : 14) / UI_DPI_FAC,
UI_panel_size_y(panel) / UI_DPI_FAC,
};
/* region size is layout based and needs to be updated */
- if ((ar->sizex != size_dyn[0]) || (ar->sizey != size_dyn[1])) {
- ar->sizex = size_dyn[0];
- ar->sizey = size_dyn[1];
+ if ((region->sizex != size_dyn[0]) || (region->sizey != size_dyn[1])) {
+ region->sizex = size_dyn[0];
+ region->sizey = size_dyn[1];
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
- y = ABS(ar->sizey * UI_DPI_FAC - 1);
+ y = ABS(region->sizey * UI_DPI_FAC - 1);
}
}
else if (vertical) {
@@ -2565,29 +2573,29 @@ void ED_region_panels_layout_ex(const bContext *C,
* flip +1 or -1 pixel compared to redoing the entire layout again.
* Leaving in commented code for future tests */
#if 0
- UI_panels_scale(ar, BLI_rctf_size_x(&v2d->cur));
+ UI_panels_scale(region, BLI_rctf_size_x(&v2d->cur));
break;
#endif
}
if (use_category_tabs) {
- ar->runtime.category = category;
+ region->runtime.category = category;
}
}
-void ED_region_panels_layout(const bContext *C, ARegion *ar)
+void ED_region_panels_layout(const bContext *C, ARegion *region)
{
bool vertical = true;
- ED_region_panels_layout_ex(C, ar, &ar->type->paneltypes, NULL, -1, vertical, NULL);
+ ED_region_panels_layout_ex(C, region, &region->type->paneltypes, NULL, -1, vertical, NULL);
}
-void ED_region_panels_draw(const bContext *C, ARegion *ar)
+void ED_region_panels_draw(const bContext *C, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
- if (ar->alignment != RGN_ALIGN_FLOAT) {
+ if (region->alignment != RGN_ALIGN_FLOAT) {
region_clear_color(
- C, ar, (ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK);
+ C, region, (region->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK);
}
/* reset line width for drawing tabs */
@@ -2597,23 +2605,24 @@ void ED_region_panels_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* View2D matrix might have changed due to dynamic sized regions. */
- UI_blocklist_update_window_matrix(C, &ar->uiblocks);
+ UI_blocklist_update_window_matrix(C, &region->uiblocks);
/* draw panels */
- UI_panels_draw(C, ar);
+ UI_panels_draw(C, region);
/* restore view matrix */
UI_view2d_view_restore(C);
/* Set in layout. */
- if (ar->runtime.category) {
- UI_panel_category_draw_all(ar, ar->runtime.category);
+ if (region->runtime.category) {
+ UI_panel_category_draw_all(region, region->runtime.category);
}
/* scrollers */
const rcti *mask = NULL;
rcti mask_buf;
- if (ar->runtime.category && (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_RIGHT)) {
+ if (region->runtime.category &&
+ (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT)) {
UI_view2d_mask_from_win(v2d, &mask_buf);
mask_buf.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH;
mask = &mask_buf;
@@ -2624,46 +2633,47 @@ void ED_region_panels_draw(const bContext *C, ARegion *ar)
}
void ED_region_panels_ex(
- const bContext *C, ARegion *ar, const char *contexts[], int contextnr, const bool vertical)
+ const bContext *C, ARegion *region, const char *contexts[], int contextnr, const bool vertical)
{
/* TODO: remove? */
- ED_region_panels_layout_ex(C, ar, &ar->type->paneltypes, contexts, contextnr, vertical, NULL);
- ED_region_panels_draw(C, ar);
+ ED_region_panels_layout_ex(
+ C, region, &region->type->paneltypes, contexts, contextnr, vertical, NULL);
+ ED_region_panels_draw(C, region);
}
-void ED_region_panels(const bContext *C, ARegion *ar)
+void ED_region_panels(const bContext *C, ARegion *region)
{
/* TODO: remove? */
- ED_region_panels_layout(C, ar);
- ED_region_panels_draw(C, ar);
+ ED_region_panels_layout(C, region);
+ ED_region_panels_draw(C, region);
}
-void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
+void ED_region_panels_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_PANELS_UI, region->winx, region->winy);
keymap = WM_keymap_ensure(wm->defaultconf, "View2D Buttons List", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-void ED_region_header_layout(const bContext *C, ARegion *ar)
+void ED_region_header_layout(const bContext *C, ARegion *region)
{
uiStyle *style = UI_style_get_dpi();
uiBlock *block;
uiLayout *layout;
HeaderType *ht;
Header header = {NULL};
- bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE;
+ bool region_layout_based = region->flag & RGN_FLAG_DYNAMIC_SIZE;
/* Height of buttons and scaling needed to achieve it. */
- const int buttony = min_ii(UI_UNIT_Y, ar->winy - 2 * UI_DPI_FAC);
+ const int buttony = min_ii(UI_UNIT_Y, region->winy - 2 * UI_DPI_FAC);
const float buttony_scale = buttony / (float)UI_UNIT_Y;
/* Vertically center buttons. */
int xco = UI_HEADER_OFFSET;
- int yco = buttony + (ar->winy - buttony) / 2;
+ int yco = buttony + (region->winy - buttony) / 2;
int maxco = xco;
/* XXX workaround for 1 px alignment issue. Not sure what causes it...
@@ -2673,15 +2683,15 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
}
/* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(&ar->v2d);
+ UI_view2d_view_ortho(&region->v2d);
/* draw all headers types */
- for (ht = ar->type->headertypes.first; ht; ht = ht->next) {
+ for (ht = region->type->headertypes.first; ht; ht = ht->next) {
if (ht->poll && !ht->poll(C, ht)) {
continue;
}
- block = UI_block_begin(C, ar, ht->idname, UI_EMBOSS);
+ block = UI_block_begin(C, region, ht->idname, UI_EMBOSS);
layout = UI_block_layout(
block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, buttony, 1, 0, style);
@@ -2713,11 +2723,11 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
int new_sizex = (maxco + UI_HEADER_OFFSET) / UI_DPI_FAC;
- if (region_layout_based && (ar->sizex != new_sizex)) {
+ if (region_layout_based && (region->sizex != new_sizex)) {
/* region size is layout based and needs to be updated */
ScrArea *sa = CTX_wm_area(C);
- ar->sizex = new_sizex;
+ region->sizex = new_sizex;
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
@@ -2729,39 +2739,39 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
}
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, maxco, ar->winy);
+ UI_view2d_totRect_set(&region->v2d, maxco, region->winy);
/* restore view matrix */
UI_view2d_view_restore(C);
}
-void ED_region_header_draw(const bContext *C, ARegion *ar)
+void ED_region_header_draw(const bContext *C, ARegion *region)
{
/* clear */
- region_clear_color(C, ar, region_background_color_id(C, ar));
+ region_clear_color(C, region, region_background_color_id(C, region));
- UI_view2d_view_ortho(&ar->v2d);
+ UI_view2d_view_ortho(&region->v2d);
/* View2D matrix might have changed due to dynamic sized regions. */
- UI_blocklist_update_window_matrix(C, &ar->uiblocks);
+ UI_blocklist_update_window_matrix(C, &region->uiblocks);
/* draw blocks */
- UI_blocklist_draw(C, &ar->uiblocks);
+ UI_blocklist_draw(C, &region->uiblocks);
/* restore view matrix */
UI_view2d_view_restore(C);
}
-void ED_region_header(const bContext *C, ARegion *ar)
+void ED_region_header(const bContext *C, ARegion *region)
{
/* TODO: remove? */
- ED_region_header_layout(C, ar);
- ED_region_header_draw(C, ar);
+ ED_region_header_layout(C, region);
+ ED_region_header_draw(C, region);
}
-void ED_region_header_init(ARegion *ar)
+void ED_region_header_init(ARegion *region)
{
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_HEADER, region->winx, region->winy);
}
int ED_area_headersize(void)
@@ -2772,9 +2782,9 @@ int ED_area_headersize(void)
int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback)
{
- for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_HEADER) {
- return ar->alignment;
+ for (ARegion *region = area->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_HEADER) {
+ return region->alignment;
}
}
return fallback;
@@ -2793,9 +2803,9 @@ int ED_area_footersize(void)
int ED_area_footer_alignment_or_fallback(const ScrArea *area, int fallback)
{
- for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_FOOTER) {
- return ar->alignment;
+ for (ARegion *region = area->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_FOOTER) {
+ return region->alignment;
}
}
return fallback;
@@ -2870,7 +2880,7 @@ int ED_region_global_size_y(void)
return ED_area_headersize(); /* same size as header */
}
-void ED_region_info_draw_multiline(ARegion *ar,
+void ED_region_info_draw_multiline(ARegion *region,
const char *text_array[],
float fill_color[4],
const bool full_redraw)
@@ -2882,7 +2892,7 @@ void ED_region_info_draw_multiline(ARegion *ar,
int num_lines = 0;
/* background box */
- rcti rect = *ED_region_visible_rect(ar);
+ rcti rect = *ED_region_visible_rect(region);
/* Box fill entire width or just around text. */
if (!full_redraw) {
@@ -2945,13 +2955,13 @@ void ED_region_info_draw_multiline(ARegion *ar,
GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
-void ED_region_info_draw(ARegion *ar,
+void ED_region_info_draw(ARegion *region,
const char *text,
float fill_color[4],
const bool full_redraw)
{
const char *text_array[2] = {text, NULL};
- ED_region_info_draw_multiline(ar, text_array, fill_color, full_redraw);
+ ED_region_info_draw_multiline(region, text_array, fill_color, full_redraw);
}
#define MAX_METADATA_STR 1024
@@ -3268,15 +3278,15 @@ void ED_region_image_metadata_panel_draw(ImBuf *ibuf, uiLayout *layout)
IMB_metadata_foreach(ibuf, metadata_panel_draw_field, &ctx);
}
-void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy, float x0, float y0)
+void ED_region_grid_draw(ARegion *region, float zoomx, float zoomy, float x0, float y0)
{
float gridsize, gridstep = 1.0f / 32.0f;
float fac, blendfac;
int x1, y1, x2, y2;
/* the image is located inside (x0, y0), (x0+1, y0+1) as set by view2d */
- UI_view2d_view_to_region(&ar->v2d, x0, y0, &x1, &y1);
- UI_view2d_view_to_region(&ar->v2d, x0 + 1.0f, y0 + 1.0f, &x2, &y2);
+ UI_view2d_view_to_region(&region->v2d, x0, y0, &x1, &y1);
+ UI_view2d_view_to_region(&region->v2d, x0 + 1.0f, y0 + 1.0f, &x2, &y2);
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -3359,22 +3369,22 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy, float x0, float
}
}
-/* If the area has overlapping regions, it returns visible rect for Region *ar */
+/* If the area has overlapping regions, it returns visible rect for Region *region */
/* rect gets returned in local region coordinates */
-static void region_visible_rect_calc(ARegion *ar, rcti *rect)
+static void region_visible_rect_calc(ARegion *region, rcti *rect)
{
- ARegion *arn = ar;
+ ARegion *arn = region;
/* allow function to be called without area */
while (arn->prev) {
arn = arn->prev;
}
- *rect = ar->winrct;
+ *rect = region->winrct;
/* check if a region overlaps with the current one */
for (; arn; arn = arn->next) {
- if (ar != arn && arn->overlap) {
+ if (region != arn && arn->overlap) {
if (BLI_rcti_isect(rect, &arn->winrct, NULL)) {
int alignment = RGN_ALIGN_ENUM_FROM_MASK(arn->alignment);
@@ -3407,31 +3417,31 @@ static void region_visible_rect_calc(ARegion *ar, rcti *rect)
}
}
}
- BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
+ BLI_rcti_translate(rect, -region->winrct.xmin, -region->winrct.ymin);
}
-const rcti *ED_region_visible_rect(ARegion *ar)
+const rcti *ED_region_visible_rect(ARegion *region)
{
- rcti *rect = &ar->runtime.visible_rect;
+ rcti *rect = &region->runtime.visible_rect;
if (rect->xmin == 0 && rect->ymin == 0 && rect->xmax == 0 && rect->ymax == 0) {
- region_visible_rect_calc(ar, rect);
+ region_visible_rect_calc(region, rect);
}
return rect;
}
/* Cache display helpers */
-void ED_region_cache_draw_background(ARegion *ar)
+void ED_region_cache_draw_background(ARegion *region)
{
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
const int region_bottom = rect_visible->ymin;
uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(128, 128, 255, 64);
- immRecti(pos, 0, region_bottom, ar->winx, region_bottom + 8 * UI_DPI_FAC);
+ immRecti(pos, 0, region_bottom, region->winx, region_bottom + 8 * UI_DPI_FAC);
immUnbindProgram();
}
@@ -3461,11 +3471,11 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f
}
void ED_region_cache_draw_cached_segments(
- ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra)
+ ARegion *region, const int num_segments, const int *points, const int sfra, const int efra)
{
if (num_segments) {
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
const int region_bottom = rect_visible->ymin;
uint pos = GPU_vertformat_attr_add(
@@ -3474,8 +3484,8 @@ void ED_region_cache_draw_cached_segments(
immUniformColor4ub(128, 128, 255, 128);
for (int a = 0; a < num_segments; a++) {
- float x1 = (float)(points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx;
- float x2 = (float)(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx;
+ float x1 = (float)(points[a * 2] - sfra) / (efra - sfra + 1) * region->winx;
+ float x2 = (float)(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * region->winx;
immRecti(pos, x1, region_bottom, x2, region_bottom + 8 * UI_DPI_FAC);
/* TODO(merwin): use primitive restart to draw multiple rects more efficiently */
@@ -3493,48 +3503,52 @@ void ED_region_message_subscribe(bContext *C,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
- if (ar->gizmo_map != NULL) {
- WM_gizmomap_message_subscribe(C, ar->gizmo_map, ar, mbus);
+ if (region->gizmo_map != NULL) {
+ WM_gizmomap_message_subscribe(C, region->gizmo_map, region, mbus);
}
- if (!BLI_listbase_is_empty(&ar->uiblocks)) {
- UI_region_message_subscribe(ar, mbus);
+ if (!BLI_listbase_is_empty(&region->uiblocks)) {
+ UI_region_message_subscribe(region, mbus);
}
- if (ar->type->message_subscribe != NULL) {
- ar->type->message_subscribe(C, workspace, scene, screen, sa, ar, mbus);
+ if (region->type->message_subscribe != NULL) {
+ region->type->message_subscribe(C, workspace, scene, screen, sa, region, mbus);
}
}
-int ED_region_snap_size_test(const ARegion *ar)
+int ED_region_snap_size_test(const ARegion *region)
{
/* Use a larger value because toggling scrollbars can jump in size. */
const int snap_match_threshold = 16;
- if (ar->type->snap_size != NULL) {
- return ((((ar->sizex - ar->type->snap_size(ar, ar->sizex, 0)) <= snap_match_threshold) << 0) |
- (((ar->sizey - ar->type->snap_size(ar, ar->sizey, 1)) <= snap_match_threshold) << 1));
+ if (region->type->snap_size != NULL) {
+ return ((((region->sizex - region->type->snap_size(region, region->sizex, 0)) <=
+ snap_match_threshold)
+ << 0) |
+ (((region->sizey - region->type->snap_size(region, region->sizey, 1)) <=
+ snap_match_threshold)
+ << 1));
}
return 0;
}
-bool ED_region_snap_size_apply(ARegion *ar, int snap_flag)
+bool ED_region_snap_size_apply(ARegion *region, int snap_flag)
{
bool changed = false;
- if (ar->type->snap_size != NULL) {
+ if (region->type->snap_size != NULL) {
if (snap_flag & (1 << 0)) {
- short snap_size = ar->type->snap_size(ar, ar->sizex, 0);
- if (snap_size != ar->sizex) {
- ar->sizex = snap_size;
+ short snap_size = region->type->snap_size(region, region->sizex, 0);
+ if (snap_size != region->sizex) {
+ region->sizex = snap_size;
changed = true;
}
}
if (snap_flag & (1 << 1)) {
- short snap_size = ar->type->snap_size(ar, ar->sizey, 1);
- if (snap_size != ar->sizey) {
- ar->sizey = snap_size;
+ short snap_size = region->type->snap_size(region, region->sizey, 1);
+ if (snap_size != region->sizey) {
+ region->sizey = snap_size;
changed = true;
}
}
diff --git a/source/blender/editors/screen/area_query.c b/source/blender/editors/screen/area_query.c
index 942050aaffd..f8a6b301911 100644
--- a/source/blender/editors/screen/area_query.c
+++ b/source/blender/editors/screen/area_query.c
@@ -33,41 +33,41 @@
#include "UI_interface.h"
#include "UI_view2d.h"
-bool ED_region_overlap_isect_x(const ARegion *ar, const int event_x)
+bool ED_region_overlap_isect_x(const ARegion *region, const int event_x)
{
- BLI_assert(ar->overlap);
+ BLI_assert(region->overlap);
/* No contents, skip it. */
- if (ar->v2d.mask.xmin == ar->v2d.mask.xmax) {
+ if (region->v2d.mask.xmin == region->v2d.mask.xmax) {
return false;
}
- return BLI_rctf_isect_x(&ar->v2d.tot,
- UI_view2d_region_to_view_x(&ar->v2d, event_x - ar->winrct.xmin));
+ return BLI_rctf_isect_x(&region->v2d.tot,
+ UI_view2d_region_to_view_x(&region->v2d, event_x - region->winrct.xmin));
}
-bool ED_region_overlap_isect_y(const ARegion *ar, const int event_y)
+bool ED_region_overlap_isect_y(const ARegion *region, const int event_y)
{
- BLI_assert(ar->overlap);
+ BLI_assert(region->overlap);
/* No contents, skip it. */
- if (ar->v2d.mask.ymin == ar->v2d.mask.ymax) {
+ if (region->v2d.mask.ymin == region->v2d.mask.ymax) {
return false;
}
- return BLI_rctf_isect_y(&ar->v2d.tot,
- UI_view2d_region_to_view_y(&ar->v2d, event_y - ar->winrct.ymin));
+ return BLI_rctf_isect_y(&region->v2d.tot,
+ UI_view2d_region_to_view_y(&region->v2d, event_y - region->winrct.ymin));
}
-bool ED_region_overlap_isect_xy(const ARegion *ar, const int event_xy[2])
+bool ED_region_overlap_isect_xy(const ARegion *region, const int event_xy[2])
{
- return (ED_region_overlap_isect_x(ar, event_xy[0]) &&
- ED_region_overlap_isect_y(ar, event_xy[1]));
+ return (ED_region_overlap_isect_x(region, event_xy[0]) &&
+ ED_region_overlap_isect_y(region, event_xy[1]));
}
-bool ED_region_panel_category_gutter_calc_rect(const ARegion *ar, rcti *r_ar_gutter)
+bool ED_region_panel_category_gutter_calc_rect(const ARegion *region, rcti *r_ar_gutter)
{
- *r_ar_gutter = ar->winrct;
- if (UI_panel_category_is_visible(ar)) {
- const int category_tabs_width = round_fl_to_int(UI_view2d_scale_get_x(&ar->v2d) *
+ *r_ar_gutter = region->winrct;
+ if (UI_panel_category_is_visible(region)) {
+ const int category_tabs_width = round_fl_to_int(UI_view2d_scale_get_x(&region->v2d) *
UI_PANEL_CATEGORY_MARGIN_WIDTH);
- const int alignment = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment);
+ const int alignment = RGN_ALIGN_ENUM_FROM_MASK(region->alignment);
if (alignment == RGN_ALIGN_LEFT) {
r_ar_gutter->xmax = r_ar_gutter->xmin + category_tabs_width;
@@ -83,86 +83,90 @@ bool ED_region_panel_category_gutter_calc_rect(const ARegion *ar, rcti *r_ar_gut
return false;
}
-bool ED_region_panel_category_gutter_isect_xy(const ARegion *ar, const int event_xy[2])
+bool ED_region_panel_category_gutter_isect_xy(const ARegion *region, const int event_xy[2])
{
rcti ar_gutter;
- if (ED_region_panel_category_gutter_calc_rect(ar, &ar_gutter)) {
+ if (ED_region_panel_category_gutter_calc_rect(region, &ar_gutter)) {
return BLI_rcti_isect_pt_v(&ar_gutter, event_xy);
}
return false;
}
-bool ED_region_overlap_isect_x_with_margin(const ARegion *ar, const int event_x, const int margin)
+bool ED_region_overlap_isect_x_with_margin(const ARegion *region,
+ const int event_x,
+ const int margin)
{
- BLI_assert(ar->overlap);
+ BLI_assert(region->overlap);
/* No contents, skip it. */
- if (ar->v2d.mask.xmin == ar->v2d.mask.xmax) {
+ if (region->v2d.mask.xmin == region->v2d.mask.xmax) {
return false;
}
- int region_x = event_x - ar->winrct.xmin;
- return ((ar->v2d.tot.xmin <= UI_view2d_region_to_view_x(&ar->v2d, region_x + margin)) &&
- (ar->v2d.tot.xmax >= UI_view2d_region_to_view_x(&ar->v2d, region_x - margin)));
+ int region_x = event_x - region->winrct.xmin;
+ return ((region->v2d.tot.xmin <= UI_view2d_region_to_view_x(&region->v2d, region_x + margin)) &&
+ (region->v2d.tot.xmax >= UI_view2d_region_to_view_x(&region->v2d, region_x - margin)));
}
-bool ED_region_overlap_isect_y_with_margin(const ARegion *ar, const int event_y, const int margin)
+bool ED_region_overlap_isect_y_with_margin(const ARegion *region,
+ const int event_y,
+ const int margin)
{
- BLI_assert(ar->overlap);
+ BLI_assert(region->overlap);
/* No contents, skip it. */
- if (ar->v2d.mask.ymin == ar->v2d.mask.ymax) {
+ if (region->v2d.mask.ymin == region->v2d.mask.ymax) {
return false;
}
- int region_y = event_y - ar->winrct.ymin;
- return ((ar->v2d.tot.ymin <= UI_view2d_region_to_view_y(&ar->v2d, region_y + margin)) &&
- (ar->v2d.tot.ymax >= UI_view2d_region_to_view_y(&ar->v2d, region_y - margin)));
+ int region_y = event_y - region->winrct.ymin;
+ return ((region->v2d.tot.ymin <= UI_view2d_region_to_view_y(&region->v2d, region_y + margin)) &&
+ (region->v2d.tot.ymax >= UI_view2d_region_to_view_y(&region->v2d, region_y - margin)));
}
-bool ED_region_overlap_isect_xy_with_margin(const ARegion *ar,
+bool ED_region_overlap_isect_xy_with_margin(const ARegion *region,
const int event_xy[2],
const int margin)
{
- return (ED_region_overlap_isect_x_with_margin(ar, event_xy[0], margin) &&
- ED_region_overlap_isect_y_with_margin(ar, event_xy[1], margin));
+ return (ED_region_overlap_isect_x_with_margin(region, event_xy[0], margin) &&
+ ED_region_overlap_isect_y_with_margin(region, event_xy[1], margin));
}
-bool ED_region_contains_xy(const ARegion *ar, const int event_xy[2])
+bool ED_region_contains_xy(const ARegion *region, const int event_xy[2])
{
/* Only use the margin when inside the region. */
- if (BLI_rcti_isect_pt_v(&ar->winrct, event_xy)) {
- if (ar->overlap) {
+ if (BLI_rcti_isect_pt_v(&region->winrct, event_xy)) {
+ if (region->overlap) {
const int overlap_margin = UI_REGION_OVERLAP_MARGIN;
/* Note the View2D.tot isn't reliable for headers with spacers otherwise
* we'd check #ED_region_overlap_isect_xy_with_margin for both bases. */
- if (ar->v2d.keeptot == V2D_KEEPTOT_STRICT) {
+ if (region->v2d.keeptot == V2D_KEEPTOT_STRICT) {
/* Header. */
rcti rect;
BLI_rcti_init_pt_radius(&rect, event_xy, overlap_margin);
- if (UI_region_but_find_rect_over(ar, &rect) == NULL) {
+ if (UI_region_but_find_rect_over(region, &rect) == NULL) {
return false;
}
}
else {
/* Side-bar & any other kind of overlapping region. */
- const int alignment = RGN_ALIGN_ENUM_FROM_MASK(ar->alignment);
+ const int alignment = RGN_ALIGN_ENUM_FROM_MASK(region->alignment);
/* Check alignment to avoid region tabs being clipped out
* by only clipping a single axis for aligned regions. */
if (ELEM(alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
- if (!ED_region_overlap_isect_x_with_margin(ar, event_xy[0], overlap_margin)) {
+ if (!ED_region_overlap_isect_x_with_margin(region, event_xy[0], overlap_margin)) {
return false;
}
}
else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) {
- if (ED_region_panel_category_gutter_isect_xy(ar, event_xy)) {
+ if (ED_region_panel_category_gutter_isect_xy(region, event_xy)) {
/* pass */
}
- else if (!ED_region_overlap_isect_y_with_margin(ar, event_xy[1], overlap_margin)) {
+ else if (!ED_region_overlap_isect_y_with_margin(region, event_xy[1], overlap_margin)) {
return false;
}
}
else {
/* No panel categories for horizontal regions currently. */
- if (!ED_region_overlap_isect_xy_with_margin(ar, event_xy, overlap_margin)) {
+ if (!ED_region_overlap_isect_xy_with_margin(region, event_xy, overlap_margin)) {
return false;
}
}
diff --git a/source/blender/editors/screen/area_utils.c b/source/blender/editors/screen/area_utils.c
index 12de1ddb795..003ba46be4f 100644
--- a/source/blender/editors/screen/area_utils.c
+++ b/source/blender/editors/screen/area_utils.c
@@ -47,12 +47,12 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *UNU
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(sa),
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
WM_msg_subscribe_rna_anon_prop(mbus, WorkSpace, tools, &msg_sub_value_region_tag_redraw);
@@ -61,11 +61,12 @@ void ED_region_generic_tools_region_message_subscribe(const struct bContext *UNU
/**
* Callback for #ARegionType.snap_size
*/
-int ED_region_generic_tools_region_snap_size(const ARegion *ar, int size, int axis)
+int ED_region_generic_tools_region_snap_size(const ARegion *region, int size, int axis)
{
if (axis == 0) {
/* Using Y axis avoids slight feedback loop when adjusting X. */
- const float aspect = BLI_rctf_size_y(&ar->v2d.cur) / (BLI_rcti_size_y(&ar->v2d.mask) + 1);
+ const float aspect = BLI_rctf_size_y(&region->v2d.cur) /
+ (BLI_rcti_size_y(&region->v2d.mask) + 1);
const float icon_size = ICON_DEFAULT_HEIGHT_TOOLBAR / aspect;
const float column = 1.25f * icon_size;
const float margin = 0.5f * icon_size;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 6c86b05e1c7..2000c707b8e 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -398,12 +398,12 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
/* ****************** EXPORTED API TO OTHER MODULES *************************** */
/* screen sets cursor based on active region */
-static void region_cursor_set_ex(wmWindow *win, ScrArea *sa, ARegion *ar, bool swin_changed)
+static void region_cursor_set_ex(wmWindow *win, ScrArea *sa, ARegion *region, bool swin_changed)
{
- BLI_assert(WM_window_get_active_screen(win)->active_region == ar);
- if (win->tag_cursor_refresh || swin_changed || (ar->type && ar->type->event_cursor)) {
+ BLI_assert(WM_window_get_active_screen(win)->active_region == region);
+ if (win->tag_cursor_refresh || swin_changed || (region->type && region->type->event_cursor)) {
win->tag_cursor_refresh = false;
- ED_region_cursor_set(win, sa, ar);
+ ED_region_cursor_set(win, sa, region);
}
}
@@ -413,9 +413,9 @@ static void region_cursor_set(wmWindow *win, bool swin_changed)
ED_screen_areas_iter(win, screen, sa)
{
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == screen->active_region) {
- region_cursor_set_ex(win, sa, ar, swin_changed);
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region == screen->active_region) {
+ region_cursor_set_ex(win, sa, region, swin_changed);
return;
}
}
@@ -522,42 +522,42 @@ void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *scree
* Utility to exit and free an area-region. Screen level regions (menus/popups) need to be treated
* slightly differently, see #ui_region_temp_remove().
*/
-void ED_region_remove(bContext *C, ScrArea *sa, ARegion *ar)
+void ED_region_remove(bContext *C, ScrArea *sa, ARegion *region)
{
- ED_region_exit(C, ar);
- BKE_area_region_free(sa->type, ar);
- BLI_freelinkN(&sa->regionbase, ar);
+ ED_region_exit(C, region);
+ BKE_area_region_free(sa->type, region);
+ BLI_freelinkN(&sa->regionbase, region);
}
/* *********** exit calls are for closing running stuff ******** */
-void ED_region_exit(bContext *C, ARegion *ar)
+void ED_region_exit(bContext *C, ARegion *region)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
ARegion *prevar = CTX_wm_region(C);
- if (ar->type && ar->type->exit) {
- ar->type->exit(wm, ar);
+ if (region->type && region->type->exit) {
+ region->type->exit(wm, region);
}
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
- WM_event_remove_handlers(C, &ar->handlers);
- WM_event_modal_handler_region_replace(win, ar, NULL);
- WM_draw_region_free(ar);
+ WM_event_remove_handlers(C, &region->handlers);
+ WM_event_modal_handler_region_replace(win, region, NULL);
+ WM_draw_region_free(region);
- if (ar->headerstr) {
- MEM_freeN(ar->headerstr);
- ar->headerstr = NULL;
+ if (region->headerstr) {
+ MEM_freeN(region->headerstr);
+ region->headerstr = NULL;
}
- if (ar->regiontimer) {
- WM_event_remove_timer(wm, win, ar->regiontimer);
- ar->regiontimer = NULL;
+ if (region->regiontimer) {
+ WM_event_remove_timer(wm, win, region->regiontimer);
+ region->regiontimer = NULL;
}
- WM_msgbus_clear_by_owner(wm->message_bus, ar);
+ WM_msgbus_clear_by_owner(wm->message_bus, region);
CTX_wm_region_set(C, prevar);
}
@@ -567,7 +567,7 @@ void ED_area_exit(bContext *C, ScrArea *sa)
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
ScrArea *prevsa = CTX_wm_area(C);
- ARegion *ar;
+ ARegion *region;
if (sa->type && sa->type->exit) {
sa->type->exit(wm, sa);
@@ -575,8 +575,8 @@ void ED_area_exit(bContext *C, ScrArea *sa)
CTX_wm_area_set(C, sa);
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ED_region_exit(C, ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ ED_region_exit(C, region);
}
WM_event_remove_handlers(C, &sa->handlers);
@@ -605,8 +605,8 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
screen->active_region = NULL;
- for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
- ED_region_exit(C, ar);
+ for (ARegion *region = screen->regionbase.first; region; region = region->next) {
+ ED_region_exit(C, region);
}
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
ED_area_exit(C, sa);
@@ -686,7 +686,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
}
ScrArea *sa = NULL;
- ARegion *ar;
+ ARegion *region;
ARegion *ar_prev = scr->active_region;
ED_screen_areas_iter(win, scr, area_iter)
@@ -702,9 +702,9 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
}
if (sa) {
/* Make overlap active when mouse over. */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ED_region_contains_xy(ar, xy)) {
- scr->active_region = ar;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (ED_region_contains_xy(region, xy)) {
+ scr->active_region = region;
break;
}
}
@@ -720,14 +720,14 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
{
bool do_draw = false;
- for (ar = area_iter->regionbase.first; ar; ar = ar->next) {
+ for (region = area_iter->regionbase.first; region; region = region->next) {
/* Call old area's deactivate if assigned. */
- if (ar == ar_prev && area_iter->type->deactivate) {
+ if (region == ar_prev && area_iter->type->deactivate) {
area_iter->type->deactivate(area_iter);
}
- if (ar == ar_prev && ar != scr->active_region) {
+ if (region == ar_prev && region != scr->active_region) {
wmGizmoMap *gzmap = ar_prev->gizmo_map;
if (gzmap) {
if (WM_gizmo_highlight_set(gzmap, NULL)) {
@@ -736,15 +736,15 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
}
}
- if (ar == ar_prev || ar == scr->active_region) {
+ if (region == ar_prev || region == scr->active_region) {
do_draw = true;
}
}
if (do_draw) {
- for (ar = area_iter->regionbase.first; ar; ar = ar->next) {
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
- ED_region_tag_redraw_no_rebuild(ar);
+ for (region = area_iter->regionbase.first; region; region = region->next) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ ED_region_tag_redraw_no_rebuild(region);
}
}
}
@@ -779,14 +779,14 @@ int ED_screen_area_active(const bContext *C)
if (win && sc && sa) {
AZone *az = ED_area_actionzone_find_xy(sa, &win->eventstate->x);
- ARegion *ar;
+ ARegion *region;
if (az && az->type == AZONE_REGION) {
return 1;
}
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == sc->active_region) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region == sc->active_region) {
return 1;
}
}
@@ -1051,7 +1051,7 @@ static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrAre
v3d->camera = BKE_view_layer_camera_find(view_layer);
// XXX if (sc == curscreen) handle_view3d_lock();
if (!v3d->camera) {
- ARegion *ar;
+ ARegion *region;
ListBase *regionbase;
/* regionbase is in different place depending if space is active */
@@ -1062,9 +1062,9 @@ static void screen_set_3dview_camera(Scene *scene, ViewLayer *view_layer, ScrAre
regionbase = &v3d->regionbase;
}
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
rv3d->persp = RV3D_PERSP;
}
@@ -1210,18 +1210,18 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
wmWindowManager *wm = CTX_wm_manager(C);
WorkSpace *workspace = WM_window_get_active_workspace(win);
bScreen *sc, *oldscreen;
- ARegion *ar;
+ ARegion *region;
if (sa) {
/* ensure we don't have a button active anymore, can crash when
* switching screens with tooltip open because region and tooltip
* are no longer in the same screen */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- UI_blocklist_free(C, &ar->uiblocks);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ UI_blocklist_free(C, &region->uiblocks);
- if (ar->regiontimer) {
- WM_event_remove_timer(wm, NULL, ar->regiontimer);
- ar->regiontimer = NULL;
+ if (region->regiontimer) {
+ WM_event_remove_timer(wm, NULL, region->regiontimer);
+ region->regiontimer = NULL;
}
}
@@ -1270,8 +1270,8 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
glob_area->global->flag &= ~GLOBAL_AREA_IS_HIDDEN;
}
/* restore the old side panels/header visibility */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ar->flag = ar->flagfullscreen;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ region->flag = region->flagfullscreen;
}
}
@@ -1335,10 +1335,10 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
glob_area->global->flag |= GLOBAL_AREA_IS_HIDDEN;
}
/* temporarily hide the side panels/header */
- for (ar = newa->regionbase.first; ar; ar = ar->next) {
- ar->flagfullscreen = ar->flag;
+ for (region = newa->regionbase.first; region; region = region->next) {
+ region->flagfullscreen = region->flag;
- if (ELEM(ar->regiontype,
+ if (ELEM(region->regiontype,
RGN_TYPE_UI,
RGN_TYPE_HEADER,
RGN_TYPE_TOOL_HEADER,
@@ -1346,7 +1346,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
RGN_TYPE_TOOLS,
RGN_TYPE_NAV_BAR,
RGN_TYPE_EXECUTE)) {
- ar->flag |= RGN_FLAG_HIDDEN;
+ region->flag |= RGN_FLAG_HIDDEN;
}
}
}
@@ -1462,7 +1462,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable)
screen->animtimer = WM_event_add_timer(wm, win, TIMER0, (1.0 / FPS));
- sad->ar = CTX_wm_region(C);
+ sad->region = CTX_wm_region(C);
/* if startframe is larger than current frame, we put currentframe on startframe.
* note: first frame then is not drawn! (ton) */
if (PRVRANGEON) {
@@ -1513,12 +1513,12 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->spacetype == SPACE_VIEW3D) {
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->winrct.xmin - ar->winrct.ymin < min) {
- aret = ar;
- min = ar->winrct.xmin - ar->winrct.ymin;
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ if (region->winrct.xmin - region->winrct.ymin < min) {
+ aret = region;
+ min = region->winrct.xmin - region->winrct.ymin;
}
}
}
@@ -1535,9 +1535,9 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws)
ScreenAnimData *sad = wt->customdata;
sad->redraws = redraws;
- sad->ar = NULL;
+ sad->region = NULL;
if (redraws & TIME_REGION) {
- sad->ar = time_top_left_3dwindow(screen);
+ sad->region = time_top_left_3dwindow(screen);
}
}
}
@@ -1587,10 +1587,10 @@ bool ED_screen_stereo3d_required(const bScreen *screen, const Scene *scene)
v3d = sa->spacedata.first;
if (v3d->camera && v3d->stereo3d_camera == STEREO_3D_ID) {
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
return true;
}
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 4971b310eff..e1a75e51cf2 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -38,7 +38,7 @@ struct bContextDataResult;
/* area.c */
void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free);
void ED_area_data_swap(ScrArea *sa1, ScrArea *sa2);
-void region_toggle_hidden(struct bContext *C, ARegion *ar, const bool do_fade);
+void region_toggle_hidden(struct bContext *C, ARegion *region, const bool do_fade);
/* screen_edit.c */
bScreen *screen_add(struct Main *bmain, const char *name, const rcti *rect);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 26529e4afcb..74c65765cbe 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -701,23 +701,25 @@ static void fullscreen_click_rcti_init(
static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
{
- const ARegion *ar = az->ar;
+ const ARegion *region = az->region;
*r_rect_clip = az->rect;
if (az->type == AZONE_REGION) {
- if (ar->overlap && (ar->v2d.keeptot != V2D_KEEPTOT_STRICT) &&
+ if (region->overlap && (region->v2d.keeptot != V2D_KEEPTOT_STRICT) &&
/* Only when this isn't hidden (where it's displayed as an button that expands). */
- ((az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) == 0)) {
+ ((az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) == 0)) {
/* A floating region to be resized, clip by the visible region. */
switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
case AE_BOTTOM_TO_TOPLEFT: {
r_rect_clip->xmin = max_ii(
r_rect_clip->xmin,
- (ar->winrct.xmin + UI_view2d_view_to_region_x(&ar->v2d, ar->v2d.tot.xmin)) -
+ (region->winrct.xmin +
+ UI_view2d_view_to_region_x(&region->v2d, region->v2d.tot.xmin)) -
UI_REGION_OVERLAP_MARGIN);
r_rect_clip->xmax = min_ii(
r_rect_clip->xmax,
- (ar->winrct.xmin + UI_view2d_view_to_region_x(&ar->v2d, ar->v2d.tot.xmax)) +
+ (region->winrct.xmin +
+ UI_view2d_view_to_region_x(&region->v2d, region->v2d.tot.xmax)) +
UI_REGION_OVERLAP_MARGIN);
return true;
}
@@ -725,11 +727,13 @@ static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
case AE_RIGHT_TO_TOPLEFT: {
r_rect_clip->ymin = max_ii(
r_rect_clip->ymin,
- (ar->winrct.ymin + UI_view2d_view_to_region_y(&ar->v2d, ar->v2d.tot.ymin)) -
+ (region->winrct.ymin +
+ UI_view2d_view_to_region_y(&region->v2d, region->v2d.tot.ymin)) -
UI_REGION_OVERLAP_MARGIN);
r_rect_clip->ymax = min_ii(
r_rect_clip->ymax,
- (ar->winrct.ymin + UI_view2d_view_to_region_y(&ar->v2d, ar->v2d.tot.ymax)) +
+ (region->winrct.ymin +
+ UI_view2d_view_to_region_y(&region->v2d, region->v2d.tot.ymax)) +
UI_REGION_OVERLAP_MARGIN);
return true;
}
@@ -799,11 +803,11 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
}
else if (az->type == AZONE_REGION_SCROLL) {
- ARegion *ar = az->ar;
- View2D *v2d = &ar->v2d;
+ ARegion *region = az->region;
+ View2D *v2d = &region->v2d;
int scroll_flag = 0;
const int isect_value = UI_view2d_mouse_in_scrollers_ex(
- ar, v2d, xy[0], xy[1], &scroll_flag);
+ region, v2d, xy[0], xy[1], &scroll_flag);
/* Check if we even have scroll bars. */
if (((az->direction == AZ_SCROLL_HOR) && !(scroll_flag & V2D_SCROLL_HORIZONTAL)) ||
@@ -833,7 +837,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
}
else {
- const int local_xy[2] = {xy[0] - ar->winrct.xmin, xy[1] - ar->winrct.ymin};
+ const int local_xy[2] = {xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin};
float dist_fac = 0.0f, alpha = 0.0f;
if (az->direction == AZ_SCROLL_HOR) {
@@ -855,7 +859,7 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
if (redraw) {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
/* Don't return! */
}
@@ -869,14 +873,14 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
else if (az->type == AZONE_REGION_SCROLL) {
if (az->direction == AZ_SCROLL_VERT) {
- az->alpha = az->ar->v2d.alpha_vert = 0;
+ az->alpha = az->region->v2d.alpha_vert = 0;
sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
- ED_region_tag_redraw_no_rebuild(az->ar);
+ ED_region_tag_redraw_no_rebuild(az->region);
}
else if (az->direction == AZ_SCROLL_HOR) {
- az->alpha = az->ar->v2d.alpha_hor = 0;
+ az->alpha = az->region->v2d.alpha_hor = 0;
sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
- ED_region_tag_redraw_no_rebuild(az->ar);
+ ED_region_tag_redraw_no_rebuild(az->region);
}
else {
BLI_assert(0);
@@ -2460,7 +2464,7 @@ static void SCREEN_OT_area_split(wmOperatorType *ot)
typedef struct RegionMoveData {
AZone *az;
- ARegion *ar;
+ ARegion *region;
ScrArea *sa;
int bigger, smaller, origval;
int origx, origy;
@@ -2478,12 +2482,12 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
const int align = RGN_ALIGN_ENUM_FROM_MASK(scalear->alignment);
if (ELEM(align, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
- ARegion *ar = scalear->prev;
- dist = ar->winy + scalear->winy - U.pixelsize;
+ ARegion *region = scalear->prev;
+ dist = region->winy + scalear->winy - U.pixelsize;
}
else /* if (ELEM(align, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) */ {
- ARegion *ar = scalear->prev;
- dist = ar->winx + scalear->winx - U.pixelsize;
+ ARegion *region = scalear->prev;
+ dist = region->winx + scalear->winx - U.pixelsize;
}
}
else {
@@ -2496,26 +2500,28 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
/* subtractwidth of regions on opposite side
* prevents dragging regions into other opposite regions */
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == scalear) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region == scalear) {
continue;
}
- if (scalear->alignment == RGN_ALIGN_LEFT && ar->alignment == RGN_ALIGN_RIGHT) {
- dist -= ar->winx;
+ if (scalear->alignment == RGN_ALIGN_LEFT && region->alignment == RGN_ALIGN_RIGHT) {
+ dist -= region->winx;
}
- else if (scalear->alignment == RGN_ALIGN_RIGHT && ar->alignment == RGN_ALIGN_LEFT) {
- dist -= ar->winx;
+ else if (scalear->alignment == RGN_ALIGN_RIGHT && region->alignment == RGN_ALIGN_LEFT) {
+ dist -= region->winx;
}
else if (scalear->alignment == RGN_ALIGN_TOP &&
- (ar->alignment == RGN_ALIGN_BOTTOM ||
- ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
- dist -= ar->winy;
+ (region->alignment == RGN_ALIGN_BOTTOM ||
+ ELEM(
+ region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
+ dist -= region->winy;
}
else if (scalear->alignment == RGN_ALIGN_BOTTOM &&
- (ar->alignment == RGN_ALIGN_TOP ||
- ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
- dist -= ar->winy;
+ (region->alignment == RGN_ALIGN_TOP ||
+ ELEM(
+ region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
+ dist -= region->winy;
}
}
}
@@ -2552,7 +2558,7 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event
az = sad->az;
- if (az->ar) {
+ if (az->region) {
RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
op->customdata = rmd;
@@ -2561,33 +2567,33 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event
/* special case for region within region - this allows the scale of
* the parent region if the azone edge is not the edge splitting
* both regions */
- if ((az->ar->alignment & RGN_SPLIT_PREV) && az->ar->prev &&
- !is_split_edge(RGN_ALIGN_ENUM_FROM_MASK(az->ar->alignment), az->edge)) {
- rmd->ar = az->ar->prev;
+ if ((az->region->alignment & RGN_SPLIT_PREV) && az->region->prev &&
+ !is_split_edge(RGN_ALIGN_ENUM_FROM_MASK(az->region->alignment), az->edge)) {
+ rmd->region = az->region->prev;
}
else {
- rmd->ar = az->ar;
+ rmd->region = az->region;
}
rmd->sa = sad->sa1;
rmd->edge = az->edge;
rmd->origx = event->x;
rmd->origy = event->y;
- rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge);
+ rmd->maxsize = area_max_regionsize(rmd->sa, rmd->region, rmd->edge);
/* if not set we do now, otherwise it uses type */
- if (rmd->ar->sizex == 0) {
- rmd->ar->sizex = rmd->ar->winx;
+ if (rmd->region->sizex == 0) {
+ rmd->region->sizex = rmd->region->winx;
}
- if (rmd->ar->sizey == 0) {
- rmd->ar->sizey = rmd->ar->winy;
+ if (rmd->region->sizey == 0) {
+ rmd->region->sizey = rmd->region->winy;
}
/* now copy to regionmovedata */
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
- rmd->origval = rmd->ar->sizex;
+ rmd->origval = rmd->region->sizex;
}
else {
- rmd->origval = rmd->ar->sizey;
+ rmd->origval = rmd->region->sizey;
}
CLAMP(rmd->maxsize, 0, 1000);
@@ -2604,14 +2610,14 @@ static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event
static void region_scale_validate_size(RegionMoveData *rmd)
{
- if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) {
+ if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
short *size, maxsize = -1;
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
- size = &rmd->ar->sizex;
+ size = &rmd->region->sizex;
}
else {
- size = &rmd->ar->sizey;
+ size = &rmd->region->sizey;
}
maxsize = rmd->maxsize - (UI_UNIT_Y / UI_DPI_FAC);
@@ -2626,15 +2632,15 @@ static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd)
{
/* hidden areas may have bad 'View2D.cur' value,
* correct before displaying. see T45156 */
- if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
- UI_view2d_curRect_validate(&rmd->ar->v2d);
+ if (rmd->region->flag & RGN_FLAG_HIDDEN) {
+ UI_view2d_curRect_validate(&rmd->region->v2d);
}
- region_toggle_hidden(C, rmd->ar, 0);
+ region_toggle_hidden(C, rmd->region, 0);
region_scale_validate_size(rmd);
- if ((rmd->ar->flag & RGN_FLAG_HIDDEN) == 0) {
- if (rmd->ar->regiontype == RGN_TYPE_HEADER) {
+ if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
+ if (rmd->region->regiontype == RGN_TYPE_HEADER) {
ARegion *ar_tool_header = BKE_area_find_region_type(rmd->sa, RGN_TYPE_TOOL_HEADER);
if (ar_tool_header != NULL) {
if ((ar_tool_header->flag & RGN_FLAG_HIDDEN_BY_USER) == 0 &&
@@ -2654,8 +2660,8 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* execute the events */
switch (event->type) {
case MOUSEMOVE: {
- const float aspect = BLI_rctf_size_x(&rmd->ar->v2d.cur) /
- (BLI_rcti_size_x(&rmd->ar->v2d.mask) + 1);
+ const float aspect = BLI_rctf_size_x(&rmd->region->v2d.cur) /
+ (BLI_rcti_size_x(&rmd->region->v2d.mask) + 1);
const int snap_size_threshold = (U.widget_unit * 2) / aspect;
if (rmd->edge == AE_LEFT_TO_TOPRIGHT || rmd->edge == AE_RIGHT_TO_TOPLEFT) {
delta = event->x - rmd->origx;
@@ -2667,27 +2673,27 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
delta /= UI_DPI_FAC;
const int size_no_snap = rmd->origval + delta;
- rmd->ar->sizex = size_no_snap;
+ rmd->region->sizex = size_no_snap;
- if (rmd->ar->type->snap_size) {
- short sizex_test = rmd->ar->type->snap_size(rmd->ar, rmd->ar->sizex, 0);
- if (ABS(rmd->ar->sizex - sizex_test) < snap_size_threshold) {
- rmd->ar->sizex = sizex_test;
+ if (rmd->region->type->snap_size) {
+ short sizex_test = rmd->region->type->snap_size(rmd->region, rmd->region->sizex, 0);
+ if (ABS(rmd->region->sizex - sizex_test) < snap_size_threshold) {
+ rmd->region->sizex = sizex_test;
}
}
- CLAMP(rmd->ar->sizex, 0, rmd->maxsize);
+ CLAMP(rmd->region->sizex, 0, rmd->maxsize);
if (size_no_snap < UI_UNIT_X / aspect) {
- rmd->ar->sizex = rmd->origval;
- if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) {
+ rmd->region->sizex = rmd->origval;
+ if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) {
region_scale_toggle_hidden(C, rmd);
}
}
- else if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
+ else if (rmd->region->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
}
- else if (rmd->ar->flag & RGN_FLAG_DYNAMIC_SIZE) {
- rmd->ar->sizex = rmd->origval;
+ else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) {
+ rmd->region->sizex = rmd->origval;
}
}
else {
@@ -2700,30 +2706,30 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
delta /= UI_DPI_FAC;
const int size_no_snap = rmd->origval + delta;
- rmd->ar->sizey = size_no_snap;
+ rmd->region->sizey = size_no_snap;
- if (rmd->ar->type->snap_size) {
- short sizey_test = rmd->ar->type->snap_size(rmd->ar, rmd->ar->sizey, 1);
- if (ABS(rmd->ar->sizey - sizey_test) < snap_size_threshold) {
- rmd->ar->sizey = sizey_test;
+ if (rmd->region->type->snap_size) {
+ short sizey_test = rmd->region->type->snap_size(rmd->region, rmd->region->sizey, 1);
+ if (ABS(rmd->region->sizey - sizey_test) < snap_size_threshold) {
+ rmd->region->sizey = sizey_test;
}
}
- CLAMP(rmd->ar->sizey, 0, rmd->maxsize);
+ CLAMP(rmd->region->sizey, 0, rmd->maxsize);
/* note, 'UI_UNIT_Y/4' means you need to drag the footer and execute region
* almost all the way down for it to become hidden, this is done
* otherwise its too easy to do this by accident */
if (size_no_snap < (UI_UNIT_Y / 4) / aspect) {
- rmd->ar->sizey = rmd->origval;
- if (!(rmd->ar->flag & RGN_FLAG_HIDDEN)) {
+ rmd->region->sizey = rmd->origval;
+ if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) {
region_scale_toggle_hidden(C, rmd);
}
}
- else if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
+ else if (rmd->region->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
}
- else if (rmd->ar->flag & RGN_FLAG_DYNAMIC_SIZE) {
- rmd->ar->sizey = rmd->origval;
+ else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) {
+ rmd->region->sizey = rmd->origval;
}
}
ED_area_tag_redraw(rmd->sa);
@@ -2734,10 +2740,10 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
case LEFTMOUSE:
if (event->val == KM_RELEASE) {
if (len_manhattan_v2v2_int(&event->x, &rmd->origx) <= WM_EVENT_CURSOR_MOTION_THRESHOLD) {
- if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
+ if (rmd->region->flag & RGN_FLAG_HIDDEN) {
region_scale_toggle_hidden(C, rmd);
}
- else if (rmd->ar->flag & RGN_FLAG_TOO_SMALL) {
+ else if (rmd->region->flag & RGN_FLAG_TOO_SMALL) {
region_scale_validate_size(rmd);
}
@@ -2795,28 +2801,29 @@ static void areas_do_frame_follow(bContext *C, bool middle)
const bScreen *screen = WM_window_get_active_screen(window);
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
/* do follow here if editor type supports it */
if ((scr->redraws_flag & TIME_FOLLOW)) {
- if ((ar->regiontype == RGN_TYPE_WINDOW &&
+ if ((region->regiontype == RGN_TYPE_WINDOW &&
ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
- (sa->spacetype == SPACE_CLIP && ar->regiontype == RGN_TYPE_PREVIEW)) {
- float w = BLI_rctf_size_x(&ar->v2d.cur);
+ (sa->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) {
+ float w = BLI_rctf_size_x(&region->v2d.cur);
if (middle) {
- if ((scene->r.cfra < ar->v2d.cur.xmin) || (scene->r.cfra > ar->v2d.cur.xmax)) {
- ar->v2d.cur.xmax = scene->r.cfra + (w / 2);
- ar->v2d.cur.xmin = scene->r.cfra - (w / 2);
+ if ((scene->r.cfra < region->v2d.cur.xmin) ||
+ (scene->r.cfra > region->v2d.cur.xmax)) {
+ region->v2d.cur.xmax = scene->r.cfra + (w / 2);
+ region->v2d.cur.xmin = scene->r.cfra - (w / 2);
}
}
else {
- if (scene->r.cfra < ar->v2d.cur.xmin) {
- ar->v2d.cur.xmax = scene->r.cfra;
- ar->v2d.cur.xmin = ar->v2d.cur.xmax - w;
+ if (scene->r.cfra < region->v2d.cur.xmin) {
+ region->v2d.cur.xmax = scene->r.cfra;
+ region->v2d.cur.xmin = region->v2d.cur.xmax - w;
}
- else if (scene->r.cfra > ar->v2d.cur.xmax) {
- ar->v2d.cur.xmin = scene->r.cfra;
- ar->v2d.cur.xmax = ar->v2d.cur.xmin + w;
+ else if (scene->r.cfra > region->v2d.cur.xmax) {
+ region->v2d.cur.xmin = scene->r.cfra;
+ region->v2d.cur.xmax = region->v2d.cur.xmin + w;
}
}
}
@@ -3802,9 +3809,9 @@ static void view3d_localview_update_rv3d(struct RegionView3D *rv3d)
}
static void region_quadview_init_rv3d(
- ScrArea *sa, ARegion *ar, const char viewlock, const char view, const char persp)
+ ScrArea *sa, ARegion *region, const char viewlock, const char view, const char persp)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (persp == RV3D_CAMOB) {
ED_view3d_lastview_store(rv3d);
@@ -3818,30 +3825,30 @@ static void region_quadview_init_rv3d(
ED_view3d_lock(rv3d);
view3d_localview_update_rv3d(rv3d);
if ((viewlock & RV3D_BOXCLIP) && (persp == RV3D_ORTHO)) {
- ED_view3d_quadview_update(sa, ar, true);
+ ED_view3d_quadview_update(sa, region, true);
}
}
/* insert a region in the area region list */
static int region_quadview_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* some rules... */
- if (ar->regiontype != RGN_TYPE_WINDOW) {
+ if (region->regiontype != RGN_TYPE_WINDOW) {
BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-split");
}
- else if (ar->alignment == RGN_ALIGN_QSPLIT) {
+ else if (region->alignment == RGN_ALIGN_QSPLIT) {
/* Exit quad-view */
ScrArea *sa = CTX_wm_area(C);
ARegion *arn;
/* keep current region */
- ar->alignment = 0;
+ region->alignment = 0;
if (sa->spacetype == SPACE_VIEW3D) {
ARegion *ar_iter;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* if this is a locked view, use settings from 'User' view */
if (rv3d->viewlock) {
@@ -3849,9 +3856,9 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
ARegion *ar_user;
if (ED_view3d_context_user_region(C, &v3d_user, &ar_user)) {
- if (ar != ar_user) {
- SWAP(void *, ar->regiondata, ar_user->regiondata);
- rv3d = ar->regiondata;
+ if (region != ar_user) {
+ SWAP(void *, region->regiondata, ar_user->regiondata);
+ rv3d = region->regiondata;
}
}
}
@@ -3869,16 +3876,16 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
}
}
- for (ar = sa->regionbase.first; ar; ar = arn) {
- arn = ar->next;
- if (ar->alignment == RGN_ALIGN_QSPLIT) {
- ED_region_remove(C, sa, ar);
+ for (region = sa->regionbase.first; region; region = arn) {
+ arn = region->next;
+ if (region->alignment == RGN_ALIGN_QSPLIT) {
+ ED_region_remove(C, sa, region);
}
}
ED_area_tag_redraw(sa);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
}
- else if (ar->next) {
+ else if (region->next) {
BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-split");
}
else {
@@ -3887,10 +3894,10 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
ARegion *newar;
int count;
- ar->alignment = RGN_ALIGN_QSPLIT;
+ region->alignment = RGN_ALIGN_QSPLIT;
for (count = 0; count < 3; count++) {
- newar = BKE_area_region_copy(sa->type, ar);
+ newar = BKE_area_region_copy(sa->type, region);
BLI_addtail(&sa->regionbase, newar);
}
@@ -3905,30 +3912,30 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
*
* We could avoid manipulating rv3d->localvd here if exiting
* localview with a 4-split would assign these view locks */
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
const char viewlock = (rv3d->viewlock_quad & RV3D_VIEWLOCK_INIT) ?
(rv3d->viewlock_quad & ~RV3D_VIEWLOCK_INIT) :
RV3D_LOCKED;
region_quadview_init_rv3d(
- sa, ar, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
+ sa, region, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
region_quadview_init_rv3d(sa,
- (ar = ar->next),
+ (region = region->next),
viewlock,
ED_view3d_lock_view_from_index(index_qsplit++),
RV3D_ORTHO);
region_quadview_init_rv3d(sa,
- (ar = ar->next),
+ (region = region->next),
viewlock,
ED_view3d_lock_view_from_index(index_qsplit++),
RV3D_ORTHO);
/* forcing camera is distracting */
#if 0
if (v3d->camera) {
- region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB);
+ region_quadview_init_rv3d(sa, (region = region->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB);
}
else {
- region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_USER, RV3D_PERSP);
+ region_quadview_init_rv3d(sa, (region = region->next), 0, RV3D_VIEW_USER, RV3D_PERSP);
}
#else
(void)v3d;
@@ -4022,23 +4029,23 @@ static void SCREEN_OT_region_toggle(wmOperatorType *ot)
/* flip a region alignment */
static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (!ar) {
+ if (!region) {
return OPERATOR_CANCELLED;
}
- if (ar->alignment == RGN_ALIGN_TOP) {
- ar->alignment = RGN_ALIGN_BOTTOM;
+ if (region->alignment == RGN_ALIGN_TOP) {
+ region->alignment = RGN_ALIGN_BOTTOM;
}
- else if (ar->alignment == RGN_ALIGN_BOTTOM) {
- ar->alignment = RGN_ALIGN_TOP;
+ else if (region->alignment == RGN_ALIGN_BOTTOM) {
+ region->alignment = RGN_ALIGN_TOP;
}
- else if (ar->alignment == RGN_ALIGN_LEFT) {
- ar->alignment = RGN_ALIGN_RIGHT;
+ else if (region->alignment == RGN_ALIGN_LEFT) {
+ region->alignment = RGN_ALIGN_RIGHT;
}
- else if (ar->alignment == RGN_ALIGN_RIGHT) {
- ar->alignment = RGN_ALIGN_LEFT;
+ else if (region->alignment == RGN_ALIGN_RIGHT) {
+ region->alignment = RGN_ALIGN_LEFT;
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -4121,8 +4128,8 @@ static bool screen_region_context_menu_poll(bContext *C)
void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_TOP) ?
+ ARegion *region = CTX_wm_region(C);
+ const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
IFACE_("Flip to Bottom") :
IFACE_("Flip to Top");
{
@@ -4168,8 +4175,8 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN
void ED_screens_footer_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_TOP) ?
+ ARegion *region = CTX_wm_region(C);
+ const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
IFACE_("Flip to Bottom") :
IFACE_("Flip to Top");
{
@@ -4195,8 +4202,8 @@ void ED_screens_footer_tools_menu_create(bContext *C, uiLayout *layout, void *UN
void ED_screens_navigation_bar_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
{
- const ARegion *ar = CTX_wm_region(C);
- const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_LEFT) ?
+ const ARegion *region = CTX_wm_region(C);
+ const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_LEFT) ?
IFACE_("Flip to Right") :
IFACE_("Flip to Left");
@@ -4212,21 +4219,21 @@ static int screen_context_menu_invoke(bContext *C,
{
uiPopupMenu *pup;
uiLayout *layout;
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
- if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
+ if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
pup = UI_popup_menu_begin(C, IFACE_("Header"), ICON_NONE);
layout = UI_popup_menu_layout(pup);
ED_screens_header_tools_menu_create(C, layout, NULL);
UI_popup_menu_end(C, pup);
}
- else if (ar->regiontype == RGN_TYPE_FOOTER) {
+ else if (region->regiontype == RGN_TYPE_FOOTER) {
pup = UI_popup_menu_begin(C, IFACE_("Footer"), ICON_NONE);
layout = UI_popup_menu_layout(pup);
ED_screens_footer_tools_menu_create(C, layout, NULL);
UI_popup_menu_end(C, pup);
}
- else if (ar->regiontype == RGN_TYPE_NAV_BAR) {
+ else if (region->regiontype == RGN_TYPE_NAV_BAR) {
pup = UI_popup_menu_begin(C, IFACE_("Navigation Bar"), ICON_NONE);
layout = UI_popup_menu_layout(pup);
ED_screens_navigation_bar_tools_menu_create(C, layout, NULL);
@@ -4507,32 +4514,32 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv
const bScreen *win_screen = WM_window_get_active_screen(window);
for (sa = win_screen->areabase.first; sa; sa = sa->next) {
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
bool redraw = false;
- if (ar == sad->ar) {
+ if (region == sad->region) {
redraw = true;
}
else if (match_region_with_redraws(
- sa->spacetype, ar->regiontype, sad->redraws, sad->from_anim_edit)) {
+ sa->spacetype, region->regiontype, sad->redraws, sad->from_anim_edit)) {
redraw = true;
}
if (redraw) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
/* do follow here if editor type supports it */
if ((sad->redraws & TIME_FOLLOW)) {
- if ((ar->regiontype == RGN_TYPE_WINDOW &&
+ if ((region->regiontype == RGN_TYPE_WINDOW &&
ELEM(sa->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
- (sa->spacetype == SPACE_CLIP && ar->regiontype == RGN_TYPE_PREVIEW)) {
- float w = BLI_rctf_size_x(&ar->v2d.cur);
- if (scene->r.cfra < ar->v2d.cur.xmin) {
- ar->v2d.cur.xmax = scene->r.cfra;
- ar->v2d.cur.xmin = ar->v2d.cur.xmax - w;
+ (sa->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) {
+ float w = BLI_rctf_size_x(&region->v2d.cur);
+ if (scene->r.cfra < region->v2d.cur.xmin) {
+ region->v2d.cur.xmax = scene->r.cfra;
+ region->v2d.cur.xmin = region->v2d.cur.xmax - w;
}
- else if (scene->r.cfra > ar->v2d.cur.xmax) {
- ar->v2d.cur.xmin = scene->r.cfra;
- ar->v2d.cur.xmax = ar->v2d.cur.xmin + w;
+ else if (scene->r.cfra > region->v2d.cur.xmax) {
+ region->v2d.cur.xmin = scene->r.cfra;
+ region->v2d.cur.xmax = region->v2d.cur.xmin + w;
}
}
}
@@ -4633,7 +4640,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode)
wmTimer *wt = screen->animtimer;
ScreenAnimData *sad = wt->customdata;
- sad->ar = CTX_wm_region(C);
+ sad->region = CTX_wm_region(C);
}
}
@@ -5062,25 +5069,25 @@ static void SCREEN_OT_delete(wmOperatorType *ot)
typedef struct RegionAlphaInfo {
ScrArea *sa;
- ARegion *ar, *child_ar; /* other region */
+ ARegion *region, *child_ar; /* other region */
int hidden;
} RegionAlphaInfo;
#define TIMEOUT 0.1f
#define TIMESTEP (1.0f / 60.0f)
-float ED_region_blend_alpha(ARegion *ar)
+float ED_region_blend_alpha(ARegion *region)
{
/* check parent too */
- if (ar->regiontimer == NULL && (ar->alignment & RGN_SPLIT_PREV) && ar->prev) {
- ar = ar->prev;
+ if (region->regiontimer == NULL && (region->alignment & RGN_SPLIT_PREV) && region->prev) {
+ region = region->prev;
}
- if (ar->regiontimer) {
- RegionAlphaInfo *rgi = ar->regiontimer->customdata;
+ if (region->regiontimer) {
+ RegionAlphaInfo *rgi = region->regiontimer->customdata;
float alpha;
- alpha = (float)ar->regiontimer->duration / TIMEOUT;
+ alpha = (float)region->regiontimer->duration / TIMEOUT;
/* makes sure the blend out works 100% - without area redraws */
if (rgi->hidden) {
alpha = 0.9f - TIMESTEP - alpha;
@@ -5093,12 +5100,12 @@ float ED_region_blend_alpha(ARegion *ar)
}
/* assumes region has running region-blend timer */
-static void region_blend_end(bContext *C, ARegion *ar, const bool is_running)
+static void region_blend_end(bContext *C, ARegion *region, const bool is_running)
{
- RegionAlphaInfo *rgi = ar->regiontimer->customdata;
+ RegionAlphaInfo *rgi = region->regiontimer->customdata;
/* always send redraw */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (rgi->child_ar) {
ED_region_tag_redraw(rgi->child_ar);
}
@@ -5106,58 +5113,58 @@ static void region_blend_end(bContext *C, ARegion *ar, const bool is_running)
/* if running timer was hiding, the flag toggle went wrong */
if (is_running) {
if (rgi->hidden) {
- rgi->ar->flag &= ~RGN_FLAG_HIDDEN;
+ rgi->region->flag &= ~RGN_FLAG_HIDDEN;
}
}
else {
if (rgi->hidden) {
- rgi->ar->flag |= rgi->hidden;
+ rgi->region->flag |= rgi->hidden;
ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), rgi->sa);
}
/* area decoration needs redraw in end */
ED_area_tag_redraw(rgi->sa);
}
- WM_event_remove_timer(CTX_wm_manager(C), NULL, ar->regiontimer); /* frees rgi */
- ar->regiontimer = NULL;
+ WM_event_remove_timer(CTX_wm_manager(C), NULL, region->regiontimer); /* frees rgi */
+ region->regiontimer = NULL;
}
/**
- * \note Assumes that \a ar itself is not a split version from previous region.
+ * \note Assumes that \a region itself is not a split version from previous region.
*/
-void ED_region_visibility_change_update_animated(bContext *C, ScrArea *sa, ARegion *ar)
+void ED_region_visibility_change_update_animated(bContext *C, ScrArea *sa, ARegion *region)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
RegionAlphaInfo *rgi;
/* end running timer */
- if (ar->regiontimer) {
+ if (region->regiontimer) {
- region_blend_end(C, ar, true);
+ region_blend_end(C, region, true);
}
rgi = MEM_callocN(sizeof(RegionAlphaInfo), "RegionAlphaInfo");
- rgi->hidden = ar->flag & RGN_FLAG_HIDDEN;
+ rgi->hidden = region->flag & RGN_FLAG_HIDDEN;
rgi->sa = sa;
- rgi->ar = ar;
- ar->flag &= ~RGN_FLAG_HIDDEN;
+ rgi->region = region;
+ region->flag &= ~RGN_FLAG_HIDDEN;
/* blend in, reinitialize regions because it got unhidden */
if (rgi->hidden == 0) {
ED_area_initialize(wm, win, sa);
}
else {
- WM_event_remove_handlers(C, &ar->handlers);
+ WM_event_remove_handlers(C, &region->handlers);
}
- if (ar->next) {
- if (ar->next->alignment & RGN_SPLIT_PREV) {
- rgi->child_ar = ar->next;
+ if (region->next) {
+ if (region->next->alignment & RGN_SPLIT_PREV) {
+ rgi->child_ar = region->next;
}
}
/* new timer */
- ar->regiontimer = WM_event_add_timer(wm, win, TIMERREGION, TIMESTEP);
- ar->regiontimer->customdata = rgi;
+ region->regiontimer = WM_event_add_timer(wm, win, TIMERREGION, TIMESTEP);
+ region->regiontimer->customdata = rgi;
}
/* timer runs in win->handlers, so it cannot use context to find area/region */
@@ -5174,14 +5181,14 @@ static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven
rgi = timer->customdata;
/* always send redraws */
- ED_region_tag_redraw(rgi->ar);
+ ED_region_tag_redraw(rgi->region);
if (rgi->child_ar) {
ED_region_tag_redraw(rgi->child_ar);
}
/* end timer? */
- if (rgi->ar->regiontimer->duration > (double)TIMEOUT) {
- region_blend_end(C, rgi->ar, false);
+ if (rgi->region->regiontimer->duration > (double)TIMEOUT) {
+ region_blend_end(C, rgi->region, false);
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 07dfa970404..dd922834d9e 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -125,7 +125,7 @@ static int same_tex_snap(TexSnapshot *snap, MTex *mtex, ViewContext *vc, bool co
//(BKE_brush_size_get(vc->scene, brush) <= snap->BKE_brush_size_get)) &&
(mtex->brush_map_mode != MTEX_MAP_MODE_TILED ||
- (vc->ar->winx == snap->winx && vc->ar->winy == snap->winy)) &&
+ (vc->region->winx == snap->winx && vc->region->winy == snap->winy)) &&
(mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL || snap->old_zoom == zoom) &&
snap->old_col == col);
}
@@ -133,8 +133,8 @@ static int same_tex_snap(TexSnapshot *snap, MTex *mtex, ViewContext *vc, bool co
static void make_tex_snap(TexSnapshot *snap, ViewContext *vc, float zoom)
{
snap->old_zoom = zoom;
- snap->winx = vc->ar->winx;
- snap->winy = vc->ar->winy;
+ snap->winx = vc->region->winx;
+ snap->winy = vc->region->winy;
}
typedef struct LoadTexData {
@@ -191,8 +191,8 @@ static void load_tex_task_cb_ex(void *__restrict userdata,
float len;
if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) {
- x *= vc->ar->winx / radius;
- y *= vc->ar->winy / radius;
+ x *= vc->region->winx / radius;
+ y *= vc->region->winy / radius;
}
else {
x = (x - 0.5f) * 2.0f;
@@ -549,9 +549,10 @@ static int project_brush_radius(ViewContext *vc, float radius, const float locat
add_v3_v3v3(offset, location, ortho);
/* Project the center of the brush, and the tangent point to the view onto the screen. */
- if ((ED_view3d_project_float_global(vc->ar, location, p1, V3D_PROJ_TEST_NOP) ==
+ if ((ED_view3d_project_float_global(vc->region, location, p1, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) &&
- (ED_view3d_project_float_global(vc->ar, offset, p2, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) {
+ (ED_view3d_project_float_global(vc->region, offset, p2, V3D_PROJ_TEST_NOP) ==
+ V3D_PROJ_RET_OK)) {
/* The distance between these points is the size of the projected brush in pixels. */
return len_v2v2(p1, p2);
}
@@ -675,8 +676,8 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups,
else if (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) {
quad.xmin = 0;
quad.ymin = 0;
- quad.xmax = BLI_rcti_size_x(&vc->ar->winrct);
- quad.ymax = BLI_rcti_size_y(&vc->ar->winrct);
+ quad.xmax = BLI_rcti_size_x(&vc->region->winrct);
+ quad.ymax = BLI_rcti_size_y(&vc->region->winrct);
}
/* Stencil code goes here. */
else {
@@ -844,9 +845,9 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups,
/* Translate to region. */
GPU_matrix_push();
- GPU_matrix_translate_2f(vc->ar->winrct.xmin, vc->ar->winrct.ymin);
- x -= vc->ar->winrct.xmin;
- y -= vc->ar->winrct.ymin;
+ GPU_matrix_translate_2f(vc->region->winrct.xmin, vc->region->winrct.ymin);
+ x -= vc->region->winrct.xmin;
+ y -= vc->region->winrct.ymin;
/* Colored overlay should be drawn separately. */
if (col) {
@@ -973,7 +974,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez
static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc)
{
GPU_matrix_push();
- GPU_matrix_translate_2f(vc->ar->winrct.xmin, vc->ar->winrct.ymin);
+ GPU_matrix_translate_2f(vc->region->winrct.xmin, vc->region->winrct.ymin);
if (brush->paint_curve && brush->paint_curve->points) {
int i;
@@ -1100,7 +1101,7 @@ static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush)
}
static void cursor_draw_point_screen_space(const uint gpuattr,
- const ARegion *ar,
+ const ARegion *region,
const float true_location[3],
const float obmat[4][4],
const int size)
@@ -1108,7 +1109,7 @@ static void cursor_draw_point_screen_space(const uint gpuattr,
float translation_vertex_cursor[3], location[3];
copy_v3_v3(location, true_location);
mul_m4_v3(obmat, location);
- ED_view3d_project(ar, location, translation_vertex_cursor);
+ ED_view3d_project(region, location, translation_vertex_cursor);
/* Do not draw points behind the view. Z [near, far] is mapped to [-1, 1]. */
if (translation_vertex_cursor[2] <= 1.0f) {
imm_draw_circle_fill_3d(
@@ -1117,7 +1118,7 @@ static void cursor_draw_point_screen_space(const uint gpuattr,
}
static void cursor_draw_tiling_preview(const uint gpuattr,
- const ARegion *ar,
+ const ARegion *region,
const float true_location[3],
Sculpt *sd,
Object *ob,
@@ -1155,14 +1156,14 @@ static void cursor_draw_tiling_preview(const uint gpuattr,
for (int dim = 0; dim < 3; dim++) {
location[dim] = cur[dim] * step[dim] + orgLoc[dim];
}
- cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3);
+ cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3);
}
}
}
}
static void cursor_draw_point_with_symmetry(const uint gpuattr,
- const ARegion *ar,
+ const ARegion *region,
const float true_location[3],
Sculpt *sd,
Object *ob,
@@ -1176,10 +1177,10 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr,
/* Axis Symmetry. */
flip_v3_v3(location, true_location, (char)i);
- cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3);
+ cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3);
/* Tiling. */
- cursor_draw_tiling_preview(gpuattr, ar, location, sd, ob, radius);
+ cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius);
/* Radial Symmetry. */
for (char raxis = 0; raxis < 3; raxis++) {
@@ -1190,8 +1191,8 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr,
rotate_m4(symm_rot_mat, raxis + 'X', angle);
mul_m4_v3(symm_rot_mat, location);
- cursor_draw_tiling_preview(gpuattr, ar, location, sd, ob, radius);
- cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3);
+ cursor_draw_tiling_preview(gpuattr, region, location, sd, ob, radius);
+ cursor_draw_point_screen_space(gpuattr, region, location, ob->obmat, 3);
}
}
}
@@ -1233,8 +1234,8 @@ static bool paint_use_2d_cursor(ePaintMode mode)
static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
{
- ARegion *ar = CTX_wm_region(C);
- if (ar && ar->regiontype != RGN_TYPE_WINDOW) {
+ ARegion *region = CTX_wm_region(C);
+ if (region && region->regiontype != RGN_TYPE_WINDOW) {
return;
}
@@ -1291,8 +1292,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
if (ups->draw_anchored) {
final_radius = ups->anchored_size;
copy_v2_fl2(translation,
- ups->anchored_initial_mouse[0] + ar->winrct.xmin,
- ups->anchored_initial_mouse[1] + ar->winrct.ymin);
+ ups->anchored_initial_mouse[0] + region->winrct.xmin,
+ ups->anchored_initial_mouse[1] + region->winrct.ymin);
}
/* Make lines pretty. */
@@ -1368,7 +1369,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
bool is_multires = ss && ss->pbvh && BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS;
SculptCursorGeometryInfo gi;
- float mouse[2] = {x - ar->winrct.xmin, y - ar->winrct.ymin};
+ float mouse[2] = {x - region->winrct.xmin, y - region->winrct.ymin};
int prev_active_vertex_index = -1;
bool is_cursor_over_mesh = false;
@@ -1403,11 +1404,11 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
rds = BKE_brush_unprojected_radius_get(scene, brush);
}
- wmViewport(&ar->winrct);
+ wmViewport(&region->winrct);
/* Draw 3D active vertex preview with symmetry. */
if (len_v3v3(gi.active_vertex_co, gi.location) < rds) {
- cursor_draw_point_with_symmetry(pos, ar, gi.active_vertex_co, sd, vc.obact, rds);
+ cursor_draw_point_with_symmetry(pos, region, gi.active_vertex_co, sd, vc.obact, rds);
}
/* Draw pose brush origins. */
@@ -1433,7 +1434,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* Draw the pose brush rotation origins. */
for (int i = 0; i < ss->pose_ik_chain_preview->tot_segments; i++) {
cursor_draw_point_screen_space(pos,
- ar,
+ region,
ss->pose_ik_chain_preview->segments[i].initial_orig,
vc.obact->obmat,
3);
@@ -1445,7 +1446,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ED_view3d_draw_setup_view(CTX_wm_window(C),
CTX_data_depsgraph_pointer(C),
CTX_data_scene(C),
- ar,
+ region,
CTX_wm_view3d(C),
NULL,
NULL,
@@ -1529,7 +1530,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
}
else {
if (vc.obact->sculpt->cache && !vc.obact->sculpt->cache->first_time) {
- wmViewport(&ar->winrct);
+ wmViewport(&region->winrct);
/* Draw cached dynamic mesh preview lines. */
if (brush->sculpt_tool == SCULPT_TOOL_GRAB && (brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) &&
@@ -1539,7 +1540,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ED_view3d_draw_setup_view(CTX_wm_window(C),
CTX_data_depsgraph_pointer(C),
CTX_data_scene(C),
- ar,
+ region,
CTX_wm_view3d(C),
NULL,
NULL,
@@ -1558,7 +1559,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ED_view3d_draw_setup_view(CTX_wm_window(C),
CTX_data_depsgraph_pointer(C),
CTX_data_scene(C),
- ar,
+ region,
CTX_wm_view3d(C),
NULL,
NULL,
@@ -1575,7 +1576,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ED_view3d_draw_setup_view(CTX_wm_window(C),
CTX_data_depsgraph_pointer(C),
CTX_data_scene(C),
- ar,
+ region,
CTX_wm_view3d(C),
NULL,
NULL,
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 8a98b15088f..4578e211c97 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -196,7 +196,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
PaintCurve *pc;
PaintCurvePoint *pcp;
wmWindow *window = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float vec[3] = {loc[0], loc[1], 0.0};
int add_index;
int i;
@@ -250,7 +250,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
ED_paintcurve_undo_push_end();
- WM_paint_cursor_tag_redraw(window, ar);
+ WM_paint_cursor_tag_redraw(window, region);
}
static int paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -309,7 +309,7 @@ static int paintcurve_delete_point_exec(bContext *C, wmOperator *op)
PaintCurve *pc;
PaintCurvePoint *pcp;
wmWindow *window = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
int i;
int tot_del = 0;
pc = br->paint_curve;
@@ -361,7 +361,7 @@ static int paintcurve_delete_point_exec(bContext *C, wmOperator *op)
ED_paintcurve_undo_push_end();
- WM_paint_cursor_tag_redraw(window, ar);
+ WM_paint_cursor_tag_redraw(window, region);
return OPERATOR_FINISHED;
}
@@ -385,7 +385,7 @@ static bool paintcurve_point_select(
bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend)
{
wmWindow *window = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Paint *p = BKE_paint_get_active_from_context(C);
Brush *br = p->brush;
PaintCurve *pc;
@@ -477,7 +477,7 @@ static bool paintcurve_point_select(
ED_paintcurve_undo_push_end();
- WM_paint_cursor_tag_redraw(window, ar);
+ WM_paint_cursor_tag_redraw(window, region);
return true;
}
@@ -586,7 +586,7 @@ static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *e
}
if (pcp) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmWindow *window = CTX_wm_window(C);
PointSlideData *psd = MEM_mallocN(sizeof(PointSlideData), "PointSlideData");
copy_v2_v2_int(psd->initial_loc, event->mval);
@@ -609,7 +609,7 @@ static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *e
BKE_paint_curve_clamp_endpoint_add_index(pc, pcp - pc->points);
WM_event_add_modal_handler(C, op);
- WM_paint_cursor_tag_redraw(window, ar);
+ WM_paint_cursor_tag_redraw(window, region);
return OPERATOR_RUNNING_MODAL;
}
@@ -629,7 +629,7 @@ static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *ev
switch (event->type) {
case MOUSEMOVE: {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmWindow *window = CTX_wm_window(C);
float diff[2] = {event->mval[0] - psd->initial_loc[0], event->mval[1] - psd->initial_loc[1]};
if (psd->select == 1) {
@@ -648,7 +648,7 @@ static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *ev
add_v2_v2v2(psd->pcp->bez.vec[opposite], psd->pcp->bez.vec[1], diff);
}
}
- WM_paint_cursor_tag_redraw(window, ar);
+ WM_paint_cursor_tag_redraw(window, region);
break;
}
default:
@@ -727,7 +727,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w
switch (mode) {
case PAINT_MODE_TEXTURE_2D: {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceImage *sima = CTX_wm_space_image(C);
float location[2];
@@ -736,7 +736,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w
}
UI_view2d_region_to_view(
- &ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+ &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
copy_v2_v2(sima->cursor, location);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
break;
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index fe091dee4f8..32b0965363a 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -307,7 +307,7 @@ static void clip_planes_from_rect(bContext *C,
view3d_operator_needs_opengl(C);
ED_view3d_viewcontext_init(C, &vc, depsgraph);
- ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, rect);
+ ED_view3d_clipping_calc(&bb, clip_planes, vc.region, vc.obact, rect);
}
/* If mode is inside, get all PBVH nodes that lie at least partially
@@ -338,7 +338,7 @@ static void get_pbvh_nodes(
static int hide_show_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Mesh *me = ob->data;
@@ -403,7 +403,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
BKE_mesh_flush_hidden_from_verts(me);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index a36da7a17e6..8f4f304b3a1 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -289,9 +289,9 @@ static bool image_paint_poll_ex(bContext *C, bool check_tool)
SpaceImage *sima = CTX_wm_space_image(C);
if (sima) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if ((sima->mode == SI_MODE_PAINT) && ar->regiontype == RGN_TYPE_WINDOW) {
+ if ((sima->mode == SI_MODE_PAINT) && region->regiontype == RGN_TYPE_WINDOW) {
return 1;
}
}
@@ -440,7 +440,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
- ARegion *ar = pop->vc.ar;
+ ARegion *region = pop->vc.region;
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -449,7 +449,8 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
immBegin(GPU_PRIM_LINES, 2);
immVertex2i(pos, x, y);
- immVertex2i(pos, pop->startmouse[0] + ar->winrct.xmin, pop->startmouse[1] + ar->winrct.ymin);
+ immVertex2i(
+ pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
immEnd();
GPU_line_width(2.0);
@@ -457,7 +458,8 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
immBegin(GPU_PRIM_LINES, 2);
immVertex2i(pos, x, y);
- immVertex2i(pos, pop->startmouse[0] + ar->winrct.xmin, pop->startmouse[1] + ar->winrct.ymin);
+ immVertex2i(
+ pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
immEnd();
immUnbindProgram();
@@ -766,8 +768,8 @@ bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
if (sa && sa->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
if (sima->mode == SI_MODE_PAINT) {
- ARegion *ar = CTX_wm_region(C);
- ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
+ ARegion *region = CTX_wm_region(C);
+ ED_space_image_get_zoom(sima, region, zoomx, zoomy);
return 1;
}
}
@@ -871,10 +873,10 @@ static int grab_clone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
Brush *brush = image_paint_brush(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
GrabClone *cmv = op->customdata;
float startfx, startfy, fx, fy, delta[2];
- int xmin = ar->winrct.xmin, ymin = ar->winrct.ymin;
+ int xmin = region->winrct.xmin, ymin = region->winrct.ymin;
switch (event->type) {
case LEFTMOUSE:
@@ -885,8 +887,8 @@ static int grab_clone_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MOUSEMOVE:
/* mouse moved, so move the clone image */
UI_view2d_region_to_view(
- &ar->v2d, cmv->startx - xmin, cmv->starty - ymin, &startfx, &startfy);
- UI_view2d_region_to_view(&ar->v2d, event->x - xmin, event->y - ymin, &fx, &fy);
+ &region->v2d, cmv->startx - xmin, cmv->starty - ymin, &startfx, &startfy);
+ UI_view2d_region_to_view(&region->v2d, event->x - xmin, event->y - ymin, &fx, &fy);
delta[0] = fx - startfx;
delta[1] = fy - startfy;
@@ -965,14 +967,14 @@ static int sample_color_exec(bContext *C, wmOperator *op)
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmWindow *win = CTX_wm_window(C);
const bool show_cursor = ((paint->flags & PAINT_SHOW_BRUSH) != 0);
int location[2];
paint->flags &= ~PAINT_SHOW_BRUSH;
/* force redraw without cursor */
- WM_paint_cursor_tag_redraw(win, ar);
+ WM_paint_cursor_tag_redraw(win, region);
WM_redraw_windows(C);
RNA_int_get_array(op->ptr, "location", location);
@@ -980,7 +982,7 @@ static int sample_color_exec(bContext *C, wmOperator *op)
const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) &&
!RNA_boolean_get(op->ptr, "merged");
- paint_sample_color(C, ar, location[0], location[1], use_sample_texture, use_palette);
+ paint_sample_color(C, region, location[0], location[1], use_sample_texture, use_palette);
if (show_cursor) {
paint->flags |= PAINT_SHOW_BRUSH;
@@ -997,7 +999,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
SampleColorData *data = MEM_mallocN(sizeof(SampleColorData), "sample color custom data");
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmWindow *win = CTX_wm_window(C);
data->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
@@ -1012,7 +1014,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event
WM_event_add_modal_handler(C, op);
/* force redraw without cursor */
- WM_paint_cursor_tag_redraw(win, ar);
+ WM_paint_cursor_tag_redraw(win, region);
WM_redraw_windows(C);
RNA_int_set_array(op->ptr, "location", event->mval);
@@ -1021,7 +1023,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event
const bool use_sample_texture = (mode == PAINT_MODE_TEXTURE_3D) &&
!RNA_boolean_get(op->ptr, "merged");
- paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false);
+ paint_sample_color(C, region, event->mval[0], event->mval[1], use_sample_texture, false);
WM_cursor_modal_set(win, WM_CURSOR_EYEDROPPER);
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush);
@@ -1058,18 +1060,18 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case MOUSEMOVE: {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RNA_int_set_array(op->ptr, "location", event->mval);
- paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false);
+ paint_sample_color(C, region, event->mval[0], event->mval[1], use_sample_texture, false);
WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush);
break;
}
case LEFTMOUSE:
if (event->val == KM_PRESS) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RNA_int_set_array(op->ptr, "location", event->mval);
- paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, true);
+ paint_sample_color(C, region, event->mval[0], event->mval[1], use_sample_texture, true);
if (!data->sample_palette) {
data->sample_palette = true;
sample_color_update_header(data, C);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 163111ce32f..0f5ebcf9f71 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -244,7 +244,7 @@ typedef struct LoopSeamData {
typedef struct ProjPaintState {
View3D *v3d;
RegionView3D *rv3d;
- ARegion *ar;
+ ARegion *region;
Depsgraph *depsgraph;
Scene *scene;
/* PROJ_SRC_**** */
@@ -3719,8 +3719,8 @@ static void proj_paint_state_viewport_init(ProjPaintState *ps, const char symmet
if (ELEM(ps->source, PROJ_SRC_VIEW, PROJ_SRC_VIEW_FILL)) {
/* normal drawing */
- ps->winx = ps->ar->winx;
- ps->winy = ps->ar->winy;
+ ps->winx = ps->region->winx;
+ ps->winy = ps->region->winy;
copy_m4_m4(viewmat, ps->rv3d->viewmat);
copy_m4_m4(viewinv, ps->rv3d->viewinv);
@@ -5782,18 +5782,18 @@ void paint_proj_stroke(const bContext *C,
Scene *scene = ps_handle->scene;
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float *cursor = scene->cursor.location;
int mval_i[2] = {(int)pos[0], (int)pos[1]};
view3d_operator_needs_opengl(C);
- if (!ED_view3d_autodist(depsgraph, ar, v3d, mval_i, cursor, false, NULL)) {
+ if (!ED_view3d_autodist(depsgraph, region, v3d, mval_i, cursor, false, NULL)) {
return;
}
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return;
}
@@ -5847,7 +5847,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int
/* these can be NULL */
ps->v3d = CTX_wm_view3d(C);
ps->rv3d = CTX_wm_region_view3d(C);
- ps->ar = CTX_wm_region(C);
+ ps->region = CTX_wm_region(C);
ps->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ps->scene = scene;
@@ -6230,12 +6230,12 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- ARegion *ar = BKE_area_find_region_active_win(sa);
- if (!ar) {
+ ARegion *region = BKE_area_find_region_active_win(sa);
+ if (!region) {
BKE_report(op->reports, RPT_ERROR, "No 3D viewport found to create image from");
return OPERATOR_CANCELLED;
}
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
RNA_string_get(op->ptr, "filepath", filename);
@@ -6267,7 +6267,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
scene,
v3d_copy.shading.type,
&v3d_copy,
- ar,
+ region,
w,
h,
IB_rect,
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 2fe585aa9ea..018d7f72bb6 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -174,7 +174,7 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(struct Depsgraph *depsgraph,
void ED_vpaint_proj_handle_update(struct Depsgraph *depsgraph,
struct VertProjHandle *vp_handle,
/* runtime vars */
- struct ARegion *ar,
+ struct ARegion *region,
const float mval_fl[2]);
void ED_vpaint_proj_handle_free(struct VertProjHandle *vp_handle);
@@ -261,7 +261,7 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
bool paint_convert_bb_to_rect(struct rcti *rect,
const float bb_min[3],
const float bb_max[3],
- const struct ARegion *ar,
+ const struct ARegion *region,
struct RegionView3D *rv3d,
struct Object *ob);
@@ -269,7 +269,7 @@ bool paint_convert_bb_to_rect(struct rcti *rect,
* screen_rect from screen into object-space (essentially converting a
* 2D screens-space bounding box into four 3D planes) */
void paint_calc_redraw_planes(float planes[4][4],
- const struct ARegion *ar,
+ const struct ARegion *region,
struct Object *ob,
const struct rcti *screen_rect);
@@ -288,7 +288,7 @@ void paint_get_tex_pixel_col(const struct MTex *mtex,
struct ColorSpace *colorspace);
void paint_sample_color(
- struct bContext *C, struct ARegion *ar, int x, int y, bool texpaint_proj, bool palette);
+ struct bContext *C, struct ARegion *region, int x, int y, bool texpaint_proj, bool palette);
void paint_stroke_operator_properties(struct wmOperatorType *ot);
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index c8f4bdc0522..d6e5559b810 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -137,7 +137,7 @@ static void mask_flood_fill_task_cb(void *__restrict userdata,
static int mask_flood_fill_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
PaintMaskFloodMode mode;
@@ -184,7 +184,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
MEM_freeN(nodes);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
@@ -298,7 +298,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *
BoundBox bb;
float clip_planes[4][4];
float clip_planes_final[4][4];
- ARegion *ar = vc->ar;
+ ARegion *region = vc->region;
Object *ob = vc->obact;
PaintMaskFloodMode mode;
bool multires;
@@ -311,7 +311,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *
float value = select ? 1.0f : 0.0f;
/* Transform the clip planes in object space. */
- ED_view3d_clipping_calc(&bb, clip_planes, vc->ar, vc->obact, rect);
+ ED_view3d_clipping_calc(&bb, clip_planes, vc->region, vc->obact, rect);
BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true);
pbvh = ob->sculpt->pbvh;
@@ -361,7 +361,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *
SCULPT_undo_push_end();
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
@@ -392,7 +392,7 @@ static bool is_effected_lasso(LassoMaskData *data, float co[3])
flip_v3_v3(co_final, co, data->symmpass);
/* First project point to 2d space. */
- ED_view3d_project_float_v2_m4(data->vc->ar, co_final, scr_co_f, data->projviewobjmat);
+ ED_view3d_project_float_v2_m4(data->vc->region, co_final, scr_co_f, data->projviewobjmat);
scr_co_s[0] = scr_co_f[0];
scr_co_s[1] = scr_co_f[1];
@@ -498,7 +498,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
mask_lasso_px_cb,
&data);
- ED_view3d_clipping_calc(&bb, clip_planes, vc.ar, vc.obact, &data.rect);
+ ED_view3d_clipping_calc(&bb, clip_planes, vc.region, vc.obact, &data.rect);
BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true);
pbvh = ob->sculpt->pbvh;
@@ -550,7 +550,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
SCULPT_undo_push_end();
- ED_region_tag_redraw(vc.ar);
+ ED_region_tag_redraw(vc.region);
MEM_freeN((void *)mcords);
MEM_freeN(data.px);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 6ed0bf1b7ba..ee1cb09ae94 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -602,7 +602,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *br = BKE_paint_brush(paint);
float mvalf[2] = {event->mval[0], event->mval[1]};
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
StencilControlData *scd;
int mask = RNA_enum_get(op->ptr, "texmode");
@@ -627,8 +627,8 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
scd->mode = RNA_enum_get(op->ptr, "mode");
scd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
- scd->area_size[0] = ar->winx;
- scd->area_size[1] = ar->winy;
+ scd->area_size[0] = region->winx;
+ scd->area_size[1] = region->winy;
op->customdata = scd;
WM_event_add_modal_handler(C, op);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 90341fa8248..72422770587 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -145,7 +145,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
GPU_line_smooth(true);
GPU_blend(true);
- ARegion *ar = stroke->vc.ar;
+ ARegion *region = stroke->vc.region;
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -154,8 +154,8 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, x, y);
immVertex2f(pos,
- stroke->last_mouse_position[0] + ar->winrct.xmin,
- stroke->last_mouse_position[1] + ar->winrct.ymin);
+ stroke->last_mouse_position[0] + region->winrct.xmin,
+ stroke->last_mouse_position[1] + region->winrct.ymin);
immEnd();
@@ -191,21 +191,21 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immBegin(GPU_PRIM_LINES, 2);
- ARegion *ar = stroke->vc.ar;
+ ARegion *region = stroke->vc.region;
if (stroke->constrain_line) {
immVertex2f(shdr_pos,
- stroke->last_mouse_position[0] + ar->winrct.xmin,
- stroke->last_mouse_position[1] + ar->winrct.ymin);
+ stroke->last_mouse_position[0] + region->winrct.xmin,
+ stroke->last_mouse_position[1] + region->winrct.ymin);
immVertex2f(shdr_pos,
- stroke->constrained_pos[0] + ar->winrct.xmin,
- stroke->constrained_pos[1] + ar->winrct.ymin);
+ stroke->constrained_pos[0] + region->winrct.xmin,
+ stroke->constrained_pos[1] + region->winrct.ymin);
}
else {
immVertex2f(shdr_pos,
- stroke->last_mouse_position[0] + ar->winrct.xmin,
- stroke->last_mouse_position[1] + ar->winrct.ymin);
+ stroke->last_mouse_position[0] + region->winrct.xmin,
+ stroke->last_mouse_position[1] + region->winrct.ymin);
immVertex2f(shdr_pos, x, y);
}
@@ -796,7 +796,7 @@ static int paint_space_stroke(bContext *C,
float final_pressure)
{
const Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
PaintStroke *stroke = op->customdata;
UnifiedPaintSettings *ups = stroke->ups;
Paint *paint = BKE_paint_get_active_from_context(C);
@@ -847,7 +847,7 @@ static int paint_space_stroke(bContext *C,
add_v3_v3v3(final_world_space_position,
stroke->last_world_space_position,
final_world_space_position);
- ED_view3d_project(ar, final_world_space_position, mouse);
+ ED_view3d_project(region, final_world_space_position, mouse);
}
else {
mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing;
@@ -1511,11 +1511,11 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
* coming, so postpone potentially slow redraw updates until all are done */
if (event->type != INBETWEEN_MOUSEMOVE) {
wmWindow *window = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* At the very least, invalidate the cursor */
- if (ar && (p->flags & PAINT_SHOW_BRUSH)) {
- WM_paint_cursor_tag_redraw(window, ar);
+ if (region && (p->flags & PAINT_SHOW_BRUSH)) {
+ WM_paint_cursor_tag_redraw(window, region);
}
if (redraw && stroke->redraw) {
@@ -1598,10 +1598,10 @@ bool paint_poll(bContext *C)
Paint *p = BKE_paint_get_active_from_context(C);
Object *ob = CTX_data_active_object(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (p && ob && BKE_paint_brush(p) && (sa && ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) &&
- (ar && ar->regiontype == RGN_TYPE_WINDOW)) {
+ (region && region->regiontype == RGN_TYPE_WINDOW)) {
/* Check the current tool is a brush. */
bToolRef *tref = sa->runtime.tool;
if (tref && tref->runtime && tref->runtime->data_block[0]) {
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 19d890eeac3..bd43fddb652 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -84,7 +84,7 @@
bool paint_convert_bb_to_rect(rcti *rect,
const float bb_min[3],
const float bb_max[3],
- const ARegion *ar,
+ const ARegion *region,
RegionView3D *rv3d,
Object *ob)
{
@@ -109,7 +109,7 @@ bool paint_convert_bb_to_rect(rcti *rect,
vec[1] = j ? bb_min[1] : bb_max[1];
vec[2] = k ? bb_min[2] : bb_max[2];
/* convert corner to screen space */
- ED_view3d_project_float_v2_m4(ar, vec, proj, projection_mat);
+ ED_view3d_project_float_v2_m4(region, vec, proj, projection_mat);
/* expand 2D rectangle */
/* we could project directly to int? */
@@ -129,7 +129,7 @@ bool paint_convert_bb_to_rect(rcti *rect,
* screen_rect from screen into object-space (essentially converting a
* 2D screens-space bounding box into four 3D planes) */
void paint_calc_redraw_planes(float planes[4][4],
- const ARegion *ar,
+ const ARegion *region,
Object *ob,
const rcti *screen_rect)
{
@@ -143,7 +143,7 @@ void paint_calc_redraw_planes(float planes[4][4],
rect.ymin -= 2;
rect.ymax += 2;
- ED_view3d_clipping_calc(&bb, planes, ar, ob, &rect);
+ ED_view3d_clipping_calc(&bb, planes, region, ob, &rect);
}
float paint_calc_object_space_radius(ViewContext *vc, const float center[3], float pixel_radius)
@@ -156,7 +156,7 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3], flo
mul_v3_m4v3(loc, ob->obmat, center);
zfac = ED_view3d_calc_zfac(vc->rv3d, loc, NULL);
- ED_view3d_win_to_delta(vc->ar, mval_f, delta, zfac);
+ ED_view3d_win_to_delta(vc->region, mval_f, delta, zfac);
scale = fabsf(mat4_to_scale(ob->obmat));
scale = (scale == 0.0f) ? 1.0f : scale;
@@ -387,7 +387,7 @@ static int imapaint_pick_face(ViewContext *vc,
/* sample only on the exact position */
ED_view3d_select_id_validate(vc);
- *r_index = DRW_select_buffer_sample_point(vc->depsgraph, vc->ar, vc->v3d, mval);
+ *r_index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, mval);
if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) {
return 0;
@@ -456,7 +456,7 @@ void flip_qt_qt(float out[4], const float in[4], const ePaintSymmetryFlags symm)
/* used for both 3d view and image window */
void paint_sample_color(
- bContext *C, ARegion *ar, int x, int y, bool texpaint_proj, bool use_palette)
+ bContext *C, ARegion *region, int x, int y, bool texpaint_proj, bool use_palette)
{
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
@@ -467,8 +467,8 @@ void paint_sample_color(
unsigned int col;
const unsigned char *cp;
- CLAMP(x, 0, ar->winx);
- CLAMP(y, 0, ar->winy);
+ CLAMP(x, 0, region->winx);
+ CLAMP(y, 0, region->winy);
if (use_palette) {
if (!palette) {
@@ -583,7 +583,7 @@ void paint_sample_color(
if (!sample_success) {
glReadBuffer(GL_FRONT);
glReadPixels(
- x + ar->winrct.xmin, y + ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
+ x + region->winrct.xmin, y + region->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
}
else {
@@ -592,7 +592,8 @@ void paint_sample_color(
}
else {
glReadBuffer(GL_FRONT);
- glReadPixels(x + ar->winrct.xmin, y + ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
+ glReadPixels(
+ x + region->winrct.xmin, y + region->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
}
cp = (unsigned char *)&col;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 1b04ce5f97f..f957f2287f0 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -216,8 +216,8 @@ static bool vertex_paint_poll_ex(bContext *C, bool check_tool)
if (vertex_paint_mode_poll(C) && BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) {
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacetype == SPACE_VIEW3D) {
- ARegion *ar = CTX_wm_region(C);
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ ARegion *region = CTX_wm_region(C);
+ if (region->regiontype == RGN_TYPE_WINDOW) {
if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) {
return 1;
}
@@ -252,8 +252,8 @@ static bool weight_paint_poll_ex(bContext *C, bool check_tool)
if ((ob != NULL) && (ob->mode & OB_MODE_WEIGHT_PAINT) &&
(BKE_paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
(sa = CTX_wm_area(C)) && (sa->spacetype == SPACE_VIEW3D)) {
- ARegion *ar = CTX_wm_region(C);
- if (ELEM(ar->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) {
+ ARegion *region = CTX_wm_region(C);
+ if (ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_HUD)) {
if (!check_tool || WM_toolsystem_active_tool_is_brush(C)) {
return 1;
}
@@ -349,7 +349,7 @@ static void tex_color_alpha(VPaint *vp, const ViewContext *vc, const float co[3]
else {
float co_ss[2]; /* screenspace */
if (ED_view3d_project_float_object(
- vc->ar, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) ==
+ vc->region, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) ==
V3D_PROJ_RET_OK) {
const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f}; /* we need a 3rd empty value */
BKE_brush_sample_tex_3d(vc->scene, brush, co_ss_3d, r_rgba, 0, NULL);
@@ -2345,7 +2345,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
swap_m4m4(wpd->vc.rv3d->persmat, mat);
rcti r;
- if (SCULPT_get_redraw_rect(vc->ar, CTX_wm_region_view3d(C), ob, &r)) {
+ if (SCULPT_get_redraw_rect(vc->region, CTX_wm_region_view3d(C), ob, &r)) {
if (ss->cache) {
ss->cache->current_r = r;
}
@@ -2358,12 +2358,12 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
}
}
- r.xmin += vc->ar->winrct.xmin - 2;
- r.xmax += vc->ar->winrct.xmin + 2;
- r.ymin += vc->ar->winrct.ymin - 2;
- r.ymax += vc->ar->winrct.ymin + 2;
+ r.xmin += vc->region->winrct.xmin - 2;
+ r.xmax += vc->region->winrct.xmin + 2;
+ r.ymin += vc->region->winrct.ymin - 2;
+ r.ymax += vc->region->winrct.ymin + 2;
}
- ED_region_tag_redraw_partial(vc->ar, &r, true);
+ ED_region_tag_redraw_partial(vc->region, &r, true);
}
static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
@@ -3318,7 +3318,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
mul_v3_m4v3(loc_world, ob->obmat, ss->cache->true_location);
paint_last_stroke_update(scene, loc_world);
- ED_region_tag_redraw(vc->ar);
+ ED_region_tag_redraw(vc->region);
if (vpd->use_fast_update == false) {
/* recalculate modifier stack to get new colors, slow,
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index 7bca7745ca0..e9935ff3eeb 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -65,7 +65,7 @@ struct VertProjUpdate {
struct VertProjHandle *vp_handle;
/* runtime */
- ARegion *ar;
+ ARegion *region;
const float *mval_fl;
};
@@ -130,7 +130,7 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(
float co_ss[2]; /* screenspace */
if (ED_view3d_project_float_object(
- vp_update->ar, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) ==
+ vp_update->region, co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) ==
V3D_PROJ_RET_OK) {
const float dist_sq = len_squared_v2v2(vp_update->mval_fl, co_ss);
if (dist_sq > vp_handle->dists_sq[index]) {
@@ -158,10 +158,10 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb(
static void vpaint_proj_dm_map_cosnos_update(struct Depsgraph *depsgraph,
struct VertProjHandle *vp_handle,
- ARegion *ar,
+ ARegion *region,
const float mval_fl[2])
{
- struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl};
+ struct VertProjUpdate vp_update = {vp_handle, region, mval_fl};
Object *ob = vp_handle->ob;
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
@@ -216,11 +216,11 @@ struct VertProjHandle *ED_vpaint_proj_handle_create(struct Depsgraph *depsgraph,
void ED_vpaint_proj_handle_update(struct Depsgraph *depsgraph,
struct VertProjHandle *vp_handle,
- ARegion *ar,
+ ARegion *region,
const float mval_fl[2])
{
if (vp_handle->use_update) {
- vpaint_proj_dm_map_cosnos_update(depsgraph, vp_handle, ar, mval_fl);
+ vpaint_proj_dm_map_cosnos_update(depsgraph, vp_handle, region, mval_fl);
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 0d4fcd3e87d..4b8990c1b5d 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -318,8 +318,8 @@ static const EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C,
uint index;
const int mval[2] = {
- win->eventstate->x - vc.ar->winrct.xmin,
- win->eventstate->y - vc.ar->winrct.ymin,
+ win->eventstate->x - vc.region->winrct.xmin,
+ win->eventstate->y - vc.region->winrct.ymin,
};
view3d_operator_needs_opengl(C);
@@ -563,7 +563,7 @@ typedef struct WPGradient_vertStoreBase {
} WPGradient_vertStoreBase;
typedef struct WPGradient_userData {
- struct ARegion *ar;
+ struct ARegion *region;
Scene *scene;
Mesh *me;
Brush *brush;
@@ -671,7 +671,7 @@ static void gradientVertInit__mapFunc(void *userData,
}
if (ED_view3d_project_float_object(
- grad_data->ar, co, vs->sco, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) !=
+ grad_data->region, co, vs->sco, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) !=
V3D_PROJ_RET_OK) {
copy_v2_fl(vs->sco, FLT_MAX);
return;
@@ -733,7 +733,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
{
wmGesture *gesture = op->customdata;
WPGradient_vertStoreBase *vert_cache;
- struct ARegion *ar = CTX_wm_region(C);
+ struct ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
Mesh *me = ob->data;
@@ -778,7 +778,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
sizeof(WPGradient_vertStoreBase) + (sizeof(WPGradient_vertStore) * me->totvert), __func__);
}
- data.ar = ar;
+ data.region = region;
data.scene = scene;
data.me = ob->data;
data.sco_start = sco_start;
@@ -801,7 +801,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
data.weightpaint = BKE_brush_weight_get(scene, brush);
}
- ED_view3d_init_mats_rv3d(ob, ar->regiondata);
+ ED_view3d_init_mats_rv3d(ob, region->regiondata);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
@@ -843,8 +843,8 @@ static int paint_weight_gradient_invoke(bContext *C, wmOperator *op, const wmEve
ret = WM_gesture_straightline_invoke(C, op, event);
if (ret & OPERATOR_RUNNING_MODAL) {
- struct ARegion *ar = CTX_wm_region(C);
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ struct ARegion *region = CTX_wm_region(C);
+ if (region->regiontype == RGN_TYPE_WINDOW) {
/* TODO, hardcoded, extend WM_gesture_straightline_ */
if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
wmGesture *gesture = op->customdata;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 3f60d96b7ce..9241287ab5d 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1161,7 +1161,7 @@ static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect)
}
/* Get a screen-space rectangle of the modified area. */
-bool SCULPT_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, Object *ob, rcti *rect)
+bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect)
{
PBVH *pbvh = ob->sculpt->pbvh;
float bb_min[3], bb_max[3];
@@ -1173,14 +1173,14 @@ bool SCULPT_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, Object *ob, rcti *r
BKE_pbvh_redraw_BB(pbvh, bb_min, bb_max);
/* Convert 3D bounding box to screen space. */
- if (!paint_convert_bb_to_rect(rect, bb_min, bb_max, ar, rv3d, ob)) {
+ if (!paint_convert_bb_to_rect(rect, bb_min, bb_max, region, rv3d, ob)) {
return false;
}
return true;
}
-void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar, Object *ob)
+void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *region, Object *ob)
{
PBVH *pbvh = ob->sculpt->pbvh;
/* Copy here, original will be used below. */
@@ -1188,7 +1188,7 @@ void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar, Object *ob)
sculpt_extend_redraw_rect_previous(ob, &rect);
- paint_calc_redraw_planes(planes, ar, ob, &rect);
+ paint_calc_redraw_planes(planes, region, ob, &rect);
/* We will draw this rect, so now we can set it as the previous partial rect.
* Note that we don't update with the union of previous/current (rect), only with
@@ -2186,7 +2186,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
mul_m4_v3(cache->symm_rot_mat_inv, symm_point);
}
- ED_view3d_project_float_v2_m4(cache->vc->ar, symm_point, point_2d, cache->projection_mat);
+ ED_view3d_project_float_v2_m4(cache->vc->region, symm_point, point_2d, cache->projection_mat);
/* Still no symmetry supported for other paint modes.
* Sculpt does it DIY. */
@@ -2457,7 +2457,7 @@ static void calc_local_y(ViewContext *vc, const float center[3], float y[3])
mul_v3_m4v3(loc, ob->imat, center);
zfac = ED_view3d_calc_zfac(vc->rv3d, loc, NULL);
- ED_view3d_win_to_delta(vc->ar, mval_f, y, zfac);
+ ED_view3d_win_to_delta(vc->region, mval_f, y, zfac);
normalize_v3(y);
add_v3_v3(y, ob->loc);
@@ -6691,7 +6691,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
/* Compute 3d coordinate at same z from original location + mouse. */
mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location);
- ED_view3d_win_to_3d(cache->vc->v3d, cache->vc->ar, loc, mouse, grab_location);
+ ED_view3d_win_to_3d(cache->vc->v3d, cache->vc->region, loc, mouse, grab_location);
/* Compute delta to move verts by. */
if (!cache->first_time) {
@@ -7033,12 +7033,12 @@ static float sculpt_raycast_init(ViewContext *vc,
float obimat[4][4];
float dist;
Object *ob = vc->obact;
- RegionView3D *rv3d = vc->ar->regiondata;
+ RegionView3D *rv3d = vc->region->regiondata;
View3D *v3d = vc->v3d;
/* TODO: what if the segment is totally clipped? (return == 0). */
ED_view3d_win_to_segment_clipped(
- vc->depsgraph, vc->ar, vc->v3d, mouse, ray_start, ray_end, true);
+ vc->depsgraph, vc->region, vc->v3d, mouse, ray_start, ray_end, true);
invert_m4_m4(obimat, ob->obmat);
mul_m4_v3(obimat, ray_start);
@@ -7328,7 +7328,7 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags)
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MultiresModifierData *mmd = ss->multires;
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -7350,7 +7350,7 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags)
/* Slow update with full dependency graph update and all that comes with it.
* Needed when there are modifiers or full shading in the 3D viewport. */
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else {
/* Fast path where we just update the BVH nodes that changed, and redraw
@@ -7365,7 +7365,7 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags)
SCULPT_update_object_bounding_box(ob);
}
- if (SCULPT_get_redraw_rect(ar, CTX_wm_region_view3d(C), ob, &r)) {
+ if (SCULPT_get_redraw_rect(region, CTX_wm_region_view3d(C), ob, &r)) {
if (ss->cache) {
ss->cache->current_r = r;
}
@@ -7374,11 +7374,11 @@ static void sculpt_flush_update_step(bContext *C, SculptUpdateType update_flags)
* the partial rect will always grow */
sculpt_extend_redraw_rect_previous(ob, &r);
- r.xmin += ar->winrct.xmin - 2;
- r.xmax += ar->winrct.xmin + 2;
- r.ymin += ar->winrct.ymin - 2;
- r.ymax += ar->winrct.ymin + 2;
- ED_region_tag_redraw_partial(ar, &r, true);
+ r.xmin += region->winrct.xmin - 2;
+ r.xmax += region->winrct.xmin + 2;
+ r.ymin += region->winrct.ymin - 2;
+ r.ymax += region->winrct.ymin + 2;
+ ED_region_tag_redraw_partial(region, &r, true);
}
}
}
@@ -7413,9 +7413,9 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob, SculptUpdate
/* Tag all 3D viewports for redraw now that we are done. Others
* viewports did not get a full redraw, and anti-aliasing for the
* current viewport was deactivated. */
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- ED_region_tag_redraw(ar);
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ ED_region_tag_redraw(region);
}
}
}
@@ -8650,7 +8650,7 @@ static void sample_detail_voxel(bContext *C, ViewContext *vc, int mx, int my)
}
}
-static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *ar, int mx, int my)
+static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *region, int mx, int my)
{
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Object *ob = vc->obact;
@@ -8658,7 +8658,7 @@ static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *ar, int
sculpt_stroke_modifiers_check(C, ob, brush);
- float mouse[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
+ float mouse[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
float ray_start[3], ray_end[3], ray_normal[3];
float depth = sculpt_raycast_init(vc, mouse, ray_start, ray_end, ray_normal, false);
@@ -8682,8 +8682,8 @@ static int sample_detail(bContext *C, int mx, int my, int mode)
/* Find 3D view to pick from. */
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_VIEW3D, mx, my);
- ARegion *ar = (sa) ? BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my) : NULL;
- if (ar == NULL) {
+ ARegion *region = (sa) ? BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my) : NULL;
+ if (region == NULL) {
return OPERATOR_CANCELLED;
}
@@ -8691,7 +8691,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode)
ScrArea *prev_sa = CTX_wm_area(C);
ARegion *prev_ar = CTX_wm_region(C);
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewContext vc;
@@ -8712,7 +8712,7 @@ static int sample_detail(bContext *C, int mx, int my, int mode)
CTX_wm_region_set(C, prev_ar);
return OPERATOR_CANCELLED;
}
- sample_detail_dyntopo(C, &vc, ar, mx, my);
+ sample_detail_dyntopo(C, &vc, region, mx, my);
break;
case SAMPLE_DETAIL_VOXEL:
if (BKE_pbvh_type(ss->pbvh) != PBVH_FACES) {
@@ -9389,7 +9389,7 @@ static void mask_filter_task_cb(void *__restrict userdata,
static int sculpt_mask_filter_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
@@ -9456,7 +9456,7 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op)
SCULPT_undo_push_end();
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -9604,7 +9604,7 @@ static void dirty_mask_apply_task_cb(void *__restrict userdata,
static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
@@ -9657,7 +9657,7 @@ static int sculpt_dirty_mask_exec(bContext *C, wmOperator *op)
SCULPT_undo_push_end();
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
@@ -9775,7 +9775,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent *
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float prevclick_f[2];
copy_v2_v2(prevclick_f, op->customdata);
int prevclick[2] = {(int)prevclick_f[0], (int)prevclick_f[1]};
@@ -9882,7 +9882,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent *
}
if (mask_expand_update_it == ss->filter_cache->mask_update_current_it) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_RUNNING_MODAL;
}
@@ -10390,7 +10390,7 @@ static int sculpt_set_pivot_position_exec(bContext *C, wmOperator *op)
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
const char symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL;
@@ -10470,7 +10470,7 @@ static int sculpt_set_pivot_position_exec(bContext *C, wmOperator *op)
MEM_SAFE_FREE(nodes);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
@@ -10558,7 +10558,7 @@ static int sculpt_face_set_create_invoke(bContext *C, wmOperator *op, const wmEv
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
const int mode = RNA_enum_get(op->ptr, "mode");
@@ -10617,7 +10617,7 @@ static int sculpt_face_set_create_invoke(bContext *C, wmOperator *op, const wmEv
SCULPT_undo_push_end();
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
@@ -10693,7 +10693,7 @@ static int sculpt_face_sets_change_visibility_invoke(bContext *C,
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
/* Dyntopo and Multires not supported for now. */
@@ -10787,7 +10787,7 @@ static int sculpt_face_sets_change_visibility_invoke(bContext *C,
BKE_mesh_flush_hidden_from_verts(ob->data);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
View3D *v3d = CTX_wm_view3d(C);
if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
@@ -10825,7 +10825,7 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C,
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* Dyntopo and Multires not supported for now. */
if (BKE_pbvh_type(ss->pbvh) != PBVH_FACES) {
@@ -10853,7 +10853,7 @@ static int sculpt_face_sets_randomize_colors_invoke(bContext *C,
DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 612908edfa1..3d1c84511e6 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -666,6 +666,9 @@ void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
void SCULPT_update_object_bounding_box(struct Object *ob);
-bool SCULPT_get_redraw_rect(struct ARegion *ar, struct RegionView3D *rv3d, Object *ob, rcti *rect);
+bool SCULPT_get_redraw_rect(struct ARegion *region,
+ struct RegionView3D *rv3d,
+ Object *ob,
+ rcti *rect);
#endif
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 5beaff5ef00..b652c509db9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -313,7 +313,7 @@ static void uv_sculpt_stroke_apply(bContext *C,
{
float co[2], radius, radius_root;
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
unsigned int tool;
UvSculptData *sculptdata = (UvSculptData *)op->customdata;
@@ -327,11 +327,11 @@ static void uv_sculpt_stroke_apply(bContext *C,
tool = sculptdata->tool;
invert = sculptdata->invert ? -1 : 1;
alpha = BKE_brush_alpha_get(scene, brush);
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
sima = CTX_wm_space_image(C);
ED_space_image_get_size(sima, &width, &height);
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
radius = BKE_brush_size_get(scene, brush) / (width * zoomx);
aspectRatio = width / (float)height;
@@ -496,7 +496,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
if (data) {
int counter = 0, i;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
BMFace *efa;
MLoopUV *luv;
@@ -542,7 +542,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
}
/* Mouse coordinates, useful for some functions like grab and sculpt all islands */
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
/* we need to find the active island here */
if (do_island_optimization) {
@@ -704,7 +704,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
radius = BKE_brush_size_get(scene, brush);
sima = CTX_wm_space_image(C);
ED_space_image_get_size(sima, &width, &height);
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
aspectRatio = width / (float)height;
radius /= (width * zoomx);
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 0c57113956d..54308553343 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -64,13 +64,13 @@
/* Channel List */
/* left hand part */
-void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
+void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
size_t items;
/* build list of channels to draw */
@@ -100,7 +100,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
}
}
{ /* second pass: widgets */
- uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
size_t channel_index = 0;
float ymax = ACHANNEL_FIRST_TOP(ac);
@@ -132,12 +132,12 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
#define EXTRA_SCROLL_PAD 100.0f
/* draw keyframes in each channel */
-void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
+void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
bDopeSheet *ads = &saction->ads;
AnimData *adt = NULL;
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a1d8b9d0b2e..e01986181bc 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -372,7 +372,7 @@ static int actkeys_viewall(bContext *C, const bool only_sel)
if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
}
- v2d = &ac.ar->v2d;
+ v2d = &ac.region->v2d;
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
found = get_keyframe_extents(&ac, &min, &max, only_sel);
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index c227b794ae7..006ba86a50a 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -42,8 +42,10 @@ void action_buttons_register(struct ARegionType *art);
/* ***************************************** */
/* action_draw.c */
-void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar);
-void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
+void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region);
+void draw_channel_strips(struct bAnimContext *ac,
+ struct SpaceAction *saction,
+ struct ARegion *region);
void timeline_draw_cache(struct SpaceAction *saction, struct Object *ob, struct Scene *scene);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 095b30aa57b..458c8690e3c 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -71,7 +71,7 @@ static bAnimListElem *actkeys_find_list_element_at_position(bAnimContext *ac,
float region_x,
float region_y)
{
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
float view_x, view_y;
int channel_index;
@@ -158,7 +158,7 @@ static void actkeys_find_key_in_list_element(bAnimContext *ac,
{
*r_found = false;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
DLRBT_Tree anim_keys;
BLI_dlrbTree_init(&anim_keys);
@@ -458,7 +458,7 @@ static void box_select_action(bAnimContext *ac, const rcti rect, short mode, sho
int filter;
BoxSelectData sel_data = {.ac = ac, .selectmode = selectmode};
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
rctf rectf;
/* Convert mouse coordinates to frame ranges and channel
@@ -697,7 +697,7 @@ static void region_select_action_keys(
int filter;
RegionSelectData sel_data = {.ac = ac, .mode = mode, .selectmode = selectmode};
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
rctf rectf, scaled_rectf;
/* Convert mouse coordinates to frame ranges and channel
@@ -1470,8 +1470,8 @@ static int actkeys_select_leftright_invoke(bContext *C, wmOperator *op, const wm
/* handle mode-based testing */
if (leftright == ACTKEYS_LRSEL_TEST) {
Scene *scene = ac.scene;
- ARegion *ar = ac.ar;
- View2D *v2d = &ar->v2d;
+ ARegion *region = ac.region;
+ View2D *v2d = &region->v2d;
float x;
/* determine which side of the current frame mouse is on */
@@ -1825,7 +1825,7 @@ static int actkeys_clickselect_exec(bContext *C, wmOperator *op)
}
/* get useful pointers from animation context data */
- /* ar = ac.ar; */ /* UNUSED */
+ /* region = ac.region; */ /* UNUSED */
/* select mode is either replace (deselect all, then add) or add/extend */
const short selectmode = RNA_boolean_get(op->ptr, "extend") ? SELECT_INVERT : SELECT_REPLACE;
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index f06b1a02675..af59b56065c 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -63,7 +63,7 @@
static SpaceLink *action_new(const ScrArea *sa, const Scene *scene)
{
SpaceAction *saction;
- ARegion *ar;
+ ARegion *region;
saction = MEM_callocN(sizeof(SpaceAction), "initaction");
saction->spacetype = SPACE_ACTION;
@@ -82,57 +82,57 @@ static SpaceLink *action_new(const ScrArea *sa, const Scene *scene)
saction->cache_display |= TIME_CACHE_RIGIDBODY;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for action");
+ region = MEM_callocN(sizeof(ARegion), "header for action");
- BLI_addtail(&saction->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&saction->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* channel list region */
- ar = MEM_callocN(sizeof(ARegion), "channel region for action");
- BLI_addtail(&saction->regionbase, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
+ region = MEM_callocN(sizeof(ARegion), "channel region for action");
+ BLI_addtail(&saction->regionbase, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
/* only need to set scroll settings, as this will use 'listview' v2d configuration */
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* ui buttons */
- ar = MEM_callocN(sizeof(ARegion), "buttons region for action");
+ region = MEM_callocN(sizeof(ARegion), "buttons region for action");
- BLI_addtail(&saction->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&saction->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for action");
+ region = MEM_callocN(sizeof(ARegion), "main region for action");
- BLI_addtail(&saction->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&saction->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin = (float)(SFRA - 10);
- ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
- ar->v2d.tot.xmax = (float)(EFRA + 10);
- ar->v2d.tot.ymax = 0.0f;
+ region->v2d.tot.xmin = (float)(SFRA - 10);
+ region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ region->v2d.tot.xmax = (float)(EFRA + 10);
+ region->v2d.tot.ymax = 0.0f;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = 0.0f;
- ar->v2d.min[1] = 0.0f;
+ region->v2d.min[0] = 0.0f;
+ region->v2d.min[1] = 0.0f;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = FLT_MAX;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = FLT_MAX;
- ar->v2d.minzoom = 0.01f;
- ar->v2d.maxzoom = 50;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
- ar->v2d.keepofs = V2D_KEEPOFS_Y;
- ar->v2d.align = V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.minzoom = 0.01f;
+ region->v2d.maxzoom = 50;
+ region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.keepzoom = V2D_LOCKZOOM_Y;
+ region->v2d.keepofs = V2D_KEEPOFS_Y;
+ region->v2d.align = V2D_ALIGN_NO_POS_Y;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
return (SpaceLink *)saction;
}
@@ -160,27 +160,27 @@ static SpaceLink *action_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void action_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void action_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void action_main_region_draw(const bContext *C, ARegion *ar)
+static void action_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceAction *saction = CTX_wm_space_action(C);
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
bAnimContext ac;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
short marker_flag = 0;
short cfra_flag = 0;
@@ -194,14 +194,14 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
/* time grid */
UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, saction->flag & SACTION_DRAWTIME);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
/* start and end frame */
ANIM_draw_framerange(scene, v2d);
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_channel_strips(&ac, saction, ar);
+ draw_channel_strips(&ac, saction, region);
}
/* current frame */
@@ -211,7 +211,7 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, cfra_flag);
/* markers */
- UI_view2d_view_orthoSpecial(ar, v2d, 1);
+ UI_view2d_view_orthoSpecial(region, v2d, 1);
marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) |
DRAW_MARKERS_MARGIN;
@@ -231,13 +231,13 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
/* callback */
UI_view2d_view_ortho(v2d);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrubbing region */
- ED_time_scrub_draw(ar, scene, saction->flag & SACTION_DRAWTIME, true);
+ ED_time_scrub_draw(region, scene, saction->flag & SACTION_DRAWTIME, true);
/* scrollers */
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
@@ -246,28 +246,28 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void action_channel_region_init(wmWindowManager *wm, ARegion *ar)
+static void action_channel_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* ensure the 2d view sync works - main region has bottom scroller */
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void action_channel_region_draw(const bContext *C, ARegion *ar)
+static void action_channel_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
bAnimContext ac;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -277,11 +277,11 @@ static void action_channel_region_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_channel_names((bContext *)C, &ac, ar);
+ draw_channel_names((bContext *)C, &ac, region);
}
/* channel filter next to scrubbing area */
- ED_time_scrub_channel_search_draw(C, ar, ac.ads);
+ ED_time_scrub_channel_search_draw(C, region, ac.ads);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -290,32 +290,32 @@ static void action_channel_region_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void action_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void action_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void action_header_region_draw(const bContext *C, ARegion *ar)
+static void action_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void action_channel_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_FRAME:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -324,28 +324,28 @@ static void action_channel_region_listener(wmWindow *UNUSED(win),
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_MODIFIER:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
break;
case NC_GPENCIL:
if (ELEM(wmn->action, NA_RENAME, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -356,15 +356,15 @@ static void saction_channel_region_message_subscribe(const struct bContext *UNUS
struct Scene *UNUSED(scene),
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, sa->spacedata.first, &ptr);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -398,14 +398,14 @@ static void saction_channel_region_message_subscribe(const struct bContext *UNUS
static void action_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
@@ -414,7 +414,7 @@ static void action_main_region_listener(wmWindow *UNUSED(win),
case ND_FRAME:
case ND_FRAME_RANGE:
case ND_MARKERS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -426,30 +426,30 @@ static void action_main_region_listener(wmWindow *UNUSED(win),
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_NODE:
switch (wmn->action) {
case NA_EDITED:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -460,15 +460,15 @@ static void saction_main_region_message_subscribe(const struct bContext *C,
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, sa->spacedata.first, &ptr);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -497,7 +497,7 @@ static void saction_main_region_message_subscribe(const struct bContext *C,
}
/* Now run the general "channels region" one - since channels and main should be in sync */
- saction_channel_region_message_subscribe(C, workspace, scene, screen, sa, ar, mbus);
+ saction_channel_region_message_subscribe(C, workspace, scene, screen, sa, region, mbus);
}
/* editor level listener */
@@ -563,11 +563,11 @@ static void action_listener(wmWindow *UNUSED(win),
ED_area_tag_redraw(sa);
break;
case ND_FRAME_RANGE:
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
Scene *scene = wmn->reference;
- ar->v2d.tot.xmin = (float)(SFRA - 4);
- ar->v2d.tot.xmax = (float)(EFRA + 4);
+ region->v2d.tot.xmin = (float)(SFRA - 4);
+ region->v2d.tot.xmax = (float)(EFRA + 4);
break;
}
}
@@ -655,8 +655,11 @@ static void action_listener(wmWindow *UNUSED(win),
}
}
-static void action_header_region_listener(
- wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar, wmNotifier *wmn, const Scene *UNUSED(scene))
+static void action_header_region_listener(wmWindow *UNUSED(win),
+ ScrArea *sa,
+ ARegion *region,
+ wmNotifier *wmn,
+ const Scene *UNUSED(scene))
{
SpaceAction *saction = (SpaceAction *)sa->spacedata.first;
@@ -665,7 +668,7 @@ static void action_header_region_listener(
case NC_SCREEN:
if (saction->mode == SACTCONT_TIMELINE) {
if (wmn->data == ND_ANIMPLAY) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
break;
@@ -678,21 +681,21 @@ static void action_header_region_listener(
case ND_FRAME_RANGE:
case ND_KEYINGSET:
case ND_RENDER_OPTIONS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
}
else {
switch (wmn->data) {
case ND_OB_ACTIVE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ANIMATION:
@@ -701,12 +704,12 @@ static void action_header_region_listener(
/* NOTE: for now, this should usually just mean that the filters changed
* It may be better if we had a dedicated flag for that though
*/
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_KEYFRAME: /* new keyframed added -> active action may have changed */
// saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -714,38 +717,38 @@ static void action_header_region_listener(
}
/* add handlers, stuff you only do once or on area/region changes */
-static void action_buttons_area_init(wmWindowManager *wm, ARegion *ar)
+static void action_buttons_area_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Dopesheet Generic", SPACE_ACTION, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void action_buttons_area_draw(const bContext *C, ARegion *ar)
+static void action_buttons_area_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void action_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_FRAME:
case ND_MARKERS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -754,13 +757,13 @@ static void action_region_listener(wmWindow *UNUSED(win),
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -774,7 +777,7 @@ static void action_refresh(const bContext *C, ScrArea *sa)
* NOTE: the temp flag is used to indicate when this needs to be done,
* and will be cleared once handled. */
if (saction->runtime.flag & SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC) {
- ARegion *ar;
+ ARegion *region;
/* Perform syncing of channel state incl. selection
* Active action setting also occurs here
@@ -787,8 +790,8 @@ static void action_refresh(const bContext *C, ScrArea *sa)
* or else they don't update [#28962]
*/
ED_area_tag_redraw(sa);
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ED_region_tag_redraw(ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ ED_region_tag_redraw(region);
}
}
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 9056bbb1246..d34b1ccb899 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -263,13 +263,13 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle)
}
}
-void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
+void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type)
{
RegionDrawCB *rdc;
- for (rdc = ar->type->drawcalls.first; rdc; rdc = rdc->next) {
+ for (rdc = region->type->drawcalls.first; rdc; rdc = rdc->next) {
if (rdc->type == type) {
- rdc->draw(C, ar, rdc->customdata);
+ rdc->draw(C, region, rdc->customdata);
}
}
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 17d4790bbc4..6d4cb65522e 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -54,7 +54,7 @@
static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceProperties *sbuts;
sbuts = MEM_callocN(sizeof(SpaceProperties), "initbuts");
@@ -63,32 +63,32 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s
sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for buts");
+ region = MEM_callocN(sizeof(ARegion), "header for buts");
- BLI_addtail(&sbuts->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sbuts->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* navigation bar */
- ar = MEM_callocN(sizeof(ARegion), "navigation bar for buts");
+ region = MEM_callocN(sizeof(ARegion), "navigation bar for buts");
- BLI_addtail(&sbuts->regionbase, ar);
- ar->regiontype = RGN_TYPE_NAV_BAR;
- ar->alignment = RGN_ALIGN_LEFT;
+ BLI_addtail(&sbuts->regionbase, region);
+ region->regiontype = RGN_TYPE_NAV_BAR;
+ region->alignment = RGN_ALIGN_LEFT;
#if 0
/* context region */
- ar = MEM_callocN(sizeof(ARegion), "context region for buts");
- BLI_addtail(&sbuts->regionbase, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_TOP;
+ region = MEM_callocN(sizeof(ARegion), "context region for buts");
+ BLI_addtail(&sbuts->regionbase, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_TOP;
#endif
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for buts");
+ region = MEM_callocN(sizeof(ARegion), "main region for buts");
- BLI_addtail(&sbuts->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sbuts->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)sbuts;
}
@@ -126,19 +126,19 @@ static SpaceLink *buttons_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void buttons_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Property Editor", SPACE_PROPERTIES, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
static void buttons_main_region_layout_properties(const bContext *C,
SpaceProperties *sbuts,
- ARegion *ar)
+ ARegion *region)
{
buttons_context_compute(C, sbuts);
@@ -199,19 +199,20 @@ static void buttons_main_region_layout_properties(const bContext *C,
}
const bool vertical = true;
- ED_region_panels_layout_ex(C, ar, &ar->type->paneltypes, contexts, sbuts->mainb, vertical, NULL);
+ ED_region_panels_layout_ex(
+ C, region, &region->type->paneltypes, contexts, sbuts->mainb, vertical, NULL);
}
-static void buttons_main_region_layout(const bContext *C, ARegion *ar)
+static void buttons_main_region_layout(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceProperties *sbuts = CTX_wm_space_properties(C);
if (sbuts->mainb == BCONTEXT_TOOL) {
- ED_view3d_buttons_region_layout_ex(C, ar, "Tool");
+ ED_view3d_buttons_region_layout_ex(C, region, "Tool");
}
else {
- buttons_main_region_layout_properties(C, sbuts, ar);
+ buttons_main_region_layout_properties(C, sbuts, region);
}
sbuts->mainbo = sbuts->mainb;
@@ -219,7 +220,7 @@ static void buttons_main_region_layout(const bContext *C, ARegion *ar)
static void buttons_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -227,7 +228,7 @@ static void buttons_main_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -246,27 +247,27 @@ static void buttons_keymap(struct wmKeyConfig *keyconf)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void buttons_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void buttons_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
#ifdef USE_HEADER_CONTEXT_PATH
/* Reinsert context buttons header-type at the end of the list so it's drawn last. */
HeaderType *context_ht = BLI_findstring(
- &ar->type->headertypes, "BUTTONS_HT_context", offsetof(HeaderType, idname));
- BLI_remlink(&ar->type->headertypes, context_ht);
- BLI_addtail(&ar->type->headertypes, context_ht);
+ &region->type->headertypes, "BUTTONS_HT_context", offsetof(HeaderType, idname));
+ BLI_remlink(&region->type->headertypes, context_ht);
+ BLI_addtail(&region->type->headertypes, context_ht);
#endif
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void buttons_header_region_draw(const bContext *C, ARegion *ar)
+static void buttons_header_region_draw(const bContext *C, ARegion *region)
{
SpaceProperties *sbuts = CTX_wm_space_properties(C);
/* Needed for RNA to get the good values! */
buttons_context_compute(C, sbuts);
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void buttons_header_region_message_subscribe(const bContext *UNUSED(C),
@@ -274,13 +275,13 @@ static void buttons_header_region_message_subscribe(const bContext *UNUSED(C),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
struct wmMsgBus *mbus)
{
SpaceProperties *sbuts = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -301,24 +302,24 @@ static void buttons_header_region_message_subscribe(const bContext *UNUSED(C),
#endif
}
-static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *ar)
+static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *region)
{
- ar->flag |= RGN_FLAG_PREFSIZE_OR_HIDDEN;
+ region->flag |= RGN_FLAG_PREFSIZE_OR_HIDDEN;
- ED_region_panels_init(wm, ar);
- ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
+ ED_region_panels_init(wm, region);
+ region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
}
-static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *ar)
+static void buttons_navigation_bar_region_draw(const bContext *C, ARegion *region)
{
- for (PanelType *pt = ar->type->paneltypes.first; pt; pt = pt->next) {
+ for (PanelType *pt = region->type->paneltypes.first; pt; pt = pt->next) {
pt->flag |= PNL_LAYOUT_VERT_BAR;
}
- ED_region_panels_layout(C, ar);
+ ED_region_panels_layout(C, region);
/* ED_region_panels_layout adds vertical scrollbars, we don't want them. */
- ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL;
- ED_region_panels_draw(C, ar);
+ region->v2d.scroll &= ~V2D_SCROLL_VERTICAL;
+ ED_region_panels_draw(C, region);
}
static void buttons_navigation_bar_region_message_subscribe(const bContext *UNUSED(C),
@@ -326,12 +327,12 @@ static void buttons_navigation_bar_region_message_subscribe(const bContext *UNUS
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index e64f21f9307..e5c82a4a80e 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -79,9 +79,9 @@ static void draw_keyframe_shape(
immVertex2f(pos_id, x, y);
}
-static void clip_draw_dopesheet_background(ARegion *ar, MovieClip *clip, unsigned int pos_id)
+static void clip_draw_dopesheet_background(ARegion *region, MovieClip *clip, unsigned int pos_id)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
MovieTracking *tracking = &clip->tracking;
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
MovieTrackingDopesheetCoverageSegment *coverage_segment;
@@ -105,10 +105,10 @@ static void clip_draw_dopesheet_background(ARegion *ar, MovieClip *clip, unsigne
}
}
-void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
+void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* frame range */
clip_draw_sfra_efra(v2d, scene);
@@ -142,7 +142,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
GPU_blend(true);
- clip_draw_dopesheet_background(ar, clip, pos_id);
+ clip_draw_dopesheet_background(region, clip, pos_id);
for (channel = dopesheet->channels.first; channel; channel = channel->next) {
float yminc = (float)(y - CHANNEL_HEIGHT_HALF);
@@ -290,11 +290,11 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
}
}
-void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
+void clip_draw_dopesheet_channels(const bContext *C, ARegion *region)
{
ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
MovieClip *clip = ED_space_clip_get_clip(sc);
uiStyle *style = UI_style_get();
int fontid = style->widget.uifont_id;
@@ -380,7 +380,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
}
/* third pass: widgets */
- uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
y = (float)CHANNEL_FIRST;
/* get RNA properties (once) */
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
index 785ced96b13..fbe92195a65 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c
@@ -51,9 +51,9 @@ static bool space_clip_dopesheet_poll(bContext *C)
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc->view == SC_VIEW_DOPESHEET) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- return ar->regiontype == RGN_TYPE_PREVIEW;
+ return region->regiontype == RGN_TYPE_PREVIEW;
}
}
@@ -123,10 +123,11 @@ static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
static int dopesheet_select_channel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
return dopesheet_select_channel_exec(C, op);
@@ -170,8 +171,8 @@ void CLIP_OT_dopesheet_select_channel(wmOperatorType *ot)
static int dopesheet_view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
@@ -194,7 +195,7 @@ static int dopesheet_view_all_exec(bContext *C, wmOperator *UNUSED(op))
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index f9899135e2d..45502d1eb81 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -143,11 +143,11 @@ static bool generic_track_is_marker_keyframed(MovieTrackingTrack *track,
return false;
}
-static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Scene *scene)
+static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip, Scene *scene)
{
float x;
int *points, totseg, i, a;
- float sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
+ float sfra = SFRA, efra = EFRA, framelen = region->winx / (efra - sfra + 1);
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *act_object = BKE_tracking_object_get_active(tracking);
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(&clip->tracking);
@@ -159,11 +159,11 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* cache background */
- ED_region_cache_draw_background(ar);
+ ED_region_cache_draw_background(region);
/* cached segments -- could be useful to debug caching strategies */
BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points);
- ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra);
+ ED_region_cache_draw_cached_segments(region, totseg, points, sfra, efra);
uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
@@ -249,7 +249,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
GPU_blend(false);
/* current frame */
- x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
+ x = (sc->user.framenr - sfra) / (efra - sfra + 1) * region->winx;
immUniformThemeColor(TH_CFRAME);
immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC);
@@ -270,11 +270,11 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
/* movie clip animation */
if ((sc->mode == SC_MODE_MASKEDIT) && sc->mask_info.mask) {
- ED_mask_draw_frames(sc->mask_info.mask, ar, CFRA, sfra, efra);
+ ED_mask_draw_frames(sc->mask_info.mask, region, CFRA, sfra, efra);
}
}
-static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
+static void draw_movieclip_notes(SpaceClip *sc, ARegion *region)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -293,11 +293,11 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
if (str[0]) {
float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.6f};
- ED_region_info_draw(ar, str, fill_color, full_redraw);
+ ED_region_info_draw(region, str, fill_color, full_redraw);
}
}
-static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx, float zoomy)
+static void draw_movieclip_muted(ARegion *region, int width, int height, float zoomx, float zoomy)
{
int x, y;
@@ -305,7 +305,7 @@ static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* find window pixel coordinates of origin */
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
immUniformColor3f(0.0f, 0.0f, 0.0f);
immRectf(pos, x, y, x + zoomx * width, y + zoomy * height);
@@ -315,7 +315,7 @@ static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx
static void draw_movieclip_buffer(const bContext *C,
SpaceClip *sc,
- ARegion *ar,
+ ARegion *region,
ImBuf *ibuf,
int width,
int height,
@@ -327,7 +327,7 @@ static void draw_movieclip_buffer(const bContext *C,
int x, y;
/* find window pixel coordinates of origin */
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
/* checkerboard for case alpha */
if (ibuf->planes == 32) {
@@ -359,13 +359,13 @@ static void draw_movieclip_buffer(const bContext *C,
}
static void draw_stabilization_border(
- SpaceClip *sc, ARegion *ar, int width, int height, float zoomx, float zoomy)
+ SpaceClip *sc, ARegion *region, int width, int height, float zoomx, float zoomy)
{
int x, y;
MovieClip *clip = ED_space_clip_get_clip(sc);
/* find window pixel coordinates of origin */
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
/* draw boundary border for frame if stabilization is enabled */
if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
@@ -1459,7 +1459,7 @@ static void draw_plane_track(SpaceClip *sc,
/* Draw all kind of tracks. */
static void draw_tracking_tracks(SpaceClip *sc,
Scene *scene,
- ARegion *ar,
+ ARegion *region,
MovieClip *clip,
int width,
int height,
@@ -1484,7 +1484,7 @@ static void draw_tracking_tracks(SpaceClip *sc,
* to avoid this flickering, calculate base point in the same way as it happens
* in UI_view2d_view_to_region_no_clip, but do it in floats here */
- UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region_fl(&region->v2d, 0.0f, 0.0f, &x, &y);
GPU_matrix_push();
GPU_matrix_translate_2f(x, y);
@@ -1721,8 +1721,13 @@ static void draw_tracking_tracks(SpaceClip *sc,
}
}
-static void draw_distortion(
- SpaceClip *sc, ARegion *ar, MovieClip *clip, int width, int height, float zoomx, float zoomy)
+static void draw_distortion(SpaceClip *sc,
+ ARegion *region,
+ MovieClip *clip,
+ int width,
+ int height,
+ float zoomx,
+ float zoomy)
{
float x, y;
const int n = 10;
@@ -1742,7 +1747,7 @@ static void draw_distortion(
return;
}
- UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region_fl(&region->v2d, 0.0f, 0.0f, &x, &y);
GPU_matrix_push();
GPU_matrix_translate_2f(x, y);
@@ -1934,7 +1939,7 @@ static void draw_distortion(
GPU_matrix_pop();
}
-void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
+void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *region)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
Scene *scene = CTX_data_scene(C);
@@ -1943,11 +1948,11 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
float zoomx, zoomy;
ED_space_clip_get_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_zoom(sc, region, &zoomx, &zoomy);
/* if no clip, nothing to do */
if (!clip) {
- ED_region_grid_draw(ar, zoomx, zoomy, 0.0f, 0.0f);
+ ED_region_grid_draw(region, zoomx, zoomy, 0.0f, 0.0f);
return;
}
@@ -1987,30 +1992,30 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar)
}
if (ibuf) {
- draw_movieclip_buffer(C, sc, ar, ibuf, width, height, zoomx, zoomy);
+ draw_movieclip_buffer(C, sc, region, ibuf, width, height, zoomx, zoomy);
IMB_freeImBuf(ibuf);
}
else if (sc->flag & SC_MUTE_FOOTAGE) {
- draw_movieclip_muted(ar, width, height, zoomx, zoomy);
+ draw_movieclip_muted(region, width, height, zoomx, zoomy);
}
else {
- ED_region_grid_draw(ar, zoomx, zoomy, 0.0f, 0.0f);
+ ED_region_grid_draw(region, zoomx, zoomy, 0.0f, 0.0f);
}
if (width && height) {
- draw_stabilization_border(sc, ar, width, height, zoomx, zoomy);
- draw_tracking_tracks(sc, scene, ar, clip, width, height, zoomx, zoomy);
- draw_distortion(sc, ar, clip, width, height, zoomx, zoomy);
+ draw_stabilization_border(sc, region, width, height, zoomx, zoomy);
+ draw_tracking_tracks(sc, scene, region, clip, width, height, zoomx, zoomy);
+ draw_distortion(sc, region, clip, width, height, zoomx, zoomy);
}
}
-void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar)
+void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
if (clip) {
- draw_movieclip_cache(sc, ar, clip, scene);
- draw_movieclip_notes(sc, ar);
+ draw_movieclip_cache(sc, region, clip, scene);
+ draw_movieclip_notes(sc, region);
}
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 2114c4cac79..9716ef48262 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -147,14 +147,16 @@ void ED_space_clip_get_size_fl(SpaceClip *sc, float size[2])
size[1] = size_i[1];
}
-void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
+void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *region, float *zoomx, float *zoomy)
{
int width, height;
ED_space_clip_get_size(sc, &width, &height);
- *zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / (BLI_rctf_size_x(&ar->v2d.cur) * width);
- *zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / (BLI_rctf_size_y(&ar->v2d.cur) * height);
+ *zoomx = (float)(BLI_rcti_size_x(&region->winrct) + 1) /
+ (BLI_rctf_size_x(&region->v2d.cur) * width);
+ *zoomy = (float)(BLI_rcti_size_y(&region->winrct) + 1) /
+ (BLI_rctf_size_y(&region->v2d.cur) * height);
}
void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
@@ -261,7 +263,7 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale
}
/* Returns color in linear space, matching ED_space_image_color_sample(). */
-bool ED_space_clip_color_sample(SpaceClip *sc, ARegion *ar, int mval[2], float r_col[3])
+bool ED_space_clip_color_sample(SpaceClip *sc, ARegion *region, int mval[2], float r_col[3])
{
ImBuf *ibuf;
float fx, fy, co[2];
@@ -273,7 +275,7 @@ bool ED_space_clip_color_sample(SpaceClip *sc, ARegion *ar, int mval[2], float r
}
/* map the mouse coords to the backdrop image space */
- ED_clip_mouse_pos(sc, ar, mval, co);
+ ED_clip_mouse_pos(sc, region, mval, co);
fx = co[0];
fy = co[1];
@@ -395,7 +397,7 @@ static bool selected_boundbox(const bContext *C, float min[2], float max[2])
}
}
-bool ED_clip_view_selection(const bContext *C, ARegion *ar, bool fit)
+bool ED_clip_view_selection(const bContext *C, ARegion *region, bool fit)
{
SpaceClip *sc = CTX_wm_space_clip(C);
int w, h, frame_width, frame_height;
@@ -425,8 +427,8 @@ bool ED_clip_view_selection(const bContext *C, ARegion *ar, bool fit)
ED_space_clip_get_aspect(sc, &aspx, &aspy);
- width = BLI_rcti_size_x(&ar->winrct) + 1;
- height = BLI_rcti_size_y(&ar->winrct) + 1;
+ width = BLI_rcti_size_x(&region->winrct) + 1;
+ height = BLI_rcti_size_y(&region->winrct) + 1;
zoomx = (float)width / w / aspx;
zoomy = (float)height / h / aspy;
@@ -550,15 +552,16 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[
}
}
-void ED_clip_point_stable_pos(SpaceClip *sc, ARegion *ar, float x, float y, float *xr, float *yr)
+void ED_clip_point_stable_pos(
+ SpaceClip *sc, ARegion *region, float x, float y, float *xr, float *yr)
{
int sx, sy, width, height;
float zoomx, zoomy, pos[3], imat[4][4];
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_zoom(sc, region, &zoomx, &zoomy);
ED_space_clip_get_size(sc, &width, &height);
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &sx, &sy);
pos[0] = (x - sx) / zoomx;
pos[1] = (y - sy) / zoomy;
@@ -588,7 +591,7 @@ void ED_clip_point_stable_pos(SpaceClip *sc, ARegion *ar, float x, float y, floa
* better name here? view_to_track / track_to_view or so?
*/
void ED_clip_point_stable_pos__reverse(SpaceClip *sc,
- ARegion *ar,
+ ARegion *region,
const float co[2],
float r_co[2])
{
@@ -597,9 +600,9 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc,
int width, height;
int sx, sy;
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &sx, &sy);
ED_space_clip_get_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_zoom(sc, region, &zoomx, &zoomy);
ED_clip_point_undistorted_pos(sc, co, pos);
pos[2] = 0.0f;
@@ -612,9 +615,9 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc,
}
/* takes event->mval */
-void ED_clip_mouse_pos(SpaceClip *sc, ARegion *ar, const int mval[2], float co[2])
+void ED_clip_mouse_pos(SpaceClip *sc, ARegion *region, const int mval[2], float co[2])
{
- ED_clip_point_stable_pos(sc, ar, mval[0], mval[1], &co[0], &co[1]);
+ ED_clip_point_stable_pos(sc, region, mval[0], mval[1], &co[0], &co[1]);
}
bool ED_space_clip_check_show_trackedit(SpaceClip *sc)
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 3f705aad89a..10bf8d93983 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -249,10 +249,10 @@ static void draw_frame_curves(SpaceClip *sc, unsigned int pos)
}
}
-void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
+void clip_draw_graph(SpaceClip *sc, ARegion *region, Scene *scene)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* grid */
UI_view2d_draw_lines_x__values(v2d);
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 58a00d2e6b9..9547c65ffab 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -182,8 +182,8 @@ static bool mouse_select_knot(bContext *C, float co[2], bool extend)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
static const int delta = 6;
@@ -316,10 +316,10 @@ static int select_exec(bContext *C, wmOperator *op)
static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return select_exec(C, op);
@@ -403,7 +403,7 @@ static void box_select_cb(void *userdata,
static int box_select_graph_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -417,7 +417,7 @@ static int box_select_graph_exec(bContext *C, wmOperator *op)
/* get rectangle from operator */
WM_operator_properties_border_to_rctf(op, &rect);
- UI_view2d_region_to_view_rctf(&ar->v2d, &rect, &userdata.rect);
+ UI_view2d_region_to_view_rctf(&region->v2d, &rect, &userdata.rect);
userdata.changed = false;
userdata.select = !RNA_boolean_get(op->ptr, "deselect");
@@ -624,9 +624,9 @@ static void view_all_cb(void *userdata,
static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
ViewAllUserData userdata;
float extra;
@@ -663,7 +663,7 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
v2d->cur.ymin -= extra;
v2d->cur.ymax += extra;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -682,9 +682,9 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot)
/******************** jump to current frame operator ********************/
-void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar)
+void ED_clip_graph_center_current_frame(Scene *scene, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
float extra = BLI_rctf_size_x(&v2d->cur) / 2.0f;
/* set extents of view to start/end frames */
@@ -695,11 +695,11 @@ void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar)
static int center_current_frame_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- ED_clip_graph_center_current_frame(scene, ar);
+ ED_clip_graph_center_current_frame(scene, region);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index bd54d4f0016..b66f7605f41 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -54,26 +54,26 @@ struct wmOperatorType;
void ED_clip_buttons_register(struct ARegionType *art);
/* clip_dopesheet_draw.c */
-void clip_draw_dopesheet_main(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
-void clip_draw_dopesheet_channels(const struct bContext *C, struct ARegion *ar);
+void clip_draw_dopesheet_main(struct SpaceClip *sc, struct ARegion *region, struct Scene *scene);
+void clip_draw_dopesheet_channels(const struct bContext *C, struct ARegion *region);
/* clip_dopesheet_ops.c */
void CLIP_OT_dopesheet_select_channel(struct wmOperatorType *ot);
void CLIP_OT_dopesheet_view_all(struct wmOperatorType *ot);
/* clip_draw.c */
-void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct ARegion *ar);
+void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, struct ARegion *region);
void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
-void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *ar);
+void clip_draw_cache_and_notes(const bContext *C, SpaceClip *sc, ARegion *region);
/* clip_editor.c */
void clip_start_prefetch_job(const struct bContext *C);
/* clip_graph_draw.c */
-void clip_draw_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
+void clip_draw_graph(struct SpaceClip *sc, struct ARegion *region, struct Scene *scene);
/* clip_graph_ops.c */
-void ED_clip_graph_center_current_frame(struct Scene *scene, struct ARegion *ar);
+void ED_clip_graph_center_current_frame(struct Scene *scene, struct ARegion *region);
void CLIP_OT_graph_select(struct wmOperatorType *ot);
void CLIP_OT_graph_select_box(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index cc8c1a8f755..c6033ec6ca0 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -88,7 +88,7 @@ static void sclip_zoom_set(const bContext *C,
const bool zoom_to_pos)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float oldzoom = sc->zoom;
int width, height;
@@ -105,10 +105,10 @@ static void sclip_zoom_set(const bContext *C,
if ((width < 4) && (height < 4) && sc->zoom < oldzoom) {
sc->zoom = oldzoom;
}
- else if (BLI_rcti_size_x(&ar->winrct) <= sc->zoom) {
+ else if (BLI_rcti_size_x(&region->winrct) <= sc->zoom) {
sc->zoom = oldzoom;
}
- else if (BLI_rcti_size_y(&ar->winrct) <= sc->zoom) {
+ else if (BLI_rcti_size_y(&region->winrct) <= sc->zoom) {
sc->zoom = oldzoom;
}
}
@@ -148,20 +148,20 @@ static void sclip_zoom_set_factor(const bContext *C,
static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2], *mpos = NULL;
if (event) {
SpaceClip *sc = CTX_wm_space_clip(C);
- ED_clip_mouse_pos(sc, ar, event->mval, location);
+ ED_clip_mouse_pos(sc, region, event->mval, location);
mpos = location;
}
sclip_zoom_set_factor(C, factor, mpos, mpos ? (U.uiflag & USER_ZOOM_TO_MOUSEPOS) : false);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
/** \} */
@@ -559,7 +559,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ViewZoomData *vpd;
op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
@@ -581,7 +581,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
vpd->zoom = sc->zoom;
vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
- ED_clip_mouse_pos(sc, ar, event->mval, vpd->location);
+ ED_clip_mouse_pos(sc, region, event->mval, vpd->location);
WM_event_add_modal_handler(C, op);
}
@@ -769,11 +769,11 @@ static int view_zoom_in_exec(bContext *C, wmOperator *op)
static int view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
- ED_clip_mouse_pos(sc, ar, event->mval, location);
+ ED_clip_mouse_pos(sc, region, event->mval, location);
RNA_float_set_array(op->ptr, "location", location);
return view_zoom_in_exec(C, op);
@@ -826,11 +826,11 @@ static int view_zoom_out_exec(bContext *C, wmOperator *op)
static int view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
- ED_clip_mouse_pos(sc, ar, event->mval, location);
+ ED_clip_mouse_pos(sc, region, event->mval, location);
RNA_float_set_array(op->ptr, "location", location);
return view_zoom_out_exec(C, op);
@@ -922,7 +922,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
static int view_all_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc;
- ARegion *ar;
+ ARegion *region;
int w, h, width, height;
float aspx, aspy;
bool fit_view = RNA_boolean_get(op->ptr, "fit_view");
@@ -930,7 +930,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
/* retrieve state */
sc = CTX_wm_space_clip(C);
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
ED_space_clip_get_size(sc, &w, &h);
ED_space_clip_get_aspect(sc, &aspx, &aspy);
@@ -939,8 +939,8 @@ static int view_all_exec(bContext *C, wmOperator *op)
h = h * aspy;
/* check if the image will fit in the image with zoom == 1 */
- width = BLI_rcti_size_x(&ar->winrct) + 1;
- height = BLI_rcti_size_y(&ar->winrct) + 1;
+ width = BLI_rcti_size_x(&region->winrct) + 1;
+ height = BLI_rcti_size_y(&region->winrct) + 1;
if (fit_view) {
const int margin = 5; /* margin from border */
@@ -965,7 +965,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
sc->xof = sc->yof = 0.0f;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -999,11 +999,11 @@ void CLIP_OT_view_all(wmOperatorType *ot)
static int view_center_cursor_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
clip_view_center_to_point(sc, sc->cursor[0], sc->cursor[1]);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -1029,13 +1029,13 @@ void CLIP_OT_view_center_cursor(wmOperatorType *ot)
static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
sc->xlockof = 0.0f;
sc->ylockof = 0.0f;
- ED_clip_view_selection(C, ar, 1);
- ED_region_tag_redraw(ar);
+ ED_clip_view_selection(C, region, 1);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -1093,19 +1093,19 @@ static int change_frame_exec(bContext *C, wmOperator *op)
static int frame_from_event(bContext *C, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int framenr = 0;
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- float sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ float sfra = SFRA, efra = EFRA, framelen = region->winx / (efra - sfra + 1);
framenr = sfra + event->mval[0] / framelen;
}
else {
float viewx, viewy;
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
framenr = round_fl_to_int(viewx);
}
@@ -1115,9 +1115,9 @@ static int frame_from_event(bContext *C, const wmEvent *event)
static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
if (event->mval[1] > 16 * UI_DPI_FAC) {
return OPERATOR_PASS_THROUGH;
}
@@ -1649,7 +1649,7 @@ static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
}
else {
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float pan_vec[3];
const wmNDOFMotionData *ndof = event->customdata;
@@ -1664,7 +1664,7 @@ static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
sc->xof += pan_vec[0];
sc->yof += pan_vec[1];
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -1797,11 +1797,11 @@ static int clip_set_2d_cursor_exec(bContext *C, wmOperator *op)
static int clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceClip *sclip = CTX_wm_space_clip(C);
float location[2];
- ED_clip_mouse_pos(sclip, ar, event->mval, location);
+ ED_clip_mouse_pos(sclip, region, event->mval, location);
RNA_float_set_array(op->ptr, "location", location);
return clip_set_2d_cursor_exec(C, op);
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index fb0362fffd3..4c4110759cd 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -55,24 +55,24 @@
ARegion *ED_clip_has_properties_region(ScrArea *sa)
{
- ARegion *ar, *arnew;
+ ARegion *region, *arnew;
- ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar) {
- return ar;
+ region = BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if (region) {
+ return region;
}
/* add subdiv level; after header */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar == NULL) {
+ if (region == NULL) {
return NULL;
}
arnew = MEM_callocN(sizeof(ARegion), "clip properties region");
- BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ BLI_insertlinkafter(&sa->regionbase, region, arnew);
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_RIGHT;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index a0ac832522d..3256ee3eb73 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -73,101 +73,101 @@
static void init_preview_region(const Scene *scene,
const ScrArea *sa,
const SpaceClip *sc,
- ARegion *ar)
+ ARegion *region)
{
- ar->regiontype = RGN_TYPE_PREVIEW;
- ar->alignment = RGN_ALIGN_TOP;
- ar->flag |= RGN_FLAG_HIDDEN;
+ region->regiontype = RGN_TYPE_PREVIEW;
+ region->alignment = RGN_ALIGN_TOP;
+ region->flag |= RGN_FLAG_HIDDEN;
if (sc->view == SC_VIEW_DOPESHEET) {
- ar->v2d.tot.xmin = -10.0f;
- ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
- ar->v2d.tot.xmax = (float)(sa->winx);
- ar->v2d.tot.ymax = 0.0f;
-
- ar->v2d.cur = ar->v2d.tot;
-
- ar->v2d.min[0] = 0.0f;
- ar->v2d.min[1] = 0.0f;
-
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = FLT_MAX;
-
- ar->v2d.minzoom = 0.01f;
- ar->v2d.maxzoom = 50;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
- ar->v2d.keepofs = V2D_KEEPOFS_Y;
- ar->v2d.align = V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.tot.xmin = -10.0f;
+ region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ region->v2d.tot.xmax = (float)(sa->winx);
+ region->v2d.tot.ymax = 0.0f;
+
+ region->v2d.cur = region->v2d.tot;
+
+ region->v2d.min[0] = 0.0f;
+ region->v2d.min[1] = 0.0f;
+
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = FLT_MAX;
+
+ region->v2d.minzoom = 0.01f;
+ region->v2d.maxzoom = 50;
+ region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.keepzoom = V2D_LOCKZOOM_Y;
+ region->v2d.keepofs = V2D_KEEPOFS_Y;
+ region->v2d.align = V2D_ALIGN_NO_POS_Y;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
}
else {
- ar->v2d.tot.xmin = 0.0f;
- ar->v2d.tot.ymin = -10.0f;
- ar->v2d.tot.xmax = (float)scene->r.efra;
- ar->v2d.tot.ymax = 10.0f;
+ region->v2d.tot.xmin = 0.0f;
+ region->v2d.tot.ymin = -10.0f;
+ region->v2d.tot.xmax = (float)scene->r.efra;
+ region->v2d.tot.ymax = 10.0f;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = FLT_MIN;
- ar->v2d.min[1] = FLT_MIN;
+ region->v2d.min[0] = FLT_MIN;
+ region->v2d.min[1] = FLT_MIN;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = FLT_MAX;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = FLT_MAX;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES);
+ region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES);
- ar->v2d.minzoom = 0.0f;
- ar->v2d.maxzoom = 0.0f;
- ar->v2d.keepzoom = 0;
- ar->v2d.keepofs = 0;
- ar->v2d.align = 0;
- ar->v2d.flag = 0;
+ region->v2d.minzoom = 0.0f;
+ region->v2d.maxzoom = 0.0f;
+ region->v2d.keepzoom = 0;
+ region->v2d.keepofs = 0;
+ region->v2d.align = 0;
+ region->v2d.flag = 0;
- ar->v2d.keeptot = 0;
+ region->v2d.keeptot = 0;
}
}
-static void reinit_preview_region(const bContext *C, ARegion *ar)
+static void reinit_preview_region(const bContext *C, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc->view == SC_VIEW_DOPESHEET) {
- if ((ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0) {
- init_preview_region(scene, sa, sc, ar);
+ if ((region->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0) {
+ init_preview_region(scene, sa, sc, region);
}
}
else {
- if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
- init_preview_region(scene, sa, sc, ar);
+ if (region->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
+ init_preview_region(scene, sa, sc, region);
}
}
}
static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa)
{
- ARegion *ar, *arnew;
+ ARegion *region, *arnew;
- ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
- if (ar) {
- return ar;
+ region = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+ if (region) {
+ return region;
}
/* add subdiv level; after header */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
/* is error! */
- if (ar == NULL) {
+ if (region == NULL) {
return NULL;
}
arnew = MEM_callocN(sizeof(ARegion), "clip preview region");
- BLI_insertlinkbefore(&sa->regionbase, ar, arnew);
+ BLI_insertlinkbefore(&sa->regionbase, region, arnew);
init_preview_region(CTX_data_scene(C), sa, CTX_wm_space_clip(C), arnew);
return arnew;
@@ -175,24 +175,24 @@ static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa)
static ARegion *ED_clip_has_channels_region(ScrArea *sa)
{
- ARegion *ar, *arnew;
+ ARegion *region, *arnew;
- ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
- if (ar) {
- return ar;
+ region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+ if (region) {
+ return region;
}
/* add subdiv level; after header */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
/* is error! */
- if (ar == NULL) {
+ if (region == NULL) {
return NULL;
}
arnew = MEM_callocN(sizeof(ARegion), "clip channels region");
- BLI_insertlinkbefore(&sa->regionbase, ar, arnew);
+ BLI_insertlinkbefore(&sa->regionbase, region, arnew);
arnew->regiontype = RGN_TYPE_CHANNELS;
arnew->alignment = RGN_ALIGN_LEFT;
@@ -205,15 +205,15 @@ static ARegion *ED_clip_has_channels_region(ScrArea *sa)
static void clip_scopes_tag_refresh(ScrArea *sa)
{
SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
- ARegion *ar;
+ ARegion *region;
if (sc->mode != SC_MODE_TRACKING) {
return;
}
/* only while properties are visible */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_UI && ar->flag & RGN_FLAG_HIDDEN) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_UI && region->flag & RGN_FLAG_HIDDEN) {
return;
}
}
@@ -240,7 +240,7 @@ static void clip_area_sync_frame_from_scene(ScrArea *sa, Scene *scene)
static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene)
{
- ARegion *ar;
+ ARegion *region;
SpaceClip *sc;
sc = MEM_callocN(sizeof(SpaceClip), "initclip");
@@ -253,47 +253,47 @@ static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene)
sc->around = V3D_AROUND_CENTER_MEDIAN;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for clip");
+ region = MEM_callocN(sizeof(ARegion), "header for clip");
- BLI_addtail(&sc->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sc->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* tools view */
- ar = MEM_callocN(sizeof(ARegion), "tools for clip");
+ region = MEM_callocN(sizeof(ARegion), "tools for clip");
- BLI_addtail(&sc->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
+ BLI_addtail(&sc->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
/* properties view */
- ar = MEM_callocN(sizeof(ARegion), "properties for clip");
+ region = MEM_callocN(sizeof(ARegion), "properties for clip");
- BLI_addtail(&sc->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
+ BLI_addtail(&sc->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
/* channels view */
- ar = MEM_callocN(sizeof(ARegion), "channels for clip");
+ region = MEM_callocN(sizeof(ARegion), "channels for clip");
- BLI_addtail(&sc->regionbase, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
+ BLI_addtail(&sc->regionbase, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* preview view */
- ar = MEM_callocN(sizeof(ARegion), "preview for clip");
+ region = MEM_callocN(sizeof(ARegion), "preview for clip");
- BLI_addtail(&sc->regionbase, ar);
- init_preview_region(scene, sa, sc, ar);
+ BLI_addtail(&sc->regionbase, region);
+ init_preview_region(scene, sa, sc, region);
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for clip");
+ region = MEM_callocN(sizeof(ARegion), "main region for clip");
- BLI_addtail(&sc->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sc->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)sc;
}
@@ -828,7 +828,7 @@ static void clip_gizmos(void)
/********************* main region ********************/
/* sets up the fields of the View2D from zoom and offset */
-static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
+static void movieclip_main_area_set_view2d(const bContext *C, ARegion *region)
{
SpaceClip *sc = CTX_wm_space_clip(C);
float x1, y1, w, h, aspx, aspy;
@@ -840,60 +840,60 @@ static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
w = width * aspx;
h = height * aspy;
- winx = BLI_rcti_size_x(&ar->winrct) + 1;
- winy = BLI_rcti_size_y(&ar->winrct) + 1;
+ winx = BLI_rcti_size_x(&region->winrct) + 1;
+ winy = BLI_rcti_size_y(&region->winrct) + 1;
- ar->v2d.tot.xmin = 0;
- ar->v2d.tot.ymin = 0;
- ar->v2d.tot.xmax = w;
- ar->v2d.tot.ymax = h;
+ region->v2d.tot.xmin = 0;
+ region->v2d.tot.ymin = 0;
+ region->v2d.tot.xmax = w;
+ region->v2d.tot.ymax = h;
- ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
- ar->v2d.mask.xmax = winx;
- ar->v2d.mask.ymax = winy;
+ region->v2d.mask.xmin = region->v2d.mask.ymin = 0;
+ region->v2d.mask.xmax = winx;
+ region->v2d.mask.ymax = winy;
/* which part of the image space do we see? */
- x1 = ar->winrct.xmin + (winx - sc->zoom * w) / 2.0f;
- y1 = ar->winrct.ymin + (winy - sc->zoom * h) / 2.0f;
+ x1 = region->winrct.xmin + (winx - sc->zoom * w) / 2.0f;
+ y1 = region->winrct.ymin + (winy - sc->zoom * h) / 2.0f;
x1 -= sc->zoom * sc->xof;
y1 -= sc->zoom * sc->yof;
/* relative display right */
- ar->v2d.cur.xmin = (ar->winrct.xmin - (float)x1) / sc->zoom;
- ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sc->zoom);
+ region->v2d.cur.xmin = (region->winrct.xmin - (float)x1) / sc->zoom;
+ region->v2d.cur.xmax = region->v2d.cur.xmin + ((float)winx / sc->zoom);
/* relative display left */
- ar->v2d.cur.ymin = (ar->winrct.ymin - (float)y1) / sc->zoom;
- ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sc->zoom);
+ region->v2d.cur.ymin = (region->winrct.ymin - (float)y1) / sc->zoom;
+ region->v2d.cur.ymax = region->v2d.cur.ymin + ((float)winy / sc->zoom);
/* normalize 0.0..1.0 */
- ar->v2d.cur.xmin /= w;
- ar->v2d.cur.xmax /= w;
- ar->v2d.cur.ymin /= h;
- ar->v2d.cur.ymax /= h;
+ region->v2d.cur.xmin /= w;
+ region->v2d.cur.xmax /= w;
+ region->v2d.cur.ymin /= h;
+ region->v2d.cur.ymax /= h;
}
/* add handlers, stuff you only do once or on area/region changes */
-static void clip_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void clip_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy);
/* mask polls mode */
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void clip_main_region_draw(const bContext *C, ARegion *ar)
+static void clip_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -915,7 +915,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
tmpibuf = ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
}
- if (ED_clip_view_selection(C, ar, 0)) {
+ if (ED_clip_view_selection(C, region, 0)) {
sc->xof += sc->xlockof;
sc->yof += sc->ylockof;
}
@@ -930,17 +930,17 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
GPU_clear(GPU_COLOR_BIT);
/* data... */
- movieclip_main_area_set_view2d(C, ar);
+ movieclip_main_area_set_view2d(C, region);
/* callback */
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
- clip_draw_main(C, sc, ar);
+ clip_draw_main(C, sc, region);
/* TODO(sergey): would be nice to find a way to de-duplicate all this space conversions */
- UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region_fl(&region->v2d, 0.0f, 0.0f, &x, &y);
ED_space_clip_get_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_zoom(sc, region, &zoomx, &zoomy);
ED_space_clip_get_aspect(sc, &aspx, &aspy);
if (sc->mode == SC_MODE_MASKEDIT) {
@@ -951,7 +951,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
ED_mask_get_size(sa, &mask_width, &mask_height);
ED_mask_draw_region(CTX_data_expect_evaluated_depsgraph(C),
mask,
- ar,
+ region,
sc->mask_info.draw_flag,
sc->mask_info.draw_type,
sc->mask_info.overlay_mode,
@@ -975,11 +975,11 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
GPU_matrix_scale_2f(zoomx, zoomy);
GPU_matrix_mul(sc->stabmat);
GPU_matrix_scale_2f(width, height);
- ED_image_draw_cursor(ar, sc->cursor);
+ ED_image_draw_cursor(region, sc->cursor);
GPU_matrix_pop();
}
- clip_draw_cache_and_notes(C, sc, ar);
+ clip_draw_cache_and_notes(C, sc, region);
if (sc->flag & SC_SHOW_ANNOTATION) {
/* Grease Pencil */
@@ -987,7 +987,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
}
/* callback */
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -997,12 +997,12 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
clip_draw_grease_pencil((bContext *)C, false);
}
- WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
+ WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
}
static void clip_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -1010,10 +1010,10 @@ static void clip_main_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_GPENCIL:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else if (wmn->data & ND_GPENCIL_EDITMODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -1021,37 +1021,37 @@ static void clip_main_region_listener(wmWindow *UNUSED(win),
/****************** preview region ******************/
-static void clip_preview_region_init(wmWindowManager *wm, ARegion *ar)
+static void clip_preview_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip Time Scrub", SPACE_CLIP, RGN_TYPE_PREVIEW);
- WM_event_add_keymap_handler_poll(&ar->handlers, keymap, ED_time_scrub_event_in_region);
+ WM_event_add_keymap_handler_poll(&region->handlers, keymap, ED_time_scrub_event_in_region);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void graph_region_draw(const bContext *C, ARegion *ar)
+static void graph_region_draw(const bContext *C, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
SpaceClip *sc = CTX_wm_space_clip(C);
Scene *scene = CTX_data_scene(C);
short cfra_flag = 0;
if (sc->flag & SC_LOCK_TIMECURSOR) {
- ED_clip_graph_center_current_frame(scene, ar);
+ ED_clip_graph_center_current_frame(scene, region);
}
/* clear and setup matrix */
@@ -1061,7 +1061,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* data... */
- clip_draw_graph(sc, ar, scene);
+ clip_draw_graph(sc, region, scene);
/* current frame indicator line */
if (sc->flag & SC_SHOW_SECONDS) {
@@ -1073,7 +1073,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* time-scrubbing */
- ED_time_scrub_draw(ar, scene, sc->flag & SC_SHOW_SECONDS, true);
+ ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true);
/* scrollers */
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
@@ -1083,17 +1083,18 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
/* scale indicators */
{
rcti rect;
- BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, ar->winy - UI_TIME_SCRUB_MARGIN_Y);
- UI_view2d_draw_scale_y__values(ar, v2d, &rect, TH_TEXT);
+ BLI_rcti_init(
+ &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
+ UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_TEXT);
}
}
-static void dopesheet_region_draw(const bContext *C, ARegion *ar)
+static void dopesheet_region_draw(const bContext *C, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
short cfra_flag = 0;
@@ -1111,7 +1112,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, sc->flag & SC_SHOW_SECONDS);
/* data... */
- clip_draw_dopesheet_main(sc, ar, scene);
+ clip_draw_dopesheet_main(sc, region, scene);
/* current frame indicator line */
if (sc->flag & SC_SHOW_SECONDS) {
@@ -1123,7 +1124,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* time-scrubbing */
- ED_time_scrub_draw(ar, scene, sc->flag & SC_SHOW_SECONDS, true);
+ ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true);
/* scrollers */
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
@@ -1131,21 +1132,21 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
UI_view2d_scrollers_free(scrollers);
}
-static void clip_preview_region_draw(const bContext *C, ARegion *ar)
+static void clip_preview_region_draw(const bContext *C, ARegion *region)
{
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc->view == SC_VIEW_GRAPH) {
- graph_region_draw(C, ar);
+ graph_region_draw(C, region);
}
else if (sc->view == SC_VIEW_DOPESHEET) {
- dopesheet_region_draw(C, ar);
+ dopesheet_region_draw(C, region);
}
}
static void clip_preview_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
@@ -1153,24 +1154,24 @@ static void clip_preview_region_listener(wmWindow *UNUSED(win),
/****************** channels region ******************/
-static void clip_channels_region_init(wmWindowManager *wm, ARegion *ar)
+static void clip_channels_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* ensure the 2d view sync works - main region has bottom scroller */
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void clip_channels_region_draw(const bContext *C, ARegion *ar)
+static void clip_channels_region_draw(const bContext *C, ARegion *region)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
if (clip) {
BKE_tracking_dopesheet_update(&clip->tracking);
@@ -1183,7 +1184,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* data... */
- clip_draw_dopesheet_channels(C, ar);
+ clip_draw_dopesheet_channels(C, region);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -1191,7 +1192,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar)
static void clip_channels_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
@@ -1200,19 +1201,19 @@ static void clip_channels_region_listener(wmWindow *UNUSED(win),
/****************** header region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void clip_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void clip_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void clip_header_region_draw(const bContext *C, ARegion *ar)
+static void clip_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void clip_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -1225,7 +1226,7 @@ static void clip_header_region_listener(wmWindow *UNUSED(win),
/* TODO - should do this when in mask mode only but no data available */
// if (sc->mode == SC_MODE_MASKEDIT)
{
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
}
@@ -1236,26 +1237,26 @@ static void clip_header_region_listener(wmWindow *UNUSED(win),
/****************** tools region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void clip_tools_region_init(wmWindowManager *wm, ARegion *ar)
+static void clip_tools_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void clip_tools_region_draw(const bContext *C, ARegion *ar)
+static void clip_tools_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
/****************** tool properties region ******************/
static void clip_props_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -1263,22 +1264,22 @@ static void clip_props_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_HISTORY) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_MODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_CLIP) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -1287,28 +1288,28 @@ static void clip_props_region_listener(wmWindow *UNUSED(win),
/****************** properties region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void clip_properties_region_init(wmWindowManager *wm, ARegion *ar)
+static void clip_properties_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void clip_properties_region_draw(const bContext *C, ARegion *ar)
+static void clip_properties_region_draw(const bContext *C, ARegion *region)
{
SpaceClip *sc = CTX_wm_space_clip(C);
BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes);
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void clip_properties_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -1316,12 +1317,12 @@ static void clip_properties_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_GPENCIL:
if (ELEM(wmn->data, ND_DATA, ND_GPENCIL_EDITMODE)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_BRUSH:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index f1bce00ea0b..030b0625e32 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -108,12 +108,12 @@ static int add_marker_exec(bContext *C, wmOperator *op)
static int add_marker_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (!RNA_struct_property_is_set(op->ptr, "location")) {
/* If location is not set, use mouse positio nas default. */
float co[2];
- ED_clip_mouse_pos(sc, ar, event->mval, co);
+ ED_clip_mouse_pos(sc, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
}
@@ -169,13 +169,17 @@ static int add_marker_at_click_modal(bContext *C, wmOperator *UNUSED(op), const
case LEFTMOUSE: {
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float pos[2];
ED_workspace_status_text(C, NULL);
- ED_clip_point_stable_pos(
- sc, ar, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, &pos[0], &pos[1]);
+ ED_clip_point_stable_pos(sc,
+ region,
+ event->x - region->winrct.xmin,
+ event->y - region->winrct.ymin,
+ &pos[0],
+ &pos[1]);
if (!add_marker(C, pos[0], pos[1])) {
return OPERATOR_CANCELLED;
@@ -544,7 +548,7 @@ MovieTrackingTrack *tracking_marker_check_slide(
{
const float distance_clip_squared = 12.0f * 12.0f;
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTrackingTrack *track;
@@ -566,7 +570,7 @@ MovieTrackingTrack *tracking_marker_check_slide(
return NULL;
}
- ED_clip_mouse_pos(sc, ar, event->mval, co);
+ ED_clip_mouse_pos(sc, region, event->mval, co);
track = tracksbase->first;
while (track) {
@@ -670,7 +674,7 @@ MovieTrackingTrack *tracking_marker_check_slide(
static void *slide_marker_customdata(bContext *C, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieTrackingTrack *track;
int width, height;
@@ -685,7 +689,7 @@ static void *slide_marker_customdata(bContext *C, const wmEvent *event)
return NULL;
}
- ED_clip_mouse_pos(sc, ar, event->mval, co);
+ ED_clip_mouse_pos(sc, region, event->mval, co);
track = tracking_marker_check_slide(C, event, &area, &action, &corner);
if (track != NULL) {
@@ -770,7 +774,7 @@ static void free_slide_data(SlideMarkerData *data)
static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SlideMarkerData *data = (SlideMarkerData *)op->customdata;
float dx, dy, mdelta[2];
@@ -826,7 +830,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
float start[2], end[2];
float scale;
- ED_clip_point_stable_pos(sc, ar, data->mval[0], data->mval[1], &start[0], &start[1]);
+ ED_clip_point_stable_pos(sc, region, data->mval[0], data->mval[1], &start[0], &start[1]);
sub_v2_v2(start, data->old_pos);
@@ -842,7 +846,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
mval[1] = event->mval[1];
}
- ED_clip_point_stable_pos(sc, ar, mval[0], mval[1], &end[0], &end[1]);
+ ED_clip_point_stable_pos(sc, region, mval[0], mval[1], &end[0], &end[1]);
sub_v2_v2(end, data->old_pos);
scale = len_v2(end) / len_v2(start);
@@ -896,7 +900,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
sub_v2_v2v2(start, data->spos, data->old_pos);
- ED_clip_point_stable_pos(sc, ar, mval[0], mval[1], &end[0], &end[1]);
+ ED_clip_point_stable_pos(sc, region, mval[0], mval[1], &end[0], &end[1]);
sub_v2_v2(end, data->old_pos);
if (len_squared_v2(start) != 0.0f) {
diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c
index 03fe1c74e2a..ced51e4502a 100644
--- a/source/blender/editors/space_clip/tracking_ops_plane.c
+++ b/source/blender/editors/space_clip/tracking_ops_plane.c
@@ -126,7 +126,7 @@ static MovieTrackingPlaneTrack *tracking_plane_marker_check_slide(bContext *C,
{
const float distance_clip_squared = 12.0f * 12.0f;
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
int width, height;
@@ -139,7 +139,7 @@ static MovieTrackingPlaneTrack *tracking_plane_marker_check_slide(bContext *C,
return NULL;
}
- ED_clip_mouse_pos(sc, ar, event->mval, co);
+ ED_clip_mouse_pos(sc, region, event->mval, co);
float min_distance_squared = FLT_MAX;
int min_corner = -1;
@@ -174,7 +174,7 @@ static MovieTrackingPlaneTrack *tracking_plane_marker_check_slide(bContext *C,
static void *slide_plane_marker_customdata(bContext *C, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieTrackingPlaneTrack *plane_track;
int width, height;
float co[2];
@@ -187,7 +187,7 @@ static void *slide_plane_marker_customdata(bContext *C, const wmEvent *event)
return NULL;
}
- ED_clip_mouse_pos(sc, ar, event->mval, co);
+ ED_clip_mouse_pos(sc, region, event->mval, co);
plane_track = tracking_plane_marker_check_slide(C, event, &corner);
if (plane_track) {
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index f6063b49005..36e529e47d0 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -407,7 +407,7 @@ static int select_exec(bContext *C, wmOperator *op)
static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
const bool extend = RNA_boolean_get(op->ptr, "extend");
@@ -427,7 +427,7 @@ static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
}
- ED_clip_mouse_pos(sc, ar, event->mval, co);
+ ED_clip_mouse_pos(sc, region, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
return select_exec(C, op);
@@ -486,7 +486,7 @@ bool ED_clip_can_select(bContext *C)
static int box_select_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -502,8 +502,8 @@ static int box_select_exec(bContext *C, wmOperator *op)
/* get rectangle from operator */
WM_operator_properties_border_to_rcti(op, &rect);
- ED_clip_point_stable_pos(sc, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
- ED_clip_point_stable_pos(sc, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
+ ED_clip_point_stable_pos(sc, region, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
+ ED_clip_point_stable_pos(sc, region, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
const bool select = (sel_op != SEL_OP_SUB);
@@ -594,7 +594,7 @@ static int do_lasso_select_marker(bContext *C,
bool select)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -619,7 +619,7 @@ static int do_lasso_select_marker(bContext *C,
float screen_co[2];
/* marker in screen coords */
- ED_clip_point_stable_pos__reverse(sc, ar, marker->pos, screen_co);
+ ED_clip_point_stable_pos__reverse(sc, region, marker->pos, screen_co);
if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED)) {
@@ -647,7 +647,7 @@ static int do_lasso_select_marker(bContext *C,
float screen_co[2];
/* marker in screen coords */
- ED_clip_point_stable_pos__reverse(sc, ar, plane_marker->corners[i], screen_co);
+ ED_clip_point_stable_pos__reverse(sc, region, plane_marker->corners[i], screen_co);
if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED)) {
@@ -739,7 +739,7 @@ static int marker_inside_ellipse(MovieTrackingMarker *marker, float offset[2], f
static int circle_select_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -767,12 +767,12 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* compute ellipse and position in unified coordinates */
ED_space_clip_get_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_zoom(sc, region, &zoomx, &zoomy);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;
- ED_clip_point_stable_pos(sc, ar, x, y, &offset[0], &offset[1]);
+ ED_clip_point_stable_pos(sc, region, x, y, &offset[0], &offset[1]);
/* do selection */
track = tracksbase->first;
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 3ba355b3730..7e32c3d2b5f 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -184,25 +184,25 @@ static void console_textview_const_colors(TextViewContext *UNUSED(tvc), uchar bg
UI_GetThemeColor4ubv(TH_CONSOLE_SELECT, bg_sel);
}
-static void console_textview_draw_rect_calc(const ARegion *ar,
+static void console_textview_draw_rect_calc(const ARegion *region,
rcti *r_draw_rect,
rcti *r_draw_rect_outer)
{
const int margin = 4 * UI_DPI_FAC;
r_draw_rect->xmin = margin;
- r_draw_rect->xmax = ar->winx - V2D_SCROLL_WIDTH;
+ r_draw_rect->xmax = region->winx - V2D_SCROLL_WIDTH;
r_draw_rect->ymin = margin;
/* No margin at the top (allow text to scroll off the window). */
- r_draw_rect->ymax = ar->winy;
+ r_draw_rect->ymax = region->winy;
r_draw_rect_outer->xmin = 0;
- r_draw_rect_outer->xmax = ar->winx;
+ r_draw_rect_outer->xmax = region->winx;
r_draw_rect_outer->ymin = 0;
- r_draw_rect_outer->ymax = ar->winy;
+ r_draw_rect_outer->ymax = region->winy;
}
static int console_textview_main__internal(struct SpaceConsole *sc,
- const ARegion *ar,
+ const ARegion *region,
const bool do_draw,
const int mval[2],
void **r_mval_pick_item,
@@ -211,7 +211,7 @@ static int console_textview_main__internal(struct SpaceConsole *sc,
ConsoleLine cl_dummy = {NULL};
int ret = 0;
- const View2D *v2d = &ar->v2d;
+ const View2D *v2d = &region->v2d;
TextViewContext tvc = {0};
@@ -234,7 +234,7 @@ static int console_textview_main__internal(struct SpaceConsole *sc,
tvc.scroll_ymin = v2d->cur.ymin;
tvc.scroll_ymax = v2d->cur.ymax;
- console_textview_draw_rect_calc(ar, &tvc.draw_rect, &tvc.draw_rect_outer);
+ console_textview_draw_rect_calc(region, &tvc.draw_rect, &tvc.draw_rect_outer);
console_scrollback_prompt_begin(sc, &cl_dummy);
ret = textview_draw(&tvc, do_draw, mval, r_mval_pick_item, r_mval_pick_offset);
@@ -243,23 +243,23 @@ static int console_textview_main__internal(struct SpaceConsole *sc,
return ret;
}
-void console_textview_main(struct SpaceConsole *sc, const ARegion *ar)
+void console_textview_main(struct SpaceConsole *sc, const ARegion *region)
{
const int mval[2] = {INT_MAX, INT_MAX};
- console_textview_main__internal(sc, ar, true, mval, NULL, NULL);
+ console_textview_main__internal(sc, region, true, mval, NULL, NULL);
}
-int console_textview_height(struct SpaceConsole *sc, const ARegion *ar)
+int console_textview_height(struct SpaceConsole *sc, const ARegion *region)
{
const int mval[2] = {INT_MAX, INT_MAX};
- return console_textview_main__internal(sc, ar, false, mval, NULL, NULL);
+ return console_textview_main__internal(sc, region, false, mval, NULL, NULL);
}
-int console_char_pick(struct SpaceConsole *sc, const ARegion *ar, const int mval[2])
+int console_char_pick(struct SpaceConsole *sc, const ARegion *region, const int mval[2])
{
int r_mval_pick_offset = 0;
void *mval_pick_item = NULL;
- console_textview_main__internal(sc, ar, false, mval, &mval_pick_item, &r_mval_pick_offset);
+ console_textview_main__internal(sc, region, false, mval, &mval_pick_item, &r_mval_pick_offset);
return r_mval_pick_offset;
}
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index def7fbc193b..d051e351f3e 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -28,10 +28,10 @@ struct bContext;
struct wmOperatorType;
/* console_draw.c */
-void console_textview_main(struct SpaceConsole *sc, const struct ARegion *ar);
+void console_textview_main(struct SpaceConsole *sc, const struct ARegion *region);
/* needed to calculate the scrollbar */
-int console_textview_height(struct SpaceConsole *sc, const struct ARegion *ar);
-int console_char_pick(struct SpaceConsole *sc, const struct ARegion *ar, const int mval[2]);
+int console_textview_height(struct SpaceConsole *sc, const struct ARegion *region);
+int console_char_pick(struct SpaceConsole *sc, const struct ARegion *region, const int mval[2]);
void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
@@ -44,7 +44,7 @@ ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, bool
ConsoleLine *console_history_verify(const struct bContext *C);
-void console_textview_update_rect(SpaceConsole *sc, ARegion *ar);
+void console_textview_update_rect(SpaceConsole *sc, ARegion *region);
void CONSOLE_OT_move(struct wmOperatorType *ot);
void CONSOLE_OT_delete(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 122634f86ba..abb566aa39b 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -49,18 +49,18 @@
#include "console_intern.h"
/* so when we type - the view scrolls to the bottom */
-static void console_scroll_bottom(ARegion *ar)
+static void console_scroll_bottom(ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
v2d->cur.ymin = 0.0;
v2d->cur.ymax = (float)v2d->winy;
}
-void console_textview_update_rect(SpaceConsole *sc, ARegion *ar)
+void console_textview_update_rect(SpaceConsole *sc, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
- UI_view2d_totRect_set(v2d, ar->winx - 1, console_textview_height(sc, ar));
+ UI_view2d_totRect_set(v2d, region->winx - 1, console_textview_height(sc, region));
}
static void console_select_offset(SpaceConsole *sc, const int offset)
@@ -354,10 +354,10 @@ static int console_move_exec(bContext *C, wmOperator *op)
if (done) {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ED_area_tag_redraw(sa);
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
}
return OPERATOR_FINISHED;
@@ -383,7 +383,7 @@ void CONSOLE_OT_move(wmOperatorType *ot)
static int console_insert_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
int len;
@@ -407,10 +407,10 @@ static int console_insert_exec(bContext *C, wmOperator *op)
console_select_offset(sc, len);
}
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -506,7 +506,7 @@ void CONSOLE_OT_indent_or_autocomplete(wmOperatorType *ot)
static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
int spaces;
int len;
@@ -528,10 +528,10 @@ static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
console_line_cursor_set(ci, ci->cursor + len);
console_select_offset(sc, len);
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -553,7 +553,7 @@ void CONSOLE_OT_indent(wmOperatorType *ot)
static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
int spaces;
int len;
@@ -582,10 +582,10 @@ static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op))
console_line_cursor_set(ci, ci->cursor - len);
console_select_offset(sc, -len);
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -613,7 +613,7 @@ static const EnumPropertyItem console_delete_type_items[] = {
static int console_delete_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
int pos;
int stride;
@@ -678,10 +678,10 @@ static int console_delete_exec(bContext *C, wmOperator *op)
console_select_offset(sc, -stride);
}
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -709,7 +709,7 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
if (ci->len == 0) {
@@ -720,11 +720,11 @@ static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
console_history_add(sc, NULL);
console_select_offset(sc, -ci->len);
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -745,7 +745,7 @@ void CONSOLE_OT_clear_line(wmOperatorType *ot)
static int console_clear_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const bool scrollback = RNA_boolean_get(op->ptr, "scrollback");
const bool history = RNA_boolean_get(op->ptr, "history");
@@ -765,7 +765,7 @@ static int console_clear_exec(bContext *C, wmOperator *op)
console_history_verify(C);
}
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
@@ -791,7 +791,7 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
static int console_history_cycle_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* TODO - stupid, just prevents crashes when no command line */
ConsoleLine *ci = console_history_verify(C);
@@ -832,10 +832,10 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
console_select_offset(sc, ci->len - prev_len);
/* could be wrapped so update scroll rect */
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -859,7 +859,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
static int console_history_append_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
ConsoleLine *ci = console_history_verify(C);
/* own this text in the new line, don't free */
@@ -889,8 +889,8 @@ static int console_history_append_exec(bContext *C, wmOperator *op)
/* when calling render modally this can be NULL when calling:
* bpy.ops.render.render('INVOKE_DEFAULT') */
- if (ar) {
- console_scroll_bottom(ar);
+ if (region) {
+ console_scroll_bottom(region);
}
return OPERATOR_FINISHED;
@@ -922,7 +922,7 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
static int console_scrollback_append_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci;
/* own this text in the new line, don't free */
@@ -936,10 +936,10 @@ static int console_scrollback_append_exec(bContext *C, wmOperator *op)
console_scrollback_limit(sc);
- /* 'ar' can be null depending on the operator that runs
+ /* 'region' can be null depending on the operator that runs
* rendering with invoke default for eg causes this */
- if (ar) {
- console_textview_update_rect(sc, ar);
+ if (region) {
+ console_textview_update_rect(sc, region);
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -1055,7 +1055,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot)
static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine *ci = console_history_verify(C);
int buf_len;
@@ -1085,10 +1085,10 @@ static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
MEM_freeN(buf_str);
- console_textview_update_rect(sc, ar);
+ console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
- console_scroll_bottom(ar);
+ console_scroll_bottom(region);
return OPERATOR_FINISHED;
}
@@ -1114,10 +1114,10 @@ typedef struct SetConsoleCursor {
// TODO, cursor placement without selection
static void console_cursor_set_to_pos(
- SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, const int mval[2], int UNUSED(sel))
+ SpaceConsole *sc, ARegion *region, SetConsoleCursor *scu, const int mval[2], int UNUSED(sel))
{
int pos;
- pos = console_char_pick(sc, ar, mval);
+ pos = console_char_pick(sc, region, mval);
if (scu->sel_init == INT_MAX) {
scu->sel_init = pos;
@@ -1141,7 +1141,7 @@ static void console_cursor_set_to_pos(
static void console_modal_select_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SetConsoleCursor *scu = op->customdata;
int mval[2];
int sel_prev[2];
@@ -1152,7 +1152,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, const wmEven
sel_prev[0] = sc->sel_start;
sel_prev[1] = sc->sel_end;
- console_cursor_set_to_pos(sc, ar, scu, mval, true);
+ console_cursor_set_to_pos(sc, region, scu, mval, true);
/* only redraw if the selection changed */
if (sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
@@ -1179,7 +1179,7 @@ static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
static int console_modal_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- // ARegion *ar = CTX_wm_region(C);
+ // ARegion *region = CTX_wm_region(C);
SetConsoleCursor *scu;
op->customdata = MEM_callocN(sizeof(SetConsoleCursor), "SetConsoleCursor");
@@ -1238,14 +1238,14 @@ void CONSOLE_OT_select_set(wmOperatorType *ot)
static int console_selectword_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
SpaceConsole *sc = CTX_wm_space_console(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ConsoleLine cl_dummy = {NULL};
ConsoleLine *cl;
int ret = OPERATOR_CANCELLED;
int pos, offset, n;
- pos = console_char_pick(sc, ar, event->mval);
+ pos = console_char_pick(sc, region, event->mval);
console_scrollback_prompt_begin(sc, &cl_dummy);
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 207f508d4ee..eb83f9963b0 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -48,7 +48,7 @@
static SpaceLink *console_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceConsole *sconsole;
sconsole = MEM_callocN(sizeof(SpaceConsole), "initconsole");
@@ -57,28 +57,28 @@ static SpaceLink *console_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s
sconsole->lheight = 14;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for console");
+ region = MEM_callocN(sizeof(ARegion), "header for console");
- BLI_addtail(&sconsole->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sconsole->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for text");
+ region = MEM_callocN(sizeof(ARegion), "main region for text");
- BLI_addtail(&sconsole->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sconsole->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
/* keep in sync with info */
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
- ar->v2d.keepofs |= V2D_LOCKOFS_X;
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ region->v2d.keepofs |= V2D_LOCKOFS_X;
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
- // ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
+ // region->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
return (SpaceLink *)sconsole;
}
@@ -116,41 +116,41 @@ static SpaceLink *console_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void console_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void console_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
ListBase *lb;
- const float prev_y_min = ar->v2d.cur.ymin; /* so re-sizing keeps the cursor visible */
+ const float prev_y_min = region->v2d.cur.ymin; /* so re-sizing keeps the cursor visible */
/* force it on init, for old files, until it becomes config */
- ar->v2d.scroll = (V2D_SCROLL_RIGHT);
+ region->v2d.scroll = (V2D_SCROLL_RIGHT);
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* always keep the bottom part of the view aligned, less annoying */
- if (prev_y_min != ar->v2d.cur.ymin) {
- const float cur_y_range = BLI_rctf_size_y(&ar->v2d.cur);
- ar->v2d.cur.ymin = prev_y_min;
- ar->v2d.cur.ymax = prev_y_min + cur_y_range;
+ if (prev_y_min != region->v2d.cur.ymin) {
+ const float cur_y_range = BLI_rctf_size_y(&region->v2d.cur);
+ region->v2d.cur.ymin = prev_y_min;
+ region->v2d.cur.ymax = prev_y_min + cur_y_range;
}
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* add drop boxes */
lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW);
- WM_event_add_dropbox_handler(&ar->handlers, lb);
+ WM_event_add_dropbox_handler(&region->handlers, lb);
}
/* same as 'text_cursor' */
-static void console_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *ar)
+static void console_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *region)
{
int wmcursor = WM_CURSOR_TEXT_EDIT;
const wmEvent *event = win->eventstate;
- if (UI_view2d_mouse_in_scrollers(ar, &ar->v2d, event->x, event->y)) {
+ if (UI_view2d_mouse_in_scrollers(region, &region->v2d, event->x, event->y)) {
wmcursor = WM_CURSOR_DEFAULT;
}
@@ -203,11 +203,11 @@ static void console_dropboxes(void)
/* ************* end drop *********** */
-static void console_main_region_draw(const bContext *C, ARegion *ar)
+static void console_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceConsole *sc = CTX_wm_space_console(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
if (BLI_listbase_is_empty(&sc->scrollback)) {
@@ -224,7 +224,7 @@ static void console_main_region_draw(const bContext *C, ARegion *ar)
/* data... */
console_history_verify(C); /* make sure we have some command line */
- console_textview_main(sc, ar);
+ console_textview_main(sc, region);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -267,18 +267,21 @@ static void console_keymap(struct wmKeyConfig *keyconf)
/****************** header region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void console_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void console_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void console_header_region_draw(const bContext *C, ARegion *ar)
+static void console_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
-static void console_main_region_listener(
- wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar, wmNotifier *wmn, const Scene *UNUSED(scene))
+static void console_main_region_listener(wmWindow *UNUSED(win),
+ ScrArea *sa,
+ ARegion *region,
+ wmNotifier *wmn,
+ const Scene *UNUSED(scene))
{
// SpaceInfo *sinfo = sa->spacedata.first;
@@ -289,13 +292,13 @@ static void console_main_region_listener(
if (wmn->action == NA_EDITED) {
if ((wmn->reference && sa) && (wmn->reference == sa->spacedata.first)) {
/* we've modified the geometry (font size), re-calculate rect */
- console_textview_update_rect(wmn->reference, ar);
- ED_region_tag_redraw(ar);
+ console_textview_update_rect(wmn->reference, region);
+ ED_region_tag_redraw(region);
}
}
else {
/* generic redraw request */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
break;
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index db29d058e49..10c56901eca 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -201,12 +201,12 @@ static void file_draw_string(int sx,
});
}
-void file_calc_previews(const bContext *C, ARegion *ar)
+void file_calc_previews(const bContext *C, ARegion *region)
{
SpaceFile *sfile = CTX_wm_space_file(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
- ED_fileselect_init_layout(sfile, ar);
+ ED_fileselect_init_layout(sfile, region);
UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height);
}
@@ -384,7 +384,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = (SpaceFile *)CTX_wm_space_data(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const char *blendfile_path = BKE_main_blendfile_path(bmain);
BLI_make_file_string(blendfile_path, orgname, sfile->params->dir, oldname);
@@ -415,7 +415,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
ED_fileselect_clear(wm, sa, sfile);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
@@ -669,17 +669,17 @@ static void draw_details_columns(const FileSelectParams *params,
}
}
-void file_draw_list(const bContext *C, ARegion *ar)
+void file_draw_list(const bContext *C, ARegion *region)
{
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
- FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
- View2D *v2d = &ar->v2d;
+ FileLayout *layout = ED_fileselect_get_layout(sfile, region);
+ View2D *v2d = &region->v2d;
struct FileList *files = sfile->files;
struct FileDirEntry *file;
const char *root = filelist_dir(files);
ImBuf *imb;
- uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
int numfiles;
int numfiles_layout;
int sx, sy;
@@ -700,12 +700,13 @@ void file_draw_list(const bContext *C, ARegion *ar)
draw_dividers(layout, v2d);
}
- offset = ED_fileselect_layout_offset(layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
+ offset = ED_fileselect_layout_offset(
+ layout, (int)region->v2d.cur.xmin, (int)-region->v2d.cur.ymax);
if (offset < 0) {
offset = 0;
}
- numfiles_layout = ED_fileselect_layout_numfiles(layout, ar);
+ numfiles_layout = ED_fileselect_layout_numfiles(layout, region);
/* adjust, so the next row is already drawn when scrolling */
if (layout->flag & FILE_LAYOUT_HOR) {
@@ -851,7 +852,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
UI_but_func_rename_set(but, renamebutton_cb, file);
UI_but_flag_enable(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
UI_but_flag_disable(but, UI_BUT_UNDO);
- if (false == UI_but_active_only(C, ar, block, but)) {
+ if (false == UI_but_active_only(C, region, block, but)) {
file_selflag = filelist_entry_select_set(
sfile->files, file, FILE_SEL_REMOVE, FILE_SEL_EDITING, CHECK_ALL);
}
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 2ded69aef2f..6ef35132087 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -37,8 +37,8 @@ struct View2D;
#define SMALL_SIZE_CHECK(_size) ((_size) < 64) /* Related to FileSelectParams.thumbnail_size. */
-void file_calc_previews(const bContext *C, ARegion *ar);
-void file_draw_list(const bContext *C, ARegion *ar);
+void file_calc_previews(const bContext *C, ARegion *region);
+void file_draw_list(const bContext *C, ARegion *region);
void file_draw_check(bContext *C);
void file_draw_check_cb(bContext *C, void *arg1, void *arg2);
@@ -86,7 +86,7 @@ int file_delete_exec(bContext *C, struct wmOperator *unused);
void file_directory_enter_handle(bContext *C, void *arg_unused, void *arg_but);
void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but);
-int file_highlight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
+int file_highlight_set(struct SpaceFile *sfile, struct ARegion *region, int mx, int my);
void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath);
void file_sfile_to_operator_ex(bContext *C,
@@ -123,6 +123,6 @@ void file_tool_props_region_panels_register(struct ARegionType *art);
void file_execute_region_panels_register(struct ARegionType *art);
/* file_utils.c */
-void file_tile_boundbox(const ARegion *ar, FileLayout *layout, const int file, rcti *r_bounds);
+void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds);
#endif /* __FILE_INTERN_H__ */
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index e065c146962..e03d15d9f34 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -69,11 +69,13 @@
#include <errno.h>
/* ---------- FILE SELECTION ------------ */
-static FileSelection find_file_mouse_rect(SpaceFile *sfile, ARegion *ar, const rcti *rect_region)
+static FileSelection find_file_mouse_rect(SpaceFile *sfile,
+ ARegion *region,
+ const rcti *rect_region)
{
FileSelection sel;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
rcti rect_view;
rctf rect_view_fl;
rctf rect_region_fl;
@@ -141,12 +143,12 @@ static void clamp_to_filelist(int numfiles, FileSelection *sel)
static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
int numfiles = filelist_files_ensure(sfile->files);
FileSelection sel;
- sel = find_file_mouse_rect(sfile, ar, rect);
+ sel = find_file_mouse_rect(sfile, region, rect);
if (!((sel.first == -1) && (sel.last == -1))) {
clamp_to_filelist(numfiles, &sel);
}
@@ -253,34 +255,34 @@ static bool file_is_any_selected(struct FileList *files)
/**
* If \a file is outside viewbounds, this adjusts view to make sure it's inside
*/
-static void file_ensure_inside_viewbounds(ARegion *ar, SpaceFile *sfile, const int file)
+static void file_ensure_inside_viewbounds(ARegion *region, SpaceFile *sfile, const int file)
{
- FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
- rctf *cur = &ar->v2d.cur;
+ FileLayout *layout = ED_fileselect_get_layout(sfile, region);
+ rctf *cur = &region->v2d.cur;
rcti rect;
bool changed = true;
- file_tile_boundbox(ar, layout, file, &rect);
+ file_tile_boundbox(region, layout, file, &rect);
/* down - also use if tile is higher than viewbounds so view is aligned to file name */
- if (cur->ymin > rect.ymin || layout->tile_h > ar->winy) {
+ if (cur->ymin > rect.ymin || layout->tile_h > region->winy) {
cur->ymin = rect.ymin - (2 * layout->tile_border_y);
- cur->ymax = cur->ymin + ar->winy;
+ cur->ymax = cur->ymin + region->winy;
}
/* up */
else if ((cur->ymax - layout->offset_top) < rect.ymax) {
cur->ymax = rect.ymax + layout->tile_border_y + layout->offset_top;
- cur->ymin = cur->ymax - ar->winy;
+ cur->ymin = cur->ymax - region->winy;
}
/* left - also use if tile is wider than viewbounds so view is aligned to file name */
- else if (cur->xmin > rect.xmin || layout->tile_w > ar->winx) {
+ else if (cur->xmin > rect.xmin || layout->tile_w > region->winx) {
cur->xmin = rect.xmin - layout->tile_border_x;
- cur->xmax = cur->xmin + ar->winx;
+ cur->xmax = cur->xmin + region->winx;
}
/* right */
else if (cur->xmax < rect.xmax) {
cur->xmax = rect.xmax + (2 * layout->tile_border_x);
- cur->xmin = cur->xmax - ar->winx;
+ cur->xmin = cur->xmax - region->winx;
}
else {
BLI_assert(cur->xmin <= rect.xmin && cur->xmax >= rect.xmax && cur->ymin <= rect.ymin &&
@@ -289,7 +291,7 @@ static void file_ensure_inside_viewbounds(ARegion *ar, SpaceFile *sfile, const i
}
if (changed) {
- UI_view2d_curRect_validate(&ar->v2d);
+ UI_view2d_curRect_validate(&region->v2d);
}
}
@@ -323,16 +325,16 @@ static FileSelect file_select(
sfile->params->active_file = -1;
}
else if (sel.last >= 0) {
- ARegion *ar = CTX_wm_region(C);
- const FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
+ ARegion *region = CTX_wm_region(C);
+ const FileLayout *layout = ED_fileselect_get_layout(sfile, region);
/* Adjust view to display selection. Doing iterations for first and last
* selected item makes view showing as much of the selection possible.
* Not really useful if tiles are (almost) bigger than viewbounds though. */
- if (((layout->flag & FILE_LAYOUT_HOR) && ar->winx > (1.2f * layout->tile_w)) ||
- ((layout->flag & FILE_LAYOUT_VER) && ar->winy > (2.0f * layout->tile_h))) {
- file_ensure_inside_viewbounds(ar, sfile, sel.last);
- file_ensure_inside_viewbounds(ar, sfile, sel.first);
+ if (((layout->flag & FILE_LAYOUT_HOR) && region->winx > (1.2f * layout->tile_w)) ||
+ ((layout->flag & FILE_LAYOUT_VER) && region->winy > (2.0f * layout->tile_h))) {
+ file_ensure_inside_viewbounds(region, sfile, sel.last);
+ file_ensure_inside_viewbounds(region, sfile, sel.first);
}
}
@@ -343,19 +345,19 @@ static FileSelect file_select(
}
static int file_box_select_find_last_selected(SpaceFile *sfile,
- ARegion *ar,
+ ARegion *region,
const FileSelection *sel,
const int mouse_xy[2])
{
- FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
+ FileLayout *layout = ED_fileselect_get_layout(sfile, region);
rcti bounds_first, bounds_last;
int dist_first, dist_last;
float mouseco_view[2];
- UI_view2d_region_to_view(&ar->v2d, UNPACK2(mouse_xy), &mouseco_view[0], &mouseco_view[1]);
+ UI_view2d_region_to_view(&region->v2d, UNPACK2(mouse_xy), &mouseco_view[0], &mouseco_view[1]);
- file_tile_boundbox(ar, layout, sel->first, &bounds_first);
- file_tile_boundbox(ar, layout, sel->last, &bounds_last);
+ file_tile_boundbox(region, layout, sel->first, &bounds_first);
+ file_tile_boundbox(region, layout, sel->last, &bounds_last);
/* are first and last in the same column (horizontal layout)/row (vertical layout)? */
if ((layout->flag & FILE_LAYOUT_HOR && bounds_first.xmin == bounds_last.xmin) ||
@@ -377,7 +379,7 @@ static int file_box_select_find_last_selected(SpaceFile *sfile,
static int file_box_select_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
FileSelection sel;
@@ -390,7 +392,7 @@ static int file_box_select_modal(bContext *C, wmOperator *op, const wmEvent *eve
if (result == OPERATOR_RUNNING_MODAL) {
WM_operator_properties_border_to_rcti(op, &rect);
- ED_fileselect_layout_isect_rect(sfile->layout, &ar->v2d, &rect, &rect);
+ ED_fileselect_layout_isect_rect(sfile->layout, &region->v2d, &rect, &rect);
sel = file_selection_get(C, &rect, 0);
if ((sel.first != params->sel_first) || (sel.last != params->sel_last)) {
@@ -418,7 +420,7 @@ static int file_box_select_modal(bContext *C, wmOperator *op, const wmEvent *eve
}
params->sel_first = sel.first;
params->sel_last = sel.last;
- params->active_file = file_box_select_find_last_selected(sfile, ar, &sel, event->mval);
+ params->active_file = file_box_select_find_last_selected(sfile, region, &sel, event->mval);
}
else {
params->highlight_file = -1;
@@ -433,7 +435,7 @@ static int file_box_select_modal(bContext *C, wmOperator *op, const wmEvent *eve
static int file_box_select_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
rcti rect;
FileSelect ret;
@@ -446,7 +448,7 @@ static int file_box_select_exec(bContext *C, wmOperator *op)
file_deselect_all(sfile, FILE_SEL_SELECTED);
}
- ED_fileselect_layout_isect_rect(sfile->layout, &ar->v2d, &rect, &rect);
+ ED_fileselect_layout_isect_rect(sfile->layout, &region->v2d, &rect, &rect);
ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, false, false);
@@ -484,7 +486,7 @@ void FILE_OT_select_box(wmOperatorType *ot)
static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelect ret;
rcti rect;
@@ -493,14 +495,14 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const bool do_diropen = RNA_boolean_get(op->ptr, "open");
const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
- if (ar->regiontype != RGN_TYPE_WINDOW) {
+ if (region->regiontype != RGN_TYPE_WINDOW) {
return OPERATOR_CANCELLED;
}
rect.xmin = rect.xmax = event->mval[0];
rect.ymin = rect.ymax = event->mval[1];
- if (!ED_fileselect_layout_is_inside_pt(sfile->layout, &ar->v2d, rect.xmin, rect.ymin)) {
+ if (!ED_fileselect_layout_is_inside_pt(sfile->layout, &region->v2d, rect.xmin, rect.ymin)) {
return OPERATOR_CANCELLED;
}
@@ -579,7 +581,7 @@ void FILE_OT_select(wmOperatorType *ot)
* \returns true if selection has changed
*/
static bool file_walk_select_selection_set(wmWindow *win,
- ARegion *ar,
+ ARegion *region,
SpaceFile *sfile,
const int direction,
const int numfiles,
@@ -687,7 +689,7 @@ static bool file_walk_select_selection_set(wmWindow *win,
fileselect_file_set(sfile, params->active_file);
/* ensure newly selected file is inside viewbounds */
- file_ensure_inside_viewbounds(ar, sfile, params->active_file);
+ file_ensure_inside_viewbounds(region, sfile, params->active_file);
/* selection changed */
return true;
@@ -704,7 +706,7 @@ static bool file_walk_select_do(bContext *C,
const bool fill)
{
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
struct FileList *files = sfile->files;
const int numfiles = filelist_files_ensure(files);
const bool has_selection = file_is_any_selected(files);
@@ -720,7 +722,7 @@ static bool file_walk_select_do(bContext *C,
}
if (has_selection) {
- FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
+ FileLayout *layout = ED_fileselect_get_layout(sfile, region);
const int idx_shift = (layout->flag & FILE_LAYOUT_HOR) ? layout->rows : layout->flow_columns;
if ((layout->flag & FILE_LAYOUT_HOR && direction == UI_SELECT_WALK_UP) ||
@@ -766,7 +768,7 @@ static bool file_walk_select_do(bContext *C,
}
return file_walk_select_selection_set(win,
- ar,
+ region,
sfile,
direction,
numfiles,
@@ -1186,9 +1188,9 @@ void FILE_OT_reset_recent(wmOperatorType *ot)
ot->poll = ED_operator_file_active;
}
-int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
+int file_highlight_set(SpaceFile *sfile, ARegion *region, int mx, int my)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
FileSelectParams *params;
int numfiles, origfile;
@@ -1201,8 +1203,8 @@ int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
origfile = params->highlight_file;
- mx -= ar->winrct.xmin;
- my -= ar->winrct.ymin;
+ mx -= region->winrct.xmin;
+ my -= region->winrct.ymin;
if (ED_fileselect_layout_is_inside_pt(sfile->layout, v2d, mx, my)) {
float fx, fy;
@@ -1229,10 +1231,10 @@ int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
- if (!file_highlight_set(sfile, ar, event->x, event->y)) {
+ if (!file_highlight_set(sfile, region, event->x, event->y)) {
return OPERATOR_PASS_THROUGH;
}
@@ -1257,13 +1259,13 @@ static int file_column_sort_ui_context_invoke(bContext *C,
wmOperator *UNUSED(op),
const wmEvent *event)
{
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
if (file_attribute_column_header_is_inside(
- &ar->v2d, sfile->layout, event->mval[0], event->mval[1])) {
+ &region->v2d, sfile->layout, event->mval[0], event->mval[1])) {
const FileAttributeColumnType column_type = file_attribute_column_type_find_isect(
- &ar->v2d, sfile->params, sfile->layout, event->mval[0]);
+ &region->v2d, sfile->params, sfile->layout, event->mval[0]);
if (column_type != COLUMN_NONE) {
const FileAttributeColumn *column = &sfile->layout->attribute_columns[column_type];
@@ -1725,7 +1727,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
{
ScrArea *sa = CTX_wm_area(C);
SpaceFile *sfile = CTX_wm_space_file(C);
- ARegion *ar, *ar_ctx = CTX_wm_region(C);
+ ARegion *region, *ar_ctx = CTX_wm_region(C);
const bool is_horizontal = (sfile->layout->flag & FILE_LAYOUT_HOR) != 0;
int i;
@@ -1767,8 +1769,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
}
/* we need the correct area for scrolling */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (!ar || ar->regiontype != RGN_TYPE_WINDOW) {
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (!region || region->regiontype != RGN_TYPE_WINDOW) {
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
sfile->smoothscroll_timer = NULL;
return OPERATOR_PASS_THROUGH;
@@ -1784,9 +1786,9 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
sfile->scroll_offset = (edit_idx / items_block_size) * items_block_size;
}
- const int numfiles_layout = ED_fileselect_layout_numfiles(sfile->layout, ar);
+ const int numfiles_layout = ED_fileselect_layout_numfiles(sfile->layout, region);
const int first_visible_item = ED_fileselect_layout_offset(
- sfile->layout, (int)ar->v2d.cur.xmin, (int)-ar->v2d.cur.ymax);
+ sfile->layout, (int)region->v2d.cur.xmin, (int)-region->v2d.cur.ymax);
const int last_visible_item = first_visible_item + numfiles_layout + 1;
/* Note: the special case for vertical layout is because filename is at the bottom of items then,
@@ -1803,10 +1805,10 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
* beginning/end of the view. */
/* Note that there is a weird glitch, that sometimes tot rctf is smaller than cur rctf...
* that is why we still need to keep the min/max_middle_offset checks too. :( */
- const float min_tot_scroll = is_horizontal ? ar->v2d.tot.xmin : -ar->v2d.tot.ymax;
- const float max_tot_scroll = is_horizontal ? ar->v2d.tot.xmax : -ar->v2d.tot.ymin;
- const float min_curr_scroll = is_horizontal ? ar->v2d.cur.xmin : -ar->v2d.cur.ymax;
- const float max_curr_scroll = is_horizontal ? ar->v2d.cur.xmax : -ar->v2d.cur.ymin;
+ const float min_tot_scroll = is_horizontal ? region->v2d.tot.xmin : -region->v2d.tot.ymax;
+ const float max_tot_scroll = is_horizontal ? region->v2d.tot.xmax : -region->v2d.tot.ymin;
+ const float min_curr_scroll = is_horizontal ? region->v2d.cur.xmin : -region->v2d.cur.ymax;
+ const float max_curr_scroll = is_horizontal ? region->v2d.cur.xmax : -region->v2d.cur.ymin;
/* Check if we have reached our final scroll position. */
/* Filelist has to be ready, otherwise it makes no sense to stop scrolling yet. */
@@ -1840,7 +1842,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
/* Temporarily set context to the main window region,
* so that the pan operator works. */
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
/* scroll one step in the desired direction */
PointerRNA op_ptr;
@@ -1886,7 +1888,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
WM_operator_name_call(C, "VIEW2D_OT_pan", WM_OP_EXEC_DEFAULT, &op_ptr);
WM_operator_properties_free(&op_ptr);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
/* and restore context */
CTX_wm_region_set(C, ar_ctx);
@@ -2535,10 +2537,10 @@ void FILE_OT_delete(struct wmOperatorType *ot)
static int file_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_UI);
SpaceFile *sf = CTX_wm_space_file(C);
- UI_textbutton_activate_rna(C, ar, sf->params, "filter_search");
+ UI_textbutton_activate_rna(C, region, sf->params, "filter_search");
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_file/file_utils.c b/source/blender/editors/space_file/file_utils.c
index a432afc4d99..61ddd7d63f2 100644
--- a/source/blender/editors/space_file/file_utils.c
+++ b/source/blender/editors/space_file/file_utils.c
@@ -32,12 +32,12 @@
#include "file_intern.h"
-void file_tile_boundbox(const ARegion *ar, FileLayout *layout, const int file, rcti *r_bounds)
+void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds)
{
int xmin, ymax;
ED_fileselect_layout_tilepos(layout, file, &xmin, &ymax);
- ymax = (int)ar->v2d.tot.ymax - ymax; /* real, view space ymax */
+ ymax = (int)region->v2d.tot.ymax - ymax; /* real, view space ymax */
BLI_rcti_init(r_bounds,
xmin,
xmin + layout->tile_w + layout->tile_border_x,
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 02fb98aa7d7..c0b859122a8 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -413,7 +413,7 @@ void fileselect_file_set(SpaceFile *sfile, const int index)
}
}
-int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar)
+int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *region)
{
int numfiles;
@@ -429,14 +429,14 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar)
*/
if (layout->flag & FILE_LAYOUT_HOR) {
const int x_item = layout->tile_w + (2 * layout->tile_border_x);
- const int x_view = (int)(BLI_rctf_size_x(&ar->v2d.cur));
+ const int x_view = (int)(BLI_rctf_size_x(&region->v2d.cur));
const int x_over = x_item - (x_view % x_item);
numfiles = (int)((float)(x_view + x_over) / (float)(x_item));
return numfiles * layout->rows;
}
else {
const int y_item = layout->tile_h + (2 * layout->tile_border_y);
- const int y_view = (int)(BLI_rctf_size_y(&ar->v2d.cur)) - layout->offset_top;
+ const int y_view = (int)(BLI_rctf_size_y(&region->v2d.cur)) - layout->offset_top;
const int y_over = y_item - (y_view % y_item);
numfiles = (int)((float)(y_view + y_over) / (float)(y_item));
return numfiles * layout->flow_columns;
@@ -720,11 +720,11 @@ static void file_attribute_columns_init(const FileSelectParams *params, FileLayo
layout->attribute_columns[COLUMN_SIZE].text_align = UI_STYLE_TEXT_RIGHT;
}
-void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
+void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *region)
{
FileSelectParams *params = ED_fileselect_get_params(sfile);
FileLayout *layout = NULL;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
int numfiles;
int textheight;
@@ -817,10 +817,10 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->dirty = false;
}
-FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, ARegion *ar)
+FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, ARegion *region)
{
if (!sfile->layout) {
- ED_fileselect_init_layout(sfile, ar);
+ ED_fileselect_init_layout(sfile, region);
}
return sfile->layout;
}
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 79ccbf6542f..c7dee1c1680 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -57,79 +57,79 @@
static ARegion *file_execute_region_ensure(ScrArea *sa, ARegion *ar_prev)
{
- ARegion *ar;
+ ARegion *region;
- if ((ar = BKE_area_find_region_type(sa, RGN_TYPE_EXECUTE)) != NULL) {
- return ar;
+ if ((region = BKE_area_find_region_type(sa, RGN_TYPE_EXECUTE)) != NULL) {
+ return region;
}
- ar = MEM_callocN(sizeof(ARegion), "execute region for file");
- BLI_insertlinkafter(&sa->regionbase, ar_prev, ar);
- ar->regiontype = RGN_TYPE_EXECUTE;
- ar->alignment = RGN_ALIGN_BOTTOM;
- ar->flag = RGN_FLAG_DYNAMIC_SIZE;
+ region = MEM_callocN(sizeof(ARegion), "execute region for file");
+ BLI_insertlinkafter(&sa->regionbase, ar_prev, region);
+ region->regiontype = RGN_TYPE_EXECUTE;
+ region->alignment = RGN_ALIGN_BOTTOM;
+ region->flag = RGN_FLAG_DYNAMIC_SIZE;
- return ar;
+ return region;
}
static ARegion *file_tool_props_region_ensure(ScrArea *sa, ARegion *ar_prev)
{
- ARegion *ar;
+ ARegion *region;
- if ((ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS)) != NULL) {
- return ar;
+ if ((region = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS)) != NULL) {
+ return region;
}
/* add subdiv level; after execute region */
- ar = MEM_callocN(sizeof(ARegion), "tool props for file");
- BLI_insertlinkafter(&sa->regionbase, ar_prev, ar);
- ar->regiontype = RGN_TYPE_TOOL_PROPS;
- ar->alignment = RGN_ALIGN_RIGHT;
+ region = MEM_callocN(sizeof(ARegion), "tool props for file");
+ BLI_insertlinkafter(&sa->regionbase, ar_prev, region);
+ region->regiontype = RGN_TYPE_TOOL_PROPS;
+ region->alignment = RGN_ALIGN_RIGHT;
- return ar;
+ return region;
}
/* ******************** default callbacks for file space ***************** */
static SpaceLink *file_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceFile *sfile;
sfile = MEM_callocN(sizeof(SpaceFile), "initfile");
sfile->spacetype = SPACE_FILE;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for file");
- BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
+ region = MEM_callocN(sizeof(ARegion), "header for file");
+ BLI_addtail(&sfile->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
/* Ignore user preference "USER_HEADER_BOTTOM" here (always show top for new types). */
- ar->alignment = RGN_ALIGN_TOP;
+ region->alignment = RGN_ALIGN_TOP;
/* Tools region */
- ar = MEM_callocN(sizeof(ARegion), "tools region for file");
- BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
+ region = MEM_callocN(sizeof(ARegion), "tools region for file");
+ BLI_addtail(&sfile->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
/* ui list region */
- ar = MEM_callocN(sizeof(ARegion), "ui region for file");
- BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_TOP;
- ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
+ region = MEM_callocN(sizeof(ARegion), "ui region for file");
+ BLI_addtail(&sfile->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_TOP;
+ region->flag |= RGN_FLAG_DYNAMIC_SIZE;
/* Tool props and execute region are added as needed, see file_refresh(). */
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for file");
- BLI_addtail(&sfile->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+ region = MEM_callocN(sizeof(ARegion), "main region for file");
+ BLI_addtail(&sfile->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
return (SpaceLink *)sfile;
}
@@ -369,23 +369,23 @@ static void file_listener(wmWindow *UNUSED(win),
}
/* add handlers, stuff you only do once or on area/region changes */
-static void file_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void file_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
/* own keymaps */
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
static void file_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -394,10 +394,10 @@ static void file_main_region_listener(wmWindow *UNUSED(win),
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_SPACE_FILE_PARAMS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -409,7 +409,7 @@ static void file_main_region_message_subscribe(const struct bContext *UNUSED(C),
struct Scene *UNUSED(scene),
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
SpaceFile *sfile = sa->spacedata.first;
@@ -418,7 +418,7 @@ static void file_main_region_message_subscribe(const struct bContext *UNUSED(C),
* keep for now since all subscribers for WM are regions.
* May be worth re-visiting later. */
wmMsgSubscribeValue msg_sub_value_area_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = sa,
.notify = ED_area_do_msg_notify_tag_refresh,
};
@@ -442,13 +442,13 @@ static void file_main_region_message_subscribe(const struct bContext *UNUSED(C),
}
}
-static void file_main_region_draw(const bContext *C, ARegion *ar)
+static void file_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceFile *sfile = CTX_wm_space_file(C);
FileSelectParams *params = ED_fileselect_get_params(sfile);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
float col[3];
@@ -487,10 +487,10 @@ static void file_main_region_draw(const bContext *C, ARegion *ar)
}
}
/* v2d has initialized flag, so this call will only set the mask correct */
- UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
/* sets tile/border settings in sfile */
- file_calc_previews(C, ar);
+ file_calc_previews(C, region);
/* set view */
UI_view2d_view_ortho(v2d);
@@ -498,10 +498,10 @@ static void file_main_region_draw(const bContext *C, ARegion *ar)
/* on first read, find active file */
if (params->highlight_file == -1) {
wmEvent *event = CTX_wm_window(C)->eventstate;
- file_highlight_set(sfile, ar, event->x, event->y);
+ file_highlight_set(sfile, region, event->x, event->y);
}
- file_draw_list(C, ar);
+ file_draw_list(C, region);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -557,26 +557,26 @@ static void file_keymap(struct wmKeyConfig *keyconf)
WM_keymap_ensure(keyconf, "File Browser Buttons", SPACE_FILE, 0);
}
-static void file_tools_region_init(wmWindowManager *wm, ARegion *ar)
+static void file_tools_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ ED_region_panels_init(wm, region);
/* own keymaps */
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void file_tools_region_draw(const bContext *C, ARegion *ar)
+static void file_tools_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void file_tools_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
@@ -589,62 +589,62 @@ static void file_tools_region_listener(wmWindow *UNUSED(win),
}
/* add handlers, stuff you only do once or on area/region changes */
-static void file_header_region_init(wmWindowManager *wm, ARegion *ar)
+static void file_header_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_header_init(ar);
+ ED_region_header_init(region);
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void file_header_region_draw(const bContext *C, ARegion *ar)
+static void file_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/* add handlers, stuff you only do once or on area/region changes */
-static void file_ui_region_init(wmWindowManager *wm, ARegion *ar)
+static void file_ui_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
- ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
+ ED_region_panels_init(wm, region);
+ region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void file_ui_region_draw(const bContext *C, ARegion *ar)
+static void file_ui_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
-static void file_execution_region_init(wmWindowManager *wm, ARegion *ar)
+static void file_execution_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
- ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
+ ED_region_panels_init(wm, region);
+ region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void file_execution_region_draw(const bContext *C, ARegion *ar)
+static void file_execution_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void file_ui_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -653,7 +653,7 @@ static void file_ui_region_listener(wmWindow *UNUSED(win),
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index f61eb15b3c2..e1edb07ab68 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -352,9 +352,9 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
BezTriple *bezt, *prevbezt;
uiLayout *layout = pa->layout;
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
/* Just a width big enough so buttons use entire layout width (will be clamped by it then). */
- const int but_max_width = ar->winx;
+ const int but_max_width = region->winx;
uiLayout *col;
uiBlock *block;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 8dd5a7c7d0c..f86ca60cefe 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -274,9 +274,12 @@ static void draw_fcurve_handle_vertices(FCurve *fcu, View2D *v2d, bool sel_handl
immUnbindProgram();
}
-static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool sel_handle_only)
+static void draw_fcurve_vertices(ARegion *region,
+ FCurve *fcu,
+ bool do_handles,
+ bool sel_handle_only)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* only draw points if curve is visible
* - Draw unselected points before selected points as separate passes
@@ -446,14 +449,14 @@ static void draw_fcurve_sample_control(
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu)
+static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
/* get view settings */
hsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
- UI_view2d_scale_get(&ar->v2d, &xscale, &yscale);
+ UI_view2d_scale_get(&region->v2d, &xscale, &yscale);
/* get verts */
first = fcu->fpt;
@@ -869,7 +872,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
{
ChannelDriver *driver = fcu->driver;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short mapping_flag = ANIM_get_normalization_flags(ac);
float offset;
float unitfac = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset);
@@ -982,7 +985,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
*/
-void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar)
+void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region)
{
FCurve *fcu;
@@ -1017,7 +1020,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar)
immUniformColor3fvAlpha(fcu->color, 0.5f);
/* simply draw the stored samples */
- draw_fcurve_curve_samples(ac, NULL, fcu, &ar->v2d, shdr_pos);
+ draw_fcurve_curve_samples(ac, NULL, fcu, &region->v2d, shdr_pos);
}
immUnbindProgram();
@@ -1031,7 +1034,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar)
/* This is called twice from space_graph.c -> graph_main_region_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
-void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short sel)
+void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -1118,20 +1121,20 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se
/* draw a curve affected by modifiers or only allowed to have integer values
* by sampling it at various small-intervals over the visible region
*/
- draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, shdr_pos);
+ draw_fcurve_curve(ac, ale->id, fcu, &region->v2d, shdr_pos);
}
else if (((fcu->bezt) || (fcu->fpt)) && (fcu->totvert)) {
/* just draw curve based on defined data (i.e. no modifiers) */
if (fcu->bezt) {
if (fcurve_can_use_simple_bezt_drawing(fcu)) {
- draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, shdr_pos);
+ draw_fcurve_curve_bezts(ac, ale->id, fcu, &region->v2d, shdr_pos);
}
else {
- draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, shdr_pos);
+ draw_fcurve_curve(ac, ale->id, fcu, &region->v2d, shdr_pos);
}
}
else if (fcu->fpt) {
- draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d, shdr_pos);
+ draw_fcurve_curve_samples(ac, ale->id, fcu, &region->v2d, shdr_pos);
}
}
@@ -1153,7 +1156,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
switch (fcm->type) {
case FMODIFIER_TYPE_ENVELOPE: /* envelope */
- draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d);
+ draw_fcurve_modifier_controls_envelope(fcm, &region->v2d);
break;
}
}
@@ -1183,11 +1186,11 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se
GPU_blend(false);
}
- draw_fcurve_vertices(ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
+ draw_fcurve_vertices(region, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
}
else {
/* samples: only draw two indicators at either end as indicators */
- draw_fcurve_samples(sipo, ar, fcu);
+ draw_fcurve_samples(sipo, region, fcu);
}
GPU_matrix_pop();
@@ -1213,13 +1216,13 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *ar, short se
/* Channel List */
/* left hand part */
-void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
+void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
float height;
size_t items;
@@ -1250,7 +1253,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
}
}
{ /* second pass: widgets */
- uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
size_t channel_index = 0;
float ymax = ACHANNEL_FIRST_TOP(ac);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 623d7e287d2..7580666c5f0 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -297,9 +297,9 @@ static int graphkeys_viewall(bContext *C,
float pad_top = UI_TIME_SCRUB_MARGIN_Y;
float pad_bottom = BLI_listbase_is_empty(ED_context_get_markers(C)) ? V2D_SCROLL_HANDLE_HEIGHT :
UI_MARKER_MARGIN_Y;
- BLI_rctf_pad_y(&cur_new, ac.ar->winy, pad_bottom, pad_top);
+ BLI_rctf_pad_y(&cur_new, ac.region->winy, pad_bottom, pad_top);
- UI_view2d_smooth_view(C, ac.ar, &cur_new, smooth_viewtx);
+ UI_view2d_smooth_view(C, ac.region, &cur_new, smooth_viewtx);
return OPERATOR_FINISHED;
}
@@ -486,7 +486,7 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
/* Ghost curves are snapshots of the visible portions of the curves,
* so set range to be the visible range. */
- v2d = &ac.ar->v2d;
+ v2d = &ac.region->v2d;
start = (int)v2d->cur.xmin;
end = (int)v2d->cur.xmax;
@@ -871,7 +871,7 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
static int graphkeys_click_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
bAnimContext ac;
- ARegion *ar;
+ ARegion *region;
View2D *v2d;
int mval[2];
float x, y;
@@ -882,11 +882,11 @@ static int graphkeys_click_insert_invoke(bContext *C, wmOperator *op, const wmEv
}
/* store mouse coordinates in View2D space, into the operator's properties */
- ar = ac.ar;
- v2d = &ar->v2d;
+ region = ac.region;
+ v2d = &region->v2d;
- mval[0] = (event->x - ar->winrct.xmin);
- mval[1] = (event->y - ar->winrct.ymin);
+ mval[0] = (event->x - region->winrct.xmin);
+ mval[1] = (event->y - region->winrct.ymin);
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
@@ -1337,7 +1337,7 @@ typedef struct tDecimateGraphOp {
bAnimContext ac;
Scene *scene;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
/** A 0-1 value for determining how much we should decimate. */
PropertyRNA *percentage_prop;
@@ -1460,7 +1460,7 @@ static void decimate_mouse_update_percentage(tDecimateGraphOp *dgo,
wmOperator *op,
const wmEvent *event)
{
- float percentage = (event->x - dgo->ar->winrct.xmin) / ((float)dgo->ar->winx);
+ float percentage = (event->x - dgo->region->winrct.xmin) / ((float)dgo->region->winx);
RNA_property_float_set(op->ptr, dgo->percentage_prop, percentage);
}
@@ -1483,7 +1483,7 @@ static int graphkeys_decimate_invoke(bContext *C, wmOperator *op, const wmEvent
dgo->scene = CTX_data_scene(C);
dgo->sa = CTX_wm_area(C);
- dgo->ar = CTX_wm_region(C);
+ dgo->region = CTX_wm_region(C);
/* initialise percentage so that it will have the correct value before the first mouse move. */
decimate_mouse_update_percentage(dgo, op, event);
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index abd8d2db04a..3ec36e43278 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -35,13 +35,15 @@ struct bContext;
/* ***************************************** */
/* graph_draw.c */
-void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar);
+void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region);
void graph_draw_curves(struct bAnimContext *ac,
struct SpaceGraph *sipo,
- struct ARegion *ar,
+ struct ARegion *region,
short sel);
-void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceGraph *sipo, struct ARegion *ar);
+void graph_draw_ghost_curves(struct bAnimContext *ac,
+ struct SpaceGraph *sipo,
+ struct ARegion *region);
/* ***************************************** */
/* graph_select.c */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 17cf5dca594..83aa0aa6eab 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -129,16 +129,16 @@ static int graphview_cursor_exec(bContext *C, wmOperator *op)
/* set the operator properties from the initial event */
static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float viewx, viewy;
/* abort if not active region (should not really be possible) */
- if (ar == NULL) {
+ if (region == NULL) {
return;
}
/* convert from region coordinates to View2D 'tot' space */
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
/* store the values in the operator properties */
/* NOTE: we don't clamp frame here, as it might be used for the drivers cursor */
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 82b8277cde5..94870cf0d81 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -179,7 +179,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
int filter;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
short mapping_flag = 0;
/* get curves to search through
@@ -521,7 +521,7 @@ static void box_select_graphkeys(bAnimContext *ac,
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked;
KeyframeEditFunc ok_cb, select_cb;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
rctf rectf, scaled_rectf;
/* Convert mouse coordinates to frame ranges and
@@ -1370,8 +1370,8 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const
/* handle mode-based testing */
if (leftright == GRAPHKEYS_LRSEL_TEST) {
Scene *scene = ac.scene;
- ARegion *ar = ac.ar;
- View2D *v2d = &ar->v2d;
+ ARegion *region = ac.region;
+ View2D *v2d = &region->v2d;
float x;
/* determine which side of the current frame mouse is on */
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index d01e4112fd0..330d309411e 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -66,7 +66,7 @@
static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene)
{
- ARegion *ar;
+ ARegion *region;
SpaceGraph *sipo;
/* Graph Editor - general stuff */
@@ -84,52 +84,52 @@ static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene)
sipo->flag |= SIPO_SELVHANDLESONLY | SIPO_SHOW_MARKERS;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for graphedit");
+ region = MEM_callocN(sizeof(ARegion), "header for graphedit");
- BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sipo->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* channels */
- ar = MEM_callocN(sizeof(ARegion), "channels region for graphedit");
+ region = MEM_callocN(sizeof(ARegion), "channels region for graphedit");
- BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
+ BLI_addtail(&sipo->regionbase, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
/* ui buttons */
- ar = MEM_callocN(sizeof(ARegion), "buttons region for graphedit");
+ region = MEM_callocN(sizeof(ARegion), "buttons region for graphedit");
- BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&sipo->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for graphedit");
+ region = MEM_callocN(sizeof(ARegion), "main region for graphedit");
- BLI_addtail(&sipo->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sipo->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin = 0.0f;
- ar->v2d.tot.ymin = (float)scene->r.sfra - 10.0f;
- ar->v2d.tot.xmax = (float)scene->r.efra;
- ar->v2d.tot.ymax = 10.0f;
+ region->v2d.tot.xmin = 0.0f;
+ region->v2d.tot.ymin = (float)scene->r.sfra - 10.0f;
+ region->v2d.tot.xmax = (float)scene->r.efra;
+ region->v2d.tot.ymax = 10.0f;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = FLT_MIN;
- ar->v2d.min[1] = FLT_MIN;
+ region->v2d.min[0] = FLT_MIN;
+ region->v2d.min[1] = FLT_MIN;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = FLT_MAX;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = FLT_MAX;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES);
+ region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES);
- ar->v2d.keeptot = 0;
+ region->v2d.keeptot = 0;
return (SpaceLink *)sipo;
}
@@ -180,26 +180,26 @@ static SpaceLink *graph_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void graph_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void graph_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor", SPACE_GRAPH, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void graph_main_region_draw(const bContext *C, ARegion *ar)
+static void graph_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceGraph *sipo = CTX_wm_space_graph(C);
Scene *scene = CTX_data_scene(C);
bAnimContext ac;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
float col[3];
short cfra_flag = 0;
@@ -216,7 +216,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
UI_view2d_draw_lines_x__frames_or_seconds(v2d, scene, display_seconds);
UI_view2d_draw_lines_y__values(v2d);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
/* start and end frame (in F-Curve mode only) */
if (sipo->mode != SIPO_MODE_DRIVERS) {
@@ -226,11 +226,11 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* draw data */
if (ANIM_animdata_get_context(C, &ac)) {
/* draw ghost curves */
- graph_draw_ghost_curves(&ac, sipo, ar);
+ graph_draw_ghost_curves(&ac, sipo, region);
/* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */
- graph_draw_curves(&ac, sipo, ar, 0);
- graph_draw_curves(&ac, sipo, ar, 1);
+ graph_draw_curves(&ac, sipo, region, 0);
+ graph_draw_curves(&ac, sipo, region, 1);
/* XXX the slow way to set tot rect... but for nice sliders needed (ton) */
get_graph_keyframe_extents(
@@ -294,7 +294,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* markers */
if (sipo->mode != SIPO_MODE_DRIVERS) {
- UI_view2d_view_orthoSpecial(ar, v2d, 1);
+ UI_view2d_view_orthoSpecial(region, v2d, 1);
int marker_draw_flag = DRAW_MARKERS_MARGIN;
if (sipo->flag & SIPO_SHOW_MARKERS) {
ED_markers_draw(C, marker_draw_flag);
@@ -309,13 +309,13 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* callback */
UI_view2d_view_ortho(v2d);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
/* time-scrubbing */
- ED_time_scrub_draw(ar, scene, display_seconds, false);
+ ED_time_scrub_draw(region, scene, display_seconds, false);
/* scrollers */
// FIXME: args for scrollers depend on the type of data being shown...
@@ -326,37 +326,38 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* scale numbers */
{
rcti rect;
- BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, ar->winy - UI_TIME_SCRUB_MARGIN_Y);
- UI_view2d_draw_scale_y__values(ar, v2d, &rect, TH_SCROLL_TEXT);
+ BLI_rcti_init(
+ &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
+ UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_SCROLL_TEXT);
}
}
-static void graph_channel_region_init(wmWindowManager *wm, ARegion *ar)
+static void graph_channel_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* make sure we keep the hide flags */
- ar->v2d.scroll |= V2D_SCROLL_RIGHT;
+ region->v2d.scroll |= V2D_SCROLL_RIGHT;
/* prevent any noise of past */
- ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM);
+ region->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM);
- ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
- ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
+ region->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
+ region->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void graph_channel_region_draw(const bContext *C, ARegion *ar)
+static void graph_channel_region_draw(const bContext *C, ARegion *region)
{
bAnimContext ac;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
float col[3];
@@ -369,11 +370,11 @@ static void graph_channel_region_draw(const bContext *C, ARegion *ar)
/* draw channels */
if (ANIM_animdata_get_context(C, &ac)) {
- graph_draw_channel_names((bContext *)C, &ac, ar);
+ graph_draw_channel_names((bContext *)C, &ac, region);
}
/* channel filter next to scrubbing area */
- ED_time_scrub_channel_search_draw(C, ar, ac.ads);
+ ED_time_scrub_channel_search_draw(C, region, ac.ads);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -385,42 +386,42 @@ static void graph_channel_region_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void graph_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void graph_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void graph_header_region_draw(const bContext *C, ARegion *ar)
+static void graph_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/* add handlers, stuff you only do once or on area/region changes */
-static void graph_buttons_region_init(wmWindowManager *wm, ARegion *ar)
+static void graph_buttons_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Graph Editor Generic", SPACE_GRAPH, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void graph_buttons_region_draw(const bContext *C, ARegion *ar)
+static void graph_buttons_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void graph_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
@@ -429,11 +430,11 @@ static void graph_region_listener(wmWindow *UNUSED(win),
case ND_FRAME:
case ND_FRAME_RANGE:
case ND_MARKERS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_SEQUENCER:
if (wmn->action == NA_SELECTED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -443,11 +444,11 @@ static void graph_region_listener(wmWindow *UNUSED(win),
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_MODIFIER:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -456,23 +457,23 @@ static void graph_region_listener(wmWindow *UNUSED(win),
switch (wmn->action) {
case NA_EDITED:
case NA_SELECTED:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -483,15 +484,15 @@ static void graph_region_message_subscribe(const struct bContext *UNUSED(C),
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceGraphEditor, sa->spacedata.first, &ptr);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index c455b7d7c54..d1b2c2330ac 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -78,7 +78,7 @@
#include "image_intern.h"
static void draw_render_info(
- const bContext *C, Scene *scene, Image *ima, ARegion *ar, float zoomx, float zoomy)
+ const bContext *C, Scene *scene, Image *ima, ARegion *region, float zoomx, float zoomy)
{
Render *re = RE_GetSceneRender(scene);
RenderData *rd = RE_engine_get_render_data(re);
@@ -91,7 +91,7 @@ static void draw_render_info(
if (rr && rr->text) {
float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
- ED_region_info_draw(ar, rr->text, fill_color, true);
+ ED_region_info_draw(region, rr->text, fill_color, true);
}
BKE_image_release_renderresult(stats_scene, ima);
@@ -104,7 +104,7 @@ static void draw_render_info(
if (total_tiles) {
/* find window pixel coordinates of origin */
int x, y;
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
GPU_matrix_push();
GPU_matrix_translate_2f(x, y);
@@ -141,7 +141,7 @@ static void draw_render_info(
/* used by node view too */
void ED_image_draw_info(Scene *scene,
- ARegion *ar,
+ ARegion *region,
bool color_manage,
bool use_default_view,
int channels,
@@ -157,7 +157,7 @@ void ED_image_draw_info(Scene *scene,
char str[256];
int dx = 6;
/* local coordinate visible rect inside region, to accommodate overlapping ui */
- const rcti *rect = ED_region_visible_rect(ar);
+ const rcti *rect = ED_region_visible_rect(region);
const int ymin = rect->ymin;
const int dy = ymin + 0.3f * UI_UNIT_Y;
@@ -185,7 +185,7 @@ void ED_image_draw_info(Scene *scene,
/* noisy, high contrast make impossible to read if lower alpha is used. */
immUniformColor4ub(0, 0, 0, 190);
- immRecti(pos, 0, ymin, BLI_rcti_size_x(&ar->winrct) + 1, ymin + UI_UNIT_Y);
+ immRecti(pos, 0, ymin, BLI_rcti_size_x(&region->winrct) + 1, ymin + UI_UNIT_Y);
immUnbindProgram();
@@ -532,7 +532,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene,
MEM_freeN(rectf);
}
-static void draw_udim_label(ARegion *ar, float fx, float fy, const char *label)
+static void draw_udim_label(ARegion *region, float fx, float fy, const char *label)
{
if (label == NULL || !label[0]) {
return;
@@ -540,14 +540,14 @@ static void draw_udim_label(ARegion *ar, float fx, float fy, const char *label)
/* find window pixel coordinates of origin */
int x, y;
- UI_view2d_view_to_region(&ar->v2d, fx, fy, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, fx, fy, &x, &y);
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
GPU_blend(true);
int textwidth = BLF_width(blf_mono_font, label, strlen(label)) + 10;
- float stepx = BLI_rcti_size_x(&ar->v2d.mask) / BLI_rctf_size_x(&ar->v2d.cur);
+ float stepx = BLI_rcti_size_x(&region->v2d.mask) / BLI_rctf_size_x(&region->v2d.cur);
float opacity;
if (textwidth < 0.5f * (stepx - 10)) {
opacity = 1.0f;
@@ -567,7 +567,7 @@ static void draw_udim_label(ARegion *ar, float fx, float fy, const char *label)
static void draw_image_buffer(const bContext *C,
SpaceImage *sima,
- ARegion *ar,
+ ARegion *region,
Scene *scene,
ImBuf *ibuf,
float fx,
@@ -578,7 +578,7 @@ static void draw_image_buffer(const bContext *C,
int x, y;
/* find window pixel coordinates of origin */
- UI_view2d_view_to_region(&ar->v2d, fx, fy, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, fx, fy, &x, &y);
/* this part is generic image display */
if (sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) {
@@ -595,7 +595,7 @@ static void draw_image_buffer(const bContext *C,
else {
int clip_max_x, clip_max_y;
UI_view2d_view_to_region(
- &ar->v2d, ar->v2d.cur.xmax, ar->v2d.cur.ymax, &clip_max_x, &clip_max_y);
+ &region->v2d, region->v2d.cur.xmax, region->v2d.cur.ymax, &clip_max_x, &clip_max_y);
if (sima->flag & SI_USE_ALPHA) {
imm_draw_box_checker_2d(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
@@ -669,7 +669,7 @@ static void draw_image_buffer(const bContext *C,
static void draw_image_buffer_repeated(const bContext *C,
SpaceImage *sima,
- ARegion *ar,
+ ARegion *region,
Scene *scene,
ImBuf *ibuf,
float zoomx,
@@ -677,14 +677,14 @@ static void draw_image_buffer_repeated(const bContext *C,
{
const double time_current = PIL_check_seconds_timer();
- const int xmax = ceil(ar->v2d.cur.xmax);
- const int ymax = ceil(ar->v2d.cur.ymax);
- const int xmin = floor(ar->v2d.cur.xmin);
- const int ymin = floor(ar->v2d.cur.ymin);
+ const int xmax = ceil(region->v2d.cur.xmax);
+ const int ymax = ceil(region->v2d.cur.ymax);
+ const int xmin = floor(region->v2d.cur.xmin);
+ const int ymin = floor(region->v2d.cur.ymin);
for (int x = xmin; x < xmax; x++) {
for (int y = ymin; y < ymax; y++) {
- draw_image_buffer(C, sima, ar, scene, ibuf, x, y, zoomx, zoomy);
+ draw_image_buffer(C, sima, region, scene, ibuf, x, y, zoomx, zoomy);
/* only draw until running out of time */
if ((PIL_check_seconds_timer() - time_current) > 0.25) {
@@ -744,7 +744,7 @@ void draw_image_sample_line(SpaceImage *sima)
}
static void draw_image_paint_helpers(
- const bContext *C, ARegion *ar, Scene *scene, float zoomx, float zoomy)
+ const bContext *C, ARegion *region, Scene *scene, float zoomx, float zoomy)
{
Brush *brush;
int x, y;
@@ -758,7 +758,8 @@ static void draw_image_paint_helpers(
if (ibuf) {
void *cache_handle = NULL;
float col[4] = {1.0f, 1.0f, 1.0f, brush->clone.alpha};
- UI_view2d_view_to_region(&ar->v2d, brush->clone.offset[0], brush->clone.offset[1], &x, &y);
+ UI_view2d_view_to_region(
+ &region->v2d, brush->clone.offset[0], brush->clone.offset[1], &x, &y);
uchar *display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
@@ -796,7 +797,7 @@ static void draw_image_paint_helpers(
static void draw_udim_tile_grid(uint pos_attr,
uint color_attr,
- ARegion *ar,
+ ARegion *region,
int x,
int y,
float stepx,
@@ -804,7 +805,7 @@ static void draw_udim_tile_grid(uint pos_attr,
const float color[3])
{
float x1, y1;
- UI_view2d_view_to_region_fl(&ar->v2d, x, y, &x1, &y1);
+ UI_view2d_view_to_region_fl(&region->v2d, x, y, &x1, &y1);
int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
for (int i = 0; i < 4; i++) {
immAttr3fv(color_attr, color);
@@ -814,7 +815,7 @@ static void draw_udim_tile_grid(uint pos_attr,
}
}
-static void draw_udim_tile_grids(ARegion *ar, SpaceImage *sima, Image *ima)
+static void draw_udim_tile_grids(ARegion *region, SpaceImage *sima, Image *ima)
{
int num_tiles;
if (ima != NULL) {
@@ -828,8 +829,8 @@ static void draw_udim_tile_grids(ARegion *ar, SpaceImage *sima, Image *ima)
num_tiles = sima->tile_grid_shape[0] * sima->tile_grid_shape[1];
}
- float stepx = BLI_rcti_size_x(&ar->v2d.mask) / BLI_rctf_size_x(&ar->v2d.cur);
- float stepy = BLI_rcti_size_y(&ar->v2d.mask) / BLI_rctf_size_y(&ar->v2d.cur);
+ float stepx = BLI_rcti_size_x(&region->v2d.mask) / BLI_rctf_size_x(&region->v2d.cur);
+ float stepy = BLI_rcti_size_y(&region->v2d.mask) / BLI_rctf_size_y(&region->v2d.cur);
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -849,20 +850,20 @@ static void draw_udim_tile_grids(ARegion *ar, SpaceImage *sima, Image *ima)
if (tile != cur_tile) {
int x = (tile->tile_number - 1001) % 10;
int y = (tile->tile_number - 1001) / 10;
- draw_udim_tile_grid(pos, color, ar, x, y, stepx, stepy, theme_color);
+ draw_udim_tile_grid(pos, color, region, x, y, stepx, stepy, theme_color);
}
}
if (cur_tile != NULL) {
int cur_x = (cur_tile->tile_number - 1001) % 10;
int cur_y = (cur_tile->tile_number - 1001) / 10;
- draw_udim_tile_grid(pos, color, ar, cur_x, cur_y, stepx, stepy, selected_color);
+ draw_udim_tile_grid(pos, color, region, cur_x, cur_y, stepx, stepy, selected_color);
}
}
else {
for (int y = 0; y < sima->tile_grid_shape[1]; y++) {
for (int x = 0; x < sima->tile_grid_shape[0]; x++) {
- draw_udim_tile_grid(pos, color, ar, x, y, stepx, stepy, theme_color);
+ draw_udim_tile_grid(pos, color, region, x, y, stepx, stepy, theme_color);
}
}
}
@@ -873,7 +874,7 @@ static void draw_udim_tile_grids(ARegion *ar, SpaceImage *sima, Image *ima)
/* draw main image region */
-void draw_image_main(const bContext *C, ARegion *ar)
+void draw_image_main(const bContext *C, ARegion *region)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -905,7 +906,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
/* retrieve the image and information about it */
ima = ED_space_image(sima);
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
/* Tag image as in active use for garbage collector. */
if (ima) {
@@ -949,31 +950,31 @@ void draw_image_main(const bContext *C, ARegion *ar)
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
int x = (tile->tile_number - 1001) % 10;
int y = (tile->tile_number - 1001) / 10;
- ED_region_grid_draw(ar, zoomx, zoomy, x, y);
+ ED_region_grid_draw(region, zoomx, zoomy, x, y);
}
}
else {
for (int y = 0; y < sima->tile_grid_shape[1]; y++) {
for (int x = 0; x < sima->tile_grid_shape[0]; x++) {
- ED_region_grid_draw(ar, zoomx, zoomy, x, y);
+ ED_region_grid_draw(region, zoomx, zoomy, x, y);
}
}
}
}
else {
if (sima->flag & SI_DRAW_TILE) {
- draw_image_buffer_repeated(C, sima, ar, scene, ibuf, zoomx, zoomy);
+ draw_image_buffer_repeated(C, sima, region, scene, ibuf, zoomx, zoomy);
}
else {
main_w = ibuf->x;
main_h = ibuf->y;
- draw_image_buffer(C, sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy);
+ draw_image_buffer(C, sima, region, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy);
if (ima->source == IMA_SRC_TILED) {
ImageTile *tile = BKE_image_get_tile(ima, 0);
char label[sizeof(tile->label)];
BKE_image_get_tile_label(ima, tile, label, sizeof(label));
- draw_udim_label(ar, 0.0f, 0.0f, label);
+ draw_udim_label(region, 0.0f, 0.0f, label);
}
}
@@ -982,7 +983,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
rctf frame;
BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
}
@@ -1005,18 +1006,18 @@ void draw_image_main(const bContext *C, ARegion *ar)
float tile_zoomx = (zoomx * main_w) / ibuf->x;
float tile_zoomy = (zoomy * main_h) / ibuf->y;
- draw_image_buffer(C, sima, ar, scene, ibuf, x_pos, y_pos, tile_zoomx, tile_zoomy);
- draw_udim_label(ar, x_pos, y_pos, label);
+ draw_image_buffer(C, sima, region, scene, ibuf, x_pos, y_pos, tile_zoomx, tile_zoomy);
+ draw_udim_label(region, x_pos, y_pos, label);
}
ED_space_image_release_buffer(sima, ibuf, lock);
}
}
- draw_udim_tile_grids(ar, sima, ima);
+ draw_udim_tile_grids(region, sima, ima);
/* paint helpers */
if (show_paint) {
- draw_image_paint_helpers(C, ar, scene, zoomx, zoomy);
+ draw_image_paint_helpers(C, region, scene, zoomx, zoomy);
}
if (show_viewer) {
@@ -1025,7 +1026,7 @@ void draw_image_main(const bContext *C, ARegion *ar)
/* render info */
if (ima && show_render) {
- draw_render_info(C, sima->iuser.scene, ima, ar, zoomx, zoomy);
+ draw_render_info(C, sima->iuser.scene, ima, region, zoomx, zoomy);
}
}
@@ -1045,12 +1046,12 @@ bool ED_space_image_show_cache(SpaceImage *sima)
return true;
}
-void draw_image_cache(const bContext *C, ARegion *ar)
+void draw_image_cache(const bContext *C, ARegion *region)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
Image *image = ED_space_image(sima);
- float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
+ float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = region->winx / (efra - sfra + 1);
Mask *mask = NULL;
if (!ED_space_image_show_cache(sima)) {
@@ -1062,7 +1063,7 @@ void draw_image_cache(const bContext *C, ARegion *ar)
}
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
const int region_bottom = rect_visible->ymin;
GPU_blend(true);
@@ -1070,7 +1071,7 @@ void draw_image_cache(const bContext *C, ARegion *ar)
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* Draw cache background. */
- ED_region_cache_draw_background(ar);
+ ED_region_cache_draw_background(region);
/* Draw cached segments. */
if (image != NULL && image->cache != NULL &&
@@ -1080,13 +1081,13 @@ void draw_image_cache(const bContext *C, ARegion *ar)
IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
ED_region_cache_draw_cached_segments(
- ar, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
+ region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
}
GPU_blend(false);
/* Draw current frame. */
- x = (cfra - sfra) / (efra - sfra + 1) * ar->winx;
+ x = (cfra - sfra) / (efra - sfra + 1) * region->winx;
uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
@@ -1098,6 +1099,6 @@ void draw_image_cache(const bContext *C, ARegion *ar)
ED_region_cache_draw_curfra_label(cfra, x, region_bottom + 8.0f * UI_DPI_FAC);
if (mask != NULL) {
- ED_mask_draw_frames(mask, ar, cfra, sfra, efra);
+ ED_mask_draw_frames(mask, region, cfra, sfra, efra);
}
}
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 862d32815f4..9d07780f756 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -240,16 +240,16 @@ void ED_space_image_get_aspect(SpaceImage *sima, float *aspx, float *aspy)
}
}
-void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zoomy)
+void ED_space_image_get_zoom(SpaceImage *sima, ARegion *region, float *zoomx, float *zoomy)
{
int width, height;
ED_space_image_get_size(sima, &width, &height);
- *zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) /
- (float)(BLI_rctf_size_x(&ar->v2d.cur) * width);
- *zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) /
- (float)(BLI_rctf_size_y(&ar->v2d.cur) * height);
+ *zoomx = (float)(BLI_rcti_size_x(&region->winrct) + 1) /
+ (float)(BLI_rctf_size_x(&region->v2d.cur) * width);
+ *zoomy = (float)(BLI_rcti_size_y(&region->winrct) + 1) /
+ (float)(BLI_rctf_size_y(&region->v2d.cur) * height);
}
void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
@@ -290,15 +290,15 @@ void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *aspx, float *as
}
/* takes event->mval */
-void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, const int mval[2], float co[2])
+void ED_image_mouse_pos(SpaceImage *sima, ARegion *region, const int mval[2], float co[2])
{
int sx, sy, width, height;
float zoomx, zoomy;
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
ED_space_image_get_size(sima, &width, &height);
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &sx, &sy);
co[0] = ((mval[0] - sx) / zoomx) / width;
co[1] = ((mval[1] - sy) / zoomy) / height;
@@ -316,29 +316,32 @@ void ED_image_view_center_to_point(SpaceImage *sima, float x, float y)
sima->yof = (y - 0.5f) * height * aspy;
}
-void ED_image_point_pos(SpaceImage *sima, ARegion *ar, float x, float y, float *xr, float *yr)
+void ED_image_point_pos(SpaceImage *sima, ARegion *region, float x, float y, float *xr, float *yr)
{
int sx, sy, width, height;
float zoomx, zoomy;
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
ED_space_image_get_size(sima, &width, &height);
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &sx, &sy);
*xr = ((x - sx) / zoomx) / width;
*yr = ((y - sy) / zoomy) / height;
}
-void ED_image_point_pos__reverse(SpaceImage *sima, ARegion *ar, const float co[2], float r_co[2])
+void ED_image_point_pos__reverse(SpaceImage *sima,
+ ARegion *region,
+ const float co[2],
+ float r_co[2])
{
float zoomx, zoomy;
int width, height;
int sx, sy;
- UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
+ UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &sx, &sy);
ED_space_image_get_size(sima, &width, &height);
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
r_co[0] = (co[0] * width * zoomx) + (float)sx;
r_co[1] = (co[1] * height * zoomy) + (float)sy;
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index f3ec68db562..ae26363ad79 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -37,8 +37,8 @@ struct wmOperatorType;
extern const char *image_context_dir[]; /* doc access */
/* image_draw.c */
-void draw_image_main(const struct bContext *C, struct ARegion *ar);
-void draw_image_cache(const struct bContext *C, struct ARegion *ar);
+void draw_image_main(const struct bContext *C, struct ARegion *region);
+void draw_image_cache(const struct bContext *C, struct ARegion *region);
void draw_image_grease_pencil(struct bContext *C, bool onlyv2d);
void draw_image_sample_line(struct SpaceImage *sima);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 86cb27465c7..6f5102ed828 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -111,7 +111,7 @@
* \{ */
static void sima_zoom_set(
- SpaceImage *sima, ARegion *ar, float zoom, const float location[2], const bool zoom_to_pos)
+ SpaceImage *sima, ARegion *region, float zoom, const float location[2], const bool zoom_to_pos)
{
float oldzoom = sima->zoom;
int width, height;
@@ -128,10 +128,10 @@ static void sima_zoom_set(
if ((width < 4) && (height < 4) && sima->zoom < oldzoom) {
sima->zoom = oldzoom;
}
- else if (BLI_rcti_size_x(&ar->winrct) <= sima->zoom) {
+ else if (BLI_rcti_size_x(&region->winrct) <= sima->zoom) {
sima->zoom = oldzoom;
}
- else if (BLI_rcti_size_y(&ar->winrct) <= sima->zoom) {
+ else if (BLI_rcti_size_y(&region->winrct) <= sima->zoom) {
sima->zoom = oldzoom;
}
}
@@ -150,16 +150,19 @@ static void sima_zoom_set(
}
}
-static void sima_zoom_set_factor(
- SpaceImage *sima, ARegion *ar, float zoomfac, const float location[2], const bool zoom_to_pos)
+static void sima_zoom_set_factor(SpaceImage *sima,
+ ARegion *region,
+ float zoomfac,
+ const float location[2],
+ const bool zoom_to_pos)
{
- sima_zoom_set(sima, ar, sima->zoom * zoomfac, location, zoom_to_pos);
+ sima_zoom_set(sima, region, sima->zoom * zoomfac, location, zoom_to_pos);
}
/**
* Fits the view to the bounds exactly, caller should add margin if needed.
*/
-static void sima_zoom_set_from_bounds(SpaceImage *sima, ARegion *ar, const rctf *bounds)
+static void sima_zoom_set_from_bounds(SpaceImage *sima, ARegion *region, const rctf *bounds)
{
int image_size[2];
float aspx, aspy;
@@ -175,13 +178,13 @@ static void sima_zoom_set_from_bounds(SpaceImage *sima, ARegion *ar, const rctf
sima->yof = roundf((BLI_rctf_cent_y(bounds) - 0.5f) * image_size[1]);
float size_xy[2], size;
- size_xy[0] = BLI_rcti_size_x(&ar->winrct) / (BLI_rctf_size_x(bounds) * image_size[0]);
- size_xy[1] = BLI_rcti_size_y(&ar->winrct) / (BLI_rctf_size_y(bounds) * image_size[1]);
+ size_xy[0] = BLI_rcti_size_x(&region->winrct) / (BLI_rctf_size_x(bounds) * image_size[0]);
+ size_xy[1] = BLI_rcti_size_y(&region->winrct) / (BLI_rctf_size_y(bounds) * image_size[1]);
size = min_ff(size_xy[0], size_xy[1]);
CLAMP_MAX(size, 100.0f);
- sima_zoom_set(sima, ar, size, NULL, false);
+ sima_zoom_set(sima, region, size, NULL, false);
}
static Image *image_from_context(const bContext *C)
@@ -252,10 +255,10 @@ static bool image_not_packed_poll(bContext *C)
bool space_image_main_region_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
- /* XXX ARegion *ar = CTX_wm_region(C); */
+ /* XXX ARegion *region = CTX_wm_region(C); */
if (sima) {
- return true; /* XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW); */
+ return true; /* XXX (region && region->type->regionid == RGN_TYPE_WINDOW); */
}
return false;
}
@@ -462,14 +465,14 @@ typedef struct ViewZoomData {
/* */
SpaceImage *sima;
- ARegion *ar;
+ ARegion *region;
} ViewZoomData;
static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ViewZoomData *vpd;
op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ImageViewZoomData");
@@ -486,7 +489,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve
vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
UI_view2d_region_to_view(
- &ar->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]);
+ &region->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]);
if (U.viewzoom == USER_ZOOM_CONT) {
/* needs a timer to continue redrawing */
@@ -495,7 +498,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve
}
vpd->sima = sima;
- vpd->ar = ar;
+ vpd->region = region;
WM_event_add_modal_handler(C, op);
}
@@ -523,11 +526,11 @@ static void image_view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
static int image_view_zoom_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- sima_zoom_set_factor(sima, ar, RNA_float_get(op->ptr, "factor"), NULL, false);
+ sima_zoom_set_factor(sima, region, RNA_float_get(op->ptr, "factor"), NULL, false);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -542,10 +545,11 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
{
if (event->type == MOUSEZOOM || event->type == MOUSEPAN) {
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float delta, factor, location[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
delta = event->prevx - event->x + event->prevy - event->y;
@@ -557,11 +561,11 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
RNA_float_set(op->ptr, "factor", factor);
const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
sima_zoom_set(sima,
- ar,
+ region,
sima->zoom * factor,
location,
(use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)));
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -616,8 +620,8 @@ static void image_zoom_apply(ViewZoomData *vpd,
}
RNA_float_set(op->ptr, "factor", factor);
- sima_zoom_set(vpd->sima, vpd->ar, vpd->zoom * factor, vpd->location, zoom_to_pos);
- ED_region_tag_redraw(vpd->ar);
+ sima_zoom_set(vpd->sima, vpd->region, vpd->zoom * factor, vpd->location, zoom_to_pos);
+ ED_region_tag_redraw(vpd->region);
}
static int image_view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -715,7 +719,7 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
}
else {
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float pan_vec[3];
const wmNDOFMotionData *ndof = event->customdata;
@@ -726,11 +730,11 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
mul_v2_fl(pan_vec, (speed * ndof->dt) / sima->zoom);
pan_vec[2] *= -ndof->dt;
- sima_zoom_set_factor(sima, ar, 1.0f + pan_vec[2], NULL, false);
+ sima_zoom_set_factor(sima, region, 1.0f + pan_vec[2], NULL, false);
sima->xof += pan_vec[0];
sima->yof += pan_vec[1];
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -766,14 +770,14 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot)
static int image_view_all_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima;
- ARegion *ar;
+ ARegion *region;
float aspx, aspy, zoomx, zoomy, w, h;
int width, height;
const bool fit_view = RNA_boolean_get(op->ptr, "fit_view");
/* retrieve state */
sima = CTX_wm_space_image(C);
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
ED_space_image_get_size(sima, &width, &height);
ED_space_image_get_aspect(sima, &aspx, &aspy);
@@ -805,8 +809,8 @@ static int image_view_all_exec(bContext *C, wmOperator *op)
}
/* check if the image will fit in the image with (zoom == 1) */
- width = BLI_rcti_size_x(&ar->winrct) + 1;
- height = BLI_rcti_size_y(&ar->winrct) + 1;
+ width = BLI_rcti_size_x(&region->winrct) + 1;
+ height = BLI_rcti_size_y(&region->winrct) + 1;
if (fit_view) {
const int margin = 5; /* margin from border */
@@ -814,7 +818,7 @@ static int image_view_all_exec(bContext *C, wmOperator *op)
zoomx = (float)width / (w + 2 * margin);
zoomy = (float)height / (h + 2 * margin);
- sima_zoom_set(sima, ar, min_ff(zoomx, zoomy), NULL, false);
+ sima_zoom_set(sima, region, min_ff(zoomx, zoomy), NULL, false);
}
else {
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
@@ -822,17 +826,17 @@ static int image_view_all_exec(bContext *C, wmOperator *op)
zoomy = (float)height / h;
/* find the zoom value that will fit the image in the image space */
- sima_zoom_set(sima, ar, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL, false);
+ sima_zoom_set(sima, region, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL, false);
}
else {
- sima_zoom_set(sima, ar, 1.0f, NULL, false);
+ sima_zoom_set(sima, region, 1.0f, NULL, false);
}
}
sima->xof = xof;
sima->yof = yof;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -867,11 +871,11 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
static int view_center_cursor_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ED_image_view_center_to_point(sima, sima->cursor[0], sima->cursor[1]);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -897,7 +901,7 @@ void IMAGE_OT_view_center_cursor(wmOperatorType *ot)
static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima;
- ARegion *ar;
+ ARegion *region;
Scene *scene;
ViewLayer *view_layer;
Object *obedit;
@@ -905,7 +909,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
/* retrieve state */
sima = CTX_wm_space_image(C);
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
scene = CTX_data_scene(C);
view_layer = CTX_data_view_layer(C);
obedit = CTX_data_edit_object(C);
@@ -934,9 +938,9 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
/* add some margin */
BLI_rctf_scale(&bounds, 1.4f);
- sima_zoom_set_from_bounds(sima, ar, &bounds);
+ sima_zoom_set_from_bounds(sima, region, &bounds);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -967,25 +971,26 @@ void IMAGE_OT_view_selected(wmOperatorType *ot)
static int image_view_zoom_in_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
sima_zoom_set_factor(
- sima, ar, powf(2.0f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
+ sima, region, powf(2.0f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
static int image_view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
return image_view_zoom_in_exec(C, op);
@@ -1025,25 +1030,26 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
static int image_view_zoom_out_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
sima_zoom_set_factor(
- sima, ar, powf(0.5f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
+ sima, region, powf(0.5f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
static int image_view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
return image_view_zoom_out_exec(C, op);
@@ -1089,15 +1095,15 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- sima_zoom_set(sima, ar, RNA_float_get(op->ptr, "ratio"), NULL, false);
+ sima_zoom_set(sima, region, RNA_float_get(op->ptr, "ratio"), NULL, false);
/* ensure pixel exact locations for draw */
sima->xof = (int)sima->xof;
sima->yof = (int)sima->yof;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -1137,13 +1143,13 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
static int image_view_zoom_border_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
rctf bounds;
const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out");
WM_operator_properties_border_to_rctf(op, &bounds);
- UI_view2d_region_to_view_rctf(&ar->v2d, &bounds, &bounds);
+ UI_view2d_region_to_view_rctf(&region->v2d, &bounds, &bounds);
const struct {
float xof;
@@ -1155,7 +1161,7 @@ static int image_view_zoom_border_exec(bContext *C, wmOperator *op)
.zoom = sima->zoom,
};
- sima_zoom_set_from_bounds(sima, ar, &bounds);
+ sima_zoom_set_from_bounds(sima, region, &bounds);
/* zoom out */
if (!zoom_in) {
@@ -1164,7 +1170,7 @@ static int image_view_zoom_border_exec(bContext *C, wmOperator *op)
sima->zoom = sima_view_prev.zoom * (sima_view_prev.zoom / sima->zoom);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -3120,7 +3126,7 @@ typedef struct ImageSampleInfo {
int use_default_view;
} ImageSampleInfo;
-static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
+static void image_sample_draw(const bContext *C, ARegion *region, void *arg_info)
{
ImageSampleInfo *info = arg_info;
if (!info->draw) {
@@ -3129,7 +3135,7 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
Scene *scene = CTX_data_scene(C);
ED_image_draw_info(scene,
- ar,
+ region,
info->color_manage,
info->use_default_view,
info->channels,
@@ -3155,9 +3161,10 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
/* TODO(campbell): lock to pixels. */
rctf sample_rect_fl;
- BLI_rctf_init_pt_radius(&sample_rect_fl,
- (float[2]){event->x - ar->winrct.xmin, event->y - ar->winrct.ymin},
- (float)(info->sample_size / 2.0f) * sima->zoom);
+ BLI_rctf_init_pt_radius(
+ &sample_rect_fl,
+ (float[2]){event->x - region->winrct.xmin, event->y - region->winrct.ymin},
+ (float)(info->sample_size / 2.0f) * sima->zoom);
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
@@ -3174,13 +3181,13 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info)
}
/* Returns color in linear space, matching ED_space_node_color_sample(). */
-bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3])
+bool ED_space_image_color_sample(SpaceImage *sima, ARegion *region, int mval[2], float r_col[3])
{
if (sima->image == NULL) {
return false;
}
float uv[2];
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &uv[0], &uv[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &uv[0], &uv[1]);
int tile = BKE_image_get_tile_from_pos(sima->image, uv, uv, NULL);
void *lock;
@@ -3295,11 +3302,11 @@ static void image_sample_rect_color_float(ImBuf *ibuf, const rcti *rect, float r
static void image_sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Image *image = ED_space_image(sima);
float uv[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &uv[0], &uv[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &uv[0], &uv[1]);
int tile = BKE_image_get_tile_from_pos(sima->image, uv, uv, NULL);
void *lock;
@@ -3439,10 +3446,10 @@ static void image_sample_exit(bContext *C, wmOperator *op)
static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ImageSampleInfo *info;
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
if (event->mval[1] <= 16 && ED_space_image_show_cache(sima)) {
return OPERATOR_PASS_THROUGH;
}
@@ -3454,9 +3461,9 @@ static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event
info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
- info->art = ar->type;
+ info->art = region->type;
info->draw_handle = ED_region_draw_cb_activate(
- ar->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL);
+ region->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL);
info->sample_size = RNA_int_get(op->ptr, "size");
op->customdata = info;
@@ -3521,7 +3528,7 @@ void IMAGE_OT_sample(wmOperatorType *ot)
static int image_sample_line_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
Image *ima = ED_space_image(sima);
@@ -3531,8 +3538,8 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
int y_end = RNA_int_get(op->ptr, "yend");
float uv1[2], uv2[2], ofs[2];
- UI_view2d_region_to_view(&ar->v2d, x_start, y_start, &uv1[0], &uv1[1]);
- UI_view2d_region_to_view(&ar->v2d, x_end, y_end, &uv2[0], &uv2[1]);
+ UI_view2d_region_to_view(&region->v2d, x_start, y_start, &uv1[0], &uv1[1]);
+ UI_view2d_region_to_view(&region->v2d, x_end, y_end, &uv2[0], &uv2[1]);
/* If the image has tiles, shift the positions accordingly. */
int tile = BKE_image_get_tile_from_pos(ima, uv1, uv1, ofs);
@@ -3834,19 +3841,19 @@ static int change_frame_exec(bContext *C, wmOperator *op)
static int frame_from_event(bContext *C, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int framenr = 0;
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- float sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ float sfra = SFRA, efra = EFRA, framelen = region->winx / (efra - sfra + 1);
framenr = sfra + event->mval[0] / framelen;
}
else {
float viewx, viewy;
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
framenr = round_fl_to_int(viewx);
}
@@ -3856,13 +3863,13 @@ static int frame_from_event(bContext *C, const wmEvent *event)
static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
SpaceImage *sima = CTX_wm_space_image(C);
/* Local coordinate visible rect inside region, to accommodate overlapping ui. */
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
const int region_bottom = rect_visible->ymin;
if (event->mval[1] > (region_bottom + 16 * UI_DPI_FAC) || !ED_space_image_show_cache(sima)) {
@@ -3963,7 +3970,7 @@ void IMAGE_OT_read_viewlayers(wmOperatorType *ot)
static int render_border_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
Render *re = RE_GetSceneRender(scene);
RenderData *rd;
@@ -3982,7 +3989,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
/* get rectangle from operator */
WM_operator_properties_border_to_rctf(op, &border);
- UI_view2d_region_to_view_rctf(&ar->v2d, &border, &border);
+ UI_view2d_region_to_view_rctf(&region->v2d, &border, &border);
/* actually set border */
CLAMP(border.xmin, 0.0f, 1.0f);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index e18eb062741..dc546e5baf5 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -86,11 +86,11 @@
static void image_scopes_tag_refresh(ScrArea *sa)
{
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
- ARegion *ar;
+ ARegion *region;
/* only while histogram is visible */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_TOOL_PROPS && ar->flag & RGN_FLAG_HIDDEN) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_TOOL_PROPS && region->flag & RGN_FLAG_HIDDEN) {
return;
}
}
@@ -119,7 +119,7 @@ static void image_user_refresh_scene(const bContext *C, SpaceImage *sima)
static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceImage *simage;
simage = MEM_callocN(sizeof(SpaceImage), "initimage");
@@ -138,41 +138,41 @@ static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sce
simage->tile_grid_shape[1] = 1;
/* tool header */
- ar = MEM_callocN(sizeof(ARegion), "tool header for image");
+ region = MEM_callocN(sizeof(ARegion), "tool header for image");
- BLI_addtail(&simage->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOL_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
- ar->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
+ BLI_addtail(&simage->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOL_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for image");
+ region = MEM_callocN(sizeof(ARegion), "header for image");
- BLI_addtail(&simage->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&simage->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* buttons/list view */
- ar = MEM_callocN(sizeof(ARegion), "buttons for image");
+ region = MEM_callocN(sizeof(ARegion), "buttons for image");
- BLI_addtail(&simage->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&simage->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* scopes/uv sculpt/paint */
- ar = MEM_callocN(sizeof(ARegion), "buttons for image");
+ region = MEM_callocN(sizeof(ARegion), "buttons for image");
- BLI_addtail(&simage->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&simage->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->flag = RGN_FLAG_HIDDEN;
/* main area */
- ar = MEM_callocN(sizeof(ARegion), "main area for image");
+ region = MEM_callocN(sizeof(ARegion), "main area for image");
- BLI_addtail(&simage->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&simage->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)simage;
}
@@ -536,7 +536,7 @@ static void image_widgets(void)
/************************** main region ***************************/
/* sets up the fields of the View2D from zoom and offset */
-static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar)
+static void image_main_region_set_view2d(SpaceImage *sima, ARegion *region)
{
Image *ima = ED_space_image(sima);
@@ -550,79 +550,79 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar)
h *= ima->aspy / ima->aspx;
}
- int winx = BLI_rcti_size_x(&ar->winrct) + 1;
- int winy = BLI_rcti_size_y(&ar->winrct) + 1;
+ int winx = BLI_rcti_size_x(&region->winrct) + 1;
+ int winy = BLI_rcti_size_y(&region->winrct) + 1;
/* For region overlap, move center so image doesn't overlap header. */
- const rcti *visible_rect = ED_region_visible_rect(ar);
+ const rcti *visible_rect = ED_region_visible_rect(region);
const int visible_winy = BLI_rcti_size_y(visible_rect) + 1;
int visible_centerx = 0;
int visible_centery = visible_rect->ymin + (visible_winy - winy) / 2;
- ar->v2d.tot.xmin = 0;
- ar->v2d.tot.ymin = 0;
- ar->v2d.tot.xmax = w;
- ar->v2d.tot.ymax = h;
+ region->v2d.tot.xmin = 0;
+ region->v2d.tot.ymin = 0;
+ region->v2d.tot.xmax = w;
+ region->v2d.tot.ymax = h;
- ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
- ar->v2d.mask.xmax = winx;
- ar->v2d.mask.ymax = winy;
+ region->v2d.mask.xmin = region->v2d.mask.ymin = 0;
+ region->v2d.mask.xmax = winx;
+ region->v2d.mask.ymax = winy;
/* which part of the image space do we see? */
- float x1 = ar->winrct.xmin + visible_centerx + (winx - sima->zoom * w) / 2.0f;
- float y1 = ar->winrct.ymin + visible_centery + (winy - sima->zoom * h) / 2.0f;
+ float x1 = region->winrct.xmin + visible_centerx + (winx - sima->zoom * w) / 2.0f;
+ float y1 = region->winrct.ymin + visible_centery + (winy - sima->zoom * h) / 2.0f;
x1 -= sima->zoom * sima->xof;
y1 -= sima->zoom * sima->yof;
/* relative display right */
- ar->v2d.cur.xmin = ((ar->winrct.xmin - (float)x1) / sima->zoom);
- ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sima->zoom);
+ region->v2d.cur.xmin = ((region->winrct.xmin - (float)x1) / sima->zoom);
+ region->v2d.cur.xmax = region->v2d.cur.xmin + ((float)winx / sima->zoom);
/* relative display left */
- ar->v2d.cur.ymin = ((ar->winrct.ymin - (float)y1) / sima->zoom);
- ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sima->zoom);
+ region->v2d.cur.ymin = ((region->winrct.ymin - (float)y1) / sima->zoom);
+ region->v2d.cur.ymax = region->v2d.cur.ymin + ((float)winy / sima->zoom);
/* normalize 0.0..1.0 */
- ar->v2d.cur.xmin /= w;
- ar->v2d.cur.xmax /= w;
- ar->v2d.cur.ymin /= h;
- ar->v2d.cur.ymax /= h;
+ region->v2d.cur.xmin /= w;
+ region->v2d.cur.xmax /= w;
+ region->v2d.cur.ymin /= h;
+ region->v2d.cur.ymax /= h;
}
/* add handlers, stuff you only do once or on area/region changes */
-static void image_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void image_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
// image space manages own v2d
- // UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+ // UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy);
/* mask polls mode */
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* image paint polls for mode */
keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Image Paint", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "UV Editor", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
/* own keymaps */
keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Image", SPACE_IMAGE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void image_main_region_draw(const bContext *C, ARegion *ar)
+static void image_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceImage *sima = CTX_wm_space_image(C);
@@ -634,7 +634,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
bool show_curve = false;
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
// View2DScrollers *scrollers;
float col[3];
@@ -643,7 +643,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
gpu_batch_presets_reset();
GPUViewport *viewport =
- ar->draw_buffer->viewport[ar->draw_buffer->stereo ? sima->iuser.multiview_eye : 0];
+ region->draw_buffer->viewport[region->draw_buffer->stereo ? sima->iuser.multiview_eye : 0];
DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport);
GPU_framebuffer_bind(fbl->default_fb);
GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
@@ -664,15 +664,15 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
image_user_refresh_scene(C, sima);
/* we set view2d from own zoom and offset each time */
- image_main_region_set_view2d(sima, ar);
+ image_main_region_set_view2d(sima, region);
/* we draw image in pixelspace */
- draw_image_main(C, ar);
+ draw_image_main(C, region);
/* and uvs in 0.0-1.0 space */
UI_view2d_view_ortho(v2d);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
ED_uvedit_draw_main(sima, scene, view_layer, obedit, obact, depsgraph);
@@ -687,7 +687,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
show_curve = true;
}
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
if (sima->flag & SI_SHOW_GPENCIL) {
/* Grease Pencil too (in addition to UV's) */
@@ -727,7 +727,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
ED_mask_draw_region(depsgraph,
mask,
- ar,
+ region,
sima->mask_info.draw_flag,
sima->mask_info.draw_type,
sima->mask_info.overlay_mode,
@@ -743,51 +743,54 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
if (show_uvedit || mask || show_curve) {
UI_view2d_view_ortho(v2d);
- ED_image_draw_cursor(ar, sima->cursor);
+ ED_image_draw_cursor(region, sima->cursor);
UI_view2d_view_restore(C);
}
- WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
+ WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
- draw_image_cache(C, ar);
+ draw_image_cache(C, region);
}
-static void image_main_region_listener(
- wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar, wmNotifier *wmn, const Scene *UNUSED(scene))
+static void image_main_region_listener(wmWindow *UNUSED(win),
+ ScrArea *sa,
+ ARegion *region,
+ wmNotifier *wmn,
+ const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_GEOM:
if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
- WM_gizmomap_tag_refresh(ar->gizmo_map);
+ WM_gizmomap_tag_refresh(region->gizmo_map);
}
break;
case NC_GPENCIL:
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else if (wmn->data & ND_GPENCIL_EDITMODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_IMAGE:
if (wmn->action == NA_PAINTING) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
- WM_gizmomap_tag_refresh(ar->gizmo_map);
+ WM_gizmomap_tag_refresh(region->gizmo_map);
break;
case NC_MATERIAL:
if (wmn->data == ND_SHADING_LINKS) {
SpaceImage *sima = sa->spacedata.first;
if (sima->iuser.scene && (sima->iuser.scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -796,18 +799,18 @@ static void image_main_region_listener(
/* *********************** buttons region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
-static void image_buttons_region_init(wmWindowManager *wm, ARegion *ar)
+static void image_buttons_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void image_buttons_region_layout(const bContext *C, ARegion *ar)
+static void image_buttons_region_layout(const bContext *C, ARegion *region)
{
const enum eContextObjectMode mode = CTX_data_mode_enum(C);
const char *contexts_base[3] = {NULL};
@@ -831,10 +834,11 @@ static void image_buttons_region_layout(const bContext *C, ARegion *ar)
}
const bool vertical = true;
- ED_region_panels_layout_ex(C, ar, &ar->type->paneltypes, contexts_base, -1, vertical, NULL);
+ ED_region_panels_layout_ex(
+ C, region, &region->type->paneltypes, contexts_base, -1, vertical, NULL);
}
-static void image_buttons_region_draw(const bContext *C, ARegion *ar)
+static void image_buttons_region_draw(const bContext *C, ARegion *region)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -842,7 +846,7 @@ static void image_buttons_region_draw(const bContext *C, ARegion *ar)
/* TODO(lukas): Support tiles in scopes? */
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
/* XXX performance regression if name of scopes category changes! */
- PanelCategoryStack *category = UI_panel_category_active_find(ar, "Scopes");
+ PanelCategoryStack *category = UI_panel_category_active_find(region, "Scopes");
/* only update scopes if scope category is active */
if (category) {
@@ -862,12 +866,12 @@ static void image_buttons_region_draw(const bContext *C, ARegion *ar)
ED_space_image_release_buffer(sima, ibuf, lock);
/* Layout handles details. */
- ED_region_panels_draw(C, ar);
+ ED_region_panels_draw(C, region);
}
static void image_buttons_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -877,33 +881,33 @@ static void image_buttons_region_listener(wmWindow *UNUSED(win),
case NC_MATERIAL:
/* sending by texture render job and needed to properly update displaying
* brush texture icon */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
case ND_MODE:
case ND_RENDER_RESULT:
case ND_COMPO_RESULT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_IMAGE:
if (wmn->action != NA_PAINTING) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_NODE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_GPENCIL:
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_BRUSH:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -912,25 +916,25 @@ static void image_buttons_region_listener(wmWindow *UNUSED(win),
/* *********************** scopes region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
-static void image_tools_region_init(wmWindowManager *wm, ARegion *ar)
+static void image_tools_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void image_tools_region_draw(const bContext *C, ARegion *ar)
+static void image_tools_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void image_tools_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -938,13 +942,13 @@ static void image_tools_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_GPENCIL:
if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_BRUSH:
/* NA_SELECTED is used on brush changes */
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
@@ -952,17 +956,17 @@ static void image_tools_region_listener(wmWindow *UNUSED(win),
case ND_MODE:
case ND_RENDER_RESULT:
case ND_COMPO_RESULT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_IMAGE:
if (wmn->action != NA_PAINTING) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_NODE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
}
@@ -970,24 +974,24 @@ static void image_tools_region_listener(wmWindow *UNUSED(win),
/************************* header region **************************/
/* add handlers, stuff you only do once or on area/region changes */
-static void image_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void image_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void image_header_region_draw(const bContext *C, ARegion *ar)
+static void image_header_region_draw(const bContext *C, ARegion *region)
{
ScrArea *sa = CTX_wm_area(C);
SpaceImage *sima = sa->spacedata.first;
image_user_refresh_scene(C, sima);
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void image_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -997,7 +1001,7 @@ static void image_header_region_listener(wmWindow *UNUSED(win),
switch (wmn->data) {
case ND_MODE:
case ND_TOOLSETTINGS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -1005,13 +1009,13 @@ static void image_header_region_listener(wmWindow *UNUSED(win),
switch (wmn->data) {
case ND_DATA:
case ND_SELECT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_BRUSH:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 6d652610b3b..4d5f59cdb7c 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -203,25 +203,25 @@ static int report_textview_line_get(struct TextViewContext *tvc, const char **li
return 1;
}
-static void info_textview_draw_rect_calc(const ARegion *ar,
+static void info_textview_draw_rect_calc(const ARegion *region,
rcti *r_draw_rect,
rcti *r_draw_rect_outer)
{
const int margin = 0.45f * U.widget_unit;
r_draw_rect->xmin = margin + UI_UNIT_X;
- r_draw_rect->xmax = ar->winx - V2D_SCROLL_WIDTH;
+ r_draw_rect->xmax = region->winx - V2D_SCROLL_WIDTH;
r_draw_rect->ymin = margin;
- r_draw_rect->ymax = ar->winy;
+ r_draw_rect->ymax = region->winy;
/* No margin at the top (allow text to scroll off the window). */
r_draw_rect_outer->xmin = 0;
- r_draw_rect_outer->xmax = ar->winx;
+ r_draw_rect_outer->xmax = region->winx;
r_draw_rect_outer->ymin = 0;
- r_draw_rect_outer->ymax = ar->winy;
+ r_draw_rect_outer->ymax = region->winy;
}
static int info_textview_main__internal(struct SpaceInfo *sinfo,
- const ARegion *ar,
+ const ARegion *region,
ReportList *reports,
const bool do_draw,
const int mval[2],
@@ -230,7 +230,7 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo,
{
int ret = 0;
- const View2D *v2d = &ar->v2d;
+ const View2D *v2d = &region->v2d;
TextViewContext tvc = {0};
tvc.begin = report_textview_begin;
@@ -252,30 +252,33 @@ static int info_textview_main__internal(struct SpaceInfo *sinfo,
tvc.scroll_ymin = v2d->cur.ymin;
tvc.scroll_ymax = v2d->cur.ymax;
- info_textview_draw_rect_calc(ar, &tvc.draw_rect, &tvc.draw_rect_outer);
+ info_textview_draw_rect_calc(region, &tvc.draw_rect, &tvc.draw_rect_outer);
ret = textview_draw(&tvc, do_draw, mval, r_mval_pick_item, r_mval_pick_offset);
return ret;
}
-void *info_text_pick(struct SpaceInfo *sinfo, const ARegion *ar, ReportList *reports, int mval_y)
+void *info_text_pick(struct SpaceInfo *sinfo,
+ const ARegion *region,
+ ReportList *reports,
+ int mval_y)
{
void *mval_pick_item = NULL;
const int mval[2] = {0, mval_y};
- info_textview_main__internal(sinfo, ar, reports, false, mval, &mval_pick_item, NULL);
+ info_textview_main__internal(sinfo, region, reports, false, mval, &mval_pick_item, NULL);
return (void *)mval_pick_item;
}
-int info_textview_height(struct SpaceInfo *sinfo, const ARegion *ar, ReportList *reports)
+int info_textview_height(struct SpaceInfo *sinfo, const ARegion *region, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- return info_textview_main__internal(sinfo, ar, reports, false, mval, NULL, NULL);
+ return info_textview_main__internal(sinfo, region, reports, false, mval, NULL, NULL);
}
-void info_textview_main(struct SpaceInfo *sinfo, const ARegion *ar, ReportList *reports)
+void info_textview_main(struct SpaceInfo *sinfo, const ARegion *region, ReportList *reports)
{
int mval[2] = {INT_MAX, INT_MAX};
- info_textview_main__internal(sinfo, ar, reports, true, mval, NULL, NULL);
+ info_textview_main__internal(sinfo, region, reports, true, mval, NULL, NULL);
}
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 177b43edf74..443a1659690 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -46,14 +46,14 @@ void INFO_OT_reports_display_update(struct wmOperatorType *ot);
/* info_draw.c */
void *info_text_pick(struct SpaceInfo *sinfo,
- const struct ARegion *ar,
+ const struct ARegion *region,
ReportList *reports,
int mouse_y);
int info_textview_height(struct SpaceInfo *sinfo,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct ReportList *reports);
void info_textview_main(struct SpaceInfo *sinfo,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct ReportList *reports);
/* info_report.c */
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 0fa9ddacc20..1b01ac95866 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -172,11 +172,11 @@ static int select_report_pick_exec(bContext *C, wmOperator *op)
static int select_report_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
Report *report;
- report = info_text_pick(sinfo, ar, reports, event->mval[1]);
+ report = info_text_pick(sinfo, region, reports, event->mval[1]);
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
@@ -239,7 +239,7 @@ void INFO_OT_select_all(wmOperatorType *ot)
static int box_select_exec(bContext *C, wmOperator *op)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
int report_mask = info_report_mask(sinfo);
Report *report_min, *report_max;
@@ -258,8 +258,8 @@ static int box_select_exec(bContext *C, wmOperator *op)
}
}
- report_min = info_text_pick(sinfo, ar, reports, rect.ymax);
- report_max = info_text_pick(sinfo, ar, reports, rect.ymin);
+ report_min = info_text_pick(sinfo, region, reports, rect.ymax);
+ report_max = info_text_pick(sinfo, region, reports, rect.ymin);
/* get the first report if none found */
if (report_min == NULL) {
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 8eddf90b06b..789a0d8ea08 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -55,7 +55,7 @@
static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceInfo *sinfo;
sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo");
@@ -64,28 +64,28 @@ static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
sinfo->rpt_mask = INFO_RPT_OP;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for info");
+ region = MEM_callocN(sizeof(ARegion), "header for info");
- BLI_addtail(&sinfo->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sinfo->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for info");
+ region = MEM_callocN(sizeof(ARegion), "main region for info");
- BLI_addtail(&sinfo->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sinfo->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
/* keep in sync with console */
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
- ar->v2d.keepofs |= V2D_LOCKOFS_X;
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ region->v2d.keepofs |= V2D_LOCKOFS_X;
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
- // ar->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
+ // region->v2d.keepzoom = (V2D_KEEPASPECT|V2D_LIMITZOOM);
return (SpaceLink *)sinfo;
}
@@ -111,33 +111,34 @@ static SpaceLink *info_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void info_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void info_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* force it on init, for old files, until it becomes config */
- ar->v2d.scroll = (V2D_SCROLL_RIGHT);
+ region->v2d.scroll = (V2D_SCROLL_RIGHT);
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Info", SPACE_INFO, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void info_textview_update_rect(const bContext *C, ARegion *ar)
+static void info_textview_update_rect(const bContext *C, ARegion *region)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
- UI_view2d_totRect_set(v2d, ar->winx - 1, info_textview_height(sinfo, ar, CTX_wm_reports(C)));
+ UI_view2d_totRect_set(
+ v2d, region->winx - 1, info_textview_height(sinfo, region, CTX_wm_reports(C)));
}
-static void info_main_region_draw(const bContext *C, ARegion *ar)
+static void info_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceInfo *sinfo = CTX_wm_space_info(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
/* clear and setup matrix */
@@ -145,16 +146,16 @@ static void info_main_region_draw(const bContext *C, ARegion *ar)
GPU_clear(GPU_COLOR_BIT);
/* quick way to avoid drawing if not bug enough */
- if (ar->winy < 16) {
+ if (region->winy < 16) {
return;
}
- info_textview_update_rect(C, ar);
+ info_textview_update_rect(C, region);
/* worlks best with no view2d matrix set */
UI_view2d_view_ortho(v2d);
- info_textview_main(sinfo, ar, CTX_wm_reports(C));
+ info_textview_main(sinfo, region, CTX_wm_reports(C));
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -197,19 +198,19 @@ static void info_keymap(struct wmKeyConfig *keyconf)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void info_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void info_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void info_header_region_draw(const bContext *C, ARegion *ar)
+static void info_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void info_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -220,7 +221,7 @@ static void info_main_region_listener(wmWindow *UNUSED(win),
case NC_SPACE:
if (wmn->data == ND_SPACE_INFO_REPORT) {
/* redraw also but only for report view, could do less redraws by checking the type */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -228,7 +229,7 @@ static void info_main_region_listener(wmWindow *UNUSED(win),
static void info_header_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -236,27 +237,27 @@ static void info_header_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER, ND_ANIMPLAY)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_WM:
if (wmn->data == ND_JOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_RENDER_RESULT) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_INFO) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -267,12 +268,12 @@ static void info_header_region_message_subscribe(const bContext *UNUSED(C),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 456eb783706..cf3e889b26c 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -81,7 +81,7 @@ static int mouse_nla_channels(
bAnimListElem *ale;
int filter;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
int notifierFlags = 0;
/* get the channel that was clicked on */
@@ -361,7 +361,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEv
{
bAnimContext ac;
SpaceNla *snla;
- ARegion *ar;
+ ARegion *region;
View2D *v2d;
int channel_index;
int notifierFlags = 0;
@@ -375,8 +375,8 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEv
/* get useful pointers from animation context data */
snla = (SpaceNla *)ac.sl;
- ar = ac.ar;
- v2d = &ar->v2d;
+ region = ac.region;
+ v2d = &region->v2d;
/* select mode is either replace (deselect all, then add) or add/extend */
if (RNA_boolean_get(op->ptr, "extend")) {
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 913d2a06d46..905e3eddc97 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -673,9 +673,9 @@ static void nla_draw_strip_frames_text(
/* ---------------------- */
-void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
const float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
const float text_margin_x = (8 * UI_DPI_FAC) * pixelx;
@@ -803,14 +803,14 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* *********************************************** */
/* Channel List */
-void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
+void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
size_t items;
/* build list of channels to draw */
@@ -848,7 +848,7 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
}
}
{ /* second pass: UI widgets */
- uiBlock *block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
size_t channel_index = 0;
float ymax = NLACHANNEL_FIRST_TOP(ac);
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index e3308ca70a2..f15e26e1b0d 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -469,7 +469,7 @@ static int nlaedit_viewall(bContext *C, const bool only_sel)
if (ANIM_animdata_get_context(C, &ac) == 0) {
return OPERATOR_CANCELLED;
}
- v2d = &ac.ar->v2d;
+ v2d = &ac.region->v2d;
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
get_nlastrip_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, only_sel);
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 2b20ab69fa7..6b0429230fe 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -42,8 +42,8 @@ void nla_buttons_register(ARegionType *art);
/* **************************************** */
/* nla_draw.c */
-void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
-void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar);
+void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region);
+void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region);
/* **************************************** */
/* nla_select.c */
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 938e7f09881..b8d5b17e26c 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -231,7 +231,7 @@ static void box_select_nla_strips(bAnimContext *ac, rcti rect, short mode, short
int filter;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
rctf rectf;
/* convert border-region to view coordinates */
@@ -285,7 +285,7 @@ static void nlaedit_strip_at_region_position(
*r_strip = NULL;
SpaceNla *snla = (SpaceNla *)ac->sl;
- View2D *v2d = &ac->ar->v2d;
+ View2D *v2d = &ac->region->v2d;
float view_x, view_y;
int channel_index;
@@ -550,8 +550,8 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, const wm
/* handle mode-based testing */
if (leftright == NLAEDIT_LRSEL_TEST) {
Scene *scene = ac.scene;
- ARegion *ar = ac.ar;
- View2D *v2d = &ar->v2d;
+ ARegion *region = ac.region;
+ View2D *v2d = &region->v2d;
float x;
/* determine which side of the current frame mouse is on */
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index e5f6b25ee25..e04338b41fc 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -59,7 +59,7 @@
static SpaceLink *nla_new(const ScrArea *sa, const Scene *scene)
{
- ARegion *ar;
+ ARegion *region;
SpaceNla *snla;
snla = MEM_callocN(sizeof(SpaceNla), "initnla");
@@ -74,57 +74,57 @@ static SpaceLink *nla_new(const ScrArea *sa, const Scene *scene)
snla->flag = SNLA_SHOW_MARKERS;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for nla");
+ region = MEM_callocN(sizeof(ARegion), "header for nla");
- BLI_addtail(&snla->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&snla->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* channel list region */
- ar = MEM_callocN(sizeof(ARegion), "channel list for nla");
- BLI_addtail(&snla->regionbase, ar);
- ar->regiontype = RGN_TYPE_CHANNELS;
- ar->alignment = RGN_ALIGN_LEFT;
+ region = MEM_callocN(sizeof(ARegion), "channel list for nla");
+ BLI_addtail(&snla->regionbase, region);
+ region->regiontype = RGN_TYPE_CHANNELS;
+ region->alignment = RGN_ALIGN_LEFT;
/* only need to set these settings since this will use the 'stack' configuration */
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
/* ui buttons */
- ar = MEM_callocN(sizeof(ARegion), "buttons region for nla");
+ region = MEM_callocN(sizeof(ARegion), "buttons region for nla");
- BLI_addtail(&snla->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&snla->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for nla");
+ region = MEM_callocN(sizeof(ARegion), "main region for nla");
- BLI_addtail(&snla->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&snla->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin = (float)(SFRA - 10);
- ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
- ar->v2d.tot.xmax = (float)(EFRA + 10);
- ar->v2d.tot.ymax = 0.0f;
+ region->v2d.tot.xmin = (float)(SFRA - 10);
+ region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ region->v2d.tot.xmax = (float)(EFRA + 10);
+ region->v2d.tot.ymax = 0.0f;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = 0.0f;
- ar->v2d.min[1] = 0.0f;
+ region->v2d.min[0] = 0.0f;
+ region->v2d.min[1] = 0.0f;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = 10000.0f;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = 10000.0f;
- ar->v2d.minzoom = 0.01f;
- ar->v2d.maxzoom = 50;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
- ar->v2d.keepofs = V2D_KEEPOFS_Y;
- ar->v2d.align = V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+ region->v2d.minzoom = 0.01f;
+ region->v2d.maxzoom = 50;
+ region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ region->v2d.keepzoom = V2D_LOCKZOOM_Y;
+ region->v2d.keepofs = V2D_KEEPOFS_Y;
+ region->v2d.align = V2D_ALIGN_NO_POS_Y;
+ region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
return (SpaceLink *)snla;
}
@@ -165,32 +165,32 @@ static SpaceLink *nla_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void nla_channel_region_init(wmWindowManager *wm, ARegion *ar)
+static void nla_channel_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
/* ensure the 2d view sync works - main region has bottom scroller */
- ar->v2d.scroll = V2D_SCROLL_BOTTOM;
+ region->v2d.scroll = V2D_SCROLL_BOTTOM;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
/* own keymap */
/* own channels map first to override some channel keymaps */
keymap = WM_keymap_ensure(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* now generic channels map for everything else that can apply */
keymap = WM_keymap_ensure(wm->defaultconf, "Animation Channels", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
/* draw entirely, view changes should be handled here */
-static void nla_channel_region_draw(const bContext *C, ARegion *ar)
+static void nla_channel_region_draw(const bContext *C, ARegion *region)
{
bAnimContext ac;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
/* clear and setup matrix */
@@ -201,11 +201,11 @@ static void nla_channel_region_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
- draw_nla_channel_list(C, &ac, ar);
+ draw_nla_channel_list(C, &ac, region);
}
/* channel filter next to scrubbing area */
- ED_time_scrub_channel_search_draw(C, ar, ac.ads);
+ ED_time_scrub_channel_search_draw(C, region, ac.ads);
/* reset view matrix */
UI_view2d_view_restore(C);
@@ -217,26 +217,26 @@ static void nla_channel_region_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void nla_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void nla_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "NLA Editor", SPACE_NLA, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void nla_main_region_draw(const bContext *C, ARegion *ar)
+static void nla_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceNla *snla = CTX_wm_space_nla(C);
Scene *scene = CTX_data_scene(C);
bAnimContext ac;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
short cfra_flag = 0;
@@ -249,7 +249,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
/* time grid */
UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, snla->flag & SNLA_DRAWTIME);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
/* start and end frame */
ANIM_draw_framerange(scene, v2d);
@@ -257,10 +257,10 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
/* strips and backdrops */
- draw_nla_main_data(&ac, snla, ar);
+ draw_nla_main_data(&ac, snla, region);
/* text draw cached, in pixelspace now */
- UI_view2d_text_cache_draw(ar);
+ UI_view2d_text_cache_draw(region);
}
UI_view2d_view_ortho(v2d);
@@ -272,7 +272,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, cfra_flag);
/* markers */
- UI_view2d_view_orthoSpecial(ar, v2d, 1);
+ UI_view2d_view_orthoSpecial(region, v2d, 1);
int marker_draw_flag = DRAW_MARKERS_MARGIN;
if (snla->flag & SNLA_SHOW_MARKERS) {
ED_markers_draw(C, marker_draw_flag);
@@ -284,12 +284,12 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
/* callback */
UI_view2d_view_ortho(v2d);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
- ED_time_scrub_draw(ar, scene, snla->flag & SNLA_DRAWTIME, true);
+ ED_time_scrub_draw(region, scene, snla->flag & SNLA_DRAWTIME, true);
/* scrollers */
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
@@ -298,42 +298,42 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void nla_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void nla_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void nla_header_region_draw(const bContext *C, ARegion *ar)
+static void nla_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/* add handlers, stuff you only do once or on area/region changes */
-static void nla_buttons_region_init(wmWindowManager *wm, ARegion *ar)
+static void nla_buttons_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void nla_buttons_region_draw(const bContext *C, ARegion *ar)
+static void nla_buttons_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void nla_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
@@ -342,7 +342,7 @@ static void nla_region_listener(wmWindow *UNUSED(win),
case ND_MARKERS:
case ND_LAYER_CONTENT:
case ND_OB_SELECT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -352,13 +352,13 @@ static void nla_region_listener(wmWindow *UNUSED(win),
case ND_BONE_SELECT:
case ND_KEYS:
case ND_DRAW:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -366,14 +366,14 @@ static void nla_region_listener(wmWindow *UNUSED(win),
static void nla_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
@@ -384,7 +384,7 @@ static void nla_main_region_listener(wmWindow *UNUSED(win),
case ND_MARKERS:
case ND_LAYER_CONTENT:
case ND_OB_SELECT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -394,30 +394,30 @@ static void nla_main_region_listener(wmWindow *UNUSED(win),
case ND_BONE_SELECT:
case ND_KEYS:
case ND_TRANSFORM:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_NODE:
switch (wmn->action) {
case NA_EDITED:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -428,15 +428,15 @@ static void nla_main_region_message_subscribe(const struct bContext *UNUSED(C),
struct Scene *scene,
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceNLA, sa->spacedata.first, &ptr);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -467,21 +467,21 @@ static void nla_main_region_message_subscribe(const struct bContext *UNUSED(C),
static void nla_channel_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_SCENE:
switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_LAYER_CONTENT:
case ND_OB_SELECT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -491,18 +491,18 @@ static void nla_channel_region_listener(wmWindow *UNUSED(win),
case ND_BONE_SELECT:
case ND_KEYS:
case ND_DRAW:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
default:
if (wmn->data == ND_KEYS) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -513,15 +513,15 @@ static void nla_channel_region_message_subscribe(const struct bContext *UNUSED(C
struct Scene *UNUSED(scene),
struct bScreen *screen,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
PointerRNA ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceNLA, sa->spacedata.first, &ptr);
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 6d37d0d1b7e..148c1669b06 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -447,7 +447,7 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp
}
static void node_draw_frame(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
@@ -459,7 +459,7 @@ static void node_draw_frame(const bContext *C,
float alpha;
/* skip if out of view */
- if (BLI_rctf_isect(&node->totr, &ar->v2d.cur, NULL) == false) {
+ if (BLI_rctf_isect(&node->totr, &region->v2d.cur, NULL) == false) {
UI_block_end(C, node->block);
node->block = NULL;
return;
@@ -569,7 +569,7 @@ static void node_draw_reroute_prepare(const bContext *UNUSED(C),
}
static void node_draw_reroute(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *UNUSED(snode),
bNodeTree *ntree,
bNode *node,
@@ -579,8 +579,8 @@ static void node_draw_reroute(const bContext *C,
rctf *rct = &node->totr;
/* skip if out of view */
- if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax ||
- node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) {
+ if (node->totr.xmax < region->v2d.cur.xmin || node->totr.xmin > region->v2d.cur.xmax ||
+ node->totr.ymax < region->v2d.cur.ymin || node->totr.ymin > region->v2d.cur.ymax) {
UI_block_end(C, node->block);
node->block = NULL;
return;
@@ -638,7 +638,7 @@ static void node_draw_reroute(const bContext *C,
/* only draw input socket. as they all are placed on the same position.
* highlight also if node itself is selected, since we don't display the node body separately!
*/
- node_draw_sockets(&ar->v2d, C, ntree, node, false, node->flag & SELECT);
+ node_draw_sockets(&region->v2d, C, ntree, node, false, node->flag & SELECT);
UI_block_end(C, node->block);
UI_block_draw(C, node->block);
@@ -3457,7 +3457,7 @@ void ED_init_node_socket_type_virtual(bNodeSocketType *stype)
/* ************** Generic drawing ************** */
void draw_nodespace_back_pix(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeInstanceKey parent_key)
{
@@ -3471,9 +3471,9 @@ void draw_nodespace_back_pix(const bContext *C,
GPU_matrix_push_projection();
GPU_matrix_push();
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
GPU_matrix_identity_set();
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_BACKDROP);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_BACKDROP);
GPU_matrix_pop_projection();
GPU_matrix_pop();
@@ -3494,10 +3494,10 @@ void draw_nodespace_back_pix(const bContext *C,
GPU_matrix_push();
/* somehow the offset has to be calculated inverse */
- wmOrtho2_region_pixelspace(ar);
+ wmOrtho2_region_pixelspace(region);
- x = (ar->winx - snode->zoom * ibuf->x) / 2 + snode->xof;
- y = (ar->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
+ x = (region->winx - snode->zoom * ibuf->x) / 2 + snode->xof;
+ y = (region->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
if (ibuf->rect || ibuf->rect_float) {
uchar *display_buffer = NULL;
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 31b27adb226..644f2b2dc5b 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -215,7 +215,7 @@ static bNodeSocketLink *add_reroute_do_socket_section(bContext *C,
static int add_reroute_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNodeTree *ntree = snode->edittree;
float mcoords[256][2];
int i = 0;
@@ -226,7 +226,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
RNA_float_get_array(&itemptr, "loc", loc);
UI_view2d_region_to_view(
- &ar->v2d, (short)loc[0], (short)loc[1], &mcoords[i][0], &mcoords[i][1]);
+ &region->v2d, (short)loc[0], (short)loc[1], &mcoords[i][0], &mcoords[i][1]);
i++;
if (i >= 256) {
break;
@@ -368,12 +368,12 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
static int node_add_file_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(
- &ar->v2d, event->mval[0], event->mval[1], &snode->cursor[0], &snode->cursor[1]);
+ &region->v2d, event->mval[0], event->mval[1], &snode->cursor[0], &snode->cursor[1]);
snode->cursor[0] /= UI_DPI_FAC;
snode->cursor[1] /= UI_DPI_FAC;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 91a42de05f2..35fbbad14b0 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -1085,7 +1085,7 @@ void node_draw_sockets(View2D *v2d,
}
static void node_draw_basis(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
@@ -1099,7 +1099,7 @@ static void node_draw_basis(const bContext *C,
int color_id = node_get_colorid(node);
float color[4];
char showname[128]; /* 128 used below */
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* skip if out of view */
if (BLI_rctf_isect(&node->totr, &v2d->cur, NULL) == false) {
@@ -1296,7 +1296,7 @@ static void node_draw_basis(const bContext *C,
}
static void node_draw_hidden(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
@@ -1308,7 +1308,7 @@ static void node_draw_hidden(const bContext *C,
int color_id = node_get_colorid(node);
float color[4];
char showname[128]; /* 128 is used below */
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
float scale;
UI_view2d_scale_get(v2d, &scale, NULL);
@@ -1392,7 +1392,7 @@ static void node_draw_hidden(const bContext *C,
/* disable lines */
if (node->flag & NODE_MUTED) {
- node_draw_mute_line(&ar->v2d, snode, node);
+ node_draw_mute_line(&region->v2d, snode, node);
}
nodeLabel(ntree, node, showname, sizeof(showname));
@@ -1499,17 +1499,17 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode, float cursor[2])
}
void node_draw_default(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
bNodeInstanceKey key)
{
if (node->flag & NODE_HIDDEN) {
- node_draw_hidden(C, ar, snode, ntree, node, key);
+ node_draw_hidden(C, region, snode, ntree, node, key);
}
else {
- node_draw_basis(C, ar, snode, ntree, node, key);
+ node_draw_basis(C, region, snode, ntree, node, key);
}
}
@@ -1534,21 +1534,21 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree)
}
static void node_draw(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
bNodeInstanceKey key)
{
if (node->typeinfo->draw_nodetype) {
- node->typeinfo->draw_nodetype(C, ar, snode, ntree, node, key);
+ node->typeinfo->draw_nodetype(C, region, snode, ntree, node, key);
}
}
#define USE_DRAW_TOT_UPDATE
void node_draw_nodetree(const bContext *C,
- ARegion *ar,
+ ARegion *region,
SpaceNode *snode,
bNodeTree *ntree,
bNodeInstanceKey parent_key)
@@ -1563,7 +1563,7 @@ void node_draw_nodetree(const bContext *C,
#ifdef USE_DRAW_TOT_UPDATE
if (ntree->nodes.first) {
- BLI_rctf_init_minmax(&ar->v2d.tot);
+ BLI_rctf_init_minmax(&region->v2d.tot);
}
#endif
@@ -1574,7 +1574,7 @@ void node_draw_nodetree(const bContext *C,
#ifdef USE_DRAW_TOT_UPDATE
/* unrelated to background nodes, update the v2d->tot,
* can be anywhere before we draw the scroll bars */
- BLI_rctf_union(&ar->v2d.tot, &node->totr);
+ BLI_rctf_union(&region->v2d.tot, &node->totr);
#endif
if (!(node->flag & NODE_BACKGROUND)) {
@@ -1583,7 +1583,7 @@ void node_draw_nodetree(const bContext *C,
key = BKE_node_instance_key(parent_key, ntree, node);
node->nr = a; /* index of node in list, used for exec event code */
- node_draw(C, ar, snode, ntree, node, key);
+ node_draw(C, region, snode, ntree, node, key);
}
/* node lines */
@@ -1591,7 +1591,7 @@ void node_draw_nodetree(const bContext *C,
nodelink_batch_start(snode);
for (link = ntree->links.first; link; link = link->next) {
if (!nodeLinkIsHidden(link)) {
- node_draw_link(&ar->v2d, snode, link);
+ node_draw_link(&region->v2d, snode, link);
}
}
nodelink_batch_end(snode);
@@ -1606,7 +1606,7 @@ void node_draw_nodetree(const bContext *C,
key = BKE_node_instance_key(parent_key, ntree, node);
node->nr = a; /* index of node in list, used for exec event code */
- node_draw(C, ar, snode, ntree, node, key);
+ node_draw(C, region, snode, ntree, node, key);
}
}
@@ -1621,21 +1621,21 @@ static void draw_tree_path(SpaceNode *snode)
BLF_draw_default(1.5f * UI_UNIT_X, 1.5f * UI_UNIT_Y, 0.0f, info, sizeof(info));
}
-static void snode_setup_v2d(SpaceNode *snode, ARegion *ar, const float center[2])
+static void snode_setup_v2d(SpaceNode *snode, ARegion *region, const float center[2])
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* shift view to node tree center */
UI_view2d_center_set(v2d, center[0], center[1]);
UI_view2d_view_ortho(v2d);
/* aspect+font, set each time */
- snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)ar->winx;
+ snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)region->winx;
// XXX snode->curfont = uiSetCurFont_ext(snode->aspect);
}
static void draw_nodetree(const bContext *C,
- ARegion *ar,
+ ARegion *region,
bNodeTree *ntree,
bNodeInstanceKey parent_key)
{
@@ -1644,13 +1644,13 @@ static void draw_nodetree(const bContext *C,
node_uiblocks_init(C, ntree);
node_update_nodetree(C, ntree);
- node_draw_nodetree(C, ar, snode, ntree, parent_key);
+ node_draw_nodetree(C, region, snode, ntree, parent_key);
}
/* shade the parent node group and add a uiBlock to clip mouse events */
-static void draw_group_overlay(const bContext *C, ARegion *ar)
+static void draw_group_overlay(const bContext *C, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
rctf rect = v2d->cur;
uiBlock *block;
float color[4];
@@ -1664,18 +1664,18 @@ static void draw_group_overlay(const bContext *C, ARegion *ar)
GPU_blend(false);
/* set the block bounds to clip mouse events from underlying nodes */
- block = UI_block_begin(C, ar, "node tree bounds block", UI_EMBOSS);
+ block = UI_block_begin(C, region, "node tree bounds block", UI_EMBOSS);
UI_block_bounds_set_explicit(block, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
UI_block_flag_enable(block, UI_BLOCK_CLIP_EVENTS);
UI_block_end(C, block);
}
-void drawnodespace(const bContext *C, ARegion *ar)
+void drawnodespace(const bContext *C, ARegion *region)
{
wmWindow *win = CTX_wm_window(C);
View2DScrollers *scrollers;
SpaceNode *snode = CTX_wm_space_node(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
UI_ThemeClearColor(TH_BACK);
GPU_clear(GPU_COLOR_BIT);
@@ -1683,9 +1683,9 @@ void drawnodespace(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* XXX snode->cursor set in coordspace for placing new nodes, used for drawing noodles too */
- UI_view2d_region_to_view(&ar->v2d,
- win->eventstate->x - ar->winrct.xmin,
- win->eventstate->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&region->v2d,
+ win->eventstate->x - region->winrct.xmin,
+ win->eventstate->y - region->winrct.ymin,
&snode->cursor[0],
&snode->cursor[1]);
snode->cursor[0] /= UI_DPI_FAC;
@@ -1693,7 +1693,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
int grid_levels = UI_GetThemeValueType(TH_NODE_GRID_LEVELS, SPACE_NODE);
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
/* only set once */
GPU_blend_set_func_separate(
@@ -1741,18 +1741,18 @@ void drawnodespace(const bContext *C, ARegion *ar)
for (curdepth = depth; curdepth > 0; path = path->next, curdepth--) {
ntree = path->nodetree;
if (ntree) {
- snode_setup_v2d(snode, ar, path->view_center);
+ snode_setup_v2d(snode, region, path->view_center);
- draw_nodetree(C, ar, ntree, path->parent_key);
+ draw_nodetree(C, region, ntree, path->parent_key);
- draw_group_overlay(C, ar);
+ draw_group_overlay(C, region);
}
}
/* top-level edit tree */
ntree = path->nodetree;
if (ntree) {
- snode_setup_v2d(snode, ar, center);
+ snode_setup_v2d(snode, region, center);
/* grid, uses theme color based on node path depth */
UI_view2d_multi_grid_draw(v2d,
@@ -1762,7 +1762,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
grid_levels);
/* backdrop */
- draw_nodespace_back_pix(C, ar, snode, path->parent_key);
+ draw_nodespace_back_pix(C, region, snode, path->parent_key);
{
float original_proj[4][4];
@@ -1771,15 +1771,15 @@ void drawnodespace(const bContext *C, ARegion *ar)
GPU_matrix_push();
GPU_matrix_identity_set();
- wmOrtho2_pixelspace(ar->winx, ar->winy);
+ wmOrtho2_pixelspace(region->winx, region->winy);
- WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
+ WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
GPU_matrix_pop();
GPU_matrix_projection_set(original_proj);
}
- draw_nodetree(C, ar, ntree, path->parent_key);
+ draw_nodetree(C, region, ntree, path->parent_key);
}
/* temporary links */
@@ -1803,10 +1803,10 @@ void drawnodespace(const bContext *C, ARegion *ar)
UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, grid_levels);
/* backdrop */
- draw_nodespace_back_pix(C, ar, snode, NODE_INSTANCE_KEY_NONE);
+ draw_nodespace_back_pix(C, region, snode, NODE_INSTANCE_KEY_NONE);
}
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index a690aa75e3c..025de1c898c 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -920,7 +920,7 @@ static void node_resize_exit(bContext *C, wmOperator *op, bool cancel)
static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNode *node = nodeGetActive(snode->edittree);
NodeSizeWidget *nsw = op->customdata;
float mx, my, dx, dy;
@@ -928,7 +928,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case MOUSEMOVE:
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mx, &my);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &mx, &my);
dx = (mx - nsw->mxstart) / UI_DPI_FAC;
dy = (my - nsw->mystart) / UI_DPI_FAC;
@@ -994,7 +994,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
@@ -1009,7 +1009,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
else if (event->val == KM_PRESS) {
node_resize_exit(C, op, true);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_CANCELLED;
}
@@ -1022,7 +1022,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNode *node = nodeGetActive(snode->edittree);
int dir;
@@ -1030,7 +1030,7 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event)
float cursor[2];
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
dir = node->typeinfo->resize_area_func(node, cursor[0], cursor[1]);
if (dir != 0) {
node_resize_init(C, op, event, node, dir);
@@ -2598,7 +2598,7 @@ void NODE_OT_shader_script_update(wmOperatorType *ot)
/* ********************** Viewer border ******************/
static void viewer_border_corner_to_backdrop(SpaceNode *snode,
- ARegion *ar,
+ ARegion *region,
int x,
int y,
int backdrop_width,
@@ -2611,8 +2611,8 @@ static void viewer_border_corner_to_backdrop(SpaceNode *snode,
bufx = backdrop_width * snode->zoom;
bufy = backdrop_height * snode->zoom;
- *fx = (bufx > 0.0f ? ((float)x - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- *fy = (bufy > 0.0f ? ((float)y - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ *fx = (bufx > 0.0f ? ((float)x - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ *fy = (bufy > 0.0f ? ((float)y - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
}
static int viewer_border_exec(bContext *C, wmOperator *op)
@@ -2628,7 +2628,7 @@ static int viewer_border_exec(bContext *C, wmOperator *op)
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
if (ibuf) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *btree = snode->nodetree;
rcti rect;
@@ -2639,10 +2639,10 @@ static int viewer_border_exec(bContext *C, wmOperator *op)
/* convert border to unified space within backdrop image */
viewer_border_corner_to_backdrop(
- snode, ar, rect.xmin, rect.ymin, ibuf->x, ibuf->y, &rectf.xmin, &rectf.ymin);
+ snode, region, rect.xmin, rect.ymin, ibuf->x, ibuf->y, &rectf.xmin, &rectf.ymin);
viewer_border_corner_to_backdrop(
- snode, ar, rect.xmax, rect.ymax, ibuf->x, ibuf->y, &rectf.xmax, &rectf.ymax);
+ snode, region, rect.xmax, rect.ymax, ibuf->x, ibuf->y, &rectf.xmax, &rectf.ymax);
/* clamp coordinates */
rectf.xmin = max_ff(rectf.xmin, 0.0f);
diff --git a/source/blender/editors/space_node/node_gizmo.c b/source/blender/editors/space_node/node_gizmo.c
index ad959570acd..3048c14dddb 100644
--- a/source/blender/editors/space_node/node_gizmo.c
+++ b/source/blender/editors/space_node/node_gizmo.c
@@ -48,26 +48,26 @@
* \{ */
static void node_gizmo_calc_matrix_space(const SpaceNode *snode,
- const ARegion *ar,
+ const ARegion *region,
float matrix_space[4][4])
{
unit_m4(matrix_space);
mul_v3_fl(matrix_space[0], snode->zoom);
mul_v3_fl(matrix_space[1], snode->zoom);
- matrix_space[3][0] = (ar->winx / 2) + snode->xof;
- matrix_space[3][1] = (ar->winy / 2) + snode->yof;
+ matrix_space[3][0] = (region->winx / 2) + snode->xof;
+ matrix_space[3][1] = (region->winy / 2) + snode->yof;
}
static void node_gizmo_calc_matrix_space_with_image_dims(const SpaceNode *snode,
- const ARegion *ar,
+ const ARegion *region,
const float image_dims[2],
float matrix_space[4][4])
{
unit_m4(matrix_space);
mul_v3_fl(matrix_space[0], snode->zoom * image_dims[0]);
mul_v3_fl(matrix_space[1], snode->zoom * image_dims[1]);
- matrix_space[3][0] = ((ar->winx / 2) + snode->xof) - ((image_dims[0] / 2.0f) * snode->zoom);
- matrix_space[3][1] = ((ar->winy / 2) + snode->yof) - ((image_dims[1] / 2.0f) * snode->zoom);
+ matrix_space[3][0] = ((region->winx / 2) + snode->xof) - ((image_dims[0] / 2.0f) * snode->zoom);
+ matrix_space[3][1] = ((region->winy / 2) + snode->yof) - ((image_dims[1] / 2.0f) * snode->zoom);
}
/** \} */
@@ -138,9 +138,9 @@ static void WIDGETGROUP_node_transform_refresh(const bContext *C, wmGizmoGroup *
{
Main *bmain = CTX_data_main(C);
wmGizmo *cage = ((wmGizmoWrapper *)gzgroup->customdata)->gizmo;
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
/* center is always at the origin */
- const float origin[3] = {ar->winx / 2, ar->winy / 2};
+ const float origin[3] = {region->winx / 2, region->winy / 2};
void *lock;
Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
@@ -352,12 +352,12 @@ static void WIDGETGROUP_node_crop_setup(const bContext *UNUSED(C), wmGizmoGroup
static void WIDGETGROUP_node_crop_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmGizmo *gz = gzgroup->gizmos.first;
SpaceNode *snode = CTX_wm_space_node(C);
- node_gizmo_calc_matrix_space(snode, ar, gz->matrix_space);
+ node_gizmo_calc_matrix_space(snode, region, gz->matrix_space);
}
static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmGizmoGroup *gzgroup)
@@ -467,13 +467,13 @@ static void WIDGETGROUP_node_sbeam_setup(const bContext *UNUSED(C), wmGizmoGroup
static void WIDGETGROUP_node_sbeam_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
struct NodeSunBeamsWidgetGroup *sbeam_group = gzgroup->customdata;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmGizmo *gz = gzgroup->gizmos.first;
SpaceNode *snode = CTX_wm_space_node(C);
node_gizmo_calc_matrix_space_with_image_dims(
- snode, ar, sbeam_group->state.dims, gz->matrix_space);
+ snode, region, sbeam_group->state.dims, gz->matrix_space);
}
static void WIDGETGROUP_node_sbeam_refresh(const bContext *C, wmGizmoGroup *gzgroup)
@@ -575,12 +575,13 @@ static void WIDGETGROUP_node_corner_pin_setup(const bContext *UNUSED(C), wmGizmo
static void WIDGETGROUP_node_corner_pin_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
struct NodeCornerPinWidgetGroup *cpin_group = gzgroup->customdata;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
float matrix_space[4][4];
- node_gizmo_calc_matrix_space_with_image_dims(snode, ar, cpin_group->state.dims, matrix_space);
+ node_gizmo_calc_matrix_space_with_image_dims(
+ snode, region, cpin_group->state.dims, matrix_space);
for (int i = 0; i < 4; i++) {
wmGizmo *gz = cpin_group->gizmos[i];
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 1825396805c..c1aeca87d7b 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -63,7 +63,7 @@ int node_get_colorid(struct bNode *node);
int node_get_resize_cursor(int directions);
void node_draw_shadow(struct SpaceNode *snode, struct bNode *node, float radius, float alpha);
void node_draw_default(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct SpaceNode *snode,
struct bNodeTree *ntree,
struct bNode *node,
@@ -79,11 +79,11 @@ int node_select_area_default(struct bNode *node, int x, int y);
int node_tweak_area_default(struct bNode *node, int x, int y);
void node_update_nodetree(const struct bContext *C, struct bNodeTree *ntree);
void node_draw_nodetree(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct SpaceNode *snode,
struct bNodeTree *ntree,
bNodeInstanceKey parent_key);
-void drawnodespace(const bContext *C, ARegion *ar);
+void drawnodespace(const bContext *C, ARegion *region);
void node_set_cursor(struct wmWindow *win, struct SpaceNode *snode, float cursor[2]);
/* DPI scaled coords */
@@ -123,7 +123,7 @@ void NODE_OT_find_node(struct wmOperatorType *ot);
/* node_view.c */
int space_node_view_flag(struct bContext *C,
SpaceNode *snode,
- ARegion *ar,
+ ARegion *region,
const int node_flag,
const int smooth_viewtx);
@@ -162,7 +162,7 @@ void node_draw_link_straight(View2D *v2d,
int th_col3);
#endif
void draw_nodespace_back_pix(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
struct SpaceNode *snode,
bNodeInstanceKey parent_key);
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 75937d8da4e..7556b6ebd06 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -750,17 +750,17 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
bNodeLinkDrag *nldrag = op->customdata;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float cursor[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
switch (event->type) {
case MOUSEMOVE:
node_link_find_socket(C, op, cursor);
node_link_update_header(C, nldrag);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case LEFTMOUSE:
@@ -770,7 +770,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
node_link_exit(C, op, true);
ED_workspace_status_text(C, NULL);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
break;
@@ -900,13 +900,13 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNodeLinkDrag *nldrag;
float cursor[2];
bool detach = RNA_boolean_get(op->ptr, "detach");
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
ED_preview_kill_jobs(CTX_wm_manager(C), bmain);
@@ -1023,7 +1023,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float mcoords[256][2];
int i = 0;
bool do_tag_update = false;
@@ -1032,7 +1032,8 @@ static int cut_links_exec(bContext *C, wmOperator *op)
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
- UI_view2d_region_to_view(&ar->v2d, (int)loc[0], (int)loc[1], &mcoords[i][0], &mcoords[i][1]);
+ UI_view2d_region_to_view(
+ &region->v2d, (int)loc[0], (int)loc[1], &mcoords[i][0], &mcoords[i][1]);
i++;
if (i >= 256) {
break;
@@ -1286,13 +1287,15 @@ void NODE_OT_join(wmOperatorType *ot)
/* ****************** Attach ******************* */
-static bNode *node_find_frame_to_attach(ARegion *ar, const bNodeTree *ntree, const int mouse_xy[2])
+static bNode *node_find_frame_to_attach(ARegion *region,
+ const bNodeTree *ntree,
+ const int mouse_xy[2])
{
bNode *frame;
float cursor[2];
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d, UNPACK2(mouse_xy), &cursor[0], &cursor[1]);
+ UI_view2d_region_to_view(&region->v2d, UNPACK2(mouse_xy), &cursor[0], &cursor[1]);
/* check nodes front to back */
for (frame = ntree->nodes.last; frame; frame = frame->prev) {
@@ -1310,10 +1313,10 @@ static bNode *node_find_frame_to_attach(ARegion *ar, const bNodeTree *ntree, con
static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *ntree = snode->edittree;
- bNode *frame = node_find_frame_to_attach(ar, ntree, event->mval);
+ bNode *frame = node_find_frame_to_attach(region, ntree, event->mval);
if (frame) {
bNode *node, *parent;
@@ -1704,7 +1707,7 @@ static bool node_link_insert_offset_chain_cb(bNode *fromnode,
}
static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
- ARegion *ar,
+ ARegion *region,
const int mouse_xy[2],
const bool right_alignment)
{
@@ -1730,7 +1733,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
/* frame attachment wasn't handled yet
* so we search the frame that the node will be attached to later */
- insert->parent = node_find_frame_to_attach(ar, ntree, mouse_xy);
+ insert->parent = node_find_frame_to_attach(region, ntree, mouse_xy);
/* this makes sure nodes are also correctly offset when inserting a node on top of a frame
* without actually making it a part of the frame (because mouse isn't intersecting it)
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index e22ef389516..a2453cb0837 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -104,9 +104,9 @@ static bool is_position_over_node_or_socket(SpaceNode *snode, float mouse[2])
static bool is_event_over_node_or_socket(bContext *C, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float mouse[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &mouse[0], &mouse[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &mouse[0], &mouse[1]);
return is_position_over_node_or_socket(snode, mouse);
}
@@ -436,7 +436,7 @@ static int node_mouse_select(bContext *C,
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNode *node, *tnode;
bNodeSocket *sock = NULL;
bNodeSocket *tsock;
@@ -454,7 +454,7 @@ static int node_mouse_select(bContext *C,
}
/* get mouse coordinates in view2d space */
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &cursor[0], &cursor[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &cursor[0], &cursor[1]);
/* first do socket selection, these generally overlap with nodes. */
if (socket_select) {
@@ -610,11 +610,11 @@ void NODE_OT_select(wmOperatorType *ot)
static int node_box_select_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
rctf rectf;
WM_operator_properties_border_to_rctf(op, &rectf);
- UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
+ UI_view2d_region_to_view_rctf(&region->v2d, &rectf, &rectf);
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
const bool select = (sel_op != SEL_OP_SUB);
@@ -692,13 +692,14 @@ void NODE_OT_select_box(wmOperatorType *ot)
static int node_circleselect_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNode *node;
int x, y, radius;
float offset[2];
- float zoom = (float)(BLI_rcti_size_x(&ar->winrct)) / (float)(BLI_rctf_size_x(&ar->v2d.cur));
+ float zoom = (float)(BLI_rcti_size_x(&region->winrct)) /
+ (float)(BLI_rctf_size_x(&region->v2d.cur));
const eSelectOp sel_op = ED_select_op_modal(RNA_enum_get(op->ptr, "mode"),
WM_gesture_is_modal_first(op->customdata));
@@ -712,7 +713,7 @@ static int node_circleselect_exec(bContext *C, wmOperator *op)
y = RNA_int_get(op->ptr, "y");
radius = RNA_int_get(op->ptr, "radius");
- UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);
+ UI_view2d_region_to_view(&region->v2d, x, y, &offset[0], &offset[1]);
for (node = snode->edittree->nodes.first; node; node = node->next) {
if (BLI_rctf_isect_circle(&node->totr, offset, radius / zoom)) {
@@ -769,7 +770,7 @@ static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves
SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
rcti rect;
bool changed = false;
@@ -794,7 +795,8 @@ static bool do_lasso_select_node(bContext *C, const int mcords[][2], short moves
const float cent[2] = {BLI_rctf_cent_x(&node->totr), BLI_rctf_cent_y(&node->totr)};
/* marker in screen coords */
- if (UI_view2d_view_to_region_clip(&ar->v2d, cent[0], cent[1], &screen_co[0], &screen_co[1]) &&
+ if (UI_view2d_view_to_region_clip(
+ &region->v2d, cent[0], cent[1], &screen_co[0], &screen_co[1]) &&
BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], INT_MAX)) {
nodeSetSelected(node, select);
@@ -1004,7 +1006,7 @@ void NODE_OT_select_linked_from(wmOperatorType *ot)
static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bNode **node_array;
bNode *active = nodeGetActive(snode->edittree);
int totnodes;
@@ -1072,10 +1074,10 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
node_select_single(C, active);
/* is note outside view? */
- if (active->totr.xmax < ar->v2d.cur.xmin || active->totr.xmin > ar->v2d.cur.xmax ||
- active->totr.ymax < ar->v2d.cur.ymin || active->totr.ymin > ar->v2d.cur.ymax) {
+ if (active->totr.xmax < region->v2d.cur.xmin || active->totr.xmin > region->v2d.cur.xmax ||
+ active->totr.ymax < region->v2d.cur.ymin || active->totr.ymin > region->v2d.cur.ymax) {
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
- space_node_view_flag(C, snode, ar, NODE_SELECT, smooth_viewtx);
+ space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx);
}
}
@@ -1142,25 +1144,25 @@ static void node_find_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2
bNode *active = arg2;
if (active) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
node_select_single(C, active);
/* is note outside view? */
- if (active->totr.xmax < ar->v2d.cur.xmin || active->totr.xmin > ar->v2d.cur.xmax ||
- active->totr.ymax < ar->v2d.cur.ymin || active->totr.ymin > ar->v2d.cur.ymax) {
- space_node_view_flag(C, snode, ar, NODE_SELECT, U.smooth_viewtx);
+ if (active->totr.xmax < region->v2d.cur.xmin || active->totr.xmin > region->v2d.cur.xmax ||
+ active->totr.ymax < region->v2d.cur.ymin || active->totr.ymin > region->v2d.cur.ymax) {
+ space_node_view_flag(C, snode, region, NODE_SELECT, U.smooth_viewtx);
}
}
}
-static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op)
+static uiBlock *node_find_menu(bContext *C, ARegion *region, void *arg_op)
{
static char search[256] = "";
uiBlock *block;
uiBut *but;
wmOperator *op = (wmOperator *)arg_op;
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index 9a13032b0bc..7023a3ebd18 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -58,7 +58,7 @@
/* **************** View All Operator ************** */
int space_node_view_flag(
- bContext *C, SpaceNode *snode, ARegion *ar, const int node_flag, const int smooth_viewtx)
+ bContext *C, SpaceNode *snode, ARegion *region, const int node_flag, const int smooth_viewtx)
{
bNode *node;
rctf cur_new;
@@ -67,8 +67,8 @@ int space_node_view_flag(
int tot = 0;
bool has_frame = false;
- oldwidth = BLI_rctf_size_x(&ar->v2d.cur);
- oldheight = BLI_rctf_size_y(&ar->v2d.cur);
+ oldwidth = BLI_rctf_size_x(&region->v2d.cur);
+ oldheight = BLI_rctf_size_y(&region->v2d.cur);
oldasp = oldwidth / oldheight;
@@ -114,7 +114,7 @@ int space_node_view_flag(
BLI_rctf_scale(&cur_new, 1.1f);
}
- UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
+ UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx);
}
return (tot != 0);
@@ -122,7 +122,7 @@ int space_node_view_flag(
static int node_view_all_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -130,7 +130,7 @@ static int node_view_all_exec(bContext *C, wmOperator *op)
snode->xof = 0;
snode->yof = 0;
- if (space_node_view_flag(C, snode, ar, 0, smooth_viewtx)) {
+ if (space_node_view_flag(C, snode, region, 0, smooth_viewtx)) {
return OPERATOR_FINISHED;
}
else {
@@ -155,11 +155,11 @@ void NODE_OT_view_all(wmOperatorType *ot)
static int node_view_selected_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
- if (space_node_view_flag(C, snode, ar, NODE_SELECT, smooth_viewtx)) {
+ if (space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx)) {
return OPERATOR_FINISHED;
}
else {
@@ -192,7 +192,7 @@ typedef struct NodeViewMove {
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
NodeViewMove *nvm = op->customdata;
switch (event->type) {
@@ -207,7 +207,7 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e
CLAMP(snode->xof, nvm->xmin, nvm->xmax);
CLAMP(snode->yof, nvm->ymin, nvm->ymax);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
break;
@@ -230,7 +230,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
NodeViewMove *nvm;
Image *ima;
ImBuf *ibuf;
@@ -251,10 +251,10 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *
nvm->mvalo[0] = event->mval[0];
nvm->mvalo[1] = event->mval[1];
- nvm->xmin = -(ar->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
- nvm->xmax = (ar->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
- nvm->ymin = -(ar->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
- nvm->ymax = (ar->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
+ nvm->xmin = -(region->winx / 2) - (ibuf->x * (0.5f * snode->zoom)) + pad;
+ nvm->xmax = (region->winx / 2) + (ibuf->x * (0.5f * snode->zoom)) - pad;
+ nvm->ymin = -(region->winy / 2) - (ibuf->y * (0.5f * snode->zoom)) + pad;
+ nvm->ymax = (region->winy / 2) + (ibuf->y * (0.5f * snode->zoom)) - pad;
BKE_image_release_ibuf(ima, ibuf, lock);
@@ -290,11 +290,11 @@ void NODE_OT_backimage_move(wmOperatorType *ot)
static int backimage_zoom_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float fac = RNA_float_get(op->ptr, "factor");
snode->zoom *= fac;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
@@ -323,7 +323,7 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Image *ima;
ImBuf *ibuf;
@@ -342,8 +342,8 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- facx = 1.0f * (ar->sizex - pad) / (ibuf->x * snode->zoom);
- facy = 1.0f * (ar->sizey - pad) / (ibuf->y * snode->zoom);
+ facx = 1.0f * (region->sizex - pad) / (ibuf->x * snode->zoom);
+ facy = 1.0f * (region->sizey - pad) / (ibuf->y * snode->zoom);
BKE_image_release_ibuf(ima, ibuf, lock);
@@ -352,7 +352,7 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op))
snode->xof = 0;
snode->yof = 0;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
@@ -396,14 +396,14 @@ typedef struct ImageSampleInfo {
int color_manage;
} ImageSampleInfo;
-static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
+static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
{
Scene *scene = CTX_data_scene(C);
ImageSampleInfo *info = arg_info;
if (info->draw) {
ED_image_draw_info(scene,
- ar,
+ region,
info->color_manage,
false,
info->channels,
@@ -421,7 +421,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
* And here we've got recursion in the comments tips...
*/
bool ED_space_node_color_sample(
- Main *bmain, SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3])
+ Main *bmain, SpaceNode *snode, ARegion *region, int mval[2], float r_col[3])
{
void *lock;
Image *ima;
@@ -445,8 +445,8 @@ bool ED_space_node_color_sample(
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
const float *fp;
@@ -479,7 +479,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
Main *bmain = CTX_data_main(C);
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ImageSampleInfo *info = op->customdata;
void *lock;
Image *ima;
@@ -500,8 +500,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
+ 0.0f);
+ fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
+ 0.0f);
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
const float *fp;
@@ -583,7 +585,7 @@ static void sample_exit(bContext *C, wmOperator *op)
static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ImageSampleInfo *info;
if (!ED_node_is_compositor(snode) || !(snode->flag & SNODE_BACKDRAW)) {
@@ -591,9 +593,9 @@ static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
- info->art = ar->type;
+ info->art = region->type;
info->draw_handle = ED_region_draw_cb_activate(
- ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
+ region->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
op->customdata = info;
sample_apply(C, op, event);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 6eab0dfff40..d3c7374e782 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -246,7 +246,7 @@ void snode_group_offset(SpaceNode *snode, float *x, float *y)
static SpaceLink *node_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceNode *snode;
snode = MEM_callocN(sizeof(SpaceNode), "initnode");
@@ -265,53 +265,53 @@ static SpaceLink *node_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
NODE_TREE_TYPES_END;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for node");
+ region = MEM_callocN(sizeof(ARegion), "header for node");
- BLI_addtail(&snode->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&snode->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* buttons/list view */
- ar = MEM_callocN(sizeof(ARegion), "buttons for node");
+ region = MEM_callocN(sizeof(ARegion), "buttons for node");
- BLI_addtail(&snode->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
+ BLI_addtail(&snode->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
/* toolbar */
- ar = MEM_callocN(sizeof(ARegion), "node tools");
+ region = MEM_callocN(sizeof(ARegion), "node tools");
- BLI_addtail(&snode->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
+ BLI_addtail(&snode->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
- ar->flag = RGN_FLAG_HIDDEN;
+ region->flag = RGN_FLAG_HIDDEN;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for node");
+ region = MEM_callocN(sizeof(ARegion), "main region for node");
- BLI_addtail(&snode->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&snode->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin = -12.8f * U.widget_unit;
- ar->v2d.tot.ymin = -12.8f * U.widget_unit;
- ar->v2d.tot.xmax = 38.4f * U.widget_unit;
- ar->v2d.tot.ymax = 38.4f * U.widget_unit;
+ region->v2d.tot.xmin = -12.8f * U.widget_unit;
+ region->v2d.tot.ymin = -12.8f * U.widget_unit;
+ region->v2d.tot.xmax = 38.4f * U.widget_unit;
+ region->v2d.tot.ymax = 38.4f * U.widget_unit;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = 1.0f;
- ar->v2d.min[1] = 1.0f;
+ region->v2d.min[0] = 1.0f;
+ region->v2d.min[1] = 1.0f;
- ar->v2d.max[0] = 32000.0f;
- ar->v2d.max[1] = 32000.0f;
+ region->v2d.max[0] = 32000.0f;
+ region->v2d.max[1] = 32000.0f;
- ar->v2d.minzoom = 0.09f;
- ar->v2d.maxzoom = 2.31f;
+ region->v2d.minzoom = 0.09f;
+ region->v2d.maxzoom = 2.31f;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
- ar->v2d.keeptot = 0;
+ region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
+ region->v2d.keeptot = 0;
return (SpaceLink *)snode;
}
@@ -347,11 +347,11 @@ static void node_area_listener(wmWindow *UNUSED(win),
case NC_SCENE:
switch (wmn->data) {
case ND_NODES: {
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
bNodeTreePath *path = snode->treepath.last;
/* shift view to node tree center */
- if (ar && path) {
- UI_view2d_center_set(&ar->v2d, path->view_center[0], path->view_center[1]);
+ if (region && path) {
+ UI_view2d_center_set(&region->v2d, path->view_center[0], path->view_center[1]);
}
ED_area_tag_refresh(sa);
@@ -554,45 +554,45 @@ static SpaceLink *node_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void node_buttons_region_init(wmWindowManager *wm, ARegion *ar)
+static void node_buttons_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void node_buttons_region_draw(const bContext *C, ARegion *ar)
+static void node_buttons_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
/* add handlers, stuff you only do once or on area/region changes */
-static void node_toolbar_region_init(wmWindowManager *wm, ARegion *ar)
+static void node_toolbar_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void node_toolbar_region_draw(const bContext *C, ARegion *ar)
+static void node_toolbar_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
-static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
+static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *region)
{
SpaceNode *snode = sa->spacedata.first;
/* convert mouse coordinates to v2d space */
- UI_view2d_region_to_view(&ar->v2d,
- win->eventstate->x - ar->winrct.xmin,
- win->eventstate->y - ar->winrct.ymin,
+ UI_view2d_region_to_view(&region->v2d,
+ win->eventstate->x - region->winrct.xmin,
+ win->eventstate->y - region->winrct.ymin,
&snode->cursor[0],
&snode->cursor[1]);
@@ -605,29 +605,29 @@ static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
}
/* Initialize main region, setting handlers. */
-static void node_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void node_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
ListBase *lb;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
/* own keymaps */
keymap = WM_keymap_ensure(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* add drop boxes */
lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
- WM_event_add_dropbox_handler(&ar->handlers, lb);
+ WM_event_add_dropbox_handler(&region->handlers, lb);
}
-static void node_main_region_draw(const bContext *C, ARegion *ar)
+static void node_main_region_draw(const bContext *C, ARegion *region)
{
- drawnodespace(C, ar);
+ drawnodespace(C, region);
}
/* ************* dropboxes ************* */
@@ -687,34 +687,34 @@ static void node_dropboxes(void)
/* ************* end drop *********** */
/* add handlers, stuff you only do once or on area/region changes */
-static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void node_header_region_draw(const bContext *C, ARegion *ar)
+static void node_header_region_draw(const bContext *C, ARegion *region)
{
/* find and set the context */
snode_set_context(C);
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/* used for header + main region */
static void node_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
- wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = region->gizmo_map;
/* context changes */
switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_NODE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_SPACE_NODE_VIEW:
WM_gizmomap_tag_refresh(gzmap);
@@ -728,23 +728,23 @@ static void node_region_listener(wmWindow *UNUSED(win),
switch (wmn->data) {
case ND_ANIMPLAY:
case ND_LAYER:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_WM:
if (wmn->data == ND_JOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (wmn->data == ND_RENDER_RESULT) {
WM_gizmomap_tag_refresh(gzmap);
}
break;
case NC_NODE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
WM_gizmomap_tag_refresh(gzmap);
}
@@ -753,24 +753,24 @@ static void node_region_listener(wmWindow *UNUSED(win),
case NC_TEXTURE:
case NC_WORLD:
case NC_LINESTYLE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_OBJECT:
if (wmn->data == ND_OB_SHADING) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else if (wmn->data & ND_GPENCIL_EDITMODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 4e77d6940b0..f129bc9e2ea 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -176,7 +176,7 @@ static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void
static int collection_new_exec(bContext *C, wmOperator *op)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -187,7 +187,7 @@ static int collection_new_exec(bContext *C, wmOperator *op)
};
if (RNA_boolean_get(op->ptr, "nested")) {
- outliner_build_tree(bmain, scene, view_layer, soops, ar);
+ outliner_build_tree(bmain, scene, view_layer, soops, region);
outliner_tree_traverse(
soops, &soops->tree, 0, TSE_SELECTED, collection_find_selected_to_add, &data);
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index ecacd55debb..fbf319bea37 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -107,10 +107,10 @@ static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops,
static TreeElement *outliner_drop_find(bContext *C, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
float fmval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
return outliner_dropzone_find(soops, fmval, true);
}
@@ -134,11 +134,12 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
TreeElementInsertType *r_insert_type)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
TreeElement *te_hovered;
float view_mval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
te_hovered = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
if (te_hovered) {
@@ -719,7 +720,7 @@ static bool collection_drop_poll(bContext *C,
const char **tooltip)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bool changed = outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
CollectionDrop data;
@@ -761,13 +762,13 @@ static bool collection_drop_poll(bContext *C,
}
}
if (changed) {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
return true;
}
else {
if (changed) {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
return false;
}
@@ -867,12 +868,12 @@ void OUTLINER_OT_collection_drop(wmOperatorType *ot)
/* ********************* Outliner Drag Operator ******************** */
static TreeElement *outliner_item_drag_element_find(SpaceOutliner *soops,
- ARegion *ar,
+ ARegion *region,
const wmEvent *event)
{
/* note: using EVT_TWEAK_ events to trigger dragging is fine,
* it sends coordinates from where dragging was started */
- const float my = UI_view2d_region_to_view_y(&ar->v2d, event->mval[1]);
+ const float my = UI_view2d_region_to_view_y(&region->v2d, event->mval[1]);
return outliner_find_item_at_y(soops, &soops->tree, my);
}
@@ -880,9 +881,9 @@ static int outliner_item_drag_drop_invoke(bContext *C,
wmOperator *UNUSED(op),
const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- TreeElement *te = outliner_item_drag_element_find(soops, ar, event);
+ TreeElement *te = outliner_item_drag_element_find(soops, region, event);
if (!te) {
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
@@ -894,7 +895,8 @@ static int outliner_item_drag_drop_invoke(bContext *C,
}
float view_mval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
if (outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 8985f32d23e..1c26dc8f834 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -987,7 +987,7 @@ static bool outliner_restrict_properties_collection_set(Scene *scene,
static void outliner_draw_restrictbuts(uiBlock *block,
Scene *scene,
ViewLayer *view_layer,
- ARegion *ar,
+ ARegion *region,
SpaceOutliner *soops,
ListBase *lb,
RestrictPropertiesActive props_active_parent)
@@ -1058,7 +1058,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
TreeStoreElem *tselem = TREESTORE(te);
RestrictPropertiesActive props_active = props_active_parent;
- if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) {
if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) {
if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
/* View layer render toggle. */
@@ -1069,7 +1069,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
VIEW_LAYER_RENDER,
0,
ICON_RESTRICT_RENDER_OFF,
- (int)(ar->v2d.cur.xmax - restrict_offsets.render),
+ (int)(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1103,7 +1103,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.hide),
+ (int)(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1130,7 +1130,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.select),
+ (int)(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1155,7 +1155,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
+ (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1180,7 +1180,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.render),
+ (int)(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1211,7 +1211,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.hide),
+ (int)(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1240,7 +1240,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
+ (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1263,7 +1263,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.render),
+ (int)(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1292,7 +1292,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_HIDDEN_P,
0,
ICON_RESTRICT_VIEW_OFF,
- (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
+ (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1313,7 +1313,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_UNSELECTABLE,
0,
ICON_RESTRICT_SELECT_OFF,
- (int)(ar->v2d.cur.xmax - restrict_offsets.select),
+ (int)(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1337,7 +1337,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_HIDDEN_A,
0,
ICON_RESTRICT_VIEW_OFF,
- (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
+ (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1358,7 +1358,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_UNSELECTABLE,
0,
ICON_RESTRICT_SELECT_OFF,
- (int)(ar->v2d.cur.xmax - restrict_offsets.select),
+ (int)(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1383,7 +1383,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
GP_LAYER_HIDE,
0,
ICON_HIDE_OFF,
- (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
+ (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1404,7 +1404,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
GP_LAYER_LOCKED,
0,
ICON_UNLOCKED,
- (int)(ar->v2d.cur.xmax - restrict_offsets.select),
+ (int)(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1436,7 +1436,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.hide),
+ (int)(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1465,7 +1465,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.holdout),
+ (int)(region->v2d.cur.xmax - restrict_offsets.holdout),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1495,7 +1495,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.indirect_only),
+ (int)(region->v2d.cur.xmax - restrict_offsets.indirect_only),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1527,7 +1527,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.viewport),
+ (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1564,7 +1564,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.render),
+ (int)(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1599,7 +1599,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(ar->v2d.cur.xmax - restrict_offsets.select),
+ (int)(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1639,17 +1639,21 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &te->subtree, props_active);
+ outliner_draw_restrictbuts(
+ block, scene, view_layer, region, soops, &te->subtree, props_active);
}
}
}
-static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *soops, ListBase *lb)
+static void outliner_draw_userbuts(uiBlock *block,
+ ARegion *region,
+ SpaceOutliner *soops,
+ ListBase *lb)
{
for (TreeElement *te = lb->first; te; te = te->next) {
TreeStoreElem *tselem = TREESTORE(te);
- if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) {
if (tselem->type == 0) {
uiBut *bt;
ID *id = tselem->id;
@@ -1667,7 +1671,7 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *s
UI_BTYPE_BUT,
1,
buf,
- (int)(ar->v2d.cur.xmax - OL_TOG_USER_BUTS_USERS),
+ (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_USERS),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1692,7 +1696,7 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *s
LIB_FAKEUSER,
1,
icon,
- (int)(ar->v2d.cur.xmax - OL_TOG_USER_BUTS_STATUS),
+ (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_STATUS),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1710,7 +1714,7 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *s
LIB_FAKEUSER,
1,
(id->flag & LIB_FAKEUSER) ? "F" : " ",
- (int)(ar->v2d.cur.xmax - OL_TOG_USER_BUTS_FAKEUSER),
+ (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_FAKEUSER),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1727,14 +1731,14 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOutliner *s
}
if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_userbuts(block, ar, soops, &te->subtree);
+ outliner_draw_userbuts(block, region, soops, &te->subtree);
}
}
}
-static void outliner_draw_rnacols(ARegion *ar, int sizex)
+static void outliner_draw_rnacols(ARegion *region, int sizex)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
float miny = v2d->cur.ymin;
if (miny < v2d->tot.ymin) {
@@ -1761,14 +1765,14 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
}
static void outliner_draw_rnabuts(
- uiBlock *block, ARegion *ar, SpaceOutliner *soops, int sizex, ListBase *lb)
+ uiBlock *block, ARegion *region, SpaceOutliner *soops, int sizex, ListBase *lb)
{
PointerRNA *ptr;
PropertyRNA *prop;
for (TreeElement *te = lb->first; te; te = te->next) {
TreeStoreElem *tselem = TREESTORE(te);
- if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+ if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) {
if (tselem->type == TSE_RNA_PROPERTY) {
ptr = &te->rnaptr;
prop = te->directdata;
@@ -1831,14 +1835,14 @@ static void outliner_draw_rnabuts(
}
if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_rnabuts(block, ar, soops, sizex, &te->subtree);
+ outliner_draw_rnabuts(block, region, soops, sizex, &te->subtree);
}
}
}
static void outliner_buttons(const bContext *C,
uiBlock *block,
- ARegion *ar,
+ ARegion *region,
const float restrict_column_width,
TreeElement *te)
{
@@ -1872,7 +1876,7 @@ static void outliner_buttons(const bContext *C,
(soops->show_restrict_flags & SO_RESTRICT_ENABLE)) {
spx += UI_UNIT_X;
}
- dx = ar->v2d.cur.xmax - (spx + restrict_column_width + 0.2f * UI_UNIT_X);
+ dx = region->v2d.cur.xmax - (spx + restrict_column_width + 0.2f * UI_UNIT_X);
bt = uiDefBut(block,
UI_BTYPE_TEXT,
@@ -1891,7 +1895,7 @@ static void outliner_buttons(const bContext *C,
UI_but_func_rename_set(bt, namebutton_cb, tselem);
/* returns false if button got removed */
- if (false == UI_but_active_only(C, ar, block, bt)) {
+ if (false == UI_but_active_only(C, region, block, bt)) {
tselem->flag &= ~TSE_TEXTBUT;
/* bad! (notifier within draw) without this, we don't get a refresh */
@@ -2941,7 +2945,7 @@ static void outliner_draw_tree_element(bContext *C,
uiBlock *block,
const uiFontStyle *fstyle,
const TreeViewContext *tvc,
- ARegion *ar,
+ ARegion *region,
SpaceOutliner *soops,
TreeElement *te,
bool draw_grayed_out,
@@ -2959,12 +2963,12 @@ static void outliner_draw_tree_element(bContext *C,
float icon_bgcolor[4], icon_border[4];
outliner_icon_background_colors(icon_bgcolor, icon_border);
- if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) {
+ if (*starty + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && *starty <= region->v2d.cur.ymax) {
const float alpha_fac = ((te->flag & TE_DISABLED) || (te->flag & TE_CHILD_NOT_IN_COLLECTION) ||
draw_grayed_out) ?
0.5f :
1.0f;
- int xmax = ar->v2d.cur.xmax;
+ int xmax = region->v2d.cur.xmax;
if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) {
*te_edit = te;
@@ -3190,7 +3194,7 @@ static void outliner_draw_tree_element(bContext *C,
block,
fstyle,
tvc,
- ar,
+ region,
soops,
ten,
draw_childs_grayed_out,
@@ -3330,7 +3334,7 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *soops,
immUnbindProgram();
}
-static void outliner_draw_struct_marks(ARegion *ar,
+static void outliner_draw_struct_marks(ARegion *region,
SpaceOutliner *soops,
ListBase *lb,
int *starty)
@@ -3345,14 +3349,14 @@ static void outliner_draw_struct_marks(ARegion *ar,
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immThemeColorShadeAlpha(TH_BACK, -15, -200);
- immRecti(pos, 0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
+ immRecti(pos, 0, *starty + 1, (int)region->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
immUnbindProgram();
}
}
*starty -= UI_UNIT_Y;
if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
+ outliner_draw_struct_marks(region, soops, &te->subtree, starty);
if (tselem->type == TSE_RNA_STRUCT) {
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -3361,7 +3365,7 @@ static void outliner_draw_struct_marks(ARegion *ar,
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y);
- immVertex2f(pos, ar->v2d.cur.xmax, (float)*starty + UI_UNIT_Y);
+ immVertex2f(pos, region->v2d.cur.xmax, (float)*starty + UI_UNIT_Y);
immEnd();
immUnbindProgram();
@@ -3371,7 +3375,7 @@ static void outliner_draw_struct_marks(ARegion *ar,
}
static void outliner_draw_highlights_recursive(uint pos,
- const ARegion *ar,
+ const ARegion *region,
const SpaceOutliner *soops,
const ListBase *lb,
const float col_selection[4],
@@ -3391,16 +3395,16 @@ static void outliner_draw_highlights_recursive(uint pos,
/* selection status */
if ((tselem->flag & TSE_ACTIVE) && (tselem->flag & TSE_SELECTED)) {
immUniformColor4fv(col_active);
- immRecti(pos, 0, start_y, (int)ar->v2d.cur.xmax, start_y + UI_UNIT_Y);
+ immRecti(pos, 0, start_y, (int)region->v2d.cur.xmax, start_y + UI_UNIT_Y);
}
else if (tselem->flag & TSE_SELECTED) {
immUniformColor4fv(col_selection);
- immRecti(pos, 0, start_y, (int)ar->v2d.cur.xmax, start_y + UI_UNIT_Y);
+ immRecti(pos, 0, start_y, (int)region->v2d.cur.xmax, start_y + UI_UNIT_Y);
}
/* highlights */
if (tselem->flag & (TSE_DRAG_ANY | TSE_HIGHLIGHTED | TSE_SEARCHMATCH)) {
- const int end_x = (int)ar->v2d.cur.xmax;
+ const int end_x = (int)region->v2d.cur.xmax;
if (tselem->flag & TSE_DRAG_ANY) {
/* drag and drop highlight */
@@ -3443,7 +3447,7 @@ static void outliner_draw_highlights_recursive(uint pos,
*io_start_y -= UI_UNIT_Y;
if (TSELEM_OPEN(tselem, soops)) {
outliner_draw_highlights_recursive(pos,
- ar,
+ region,
soops,
&te->subtree,
col_selection,
@@ -3456,7 +3460,10 @@ static void outliner_draw_highlights_recursive(uint pos,
}
}
-static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int startx, int *starty)
+static void outliner_draw_highlights(ARegion *region,
+ SpaceOutliner *soops,
+ int startx,
+ int *starty)
{
const float col_highlight[4] = {1.0f, 1.0f, 1.0f, 0.13f};
float col_selection[4], col_active[4], col_searchmatch[4];
@@ -3473,7 +3480,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int star
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
outliner_draw_highlights_recursive(pos,
- ar,
+ region,
soops,
&soops->tree,
col_selection,
@@ -3489,7 +3496,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOutliner *soops, int star
static void outliner_draw_tree(bContext *C,
uiBlock *block,
const TreeViewContext *tvc,
- ARegion *ar,
+ ARegion *region,
SpaceOutliner *soops,
const float restrict_column_width,
TreeElement **te_edit)
@@ -3502,40 +3509,40 @@ static void outliner_draw_tree(bContext *C,
if (soops->outlinevis == SO_DATA_API) {
/* struct marks */
- starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
- outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
+ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
+ outliner_draw_struct_marks(region, soops, &soops->tree, &starty);
}
/* draw highlights before hierarchy */
- starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
+ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
- outliner_draw_highlights(ar, soops, startx, &starty);
+ outliner_draw_highlights(region, soops, startx, &starty);
/* set scissor so tree elements or lines can't overlap restriction icons */
float scissor[4] = {0};
if (restrict_column_width > 0.0f) {
- int mask_x = BLI_rcti_size_x(&ar->v2d.mask) - (int)restrict_column_width + 1;
+ int mask_x = BLI_rcti_size_x(&region->v2d.mask) - (int)restrict_column_width + 1;
CLAMP_MIN(mask_x, 0);
GPU_scissor_get_f(scissor);
- GPU_scissor(0, 0, mask_x, ar->winy);
+ GPU_scissor(0, 0, mask_x, region->winy);
}
// gray hierarchy lines
- starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
+ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
startx = UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty);
// items themselves
- starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
+ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
for (TreeElement *te = soops->tree.first; te; te = te->next) {
outliner_draw_tree_element(C,
block,
fstyle,
tvc,
- ar,
+ region,
soops,
te,
(te->flag & TE_DRAGGING) != 0,
@@ -3551,11 +3558,11 @@ static void outliner_draw_tree(bContext *C,
}
}
-static void outliner_back(ARegion *ar)
+static void outliner_back(ARegion *region)
{
int ystart;
- ystart = (int)ar->v2d.tot.ymax;
+ ystart = (int)region->v2d.tot.ymax;
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
GPUVertFormat *format = immVertexFormat();
@@ -3567,9 +3574,9 @@ static void outliner_back(ARegion *ar)
UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
immUniformThemeColorBlend(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3]);
- const float x1 = 0.0f, x2 = ar->v2d.cur.xmax;
+ const float x1 = 0.0f, x2 = region->v2d.cur.xmax;
float y1 = ystart, y2;
- int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y);
+ int tot = (int)floor(ystart - region->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y);
if (tot > 0) {
immBegin(GPU_PRIM_TRIS, 6 * tot);
@@ -3604,7 +3611,7 @@ static int outliner_width(SpaceOutliner *soops, int max_tree_width, float restri
}
}
-static void outliner_update_viewable_area(ARegion *ar,
+static void outliner_update_viewable_area(ARegion *region,
SpaceOutliner *soops,
int tree_width,
int tree_height,
@@ -3616,7 +3623,7 @@ static void outliner_update_viewable_area(ARegion *ar,
/* extend size to allow for horizontal scrollbar and extra offset */
sizey += V2D_SCROLL_HEIGHT + OL_Y_OFFSET;
- UI_view2d_totRect_set(&ar->v2d, sizex, sizey);
+ UI_view2d_totRect_set(&region->v2d, sizex, sizey);
}
/* ****************************************************** */
@@ -3625,8 +3632,8 @@ static void outliner_update_viewable_area(ARegion *ar,
void draw_outliner(const bContext *C)
{
Main *mainvar = CTX_data_main(C);
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBlock *block;
TreeElement *te_edit = NULL;
@@ -3634,7 +3641,7 @@ void draw_outliner(const bContext *C)
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);
- outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, soops, ar); // always
+ outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, soops, region); // always
/* If global sync select is dirty, flag other outliners */
if (ED_outliner_select_sync_is_dirty(C)) {
@@ -3654,9 +3661,9 @@ void draw_outliner(const bContext *C)
/* draw outliner stuff (background, hierarchy lines and names) */
const float restrict_column_width = outliner_restrict_columns_width(soops);
- outliner_back(ar);
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
- outliner_draw_tree((bContext *)C, block, &tvc, ar, soops, restrict_column_width, &te_edit);
+ outliner_back(region);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
+ outliner_draw_tree((bContext *)C, block, &tvc, region, soops, restrict_column_width, &te_edit);
/* Compute outliner dimensions after it has been drawn. */
int tree_width, tree_height;
@@ -3668,34 +3675,34 @@ void draw_outliner(const bContext *C)
if (soops->outlinevis == SO_DATA_API) {
int buttons_start_x = outliner_data_api_buttons_start_x(tree_width);
/* draw rna buttons */
- outliner_draw_rnacols(ar, buttons_start_x);
+ outliner_draw_rnacols(region, buttons_start_x);
UI_block_emboss_set(block, UI_EMBOSS);
- outliner_draw_rnabuts(block, ar, soops, buttons_start_x, &soops->tree);
+ outliner_draw_rnabuts(block, region, soops, buttons_start_x, &soops->tree);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
}
else if (soops->outlinevis == SO_ID_ORPHANS) {
/* draw user toggle columns */
- outliner_draw_userbuts(block, ar, soops, &soops->tree);
+ outliner_draw_userbuts(block, region, soops, &soops->tree);
}
else if (restrict_column_width > 0.0f) {
/* draw restriction columns */
RestrictPropertiesActive props_active;
memset(&props_active, 1, sizeof(RestrictPropertiesActive));
outliner_draw_restrictbuts(
- block, tvc.scene, tvc.view_layer, ar, soops, &soops->tree, props_active);
+ block, tvc.scene, tvc.view_layer, region, soops, &soops->tree, props_active);
}
UI_block_emboss_set(block, UI_EMBOSS);
/* Draw edit buttons if necessary. */
if (te_edit) {
- outliner_buttons(C, block, ar, restrict_column_width, te_edit);
+ outliner_buttons(C, block, region, restrict_column_width, te_edit);
}
UI_block_end(C, block);
UI_block_draw(C, block);
/* Update total viewable region. */
- outliner_update_viewable_area(ar, soops, tree_width, tree_height, restrict_column_width);
+ outliner_update_viewable_area(region, soops, tree_width, tree_height, restrict_column_width);
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 4503de3beda..945bfb55b1b 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -99,11 +99,12 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const
return OPERATOR_PASS_THROUGH;
}
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
float view_mval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
TreeElement *hovered_te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
@@ -121,7 +122,7 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const
}
if (changed) {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
return OPERATOR_PASS_THROUGH;
@@ -165,11 +166,12 @@ typedef struct OpenCloseData {
static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
float view_mval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
if (event->type == MOUSEMOVE) {
TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
@@ -182,7 +184,7 @@ static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEv
/* Only toggle openclose on the same level as the first clicked element */
if (te->xs == data->x_location) {
outliner_item_openclose(te, data->open, false);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
@@ -204,13 +206,14 @@ static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEv
static int outliner_item_openclose_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
const bool toggle_all = RNA_boolean_get(op->ptr, "all");
float view_mval[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
@@ -221,7 +224,7 @@ static int outliner_item_openclose_invoke(bContext *C, wmOperator *op, const wmE
(toggle_all && (outliner_flag_is_any_test(&te->subtree, TSE_CLOSED, 1)));
outliner_item_openclose(te, open, toggle_all);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
/* Only toggle once for single click toggling */
if (event->type == LEFTMOUSE) {
@@ -315,7 +318,7 @@ void item_object_mode_exit_cb(bContext *C,
/* Rename --------------------------------------------------- */
-static void do_item_rename(ARegion *ar,
+static void do_item_rename(ARegion *region,
TreeElement *te,
TreeStoreElem *tselem,
ReportList *reports)
@@ -370,7 +373,7 @@ static void do_item_rename(ARegion *ar,
if (add_textbut) {
tselem->flag |= TSE_TEXTBUT;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
@@ -382,12 +385,12 @@ void item_rename_cb(bContext *C,
TreeStoreElem *tselem,
void *UNUSED(user_data))
{
- ARegion *ar = CTX_wm_region(C);
- do_item_rename(ar, te, tselem, reports);
+ ARegion *region = CTX_wm_region(C);
+ do_item_rename(region, te, tselem, reports);
}
static void do_outliner_item_rename(ReportList *reports,
- ARegion *ar,
+ ARegion *region,
TreeElement *te,
const float mval[2])
{
@@ -396,18 +399,18 @@ static void do_outliner_item_rename(ReportList *reports,
/* click on name */
if (mval[0] > te->xs + UI_UNIT_X * 2 && mval[0] < te->xend) {
- do_item_rename(ar, te, tselem, reports);
+ do_item_rename(region, te, tselem, reports);
}
}
for (te = te->subtree.first; te; te = te->next) {
- do_outliner_item_rename(reports, ar, te, mval);
+ do_outliner_item_rename(reports, region, te, mval);
}
}
static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
@@ -417,17 +420,17 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even
TreeElement *active_element = outliner_find_element_with_flag(&soops->tree, TSE_ACTIVE);
if (active_element) {
- do_item_rename(ar, active_element, TREESTORE(active_element), op->reports);
+ do_item_rename(region, active_element, TREESTORE(active_element), op->reports);
}
else {
BKE_report(op->reports, RPT_WARNING, "No active item to rename");
}
}
else {
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
for (te = soops->tree.first; te; te = te->next) {
- do_outliner_item_rename(op->reports, ar, te, fmval);
+ do_outliner_item_rename(op->reports, region, te, fmval);
}
}
@@ -521,14 +524,14 @@ static int outliner_id_delete_invoke_do(bContext *C,
static int outliner_id_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- BLI_assert(ar && soops);
+ BLI_assert(region && soops);
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
for (te = soops->tree.first; te; te = te->next) {
int ret;
@@ -633,11 +636,11 @@ static bool outliner_id_remap_find_tree_element(bContext *C,
static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float fmval[2];
if (!RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "id_type"))) {
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
outliner_id_remap_find_tree_element(C, op, &soops->tree, fmval[1]);
}
@@ -898,14 +901,14 @@ static int outliner_lib_relocate_invoke_do(
static int outliner_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- BLI_assert(ar && soops);
+ BLI_assert(region && soops);
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
for (te = soops->tree.first; te; te = te->next) {
int ret;
@@ -946,14 +949,14 @@ void lib_relocate_cb(bContext *C,
static int outliner_lib_reload_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- BLI_assert(ar && soops);
+ BLI_assert(region && soops);
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
for (te = soops->tree.first; te; te = te->next) {
int ret;
@@ -1111,7 +1114,7 @@ int common_restrict_check(bContext *C, Object *ob)
static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (outliner_flag_is_any_test(&soops->tree, TSE_CLOSED, 1)) {
outliner_flag_set(&soops->tree, TSE_CLOSED, 0);
@@ -1120,7 +1123,7 @@ static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
outliner_flag_set(&soops->tree, TSE_CLOSED, 1);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -1144,7 +1147,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
static int outliner_select_all_exec(bContext *C, wmOperator *op)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
@@ -1169,7 +1172,7 @@ static int outliner_select_all_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
return OPERATOR_FINISHED;
}
@@ -1217,10 +1220,10 @@ static void outliner_set_coordinates_element_recursive(SpaceOutliner *soops,
}
/* to retrieve coordinates with redrawing the entire tree */
-void outliner_set_coordinates(ARegion *ar, SpaceOutliner *soops)
+void outliner_set_coordinates(ARegion *region, SpaceOutliner *soops)
{
TreeElement *te;
- int starty = (int)(ar->v2d.tot.ymax) - UI_UNIT_Y;
+ int starty = (int)(region->v2d.tot.ymax) - UI_UNIT_Y;
for (te = soops->tree.first; te; te = te->next) {
outliner_set_coordinates_element_recursive(soops, te, 0, &starty);
@@ -1279,18 +1282,18 @@ static TreeElement *outliner_show_active_get_element(bContext *C,
return te;
}
-static void outliner_show_active(SpaceOutliner *so, ARegion *ar, TreeElement *te, ID *id)
+static void outliner_show_active(SpaceOutliner *so, ARegion *region, TreeElement *te, ID *id)
{
/* open up tree to active object/bone */
if (TREESTORE(te)->id == id) {
if (outliner_open_back(te)) {
- outliner_set_coordinates(ar, so);
+ outliner_set_coordinates(region, so);
}
return;
}
for (TreeElement *ten = te->subtree.first; ten; ten = ten->next) {
- outliner_show_active(so, ar, ten, id);
+ outliner_show_active(so, region, ten, id);
}
}
@@ -1298,8 +1301,8 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOutliner *so = CTX_wm_space_outliner(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- ARegion *ar = CTX_wm_region(C);
- View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ View2D *v2d = &region->v2d;
TreeElement *active_element = outliner_show_active_get_element(C, so, view_layer);
@@ -1308,25 +1311,25 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
/* Expand all elements in the outliner with matching ID */
for (TreeElement *te = so->tree.first; te; te = te->next) {
- outliner_show_active(so, ar, te, id);
+ outliner_show_active(so, region, te, id);
}
/* Also open back from the active_element (only done for the first found occurrence of ID
* though). */
- outliner_show_active(so, ar, active_element, id);
+ outliner_show_active(so, region, active_element, id);
/* Center view on first element found */
int size_y = BLI_rcti_size_y(&v2d->mask) + 1;
int ytop = (active_element->ys + (size_y / 2));
int delta_y = ytop - v2d->cur.ymax;
- outliner_scroll_view(ar, delta_y);
+ outliner_scroll_view(region, delta_y);
}
else {
return OPERATOR_CANCELLED;
}
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
return OPERATOR_FINISHED;
}
@@ -1348,8 +1351,8 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
- int size_y = BLI_rcti_size_y(&ar->v2d.mask) + 1;
+ ARegion *region = CTX_wm_region(C);
+ int size_y = BLI_rcti_size_y(&region->v2d.mask) + 1;
bool up = RNA_boolean_get(op->ptr, "up");
@@ -1357,9 +1360,9 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
size_y = -size_y;
}
- outliner_scroll_view(ar, size_y);
+ outliner_scroll_view(region, size_y);
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
return OPERATOR_FINISHED;
}
@@ -1422,7 +1425,7 @@ static TreeElement *outliner_find_name(
}
static void outliner_find_panel(
- Scene *UNUSED(scene), ARegion *ar, SpaceOutliner *soops, int again, int flags)
+ Scene *UNUSED(scene), ARegion *region, SpaceOutliner *soops, int again, int flags)
{
ReportList *reports = NULL; // CTX_wm_reports(C);
TreeElement *te = NULL;
@@ -1463,7 +1466,7 @@ static void outliner_find_panel(
if (tselem) {
/* expand branches so that it will be visible, we need to get correct coordinates */
if (outliner_open_back(soops, te)) {
- outliner_set_coordinates(ar, soops);
+ outliner_set_coordinates(region, soops);
}
/* deselect all visible, and select found element */
@@ -1471,17 +1474,17 @@ static void outliner_find_panel(
tselem->flag |= TSE_SELECTED;
/* make te->ys center of view */
- ytop = (int)(te->ys + BLI_rctf_size_y(&ar->v2d.mask) / 2);
+ ytop = (int)(te->ys + BLI_rctf_size_y(&region->v2d.mask) / 2);
if (ytop > 0) {
ytop = 0;
}
- ar->v2d.cur.ymax = (float)ytop;
- ar->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&ar->v2d.mask));
+ region->v2d.cur.ymax = (float)ytop;
+ region->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&region->v2d.mask));
/* make te->xs ==> te->xend center of view */
- xdelta = (int)(te->xs - ar->v2d.cur.xmin);
- ar->v2d.cur.xmin += xdelta;
- ar->v2d.cur.xmax += xdelta;
+ xdelta = (int)(te->xs - region->v2d.cur.xmin);
+ region->v2d.cur.xmin += xdelta;
+ region->v2d.cur.xmax += xdelta;
/* store selection */
soops->search_tse = *tselem;
@@ -1490,7 +1493,7 @@ static void outliner_find_panel(
soops->search_flags = flags;
/* redraw */
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
}
else {
@@ -1529,7 +1532,7 @@ static void outliner_openclose_level(ListBase *lb, int curlevel, int level, int
static int outliner_one_level_exec(bContext *C, wmOperator *op)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const bool add = RNA_boolean_get(op->ptr, "open");
int level;
@@ -1548,7 +1551,7 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
}
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
@@ -1640,13 +1643,13 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *soops, List
static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
/* recursively open/close levels */
tree_element_show_hierarchy(scene, soops, &soops->tree);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index f83f53c5300..4cc8ece0066 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -221,7 +221,7 @@ void outliner_build_tree(struct Main *mainvar,
struct Scene *scene,
struct ViewLayer *view_layer,
struct SpaceOutliner *soops,
- struct ARegion *ar);
+ struct ARegion *region);
typedef struct IDsSelectedData {
struct ListBase selected_array;
@@ -361,7 +361,7 @@ void item_object_mode_exit_cb(struct bContext *C,
struct TreeStoreElem *tselem,
void *user_data);
-void outliner_set_coordinates(struct ARegion *ar, struct SpaceOutliner *soops);
+void outliner_set_coordinates(struct ARegion *region, struct SpaceOutliner *soops);
void outliner_item_openclose(TreeElement *te, bool open, bool toggle_all);
@@ -494,7 +494,7 @@ bool outliner_tree_traverse(const SpaceOutliner *soops,
float outliner_restrict_columns_width(const struct SpaceOutliner *soops);
TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag);
bool outliner_is_element_visible(const TreeElement *te);
-void outliner_scroll_view(struct ARegion *ar, int delta_y);
+void outliner_scroll_view(struct ARegion *region, int delta_y);
/* outliner_sync.c ---------------------------------------------- */
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 715b554b154..dd2179da815 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1318,10 +1318,10 @@ static void do_outliner_range_select(bContext *C,
}
static bool outliner_is_co_within_restrict_columns(const SpaceOutliner *soops,
- const ARegion *ar,
+ const ARegion *region,
float view_co_x)
{
- return (view_co_x > ar->v2d.cur.xmax - outliner_restrict_columns_width(soops));
+ return (view_co_x > region->v2d.cur.xmax - outliner_restrict_columns_width(soops));
}
/**
@@ -1352,15 +1352,15 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
const bool use_range,
const bool deselect_all)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
float view_mval[2];
bool changed = false, rebuild_tree = false;
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
- if (outliner_is_co_within_restrict_columns(soops, ar, view_mval[0])) {
+ if (outliner_is_co_within_restrict_columns(soops, region, view_mval[0])) {
return OPERATOR_CANCELLED;
}
@@ -1408,10 +1408,10 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
if (changed) {
if (rebuild_tree) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
if (soops->flag & SO_SYNC_SELECT) {
@@ -1486,7 +1486,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
rctf rectf;
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
@@ -1496,7 +1496,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
}
WM_operator_properties_border_to_rctf(op, &rectf);
- UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
+ UI_view2d_region_to_view_rctf(&region->v2d, &rectf, &rectf);
for (TreeElement *te = soops->tree.first; te; te = te->next) {
outliner_item_box_select(soops, scene, &rectf, te, select);
@@ -1504,7 +1504,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
@@ -1516,11 +1516,12 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
static int outliner_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float view_mval[2];
const bool tweak = RNA_boolean_get(op->ptr, "tweak");
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
/* Find element clicked on */
TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
@@ -1707,25 +1708,25 @@ static TreeElement *find_walk_select_start_element(SpaceOutliner *soops, bool *c
}
/* Scroll the outliner when the walk element reaches the top or bottom boundary */
-static void outliner_walk_scroll(ARegion *ar, TreeElement *te)
+static void outliner_walk_scroll(ARegion *region, TreeElement *te)
{
/* Account for the header height */
- int y_max = ar->v2d.cur.ymax - UI_UNIT_Y;
- int y_min = ar->v2d.cur.ymin;
+ int y_max = region->v2d.cur.ymax - UI_UNIT_Y;
+ int y_min = region->v2d.cur.ymin;
/* Scroll if walked position is beyond the border */
if (te->ys > y_max) {
- outliner_scroll_view(ar, te->ys - y_max);
+ outliner_scroll_view(region, te->ys - y_max);
}
else if (te->ys < y_min) {
- outliner_scroll_view(ar, -(y_min - te->ys));
+ outliner_scroll_view(region, -(y_min - te->ys));
}
}
static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const short direction = RNA_enum_get(op->ptr, "direction");
const bool extend = RNA_boolean_get(op->ptr, "extend");
@@ -1743,12 +1744,12 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven
}
/* Scroll outliner to focus on walk element */
- outliner_walk_scroll(ar, walk_element);
+ outliner_walk_scroll(region, walk_element);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 2cf106ea07d..63ffe3da27b 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -551,7 +551,7 @@ static void merged_element_search_call_cb(struct bContext *C, void *UNUSED(arg1)
* Merged element search menu
* Created on activation of a merged or aggregated icon-row icon.
*/
-static uiBlock *merged_element_search_menu(bContext *C, ARegion *ar, void *data)
+static uiBlock *merged_element_search_menu(bContext *C, ARegion *region, void *data)
{
static char search[64] = "";
uiBlock *block;
@@ -560,7 +560,7 @@ static uiBlock *merged_element_search_menu(bContext *C, ARegion *ar, void *data)
/* Clear search on each menu creation */
*search = '\0';
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
@@ -2324,7 +2324,7 @@ static int outliner_operator_menu(bContext *C, const char *opname)
}
static int do_outliner_operation_event(
- bContext *C, ARegion *ar, SpaceOutliner *soops, TreeElement *te, const float mval[2])
+ bContext *C, ARegion *region, SpaceOutliner *soops, TreeElement *te, const float mval[2])
{
ReportList *reports = CTX_wm_reports(C); // XXX...
@@ -2343,7 +2343,7 @@ static int do_outliner_operation_event(
/* Only redraw, don't rebuild here because TreeElement pointers will
* become invalid and operations will crash. */
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
@@ -2421,7 +2421,7 @@ static int do_outliner_operation_event(
}
for (te = te->subtree.first; te; te = te->next) {
- int retval = do_outliner_operation_event(C, ar, soops, te, mval);
+ int retval = do_outliner_operation_event(C, region, soops, te, mval);
if (retval) {
return retval;
}
@@ -2432,7 +2432,7 @@ static int do_outliner_operation_event(
static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBut *but = UI_context_active_but_get(C);
TreeElement *te;
@@ -2442,10 +2442,10 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent
UI_but_tooltip_timer_remove(C, but);
}
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
for (te = soops->tree.first; te; te = te->next) {
- int retval = do_outliner_operation_event(C, ar, soops, te, fmval);
+ int retval = do_outliner_operation_event(C, region, soops, te, fmval);
if (retval) {
return retval;
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 4f896424f08..b8cbb6bb0e3 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1842,13 +1842,13 @@ typedef struct OutlinerTreeElementFocus {
* Caller is expected to handle redrawing of ARegion.
*/
static void outliner_restore_scrolling_position(SpaceOutliner *soops,
- ARegion *ar,
+ ARegion *region,
OutlinerTreeElementFocus *focus)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
if (focus->tselem != NULL) {
- outliner_set_coordinates(ar, soops);
+ outliner_set_coordinates(region, soops);
TreeElement *te_new = outliner_find_tree_element(&soops->tree, focus->tselem);
@@ -1970,15 +1970,15 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
* original position as before filtering.
*/
static void outliner_store_scrolling_position(SpaceOutliner *soops,
- ARegion *ar,
+ ARegion *region,
OutlinerTreeElementFocus *focus)
{
TreeElement *te;
- float limit = ar->v2d.cur.ymin;
+ float limit = region->v2d.cur.ymin;
- outliner_set_coordinates(ar, soops);
+ outliner_set_coordinates(region, soops);
- te = outliner_find_first_desired_element_at_y(soops, ar->v2d.cur.ymax, limit);
+ te = outliner_find_first_desired_element_at_y(soops, region->v2d.cur.ymax, limit);
if (te != NULL) {
focus->tselem = TREESTORE(te);
@@ -2264,7 +2264,7 @@ static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer)
/* Main entry point for building the tree data-structure that the outliner represents */
// TODO: split each mode into its own function?
void outliner_build_tree(
- Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *ar)
+ Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *region)
{
TreeElement *te = NULL, *ten;
TreeStoreElem *tselem;
@@ -2286,12 +2286,12 @@ void outliner_build_tree(
BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
}
- if (ar->do_draw & RGN_DRAW_NO_REBUILD) {
+ if (region->do_draw & RGN_DRAW_NO_REBUILD) {
return;
}
OutlinerTreeElementFocus focus;
- outliner_store_scrolling_position(soops, ar, &focus);
+ outliner_store_scrolling_position(soops, region, &focus);
outliner_free_tree(&soops->tree);
outliner_storage_cleanup(soops);
@@ -2445,7 +2445,7 @@ void outliner_build_tree(
}
outliner_filter_tree(soops, view_layer);
- outliner_restore_scrolling_position(soops, ar, &focus);
+ outliner_restore_scrolling_position(soops, region, &focus);
BKE_main_id_clear_newpoins(mainvar);
}
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index c3984ab16fa..a12defac813 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -409,38 +409,38 @@ bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_c
}
/* Scroll view vertically while keeping within total bounds */
-void outliner_scroll_view(ARegion *ar, int delta_y)
+void outliner_scroll_view(ARegion *region, int delta_y)
{
- int y_min = MIN2(ar->v2d.cur.ymin, ar->v2d.tot.ymin);
+ int y_min = MIN2(region->v2d.cur.ymin, region->v2d.tot.ymin);
- ar->v2d.cur.ymax += delta_y;
- ar->v2d.cur.ymin += delta_y;
+ region->v2d.cur.ymax += delta_y;
+ region->v2d.cur.ymin += delta_y;
/* Adjust view if delta placed view outside total area */
int offset;
- if (ar->v2d.cur.ymax > -UI_UNIT_Y) {
- offset = ar->v2d.cur.ymax;
- ar->v2d.cur.ymax -= offset;
- ar->v2d.cur.ymin -= offset;
+ if (region->v2d.cur.ymax > -UI_UNIT_Y) {
+ offset = region->v2d.cur.ymax;
+ region->v2d.cur.ymax -= offset;
+ region->v2d.cur.ymin -= offset;
}
- else if (ar->v2d.cur.ymin < y_min) {
- offset = y_min - ar->v2d.cur.ymin;
- ar->v2d.cur.ymax += offset;
- ar->v2d.cur.ymin += offset;
+ else if (region->v2d.cur.ymin < y_min) {
+ offset = y_min - region->v2d.cur.ymin;
+ region->v2d.cur.ymax += offset;
+ region->v2d.cur.ymin += offset;
}
}
/* Get base of object under cursor. Used for eyedropper tool */
Base *ED_outliner_give_base_under_cursor(bContext *C, const int mval[2])
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
TreeElement *te;
Base *base = NULL;
float view_mval[2];
- UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
if (te) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 68eea4f278b..ff9b3c8a05b 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -54,36 +54,36 @@
#include "outliner_intern.h"
#include "GPU_framebuffer.h"
-static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void outliner_main_region_init(wmWindowManager *wm, ARegion *region)
{
ListBase *lb;
wmKeyMap *keymap;
/* make sure we keep the hide flags */
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP); /* prevent any noise of past */
- ar->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
- ar->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ region->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP); /* prevent any noise of past */
+ region->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
+ region->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE;
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
- ar->v2d.minzoom = ar->v2d.maxzoom = 1.0f;
+ region->v2d.align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+ region->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+ region->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ region->v2d.minzoom = region->v2d.maxzoom = 1.0f;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* Add dropboxes */
lb = WM_dropboxmap_find("Outliner", SPACE_OUTLINER, RGN_TYPE_WINDOW);
- WM_event_add_dropbox_handler(&ar->handlers, lb);
+ WM_event_add_dropbox_handler(&region->handlers, lb);
}
-static void outliner_main_region_draw(const bContext *C, ARegion *ar)
+static void outliner_main_region_draw(const bContext *C, ARegion *region)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
/* clear */
@@ -101,13 +101,13 @@ static void outliner_main_region_draw(const bContext *C, ARegion *ar)
UI_view2d_scrollers_free(scrollers);
}
-static void outliner_main_region_free(ARegion *UNUSED(ar))
+static void outliner_main_region_free(ARegion *UNUSED(region))
{
}
static void outliner_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -128,11 +128,11 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
case ND_LAYER_CONTENT:
case ND_WORLD:
case ND_SCENEBROWSE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
if (wmn->action & NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_OBJECT:
@@ -145,46 +145,46 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
case ND_DRAW:
case ND_PARENT:
case ND_OB_SHADING:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_CONSTRAINT:
/* all constraint actions now, for reordering */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_MODIFIER:
/* all modifier actions now */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
default:
/* Trigger update for NC_OBJECT itself */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_GROUP:
/* all actions now, todo: check outliner view mode? */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_LAMP:
/* For updating light icons, when changing light type */
if (wmn->data == ND_LIGHTING_DRAW) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_OUTLINER) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_MATERIAL:
switch (wmn->data) {
case ND_SHADING_LINKS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -192,7 +192,7 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
switch (wmn->data) {
case ND_VERTEX_GROUP:
case ND_DATA:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -200,38 +200,38 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win),
switch (wmn->data) {
case ND_NLA_ACTCHANGE:
case ND_KEYFRAME:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_ANIMCHAN:
if (wmn->action == NA_SELECTED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
break;
case NC_GPENCIL:
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_MASK:
if (ELEM(wmn->action, NA_ADDED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_PAINTCURVE:
if (ELEM(wmn->action, NA_ADDED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_TEXT:
if (ELEM(wmn->action, NA_ADDED, NA_REMOVED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -242,13 +242,13 @@ static void outliner_main_region_message_subscribe(const struct bContext *UNUSED
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
SpaceOutliner *soops = sa->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -260,23 +260,23 @@ static void outliner_main_region_message_subscribe(const struct bContext *UNUSED
/* ************************ header outliner area region *********************** */
/* add handlers, stuff you only do once or on area/region changes */
-static void outliner_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void outliner_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void outliner_header_region_draw(const bContext *C, ARegion *ar)
+static void outliner_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
-static void outliner_header_region_free(ARegion *UNUSED(ar))
+static void outliner_header_region_free(ARegion *UNUSED(region))
{
}
static void outliner_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -284,12 +284,12 @@ static void outliner_header_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_SCENE:
if (wmn->data == ND_KEYINGSET) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_OUTLINER) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -299,7 +299,7 @@ static void outliner_header_region_listener(wmWindow *UNUSED(win),
static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceOutliner *soutliner;
soutliner = MEM_callocN(sizeof(SpaceOutliner), "initoutliner");
@@ -311,17 +311,17 @@ static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED(
soutliner->flag |= SO_SYNC_SELECT;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for outliner");
+ region = MEM_callocN(sizeof(ARegion), "header for outliner");
- BLI_addtail(&soutliner->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&soutliner->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for outliner");
+ region = MEM_callocN(sizeof(ARegion), "main region for outliner");
- BLI_addtail(&soutliner->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&soutliner->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)soutliner;
}
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 2be05785d2b..b9e97a19b82 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -51,8 +51,8 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_PYTHON
if (BPY_execute_filepath(C, path, op->reports)) {
- ARegion *ar = CTX_wm_region(C);
- ED_region_tag_redraw(ar);
+ ARegion *region = CTX_wm_region(C);
+ ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
}
#else
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index b99c2eaf54e..4ee3a87e4fa 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -53,24 +53,24 @@
static SpaceLink *script_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceScript *sscript;
sscript = MEM_callocN(sizeof(SpaceScript), "initscript");
sscript->spacetype = SPACE_SCRIPT;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for script");
+ region = MEM_callocN(sizeof(ARegion), "header for script");
- BLI_addtail(&sscript->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sscript->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for script");
+ region = MEM_callocN(sizeof(ARegion), "main region for script");
- BLI_addtail(&sscript->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sscript->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
/* channel list region XXX */
@@ -108,22 +108,22 @@ static SpaceLink *script_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void script_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void script_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void script_main_region_draw(const bContext *C, ARegion *ar)
+static void script_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceScript *sscript = (SpaceScript *)CTX_wm_space_data(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -149,19 +149,19 @@ static void script_main_region_draw(const bContext *C, ARegion *ar)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void script_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void script_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void script_header_region_draw(const bContext *C, ARegion *ar)
+static void script_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void script_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index a4558f31cc8..ef192f6c9db 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -690,11 +690,14 @@ static void draw_seq_text(View2D *v2d,
UI_view2d_text_cache_add_rectf(v2d, &rect, str, str_len, col);
}
-static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, unsigned int pos)
+static void draw_sequence_extensions(Scene *scene,
+ ARegion *region,
+ Sequence *seq,
+ unsigned int pos)
{
float x1, x2, y1, y2, pixely;
unsigned char col[4], blendcol[3];
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
x1 = seq->startdisp;
x2 = seq->enddisp;
@@ -800,12 +803,12 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
static void draw_seq_strip(const bContext *C,
SpaceSeq *sseq,
Scene *scene,
- ARegion *ar,
+ ARegion *region,
Sequence *seq,
int outline_tint,
float pixelx)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
float x1, x2, y1, y2;
unsigned char col[4], background_col[4], is_single_image;
const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
@@ -862,7 +865,7 @@ static void draw_seq_strip(const bContext *C,
if (!is_single_image) {
if ((sseq->draw_flag & SEQ_DRAW_OFFSET_EXT) || (seq == special_seq_update)) {
- draw_sequence_extensions(scene, ar, seq, pos);
+ draw_sequence_extensions(scene, region, seq, pos);
}
}
@@ -877,8 +880,16 @@ static void draw_seq_strip(const bContext *C,
/* draw sound wave */
if (seq->type == SEQ_TYPE_SOUND_RAM) {
if (!(sseq->flag & SEQ_NO_WAVEFORMS)) {
- drawseqwave(
- v2d, C, sseq, scene, seq, x1, y1, x2, y2, BLI_rctf_size_x(&ar->v2d.cur) / ar->winx);
+ drawseqwave(v2d,
+ C,
+ sseq,
+ scene,
+ seq,
+ x1,
+ y1,
+ x2,
+ y2,
+ BLI_rctf_size_x(&region->v2d.cur) / region->winx);
}
}
@@ -1002,10 +1013,10 @@ Sequence *ED_sequencer_special_preview_get(void)
void ED_sequencer_special_preview_set(bContext *C, const int mval[2])
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
int hand;
Sequence *seq;
- seq = find_nearest_seq(scene, &ar->v2d, &hand, mval);
+ seq = find_nearest_seq(scene, &region->v2d, &hand, mval);
sequencer_special_update_set(seq);
}
@@ -1185,7 +1196,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
}
#if 0
-void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq)
+void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq)
{
/* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not,
* for now just disable drawing since the strip frame will likely be offset */
@@ -1204,7 +1215,7 @@ void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *ar, Space
height = (scene->r.size * scene->r.ysch) / 100;
ED_mask_draw_region(mask,
- ar,
+ region,
0,
0,
0, /* TODO */
@@ -1326,12 +1337,12 @@ static void sequencer_preview_clear(void)
static void sequencer_preview_get_rect(rctf *preview,
Scene *scene,
- ARegion *ar,
+ ARegion *region,
SpaceSeq *sseq,
bool draw_overlay,
bool draw_backdrop)
{
- struct View2D *v2d = &ar->v2d;
+ struct View2D *v2d = &region->v2d;
float viewrect[2];
sequencer_display_size(scene, viewrect);
@@ -1348,7 +1359,7 @@ static void sequencer_preview_get_rect(rctf *preview,
(fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin);
}
else if (draw_backdrop) {
- float aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
+ float aspect = BLI_rcti_size_x(&region->winrct) / (float)BLI_rcti_size_y(&region->winrct);
float image_aspect = viewrect[0] / viewrect[1];
if (aspect >= image_aspect) {
@@ -1367,7 +1378,7 @@ static void sequencer_preview_get_rect(rctf *preview,
static void sequencer_draw_display_buffer(const bContext *C,
Scene *scene,
- ARegion *ar,
+ ARegion *region,
SpaceSeq *sseq,
ImBuf *ibuf,
ImBuf *scope,
@@ -1438,7 +1449,7 @@ static void sequencer_draw_display_buffer(const bContext *C,
rctf preview;
rctf canvas;
- sequencer_preview_get_rect(&preview, scene, ar, sseq, draw_overlay, draw_backdrop);
+ sequencer_preview_get_rect(&preview, scene, region, sseq, draw_overlay, draw_backdrop);
if (draw_overlay && sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
canvas = scene->ed->over_border;
@@ -1543,7 +1554,7 @@ static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, boo
void sequencer_draw_preview(const bContext *C,
Scene *scene,
- ARegion *ar,
+ ARegion *region,
SpaceSeq *sseq,
int cfra,
int frame_ofs,
@@ -1552,7 +1563,7 @@ void sequencer_draw_preview(const bContext *C,
{
struct Main *bmain = CTX_data_main(C);
struct Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
- struct View2D *v2d = &ar->v2d;
+ struct View2D *v2d = &region->v2d;
struct ImBuf *ibuf = NULL;
struct ImBuf *scope = NULL;
float viewrect[2];
@@ -1592,7 +1603,8 @@ void sequencer_draw_preview(const bContext *C,
scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop);
/* Draw image */
- sequencer_draw_display_buffer(C, scene, ar, sseq, ibuf, scope, draw_overlay, draw_backdrop);
+ sequencer_draw_display_buffer(
+ C, scene, region, sseq, ibuf, scope, draw_overlay, draw_backdrop);
/* Draw over image */
if (sseq->flag & SEQ_SHOW_METADATA) {
@@ -1609,7 +1621,7 @@ void sequencer_draw_preview(const bContext *C,
}
/* TODO */
- /* sequencer_draw_maskedit(C, scene, ar, sseq); */
+ /* sequencer_draw_maskedit(C, scene, region, sseq); */
/* Scope is freed in sequencer_check_scopes when ibuf changes and
* scope image is to be replaced. */
@@ -1664,10 +1676,10 @@ static void draw_seq_backdrop(View2D *v2d)
}
/* draw the contents of the sequencer strips view */
-static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
+static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
SpaceSeq *sseq = CTX_wm_space_seq(C);
Sequence *last_seq = BKE_sequencer_active_get(scene);
int sel = 0, j;
@@ -1702,7 +1714,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
}
/* strip passed all tests unscathed... so draw it now */
- draw_seq_strip(C, sseq, scene, ar, seq, outline_tint, pixelx);
+ draw_seq_strip(C, sseq, scene, region, seq, outline_tint, pixelx);
}
/* draw selected next time round */
@@ -1712,7 +1724,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
/* draw the last selected last (i.e. 'active' in other parts of Blender),
* removes some overlapping error */
if (last_seq) {
- draw_seq_strip(C, sseq, scene, ar, last_seq, 120, pixelx);
+ draw_seq_strip(C, sseq, scene, region, last_seq, 120, pixelx);
}
/* draw highlight when previewing a single strip */
@@ -1892,8 +1904,8 @@ static void draw_cache_view_batch(
static void draw_cache_view(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
- struct View2D *v2d = &ar->v2d;
+ ARegion *region = CTX_wm_region(C);
+ struct View2D *v2d = &region->v2d;
if ((scene->ed->cache_flag & SEQ_CACHE_VIEW_ENABLE) == 0) {
return;
@@ -2000,12 +2012,12 @@ static void draw_cache_view(const bContext *C)
}
/* Draw Timeline/Strip Editor Mode for Sequencer */
-void draw_timeline_seq(const bContext *C, ARegion *ar)
+void draw_timeline_seq(const bContext *C, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
SpaceSeq *sseq = CTX_wm_space_seq(C);
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
View2DScrollers *scrollers;
short cfra_flag = 0;
float col[3];
@@ -2037,20 +2049,20 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* Only draw backdrop in pure sequence view. */
if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) {
- sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
+ sequencer_draw_preview(C, scene, region, sseq, scene->r.cfra, 0, false, true);
UI_view2d_view_ortho(v2d);
}
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW);
seq_draw_sfra_efra(scene, v2d);
/* sequence strips (if there is data available to be drawn) */
if (ed) {
/* draw the data */
- draw_seq_strips(C, ed, ar);
+ draw_seq_strips(C, ed, region);
/* text draw cached (for sequence names), in pixelspace now */
- UI_view2d_text_cache_draw(ar);
+ UI_view2d_text_cache_draw(region);
}
/* current frame */
@@ -2061,7 +2073,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
ANIM_draw_cfra(C, v2d, cfra_flag);
/* markers */
- UI_view2d_view_orthoSpecial(ar, v2d, 1);
+ UI_view2d_view_orthoSpecial(region, v2d, 1);
int marker_draw_flag = DRAW_MARKERS_MARGIN;
if (sseq->flag & SEQ_SHOW_MARKERS) {
ED_markers_draw(C, marker_draw_flag);
@@ -2099,13 +2111,13 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
}
/* callback */
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW);
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrubbing region */
- ED_time_scrub_draw(ar, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
+ ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true);
/* scrollers */
scrollers = UI_view2d_scrollers_calc(v2d, NULL);
@@ -2115,7 +2127,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* channel numbers */
{
rcti rect;
- BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, ar->winy - UI_TIME_SCRUB_MARGIN_Y);
- UI_view2d_draw_scale_y__block(ar, v2d, &rect, TH_SCROLL_TEXT);
+ BLI_rcti_init(
+ &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y);
+ UI_view2d_draw_scale_y__block(region, v2d, &rect, TH_SCROLL_TEXT);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 905692de8a6..ca2a5eaa54f 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2478,9 +2478,9 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
/* bounding box of 30 pixels is used for markers shortcuts,
* prevent conflict with markers shortcuts here
*/
@@ -2899,13 +2899,13 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
/* view_all operator */
static int sequencer_view_all_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
rctf box;
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
boundbox_seq(CTX_data_scene(C), &box);
- UI_view2d_smooth_view(C, ar, &box, smooth_viewtx);
+ UI_view2d_smooth_view(C, region, &box, smooth_viewtx);
return OPERATOR_FINISHED;
}
@@ -2953,7 +2953,7 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
bScreen *sc = CTX_wm_screen(C);
ScrArea *area = CTX_wm_area(C);
#if 0
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceSeq *sseq = area->spacedata.first;
Scene *scene = CTX_data_scene(C);
#endif
@@ -2968,8 +2968,8 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
float zoomX, zoomY;
int width, height, imgwidth, imgheight;
- width = ar->winx;
- height = ar->winy;
+ width = region->winx;
+ height = region->winy;
seq_reset_imageofs(sseq);
@@ -3102,7 +3102,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
View2D *v2d = UI_view2d_fromcontext(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *last_seq = BKE_sequencer_active_get(scene);
Sequence *seq;
@@ -3155,7 +3155,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op)
cur_new.ymax = ymid + (orig_height / 2);
}
- UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
+ UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index ebdaf068f0a..2cbd4d35e27 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -42,10 +42,10 @@ struct rctf;
struct wmOperator;
/* sequencer_draw.c */
-void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
+void draw_timeline_seq(const struct bContext *C, struct ARegion *region);
void sequencer_draw_preview(const struct bContext *C,
struct Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
struct SpaceSeq *sseq,
int cfra,
int offset,
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 534d02c7bf3..f30a604ca93 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -68,14 +68,14 @@ typedef struct ImageSampleInfo {
int color_manage;
} ImageSampleInfo;
-static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
+static void sample_draw(const bContext *C, ARegion *region, void *arg_info)
{
Scene *scene = CTX_data_scene(C);
ImageSampleInfo *info = arg_info;
if (info->draw) {
ED_image_draw_info(scene,
- ar,
+ region,
info->color_manage,
false,
info->channels,
@@ -95,7 +95,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ImBuf *ibuf = sequencer_ibuf_get(bmain, depsgraph, scene, sseq, CFRA, 0, NULL);
ImageSampleInfo *info = op->customdata;
float fx, fy;
@@ -106,7 +106,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
return;
}
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fx, &fy);
fx /= scene->r.xasp / scene->r.yasp;
@@ -184,7 +184,7 @@ static void sample_exit(bContext *C, wmOperator *op)
static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceSeq *sseq = CTX_wm_space_seq(C);
ImageSampleInfo *info;
@@ -193,9 +193,9 @@ static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
- info->art = ar->type;
+ info->art = region->type;
info->draw_handle = ED_region_draw_cb_activate(
- ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
+ region->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
op->customdata = info;
sample_apply(C, op, event);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index d225c70b56b..8a934a28690 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -72,22 +72,22 @@ static void sequencer_scopes_tag_refresh(ScrArea *sa)
static ARegion *sequencer_find_region(ScrArea *sa, short type)
{
- ARegion *ar = NULL;
+ ARegion *region = NULL;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == type) {
- return ar;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == type) {
+ return region;
}
}
- return ar;
+ return region;
}
/* ******************** default callbacks for sequencer space ***************** */
static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene)
{
- ARegion *ar;
+ ARegion *region;
SpaceSeq *sseq;
sseq = MEM_callocN(sizeof(SpaceSeq), "initsequencer");
@@ -98,88 +98,88 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene)
sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS;
/* tool header */
- ar = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
+ region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
- BLI_addtail(&sseq->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOL_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
- ar->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
+ BLI_addtail(&sseq->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOL_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
+ region = MEM_callocN(sizeof(ARegion), "header for sequencer");
- BLI_addtail(&sseq->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&sseq->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* buttons/list view */
- ar = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
+ region = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
- BLI_addtail(&sseq->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&sseq->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* toolbar */
- ar = MEM_callocN(sizeof(ARegion), "tools for sequencer");
+ region = MEM_callocN(sizeof(ARegion), "tools for sequencer");
- BLI_addtail(&sseq->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&sseq->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->flag = RGN_FLAG_HIDDEN;
/* preview region */
/* NOTE: if you change values here, also change them in sequencer_init_preview_region */
- ar = MEM_callocN(sizeof(ARegion), "preview region for sequencer");
- BLI_addtail(&sseq->regionbase, ar);
- ar->regiontype = RGN_TYPE_PREVIEW;
- ar->alignment = RGN_ALIGN_TOP;
- ar->flag |= RGN_FLAG_HIDDEN;
+ region = MEM_callocN(sizeof(ARegion), "preview region for sequencer");
+ BLI_addtail(&sseq->regionbase, region);
+ region->regiontype = RGN_TYPE_PREVIEW;
+ region->alignment = RGN_ALIGN_TOP;
+ region->flag |= RGN_FLAG_HIDDEN;
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
- ar->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM | V2D_LIMITZOOM;
- ar->v2d.minzoom = 0.001f;
- ar->v2d.maxzoom = 1000.0f;
- ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
- ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
- ar->v2d.tot.xmax = 960.0f;
- ar->v2d.tot.ymax = 540.0f;
- ar->v2d.min[0] = 0.0f;
- ar->v2d.min[1] = 0.0f;
- ar->v2d.max[0] = 12000.0f;
- ar->v2d.max[1] = 12000.0f;
- ar->v2d.cur = ar->v2d.tot;
- ar->v2d.align = V2D_ALIGN_FREE;
- ar->v2d.keeptot = V2D_KEEPTOT_FREE;
+ region->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM | V2D_LIMITZOOM;
+ region->v2d.minzoom = 0.001f;
+ region->v2d.maxzoom = 1000.0f;
+ region->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+ region->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+ region->v2d.tot.xmax = 960.0f;
+ region->v2d.tot.ymax = 540.0f;
+ region->v2d.min[0] = 0.0f;
+ region->v2d.min[1] = 0.0f;
+ region->v2d.max[0] = 12000.0f;
+ region->v2d.max[1] = 12000.0f;
+ region->v2d.cur = region->v2d.tot;
+ region->v2d.align = V2D_ALIGN_FREE;
+ region->v2d.keeptot = V2D_KEEPTOT_FREE;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for sequencer");
+ region = MEM_callocN(sizeof(ARegion), "main region for sequencer");
- BLI_addtail(&sseq->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&sseq->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
/* seq space goes from (0,8) to (0, efra) */
- ar->v2d.tot.xmin = 0.0f;
- ar->v2d.tot.ymin = 0.0f;
- ar->v2d.tot.xmax = scene->r.efra;
- ar->v2d.tot.ymax = 8.0f;
+ region->v2d.tot.xmin = 0.0f;
+ region->v2d.tot.ymin = 0.0f;
+ region->v2d.tot.xmax = scene->r.efra;
+ region->v2d.tot.ymax = 8.0f;
- ar->v2d.cur = ar->v2d.tot;
+ region->v2d.cur = region->v2d.tot;
- ar->v2d.min[0] = 10.0f;
- ar->v2d.min[1] = 0.5f;
+ region->v2d.min[0] = 10.0f;
+ region->v2d.min[1] = 0.5f;
- ar->v2d.max[0] = MAXFRAMEF;
- ar->v2d.max[1] = MAXSEQ;
+ region->v2d.max[0] = MAXFRAMEF;
+ region->v2d.max[1] = MAXSEQ;
- ar->v2d.minzoom = 0.01f;
- ar->v2d.maxzoom = 100.0f;
+ region->v2d.minzoom = 0.01f;
+ region->v2d.maxzoom = 100.0f;
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES);
- ar->v2d.keepzoom = 0;
- ar->v2d.keeptot = 0;
- ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
+ region->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES);
+ region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES);
+ region->v2d.keepzoom = 0;
+ region->v2d.keeptot = 0;
+ region->v2d.align = V2D_ALIGN_NO_NEG_Y;
return (SpaceLink *)sseq;
}
@@ -365,13 +365,13 @@ static bool image_drop_poll(bContext *C,
const wmEvent *event,
const char **UNUSED(tooltip))
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int hand;
if (drag->type == WM_DRAG_PATH) {
if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) { /* rule might not work? */
- if (find_nearest_seq(scene, &ar->v2d, &hand, event->mval) == NULL) {
+ if (find_nearest_seq(scene, &region->v2d, &hand, event->mval) == NULL) {
return 1;
}
}
@@ -385,13 +385,13 @@ static bool movie_drop_poll(bContext *C,
const wmEvent *event,
const char **UNUSED(tooltip))
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int hand;
if (drag->type == WM_DRAG_PATH) {
if (ELEM(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) { /* rule might not work? */
- if (find_nearest_seq(scene, &ar->v2d, &hand, event->mval) == NULL) {
+ if (find_nearest_seq(scene, &region->v2d, &hand, event->mval) == NULL) {
return 1;
}
}
@@ -404,13 +404,13 @@ static bool sound_drop_poll(bContext *C,
const wmEvent *event,
const char **UNUSED(tooltip))
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int hand;
if (drag->type == WM_DRAG_PATH) {
if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) { /* rule might not work? */
- if (find_nearest_seq(scene, &ar->v2d, &hand, event->mval) == NULL) {
+ if (find_nearest_seq(scene, &region->v2d, &hand, event->mval) == NULL) {
return 1;
}
}
@@ -490,40 +490,40 @@ static void sequencer_gizmos(void)
/* *********************** sequencer (main) region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
-static void sequencer_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void sequencer_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
ListBase *lb;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
#if 0
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
#endif
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* add drop boxes */
lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
- WM_event_add_dropbox_handler(&ar->handlers, lb);
+ WM_event_add_dropbox_handler(&region->handlers, lb);
}
-static void sequencer_main_region_draw(const bContext *C, ARegion *ar)
+static void sequencer_main_region_draw(const bContext *C, ARegion *region)
{
/* NLE - strip editing timeline interface */
- draw_timeline_seq(C, ar);
+ draw_timeline_seq(C, region);
}
static void sequencer_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -537,30 +537,30 @@ static void sequencer_main_region_listener(wmWindow *UNUSED(win),
case ND_RENDER_OPTIONS: /* for FPS and FPS Base */
case ND_SEQUENCER:
case ND_RENDER_RESULT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_ANIMATION:
switch (wmn->data) {
case ND_KEYFRAME:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_SEQUENCER) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
if (ELEM(wmn->data, ND_ANIMPLAY)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -571,12 +571,12 @@ static void sequencer_main_region_message_subscribe(const struct bContext *UNUSE
struct Scene *scene,
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(sa),
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -626,54 +626,54 @@ static void sequencer_main_region_message_subscribe(const struct bContext *UNUSE
/* *********************** header region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
-static void sequencer_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void sequencer_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void sequencer_header_region_draw(const bContext *C, ARegion *ar)
+static void sequencer_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/* *********************** toolbar region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
-static void sequencer_tools_region_init(wmWindowManager *wm, ARegion *ar)
+static void sequencer_tools_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void sequencer_tools_region_draw(const bContext *C, ARegion *ar)
+static void sequencer_tools_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
/* *********************** preview region ************************ */
-static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *ar)
+static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy);
#if 0
keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
#endif
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
+static void sequencer_preview_region_draw(const bContext *C, ARegion *region)
{
ScrArea *sa = CTX_wm_area(C);
SpaceSeq *sseq = sa->spacedata.first;
@@ -688,7 +688,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
}
if (!show_split || sseq->overlay_type != SEQ_DRAW_OVERLAY_REFERENCE) {
- sequencer_draw_preview(C, scene, ar, sseq, scene->r.cfra, 0, false, false);
+ sequencer_draw_preview(C, scene, region, sseq, scene->r.cfra, 0, false, false);
}
if (show_split && sseq->overlay_type != SEQ_DRAW_OVERLAY_CURRENT) {
@@ -703,14 +703,14 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
if (over_cfra != scene->r.cfra || sseq->overlay_type != SEQ_DRAW_OVERLAY_RECT) {
sequencer_draw_preview(
- C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
+ C, scene, region, sseq, scene->r.cfra, over_cfra - scene->r.cfra, true, false);
}
}
- WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
+ WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
- const rcti *rect = ED_region_visible_rect(ar);
+ const rcti *rect = ED_region_visible_rect(region);
int xoffset = rect->xmin + U.widget_unit;
int yoffset = rect->ymax;
ED_scene_draw_fps(scene, xoffset, &yoffset);
@@ -719,7 +719,7 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
static void sequencer_preview_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -727,7 +727,7 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_GPENCIL:
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
@@ -737,32 +737,32 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win),
case ND_SEQUENCER:
case ND_RENDER_OPTIONS:
case ND_DRAW_RENDER_VIEWPORT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_ANIMATION:
switch (wmn->data) {
case ND_KEYFRAME:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_SEQUENCER) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
switch (wmn->data) {
case NA_RENAME:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_MASK:
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -771,25 +771,25 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win),
/* *********************** buttons region ************************ */
/* add handlers, stuff you only do once or on area/region changes */
-static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *ar)
+static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
- UI_panel_category_active_set_default(ar, "Strip");
- ED_region_panels_init(wm, ar);
+ UI_panel_category_active_set_default(region, "Strip");
+ ED_region_panels_init(wm, region);
}
-static void sequencer_buttons_region_draw(const bContext *C, ARegion *ar)
+static void sequencer_buttons_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
static void sequencer_buttons_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -797,25 +797,25 @@ static void sequencer_buttons_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_GPENCIL:
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
switch (wmn->data) {
case ND_FRAME:
case ND_SEQUENCER:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_SEQUENCER) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 69060daa171..a37ad59fc14 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -44,17 +44,17 @@
static SpaceLink *statusbar_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceStatusBar *sstatusbar;
sstatusbar = MEM_callocN(sizeof(*sstatusbar), "init statusbar");
sstatusbar->spacetype = SPACE_STATUSBAR;
/* header region */
- ar = MEM_callocN(sizeof(*ar), "header for statusbar");
- BLI_addtail(&sstatusbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_NONE;
+ region = MEM_callocN(sizeof(*region), "header for statusbar");
+ BLI_addtail(&sstatusbar->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = RGN_ALIGN_NONE;
return (SpaceLink *)sstatusbar;
}
@@ -97,7 +97,7 @@ static void statusbar_keymap(struct wmKeyConfig *UNUSED(keyconf))
static void statusbar_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -105,27 +105,27 @@ static void statusbar_header_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_SCREEN:
if (ELEM(wmn->data, ND_LAYER, ND_ANIMPLAY)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_WM:
if (wmn->data == ND_JOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_RENDER_RESULT) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_INFO) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -136,12 +136,12 @@ static void statusbar_header_region_message_subscribe(const bContext *UNUSED(C),
Scene *UNUSED(scene),
bScreen *UNUSED(screen),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 09a2b83d909..437b118a69c 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -55,7 +55,7 @@
static SpaceLink *text_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceText *stext;
stext = MEM_callocN(sizeof(SpaceText), "inittext");
@@ -68,31 +68,31 @@ static SpaceLink *text_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen
stext->showlinenrs = true;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for text");
+ region = MEM_callocN(sizeof(ARegion), "header for text");
- BLI_addtail(&stext->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&stext->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* footer */
- ar = MEM_callocN(sizeof(ARegion), "footer for text");
- BLI_addtail(&stext->regionbase, ar);
- ar->regiontype = RGN_TYPE_FOOTER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
+ region = MEM_callocN(sizeof(ARegion), "footer for text");
+ BLI_addtail(&stext->regionbase, region);
+ region->regiontype = RGN_TYPE_FOOTER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_TOP : RGN_ALIGN_BOTTOM;
/* properties region */
- ar = MEM_callocN(sizeof(ARegion), "properties region for text");
+ region = MEM_callocN(sizeof(ARegion), "properties region for text");
- BLI_addtail(&stext->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&stext->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for text");
+ region = MEM_callocN(sizeof(ARegion), "main region for text");
- BLI_addtail(&stext->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&stext->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)stext;
}
@@ -269,30 +269,30 @@ static int text_context(const bContext *C, const char *member, bContextDataResul
/********************* main region ********************/
/* add handlers, stuff you only do once or on area/region changes */
-static void text_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void text_main_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
ListBase *lb;
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
+ UI_view2d_region_reinit(&region->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy);
/* own keymap */
keymap = WM_keymap_ensure(wm->defaultconf, "Text Generic", SPACE_TEXT, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Text", SPACE_TEXT, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
/* add drop boxes */
lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW);
- WM_event_add_dropbox_handler(&ar->handlers, lb);
+ WM_event_add_dropbox_handler(&region->handlers, lb);
}
-static void text_main_region_draw(const bContext *C, ARegion *ar)
+static void text_main_region_draw(const bContext *C, ARegion *region)
{
/* draw entirely, view changes should be handled here */
SpaceText *st = CTX_wm_space_text(C);
- // View2D *v2d = &ar->v2d;
+ // View2D *v2d = &region->v2d;
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
@@ -301,7 +301,7 @@ static void text_main_region_draw(const bContext *C, ARegion *ar)
// UI_view2d_view_ortho(v2d);
/* data... */
- draw_text_main(st, ar);
+ draw_text_main(st, region);
/* reset view matrix */
// UI_view2d_view_restore(C);
@@ -309,13 +309,13 @@ static void text_main_region_draw(const bContext *C, ARegion *ar)
/* scrollers? */
}
-static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
+static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *region)
{
SpaceText *st = sa->spacedata.first;
int wmcursor = WM_CURSOR_TEXT_EDIT;
if (st->text && BLI_rcti_isect_pt(&st->runtime.scroll_region_handle,
- win->eventstate->x - ar->winrct.xmin,
+ win->eventstate->x - region->winrct.xmin,
st->runtime.scroll_region_handle.ymin)) {
wmcursor = WM_CURSOR_DEFAULT;
}
@@ -378,40 +378,40 @@ static void text_dropboxes(void)
/****************** header region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void text_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void text_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void text_header_region_draw(const bContext *C, ARegion *ar)
+static void text_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/****************** properties region ******************/
/* add handlers, stuff you only do once or on area/region changes */
-static void text_properties_region_init(wmWindowManager *wm, ARegion *ar)
+static void text_properties_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ ED_region_panels_init(wm, region);
/* own keymaps */
keymap = WM_keymap_ensure(wm->defaultconf, "Text Generic", SPACE_TEXT, 0);
- WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
+ WM_event_add_keymap_handler_v2d_mask(&region->handlers, keymap);
}
-static void text_properties_region_draw(const bContext *C, ARegion *ar)
+static void text_properties_region_draw(const bContext *C, ARegion *region)
{
SpaceText *st = CTX_wm_space_text(C);
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
/* this flag trick is make sure buttons have been added already */
if (st->flags & ST_FIND_ACTIVATE) {
- if (UI_textbutton_activate_rna(C, ar, st, "find_text")) {
+ if (UI_textbutton_activate_rna(C, region, st, "find_text")) {
/* if the panel was already open we need to do another redraw */
ScrArea *sa = CTX_wm_area(C);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_TEXT, sa);
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index a560b8af70f..97ce7035222 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -49,7 +49,7 @@
/** \name Public API
* \{ */
-int text_do_suggest_select(SpaceText *st, ARegion *ar)
+int text_do_suggest_select(SpaceText *st, ARegion *region)
{
SuggItem *item, *first, *last /* , *sel */ /* UNUSED */;
TextLine *tmp;
@@ -84,7 +84,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
text_update_character_width(st);
x = TXT_BODY_LEFT(st) + (st->runtime.cwidth_px * (st->text->curc - st->left));
- y = ar->winy - st->runtime.lheight_px * l - 2;
+ y = region->winy - st->runtime.lheight_px * l - 2;
w = SUGG_LIST_WIDTH * st->runtime.cwidth_px + U.widget_unit;
h = SUGG_LIST_SIZE * st->runtime.lheight_px + 0.4f * U.widget_unit;
@@ -336,7 +336,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
{
SpaceText *st = CTX_wm_space_text(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
int draw = 0, tools = 0, swallow = 0, scroll = 1;
Text *text = CTX_data_edit_text(C);
@@ -356,7 +356,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
switch (event->type) {
case LEFTMOUSE:
if (event->val == KM_PRESS) {
- if (text_do_suggest_select(st, ar)) {
+ if (text_do_suggest_select(st, region)) {
swallow = 1;
}
else {
@@ -374,7 +374,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
break;
case MIDDLEMOUSE:
if (event->val == KM_PRESS) {
- if (text_do_suggest_select(st, ar)) {
+ if (text_do_suggest_select(st, region)) {
ED_text_undo_push_init(C);
confirm_suggestion(st->text);
text_update_line_edited(st->text->curl);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 02914737229..b03c3ca68cb 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -187,9 +187,9 @@ static void format_draw_color(const TextDrawContext *tdc, char formatchar)
* \encode
*/
-int wrap_width(const SpaceText *st, ARegion *ar)
+int wrap_width(const SpaceText *st, ARegion *region)
{
- int winx = ar->winx - TXT_SCROLL_WIDTH;
+ int winx = region->winx - TXT_SCROLL_WIDTH;
int x, max;
x = TXT_BODY_LEFT(st);
@@ -199,7 +199,7 @@ int wrap_width(const SpaceText *st, ARegion *ar)
/* Sets (offl, offc) for transforming (line, curs) to its wrapped position */
void wrap_offset(
- const SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
+ const SpaceText *st, ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
{
Text *text;
TextLine *linep;
@@ -221,7 +221,7 @@ void wrap_offset(
linep = text->lines.first;
i = st->top;
while (i > 0 && linep) {
- int lines = text_get_visible_lines(st, ar, linep->line);
+ int lines = text_get_visible_lines(st, region, linep->line);
/* Line before top */
if (linep == linein) {
@@ -241,7 +241,7 @@ void wrap_offset(
}
}
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
cursin = BLI_str_utf8_offset_to_column(linein->line, cursin);
while (linep) {
@@ -305,7 +305,7 @@ void wrap_offset(
/* cursin - mem, offc - view */
void wrap_offset_in_line(
- const SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc)
+ const SpaceText *st, ARegion *region, TextLine *linein, int cursin, int *offl, int *offc)
{
int i, j, start, end, chars, max, chop;
char ch;
@@ -319,7 +319,7 @@ void wrap_offset_in_line(
return;
}
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
start = 0;
end = max;
@@ -598,7 +598,7 @@ static void text_drawcache_init(SpaceText *st)
st->runtime.drawcache = drawcache;
}
-static void text_update_drawcache(SpaceText *st, ARegion *ar)
+static void text_update_drawcache(SpaceText *st, ARegion *region)
{
DrawCache *drawcache;
int full_update = 0, nlines = 0;
@@ -616,7 +616,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
/* check if full cache update is needed */
/* area was resized */
- full_update |= drawcache->winx != ar->winx;
+ full_update |= drawcache->winx != region->winx;
/* word-wrapping option was toggled */
full_update |= drawcache->wordwrap != st->wordwrap;
/* word-wrapping option was toggled */
@@ -673,7 +673,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
lines_count = fp[lineno];
}
else {
- lines_count = text_get_visible_lines(st, ar, line->line);
+ lines_count = text_get_visible_lines(st, region, line->line);
}
fp[lineno] = lines_count;
@@ -706,7 +706,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
drawcache->nlines = nlines;
/* store settings */
- drawcache->winx = ar->winx;
+ drawcache->winx = region->winx;
drawcache->wordwrap = st->wordwrap;
drawcache->lheight = st->runtime.lheight_px;
drawcache->cwidth_px = st->runtime.cwidth_px;
@@ -793,12 +793,12 @@ static int text_get_visible_lines_no(const SpaceText *st, int lineno)
return drawcache->line_height[lineno];
}
-int text_get_visible_lines(const SpaceText *st, ARegion *ar, const char *str)
+int text_get_visible_lines(const SpaceText *st, ARegion *region, const char *str)
{
int i, j, start, end, max, lines, chars;
char ch;
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
lines = 1;
start = 0;
end = max;
@@ -832,7 +832,7 @@ int text_get_visible_lines(const SpaceText *st, ARegion *ar, const char *str)
return lines;
}
-int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
+int text_get_span_wrap(const SpaceText *st, ARegion *region, TextLine *from, TextLine *to)
{
if (st->wordwrap) {
int ret = 0;
@@ -843,7 +843,7 @@ int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLin
if (tmp == to) {
return ret;
}
- ret += text_get_visible_lines(st, ar, tmp->line);
+ ret += text_get_visible_lines(st, region, tmp->line);
tmp = tmp->next;
}
@@ -854,11 +854,11 @@ int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLin
}
}
-int text_get_total_lines(SpaceText *st, ARegion *ar)
+int text_get_total_lines(SpaceText *st, ARegion *region)
{
DrawCache *drawcache;
- text_update_drawcache(st, ar);
+ text_update_drawcache(st, region);
drawcache = st->runtime.drawcache;
return drawcache->total_lines;
@@ -866,7 +866,7 @@ int text_get_total_lines(SpaceText *st, ARegion *ar)
/************************ draw scrollbar *****************************/
-static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
+static void calc_text_rcts(SpaceText *st, ARegion *region, rcti *scroll, rcti *back)
{
int lhlstart, lhlend, ltexth, sell_off, curl_off;
short barheight, barstart, hlstart, hlend, blank_lines;
@@ -874,17 +874,17 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
pix_top_margin = (0.4 * U.widget_unit);
pix_bottom_margin = (0.4 * U.widget_unit);
- pix_available = ar->winy - pix_top_margin - pix_bottom_margin;
- ltexth = text_get_total_lines(st, ar);
+ pix_available = region->winy - pix_top_margin - pix_bottom_margin;
+ ltexth = text_get_total_lines(st, region);
blank_lines = st->runtime.viewlines / 2;
/* nicer code: use scroll rect for entire bar */
- back->xmin = ar->winx - (0.6 * U.widget_unit);
- back->xmax = ar->winx;
+ back->xmin = region->winx - (0.6 * U.widget_unit);
+ back->xmax = region->winx;
back->ymin = 0;
- back->ymax = ar->winy;
+ back->ymax = region->winy;
- scroll->xmax = ar->winx - (0.2 * U.widget_unit);
+ scroll->xmax = region->winx - (0.2 * U.widget_unit);
scroll->xmin = scroll->xmax - (0.4 * U.widget_unit);
scroll->ymin = pix_top_margin;
scroll->ymax = pix_available;
@@ -909,16 +909,16 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
st->runtime.scroll_region_handle.ymax -= barstart;
st->runtime.scroll_region_handle.ymin = st->runtime.scroll_region_handle.ymax - barheight;
- CLAMP(st->runtime.scroll_region_handle.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
- CLAMP(st->runtime.scroll_region_handle.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_handle.ymin, pix_bottom_margin, region->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_handle.ymax, pix_bottom_margin, region->winy - pix_top_margin);
st->runtime.scroll_px_per_line = (pix_available > 0) ? (float)ltexth / pix_available : 0;
if (st->runtime.scroll_px_per_line < 0.1f) {
st->runtime.scroll_px_per_line = 0.1f;
}
- curl_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
- sell_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
+ curl_off = text_get_span_wrap(st, region, st->text->lines.first, st->text->curl);
+ sell_off = text_get_span_wrap(st, region, st->text->lines.first, st->text->sell);
lhlstart = MIN2(curl_off, sell_off);
lhlend = MAX2(curl_off, sell_off);
@@ -981,11 +981,11 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
}
st->runtime.scroll_region_select = *scroll;
- st->runtime.scroll_region_select.ymax = ar->winy - pix_top_margin - hlstart;
- st->runtime.scroll_region_select.ymin = ar->winy - pix_top_margin - hlend;
+ st->runtime.scroll_region_select.ymax = region->winy - pix_top_margin - hlstart;
+ st->runtime.scroll_region_select.ymin = region->winy - pix_top_margin - hlend;
- CLAMP(st->runtime.scroll_region_select.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
- CLAMP(st->runtime.scroll_region_select.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_select.ymin, pix_bottom_margin, region->winy - pix_top_margin);
+ CLAMP(st->runtime.scroll_region_select.ymax, pix_bottom_margin, region->winy - pix_top_margin);
}
static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
@@ -1025,7 +1025,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
/*********************** draw documentation *******************************/
#if 0
-static void draw_documentation(const SpaceText *st, ARegion *ar)
+static void draw_documentation(const SpaceText *st, ARegion *region)
{
TextDrawContext tdc = {0};
TextLine *tmp;
@@ -1062,7 +1062,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
x += SUGG_LIST_WIDTH * st->runtime.cwidth_px + 50;
}
- /* top = */ /* UNUSED */ y = ar->winy - st->runtime.lheight_px * l - 2;
+ /* top = */ /* UNUSED */ y = region->winy - st->runtime.lheight_px * l - 2;
boxw = DOC_WIDTH * st->runtime.cwidth_px + 20;
boxh = (DOC_HEIGHT + 1) * TXT_LINE_HEIGHT(st);
@@ -1136,7 +1136,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar)
/*********************** draw suggestion list *******************************/
-static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc, ARegion *ar)
+static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc, ARegion *region)
{
SuggItem *item, *first, *last, *sel;
char str[SUGG_LIST_WIDTH * BLI_UTF8_MAX + 1];
@@ -1163,12 +1163,12 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
sel = texttool_suggest_selected();
top = texttool_suggest_top();
- wrap_offset(st, ar, st->text->curl, st->text->curc, &offl, &offc);
+ wrap_offset(st, region, st->text->curl, st->text->curc, &offl, &offc);
vcurl = txt_get_span(st->text->lines.first, st->text->curl) - st->top + offl;
vcurc = text_get_char_pos(st, st->text->curl->line, st->text->curc) - st->left + offc;
x = TXT_BODY_LEFT(st) + (vcurc * st->runtime.cwidth_px);
- y = ar->winy - (vcurl + 1) * lheight - 2;
+ y = region->winy - (vcurl + 1) * lheight - 2;
/* offset back so the start of the text lines up with the suggestions,
* not essential but makes suggestions easier to follow */
@@ -1178,8 +1178,8 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
boxw = SUGG_LIST_WIDTH * st->runtime.cwidth_px + 20;
boxh = SUGG_LIST_SIZE * lheight + 8;
- if (x + boxw > ar->winx) {
- x = MAX2(0, ar->winx - boxw);
+ if (x + boxw > region->winx) {
+ x = MAX2(0, region->winx - boxw);
}
/* not needed but stands out nicer */
@@ -1232,7 +1232,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
/*********************** draw cursor ************************/
-static void draw_text_decoration(SpaceText *st, ARegion *ar)
+static void draw_text_decoration(SpaceText *st, ARegion *region)
{
Text *text = st->text;
int vcurl, vcurc, vsell, vselc, hidden = 0;
@@ -1241,7 +1241,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
const int lheight = TXT_LINE_HEIGHT(st);
/* Convert to view space character coordinates to determine if cursor is hidden */
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
+ wrap_offset(st, region, text->sell, text->selc, &offl, &offc);
vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
@@ -1262,7 +1262,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
/* Draw the selection */
if (text->curl != text->sell || text->curc != text->selc) {
/* Convert all to view space character coordinates */
- wrap_offset(st, ar, text->curl, text->curc, &offl, &offc);
+ wrap_offset(st, region, text->curl, text->curc, &offl, &offc);
vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl;
vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc;
@@ -1273,7 +1273,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
immUniformThemeColor(TH_SHADE2);
x = TXT_BODY_LEFT(st);
- y = ar->winy;
+ y = region->winy;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
}
@@ -1314,11 +1314,11 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
y -= froml * lheight;
- immRecti(pos, x + fromc * st->runtime.cwidth_px - U.pixelsize, y, ar->winx, y - lheight);
+ immRecti(pos, x + fromc * st->runtime.cwidth_px - U.pixelsize, y, region->winx, y - lheight);
y -= lheight;
for (i = froml + 1; i < tol; i++) {
- immRecti(pos, x - U.pixelsize, y, ar->winx, y - lheight);
+ immRecti(pos, x - U.pixelsize, y, region->winx, y - lheight);
y -= lheight;
}
@@ -1333,25 +1333,25 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
int y1, y2;
if (st->wordwrap) {
- int visible_lines = text_get_visible_lines(st, ar, text->sell->line);
+ int visible_lines = text_get_visible_lines(st, region, text->sell->line);
- wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc);
+ wrap_offset_in_line(st, region, text->sell, text->selc, &offl, &offc);
- y1 = ar->winy - (vsell - offl) * lheight;
+ y1 = region->winy - (vsell - offl) * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y1 += st->runtime.scroll_ofs_px[1];
}
y2 = y1 - (lheight * visible_lines);
}
else {
- y1 = ar->winy - vsell * lheight;
+ y1 = region->winy - vsell * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y1 += st->runtime.scroll_ofs_px[1];
}
y2 = y1 - (lheight);
}
- if (!(y1 < 0 || y2 > ar->winy)) { /* check we need to draw */
+ if (!(y1 < 0 || y2 > region->winy)) { /* check we need to draw */
float highlight_color[4];
UI_GetThemeColor4fv(TH_TEXT, highlight_color);
highlight_color[3] = 0.1f;
@@ -1359,7 +1359,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
GPU_blend(true);
- immRecti(pos, 0, y1, ar->winx, y2);
+ immRecti(pos, 0, y1, region->winx, y2);
GPU_blend(false);
}
}
@@ -1367,7 +1367,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
if (!hidden) {
/* Draw the cursor itself (we draw the sel. cursor as this is the leading edge) */
x = TXT_BODY_LEFT(st) + (vselc * st->runtime.cwidth_px);
- y = ar->winy - vsell * lheight;
+ y = region->winy - vsell * lheight;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
}
@@ -1396,7 +1396,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
/******************* draw matching brackets *********************/
-static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegion *ar)
+static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegion *region)
{
TextLine *startl, *endl, *linep;
Text *text = st->text;
@@ -1521,14 +1521,14 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
UI_FontThemeColor(tdc->font_id, TH_HILITE);
x = TXT_BODY_LEFT(st);
- y = ar->winy - st->runtime.lheight_px;
+ y = region->winy - st->runtime.lheight_px;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
}
/* draw opening bracket */
ch = startl->line[startc];
- wrap_offset(st, ar, startl, startc, &offl, &offc);
+ wrap_offset(st, region, startl, startc, &offl, &offc);
viewc = text_get_char_pos(st, startl->line, startc) - st->left + offc;
if (viewc >= 0) {
@@ -1542,7 +1542,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
/* draw closing bracket */
ch = endl->line[endc];
- wrap_offset(st, ar, endl, endc, &offl, &offc);
+ wrap_offset(st, region, endl, endc, &offl, &offc);
viewc = text_get_char_pos(st, endl->line, endc) - st->left + offc;
if (viewc >= 0) {
@@ -1557,7 +1557,7 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
/*********************** main region drawing *************************/
-void draw_text_main(SpaceText *st, ARegion *ar)
+void draw_text_main(SpaceText *st, ARegion *region)
{
TextDrawContext tdc = {0};
Text *text = st->text;
@@ -1581,12 +1581,12 @@ void draw_text_main(SpaceText *st, ARegion *ar)
const int clip_min_y = -(int)(st->runtime.lheight_px - 1);
st->runtime.viewlines = (st->runtime.lheight_px) ?
- (int)(ar->winy - clip_min_y) / TXT_LINE_HEIGHT(st) :
+ (int)(region->winy - clip_min_y) / TXT_LINE_HEIGHT(st) :
0;
text_draw_context_init(st, &tdc);
- text_update_drawcache(st, ar);
+ text_update_drawcache(st, region);
/* make sure all the positional pointers exist */
if (!text->curl || !text->sell || !text->lines.first || !text->lines.last) {
@@ -1594,7 +1594,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
}
/* update rects for scroll */
- calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */
+ calc_text_rcts(st, region, &scroll, &back); /* scroll will hold the entire bar size */
/* update syntax formatting if needed */
tft = ED_text_format_get(text);
@@ -1637,7 +1637,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_GRID);
- immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), ar->winy);
+ immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), region->winy);
immUnbindProgram();
}
else {
@@ -1645,17 +1645,17 @@ void draw_text_main(SpaceText *st, ARegion *ar)
}
x = TXT_BODY_LEFT(st);
- y = ar->winy - st->runtime.lheight_px;
+ y = region->winy - st->runtime.lheight_px;
int viewlines = st->runtime.viewlines;
if (st->flags & ST_SCROLL_SELECT) {
y += st->runtime.scroll_ofs_px[1];
viewlines += 1;
}
- winx = ar->winx - TXT_SCROLL_WIDTH;
+ winx = region->winx - TXT_SCROLL_WIDTH;
/* draw cursor, margin, selection and highlight */
- draw_text_decoration(st, ar);
+ draw_text_decoration(st, region);
/* draw the text */
UI_FontThemeColor(tdc.font_id, TH_TEXT);
@@ -1695,7 +1695,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
else {
/* draw unwrapped text */
text_draw(
- st, &tdc, tmp->line, st->left, ar->winx / st->runtime.cwidth_px, x, y, tmp->format);
+ st, &tdc, tmp->line, st->left, region->winx / st->runtime.cwidth_px, x, y, tmp->format);
y -= TXT_LINE_HEIGHT(st);
}
@@ -1713,17 +1713,17 @@ void draw_text_main(SpaceText *st, ARegion *ar)
margin_color[3] = 0.2f;
immUniformColor4fv(margin_color);
GPU_blend(true);
- immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, ar->winy);
+ immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy);
GPU_blend(false);
immUnbindProgram();
}
}
/* draw other stuff */
- draw_brackets(st, &tdc, ar);
+ draw_brackets(st, &tdc, region);
draw_textscroll(st, &scroll, &back);
- /* draw_documentation(st, ar); - No longer supported */
- draw_suggestion_list(st, &tdc, ar);
+ /* draw_documentation(st, region); - No longer supported */
+ draw_suggestion_list(st, &tdc, region);
text_font_end(&tdc);
}
@@ -1744,10 +1744,10 @@ void text_update_character_width(SpaceText *st)
/* Moves the view to the cursor location,
* also used to make sure the view isn't outside the file */
-void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
+void text_scroll_to_cursor(SpaceText *st, ARegion *region, const bool center)
{
Text *text;
- int i, x, winx = ar->winx;
+ int i, x, winx = region->winx;
if (ELEM(NULL, st, st->text, st->text->curl)) {
return;
@@ -1760,7 +1760,7 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
i = txt_get_span(text->lines.first, text->sell);
if (st->wordwrap) {
int offl, offc;
- wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
+ wrap_offset(st, region, text->sell, text->selc, &offl, &offc);
i += offl;
}
@@ -1814,16 +1814,16 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
/* takes an area instead of a region, use for listeners */
void text_scroll_to_cursor__area(SpaceText *st, ScrArea *sa, const bool center)
{
- ARegion *ar;
+ ARegion *region;
if (ELEM(NULL, st, st->text, st->text->curl)) {
return;
}
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- text_scroll_to_cursor(st, ar, center);
+ if (region) {
+ text_scroll_to_cursor(st, region, center);
}
}
@@ -1839,7 +1839,7 @@ void text_update_cursor_moved(bContext *C)
* Takes a cursor (row, character) and returns x,y pixel coords.
*/
bool ED_text_region_location_from_cursor(SpaceText *st,
- ARegion *ar,
+ ARegion *region,
const int cursor_co[2],
int r_pixel_co[2])
{
@@ -1859,10 +1859,10 @@ bool ED_text_region_location_from_cursor(SpaceText *st,
/* handle tabs as well! */
int char_pos = text_get_char_pos(st, line->line, cursor_co[1]);
- wrap_offset(st, ar, line, cursor_co[1], &offl, &offc);
+ wrap_offset(st, region, line, cursor_co[1], &offl, &offc);
r_pixel_co[0] = (char_pos + offc - st->left) * st->runtime.cwidth_px + linenr_offset;
r_pixel_co[1] = (cursor_co[0] + offl - st->top) * TXT_LINE_HEIGHT(st);
- r_pixel_co[1] = (ar->winy - (r_pixel_co[1] + (TXT_BODY_LPAD * st->runtime.cwidth_px))) -
+ r_pixel_co[1] = (region->winy - (r_pixel_co[1] + (TXT_BODY_LPAD * st->runtime.cwidth_px))) -
st->runtime.lheight_px;
}
return true;
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 846220b95ba..da39ba3c5ad 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -44,24 +44,24 @@
static ARegion *text_has_properties_region(ScrArea *sa)
{
- ARegion *ar, *arnew;
+ ARegion *region, *arnew;
- ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar) {
- return ar;
+ region = BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if (region) {
+ return region;
}
/* add subdiv level; after header */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar == NULL) {
+ if (region == NULL) {
return NULL;
}
arnew = MEM_callocN(sizeof(ARegion), "properties region");
- BLI_insertlinkafter(&sa->regionbase, ar, arnew);
+ BLI_insertlinkafter(&sa->regionbase, region, arnew);
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_LEFT;
@@ -78,21 +78,21 @@ static bool text_properties_poll(bContext *C)
static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = text_has_properties_region(sa);
+ ARegion *region = text_has_properties_region(sa);
SpaceText *st = CTX_wm_space_text(C);
- if (ar) {
- if (ar->flag & RGN_FLAG_HIDDEN) {
- ED_region_toggle_hidden(C, ar);
+ if (region) {
+ if (region->flag & RGN_FLAG_HIDDEN) {
+ ED_region_toggle_hidden(C, region);
}
- UI_panel_category_active_set(ar, "Text");
+ UI_panel_category_active_set(region, "Text");
/* cannot send a button activate yet for case when region wasn't visible yet */
/* flag gets checked and cleared in main draw callback */
st->flags |= ST_FIND_ACTIVATE;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 1a36b21952b..5ad6a554188 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -35,12 +35,12 @@ struct bContext;
struct wmOperatorType;
/* text_draw.c */
-void draw_text_main(struct SpaceText *st, struct ARegion *ar);
+void draw_text_main(struct SpaceText *st, struct ARegion *region);
void text_update_line_edited(struct TextLine *line);
void text_update_edited(struct Text *text);
void text_update_character_width(struct SpaceText *st);
-void text_scroll_to_cursor(struct SpaceText *st, struct ARegion *ar, const bool center);
+void text_scroll_to_cursor(struct SpaceText *st, struct ARegion *region, const bool center);
void text_scroll_to_cursor__area(struct SpaceText *st, struct ScrArea *sa, const bool center);
void text_update_cursor_moved(struct bContext *C);
@@ -74,15 +74,15 @@ void text_update_cursor_moved(struct bContext *C);
#define TOOL_SUGG_LIST 0x01
#define TOOL_DOCUMENT 0x02
-int wrap_width(const struct SpaceText *st, struct ARegion *ar);
+int wrap_width(const struct SpaceText *st, struct ARegion *region);
void wrap_offset(const struct SpaceText *st,
- struct ARegion *ar,
+ struct ARegion *region,
struct TextLine *linein,
int cursin,
int *offl,
int *offc);
void wrap_offset_in_line(const struct SpaceText *st,
- struct ARegion *ar,
+ struct ARegion *region,
struct TextLine *linep,
int cursin,
int *offl,
@@ -92,15 +92,15 @@ int text_get_char_pos(const struct SpaceText *st, const char *line, int cur);
void text_drawcache_tag_update(struct SpaceText *st, int full);
void text_free_caches(struct SpaceText *st);
-int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar);
+int text_do_suggest_select(struct SpaceText *st, struct ARegion *region);
void text_pop_suggest_list(void);
-int text_get_visible_lines(const struct SpaceText *st, struct ARegion *ar, const char *str);
+int text_get_visible_lines(const struct SpaceText *st, struct ARegion *region, const char *str);
int text_get_span_wrap(const struct SpaceText *st,
- struct ARegion *ar,
+ struct ARegion *region,
struct TextLine *from,
struct TextLine *to);
-int text_get_total_lines(struct SpaceText *st, struct ARegion *ar);
+int text_get_total_lines(struct SpaceText *st, struct ARegion *region);
/* text_ops.c */
enum {
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index ab1f5f53e7b..43010829bdf 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -60,7 +60,7 @@
#include "text_intern.h"
#include "text_format.h"
-static void txt_screen_clamp(SpaceText *st, ARegion *ar);
+static void txt_screen_clamp(SpaceText *st, ARegion *region);
/* -------------------------------------------------------------------- */
/** \name Util
@@ -195,13 +195,13 @@ static bool text_region_edit_poll(bContext *C)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (!st || !text) {
return 0;
}
- if (!ar || ar->regiontype != RGN_TYPE_WINDOW) {
+ if (!region || region->regiontype != RGN_TYPE_WINDOW) {
return 0;
}
@@ -421,7 +421,7 @@ static int text_reload_exec(bContext *C, wmOperator *op)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* store view & cursor state */
const int orig_top = st->top;
@@ -448,7 +448,7 @@ static int text_reload_exec(bContext *C, wmOperator *op)
/* return to scroll position */
st->top = orig_top;
- txt_screen_clamp(st, ar);
+ txt_screen_clamp(st, region);
/* return cursor */
txt_move_to(text, orig_curl, orig_curc, false);
@@ -1633,12 +1633,13 @@ static const EnumPropertyItem move_type_items[] = {
};
/* get cursor position in line by relative wrapped line and column positions */
-static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int rell, int relc)
+static int text_get_cursor_rel(
+ SpaceText *st, ARegion *region, TextLine *linein, int rell, int relc)
{
int i, j, start, end, max, chop, curs, loop, endj, found, selc;
char ch;
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
selc = start = endj = curs = found = 0;
end = max;
@@ -1726,17 +1727,17 @@ static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int
}
static int cursor_skip_find_line(
- SpaceText *st, ARegion *ar, int lines, TextLine **linep, int *charp, int *rell, int *relc)
+ SpaceText *st, ARegion *region, int lines, TextLine **linep, int *charp, int *rell, int *relc)
{
int offl, offc, visible_lines;
- wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
+ wrap_offset_in_line(st, region, *linep, *charp, &offl, &offc);
*relc = text_get_char_pos(st, (*linep)->line, *charp) + offc;
*rell = lines;
/* handle current line */
if (lines > 0) {
- visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
+ visible_lines = text_get_visible_lines(st, region, (*linep)->line);
if (*rell - visible_lines + offl >= 0) {
if (!(*linep)->next) {
@@ -1780,7 +1781,7 @@ static int cursor_skip_find_line(
/* skip lines and find destination line and offsets */
while (*linep) {
- visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
+ visible_lines = text_get_visible_lines(st, region, (*linep)->line);
if (lines < 0) { /* moving top */
if (*rell + visible_lines >= 0) {
@@ -1814,7 +1815,7 @@ static int cursor_skip_find_line(
return 1;
}
-static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, const bool sel)
+static void txt_wrap_move_bol(SpaceText *st, ARegion *region, const bool sel)
{
Text *text = st->text;
TextLine **linep;
@@ -1835,7 +1836,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, const bool sel)
oldc = *charp;
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
start = endj = 0;
end = max;
@@ -1898,7 +1899,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, const bool sel)
}
}
-static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, const bool sel)
+static void txt_wrap_move_eol(SpaceText *st, ARegion *region, const bool sel)
{
Text *text = st->text;
TextLine **linep;
@@ -1919,7 +1920,7 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, const bool sel)
oldc = *charp;
- max = wrap_width(st, ar);
+ max = wrap_width(st, region);
start = endj = 0;
end = max;
@@ -1982,7 +1983,7 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, const bool sel)
}
}
-static void txt_wrap_move_up(SpaceText *st, ARegion *ar, const bool sel)
+static void txt_wrap_move_up(SpaceText *st, ARegion *region, const bool sel)
{
Text *text = st->text;
TextLine **linep;
@@ -2000,18 +2001,18 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, const bool sel)
charp = &text->curc;
}
- wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
+ wrap_offset_in_line(st, region, *linep, *charp, &offl, &offc);
col = text_get_char_pos(st, (*linep)->line, *charp) + offc;
if (offl) {
- *charp = text_get_cursor_rel(st, ar, *linep, offl - 1, col);
+ *charp = text_get_cursor_rel(st, region, *linep, offl - 1, col);
}
else {
if ((*linep)->prev) {
int visible_lines;
*linep = (*linep)->prev;
- visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
- *charp = text_get_cursor_rel(st, ar, *linep, visible_lines - 1, col);
+ visible_lines = text_get_visible_lines(st, region, (*linep)->line);
+ *charp = text_get_cursor_rel(st, region, *linep, visible_lines - 1, col);
}
else {
*charp = 0;
@@ -2023,7 +2024,7 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, const bool sel)
}
}
-static void txt_wrap_move_down(SpaceText *st, ARegion *ar, const bool sel)
+static void txt_wrap_move_down(SpaceText *st, ARegion *region, const bool sel)
{
Text *text = st->text;
TextLine **linep;
@@ -2041,16 +2042,16 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, const bool sel)
charp = &text->curc;
}
- wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
+ wrap_offset_in_line(st, region, *linep, *charp, &offl, &offc);
col = text_get_char_pos(st, (*linep)->line, *charp) + offc;
- visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
+ visible_lines = text_get_visible_lines(st, region, (*linep)->line);
if (offl < visible_lines - 1) {
- *charp = text_get_cursor_rel(st, ar, *linep, offl + 1, col);
+ *charp = text_get_cursor_rel(st, region, *linep, offl + 1, col);
}
else {
if ((*linep)->next) {
*linep = (*linep)->next;
- *charp = text_get_cursor_rel(st, ar, *linep, 0, col);
+ *charp = text_get_cursor_rel(st, region, *linep, 0, col);
}
else {
*charp = (*linep)->len;
@@ -2068,7 +2069,7 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, const bool sel)
*
* This is to replace screen_skip for PageUp/Down operations.
*/
-static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, const bool sel)
+static void cursor_skip(SpaceText *st, ARegion *region, Text *text, int lines, const bool sel)
{
TextLine **linep;
int *charp;
@@ -2082,12 +2083,12 @@ static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, const
charp = &text->curc;
}
- if (st && ar && st->wordwrap) {
+ if (st && region && st->wordwrap) {
int rell, relc;
/* find line and offsets inside it needed to set cursor position */
- if (cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc)) {
- *charp = text_get_cursor_rel(st, ar, *linep, rell, relc);
+ if (cursor_skip_find_line(st, region, lines, linep, charp, &rell, &relc)) {
+ *charp = text_get_cursor_rel(st, region, *linep, rell, relc);
}
}
else {
@@ -2114,11 +2115,11 @@ static int text_move_cursor(bContext *C, int type, bool select)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* ensure we have the right region, it's optional */
- if (ar && ar->regiontype != RGN_TYPE_WINDOW) {
- ar = NULL;
+ if (region && region->regiontype != RGN_TYPE_WINDOW) {
+ region = NULL;
}
switch (type) {
@@ -2126,8 +2127,8 @@ static int text_move_cursor(bContext *C, int type, bool select)
if (!select) {
txt_sel_clear(text);
}
- if (st && st->wordwrap && ar) {
- txt_wrap_move_bol(st, ar, select);
+ if (st && st->wordwrap && region) {
+ txt_wrap_move_bol(st, region, select);
}
else {
txt_move_bol(text, select);
@@ -2138,8 +2139,8 @@ static int text_move_cursor(bContext *C, int type, bool select)
if (!select) {
txt_sel_clear(text);
}
- if (st && st->wordwrap && ar) {
- txt_wrap_move_eol(st, ar, select);
+ if (st && st->wordwrap && region) {
+ txt_wrap_move_eol(st, region, select);
}
else {
txt_move_eol(text, select);
@@ -2189,8 +2190,8 @@ static int text_move_cursor(bContext *C, int type, bool select)
break;
case PREV_LINE:
- if (st && st->wordwrap && ar) {
- txt_wrap_move_up(st, ar, select);
+ if (st && st->wordwrap && region) {
+ txt_wrap_move_up(st, region, select);
}
else {
txt_move_up(text, select);
@@ -2198,8 +2199,8 @@ static int text_move_cursor(bContext *C, int type, bool select)
break;
case NEXT_LINE:
- if (st && st->wordwrap && ar) {
- txt_wrap_move_down(st, ar, select);
+ if (st && st->wordwrap && region) {
+ txt_wrap_move_down(st, region, select);
}
else {
txt_move_down(text, select);
@@ -2208,7 +2209,7 @@ static int text_move_cursor(bContext *C, int type, bool select)
case PREV_PAGE:
if (st) {
- cursor_skip(st, ar, st->text, -st->runtime.viewlines, select);
+ cursor_skip(st, region, st->text, -st->runtime.viewlines, select);
}
else {
cursor_skip(NULL, NULL, text, -10, select);
@@ -2217,7 +2218,7 @@ static int text_move_cursor(bContext *C, int type, bool select)
case NEXT_PAGE:
if (st) {
- cursor_skip(st, ar, st->text, st->runtime.viewlines, select);
+ cursor_skip(st, region, st->text, st->runtime.viewlines, select);
}
else {
cursor_skip(NULL, NULL, text, 10, select);
@@ -2491,14 +2492,14 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
/** \name Scroll Operator
* \{ */
-static void txt_screen_clamp(SpaceText *st, ARegion *ar)
+static void txt_screen_clamp(SpaceText *st, ARegion *region)
{
if (st->top <= 0) {
st->top = 0;
}
else {
int last;
- last = text_get_total_lines(st, ar);
+ last = text_get_total_lines(st, region);
last = last - (st->runtime.viewlines / 2);
if (last > 0 && st->top > last) {
st->top = last;
@@ -2507,10 +2508,10 @@ static void txt_screen_clamp(SpaceText *st, ARegion *ar)
}
/* Moves the view vertically by the specified number of lines */
-static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines)
+static void txt_screen_skip(SpaceText *st, ARegion *region, int lines)
{
st->top += lines;
- txt_screen_clamp(st, ar);
+ txt_screen_clamp(st, region);
}
/* quick enum for tsc->zone (scroller handles) */
@@ -2540,13 +2541,14 @@ typedef struct TextScroll {
int ofs_delta_px[2];
} TextScroll;
-static void text_scroll_state_init(TextScroll *tsc, SpaceText *st, ARegion *ar)
+static void text_scroll_state_init(TextScroll *tsc, SpaceText *st, ARegion *region)
{
tsc->state.ofs_init[0] = st->left;
tsc->state.ofs_init[1] = st->top;
tsc->state.ofs_max[0] = INT_MAX;
- tsc->state.ofs_max[1] = max_ii(0, text_get_total_lines(st, ar) - (st->runtime.viewlines / 2));
+ tsc->state.ofs_max[1] = max_ii(0,
+ text_get_total_lines(st, region) - (st->runtime.viewlines / 2));
tsc->state.size_px[0] = st->runtime.cwidth_px;
tsc->state.size_px[1] = TXT_LINE_HEIGHT(st);
@@ -2562,7 +2564,7 @@ static bool text_scroll_poll(bContext *C)
static int text_scroll_exec(bContext *C, wmOperator *op)
{
SpaceText *st = CTX_wm_space_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
int lines = RNA_int_get(op->ptr, "lines");
@@ -2570,7 +2572,7 @@ static int text_scroll_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- txt_screen_skip(st, ar, lines * U.wheellinescroll);
+ txt_screen_skip(st, region, lines * U.wheellinescroll);
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2689,7 +2691,7 @@ static int text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
TextScroll *tsc = op->customdata;
SpaceText *st = CTX_wm_space_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
switch (event->type) {
case MOUSEMOVE:
@@ -2702,8 +2704,10 @@ static int text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MIDDLEMOUSE:
if (event->val == KM_RELEASE) {
if (ELEM(tsc->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
- txt_screen_skip(
- st, ar, st->runtime.viewlines * (tsc->zone == SCROLLHANDLE_MIN_OUTSIDE ? 1 : -1));
+ txt_screen_skip(st,
+ region,
+ st->runtime.viewlines *
+ (tsc->zone == SCROLLHANDLE_MIN_OUTSIDE ? 1 : -1));
ED_area_tag_redraw(CTX_wm_area(C));
}
@@ -2723,7 +2727,7 @@ static void text_scroll_cancel(bContext *C, wmOperator *op)
static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceText *st = CTX_wm_space_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
TextScroll *tsc;
@@ -2735,7 +2739,7 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
tsc->is_first = true;
tsc->zone = SCROLLHANDLE_BAR;
- text_scroll_state_init(tsc, st, ar);
+ text_scroll_state_init(tsc, st, region);
op->customdata = tsc;
@@ -2796,13 +2800,13 @@ static bool text_region_scroll_poll(bContext *C)
/* same as text_region_edit_poll except it works on libdata too */
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (!st || !text) {
return 0;
}
- if (!ar || ar->regiontype != RGN_TYPE_WINDOW) {
+ if (!region || region->regiontype != RGN_TYPE_WINDOW) {
return 0;
}
@@ -2812,7 +2816,7 @@ static bool text_region_scroll_poll(bContext *C)
static int text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceText *st = CTX_wm_space_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
TextScroll *tsc;
const int *mval = event->mval;
enum eScrollZone zone = SCROLLHANDLE_INVALID_OUTSIDE;
@@ -2829,7 +2833,7 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *ev
/* mouse inside scroll handle */
zone = SCROLLHANDLE_BAR;
}
- else if (mval[1] > TXT_SCROLL_SPACE && mval[1] < ar->winy - TXT_SCROLL_SPACE) {
+ else if (mval[1] > TXT_SCROLL_SPACE && mval[1] < region->winy - TXT_SCROLL_SPACE) {
if (mval[1] < st->runtime.scroll_region_handle.ymin) {
zone = SCROLLHANDLE_MIN_OUTSIDE;
}
@@ -2851,12 +2855,12 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *ev
op->customdata = tsc;
st->flags |= ST_SCROLL_SELECT;
- text_scroll_state_init(tsc, st, ar);
+ text_scroll_state_init(tsc, st, region);
/* jump scroll, works in v2d but needs to be added here too :S */
if (event->type == MIDDLEMOUSE) {
- tsc->mval_prev[0] = ar->winrct.xmin + BLI_rcti_cent_x(&st->runtime.scroll_region_handle);
- tsc->mval_prev[1] = ar->winrct.ymin + BLI_rcti_cent_y(&st->runtime.scroll_region_handle);
+ tsc->mval_prev[0] = region->winrct.xmin + BLI_rcti_cent_x(&st->runtime.scroll_region_handle);
+ tsc->mval_prev[1] = region->winrct.ymin + BLI_rcti_cent_y(&st->runtime.scroll_region_handle);
tsc->is_first = false;
tsc->zone = SCROLLHANDLE_BAR;
@@ -2943,7 +2947,7 @@ static int flatten_column_to_offset(SpaceText *st, const char *str, int index)
return j;
}
-static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *ar, int *y)
+static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *region, int *y)
{
TextLine *linep = st->text->lines.first;
int i, lines;
@@ -2953,7 +2957,7 @@ static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *ar, int *y)
}
for (i = -st->top; i <= *y && linep; linep = linep->next, i += lines) {
- lines = text_get_visible_lines(st, ar, linep->line);
+ lines = text_get_visible_lines(st, region, linep->line);
if (i + lines > *y) {
/* We found the line matching given vertical 'coordinate',
@@ -2966,15 +2970,15 @@ static TextLine *get_line_pos_wrapped(SpaceText *st, ARegion *ar, int *y)
}
static void text_cursor_set_to_pos_wrapped(
- SpaceText *st, ARegion *ar, int x, int y, const bool sel)
+ SpaceText *st, ARegion *region, int x, int y, const bool sel)
{
Text *text = st->text;
- int max = wrap_width(st, ar); /* column */
- int charp = -1; /* mem */
- bool found = false; /* flags */
+ int max = wrap_width(st, region); /* column */
+ int charp = -1; /* mem */
+ bool found = false; /* flags */
/* Point to line matching given y position, if any. */
- TextLine *linep = get_line_pos_wrapped(st, ar, &y);
+ TextLine *linep = get_line_pos_wrapped(st, region, &y);
if (linep) {
int i = 0, start = 0, end = max; /* column */
@@ -3090,11 +3094,11 @@ static void text_cursor_set_to_pos_wrapped(
}
}
-static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, const bool sel)
+static void text_cursor_set_to_pos(SpaceText *st, ARegion *region, int x, int y, const bool sel)
{
Text *text = st->text;
text_update_character_width(st);
- y = (ar->winy - 2 - y) / TXT_LINE_HEIGHT(st);
+ y = (region->winy - 2 - y) / TXT_LINE_HEIGHT(st);
x -= TXT_BODY_LEFT(st);
if (x < 0) {
@@ -3103,7 +3107,7 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, con
x = text_pixel_x_to_column(st, x) + st->left;
if (st->wordwrap) {
- text_cursor_set_to_pos_wrapped(st, ar, x, y, sel);
+ text_cursor_set_to_pos_wrapped(st, region, x, y, sel);
}
else {
TextLine **linep;
@@ -3173,24 +3177,25 @@ static void text_cursor_timer_remove(bContext *C, SetSelection *ssel)
static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceText *st = CTX_wm_space_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SetSelection *ssel = op->customdata;
- if (event->mval[1] < 0 || event->mval[1] > ar->winy) {
+ if (event->mval[1] < 0 || event->mval[1] > region->winy) {
text_cursor_timer_ensure(C, ssel);
if (event->type == TIMER) {
- text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
- text_scroll_to_cursor(st, ar, false);
+ text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1);
+ text_scroll_to_cursor(st, region, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
}
}
- else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > ar->winx)) {
+ else if (!st->wordwrap && (event->mval[0] < 0 || event->mval[0] > region->winx)) {
text_cursor_timer_ensure(C, ssel);
if (event->type == TIMER) {
- text_cursor_set_to_pos(st, ar, CLAMPIS(event->mval[0], 0, ar->winx), event->mval[1], 1);
- text_scroll_to_cursor(st, ar, false);
+ text_cursor_set_to_pos(
+ st, region, CLAMPIS(event->mval[0], 0, region->winx), event->mval[1], 1);
+ text_scroll_to_cursor(st, region, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
}
}
@@ -3198,8 +3203,8 @@ static void text_cursor_set_apply(bContext *C, wmOperator *op, const wmEvent *ev
text_cursor_timer_remove(C, ssel);
if (event->type != TIMER) {
- text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
- text_scroll_to_cursor(st, ar, false);
+ text_cursor_set_to_pos(st, region, event->mval[0], event->mval[1], 1);
+ text_scroll_to_cursor(st, region, false);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
ssel->mval_prev[0] = event->mval[0];
@@ -3298,11 +3303,11 @@ void TEXT_OT_selection_set(wmOperatorType *ot)
static int text_cursor_set_exec(bContext *C, wmOperator *op)
{
SpaceText *st = CTX_wm_space_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
int x = RNA_int_get(op->ptr, "x");
int y = RNA_int_get(op->ptr, "y");
- text_cursor_set_to_pos(st, ar, x, y, 0);
+ text_cursor_set_to_pos(st, region, x, y, 0);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
@@ -3351,7 +3356,7 @@ static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), const wm
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const int *mval = event->mval;
double time;
static int jump_to = 0;
@@ -3365,7 +3370,7 @@ static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), const wm
if (!(mval[0] > 2 &&
mval[0] < (TXT_NUMCOL_WIDTH(st) + (TXT_BODY_LPAD * st->runtime.cwidth_px)) &&
- mval[1] > 2 && mval[1] < ar->winy - 2)) {
+ mval[1] > 2 && mval[1] < region->winy - 2)) {
return OPERATOR_PASS_THROUGH;
}
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c
index d62fcf45d68..facdba46b21 100644
--- a/source/blender/editors/space_topbar/space_topbar.c
+++ b/source/blender/editors/space_topbar/space_topbar.c
@@ -54,26 +54,26 @@
static SpaceLink *topbar_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceTopBar *stopbar;
stopbar = MEM_callocN(sizeof(*stopbar), "init topbar");
stopbar->spacetype = SPACE_TOPBAR;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "left aligned header for topbar");
- BLI_addtail(&stopbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_TOP;
- ar = MEM_callocN(sizeof(ARegion), "right aligned header for topbar");
- BLI_addtail(&stopbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_RIGHT | RGN_SPLIT_PREV;
+ region = MEM_callocN(sizeof(ARegion), "left aligned header for topbar");
+ BLI_addtail(&stopbar->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = RGN_ALIGN_TOP;
+ region = MEM_callocN(sizeof(ARegion), "right aligned header for topbar");
+ BLI_addtail(&stopbar->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = RGN_ALIGN_RIGHT | RGN_SPLIT_PREV;
/* main regions */
- ar = MEM_callocN(sizeof(ARegion), "main region of topbar");
- BLI_addtail(&stopbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ region = MEM_callocN(sizeof(ARegion), "main region of topbar");
+ BLI_addtail(&stopbar->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)stopbar;
}
@@ -121,17 +121,17 @@ static void topbar_keymap(struct wmKeyConfig *UNUSED(keyconf))
}
/* add handlers, stuff you only do once or on area/region changes */
-static void topbar_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void topbar_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- if (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_RIGHT) {
- ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
+ if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT) {
+ region->flag |= RGN_FLAG_DYNAMIC_SIZE;
}
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
static void topbar_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -139,22 +139,22 @@ static void topbar_main_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_HISTORY) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_MODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_VIEW3D) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if (wmn->data == ND_DATA) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -162,7 +162,7 @@ static void topbar_main_region_listener(wmWindow *UNUSED(win),
static void topbar_header_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -170,22 +170,22 @@ static void topbar_header_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_JOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_INFO) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
if (wmn->data == ND_LAYER) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_SCENEBROWSE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -196,12 +196,12 @@ static void topbar_header_region_message_subscribe(const struct bContext *UNUSED
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(sa),
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 731c8a3028e..e3c1170ddba 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -47,45 +47,45 @@
static SpaceLink *userpref_new(const ScrArea *area, const Scene *UNUSED(scene))
{
- ARegion *ar;
+ ARegion *region;
SpaceUserPref *spref;
spref = MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
spref->spacetype = SPACE_USERPREF;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for userpref");
+ region = MEM_callocN(sizeof(ARegion), "header for userpref");
- BLI_addtail(&spref->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
+ BLI_addtail(&spref->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
/* Ignore user preference "USER_HEADER_BOTTOM" here (always show bottom for new types). */
- ar->alignment = RGN_ALIGN_BOTTOM;
+ region->alignment = RGN_ALIGN_BOTTOM;
/* navigation region */
- ar = MEM_callocN(sizeof(ARegion), "navigation region for userpref");
+ region = MEM_callocN(sizeof(ARegion), "navigation region for userpref");
- BLI_addtail(&spref->regionbase, ar);
- ar->regiontype = RGN_TYPE_NAV_BAR;
- ar->alignment = RGN_ALIGN_LEFT;
+ BLI_addtail(&spref->regionbase, region);
+ region->regiontype = RGN_TYPE_NAV_BAR;
+ region->alignment = RGN_ALIGN_LEFT;
/* Use smaller size when opened in area like properties editor. */
if (area->winx && area->winx < 3.0f * UI_NAVIGATION_REGION_WIDTH * UI_DPI_FAC) {
- ar->sizex = UI_NARROW_NAVIGATION_REGION_WIDTH;
+ region->sizex = UI_NARROW_NAVIGATION_REGION_WIDTH;
}
/* execution region */
- ar = MEM_callocN(sizeof(ARegion), "execution region for userpref");
+ region = MEM_callocN(sizeof(ARegion), "execution region for userpref");
- BLI_addtail(&spref->regionbase, ar);
- ar->regiontype = RGN_TYPE_EXECUTE;
- ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
- ar->flag |= RGN_FLAG_DYNAMIC_SIZE;
+ BLI_addtail(&spref->regionbase, region);
+ region->regiontype = RGN_TYPE_EXECUTE;
+ region->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
+ region->flag |= RGN_FLAG_DYNAMIC_SIZE;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for userpref");
+ region = MEM_callocN(sizeof(ARegion), "main region for userpref");
- BLI_addtail(&spref->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&spref->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
return (SpaceLink *)spref;
}
@@ -111,18 +111,18 @@ static SpaceLink *userpref_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void userpref_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void userpref_main_region_init(wmWindowManager *wm, ARegion *region)
{
/* do not use here, the properties changed in userprefs do a system-wide refresh,
* then scroller jumps back */
- /* ar->v2d.flag &= ~V2D_IS_INITIALISED; */
+ /* region->v2d.flag &= ~V2D_IS_INITIALISED; */
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
}
-static void userpref_main_region_layout(const bContext *C, ARegion *ar)
+static void userpref_main_region_layout(const bContext *C, ARegion *region)
{
char id_lower[64];
const char *contexts[2] = {id_lower, NULL};
@@ -142,7 +142,7 @@ static void userpref_main_region_layout(const bContext *C, ARegion *ar)
}
ED_region_panels_layout_ex(
- C, ar, &ar->type->paneltypes, contexts, U.space_data.section_active, true, NULL);
+ C, region, &region->type->paneltypes, contexts, U.space_data.section_active, true, NULL);
}
static void userpref_operatortypes(void)
@@ -154,39 +154,39 @@ static void userpref_keymap(struct wmKeyConfig *UNUSED(keyconf))
}
/* add handlers, stuff you only do once or on area/region changes */
-static void userpref_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
+static void userpref_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
{
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void userpref_header_region_draw(const bContext *C, ARegion *ar)
+static void userpref_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
/* add handlers, stuff you only do once or on area/region changes */
-static void userpref_navigation_region_init(wmWindowManager *wm, ARegion *ar)
+static void userpref_navigation_region_init(wmWindowManager *wm, ARegion *region)
{
- ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
+ region->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
}
-static void userpref_navigation_region_draw(const bContext *C, ARegion *ar)
+static void userpref_navigation_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels(C, ar);
+ ED_region_panels(C, region);
}
/* add handlers, stuff you only do once or on area/region changes */
-static void userpref_execute_region_init(wmWindowManager *wm, ARegion *ar)
+static void userpref_execute_region_init(wmWindowManager *wm, ARegion *region)
{
- ED_region_panels_init(wm, ar);
- ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
+ ED_region_panels_init(wm, region);
+ region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
}
static void userpref_main_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
@@ -195,7 +195,7 @@ static void userpref_main_region_listener(wmWindow *UNUSED(win),
static void userpref_header_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
@@ -210,7 +210,7 @@ static void userpref_header_listener(wmWindow *UNUSED(win),
static void userpref_navigation_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
@@ -219,7 +219,7 @@ static void userpref_navigation_region_listener(wmWindow *UNUSED(win),
static void userpref_execute_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *UNUSED(ar),
+ ARegion *UNUSED(region),
wmNotifier *UNUSED(wmn),
const Scene *UNUSED(scene))
{
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index df743415fec..a8514967748 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -89,9 +89,9 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
if (rv3d == NULL) {
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacetype == SPACE_VIEW3D) {
- ARegion *ar = BKE_area_find_region_active_win(sa);
- if (ar) {
- rv3d = ar->regiondata;
+ ARegion *region = BKE_area_find_region_active_win(sa);
+ if (region) {
+ rv3d = region->regiondata;
}
}
}
@@ -99,7 +99,7 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
}
/* ideally would return an rv3d but in some cases the region is needed too
- * so return that, the caller can then access the ar->regiondata */
+ * so return that, the caller can then access the region->regiondata */
bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
{
ScrArea *sa = CTX_wm_area(C);
@@ -108,28 +108,28 @@ bool ED_view3d_context_user_region(bContext *C, View3D **r_v3d, ARegion **r_ar)
*r_ar = NULL;
if (sa && sa->spacetype == SPACE_VIEW3D) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = (View3D *)sa->spacedata.first;
- if (ar) {
+ if (region) {
RegionView3D *rv3d;
- if ((ar->regiontype == RGN_TYPE_WINDOW) && (rv3d = ar->regiondata) &&
+ if ((region->regiontype == RGN_TYPE_WINDOW) && (rv3d = region->regiondata) &&
(rv3d->viewlock & RV3D_LOCKED) == 0) {
*r_v3d = v3d;
- *r_ar = ar;
+ *r_ar = region;
return true;
}
else {
ARegion *ar_unlock_user = NULL;
ARegion *ar_unlock = NULL;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (region = sa->regionbase.first; region; region = region->next) {
/* find the first unlocked rv3d */
- if (ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
- rv3d = ar->regiondata;
+ if (region->regiondata && region->regiontype == RGN_TYPE_WINDOW) {
+ rv3d = region->regiondata;
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
- ar_unlock = ar;
+ ar_unlock = region;
if (rv3d->persp == RV3D_PERSP || rv3d->persp == RV3D_CAMOB) {
- ar_unlock_user = ar;
+ ar_unlock_user = region;
break;
}
}
@@ -201,16 +201,16 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d)
}
#endif
-void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *ar)
+void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->render_engine) {
#ifdef WITH_PYTHON
BPy_BEGIN_ALLOW_THREADS;
#endif
- WM_jobs_kill_type(wm, ar, WM_JOB_TYPE_RENDER_PREVIEW);
+ WM_jobs_kill_type(wm, region, WM_JOB_TYPE_RENDER_PREVIEW);
#ifdef WITH_PYTHON
BPy_END_ALLOW_THREADS;
@@ -226,11 +226,11 @@ void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *sa)
wmWindowManager *wm = bmain->wm.first;
if (v3d->shading.type != OB_RENDER) {
- ARegion *ar;
+ ARegion *region;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if ((ar->regiontype == RGN_TYPE_WINDOW) && ar->regiondata) {
- ED_view3d_stop_render_preview(wm, ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if ((region->regiontype == RGN_TYPE_WINDOW) && region->regiondata) {
+ ED_view3d_stop_render_preview(wm, region);
break;
}
}
@@ -241,7 +241,7 @@ void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *sa)
static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
{
- ARegion *ar;
+ ARegion *region;
View3D *v3d;
RegionView3D *rv3d;
@@ -252,44 +252,44 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
}
/* tool header */
- ar = MEM_callocN(sizeof(ARegion), "tool header for view3d");
+ region = MEM_callocN(sizeof(ARegion), "tool header for view3d");
- BLI_addtail(&v3d->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOL_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
- ar->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
+ BLI_addtail(&v3d->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOL_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
/* header */
- ar = MEM_callocN(sizeof(ARegion), "header for view3d");
+ region = MEM_callocN(sizeof(ARegion), "header for view3d");
- BLI_addtail(&v3d->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addtail(&v3d->regionbase, region);
+ region->regiontype = RGN_TYPE_HEADER;
+ region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* tool shelf */
- ar = MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
+ region = MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
- BLI_addtail(&v3d->regionbase, ar);
- ar->regiontype = RGN_TYPE_TOOLS;
- ar->alignment = RGN_ALIGN_LEFT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&v3d->regionbase, region);
+ region->regiontype = RGN_TYPE_TOOLS;
+ region->alignment = RGN_ALIGN_LEFT;
+ region->flag = RGN_FLAG_HIDDEN;
/* buttons/list view */
- ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
+ region = MEM_callocN(sizeof(ARegion), "buttons for view3d");
- BLI_addtail(&v3d->regionbase, ar);
- ar->regiontype = RGN_TYPE_UI;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
+ BLI_addtail(&v3d->regionbase, region);
+ region->regiontype = RGN_TYPE_UI;
+ region->alignment = RGN_ALIGN_RIGHT;
+ region->flag = RGN_FLAG_HIDDEN;
/* main region */
- ar = MEM_callocN(sizeof(ARegion), "main region for view3d");
+ region = MEM_callocN(sizeof(ARegion), "main region for view3d");
- BLI_addtail(&v3d->regionbase, ar);
- ar->regiontype = RGN_TYPE_WINDOW;
+ BLI_addtail(&v3d->regionbase, region);
+ region->regiontype = RGN_TYPE_WINDOW;
- ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region view3d");
- rv3d = ar->regiondata;
+ region->regiondata = MEM_callocN(sizeof(RegionView3D), "region view3d");
+ rv3d = region->regiondata;
rv3d->viewquat[0] = 1.0f;
rv3d->persp = RV3D_PERSP;
rv3d->view = RV3D_VIEW_USER;
@@ -353,7 +353,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
}
/* add handlers, stuff you only do once or on area/region changes */
-static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
+static void view3d_main_region_init(wmWindowManager *wm, ARegion *region)
{
ListBase *lb;
wmKeyMap *keymap;
@@ -362,78 +362,78 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
/* important to be before Pose keymap since they can both be enabled at once */
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Face Mask (Weight, Vertex, Texture)", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Vertex Selection (Weight, Vertex)", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
/* Before 'Pose' so weight paint menus aren't overridden by pose menus. */
keymap = WM_keymap_ensure(wm->defaultconf, "Weight Paint", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Vertex Paint", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
/* pose is not modal, operator poll checks for this */
keymap = WM_keymap_ensure(wm->defaultconf, "Pose", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Object Mode", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Curve", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Image Paint", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Sculpt", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Mesh", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Armature", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Metaball", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Lattice", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Particle", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
/* editfont keymap swallows all... */
keymap = WM_keymap_ensure(wm->defaultconf, "Font", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Object Non-modal", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "Frames", 0, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
/* own keymap, last so modes can override it */
keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
keymap = WM_keymap_ensure(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
/* add drop boxes */
lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
- WM_event_add_dropbox_handler(&ar->handlers, lb);
+ WM_event_add_dropbox_handler(&region->handlers, lb);
}
-static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar)
+static void view3d_main_region_exit(wmWindowManager *wm, ARegion *region)
{
- ED_view3d_stop_render_preview(wm, ar);
+ ED_view3d_stop_render_preview(wm, region);
}
static bool view3d_ob_drop_poll(bContext *UNUSED(C),
@@ -632,9 +632,9 @@ static void view3d_widgets(void)
}
/* type callback, not region itself */
-static void view3d_main_region_free(ARegion *ar)
+static void view3d_main_region_free(ARegion *region)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d) {
if (rv3d->localvd) {
@@ -659,7 +659,7 @@ static void view3d_main_region_free(ARegion *ar)
}
MEM_freeN(rv3d);
- ar->regiondata = NULL;
+ region->regiondata = NULL;
}
}
@@ -688,11 +688,11 @@ static void *view3d_main_region_duplicate(void *poin)
}
static void view3d_main_region_listener(
- wmWindow *UNUSED(win), ScrArea *sa, ARegion *ar, wmNotifier *wmn, const Scene *scene)
+ wmWindow *UNUSED(win), ScrArea *sa, ARegion *region, wmNotifier *wmn, const Scene *scene)
{
View3D *v3d = sa->spacedata.first;
- RegionView3D *rv3d = ar->regiondata;
- wmGizmoMap *gzmap = ar->gizmo_map;
+ RegionView3D *rv3d = region->regiondata;
+ wmGizmoMap *gzmap = region->gizmo_map;
/* context changes */
switch (wmn->category) {
@@ -705,17 +705,17 @@ static void view3d_main_region_listener(
switch (wmn->data) {
case ND_KEYFRAME_PROP:
case ND_NLA_ACTCHANGE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_NLA:
case ND_KEYFRAME:
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case ND_ANIMCHAN:
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -724,14 +724,14 @@ static void view3d_main_region_listener(
switch (wmn->data) {
case ND_SCENEBROWSE:
case ND_LAYER_CONTENT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
break;
case ND_LAYER:
if (wmn->reference) {
BKE_screen_view3d_sync(v3d, wmn->reference);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
break;
case ND_OB_ACTIVE:
@@ -743,7 +743,7 @@ static void view3d_main_region_listener(
case ND_RENDER_OPTIONS:
case ND_MARKERS:
case ND_MODE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
break;
case ND_WORLD:
@@ -752,14 +752,14 @@ static void view3d_main_region_listener(
case ND_DRAW_RENDER_VIEWPORT: {
if (v3d->camera && (scene == wmn->reference)) {
if (rv3d->persp == RV3D_CAMOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
break;
}
}
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_OBJECT:
@@ -775,13 +775,13 @@ static void view3d_main_region_listener(
case ND_PARTICLE:
case ND_POINTCACHE:
case ND_LOD:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
break;
}
switch (wmn->action) {
case NA_ADDED:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -792,16 +792,16 @@ static void view3d_main_region_listener(
ATTR_FALLTHROUGH;
}
case ND_DATA:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
break;
case ND_VERTEX_GROUP:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
switch (wmn->action) {
case NA_EDITED:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -810,7 +810,7 @@ static void view3d_main_region_listener(
case ND_DRAW_RENDER_VIEWPORT: {
if (v3d->camera && (v3d->camera->data == wmn->reference)) {
if (rv3d->persp == RV3D_CAMOB) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
break;
@@ -819,17 +819,17 @@ static void view3d_main_region_listener(
break;
case NC_GROUP:
/* all group ops for now */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_BRUSH:
switch (wmn->action) {
case NA_EDITED:
- ED_region_tag_redraw_cursor(ar);
+ ED_region_tag_redraw_cursor(region);
break;
case NA_SELECTED:
/* used on brush changes - needed because 3d cursor
* has to be drawn if clone brush is selected */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -842,11 +842,11 @@ static void view3d_main_region_listener(
*
* How to solve?
*/
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_SHADING_DRAW:
case ND_SHADING_LINKS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -857,7 +857,7 @@ static void view3d_main_region_listener(
break;
case ND_WORLD:
/* Needed for updating world materials */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -867,10 +867,10 @@ static void view3d_main_region_listener(
/* TODO(sergey): This is a bit too much, but needed to
* handle updates from new depsgraph.
*/
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_LIGHTING_DRAW:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
break;
}
@@ -881,15 +881,15 @@ static void view3d_main_region_listener(
case NC_IMAGE:
/* this could be more fine grained checks if we had
* more context than just the region */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_TEXTURE:
/* same as above */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_MOVIECLIP:
if (wmn->data == ND_DISPLAY || wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
@@ -897,36 +897,36 @@ static void view3d_main_region_listener(
if (wmn->subtype == NS_VIEW3D_GPU) {
rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
WM_gizmomap_tag_refresh(gzmap);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCREEN:
switch (wmn->data) {
case ND_ANIMPLAY:
case ND_SKETCH:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_LAYOUTBROWSE:
case ND_LAYOUTDELETE:
case ND_LAYOUTSET:
WM_gizmomap_tag_refresh(gzmap);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_LAYER:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_GPENCIL:
if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -937,7 +937,7 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
/* Developer note: there are many properties that impact 3D view drawing,
@@ -968,8 +968,8 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
};
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -979,7 +979,7 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
}
/* Subscribe to a handful of other properties. */
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
WM_msg_subscribe_rna_anon_prop(mbus, RenderSettings, engine, &msg_sub_value_region_tag_redraw);
WM_msg_subscribe_rna_anon_prop(
@@ -1013,7 +1013,7 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
{
wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = sa,
.notify = WM_toolsystem_do_msg_notify_tag_refresh,
};
@@ -1022,31 +1022,31 @@ static void view3d_main_region_message_subscribe(const struct bContext *C,
}
}
-static void view3d_main_region_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
+static void view3d_main_region_cursor(wmWindow *win, ScrArea *sa, ARegion *region)
{
- if (!WM_cursor_set_from_tool(win, sa, ar)) {
+ if (!WM_cursor_set_from_tool(win, sa, region)) {
WM_cursor_set(win, WM_CURSOR_DEFAULT);
}
}
/* add handlers, stuff you only do once or on area/region changes */
-static void view3d_header_region_init(wmWindowManager *wm, ARegion *ar)
+static void view3d_header_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
- ED_region_header_init(ar);
+ ED_region_header_init(region);
}
-static void view3d_header_region_draw(const bContext *C, ARegion *ar)
+static void view3d_header_region_draw(const bContext *C, ARegion *region)
{
- ED_region_header(C, ar);
+ ED_region_header(C, region);
}
static void view3d_header_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -1063,25 +1063,25 @@ static void view3d_header_region_listener(wmWindow *UNUSED(win),
case ND_TOOLSETTINGS:
case ND_LAYER_CONTENT:
case ND_RENDER_OPTIONS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_VIEW3D) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if (wmn->data & ND_GPENCIL_EDITMODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
else if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_BRUSH:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
@@ -1092,22 +1092,22 @@ static void view3d_header_region_listener(wmWindow *UNUSED(win),
switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_HISTORY) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SCENE:
if (wmn->data == ND_MODE) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_VIEW3D) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if (wmn->data == ND_DATA) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -1119,7 +1119,7 @@ static void view3d_header_region_message_subscribe(const struct bContext *UNUSED
struct Scene *UNUSED(scene),
struct bScreen *UNUSED(screen),
struct ScrArea *UNUSED(sa),
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus)
{
wmMsgParams_RNA msg_key_params = {{0}};
@@ -1130,8 +1130,8 @@ static void view3d_header_region_message_subscribe(const struct bContext *UNUSED
};
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
@@ -1142,18 +1142,18 @@ static void view3d_header_region_message_subscribe(const struct bContext *UNUSED
}
/* add handlers, stuff you only do once or on area/region changes */
-static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *ar)
+static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
void ED_view3d_buttons_region_layout_ex(const bContext *C,
- ARegion *ar,
+ ARegion *region,
const char *category_override)
{
const enum eContextObjectMode mode = CTX_data_mode_enum(C);
@@ -1236,7 +1236,7 @@ void ED_view3d_buttons_region_layout_ex(const bContext *C,
break;
}
- ListBase *paneltypes = &ar->type->paneltypes;
+ ListBase *paneltypes = &region->type->paneltypes;
/* Allow drawing 3D view toolbar from non 3D view space type. */
if (category_override != NULL) {
@@ -1246,17 +1246,18 @@ void ED_view3d_buttons_region_layout_ex(const bContext *C,
}
const bool vertical = true;
- ED_region_panels_layout_ex(C, ar, paneltypes, contexts_base, -1, vertical, category_override);
+ ED_region_panels_layout_ex(
+ C, region, paneltypes, contexts_base, -1, vertical, category_override);
}
-static void view3d_buttons_region_layout(const bContext *C, ARegion *ar)
+static void view3d_buttons_region_layout(const bContext *C, ARegion *region)
{
- ED_view3d_buttons_region_layout_ex(C, ar, NULL);
+ ED_view3d_buttons_region_layout_ex(C, region, NULL);
}
static void view3d_buttons_region_listener(wmWindow *UNUSED(win),
ScrArea *UNUSED(sa),
- ARegion *ar,
+ ARegion *region,
wmNotifier *wmn,
const Scene *UNUSED(scene))
{
@@ -1266,12 +1267,12 @@ static void view3d_buttons_region_listener(wmWindow *UNUSED(win),
switch (wmn->data) {
case ND_KEYFRAME_PROP:
case ND_NLA_ACTCHANGE:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case ND_NLA:
case ND_KEYFRAME:
if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
@@ -1286,12 +1287,12 @@ static void view3d_buttons_region_listener(wmWindow *UNUSED(win),
case ND_LAYER:
case ND_LAYER_CONTENT:
case ND_TOOLSETTINGS:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
switch (wmn->action) {
case NA_EDITED:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -1304,7 +1305,7 @@ static void view3d_buttons_region_listener(wmWindow *UNUSED(win),
case ND_DRAW:
case ND_KEYS:
case ND_MODIFIER:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
break;
@@ -1313,62 +1314,62 @@ static void view3d_buttons_region_listener(wmWindow *UNUSED(win),
case ND_DATA:
case ND_VERTEX_GROUP:
case ND_SELECT:
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
}
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_TEXTURE:
case NC_MATERIAL:
/* for brush textures */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
break;
case NC_BRUSH:
/* NA_SELECTED is used on brush changes */
if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_VIEW3D) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_ID:
if (wmn->action == NA_RENAME) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_GPENCIL:
if ((wmn->data & (ND_DATA | ND_GPENCIL_EDITMODE)) || (wmn->action == NA_EDITED)) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
case NC_IMAGE:
/* Update for the image layers in texture paint. */
if (wmn->action == NA_EDITED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
break;
}
}
/* add handlers, stuff you only do once or on area/region changes */
-static void view3d_tools_region_init(wmWindowManager *wm, ARegion *ar)
+static void view3d_tools_region_init(wmWindowManager *wm, ARegion *region)
{
wmKeyMap *keymap;
- ED_region_panels_init(wm, ar);
+ ED_region_panels_init(wm, region);
keymap = WM_keymap_ensure(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
+ WM_event_add_keymap_handler(&region->handlers, keymap);
}
-static void view3d_tools_region_draw(const bContext *C, ARegion *ar)
+static void view3d_tools_region_draw(const bContext *C, ARegion *region)
{
- ED_region_panels_ex(C, ar, (const char *[]){CTX_data_mode_string(C), NULL}, -1, true);
+ ED_region_panels_ex(C, region, (const char *[]){CTX_data_mode_string(C), NULL}, -1, true);
}
/* area (not region) level listener */
@@ -1473,7 +1474,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
static void view3d_id_remap(ScrArea *sa, SpaceLink *slink, ID *old_id, ID *new_id)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
bool is_local = false;
if (!ELEM(GS(old_id->name), ID_OB, ID_MA, ID_IM, ID_MC)) {
@@ -1487,10 +1488,10 @@ static void view3d_id_remap(ScrArea *sa, SpaceLink *slink, ID *old_id, ID *new_i
/* 3D view might be inactive, in that case needs to use slink->regionbase */
ListBase *regionbase = (slink == sa->spacedata.first) ? &sa->regionbase :
&slink->regionbase;
- for (ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = is_local ? ((RegionView3D *)ar->regiondata)->localvd :
- ar->regiondata;
+ for (region = regionbase->first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = is_local ? ((RegionView3D *)region->regiondata)->localvd :
+ region->regiondata;
if (rv3d && (rv3d->persp == RV3D_CAMOB)) {
rv3d->persp = RV3D_PERSP;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 101e04664ec..4e2aada1e26 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -111,20 +111,20 @@
void ED_view3d_update_viewmat(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const rcti *rect,
bool offscreen)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* setup window matrices */
if (winmat) {
copy_m4_m4(rv3d->winmat, winmat);
}
else {
- view3d_winmatrix_set(depsgraph, ar, v3d, rect);
+ view3d_winmatrix_set(depsgraph, region, v3d, rect);
}
/* setup view matrix */
@@ -134,8 +134,8 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
else {
float rect_scale[2];
if (rect) {
- rect_scale[0] = (float)BLI_rcti_size_x(rect) / (float)ar->winx;
- rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)ar->winy;
+ rect_scale[0] = (float)BLI_rcti_size_x(rect) / (float)region->winx;
+ rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)region->winy;
}
/* note: calls BKE_object_where_is_calc for camera... */
view3d_viewmatrix_set(depsgraph, scene, v3d, rv3d, rect ? rect_scale : NULL);
@@ -150,12 +150,12 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
/* store window coordinates scaling/offset */
if (!offscreen && rv3d->persp == RV3D_CAMOB && v3d->camera) {
rctf cameraborder;
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &cameraborder, false);
- rv3d->viewcamtexcofac[0] = (float)ar->winx / BLI_rctf_size_x(&cameraborder);
- rv3d->viewcamtexcofac[1] = (float)ar->winy / BLI_rctf_size_y(&cameraborder);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &cameraborder, false);
+ rv3d->viewcamtexcofac[0] = (float)region->winx / BLI_rctf_size_x(&cameraborder);
+ rv3d->viewcamtexcofac[1] = (float)region->winy / BLI_rctf_size_y(&cameraborder);
- rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)ar->winx;
- rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)ar->winy;
+ rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)region->winx;
+ rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)region->winy;
}
else {
rv3d->viewcamtexcofac[0] = rv3d->viewcamtexcofac[1] = 1.0f;
@@ -183,7 +183,7 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
len_sc = (float)max_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
}
else {
- len_sc = (float)MAX2(ar->winx, ar->winy);
+ len_sc = (float)MAX2(region->winx, region->winy);
}
rv3d->pixsize = len_px / len_sc;
@@ -193,14 +193,14 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
static void view3d_main_region_setup_view(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const rcti *rect)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
- ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, viewmat, winmat, rect, false);
+ ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, rect, false);
/* set for opengl */
GPU_matrix_projection_set(rv3d->winmat);
@@ -210,12 +210,12 @@ static void view3d_main_region_setup_view(Depsgraph *depsgraph,
static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
float viewmat[4][4],
float winmat[4][4])
{
- RegionView3D *rv3d = ar->regiondata;
- ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, viewmat, winmat, NULL, true);
+ RegionView3D *rv3d = region->regiondata;
+ ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, NULL, true);
/* set for opengl */
GPU_matrix_projection_set(rv3d->winmat);
@@ -264,7 +264,7 @@ static bool view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, Reg
* view3d)main_region_setup_view() code to account for that.
*/
static void view3d_stereo3d_setup(
- Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *ar, const rcti *rect)
+ Depsgraph *depsgraph, Scene *scene, View3D *v3d, ARegion *region, const rcti *rect)
{
bool is_left;
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
@@ -293,7 +293,7 @@ static void view3d_stereo3d_setup(
data_eval->shiftx = BKE_camera_multiview_shift_x(&scene->r, v3d->camera, viewname);
BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat);
- view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, NULL, rect);
+ view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, NULL, rect);
data_eval->shiftx = shiftx;
BLI_thread_unlock(LOCK_VIEW3D);
@@ -307,7 +307,7 @@ static void view3d_stereo3d_setup(
v3d->camera = camera;
BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat);
- view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, NULL, rect);
+ view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, NULL, rect);
v3d->camera = view_ob;
BLI_thread_unlock(LOCK_VIEW3D);
@@ -320,20 +320,20 @@ static void view3d_stereo3d_setup(
void ED_view3d_draw_setup_view(wmWindow *win,
Depsgraph *depsgraph,
Scene *scene,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
float viewmat[4][4],
float winmat[4][4],
const rcti *rect)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* Setup the view matrix. */
if (view3d_stereo3d_active(win, scene, v3d, rv3d)) {
- view3d_stereo3d_setup(depsgraph, scene, v3d, ar, rect);
+ view3d_stereo3d_setup(depsgraph, scene, v3d, region, rect);
}
else {
- view3d_main_region_setup_view(depsgraph, scene, v3d, ar, viewmat, winmat, rect);
+ view3d_main_region_setup_view(depsgraph, scene, v3d, region, viewmat, winmat, rect);
}
}
@@ -345,7 +345,7 @@ void ED_view3d_draw_setup_view(wmWindow *win,
static void view3d_camera_border(const Scene *scene,
struct Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d,
const RegionView3D *rv3d,
rctf *r_viewborder,
@@ -362,7 +362,7 @@ static void view3d_camera_border(const Scene *scene,
if (no_zoom) {
params.zoom = 1.0f;
}
- BKE_camera_params_compute_viewplane(&params, ar->winx, ar->winy, 1.0f, 1.0f);
+ BKE_camera_params_compute_viewplane(&params, region->winx, region->winy, 1.0f, 1.0f);
rect_view = params.viewplane;
/* get camera viewplane */
@@ -381,38 +381,38 @@ static void view3d_camera_border(const Scene *scene,
/* get camera border within viewport */
r_viewborder->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) *
- ar->winx;
+ region->winx;
r_viewborder->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) *
- ar->winx;
+ region->winx;
r_viewborder->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) *
- ar->winy;
+ region->winy;
r_viewborder->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) *
- ar->winy;
+ region->winy;
}
void ED_view3d_calc_camera_border_size(const Scene *scene,
Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d,
const RegionView3D *rv3d,
float r_size[2])
{
rctf viewborder;
- view3d_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewborder, true, true);
+ view3d_camera_border(scene, depsgraph, region, v3d, rv3d, &viewborder, true, true);
r_size[0] = BLI_rctf_size_x(&viewborder);
r_size[1] = BLI_rctf_size_y(&viewborder);
}
void ED_view3d_calc_camera_border(const Scene *scene,
Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d,
const RegionView3D *rv3d,
rctf *r_viewborder,
const bool no_shift)
{
- view3d_camera_border(scene, depsgraph, ar, v3d, rv3d, r_viewborder, no_shift, false);
+ view3d_camera_border(scene, depsgraph, region, v3d, rv3d, r_viewborder, no_shift, false);
}
static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, float y2, float fac)
@@ -495,14 +495,14 @@ static void drawviewborder_triangle(
immEnd();
}
-static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View3D *v3d)
+static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, View3D *v3d)
{
float x1, x2, y1, y2;
float x1i, x2i, y1i, y2i;
rctf viewborder;
Camera *ca = NULL;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (v3d->camera == NULL) {
return;
@@ -511,7 +511,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
ca = v3d->camera->data;
}
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewborder, false);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &viewborder, false);
/* the offsets */
x1 = viewborder.xmin;
y1 = viewborder.ymin;
@@ -541,8 +541,8 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
/* passepartout, specified in camera edit buttons */
if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
- const float winx = (ar->winx + 1);
- const float winy = (ar->winy + 1);
+ const float winx = (region->winx + 1);
+ const float winy = (region->winy + 1);
float alpha = 1.0f;
@@ -753,7 +753,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
}
}
-static void drawrenderborder(ARegion *ar, View3D *v3d)
+static void drawrenderborder(ARegion *region, View3D *v3d)
{
/* use the same program for everything */
uint shdr_pos = GPU_vertformat_attr_add(
@@ -773,19 +773,19 @@ static void drawrenderborder(ARegion *ar, View3D *v3d)
immUniform1f("dash_factor", 0.5f);
imm_draw_box_wire_2d(shdr_pos,
- v3d->render_border.xmin * ar->winx,
- v3d->render_border.ymin * ar->winy,
- v3d->render_border.xmax * ar->winx,
- v3d->render_border.ymax * ar->winy);
+ v3d->render_border.xmin * region->winx,
+ v3d->render_border.ymin * region->winy,
+ v3d->render_border.xmax * region->winx,
+ v3d->render_border.ymax * region->winy);
immUnbindProgram();
}
-void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool alphaoverride)
+void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *region, View3D *v3d, bool alphaoverride)
{
struct bThemeState theme_state;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
short flag = v3d->flag;
float glalphaclip = U.glalphaclip;
@@ -800,7 +800,7 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
UI_Theme_Store(&theme_state);
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
- ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL);
+ ED_view3d_draw_setup_view(NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL);
GPU_clear(GPU_DEPTH_BIT);
@@ -813,17 +813,17 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
GPU_depth_test(true);
/* Needed in cases the view-port isn't already setup. */
- WM_draw_region_viewport_ensure(ar, SPACE_VIEW3D);
- WM_draw_region_viewport_bind(ar);
+ WM_draw_region_viewport_ensure(region, SPACE_VIEW3D);
+ WM_draw_region_viewport_bind(region);
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, 0);
/* When Blender is starting, a click event can trigger a depth test while the viewport is not
* yet available. */
if (viewport != NULL) {
- DRW_draw_depth_loop(depsgraph, ar, v3d, viewport, false);
+ DRW_draw_depth_loop(depsgraph, region, v3d, viewport, false);
}
- WM_draw_region_viewport_unbind(ar);
+ WM_draw_region_viewport_unbind(region);
if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) {
ED_view3d_clipping_disable();
@@ -1140,18 +1140,18 @@ static void draw_rotation_guide(const RegionView3D *rv3d)
/**
* Render and camera border
*/
-static void view3d_draw_border(const bContext *C, ARegion *ar)
+static void view3d_draw_border(const bContext *C, ARegion *region)
{
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
View3D *v3d = CTX_wm_view3d(C);
if (rv3d->persp == RV3D_CAMOB) {
- drawviewborder(scene, depsgraph, ar, v3d);
+ drawviewborder(scene, depsgraph, region, v3d);
}
else if (v3d->flag2 & V3D_RENDER_BORDER) {
- drawrenderborder(ar, v3d);
+ drawrenderborder(region, v3d);
}
}
@@ -1255,9 +1255,9 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
return name;
}
-static void draw_viewport_name(ARegion *ar, View3D *v3d, int xoffset, int *yoffset)
+static void draw_viewport_name(ARegion *region, View3D *v3d, int xoffset, int *yoffset)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
const char *name = view3d_get_name(v3d, rv3d);
const char *name_array[3] = {name, NULL, NULL};
int name_array_len = 1;
@@ -1470,9 +1470,9 @@ static void draw_grid_unit_name(
/**
* Information drawn on top of the solid plates and composed data
*/
-void view3d_draw_region_info(const bContext *C, ARegion *ar)
+void view3d_draw_region_info(const bContext *C, ARegion *region)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
wmWindowManager *wm = CTX_wm_manager(C);
@@ -1486,12 +1486,12 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
#endif
/* correct projection matrix */
- ED_region_pixelspace(ar);
+ ED_region_pixelspace(region);
/* local coordinate visible rect inside region, to accommodate overlapping ui */
- const rcti *rect = ED_region_visible_rect(ar);
+ const rcti *rect = ED_region_visible_rect(region);
- view3d_draw_border(C, ar);
+ view3d_draw_border(C, region);
view3d_draw_grease_pencil(C);
BLF_batch_draw_begin();
@@ -1519,7 +1519,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
ED_scene_draw_fps(scene, xoffset, &yoffset);
}
else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
- draw_viewport_name(ar, v3d, xoffset, &yoffset);
+ draw_viewport_name(region, v3d, xoffset, &yoffset);
}
if (U.uiflag & USER_DRAWVIEWINFO) {
@@ -1547,12 +1547,12 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
/** \name Draw Viewport Contents
* \{ */
-static void view3d_draw_view(const bContext *C, ARegion *ar)
+static void view3d_draw_view(const bContext *C, ARegion *region)
{
ED_view3d_draw_setup_view(CTX_wm_window(C),
CTX_data_expect_evaluated_depsgraph(C),
CTX_data_scene(C),
- ar,
+ region,
CTX_wm_view3d(C),
NULL,
NULL,
@@ -1578,12 +1578,12 @@ RenderEngineType *ED_view3d_engine_type(Scene *scene, int drawtype)
}
}
-void view3d_main_region_draw(const bContext *C, ARegion *ar)
+void view3d_main_region_draw(const bContext *C, ARegion *region)
{
Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
- view3d_draw_view(C, ar);
+ view3d_draw_view(C, region);
DRW_cache_free_old_batches(bmain);
GPU_free_images_old(bmain);
@@ -1608,7 +1608,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar)
static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
float winmat[4][4],
const char *viewname)
{
@@ -1618,14 +1618,14 @@ static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph,
const bool is_left = STREQ(viewname, STEREO_LEFT_NAME);
BKE_camera_multiview_view_matrix(&scene->r, v3d->camera, is_left, viewmat);
- view3d_main_region_setup_offscreen(depsgraph, scene, v3d, ar, viewmat, winmat);
+ view3d_main_region_setup_offscreen(depsgraph, scene, v3d, region, viewmat, winmat);
}
else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
float viewmat[4][4];
Object *camera = BKE_camera_multiview_render(scene, v3d->camera, viewname);
BKE_camera_multiview_view_matrix(&scene->r, camera, false, viewmat);
- view3d_main_region_setup_offscreen(depsgraph, scene, v3d, ar, viewmat, winmat);
+ view3d_main_region_setup_offscreen(depsgraph, scene, v3d, region, viewmat, winmat);
}
}
@@ -1633,7 +1633,7 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
Scene *scene,
eDrawType drawtype,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
int winx,
int winy,
float viewmat[4][4],
@@ -1645,20 +1645,20 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
GPUOffScreen *ofs,
GPUViewport *viewport)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
RenderEngineType *engine_type = ED_view3d_engine_type(scene, drawtype);
/* set temporary new size */
- int bwinx = ar->winx;
- int bwiny = ar->winy;
- rcti brect = ar->winrct;
+ int bwinx = region->winx;
+ int bwiny = region->winy;
+ rcti brect = region->winrct;
- ar->winx = winx;
- ar->winy = winy;
- ar->winrct.xmin = 0;
- ar->winrct.ymin = 0;
- ar->winrct.xmax = winx;
- ar->winrct.ymax = winy;
+ region->winx = winx;
+ region->winy = winy;
+ region->winrct.xmin = 0;
+ region->winrct.ymin = 0;
+ region->winrct.xmax = winx;
+ region->winrct.ymax = winy;
struct bThemeState theme_state;
UI_Theme_Store(&theme_state);
@@ -1680,20 +1680,20 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
if ((viewname != NULL && viewname[0] != '\0') && (viewmat == NULL) &&
rv3d->persp == RV3D_CAMOB && v3d->camera) {
- view3d_stereo3d_setup_offscreen(depsgraph, scene, v3d, ar, winmat, viewname);
+ view3d_stereo3d_setup_offscreen(depsgraph, scene, v3d, region, winmat, viewname);
}
else {
- view3d_main_region_setup_offscreen(depsgraph, scene, v3d, ar, viewmat, winmat);
+ view3d_main_region_setup_offscreen(depsgraph, scene, v3d, region, viewmat, winmat);
}
/* main drawing call */
DRW_draw_render_loop_offscreen(
- depsgraph, engine_type, ar, v3d, do_sky, do_color_management, ofs, viewport);
+ depsgraph, engine_type, region, v3d, do_sky, do_color_management, ofs, viewport);
/* restore size */
- ar->winx = bwinx;
- ar->winy = bwiny;
- ar->winrct = brect;
+ region->winx = bwinx;
+ region->winy = bwiny;
+ region->winrct = brect;
GPU_matrix_pop_projection();
GPU_matrix_pop();
@@ -1713,7 +1713,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
Scene *scene,
eDrawType drawtype,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
int sizex,
int sizey,
eImBufFlags imbuf_flag,
@@ -1723,7 +1723,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
GPUOffScreen *ofs,
char err_out[256])
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
const bool draw_sky = (alpha_mode == R_ADDSKY);
/* view state */
@@ -1807,7 +1807,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
scene,
drawtype,
v3d,
- ar,
+ region,
sizex,
sizey,
NULL,
@@ -1869,13 +1869,13 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
char err_out[256])
{
View3D v3d = {NULL};
- ARegion ar = {NULL};
+ ARegion region = {NULL};
RegionView3D rv3d = {{{0}}};
/* connect data */
- v3d.regionbase.first = v3d.regionbase.last = &ar;
- ar.regiondata = &rv3d;
- ar.regiontype = RGN_TYPE_WINDOW;
+ v3d.regionbase.first = v3d.regionbase.last = &region;
+ region.regiondata = &rv3d;
+ region.regiontype = RGN_TYPE_WINDOW;
v3d.camera = camera;
View3DShading *source_shading_settings = &scene->display.shading;
@@ -1932,7 +1932,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
scene,
drawtype,
&v3d,
- &ar,
+ &region,
width,
height,
imbuf_flag,
@@ -1996,13 +1996,16 @@ void ED_view3d_clipping_enable(void)
/**
* \note Only use in object mode.
*/
-static void validate_object_select_id(
- struct Depsgraph *depsgraph, ViewLayer *view_layer, ARegion *ar, View3D *v3d, Object *obact)
+static void validate_object_select_id(struct Depsgraph *depsgraph,
+ ViewLayer *view_layer,
+ ARegion *region,
+ View3D *v3d,
+ Object *obact)
{
Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
- BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
- UNUSED_VARS_NDEBUG(ar);
+ BLI_assert(region->regiontype == RGN_TYPE_WINDOW);
+ UNUSED_VARS_NDEBUG(region);
if (obact_eval && (obact_eval->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) ||
BKE_paint_select_face_test(obact_eval))) {
@@ -2062,19 +2065,19 @@ void ED_view3d_select_id_validate(ViewContext *vc)
/* TODO: Create a flag in `DRW_manager` because the drawing is no longer
* made on the backbuffer in this case. */
if (vc->v3d->flag & V3D_INVALID_BACKBUF) {
- validate_object_select_id(vc->depsgraph, vc->view_layer, vc->ar, vc->v3d, vc->obact);
+ validate_object_select_id(vc->depsgraph, vc->view_layer, vc->region, vc->v3d, vc->obact);
}
}
void ED_view3d_backbuf_depth_validate(ViewContext *vc)
{
if (vc->v3d->flag & V3D_INVALID_BACKBUF) {
- ARegion *ar = vc->ar;
+ ARegion *region = vc->region;
Object *obact_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact);
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE_DEPSGRAPH) != 0)) {
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
- DRW_draw_depth_object(vc->ar, vc->v3d, viewport, obact_eval);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, 0);
+ DRW_draw_depth_object(vc->region, vc->v3d, viewport, obact_eval);
}
vc->v3d->flag &= ~V3D_INVALID_BACKBUF;
@@ -2085,21 +2088,21 @@ void ED_view3d_backbuf_depth_validate(ViewContext *vc)
* allow for small values [0.5 - 2.5],
* and large values, FLT_MAX by clamping by the area size
*/
-int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
+int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist)
{
- return (int)min_ff(ceilf(dist), (float)max_ii(ar->winx, ar->winx));
+ return (int)min_ff(ceilf(dist), (float)max_ii(region->winx, region->winx));
}
/* *********************** */
-void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
+void view3d_update_depths_rect(ARegion *region, ViewDepths *d, rcti *rect)
{
/* clamp rect by region */
rcti r = {
.xmin = 0,
- .xmax = ar->winx - 1,
+ .xmax = region->winx - 1,
.ymin = 0,
- .ymax = ar->winy - 1,
+ .ymax = region->winy - 1,
};
/* Constrain rect to depth bounds */
@@ -2136,7 +2139,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
}
if (d->damaged) {
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, 0);
view3d_opengl_read_Z_pixels(viewport, rect, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
d->damaged = false;
@@ -2144,9 +2147,9 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
}
/* Note, with nouveau drivers the glReadPixels() is very slow. [#24339]. */
-void ED_view3d_depth_update(ARegion *ar)
+void ED_view3d_depth_update(ARegion *region)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
/* Create storage for, and, if necessary, copy depth buffer. */
if (!rv3d->depths) {
@@ -2154,9 +2157,9 @@ void ED_view3d_depth_update(ARegion *ar)
}
if (rv3d->depths) {
ViewDepths *d = rv3d->depths;
- if (d->w != ar->winx || d->h != ar->winy || !d->depths) {
- d->w = ar->winx;
- d->h = ar->winy;
+ if (d->w != region->winx || d->h != region->winy || !d->depths) {
+ d->w = region->winx;
+ d->h = region->winy;
if (d->depths) {
MEM_freeN(d->depths);
}
@@ -2165,7 +2168,7 @@ void ED_view3d_depth_update(ARegion *ar)
}
if (d->damaged) {
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, 0);
rcti r = {
.xmin = 0,
.xmax = d->w,
@@ -2203,17 +2206,17 @@ float view3d_depth_near(ViewDepths *d)
return far == far_real ? FLT_MAX : far;
}
-void ED_view3d_draw_depth_gpencil(Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d)
+void ED_view3d_draw_depth_gpencil(Depsgraph *depsgraph, Scene *scene, ARegion *region, View3D *v3d)
{
/* Setup view matrix. */
- ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL);
+ ED_view3d_draw_setup_view(NULL, depsgraph, scene, region, v3d, NULL, NULL, NULL);
GPU_clear(GPU_DEPTH_BIT);
GPU_depth_test(true);
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
- DRW_draw_depth_loop_gpencil(depsgraph, ar, v3d, viewport);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, 0);
+ DRW_draw_depth_loop_gpencil(depsgraph, region, v3d, viewport);
GPU_depth_test(false);
}
@@ -2368,9 +2371,9 @@ static bool view3d_main_region_do_render_draw(const Scene *scene)
}
bool ED_view3d_calc_render_border(
- const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *ar, rcti *rect)
+ const Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *region, rcti *rect)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
bool use_border;
/* Test if there is a 3d view rendering. */
@@ -2393,7 +2396,7 @@ bool ED_view3d_calc_render_border(
/* Compute border. */
if (rv3d->persp == RV3D_CAMOB) {
rctf viewborder;
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &viewborder, false);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &viewborder, false);
rect->xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder);
rect->ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder);
@@ -2401,14 +2404,14 @@ bool ED_view3d_calc_render_border(
rect->ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder);
}
else {
- rect->xmin = v3d->render_border.xmin * ar->winx;
- rect->xmax = v3d->render_border.xmax * ar->winx;
- rect->ymin = v3d->render_border.ymin * ar->winy;
- rect->ymax = v3d->render_border.ymax * ar->winy;
+ rect->xmin = v3d->render_border.xmin * region->winx;
+ rect->xmax = v3d->render_border.xmax * region->winx;
+ rect->ymin = v3d->render_border.ymin * region->winy;
+ rect->ymax = v3d->render_border.ymax * region->winy;
}
- BLI_rcti_translate(rect, ar->winrct.xmin, ar->winrct.ymin);
- BLI_rcti_isect(&ar->winrct, rect, rect);
+ BLI_rcti_translate(rect, region->winrct.xmin, region->winrct.ymin);
+ BLI_rcti_isect(&region->winrct, rect, rect);
return true;
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 6d4995285c2..00b696da756 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -130,7 +130,7 @@ typedef struct ViewOpsData {
Main *bmain;
Scene *scene;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
View3D *v3d;
RegionView3D *rv3d;
Depsgraph *depsgraph;
@@ -232,9 +232,9 @@ static void viewops_data_alloc(bContext *C, wmOperator *op)
vod->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
vod->scene = CTX_data_scene(C);
vod->sa = CTX_wm_area(C);
- vod->ar = CTX_wm_region(C);
+ vod->region = CTX_wm_region(C);
vod->v3d = vod->sa->spacedata.first;
- vod->rv3d = vod->ar->regiondata;
+ vod->rv3d = vod->region->regiondata;
}
void view3d_orbit_apply_dyn_ofs(float r_ofs[3],
@@ -401,17 +401,17 @@ static void viewops_data_create(bContext *C,
negate_v3_v3(fallback_depth_pt, rv3d->ofs);
vod->use_dyn_ofs = ED_view3d_autodist(
- depsgraph, vod->ar, vod->v3d, event->mval, vod->dyn_ofs, true, fallback_depth_pt);
+ depsgraph, vod->region, vod->v3d, event->mval, vod->dyn_ofs, true, fallback_depth_pt);
}
else {
vod->use_dyn_ofs = false;
}
if (viewops_flag & VIEWOPS_FLAG_PERSP_ENSURE) {
- if (ED_view3d_persp_ensure(depsgraph, vod->v3d, vod->ar)) {
+ if (ED_view3d_persp_ensure(depsgraph, vod->v3d, vod->region)) {
/* If we're switching from camera view to the perspective one,
* need to tag viewport update, so camera view and borders are properly updated. */
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
}
@@ -432,8 +432,8 @@ static void viewops_data_create(bContext *C,
}
else {
/* Simulate the event starting in the middle of the region. */
- vod->init.event_xy_offset[0] = BLI_rcti_cent_x(&vod->ar->winrct) - event->x;
- vod->init.event_xy_offset[1] = BLI_rcti_cent_y(&vod->ar->winrct) - event->y;
+ vod->init.event_xy_offset[0] = BLI_rcti_cent_x(&vod->region->winrct) - event->x;
+ vod->init.event_xy_offset[1] = BLI_rcti_cent_y(&vod->region->winrct) - event->y;
}
vod->init.event_type = event->type;
@@ -483,9 +483,10 @@ static void viewops_data_create(bContext *C,
negate_v3_v3(rv3d->ofs, dvec);
}
else {
- const float mval_ar_mid[2] = {(float)vod->ar->winx / 2.0f, (float)vod->ar->winy / 2.0f};
+ const float mval_ar_mid[2] = {(float)vod->region->winx / 2.0f,
+ (float)vod->region->winy / 2.0f};
- ED_view3d_win_to_3d(vod->v3d, vod->ar, vod->dyn_ofs, mval_ar_mid, rv3d->ofs);
+ ED_view3d_win_to_3d(vod->v3d, vod->region, vod->dyn_ofs, mval_ar_mid, rv3d->ofs);
negate_v3(rv3d->ofs);
}
negate_v3(vod->dyn_ofs);
@@ -494,7 +495,7 @@ static void viewops_data_create(bContext *C,
}
/* For dolly */
- ED_view3d_win_to_vector(vod->ar, (const float[2]){UNPACK2(event->mval)}, vod->init.mousevec);
+ ED_view3d_win_to_vector(vod->region, (const float[2]){UNPACK2(event->mval)}, vod->init.mousevec);
{
const int event_xy_offset[2] = {
@@ -502,7 +503,7 @@ static void viewops_data_create(bContext *C,
event->y + vod->init.event_xy_offset[1],
};
/* For rotation with trackball rotation. */
- calctrackballvec(&vod->ar->winrct, event_xy_offset, vod->init.trackvec);
+ calctrackballvec(&vod->region->winrct, event_xy_offset, vod->init.trackvec);
}
{
@@ -521,10 +522,10 @@ static void viewops_data_create(bContext *C,
static void viewops_data_free(bContext *C, wmOperator *op)
{
- ARegion *ar;
+ ARegion *region;
if (op->customdata) {
ViewOpsData *vod = op->customdata;
- ar = vod->ar;
+ region = vod->region;
vod->rv3d->rflag &= ~RV3D_NAVIGATING;
if (vod->timer) {
@@ -535,12 +536,12 @@ static void viewops_data_free(bContext *C, wmOperator *op)
op->customdata = NULL;
}
else {
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
}
/* Need to redraw because drawing code uses RV3D_NAVIGATING to draw
* faster while navigation operator runs. */
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
/** \} */
@@ -741,7 +742,7 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2])
event_xy[0] + vod->init.event_xy_offset[0],
event_xy[1] + vod->init.event_xy_offset[1],
};
- calctrackballvec(&vod->ar->winrct, event_xy_offset, newvec);
+ calctrackballvec(&vod->region->winrct, event_xy_offset, newvec);
}
sub_v3_v3v3(dvec, newvec, vod->init.trackvec);
@@ -858,7 +859,7 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2])
ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, rv3d);
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -939,7 +940,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_PASS_THROUGH;
}
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
viewops_data_create(C,
op,
@@ -986,10 +987,10 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool view3d_camera_user_poll(bContext *C)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
- if (ED_view3d_context_user_region(C, &v3d, &ar)) {
- RegionView3D *rv3d = ar->regiondata;
+ if (ED_view3d_context_user_region(C, &v3d, &region)) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
return 1;
}
@@ -1102,11 +1103,11 @@ static float view3d_ndof_pan_speed_calc(RegionView3D *rv3d)
*/
static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof,
ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
const bool has_translate,
const bool has_zoom)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float view_inv[4];
float pan_vec[3];
@@ -1159,25 +1160,25 @@ static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof,
sub_v3_v3(rv3d->ofs, pan_vec);
if (rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(sa, ar);
+ view3d_boxview_sync(sa, region);
}
}
}
static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof,
ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
ViewOpsData *vod,
const bool apply_dyn_ofs)
{
View3D *v3d = sa->spacedata.first;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float view_inv[4];
BLI_assert((rv3d->viewlock & RV3D_LOCKED) == 0);
- ED_view3d_persp_ensure(vod->depsgraph, v3d, ar);
+ ED_view3d_persp_ensure(vod->depsgraph, v3d, region);
rv3d->view = RV3D_VIEW_USER;
@@ -1385,7 +1386,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
C, op, event, viewops_flag_from_args((U.uiflag & USER_ORBIT_SELECTION) != 0, false));
vod = op->customdata;
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
v3d = vod->v3d;
rv3d = vod->rv3d;
@@ -1403,12 +1404,12 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
const bool has_zoom = (ndof->tvec[2] != 0.0f) && !rv3d->is_persp;
if (has_translate || has_zoom) {
- view3d_ndof_pan_zoom(ndof, vod->sa, vod->ar, has_translate, has_zoom);
+ view3d_ndof_pan_zoom(ndof, vod->sa, vod->region, has_translate, has_zoom);
xform_flag |= HAS_TRANSLATE;
}
if (has_rotation) {
- view3d_ndof_orbit(ndof, vod->sa, vod->ar, vod, true);
+ view3d_ndof_orbit(ndof, vod->sa, vod->region, vod, true);
xform_flag |= HAS_ROTATE;
}
}
@@ -1419,7 +1420,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
v3d, rv3d, C, xform_flag & HAS_ROTATE, xform_flag & HAS_TRANSLATE);
}
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
viewops_data_free(C, op);
@@ -1467,7 +1468,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
vod = op->customdata;
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
v3d = vod->v3d;
rv3d = vod->rv3d;
@@ -1486,7 +1487,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
const bool has_zoom = (ndof->tvec[2] != 0.0f) && ED_view3d_offset_lock_check(v3d, rv3d);
if (has_translate || has_zoom) {
- view3d_ndof_pan_zoom(ndof, vod->sa, vod->ar, has_translate, true);
+ view3d_ndof_pan_zoom(ndof, vod->sa, vod->region, has_translate, true);
xform_flag |= HAS_TRANSLATE;
}
}
@@ -1516,7 +1517,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
if (!is_orbit_around_pivot) {
ED_view3d_distance_set(rv3d, 0.0f);
}
- view3d_ndof_orbit(ndof, vod->sa, vod->ar, vod, is_orbit_around_pivot);
+ view3d_ndof_orbit(ndof, vod->sa, vod->region, vod, is_orbit_around_pivot);
xform_flag |= HAS_ROTATE;
if (!is_orbit_around_pivot) {
ED_view3d_distance_set(rv3d, dist_backup);
@@ -1524,7 +1525,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
}
if (has_translate || has_zoom) {
- view3d_ndof_pan_zoom(ndof, vod->sa, vod->ar, has_translate, has_zoom);
+ view3d_ndof_pan_zoom(ndof, vod->sa, vod->region, has_translate, has_zoom);
xform_flag |= HAS_TRANSLATE;
}
}
@@ -1535,7 +1536,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
v3d, rv3d, C, xform_flag & HAS_ROTATE, xform_flag & HAS_TRANSLATE);
}
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
viewops_data_free(C, op);
@@ -1589,10 +1590,10 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *e
if (ndof->progress != P_FINISHING) {
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (has_translate || has_zoom) {
- view3d_ndof_pan_zoom(ndof, sa, ar, has_translate, has_zoom);
+ view3d_ndof_pan_zoom(ndof, sa, region, has_translate, has_zoom);
xform_flag |= HAS_TRANSLATE;
}
}
@@ -1711,13 +1712,13 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
static void viewmove_apply(ViewOpsData *vod, int x, int y)
{
if (ED_view3d_offset_lock_check(vod->v3d, vod->rv3d)) {
- vod->rv3d->ofs_lock[0] -= ((vod->prev.event_xy[0] - x) * 2.0f) / (float)vod->ar->winx;
- vod->rv3d->ofs_lock[1] -= ((vod->prev.event_xy[1] - y) * 2.0f) / (float)vod->ar->winy;
+ vod->rv3d->ofs_lock[0] -= ((vod->prev.event_xy[0] - x) * 2.0f) / (float)vod->region->winx;
+ vod->rv3d->ofs_lock[1] -= ((vod->prev.event_xy[1] - y) * 2.0f) / (float)vod->region->winy;
}
else if ((vod->rv3d->persp == RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
const float zoomfac = BKE_screen_view3d_zoom_to_fac(vod->rv3d->camzoom) * 2.0f;
- vod->rv3d->camdx += (vod->prev.event_xy[0] - x) / (vod->ar->winx * zoomfac);
- vod->rv3d->camdy += (vod->prev.event_xy[1] - y) / (vod->ar->winy * zoomfac);
+ vod->rv3d->camdx += (vod->prev.event_xy[0] - x) / (vod->region->winx * zoomfac);
+ vod->rv3d->camdy += (vod->prev.event_xy[1] - y) / (vod->region->winy * zoomfac);
CLAMP(vod->rv3d->camdx, -1.0f, 1.0f);
CLAMP(vod->rv3d->camdy, -1.0f, 1.0f);
}
@@ -1727,12 +1728,12 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
mval_f[0] = x - vod->prev.event_xy[0];
mval_f[1] = y - vod->prev.event_xy[1];
- ED_view3d_win_to_delta(vod->ar, mval_f, dvec, vod->init.zfac);
+ ED_view3d_win_to_delta(vod->region, mval_f, dvec, vod->init.zfac);
add_v3_v3(vod->rv3d->ofs, dvec);
if (vod->rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(vod->sa, vod->ar);
+ view3d_boxview_sync(vod->sa, vod->region);
}
}
@@ -1741,7 +1742,7 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
static int viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1813,7 +1814,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event)
(use_cursor_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
vod = op->customdata;
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
if (event->type == MOUSEPAN) {
/* invert it, trackpad scroll follows same principle as 2d windows this way */
@@ -1901,10 +1902,14 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
* \param zoom_xy: Optionally zoom to window location
* (coords compatible w/ #wmEvent.x, y). Use when not NULL.
*/
-static void view_zoom_to_window_xy_camera(
- Scene *scene, Depsgraph *depsgraph, View3D *v3d, ARegion *ar, float dfac, const int zoom_xy[2])
-{
- RegionView3D *rv3d = ar->regiondata;
+static void view_zoom_to_window_xy_camera(Scene *scene,
+ Depsgraph *depsgraph,
+ View3D *v3d,
+ ARegion *region,
+ float dfac,
+ const int zoom_xy[2])
+{
+ RegionView3D *rv3d = region->regiondata;
const float zoomfac = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
const float zoomfac_new = clamp_f(
zoomfac * (1.0f / dfac), RV3D_CAMZOOM_MIN_FACTOR, RV3D_CAMZOOM_MAX_FACTOR);
@@ -1919,14 +1924,14 @@ static void view_zoom_to_window_xy_camera(
float pt_dst[2];
float delta_px[2];
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &camera_frame_old, false);
- BLI_rctf_translate(&camera_frame_old, ar->winrct.xmin, ar->winrct.ymin);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &camera_frame_old, false);
+ BLI_rctf_translate(&camera_frame_old, region->winrct.xmin, region->winrct.ymin);
rv3d->camzoom = camzoom_new;
CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &camera_frame_new, false);
- BLI_rctf_translate(&camera_frame_new, ar->winrct.xmin, ar->winrct.ymin);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &camera_frame_new, false);
+ BLI_rctf_translate(&camera_frame_new, region->winrct.xmin, region->winrct.ymin);
BLI_rctf_transform_pt_v(&camera_frame_new, &camera_frame_old, pt_dst, pt_src);
sub_v2_v2v2(delta_px, pt_dst, pt_src);
@@ -1935,8 +1940,8 @@ static void view_zoom_to_window_xy_camera(
* mapped back to the camera (same logic as panning in camera view) */
zoomfac_px = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom) * 2.0f;
- rv3d->camdx += delta_px[0] / (ar->winx * zoomfac_px);
- rv3d->camdy += delta_px[1] / (ar->winy * zoomfac_px);
+ rv3d->camdx += delta_px[0] / (region->winx * zoomfac_px);
+ rv3d->camdy += delta_px[1] / (region->winy * zoomfac_px);
CLAMP(rv3d->camdx, -1.0f, 1.0f);
CLAMP(rv3d->camdy, -1.0f, 1.0f);
}
@@ -1950,9 +1955,9 @@ static void view_zoom_to_window_xy_camera(
* \param zoom_xy: Optionally zoom to window location
* (coords compatible w/ #wmEvent.x, y). Use when not NULL.
*/
-static void view_zoom_to_window_xy_3d(ARegion *ar, float dfac, const int zoom_xy[2])
+static void view_zoom_to_window_xy_3d(ARegion *region, float dfac, const int zoom_xy[2])
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
const float dist_new = rv3d->dist * dfac;
if (zoom_xy != NULL) {
@@ -1965,12 +1970,12 @@ static void view_zoom_to_window_xy_3d(ARegion *ar, float dfac, const int zoom_xy
negate_v3_v3(tpos, rv3d->ofs);
- mval_f[0] = (float)(((zoom_xy[0] - ar->winrct.xmin) * 2) - ar->winx) / 2.0f;
- mval_f[1] = (float)(((zoom_xy[1] - ar->winrct.ymin) * 2) - ar->winy) / 2.0f;
+ mval_f[0] = (float)(((zoom_xy[0] - region->winrct.xmin) * 2) - region->winx) / 2.0f;
+ mval_f[1] = (float)(((zoom_xy[1] - region->winrct.ymin) * 2) - region->winy) / 2.0f;
/* Project cursor position into 3D space */
zfac = ED_view3d_calc_zfac(rv3d, tpos, NULL);
- ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
/* Calculate view target position for dolly */
add_v3_v3v3(tvec, tpos, dvec);
@@ -2102,7 +2107,7 @@ static void viewzoom_apply_camera(ViewOpsData *vod,
float zoomfac_prev = BKE_screen_view3d_zoom_to_fac(vod->init.camzoom) * 2.0f;
float zoomfac = BKE_screen_view3d_zoom_to_fac(vod->rv3d->camzoom) * 2.0f;
- zfac = viewzoom_scale_value_offset(&vod->ar->winrct,
+ zfac = viewzoom_scale_value_offset(&vod->region->winrct,
viewzoom,
zoom_invert,
true,
@@ -2119,12 +2124,12 @@ static void viewzoom_apply_camera(ViewOpsData *vod,
view_zoom_to_window_xy_camera(vod->scene,
vod->depsgraph,
vod->v3d,
- vod->ar,
+ vod->region,
zfac,
zoom_to_pos ? vod->prev.event_xy : NULL);
}
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
static void viewzoom_apply_3d(ViewOpsData *vod,
@@ -2138,7 +2143,7 @@ static void viewzoom_apply_3d(ViewOpsData *vod,
ED_view3d_dist_range_get(vod->v3d, dist_range);
- zfac = viewzoom_scale_value_offset(&vod->ar->winrct,
+ zfac = viewzoom_scale_value_offset(&vod->region->winrct,
viewzoom,
zoom_invert,
false,
@@ -2154,19 +2159,19 @@ static void viewzoom_apply_3d(ViewOpsData *vod,
const float zfac_max = dist_range[1] / vod->rv3d->dist;
CLAMP(zfac, zfac_min, zfac_max);
- view_zoom_to_window_xy_3d(vod->ar, zfac, zoom_to_pos ? vod->prev.event_xy : NULL);
+ view_zoom_to_window_xy_3d(vod->region, zfac, zoom_to_pos ? vod->prev.event_xy : NULL);
}
/* these limits were in old code too */
CLAMP(vod->rv3d->dist, dist_range[0], dist_range[1]);
if (vod->rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(vod->sa, vod->ar);
+ view3d_boxview_sync(vod->sa, vod->region);
}
ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
static void viewzoom_apply(ViewOpsData *vod,
@@ -2253,7 +2258,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
View3D *v3d;
RegionView3D *rv3d;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
bool use_cam_zoom;
float dist_range[2];
@@ -2264,15 +2269,15 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
ViewOpsData *vod = op->customdata;
sa = vod->sa;
- ar = vod->ar;
+ region = vod->region;
}
else {
sa = CTX_wm_area(C);
- ar = CTX_wm_region(C);
+ region = CTX_wm_region(C);
}
v3d = sa->spacedata.first;
- rv3d = ar->regiondata;
+ rv3d = region->regiondata;
use_cam_zoom = (rv3d->persp == RV3D_CAMOB) &&
!(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
@@ -2281,9 +2286,9 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
const int *zoom_xy = NULL;
if (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS)) {
zoom_xy_buf[0] = RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") :
- ar->winx / 2;
+ region->winx / 2;
zoom_xy_buf[1] = RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") :
- ar->winy / 2;
+ region->winy / 2;
zoom_xy = zoom_xy_buf;
}
@@ -2293,28 +2298,28 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
const float step = 1.2f;
/* this min and max is also in viewmove() */
if (use_cam_zoom) {
- view_zoom_to_window_xy_camera(scene, depsgraph, v3d, ar, step, zoom_xy);
+ view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
}
else {
if (rv3d->dist < dist_range[1]) {
- view_zoom_to_window_xy_3d(ar, step, zoom_xy);
+ view_zoom_to_window_xy_3d(region, step, zoom_xy);
}
}
}
else {
const float step = 1.0f / 1.2f;
if (use_cam_zoom) {
- view_zoom_to_window_xy_camera(scene, depsgraph, v3d, ar, step, zoom_xy);
+ view_zoom_to_window_xy_camera(scene, depsgraph, v3d, region, step, zoom_xy);
}
else {
if (rv3d->dist > dist_range[0]) {
- view_zoom_to_window_xy_3d(ar, step, zoom_xy);
+ view_zoom_to_window_xy_3d(region, step, zoom_xy);
}
}
}
if (rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(sa, ar);
+ view3d_boxview_sync(sa, region);
}
ED_view3d_depth_tag_update(rv3d);
@@ -2322,7 +2327,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d);
ED_view3d_camera_lock_autokey(v3d, rv3d, C, false, true);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
viewops_data_free(C, op);
@@ -2345,7 +2350,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
(use_cursor_init ? VIEWOPS_FLAG_USE_MOUSE_INIT : 0));
vod = op->customdata;
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
/* if one or the other zoom position aren't set, set from event */
if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) {
@@ -2477,9 +2482,9 @@ static bool viewdolly_offset_lock_check(bContext *C, wmOperator *op)
}
}
-static void view_dolly_to_vector_3d(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac)
+static void view_dolly_to_vector_3d(ARegion *region, float orig_ofs[3], float dvec[3], float dfac)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac));
}
@@ -2491,12 +2496,12 @@ static void viewdolly_apply(ViewOpsData *vod, const int xy[2], const short zoom_
float len1, len2;
if (U.uiflag & USER_ZOOM_HORIZ) {
- len1 = (vod->ar->winrct.xmax - xy[0]) + 5;
- len2 = (vod->ar->winrct.xmax - vod->init.event_xy[0]) + 5;
+ len1 = (vod->region->winrct.xmax - xy[0]) + 5;
+ len2 = (vod->region->winrct.xmax - vod->init.event_xy[0]) + 5;
}
else {
- len1 = (vod->ar->winrct.ymax - xy[1]) + 5;
- len2 = (vod->ar->winrct.ymax - vod->init.event_xy[1]) + 5;
+ len1 = (vod->region->winrct.ymax - xy[1]) + 5;
+ len2 = (vod->region->winrct.ymax - vod->init.event_xy[1]) + 5;
}
if (zoom_invert) {
SWAP(float, len1, len2);
@@ -2506,16 +2511,16 @@ static void viewdolly_apply(ViewOpsData *vod, const int xy[2], const short zoom_
}
if (zfac != 1.0f) {
- view_dolly_to_vector_3d(vod->ar, vod->init.ofs, vod->init.mousevec, zfac);
+ view_dolly_to_vector_3d(vod->region, vod->init.ofs, vod->init.mousevec, zfac);
}
if (vod->rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(vod->sa, vod->ar);
+ view3d_boxview_sync(vod->sa, vod->region);
}
ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
static int viewdolly_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -2576,7 +2581,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
View3D *v3d;
RegionView3D *rv3d;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
float mousevec[3];
const int delta = RNA_int_get(op->ptr, "delta");
@@ -2585,18 +2590,18 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
ViewOpsData *vod = op->customdata;
sa = vod->sa;
- ar = vod->ar;
+ region = vod->region;
copy_v3_v3(mousevec, vod->init.mousevec);
}
else {
sa = CTX_wm_area(C);
- ar = CTX_wm_region(C);
- negate_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]);
+ region = CTX_wm_region(C);
+ negate_v3_v3(mousevec, ((RegionView3D *)region->regiondata)->viewinv[2]);
normalize_v3(mousevec);
}
v3d = sa->spacedata.first;
- rv3d = ar->regiondata;
+ rv3d = region->regiondata;
const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
@@ -2605,17 +2610,17 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
normalize_v3_v3(mousevec, rv3d->viewinv[2]);
}
- view_dolly_to_vector_3d(ar, rv3d->ofs, mousevec, delta < 0 ? 0.2f : 1.8f);
+ view_dolly_to_vector_3d(region, rv3d->ofs, mousevec, delta < 0 ? 0.2f : 1.8f);
if (rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(sa, ar);
+ view3d_boxview_sync(sa, region);
}
ED_view3d_depth_tag_update(rv3d);
ED_view3d_camera_lock_sync(CTX_data_ensure_evaluated_depsgraph(C), v3d, rv3d);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
viewops_data_free(C, op);
@@ -2641,7 +2646,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_PASS_THROUGH;
}
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
/* needs to run before 'viewops_data_create' so the backup 'rv3d->ofs' is correct */
/* switch from camera view when: */
@@ -2654,7 +2659,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
else {
vod->rv3d->persp = RV3D_PERSP;
}
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
@@ -2767,17 +2772,17 @@ static bool view3d_object_skip_minmax(const View3D *v3d,
static void view3d_from_minmax(bContext *C,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
const float min[3],
const float max[3],
bool ok_dist,
const int smooth_viewtx)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float afm[3];
float size;
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
/* SMOOTHVIEW */
float new_ofs[3];
@@ -2811,7 +2816,7 @@ static void view3d_from_minmax(bContext *C,
if (ok_dist) {
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
new_dist = ED_view3d_radius_to_dist(
- v3d, ar, depsgraph, persp, true, (size / 2) * VIEW3D_MARGIN);
+ v3d, region, depsgraph, persp, true, (size / 2) * VIEW3D_MARGIN);
if (rv3d->is_persp) {
/* don't zoom closer than the near clipping plane */
new_dist = max_ff(new_dist, v3d->clip_start * 1.5f);
@@ -2826,7 +2831,7 @@ static void view3d_from_minmax(bContext *C,
rv3d->persp = RV3D_PERSP;
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.camera_old = v3d->camera,
@@ -2837,7 +2842,7 @@ static void view3d_from_minmax(bContext *C,
else {
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.ofs = new_ofs,
@@ -2859,14 +2864,14 @@ static void view3d_from_minmax_multi(bContext *C,
const int smooth_viewtx)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
/* when using all regions, don't jump out of camera view,
* but _do_ allow locked cameras to be moved */
if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
- view3d_from_minmax(C, v3d, ar, min, max, ok_dist, smooth_viewtx);
+ view3d_from_minmax(C, v3d, region, min, max, ok_dist, smooth_viewtx);
}
}
}
@@ -2874,7 +2879,7 @@ static void view3d_from_minmax_multi(bContext *C,
static int view3d_all_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
@@ -2882,7 +2887,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
Base *base_eval;
const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
- const bool skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+ const bool skip_camera = (ED_view3d_camera_lock_check(v3d, region->regiondata) ||
/* any one of the regions may be locked */
(use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
const bool center = RNA_boolean_get(op->ptr, "center");
@@ -2928,7 +2933,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
}
if (!changed) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
/* TODO - should this be cancel?
* I think no, because we always move the cursor, with or without
* object, but in this case there is no change in the scene,
@@ -2943,7 +2948,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
view3d_from_minmax_multi(C, v3d, min, max, true, smooth_viewtx);
}
else {
- view3d_from_minmax(C, v3d, ar, min, max, true, smooth_viewtx);
+ view3d_from_minmax(C, v3d, region, min, max, true, smooth_viewtx);
}
return OPERATOR_FINISHED;
@@ -2979,7 +2984,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
/* like a localview without local!, was centerview() in 2.4x */
static int viewselected_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
@@ -2989,12 +2994,12 @@ static int viewselected_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
const bGPdata *gpd_eval = ob_eval && (ob_eval->type == OB_GPENCIL) ? ob_eval->data : NULL;
const bool is_gp_edit = gpd_eval ? GPENCIL_ANY_MODE(gpd_eval) : false;
- const bool is_face_map = ((is_gp_edit == false) && ar->gizmo_map &&
- WM_gizmomap_is_any_selected(ar->gizmo_map));
+ const bool is_face_map = ((is_gp_edit == false) && region->gizmo_map &&
+ WM_gizmomap_is_any_selected(region->gizmo_map));
float min[3], max[3];
bool ok = false, ok_dist = true;
const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
- const bool skip_camera = (ED_view3d_camera_lock_check(v3d, ar->regiondata) ||
+ const bool skip_camera = (ED_view3d_camera_lock_check(v3d, region->regiondata) ||
/* any one of the regions may be locked */
(use_all_regions && v3d->flag2 & V3D_LOCK_CAMERA));
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -3038,7 +3043,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
}
}
else if (is_face_map) {
- ok = WM_gizmomap_minmax(ar->gizmo_map, true, true, min, max);
+ ok = WM_gizmomap_minmax(region->gizmo_map, true, true, min, max);
}
else if (obedit) {
/* only selected */
@@ -3101,7 +3106,7 @@ static int viewselected_exec(bContext *C, wmOperator *op)
view3d_from_minmax_multi(C, v3d, min, max, ok_dist, smooth_viewtx);
}
else {
- view3d_from_minmax(C, v3d, ar, min, max, ok_dist, smooth_viewtx);
+ view3d_from_minmax(C, v3d, region, min, max, ok_dist, smooth_viewtx);
}
return OPERATOR_FINISHED;
@@ -3234,15 +3239,16 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
if (rv3d) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
/* non camera center */
float new_ofs[3];
negate_v3_v3(new_ofs, scene->cursor.location);
- ED_view3d_smooth_view(C, v3d, ar, smooth_viewtx, &(const V3D_SmoothParams){.ofs = new_ofs});
+ ED_view3d_smooth_view(
+ C, v3d, region, smooth_viewtx, &(const V3D_SmoothParams){.ofs = new_ofs});
/* smooth view does viewlock RV3D_BOXVIEW copy */
}
@@ -3275,27 +3281,28 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (rv3d) {
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
float new_ofs[3];
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
view3d_operator_needs_opengl(C);
- if (ED_view3d_autodist(depsgraph, ar, v3d, event->mval, new_ofs, false, NULL)) {
+ if (ED_view3d_autodist(depsgraph, region, v3d, event->mval, new_ofs, false, NULL)) {
/* pass */
}
else {
/* fallback to simple pan */
negate_v3_v3(new_ofs, rv3d->ofs);
- ED_view3d_win_to_3d_int(v3d, ar, new_ofs, event->mval, new_ofs);
+ ED_view3d_win_to_3d_int(v3d, region, new_ofs, event->mval, new_ofs);
}
negate_v3(new_ofs);
- ED_view3d_smooth_view(C, v3d, ar, smooth_viewtx, &(const V3D_SmoothParams){.ofs = new_ofs});
+ ED_view3d_smooth_view(
+ C, v3d, region, smooth_viewtx, &(const V3D_SmoothParams){.ofs = new_ofs});
}
return OPERATOR_FINISHED;
@@ -3330,20 +3337,20 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op))
float size[2];
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d, &region);
+ rv3d = region->regiondata;
rv3d->camdx = rv3d->camdy = 0.0f;
- ED_view3d_calc_camera_border_size(scene, depsgraph, ar, v3d, rv3d, size);
+ ED_view3d_calc_camera_border_size(scene, depsgraph, region, v3d, rv3d, size);
/* 4px is just a little room from the edge of the area */
- xfac = (float)ar->winx / (float)(size[0] + 4);
- yfac = (float)ar->winy / (float)(size[1] + 4);
+ xfac = (float)region->winx / (float)(size[0] + 4);
+ yfac = (float)region->winy / (float)(size[1] + 4);
rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(min_ff(xfac, yfac));
CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
@@ -3409,7 +3416,7 @@ void VIEW3D_OT_view_center_lock(wmOperatorType *ot)
static int render_border_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
Scene *scene = CTX_data_scene(C);
@@ -3424,13 +3431,13 @@ static int render_border_exec(bContext *C, wmOperator *op)
if (rv3d->persp == RV3D_CAMOB) {
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &vb, false);
+ ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &vb, false);
}
else {
vb.xmin = 0;
vb.ymin = 0;
- vb.xmax = ar->winx;
- vb.ymax = ar->winy;
+ vb.xmax = region->winx;
+ vb.ymax = region->winy;
}
border.xmin = ((float)rect.xmin - vb.xmin) / BLI_rctf_size_x(&vb);
@@ -3562,7 +3569,7 @@ void VIEW3D_OT_clear_render_border(wmOperatorType *ot)
static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -3592,14 +3599,14 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
ED_view3d_dist_range_get(v3d, dist_range);
/* Get Z Depths, needed for perspective, nice for ortho */
- ED_view3d_draw_depth(CTX_data_ensure_evaluated_depsgraph(C), ar, v3d, true);
+ ED_view3d_draw_depth(CTX_data_ensure_evaluated_depsgraph(C), region, v3d, true);
{
/* avoid allocating the whole depth buffer */
ViewDepths depth_temp = {0};
/* avoid view3d_update_depths() for speed. */
- view3d_update_depths_rect(ar, &depth_temp, &rect);
+ view3d_update_depths_rect(region, &depth_temp, &rect);
/* find the closest Z pixel */
depth_close = view3d_depth_near(&depth_temp);
@@ -3619,8 +3626,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* convert border to 3d coordinates */
- if ((!ED_view3d_unproject(ar, cent[0], cent[1], depth_close, p)) ||
- (!ED_view3d_unproject(ar, rect.xmin, rect.ymin, depth_close, p_corner))) {
+ if ((!ED_view3d_unproject(region, cent[0], cent[1], depth_close, p)) ||
+ (!ED_view3d_unproject(region, rect.xmin, rect.ymin, depth_close, p_corner))) {
return OPERATOR_CANCELLED;
}
@@ -3634,13 +3641,13 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
}
else { /* orthographic */
/* find the current window width and height */
- vb[0] = ar->winx;
- vb[1] = ar->winy;
+ vb[0] = region->winx;
+ vb[1] = region->winy;
new_dist = rv3d->dist;
/* convert the drawn rectangle into 3d space */
- if (depth_close != FLT_MAX && ED_view3d_unproject(ar, cent[0], cent[1], depth_close, p)) {
+ if (depth_close != FLT_MAX && ED_view3d_unproject(region, cent[0], cent[1], depth_close, p)) {
negate_v3_v3(new_ofs, p);
}
else {
@@ -3658,7 +3665,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
mval_f[0] = (rect.xmin + rect.xmax - vb[0]) / 2.0f;
mval_f[1] = (rect.ymin + rect.ymax - vb[1]) / 2.0f;
- ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
/* center the view to the center of the rectangle */
sub_v3_v3(new_ofs, dvec);
}
@@ -3687,7 +3694,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.ofs = new_ofs,
@@ -3695,7 +3702,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
});
if (rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(CTX_wm_area(C), ar);
+ view3d_boxview_sync(CTX_wm_area(C), region);
}
return OPERATOR_FINISHED;
@@ -3733,14 +3740,14 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
static void view3d_set_1_to_1_viewborder(Scene *scene,
Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float size[2];
int im_width = (scene->r.size * scene->r.xsch) / 100;
- ED_view3d_calc_camera_border_size(scene, depsgraph, ar, v3d, rv3d, size);
+ ED_view3d_calc_camera_border_size(scene, depsgraph, region, v3d, rv3d, size);
rv3d->camzoom = BKE_screen_view3d_zoom_from_fac((float)im_width / size[0]);
CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
@@ -3752,12 +3759,12 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d, &ar);
+ ED_view3d_context_user_region(C, &v3d, &region);
- view3d_set_1_to_1_viewborder(scene, depsgraph, ar, v3d);
+ view3d_set_1_to_1_viewborder(scene, depsgraph, region, v3d);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
@@ -3802,7 +3809,7 @@ static const EnumPropertyItem prop_view_items[] = {
*/
static void axis_set_view(bContext *C,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
const float quat_[4],
char view,
char view_axis_roll,
@@ -3810,7 +3817,7 @@ static void axis_set_view(bContext *C,
const float *align_to_quat,
const int smooth_viewtx)
{
- RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */
+ RegionView3D *rv3d = region->regiondata; /* no NULL check is needed, poll checks */
float quat[4];
const short orig_persp = rv3d->persp;
@@ -3828,7 +3835,7 @@ static void axis_set_view(bContext *C,
}
if (rv3d->viewlock & RV3D_LOCKED) {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
return;
}
@@ -3843,7 +3850,7 @@ static void axis_set_view(bContext *C,
/* to camera */
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.camera_old = v3d->camera,
@@ -3865,7 +3872,7 @@ static void axis_set_view(bContext *C,
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.ofs = ofs,
@@ -3888,7 +3895,7 @@ static void axis_set_view(bContext *C,
/* no camera involved */
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.quat = quat,
@@ -3900,7 +3907,7 @@ static void axis_set_view(bContext *C,
static int view_axis_exec(bContext *C, wmOperator *op)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
static int perspo = RV3D_PERSP;
int viewnum;
@@ -3908,10 +3915,10 @@ static int view_axis_exec(bContext *C, wmOperator *op)
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d, &region);
+ rv3d = region->regiondata;
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
viewnum = RNA_enum_get(op->ptr, "type");
@@ -3998,7 +4005,8 @@ static int view_axis_exec(bContext *C, wmOperator *op)
const int nextperspo = (rv3d->persp == RV3D_CAMOB) ? rv3d->lpersp : perspo;
float quat[4];
ED_view3d_quat_from_axis_view(viewnum, view_axis_roll, quat);
- axis_set_view(C, v3d, ar, quat, viewnum, view_axis_roll, nextperspo, align_quat, smooth_viewtx);
+ axis_set_view(
+ C, v3d, region, quat, viewnum, view_axis_roll, nextperspo, align_quat, smooth_viewtx);
perspo = rv3d->persp;
@@ -4040,15 +4048,15 @@ void VIEW3D_OT_view_axis(wmOperatorType *ot)
static int view_camera_exec(bContext *C, wmOperator *op)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d, &region);
+ rv3d = region->regiondata;
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
/* lastview - */
@@ -4111,7 +4119,7 @@ static int view_camera_exec(bContext *C, wmOperator *op)
rv3d->persp = RV3D_CAMOB;
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.camera = v3d->camera,
@@ -4126,7 +4134,7 @@ static int view_camera_exec(bContext *C, wmOperator *op)
/* does view3d_smooth_view too */
axis_set_view(C,
v3d,
- ar,
+ region,
rv3d->lviewquat,
rv3d->lview,
rv3d->lview_axis_roll,
@@ -4180,7 +4188,7 @@ static const EnumPropertyItem prop_view_orbit_items[] = {
static int vieworbit_exec(bContext *C, wmOperator *op)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
int orbitdir;
char view_opposite;
@@ -4191,8 +4199,8 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
/* no NULL check is needed, poll checks */
v3d = CTX_wm_view3d(C);
- ar = CTX_wm_region(C);
- rv3d = ar->regiondata;
+ region = CTX_wm_region(C);
+ rv3d = region->regiondata;
/* support for switching to the opposite view (even when in locked views) */
view_opposite = (fabsf(angle) == (float)M_PI) ? ED_view3d_axis_view_opposite(rv3d->view) :
@@ -4201,11 +4209,11 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
if ((rv3d->viewlock & RV3D_LOCKED) && (view_opposite == RV3D_VIEW_USER)) {
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d, &region);
+ rv3d = region->regiondata;
}
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
if ((rv3d->viewlock & RV3D_LOCKED) == 0 || (view_opposite != RV3D_VIEW_USER)) {
if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
@@ -4215,7 +4223,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
if (view_opposite == RV3D_VIEW_USER) {
const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ED_view3d_persp_ensure(depsgraph, v3d, ar);
+ ED_view3d_persp_ensure(depsgraph, v3d, region);
}
if (ELEM(orbitdir, V3D_VIEW_STEPLEFT, V3D_VIEW_STEPRIGHT)) {
@@ -4261,7 +4269,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.quat = quat_new,
@@ -4306,9 +4314,9 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot)
* \{ */
static void view_roll_angle(
- ARegion *ar, float quat[4], const float orig_quat[4], const float dvec[3], float angle)
+ ARegion *region, float quat[4], const float orig_quat[4], const float dvec[3], float angle)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float quat_mul[4];
/* camera axis */
@@ -4329,14 +4337,14 @@ static void viewroll_apply(ViewOpsData *vod, int x, int UNUSED(y))
{
float len1, len2, tot;
- tot = vod->ar->winrct.xmax - vod->ar->winrct.xmin;
- len1 = (vod->ar->winrct.xmax - x) / tot;
- len2 = (vod->ar->winrct.xmax - vod->init.event_xy[0]) / tot;
+ tot = vod->region->winrct.xmax - vod->region->winrct.xmin;
+ len1 = (vod->region->winrct.xmax - x) / tot;
+ len2 = (vod->region->winrct.xmax - vod->init.event_xy[0]) / tot;
angle = (len1 - len2) * (float)M_PI * 4.0f;
}
if (angle != 0.0f) {
- view_roll_angle(vod->ar, vod->rv3d->viewquat, vod->init.quat, vod->init.mousevec, angle);
+ view_roll_angle(vod->region, vod->rv3d->viewquat, vod->init.quat, vod->init.mousevec, angle);
}
if (vod->use_dyn_ofs) {
@@ -4345,12 +4353,12 @@ static void viewroll_apply(ViewOpsData *vod, int x, int UNUSED(y))
}
if (vod->rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_sync(vod->sa, vod->ar);
+ view3d_boxview_sync(vod->sa, vod->region);
}
ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
- ED_region_tag_redraw(vod->ar);
+ ED_region_tag_redraw(vod->region);
}
static int viewroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -4417,21 +4425,21 @@ static int viewroll_exec(bContext *C, wmOperator *op)
{
View3D *v3d;
RegionView3D *rv3d;
- ARegion *ar;
+ ARegion *region;
if (op->customdata) {
ViewOpsData *vod = op->customdata;
- ar = vod->ar;
+ region = vod->region;
v3d = vod->v3d;
}
else {
- ED_view3d_context_user_region(C, &v3d, &ar);
+ ED_view3d_context_user_region(C, &v3d, &region);
}
- rv3d = ar->regiondata;
+ rv3d = region->regiondata;
if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
- ED_view3d_smooth_view_force_finish(C, v3d, ar);
+ ED_view3d_smooth_view_force_finish(C, v3d, region);
int type = RNA_enum_get(op->ptr, "type");
float angle = (type == 0) ? RNA_float_get(op->ptr, "angle") : DEG2RADF(U.pad_rot_angle);
@@ -4446,7 +4454,7 @@ static int viewroll_exec(bContext *C, wmOperator *op)
normalize_v3_v3(mousevec, rv3d->viewinv[2]);
negate_v3(mousevec);
- view_roll_angle(ar, quat_new, rv3d->viewquat, mousevec, angle);
+ view_roll_angle(region, quat_new, rv3d->viewquat, mousevec, angle);
const float *dyn_ofs_pt = NULL;
float dyn_ofs[3];
@@ -4459,7 +4467,7 @@ static int viewroll_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.quat = quat_new,
@@ -4490,7 +4498,7 @@ static int viewroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
viewops_data_create(C, op, event, viewops_flag_from_prefs());
vod = op->customdata;
- ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
+ ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->region);
/* overwrite the mouse vector with the view direction */
normalize_v3_v3(vod->init.mousevec, vod->rv3d->viewinv[2]);
@@ -4632,12 +4640,12 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot)
static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
{
View3D *v3d_dummy;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d_dummy, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d_dummy, &region);
+ rv3d = region->regiondata;
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
if (rv3d->persp != RV3D_ORTHO) {
@@ -4646,7 +4654,7 @@ static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
else {
rv3d->persp = RV3D_PERSP;
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
return OPERATOR_FINISHED;
@@ -4872,7 +4880,7 @@ void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4])
static int view3d_clipping_exec(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
rcti rect;
@@ -4882,7 +4890,7 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
rv3d->clipbb = MEM_callocN(sizeof(BoundBox), "clipbb");
/* NULL object because we don't want it in object space */
- ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, ar, NULL, &rect);
+ ED_view3d_clipping_calc(rv3d->clipbb, rv3d->clip, region, NULL, &rect);
return OPERATOR_FINISHED;
}
@@ -4890,11 +4898,11 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
if (rv3d->rflag & RV3D_CLIPPING) {
rv3d->rflag &= ~RV3D_CLIPPING;
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
if (rv3d->clipbb) {
MEM_freeN(rv3d->clipbb);
}
@@ -4942,9 +4950,9 @@ void ED_view3d_cursor3d_position(bContext *C,
const bool use_depth,
float cursor_co[3])
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
bool flip;
bool depth_used = false;
@@ -4967,7 +4975,7 @@ void ED_view3d_cursor3d_position(bContext *C,
struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
view3d_operator_needs_opengl(C);
- if (ED_view3d_autodist(depsgraph, ar, v3d, mval, cursor_co, true, NULL)) {
+ if (ED_view3d_autodist(depsgraph, region, v3d, mval, cursor_co, true, NULL)) {
depth_used = true;
}
}
@@ -4975,7 +4983,7 @@ void ED_view3d_cursor3d_position(bContext *C,
if (depth_used == false) {
float depth_pt[3];
copy_v3_v3(depth_pt, cursor_co);
- ED_view3d_win_to_3d_int(v3d, ar, depth_pt, mval, cursor_co);
+ ED_view3d_win_to_3d_int(v3d, region, depth_pt, mval, cursor_co);
}
}
@@ -4989,8 +4997,8 @@ void ED_view3d_cursor3d_position_rotation(bContext *C,
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
/* XXX, caller should check. */
if (rv3d == NULL) {
@@ -5020,7 +5028,7 @@ void ED_view3d_cursor3d_position_rotation(bContext *C,
float ray_co[3];
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
- bmain, scene, CTX_data_ensure_evaluated_depsgraph(C), 0, ar, v3d);
+ bmain, scene, CTX_data_ensure_evaluated_depsgraph(C), 0, region, v3d);
float obmat[4][4];
Object *ob_dummy = NULL;
@@ -5102,8 +5110,8 @@ void ED_view3d_cursor3d_update(bContext *C,
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
View3DCursor *cursor_curr = &scene->cursor;
View3DCursor cursor_prev = *cursor_curr;
@@ -5137,11 +5145,11 @@ void ED_view3d_cursor3d_update(bContext *C,
float co_2d_curr[2], co_2d_prev[2];
if ((ED_view3d_project_float_global(
- ar, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
+ region, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
(ED_view3d_project_float_global(
- ar, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) {
- rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (ar->winx * 0.5f);
- rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (ar->winy * 0.5f);
+ region, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK)) {
+ rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (region->winx * 0.5f);
+ rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (region->winy * 0.5f);
}
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 165e4c7c6a3..eb7b1412fde 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -142,7 +142,7 @@ typedef struct FlyInfo {
/* context stuff */
RegionView3D *rv3d;
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
struct Depsgraph *depsgraph;
Scene *scene;
@@ -211,7 +211,7 @@ static void flyApply_ndof(bContext *C, FlyInfo *fly, bool is_confirm);
#endif /* WITH_INPUT_NDOF */
static int flyApply(bContext *C, struct FlyInfo *fly, bool force_autokey);
-static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
+static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
{
FlyInfo *fly = arg;
rctf viewborder;
@@ -220,7 +220,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar),
if (ED_view3d_cameracontrol_object_get(fly->v3d_camera_control)) {
ED_view3d_calc_camera_border(
- fly->scene, fly->depsgraph, fly->ar, fly->v3d, fly->rv3d, &viewborder, false);
+ fly->scene, fly->depsgraph, fly->region, fly->v3d, fly->rv3d, &viewborder, false);
xoff = viewborder.xmin;
yoff = viewborder.ymin;
}
@@ -296,7 +296,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
fly->rv3d = CTX_wm_region_view3d(C);
fly->v3d = CTX_wm_view3d(C);
- fly->ar = CTX_wm_region(C);
+ fly->region = CTX_wm_region(C);
fly->depsgraph = CTX_data_expect_evaluated_depsgraph(C);
fly->scene = CTX_data_scene(C);
@@ -353,7 +353,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
fly->time_lastdraw = fly->time_lastwheel = PIL_check_seconds_timer();
fly->draw_handle_pixel = ED_region_draw_cb_activate(
- fly->ar->type, drawFlyPixel, fly, REGION_DRAW_POST_PIXEL);
+ fly->region->type, drawFlyPixel, fly, REGION_DRAW_POST_PIXEL);
fly->rv3d->rflag |= RV3D_NAVIGATING;
@@ -371,7 +371,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
/* calculate center */
if (ED_view3d_cameracontrol_object_get(fly->v3d_camera_control)) {
ED_view3d_calc_camera_border(
- fly->scene, fly->depsgraph, fly->ar, fly->v3d, fly->rv3d, &viewborder, false);
+ fly->scene, fly->depsgraph, fly->region, fly->v3d, fly->rv3d, &viewborder, false);
fly->width = BLI_rctf_size_x(&viewborder);
fly->height = BLI_rctf_size_y(&viewborder);
@@ -380,16 +380,17 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
fly->center_mval[1] = viewborder.ymin + fly->height / 2;
}
else {
- fly->width = fly->ar->winx;
- fly->height = fly->ar->winy;
+ fly->width = fly->region->winx;
+ fly->height = fly->region->winy;
fly->center_mval[0] = fly->width / 2;
fly->center_mval[1] = fly->height / 2;
}
/* center the mouse, probably the UI mafia are against this but without its quite annoying */
- WM_cursor_warp(
- win, fly->ar->winrct.xmin + fly->center_mval[0], fly->ar->winrct.ymin + fly->center_mval[1]);
+ WM_cursor_warp(win,
+ fly->region->winrct.xmin + fly->center_mval[0],
+ fly->region->winrct.ymin + fly->center_mval[1]);
return 1;
}
@@ -424,7 +425,7 @@ static int flyEnd(bContext *C, FlyInfo *fly)
WM_event_remove_timer(CTX_wm_manager(C), win, fly->timer);
- ED_region_draw_cb_exit(fly->ar->type, fly->draw_handle_pixel);
+ ED_region_draw_cb_exit(fly->region->type, fly->draw_handle_pixel);
ED_view3d_cameracontrol_release(fly->v3d_camera_control, fly->state == FLY_CANCEL);
@@ -786,7 +787,7 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm)
}
/* scale the mouse movement by this value - scales mouse movement to the view size
- * moffset[0] / (ar->winx-xmargin * 2) - window size minus margin (same for y)
+ * moffset[0] / (region->winx-xmargin * 2) - window size minus margin (same for y)
*
* the mouse moves isn't linear */
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index 8e279b2d11a..23845a64ad8 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -253,13 +253,13 @@ static void WIDGETGROUP_camera_message_subscribe(const bContext *C,
wmGizmoGroup *gzgroup,
struct wmMsgBus *mbus)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
Camera *ca = ob->data;
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
@@ -403,8 +403,8 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UN
return false;
}
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
if (scene->r.mode & R_BORDER) {
/* TODO: support overrides. */
@@ -441,22 +441,22 @@ static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup
{
struct CameraViewWidgetGroup *viewgroup = gzgroup->customdata;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* Drawing code should happen with fully evaluated graph. */
struct Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
ED_view3d_calc_camera_border(
- scene, depsgraph, ar, v3d, rv3d, &viewgroup->state.view_border, false);
+ scene, depsgraph, region, v3d, rv3d, &viewgroup->state.view_border, false);
}
else {
viewgroup->state.view_border = (rctf){
.xmin = 0,
.ymin = 0,
- .xmax = ar->winx,
- .ymax = ar->winy,
+ .xmax = region->winx,
+ .ymax = region->winy,
};
}
@@ -473,8 +473,8 @@ static void WIDGETGROUP_camera_view_refresh(const bContext *C, wmGizmoGroup *gzg
struct CameraViewWidgetGroup *viewgroup = gzgroup->customdata;
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
Scene *scene = CTX_data_scene(C);
viewgroup->scene = scene;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index 25dd5b69f98..0d55fcda6a9 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -239,14 +239,14 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, wmGizmoGroup *gzgroup)
static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
struct NavigateWidgetGroup *navgroup = gzgroup->customdata;
- ARegion *ar = CTX_wm_region(C);
- const RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ const RegionView3D *rv3d = region->regiondata;
for (int i = 0; i < 3; i++) {
copy_v3_v3(navgroup->gz_array[GZ_INDEX_ROTATE]->matrix_offset[i], rv3d->viewmat[i]);
}
- const rcti *rect_visible = ED_region_visible_rect(ar);
+ const rcti *rect_visible = ED_region_visible_rect(region);
if ((navgroup->state.rect_visible.xmax == rect_visible->xmax) &&
(navgroup->state.rect_visible.ymax == rect_visible->ymax) &&
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
index eec5ec3da34..0a5b27a4d15 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
@@ -158,7 +158,7 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
float vert_p_co[3], vert_co[3];
float mval_f[2] = {UNPACK2(vc.mval)};
mul_v3_m4v3(vert_co, gz_ele->bases[base_index_vert]->object->obmat, vert->co);
- ED_view3d_project(vc.ar, vert_co, vert_p_co);
+ ED_view3d_project(vc.region, vert_co, vert_p_co);
float len = len_v2v2(vert_p_co, mval_f);
if (len < 35) {
best.ele = (BMElem *)eve_test;
@@ -226,8 +226,8 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
RNA_int_set(gz->ptr, "face_index", gz_ele->face_index);
if (best.ele) {
- ARegion *ar = CTX_wm_region(C);
- ED_region_tag_redraw_editor_overlays(ar);
+ ARegion *region = CTX_wm_region(C);
+ ED_region_tag_redraw_editor_overlays(region);
}
// return best.eed ? 0 : -1;
@@ -382,8 +382,8 @@ static int gizmo_preselect_edgering_test_select(bContext *C, wmGizmo *gz, const
RNA_int_set(gz->ptr, "object_index", gz_ring->base_index);
RNA_int_set(gz->ptr, "edge_index", gz_ring->edge_index);
- ARegion *ar = CTX_wm_region(C);
- ED_region_tag_redraw_editor_overlays(ar);
+ ARegion *region = CTX_wm_region(C);
+ ED_region_tag_redraw_editor_overlays(region);
}
// return best.eed ? 0 : -1;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index db120b246c7..99789a512d3 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -111,7 +111,7 @@ typedef struct RulerInfo {
/* wm state */
wmWindow *win;
ScrArea *sa;
- ARegion *ar; /* re-assigned every modal update */
+ ARegion *region; /* re-assigned every modal update */
/* Track changes in state. */
struct {
@@ -201,7 +201,7 @@ static bool view3d_ruler_pick(wmGizmoGroup *gzgroup,
int *r_co_index)
{
RulerInfo *ruler_info = gzgroup->customdata;
- ARegion *ar = ruler_info->ar;
+ ARegion *region = ruler_info->region;
bool found = false;
float dist_best = RULER_PICK_DIST_SQ;
@@ -214,7 +214,7 @@ static bool view3d_ruler_pick(wmGizmoGroup *gzgroup,
/* should these be checked? - ok for now not to */
for (j = 0; j < 3; j++) {
- ED_view3d_project_float_global(ar, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
+ ED_view3d_project_float_global(region, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
}
if (ruler_item->flag & RULERITEM_USE_ANGLE) {
@@ -292,7 +292,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
CTX_data_scene(C),
CTX_data_ensure_evaluated_depsgraph(C),
0,
- ruler_info->ar,
+ ruler_info->region,
CTX_wm_view3d(C));
}
else {
@@ -304,7 +304,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
static void view3d_ruler_item_project(RulerInfo *ruler_info, float r_co[3], const int xy[2])
{
- ED_view3d_win_to_3d_int(ruler_info->sa->spacedata.first, ruler_info->ar, r_co, xy, r_co);
+ ED_view3d_win_to_3d_int(ruler_info->sa->spacedata.first, ruler_info->region, r_co, xy, r_co);
}
/* use for mousemove events */
@@ -543,8 +543,8 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
UnitSettings *unit = &scene->unit;
RulerInfo *ruler_info = gz->parent_gzgroup->customdata;
RulerItem *ruler_item = (RulerItem *)gz;
- ARegion *ar = ruler_info->ar;
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = ruler_info->region;
+ RegionView3D *rv3d = region->regiondata;
const float cap_size = 4.0f;
const float bg_margin = 4.0f * U.pixelsize;
const float arc_size = 64.0f * U.pixelsize;
@@ -579,7 +579,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
/* should these be checked? - ok for now not to */
for (j = 0; j < 3; j++) {
- ED_view3d_project_float_global(ar, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
+ ED_view3d_project_float_global(region, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
}
GPU_blend(true);
@@ -649,7 +649,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
for (j = 0; j <= arc_steps; j++) {
madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale);
- ED_view3d_project_float_global(ar, co_tmp, arc_ss_coord, V3D_PROJ_TEST_NOP);
+ ED_view3d_project_float_global(region, co_tmp, arc_ss_coord, V3D_PROJ_TEST_NOP);
mul_qt_v3(quat, dir_tmp);
immVertex2fv(shdr_pos, arc_ss_coord);
@@ -859,7 +859,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
const float size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
float co_ss_snap[3];
ED_view3d_project_float_global(
- ar, ruler_item->co[inter->co_index], co_ss_snap, V3D_PROJ_TEST_NOP);
+ region, ruler_item->co[inter->co_index], co_ss_snap, V3D_PROJ_TEST_NOP);
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -901,10 +901,10 @@ static int gizmo_ruler_modal(bContext *C,
int exit_code = OPERATOR_RUNNING_MODAL;
RulerInfo *ruler_info = gz->parent_gzgroup->customdata;
RulerItem *ruler_item = (RulerItem *)gz;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
bool do_cursor_update = false;
- ruler_info->ar = ar;
+ ruler_info->region = region;
switch (event->type) {
case MOUSEMOVE: {
@@ -933,7 +933,7 @@ static int gizmo_ruler_modal(bContext *C,
ruler_info->drag_state_prev.do_thickness = do_thickness;
if (do_draw) {
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
}
return exit_code;
}
@@ -946,7 +946,7 @@ static int gizmo_ruler_invoke(bContext *C, wmGizmo *gz, const wmEvent *event)
RulerInteraction *inter = MEM_callocN(sizeof(RulerInteraction), __func__);
gz->interaction_data = inter;
- ARegion *ar = ruler_info->ar;
+ ARegion *region = ruler_info->region;
const float mval_fl[2] = {UNPACK2(event->mval)};
@@ -963,8 +963,10 @@ static int gizmo_ruler_invoke(bContext *C, wmGizmo *gz, const wmEvent *event)
float co_ss[2][2];
float fac;
- ED_view3d_project_float_global(ar, ruler_item_pick->co[0], co_ss[0], V3D_PROJ_TEST_NOP);
- ED_view3d_project_float_global(ar, ruler_item_pick->co[2], co_ss[1], V3D_PROJ_TEST_NOP);
+ ED_view3d_project_float_global(
+ region, ruler_item_pick->co[0], co_ss[0], V3D_PROJ_TEST_NOP);
+ ED_view3d_project_float_global(
+ region, ruler_item_pick->co[2], co_ss[1], V3D_PROJ_TEST_NOP);
fac = line_point_factor_v2(mval_fl, co_ss[0], co_ss[1]);
CLAMP(fac, 0.0f, 1.0f);
@@ -1060,10 +1062,10 @@ static void WIDGETGROUP_ruler_setup(const bContext *C, wmGizmoGroup *gzgroup)
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ruler_info->win = win;
ruler_info->sa = sa;
- ruler_info->ar = ar;
+ ruler_info->region = region;
gzgroup->customdata = ruler_info;
}
@@ -1100,16 +1102,16 @@ static bool view3d_ruler_poll(bContext *C)
static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
BKE_report(op->reports, RPT_WARNING, "Gizmos hidden in this view");
return OPERATOR_CANCELLED;
}
- wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
const bool use_depth = (v3d->shading.type >= OB_SOLID);
@@ -1162,7 +1164,7 @@ void VIEW3D_OT_ruler_add(wmOperatorType *ot)
static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
if (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_TOOL)) {
@@ -1170,7 +1172,7 @@ static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent
return OPERATOR_CANCELLED;
}
- wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
if (gzgroup) {
RulerInfo *ruler_info = gzgroup->customdata;
@@ -1187,7 +1189,7 @@ static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent
/* Update the annotation layer. */
view3d_ruler_to_gpencil(C, gzgroup);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
return OPERATOR_FINISHED;
}
}
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
index 75d0384182b..2a07128b227 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_tool_generic.c
@@ -164,10 +164,10 @@ static void WIDGETGROUP_gizmo_message_subscribe(const bContext *C,
wmGizmoGroup *gzgroup,
struct wmMsgBus *mbus)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index c1690445a41..2ced545a108 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -91,8 +91,8 @@ void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);
void VIEW3D_OT_toggle_shading(struct wmOperatorType *ot);
void VIEW3D_OT_toggle_xray(struct wmOperatorType *ot);
-void view3d_boxview_copy(struct ScrArea *sa, struct ARegion *ar);
-void view3d_boxview_sync(struct ScrArea *sa, struct ARegion *ar);
+void view3d_boxview_copy(struct ScrArea *sa, struct ARegion *region);
+void view3d_boxview_sync(struct ScrArea *sa, struct ARegion *region);
void view3d_orbit_apply_dyn_ofs(float r_ofs[3],
const float ofs_old[3],
@@ -120,18 +120,18 @@ void VIEW3D_OT_fly(struct wmOperatorType *ot);
void VIEW3D_OT_walk(struct wmOperatorType *ot);
/* view3d_draw.c */
-void view3d_main_region_draw(const struct bContext *C, struct ARegion *ar);
-void view3d_draw_region_info(const struct bContext *C, struct ARegion *ar);
+void view3d_main_region_draw(const struct bContext *C, struct ARegion *region);
+void view3d_draw_region_info(const struct bContext *C, struct ARegion *region);
void ED_view3d_draw_depth(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
View3D *v3d,
bool alphaoverride);
/* view3d_draw_legacy.c */
void ED_view3d_draw_depth_gpencil(struct Depsgraph *depsgraph,
Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
View3D *v3d);
void ED_view3d_draw_select_loop(struct Depsgraph *depsgraph,
@@ -139,16 +139,16 @@ void ED_view3d_draw_select_loop(struct Depsgraph *depsgraph,
Scene *scene,
struct ViewLayer *view_layer,
View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
bool use_obedit_skip,
bool use_nearest);
void ED_view3d_draw_depth_loop(struct Depsgraph *depsgraph,
Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
View3D *v3d);
-void view3d_update_depths_rect(struct ARegion *ar, struct ViewDepths *d, struct rcti *rect);
+void view3d_update_depths_rect(struct ARegion *region, struct ViewDepths *d, struct rcti *rect);
float view3d_depth_near(struct ViewDepths *d);
/* view3d_select.c */
@@ -183,22 +183,22 @@ void ED_view3d_smooth_view_ex(const struct Depsgraph *depsgraph,
struct wmWindow *win,
struct ScrArea *sa,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
const int smooth_viewtx,
const V3D_SmoothParams *sview);
void ED_view3d_smooth_view(struct bContext *C,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
const int smooth_viewtx,
const V3D_SmoothParams *sview);
void ED_view3d_smooth_view_force_finish(struct bContext *C,
struct View3D *v3d,
- struct ARegion *ar);
+ struct ARegion *region);
void view3d_winmatrix_set(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
const View3D *v3d,
const rcti *rect);
void view3d_viewmatrix_set(struct Depsgraph *depsgraph,
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index f6fa6f6fb45..b446ba74b56 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -73,7 +73,7 @@ typedef struct foreachScreenEdge_userData {
int index);
void *userData;
ViewContext vc;
- rctf win_rect; /* copy of: vc.ar->winx/winy, use for faster tests, minx/y will always be 0 */
+ rctf win_rect; /* copy of: vc.region->winx/winy, use for faster tests, minx/y will always be 0 */
eV3DProjTest clip_flag;
} foreachScreenEdge_userData;
@@ -105,7 +105,7 @@ static void meshobject_foreachScreenVert__mapFunc(void *userData,
if (!(mv->flag & ME_HIDE)) {
float screen_co[2];
- if (ED_view3d_project_float_object(data->vc.ar, co, screen_co, data->clip_flag) !=
+ if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) !=
V3D_PROJ_RET_OK) {
return;
}
@@ -154,7 +154,7 @@ static void mesh_foreachScreenVert__mapFunc(void *userData,
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
float screen_co[2];
- if (ED_view3d_project_float_object(data->vc.ar, co, screen_co, data->clip_flag) !=
+ if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) !=
V3D_PROJ_RET_OK) {
return;
}
@@ -204,11 +204,11 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData,
float screen_co_b[2];
eV3DProjTest clip_flag_nowin = data->clip_flag & ~V3D_PROJ_TEST_CLIP_WIN;
- if (ED_view3d_project_float_object(data->vc.ar, v0co, screen_co_a, clip_flag_nowin) !=
+ if (ED_view3d_project_float_object(data->vc.region, v0co, screen_co_a, clip_flag_nowin) !=
V3D_PROJ_RET_OK) {
return;
}
- if (ED_view3d_project_float_object(data->vc.ar, v1co, screen_co_b, clip_flag_nowin) !=
+ if (ED_view3d_project_float_object(data->vc.region, v1co, screen_co_b, clip_flag_nowin) !=
V3D_PROJ_RET_OK) {
return;
}
@@ -243,8 +243,8 @@ void mesh_foreachScreenEdge(ViewContext *vc,
data.win_rect.xmin = 0;
data.win_rect.ymin = 0;
- data.win_rect.xmax = vc->ar->winx;
- data.win_rect.ymax = vc->ar->winy;
+ data.win_rect.xmax = vc->region->winx;
+ data.win_rect.ymax = vc->region->winy;
data.func = func;
data.userData = userData;
@@ -289,11 +289,11 @@ static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *userData,
eV3DProjTest clip_flag_nowin = data->clip_flag &
~(V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_BB);
- if (ED_view3d_project_float_object(data->vc.ar, v0co_clip, screen_co_a, clip_flag_nowin) !=
+ if (ED_view3d_project_float_object(data->vc.region, v0co_clip, screen_co_a, clip_flag_nowin) !=
V3D_PROJ_RET_OK) {
return;
}
- if (ED_view3d_project_float_object(data->vc.ar, v1co_clip, screen_co_b, clip_flag_nowin) !=
+ if (ED_view3d_project_float_object(data->vc.region, v1co_clip, screen_co_b, clip_flag_nowin) !=
V3D_PROJ_RET_OK) {
return;
}
@@ -332,8 +332,8 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc,
data.win_rect.xmin = 0;
data.win_rect.ymin = 0;
- data.win_rect.xmax = vc->ar->winx;
- data.win_rect.ymax = vc->ar->winy;
+ data.win_rect.xmax = vc->region->winx;
+ data.win_rect.ymax = vc->region->winy;
data.func = func;
data.userData = userData;
@@ -362,7 +362,7 @@ static void mesh_foreachScreenFace__mapFunc(void *userData,
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
float screen_co[2];
- if (ED_view3d_project_float_object(data->vc.ar, cent, screen_co, data->clip_flag) ==
+ if (ED_view3d_project_float_object(data->vc.region, cent, screen_co, data->clip_flag) ==
V3D_PROJ_RET_OK) {
data->func(data->userData, efa, screen_co, index);
}
@@ -430,7 +430,7 @@ void nurbs_foreachScreenVert(ViewContext *vc,
float screen_co[2];
if ((vc->v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_CU_HANDLES) == 0) {
- if (ED_view3d_project_float_object(vc->ar,
+ if (ED_view3d_project_float_object(vc->region,
bezt->vec[1],
screen_co,
V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
@@ -439,21 +439,21 @@ void nurbs_foreachScreenVert(ViewContext *vc,
}
}
else {
- if (ED_view3d_project_float_object(vc->ar,
+ if (ED_view3d_project_float_object(vc->region,
bezt->vec[0],
screen_co,
V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
V3D_PROJ_RET_OK) {
func(userData, nu, NULL, bezt, 0, screen_co);
}
- if (ED_view3d_project_float_object(vc->ar,
+ if (ED_view3d_project_float_object(vc->region,
bezt->vec[1],
screen_co,
V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
V3D_PROJ_RET_OK) {
func(userData, nu, NULL, bezt, 1, screen_co);
}
- if (ED_view3d_project_float_object(vc->ar,
+ if (ED_view3d_project_float_object(vc->region,
bezt->vec[2],
screen_co,
V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
@@ -471,7 +471,7 @@ void nurbs_foreachScreenVert(ViewContext *vc,
if (bp->hide == 0) {
float screen_co[2];
if (ED_view3d_project_float_object(
- vc->ar, bp->vec, screen_co, V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
+ vc->region, bp->vec, screen_co, V3D_PROJ_RET_CLIP_BB | V3D_PROJ_RET_CLIP_WIN) ==
V3D_PROJ_RET_OK) {
func(userData, nu, bp, NULL, -1, screen_co);
}
@@ -498,7 +498,8 @@ void mball_foreachScreenElem(struct ViewContext *vc,
for (ml = mb->editelems->first; ml; ml = ml->next) {
float screen_co[2];
- if (ED_view3d_project_float_object(vc->ar, &ml->x, screen_co, clip_flag) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_object(vc->region, &ml->x, screen_co, clip_flag) ==
+ V3D_PROJ_RET_OK) {
func(userData, ml, screen_co);
}
}
@@ -529,7 +530,7 @@ void lattice_foreachScreenVert(ViewContext *vc,
for (i = 0; i < N; i++, bp++, co += 3) {
if (bp->hide == 0) {
float screen_co[2];
- if (ED_view3d_project_float_object(vc->ar, dl ? co : bp->vec, screen_co, clip_flag) ==
+ if (ED_view3d_project_float_object(vc->region, dl ? co : bp->vec, screen_co, clip_flag) ==
V3D_PROJ_RET_OK) {
func(userData, bp, screen_co);
}
@@ -559,7 +560,7 @@ void armature_foreachScreenBone(struct ViewContext *vc,
int points_proj_tot = 0;
/* project head location to screenspace */
- if (ED_view3d_project_float_object(vc->ar, ebone->head, screen_co_a, clip_flag) ==
+ if (ED_view3d_project_float_object(vc->region, ebone->head, screen_co_a, clip_flag) ==
V3D_PROJ_RET_OK) {
points_proj_tot++;
}
@@ -569,7 +570,7 @@ void armature_foreachScreenBone(struct ViewContext *vc,
}
/* project tail location to screenspace */
- if (ED_view3d_project_float_object(vc->ar, ebone->tail, screen_co_b, clip_flag) ==
+ if (ED_view3d_project_float_object(vc->region, ebone->tail, screen_co_b, clip_flag) ==
V3D_PROJ_RET_OK) {
points_proj_tot++;
}
@@ -611,8 +612,8 @@ void pose_foreachScreenBone(struct ViewContext *vc,
int points_proj_tot = 0;
/* project head location to screenspace */
- if (ED_view3d_project_float_object(vc->ar, pchan_eval->pose_head, screen_co_a, clip_flag) ==
- V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_object(
+ vc->region, pchan_eval->pose_head, screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
points_proj_tot++;
}
else {
@@ -621,8 +622,8 @@ void pose_foreachScreenBone(struct ViewContext *vc,
}
/* project tail location to screenspace */
- if (ED_view3d_project_float_object(vc->ar, pchan_eval->pose_tail, screen_co_b, clip_flag) ==
- V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_object(
+ vc->region, pchan_eval->pose_tail, screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
points_proj_tot++;
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 56c8b4bcbe9..10791bd1c9f 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -47,7 +47,7 @@
/**
* \note use #ED_view3d_ob_project_mat_get to get the projection matrix
*/
-void ED_view3d_project_float_v2_m4(const ARegion *ar,
+void ED_view3d_project_float_v2_m4(const ARegion *region,
const float co[3],
float r_co[2],
float mat[4][4])
@@ -61,8 +61,8 @@ void ED_view3d_project_float_v2_m4(const ARegion *ar,
mul_m4_v4(mat, vec4);
if (vec4[3] > FLT_EPSILON) {
- r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
- r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
+ r_co[0] = (float)(region->winx / 2.0f) + (region->winx / 2.0f) * vec4[0] / vec4[3];
+ r_co[1] = (float)(region->winy / 2.0f) + (region->winy / 2.0f) * vec4[1] / vec4[3];
}
else {
zero_v2(r_co);
@@ -72,7 +72,7 @@ void ED_view3d_project_float_v2_m4(const ARegion *ar,
/**
* \note use #ED_view3d_ob_project_mat_get to get projecting mat
*/
-void ED_view3d_project_float_v3_m4(const ARegion *ar,
+void ED_view3d_project_float_v3_m4(const ARegion *region,
const float vec[3],
float r_co[3],
float mat[4][4])
@@ -86,8 +86,8 @@ void ED_view3d_project_float_v3_m4(const ARegion *ar,
mul_m4_v4(mat, vec4);
if (vec4[3] > FLT_EPSILON) {
- r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
- r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
+ r_co[0] = (float)(region->winx / 2.0f) + (region->winx / 2.0f) * vec4[0] / vec4[3];
+ r_co[1] = (float)(region->winy / 2.0f) + (region->winy / 2.0f) * vec4[1] / vec4[3];
r_co[2] = vec4[2] / vec4[3];
}
else {
@@ -98,10 +98,10 @@ void ED_view3d_project_float_v3_m4(const ARegion *ar,
/* Clipping Projection Functions
* ***************************** */
-eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *base)
+eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct Base *base)
{
eV3DProjStatus ret = ED_view3d_project_short_global(
- ar, base->object->obmat[3], &base->sx, V3D_PROJ_TEST_CLIP_DEFAULT);
+ region, base->object->obmat[3], &base->sx, V3D_PROJ_TEST_CLIP_DEFAULT);
if (ret != V3D_PROJ_RET_OK) {
base->sx = IS_CLIPPED;
@@ -115,7 +115,7 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas
* - 'rv3d->perspmat', is_local == false
* - 'rv3d->persmatob', is_local == true
*/
-static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
+static eV3DProjStatus ed_view3d_project__internal(const ARegion *region,
const float perspmat[4][4],
const bool is_local, /* normally hidden */
const float co[3],
@@ -128,7 +128,7 @@ static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
BLI_assert((flag & V3D_PROJ_TEST_ALL) == flag);
if (flag & V3D_PROJ_TEST_CLIP_BB) {
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->rflag & RV3D_CLIPPING) {
if (ED_view3d_clipping_test(rv3d, co, is_local)) {
return V3D_PROJ_RET_CLIP_BB;
@@ -143,10 +143,10 @@ static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
if (((flag & V3D_PROJ_TEST_CLIP_ZERO) == 0) || (fabsf(vec4[3]) > (float)BL_ZERO_CLIP)) {
if (((flag & V3D_PROJ_TEST_CLIP_NEAR) == 0) || (vec4[3] > (float)BL_NEAR_CLIP)) {
const float scalar = (vec4[3] != 0.0f) ? (1.0f / vec4[3]) : 0.0f;
- const float fx = ((float)ar->winx / 2.0f) * (1.0f + (vec4[0] * scalar));
- if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fx > 0.0f && fx < (float)ar->winx)) {
- const float fy = ((float)ar->winy / 2.0f) * (1.0f + (vec4[1] * scalar));
- if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fy > 0.0f && fy < (float)ar->winy)) {
+ const float fx = ((float)region->winx / 2.0f) * (1.0f + (vec4[0] * scalar));
+ if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fx > 0.0f && fx < (float)region->winx)) {
+ const float fy = ((float)region->winy / 2.0f) * (1.0f + (vec4[1] * scalar));
+ if (((flag & V3D_PROJ_TEST_CLIP_WIN) == 0) || (fy > 0.0f && fy < (float)region->winy)) {
r_co[0] = fx;
r_co[1] = fy;
@@ -174,7 +174,7 @@ static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
return V3D_PROJ_RET_OK;
}
-eV3DProjStatus ED_view3d_project_short_ex(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_ex(const ARegion *region,
float perspmat[4][4],
const bool is_local,
const float co[3],
@@ -182,7 +182,7 @@ eV3DProjStatus ED_view3d_project_short_ex(const ARegion *ar,
const eV3DProjTest flag)
{
float tvec[2];
- eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
+ eV3DProjStatus ret = ed_view3d_project__internal(region, perspmat, is_local, co, tvec, flag);
if (ret == V3D_PROJ_RET_OK) {
if ((tvec[0] > -32700.0f && tvec[0] < 32700.0f) &&
(tvec[1] > -32700.0f && tvec[1] < 32700.0f)) {
@@ -196,7 +196,7 @@ eV3DProjStatus ED_view3d_project_short_ex(const ARegion *ar,
return ret;
}
-eV3DProjStatus ED_view3d_project_int_ex(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_ex(const ARegion *region,
float perspmat[4][4],
const bool is_local,
const float co[3],
@@ -204,7 +204,7 @@ eV3DProjStatus ED_view3d_project_int_ex(const ARegion *ar,
const eV3DProjTest flag)
{
float tvec[2];
- eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
+ eV3DProjStatus ret = ed_view3d_project__internal(region, perspmat, is_local, co, tvec, flag);
if (ret == V3D_PROJ_RET_OK) {
if ((tvec[0] > -2140000000.0f && tvec[0] < 2140000000.0f) &&
(tvec[1] > -2140000000.0f && tvec[1] < 2140000000.0f)) {
@@ -218,7 +218,7 @@ eV3DProjStatus ED_view3d_project_int_ex(const ARegion *ar,
return ret;
}
-eV3DProjStatus ED_view3d_project_float_ex(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_ex(const ARegion *region,
float perspmat[4][4],
const bool is_local,
const float co[3],
@@ -226,7 +226,7 @@ eV3DProjStatus ED_view3d_project_float_ex(const ARegion *ar,
const eV3DProjTest flag)
{
float tvec[2];
- eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
+ eV3DProjStatus ret = ed_view3d_project__internal(region, perspmat, is_local, co, tvec, flag);
if (ret == V3D_PROJ_RET_OK) {
if (isfinite(tvec[0]) && isfinite(tvec[1])) {
copy_v2_v2(r_co, tvec);
@@ -239,63 +239,63 @@ eV3DProjStatus ED_view3d_project_float_ex(const ARegion *ar,
}
/* --- short --- */
-eV3DProjStatus ED_view3d_project_short_global(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_global(const ARegion *region,
const float co[3],
short r_co[2],
const eV3DProjTest flag)
{
- RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_short_ex(ar, rv3d->persmat, false, co, r_co, flag);
+ RegionView3D *rv3d = region->regiondata;
+ return ED_view3d_project_short_ex(region, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
-eV3DProjStatus ED_view3d_project_short_object(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_object(const ARegion *region,
const float co[3],
short r_co[2],
const eV3DProjTest flag)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
ED_view3d_check_mats_rv3d(rv3d);
- return ED_view3d_project_short_ex(ar, rv3d->persmatob, true, co, r_co, flag);
+ return ED_view3d_project_short_ex(region, rv3d->persmatob, true, co, r_co, flag);
}
/* --- int --- */
-eV3DProjStatus ED_view3d_project_int_global(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_global(const ARegion *region,
const float co[3],
int r_co[2],
const eV3DProjTest flag)
{
- RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_int_ex(ar, rv3d->persmat, false, co, r_co, flag);
+ RegionView3D *rv3d = region->regiondata;
+ return ED_view3d_project_int_ex(region, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
-eV3DProjStatus ED_view3d_project_int_object(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_object(const ARegion *region,
const float co[3],
int r_co[2],
const eV3DProjTest flag)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
ED_view3d_check_mats_rv3d(rv3d);
- return ED_view3d_project_int_ex(ar, rv3d->persmatob, true, co, r_co, flag);
+ return ED_view3d_project_int_ex(region, rv3d->persmatob, true, co, r_co, flag);
}
/* --- float --- */
-eV3DProjStatus ED_view3d_project_float_global(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_global(const ARegion *region,
const float co[3],
float r_co[2],
const eV3DProjTest flag)
{
- RegionView3D *rv3d = ar->regiondata;
- return ED_view3d_project_float_ex(ar, rv3d->persmat, false, co, r_co, flag);
+ RegionView3D *rv3d = region->regiondata;
+ return ED_view3d_project_float_ex(region, rv3d->persmat, false, co, r_co, flag);
}
/* object space, use ED_view3d_init_mats_rv3d before calling */
-eV3DProjStatus ED_view3d_project_float_object(const ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_object(const ARegion *region,
const float co[3],
float r_co[2],
const eV3DProjTest flag)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
ED_view3d_check_mats_rv3d(rv3d);
- return ED_view3d_project_float_ex(ar, rv3d->persmatob, true, co, r_co, flag);
+ return ED_view3d_project_float_ex(region, rv3d->persmatob, true, co, r_co, flag);
}
/* More Generic Window/Ray/Vector projection functions
@@ -338,7 +338,7 @@ float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_f
}
static void view3d_win_to_ray_segment(struct Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d,
const float mval[2],
float r_ray_co[3],
@@ -346,7 +346,7 @@ static void view3d_win_to_ray_segment(struct Depsgraph *depsgraph,
float r_ray_start[3],
float r_ray_end[3])
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float _ray_co[3], _ray_dir[3], start_offset, end_offset;
if (!r_ray_co) {
@@ -356,8 +356,8 @@ static void view3d_win_to_ray_segment(struct Depsgraph *depsgraph,
r_ray_dir = _ray_dir;
}
- ED_view3d_win_to_origin(ar, mval, r_ray_co);
- ED_view3d_win_to_vector(ar, mval, r_ray_dir);
+ ED_view3d_win_to_origin(region, mval, r_ray_co);
+ ED_view3d_win_to_vector(region, mval, r_ray_dir);
if ((rv3d->is_persp == false) && (rv3d->persp != RV3D_CAMOB)) {
end_offset = v3d->clip_end / 2.0f;
@@ -391,7 +391,7 @@ bool ED_view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float
* In orthographic view the resulting ray_normal will match the view vector.
* This version also returns the ray_co point of the ray on window plane, useful to fix precision
* issues esp. with ortho view, where default ray_start is set rather far away.
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param v3d: The 3d viewport (used for near clipping value).
* \param mval: The area relative 2d location (such as event->mval, converted into float[2]).
* \param r_ray_co: The world-space point where the ray intersects the window plane.
@@ -401,7 +401,7 @@ bool ED_view3d_clip_segment(const RegionView3D *rv3d, float ray_start[3], float
* \return success, false if the ray is totally clipped.
*/
bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d,
const float mval[2],
float r_ray_co[3],
@@ -412,11 +412,11 @@ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
float ray_end[3];
view3d_win_to_ray_segment(
- depsgraph, ar, v3d, mval, r_ray_co, r_ray_normal, r_ray_start, ray_end);
+ depsgraph, region, v3d, mval, r_ray_co, r_ray_normal, r_ray_start, ray_end);
/* bounds clipping */
if (do_clip_planes) {
- return ED_view3d_clip_segment(ar->regiondata, r_ray_start, ray_end);
+ return ED_view3d_clip_segment(region->regiondata, r_ray_start, ray_end);
}
return true;
@@ -427,7 +427,7 @@ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
* This ray_start is located at the viewpoint, ray_normal is the direction towards mval.
* ray_start is clipped by the view near limit so points in front of it are always in view.
* In orthographic view the resulting ray_normal will match the view vector.
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param v3d: The 3d viewport (used for near clipping value).
* \param mval: The area relative 2d location (such as event->mval, converted into float[2]).
* \param r_ray_start: The world-space point where the ray intersects the window plane.
@@ -436,7 +436,7 @@ bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
* \return success, false if the ray is totally clipped.
*/
bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d,
const float mval[2],
float r_ray_start[3],
@@ -444,13 +444,13 @@ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph,
const bool do_clip_planes)
{
return ED_view3d_win_to_ray_clipped_ex(
- depsgraph, ar, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip_planes);
+ depsgraph, region, v3d, mval, NULL, r_ray_normal, r_ray_start, do_clip_planes);
}
/**
* Calculate a 3d viewpoint and direction vector from 2d window coordinates.
* This ray_start is located at the viewpoint, ray_normal is the direction towards mval.
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param mval: The area relative 2d location (such as event->mval, converted into float[2]).
* \param r_ray_start: The world-space point where the ray intersects the window plane.
* \param r_ray_normal: The normalized world-space direction of towards mval.
@@ -458,13 +458,13 @@ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph,
* \note Ignores view near/far clipping,
* to take this into account use #ED_view3d_win_to_ray_clipped.
*/
-void ED_view3d_win_to_ray(const ARegion *ar,
+void ED_view3d_win_to_ray(const ARegion *region,
const float mval[2],
float r_ray_start[3],
float r_ray_normal[3])
{
- ED_view3d_win_to_origin(ar, mval, r_ray_start);
- ED_view3d_win_to_vector(ar, mval, r_ray_normal);
+ ED_view3d_win_to_origin(region, mval, r_ray_start);
+ ED_view3d_win_to_vector(region, mval, r_ray_normal);
}
/**
@@ -499,22 +499,22 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3],
/* very similar to ED_view3d_win_to_3d() but has no advantage, de-duplicating */
#if 0
-bool view3d_get_view_aligned_coordinate(ARegion *ar,
+bool view3d_get_view_aligned_coordinate(ARegion *region,
float fp[3],
const int mval[2],
const bool do_fallback)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float dvec[3];
int mval_cpy[2];
eV3DProjStatus ret;
- ret = ED_view3d_project_int_global(ar, fp, mval_cpy, V3D_PROJ_TEST_NOP);
+ ret = ED_view3d_project_int_global(region, fp, mval_cpy, V3D_PROJ_TEST_NOP);
if (ret == V3D_PROJ_RET_OK) {
const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]), (float)(mval_cpy[1] - mval[1])};
const float zfac = ED_view3d_calc_zfac(rv3d, fp, NULL);
- ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
+ ED_view3d_win_to_delta(region, mval_f, dvec, zfac);
sub_v3_v3(fp, dvec);
return true;
@@ -523,7 +523,7 @@ bool view3d_get_view_aligned_coordinate(ARegion *ar,
/* fallback to the view center */
if (do_fallback) {
negate_v3_v3(fp, rv3d->ofs);
- return view3d_get_view_aligned_coordinate(ar, fp, mval, false);
+ return view3d_get_view_aligned_coordinate(region, fp, mval, false);
}
else {
return false;
@@ -534,18 +534,18 @@ bool view3d_get_view_aligned_coordinate(ARegion *ar,
/**
* Calculate a 3d location from 2d window coordinates.
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param depth_pt: The reference location used to calculate the Z depth.
* \param mval: The area relative location (such as event->mval converted to floats).
* \param r_out: The resulting world-space location.
*/
void ED_view3d_win_to_3d(const View3D *v3d,
- const ARegion *ar,
+ const ARegion *region,
const float depth_pt[3],
const float mval[2],
float r_out[3])
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float ray_origin[3];
float ray_direction[3];
@@ -555,7 +555,7 @@ void ED_view3d_win_to_3d(const View3D *v3d,
float plane[4];
copy_v3_v3(ray_origin, rv3d->viewinv[3]);
- ED_view3d_win_to_vector(ar, mval, ray_direction);
+ ED_view3d_win_to_vector(region, mval, ray_direction);
/* note, we could use isect_line_plane_v3()
* however we want the intersection to be infront of the view no matter what,
@@ -566,16 +566,16 @@ void ED_view3d_win_to_3d(const View3D *v3d,
lambda = fabsf(lambda);
}
else {
- float dx = (2.0f * mval[0] / (float)ar->winx) - 1.0f;
- float dy = (2.0f * mval[1] / (float)ar->winy) - 1.0f;
+ float dx = (2.0f * mval[0] / (float)region->winx) - 1.0f;
+ float dy = (2.0f * mval[1] / (float)region->winy) - 1.0f;
if (rv3d->persp == RV3D_CAMOB) {
/* ortho camera needs offset applied */
const Camera *cam = v3d->camera->data;
- const int sensor_fit = BKE_camera_sensor_fit(cam->sensor_fit, ar->winx, ar->winy);
+ const int sensor_fit = BKE_camera_sensor_fit(cam->sensor_fit, region->winx, region->winy);
const float zoomfac = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom) * 4.0f;
- const float aspx = ar->winx / (float)ar->winy;
- const float aspy = ar->winy / (float)ar->winx;
+ const float aspx = region->winx / (float)region->winy;
+ const float aspy = region->winy / (float)region->winx;
const float shiftx = cam->shiftx * 0.5f *
(sensor_fit == CAMERA_SENSOR_FIT_HOR ? 1.0f : aspy);
const float shifty = cam->shifty * 0.5f *
@@ -596,24 +596,24 @@ void ED_view3d_win_to_3d(const View3D *v3d,
}
void ED_view3d_win_to_3d_int(const View3D *v3d,
- const ARegion *ar,
+ const ARegion *region,
const float depth_pt[3],
const int mval[2],
float r_out[3])
{
const float mval_fl[2] = {mval[0], mval[1]};
- ED_view3d_win_to_3d(v3d, ar, depth_pt, mval_fl, r_out);
+ ED_view3d_win_to_3d(v3d, region, depth_pt, mval_fl, r_out);
}
-bool ED_view3d_win_to_3d_on_plane(const ARegion *ar,
+bool ED_view3d_win_to_3d_on_plane(const ARegion *region,
const float plane[4],
const float mval[2],
const bool do_clip,
float r_out[3])
{
float ray_co[3], ray_no[3];
- ED_view3d_win_to_origin(ar, mval, ray_co);
- ED_view3d_win_to_vector(ar, mval, ray_no);
+ ED_view3d_win_to_origin(region, mval, ray_co);
+ ED_view3d_win_to_vector(region, mval, ray_no);
float lambda;
if (isect_ray_plane_v3(ray_co, ray_no, plane, &lambda, do_clip)) {
madd_v3_v3v3fl(r_out, ray_co, ray_no, lambda);
@@ -622,28 +622,34 @@ bool ED_view3d_win_to_3d_on_plane(const ARegion *ar,
return false;
}
-bool ED_view3d_win_to_3d_on_plane_int(
- const ARegion *ar, const float plane[4], const int mval[2], const bool do_clip, float r_out[3])
+bool ED_view3d_win_to_3d_on_plane_int(const ARegion *region,
+ const float plane[4],
+ const int mval[2],
+ const bool do_clip,
+ float r_out[3])
{
const float mval_fl[2] = {mval[0], mval[1]};
- return ED_view3d_win_to_3d_on_plane(ar, plane, mval_fl, do_clip, r_out);
+ return ED_view3d_win_to_3d_on_plane(region, plane, mval_fl, do_clip, r_out);
}
/**
* Calculate a 3d difference vector from 2d window offset.
* note that #ED_view3d_calc_zfac() must be called first to determine
* the depth used to calculate the delta.
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param mval: The area relative 2d difference (such as event->mval[0] - other_x).
* \param out: The resulting world-space delta.
*/
-void ED_view3d_win_to_delta(const ARegion *ar, const float mval[2], float out[3], const float zfac)
+void ED_view3d_win_to_delta(const ARegion *region,
+ const float mval[2],
+ float out[3],
+ const float zfac)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float dx, dy;
- dx = 2.0f * mval[0] * zfac / ar->winx;
- dy = 2.0f * mval[1] * zfac / ar->winy;
+ dx = 2.0f * mval[0] * zfac / region->winx;
+ dy = 2.0f * mval[1] * zfac / region->winy;
out[0] = (rv3d->persinv[0][0] * dx + rv3d->persinv[1][0] * dy);
out[1] = (rv3d->persinv[0][1] * dx + rv3d->persinv[1][1] * dy);
@@ -656,19 +662,19 @@ void ED_view3d_win_to_delta(const ARegion *ar, const float mval[2], float out[3]
* Since far clip can be a very large value resulting in numeric precision issues,
* the origin in this case is close to zero coordinate.
*
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param mval: The area relative 2d location (such as event->mval converted to floats).
* \param out: The resulting normalized world-space direction vector.
*/
-void ED_view3d_win_to_origin(const ARegion *ar, const float mval[2], float out[3])
+void ED_view3d_win_to_origin(const ARegion *region, const float mval[2], float out[3])
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->is_persp) {
copy_v3_v3(out, rv3d->viewinv[3]);
}
else {
- out[0] = 2.0f * mval[0] / ar->winx - 1.0f;
- out[1] = 2.0f * mval[1] / ar->winy - 1.0f;
+ out[0] = 2.0f * mval[0] / region->winx - 1.0f;
+ out[1] = 2.0f * mval[1] / region->winy - 1.0f;
if (rv3d->persp == RV3D_CAMOB) {
out[2] = -1.0f;
@@ -690,17 +696,17 @@ void ED_view3d_win_to_origin(const ARegion *ar, const float mval[2], float out[3
* for perspective view, get the vector direction to
* the mouse cursor as a normalized vector.
*
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param mval: The area relative 2d location (such as event->mval converted to floats).
* \param out: The resulting normalized world-space direction vector.
*/
-void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3])
+void ED_view3d_win_to_vector(const ARegion *region, const float mval[2], float out[3])
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->is_persp) {
- out[0] = 2.0f * (mval[0] / ar->winx) - 1.0f;
- out[1] = 2.0f * (mval[1] / ar->winy) - 1.0f;
+ out[0] = 2.0f * (mval[0] / region->winx) - 1.0f;
+ out[1] = 2.0f * (mval[1] / region->winy) - 1.0f;
out[2] = -0.5f;
mul_project_m4_v3(rv3d->persinv, out);
sub_v3_v3(out, rv3d->viewinv[3]);
@@ -717,7 +723,7 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3
* ray_start and ray_end are clipped by the view near and far limits
* so points along this line are always in view.
* In orthographic view all resulting segments will be parallel.
- * \param ar: The region (used for the window width and height).
+ * \param region: The region (used for the window width and height).
* \param v3d: The 3d viewport (used for near and far clipping range).
* \param mval: The area relative 2d location (such as event->mval, converted into float[2]).
* \param r_ray_start: The world-space starting point of the segment.
@@ -726,18 +732,18 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3
* \return success, false if the segment is totally clipped.
*/
bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
- const ARegion *ar,
+ const ARegion *region,
View3D *v3d,
const float mval[2],
float r_ray_start[3],
float r_ray_end[3],
const bool do_clip_planes)
{
- view3d_win_to_ray_segment(depsgraph, ar, v3d, mval, NULL, NULL, r_ray_start, r_ray_end);
+ view3d_win_to_ray_segment(depsgraph, region, v3d, mval, NULL, NULL, r_ray_start, r_ray_end);
/* bounds clipping */
if (do_clip_planes) {
- return ED_view3d_clip_segment((RegionView3D *)ar->regiondata, r_ray_start, r_ray_end);
+ return ED_view3d_clip_segment((RegionView3D *)region->regiondata, r_ray_start, r_ray_end);
}
return true;
@@ -767,21 +773,21 @@ void ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d,
/**
* Convert between region relative coordinates (x,y) and depth component z and
* a point in world space. */
-void ED_view3d_project(const struct ARegion *ar, const float world[3], float region[3])
+void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3])
{
// viewport is set up to make coordinates relative to the region, not window
- RegionView3D *rv3d = ar->regiondata;
- int viewport[4] = {0, 0, ar->winx, ar->winy};
+ RegionView3D *rv3d = region->regiondata;
+ int viewport[4] = {0, 0, region->winx, region->winy};
- GPU_matrix_project(world, rv3d->viewmat, rv3d->winmat, viewport, region);
+ GPU_matrix_project(world, rv3d->viewmat, rv3d->winmat, viewport, r_region_co);
}
bool ED_view3d_unproject(
- const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3])
+ const struct ARegion *region, float regionx, float regiony, float regionz, float world[3])
{
- RegionView3D *rv3d = ar->regiondata;
- int viewport[4] = {0, 0, ar->winx, ar->winy};
- float region[3] = {regionx, regiony, regionz};
+ RegionView3D *rv3d = region->regiondata;
+ int viewport[4] = {0, 0, region->winx, region->winy};
+ float region_co[3] = {regionx, regiony, regionz};
- return GPU_matrix_unproject(region, rv3d->viewmat, rv3d->winmat, viewport, world);
+ return GPU_matrix_unproject(region_co, rv3d->viewmat, rv3d->winmat, viewport, world);
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 89baf60bd8c..7649bd45a1a 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -124,7 +124,7 @@ void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc, Depsgraph *depsgra
{
memset(vc, 0, sizeof(ViewContext));
vc->C = C;
- vc->ar = CTX_wm_region(C);
+ vc->region = CTX_wm_region(C);
vc->bmain = CTX_data_main(C);
vc->depsgraph = depsgraph;
vc->scene = CTX_data_scene(C);
@@ -589,7 +589,7 @@ static bool do_lasso_select_objects(ViewContext *vc,
for (base = vc->view_layer->object_bases.first; base; base = base->next) {
if (BASE_SELECTABLE(v3d, base)) { /* use this to avoid un-needed lasso lookups */
const bool is_select = base->flag & BASE_SELECTED;
- const bool is_inside = ((ED_view3d_project_base(vc->ar, base) == V3D_PROJ_RET_OK) &&
+ const bool is_inside = ((ED_view3d_project_base(vc->region, base) == V3D_PROJ_RET_OK) &&
BLI_lasso_is_point_inside(
mcords, moves, base->sx, base->sy, IS_CLIPPED));
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
@@ -836,7 +836,7 @@ static bool do_lasso_select_mesh(ViewContext *vc,
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, ts->selectmode);
esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_poly(
- vc->depsgraph, vc->ar, vc->v3d, mcords, moves, &rect, NULL);
+ vc->depsgraph, vc->region, vc->v3d, mcords, moves, &rect, NULL);
}
}
@@ -1151,7 +1151,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc,
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_VERTEX);
esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_poly(
- vc->depsgraph, vc->ar, vc->v3d, mcords, moves, &rect, NULL);
+ vc->depsgraph, vc->region, vc->v3d, mcords, moves, &rect, NULL);
}
}
@@ -1210,7 +1210,7 @@ static bool do_lasso_select_paintface(ViewContext *vc,
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_FACE);
esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_poly(
- vc->depsgraph, vc->ar, vc->v3d, mcords, moves, &rect, NULL);
+ vc->depsgraph, vc->region, vc->v3d, mcords, moves, &rect, NULL);
}
if (esel->select_bitmap) {
@@ -1566,7 +1566,7 @@ static Base *object_mouse_select_menu(bContext *C,
}
else {
const int dist = 15 * U.pixelsize;
- if (ED_view3d_project_base(vc->ar, base) == V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_base(vc->region, base) == V3D_PROJ_RET_OK) {
const int delta_px[2] = {base->sx - mval[0], base->sy - mval[1]};
if (len_manhattan_v2_int(delta_px) < dist) {
ok = true;
@@ -1971,7 +1971,7 @@ static bool ed_object_select_pick(bContext *C,
/* setup view context for argument to callbacks */
ED_view3d_viewcontext_init(C, &vc, depsgraph);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -2015,7 +2015,7 @@ static bool ed_object_select_pick(bContext *C,
while (base) {
if (BASE_SELECTABLE(v3d, base)) {
float screen_co[2];
- if (ED_view3d_project_float_global(ar,
+ if (ED_view3d_project_float_global(region,
base->object->obmat[3],
screen_co,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN |
@@ -2600,7 +2600,7 @@ static bool do_paintvert_box_select(ViewContext *vc,
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_VERTEX);
esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_rect(
- vc->depsgraph, vc->ar, vc->v3d, rect, NULL);
+ vc->depsgraph, vc->region, vc->v3d, rect, NULL);
}
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_verts_obmode(me, esel, sel_op);
@@ -2655,7 +2655,7 @@ static bool do_paintface_box_select(ViewContext *vc,
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, SCE_SELECT_FACE);
esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_rect(
- vc->depsgraph, vc->ar, vc->v3d, rect, NULL);
+ vc->depsgraph, vc->region, vc->v3d, rect, NULL);
}
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_faces_obmode(me, esel, sel_op);
@@ -2857,7 +2857,7 @@ static bool do_mesh_box_select(ViewContext *vc,
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc, ts->selectmode);
esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_rect(
- vc->depsgraph, vc->ar, vc->v3d, rect, NULL);
+ vc->depsgraph, vc->region, vc->v3d, rect, NULL);
}
}
@@ -3456,7 +3456,7 @@ static bool mesh_circle_select(ViewContext *vc,
if (use_zbuf) {
if (esel->select_bitmap == NULL) {
esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(
- vc->depsgraph, vc->ar, vc->v3d, mval, (int)(rad + 1.0f), NULL);
+ vc->depsgraph, vc->region, vc->v3d, mval, (int)(rad + 1.0f), NULL);
}
}
@@ -3528,7 +3528,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
{
struct EditSelectBuf_Cache *esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(
- vc->depsgraph, vc->ar, vc->v3d, mval, (int)(rad + 1.0f), NULL);
+ vc->depsgraph, vc->region, vc->v3d, mval, (int)(rad + 1.0f), NULL);
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_faces_obmode(me, esel, sel_op);
MEM_freeN(esel->select_bitmap);
@@ -3583,7 +3583,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
if (use_zbuf) {
struct EditSelectBuf_Cache *esel = wm_userdata->data;
esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(
- vc->depsgraph, vc->ar, vc->v3d, mval, (int)(rad + 1.0f), NULL);
+ vc->depsgraph, vc->region, vc->v3d, mval, (int)(rad + 1.0f), NULL);
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_verts_obmode(me, esel, sel_op);
MEM_freeN(esel->select_bitmap);
@@ -3999,7 +3999,7 @@ static bool object_circle_select(ViewContext *vc,
for (base = FIRSTBASE(view_layer); base; base = base->next) {
if (BASE_SELECTABLE(v3d, base) && ((base->flag & BASE_SELECTED) != select_flag)) {
float screen_co[2];
- if (ED_view3d_project_float_global(vc->ar,
+ if (ED_view3d_project_float_global(vc->region,
base->object->obmat[3],
screen_co,
V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN |
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 08a4947dc18..f6ec5c93e7f 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -181,21 +181,21 @@ bool ED_view3d_viewplane_get(Depsgraph *depsgraph,
void view3d_operator_needs_opengl(const bContext *C)
{
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- view3d_region_operator_needs_opengl(win, ar);
+ view3d_region_operator_needs_opengl(win, region);
}
-void view3d_region_operator_needs_opengl(wmWindow *UNUSED(win), ARegion *ar)
+void view3d_region_operator_needs_opengl(wmWindow *UNUSED(win), ARegion *region)
{
/* for debugging purpose, context should always be OK */
- if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW)) {
+ if ((region == NULL) || (region->regiontype != RGN_TYPE_WINDOW)) {
printf("view3d_region_operator_needs_opengl error, wrong region\n");
}
else {
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
- wmViewport(&ar->winrct); // TODO: bad
+ wmViewport(&region->winrct); // TODO: bad
GPU_matrix_projection_set(rv3d->winmat);
GPU_matrix_set(rv3d->viewmat);
}
@@ -230,7 +230,7 @@ bool ED_view3d_context_activate(bContext *C)
{
bScreen *sc = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar;
+ ARegion *region;
/* sa can be NULL when called from python */
if (sa == NULL || sa->spacetype != SPACE_VIEW3D) {
@@ -241,14 +241,14 @@ bool ED_view3d_context_activate(bContext *C)
return false;
}
- ar = BKE_area_find_region_active_win(sa);
- if (ar == NULL) {
+ region = BKE_area_find_region_active_win(sa);
+ if (region == NULL) {
return false;
}
/* bad context switch .. */
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
return true;
}
@@ -277,7 +277,7 @@ void ED_view3d_clipping_calc_from_boundbox(float clip[4][4],
}
void ED_view3d_clipping_calc(
- BoundBox *bb, float planes[4][4], const ARegion *ar, const Object *ob, const rcti *rect)
+ BoundBox *bb, float planes[4][4], const ARegion *region, const Object *ob, const rcti *rect)
{
/* init in case unproject fails */
memset(bb->vec, 0, sizeof(bb->vec));
@@ -288,8 +288,8 @@ void ED_view3d_clipping_calc(
float xs = (val == 0 || val == 3) ? rect->xmin : rect->xmax;
float ys = (val == 0 || val == 1) ? rect->ymin : rect->ymax;
- ED_view3d_unproject(ar, xs, ys, 0.0, bb->vec[val]);
- ED_view3d_unproject(ar, xs, ys, 1.0, bb->vec[4 + val]);
+ ED_view3d_unproject(region, xs, ys, 0.0, bb->vec[val]);
+ ED_view3d_unproject(region, xs, ys, 1.0, bb->vec[4 + val]);
}
/* optionally transform to object space */
@@ -453,9 +453,9 @@ void ED_view3d_persp_switch_from_camera(const Depsgraph *depsgraph,
*
* shared with NDOF.
*/
-bool ED_view3d_persp_ensure(const Depsgraph *depsgraph, View3D *v3d, ARegion *ar)
+bool ED_view3d_persp_ensure(const Depsgraph *depsgraph, View3D *v3d, ARegion *region)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
const bool autopersp = (U.uiflag & USER_AUTOPERSP) != 0;
BLI_assert((rv3d->viewlock & RV3D_LOCKED) == 0);
@@ -664,28 +664,28 @@ bool ED_view3d_camera_lock_autokey(View3D *v3d,
static void view3d_boxview_clip(ScrArea *sa)
{
- ARegion *ar;
+ ARegion *region;
BoundBox *bb = MEM_callocN(sizeof(BoundBox), "clipbb");
float clip[6][4];
float x1 = 0.0f, y1 = 0.0f, z1 = 0.0f, ofs[3] = {0.0f, 0.0f, 0.0f};
int val;
/* create bounding box */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->viewlock & RV3D_BOXCLIP) {
if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
- if (ar->winx > ar->winy) {
+ if (region->winx > region->winy) {
x1 = rv3d->dist;
}
else {
- x1 = ar->winx * rv3d->dist / ar->winy;
+ x1 = region->winx * rv3d->dist / region->winy;
}
- if (ar->winx > ar->winy) {
- y1 = ar->winy * rv3d->dist / ar->winx;
+ if (region->winx > region->winy) {
+ y1 = region->winy * rv3d->dist / region->winx;
}
else {
y1 = rv3d->dist;
@@ -695,8 +695,8 @@ static void view3d_boxview_clip(ScrArea *sa)
else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
ofs[2] = rv3d->ofs[2];
- if (ar->winx > ar->winy) {
- z1 = ar->winy * rv3d->dist / ar->winx;
+ if (region->winx > region->winy) {
+ z1 = region->winy * rv3d->dist / region->winx;
}
else {
z1 = rv3d->dist;
@@ -743,9 +743,9 @@ static void view3d_boxview_clip(ScrArea *sa)
}
/* create bounding box */
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->viewlock & RV3D_BOXCLIP) {
rv3d->rflag |= RV3D_CLIPPING;
@@ -808,14 +808,14 @@ static void view3d_boxview_sync_axis(RegionView3D *rv3d_dst, RegionView3D *rv3d_
}
/* sync center/zoom view of region to others, for view transforms */
-void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
+void view3d_boxview_sync(ScrArea *sa, ARegion *region)
{
ARegion *artest;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
short clip = 0;
for (artest = sa->regionbase.first; artest; artest = artest->next) {
- if (artest != ar && artest->regiontype == RGN_TYPE_WINDOW) {
+ if (artest != region && artest->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3dtest = artest->regiondata;
if (rv3dtest->viewlock & RV3D_LOCKED) {
@@ -834,14 +834,14 @@ void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
}
/* for home, center etc */
-void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
+void view3d_boxview_copy(ScrArea *sa, ARegion *region)
{
ARegion *artest;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
bool clip = false;
for (artest = sa->regionbase.first; artest; artest = artest->next) {
- if (artest != ar && artest->regiontype == RGN_TYPE_WINDOW) {
+ if (artest != region && artest->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3dtest = artest->regiondata;
if (rv3dtest->viewlock) {
@@ -860,10 +860,10 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
}
/* 'clip' is used to know if our clip setting has changed */
-void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
+void ED_view3d_quadview_update(ScrArea *sa, ARegion *region, bool do_clip)
{
ARegion *ar_sync = NULL;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
short viewlock;
/* this function copies flags from the first of the 3 other quadview
* regions to the 2 other, so it assumes this is the region whose
@@ -879,9 +879,9 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
viewlock &= ~RV3D_BOXCLIP;
}
- for (; ar; ar = ar->prev) {
- if (ar->alignment == RGN_ALIGN_QSPLIT) {
- rv3d = ar->regiondata;
+ for (; region; region = region->prev) {
+ if (region->alignment == RGN_ALIGN_QSPLIT) {
+ rv3d = region->regiondata;
rv3d->viewlock = viewlock;
if (do_clip && (viewlock & RV3D_BOXCLIP) == 0) {
@@ -891,7 +891,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
/* use ar_sync so we sync with one of the aligned views below
* else the view jumps on changing view settings like 'clip'
* since it copies from the perspective view */
- ar_sync = ar;
+ ar_sync = region;
}
}
@@ -902,9 +902,9 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
/* ensure locked regions have an axis, locked user views don't make much sense */
if (viewlock & RV3D_LOCKED) {
int index_qsplit = 0;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->alignment == RGN_ALIGN_QSPLIT) {
- rv3d = ar->regiondata;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->alignment == RGN_ALIGN_QSPLIT) {
+ rv3d = region->regiondata;
if (rv3d->viewlock) {
if (!RV3D_VIEW_IS_AXIS(rv3d->view) || (rv3d->view_axis_roll != RV3D_VIEW_AXIS_ROLL_0)) {
rv3d->view = ED_view3d_lock_view_from_index(index_qsplit);
@@ -927,7 +927,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, bool do_clip)
/** \name View Auto-Depth Utilities
* \{ */
-static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int margin)
+static float view_autodist_depth_margin(ARegion *region, const int mval[2], int margin)
{
ViewDepths depth_temp = {0};
rcti rect;
@@ -944,7 +944,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
BLI_rcti_init_pt_radius(&rect, mval, margin);
}
- view3d_update_depths_rect(ar, &depth_temp, &rect);
+ view3d_update_depths_rect(region, &depth_temp, &rect);
depth_close = view3d_depth_near(&depth_temp);
MEM_SAFE_FREE(depth_temp.depths);
return depth_close;
@@ -958,7 +958,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
* \param fallback_depth_pt: Use this points depth when no depth can be found.
*/
bool ED_view3d_autodist(Depsgraph *depsgraph,
- ARegion *ar,
+ ARegion *region,
View3D *v3d,
const int mval[2],
float mouse_worldloc[3],
@@ -971,12 +971,12 @@ bool ED_view3d_autodist(Depsgraph *depsgraph,
bool depth_ok = false;
/* Get Z Depths, needed for perspective, nice for ortho */
- ED_view3d_draw_depth(depsgraph, ar, v3d, alphaoverride);
+ ED_view3d_draw_depth(depsgraph, region, v3d, alphaoverride);
/* Attempt with low margin's first */
i = 0;
do {
- depth_close = view_autodist_depth_margin(ar, mval, margin_arr[i++] * U.pixelsize);
+ depth_close = view_autodist_depth_margin(region, mval, margin_arr[i++] * U.pixelsize);
depth_ok = (depth_close != FLT_MAX);
} while ((depth_ok == false) && (i < ARRAY_SIZE(margin_arr)));
@@ -984,13 +984,13 @@ bool ED_view3d_autodist(Depsgraph *depsgraph,
float centx = (float)mval[0] + 0.5f;
float centy = (float)mval[1] + 0.5f;
- if (ED_view3d_unproject(ar, centx, centy, depth_close, mouse_worldloc)) {
+ if (ED_view3d_unproject(region, centx, centy, depth_close, mouse_worldloc)) {
return true;
}
}
if (fallback_depth_pt) {
- ED_view3d_win_to_3d_int(v3d, ar, fallback_depth_pt, mval, mouse_worldloc);
+ ED_view3d_win_to_3d_int(v3d, region, fallback_depth_pt, mval, mouse_worldloc);
return true;
}
else {
@@ -998,16 +998,16 @@ bool ED_view3d_autodist(Depsgraph *depsgraph,
}
}
-void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, int mode)
+void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, int mode)
{
/* Get Z Depths, needed for perspective, nice for ortho */
switch (mode) {
case 0:
- ED_view3d_draw_depth(depsgraph, ar, v3d, true);
+ ED_view3d_draw_depth(depsgraph, region, v3d, true);
break;
case 1: {
Scene *scene = DEG_get_evaluated_scene(depsgraph);
- ED_view3d_draw_depth_gpencil(depsgraph, scene, ar, v3d);
+ ED_view3d_draw_depth_gpencil(depsgraph, scene, region, v3d);
break;
}
}
@@ -1015,7 +1015,7 @@ void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, int
/* no 4x4 sampling, run #ED_view3d_autodist_init first */
bool ED_view3d_autodist_simple(
- ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth)
+ ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth)
{
float depth;
@@ -1024,7 +1024,7 @@ bool ED_view3d_autodist_simple(
depth = *force_depth;
}
else {
- depth = view_autodist_depth_margin(ar, mval, margin);
+ depth = view_autodist_depth_margin(region, mval, margin);
}
if (depth == FLT_MAX) {
@@ -1033,12 +1033,12 @@ bool ED_view3d_autodist_simple(
float centx = (float)mval[0] + 0.5f;
float centy = (float)mval[1] + 0.5f;
- return ED_view3d_unproject(ar, centx, centy, depth, mouse_worldloc);
+ return ED_view3d_unproject(region, centx, centy, depth, mouse_worldloc);
}
-bool ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float *depth)
+bool ED_view3d_autodist_depth(ARegion *region, const int mval[2], int margin, float *depth)
{
- *depth = view_autodist_depth_margin(ar, mval, margin);
+ *depth = view_autodist_depth_margin(region, mval, margin);
return (*depth != FLT_MAX);
}
@@ -1046,7 +1046,7 @@ bool ED_view3d_autodist_depth(ARegion *ar, const int mval[2], int margin, float
static bool depth_segment_cb(int x, int y, void *userData)
{
struct {
- ARegion *ar;
+ ARegion *region;
int margin;
float depth;
} *data = userData;
@@ -1056,7 +1056,7 @@ static bool depth_segment_cb(int x, int y, void *userData)
mval[0] = x;
mval[1] = y;
- depth = view_autodist_depth_margin(data->ar, mval, data->margin);
+ depth = view_autodist_depth_margin(data->region, mval, data->margin);
if (depth != FLT_MAX) {
data->depth = depth;
@@ -1068,17 +1068,17 @@ static bool depth_segment_cb(int x, int y, void *userData)
}
bool ED_view3d_autodist_depth_seg(
- ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
+ ARegion *region, const int mval_sta[2], const int mval_end[2], int margin, float *depth)
{
struct {
- ARegion *ar;
+ ARegion *region;
int margin;
float depth;
} data = {NULL};
int p1[2];
int p2[2];
- data.ar = ar;
+ data.region = region;
data.margin = margin;
data.depth = FLT_MAX;
@@ -1129,14 +1129,14 @@ float ED_view3d_radius_to_dist_ortho(const float lens, const float radius)
* +
* </pre>
*
- * \param ar: Can be NULL if \a use_aspect is false.
+ * \param region: Can be NULL if \a use_aspect is false.
* \param persp: Allow the caller to tell what kind of perspective to use (ortho/view/camera)
* \param use_aspect: Increase the distance to account for non 1:1 view aspect.
* \param radius: The radius will be fitted exactly,
* typically pre-scaled by a margin (#VIEW3D_MARGIN).
*/
float ED_view3d_radius_to_dist(const View3D *v3d,
- const ARegion *ar,
+ const ARegion *region,
const struct Depsgraph *depsgraph,
const char persp,
const bool use_aspect,
@@ -1184,18 +1184,18 @@ float ED_view3d_radius_to_dist(const View3D *v3d,
}
if (use_aspect) {
- const RegionView3D *rv3d = ar->regiondata;
+ const RegionView3D *rv3d = region->regiondata;
float winx, winy;
if (persp == RV3D_CAMOB) {
/* camera frame x/y in pixels */
- winx = ar->winx / rv3d->viewcamtexcofac[0];
- winy = ar->winy / rv3d->viewcamtexcofac[1];
+ winx = region->winx / rv3d->viewcamtexcofac[0];
+ winy = region->winy / rv3d->viewcamtexcofac[1];
}
else {
- winx = ar->winx;
- winy = ar->winy;
+ winx = region->winx;
+ winy = region->winy;
}
if (winx && winy) {
@@ -1568,7 +1568,7 @@ bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
bool depths_valid[9] = {false};
float coords[9][3] = {{0}};
- ARegion *ar = vc->ar;
+ ARegion *region = vc->region;
const ViewDepths *depths = vc->rv3d->depths;
for (int x = 0, i = 0; x < 2; x++) {
@@ -1577,7 +1577,7 @@ bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
const double depth = (double)ED_view3d_depth_read_cached(vc, mval_ofs);
if ((depth > depths->depth_range[0]) && (depth < depths->depth_range[1])) {
- if (ED_view3d_depth_unproject(ar, mval_ofs, depth, coords[i])) {
+ if (ED_view3d_depth_unproject(region, mval_ofs, depth, coords[i])) {
depths_valid[i] = true;
}
}
@@ -1614,14 +1614,14 @@ bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
}
}
-bool ED_view3d_depth_unproject(const ARegion *ar,
+bool ED_view3d_depth_unproject(const ARegion *region,
const int mval[2],
const double depth,
float r_location_world[3])
{
float centx = (float)mval[0] + 0.5f;
float centy = (float)mval[1] + 0.5f;
- return ED_view3d_unproject(ar, centx, centy, depth, r_location_world);
+ return ED_view3d_unproject(region, centx, centy, depth, r_location_world);
}
void ED_view3d_depth_tag_update(RegionView3D *rv3d)
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 4658198e4e1..9b0c987c451 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -129,11 +129,11 @@ void ED_view3d_smooth_view_ex(
wmWindow *win,
ScrArea *sa,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
const int smooth_viewtx,
const V3D_SmoothParams *sview)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
struct SmoothView3DStore sms = {{0}};
bool ok = false;
@@ -292,16 +292,16 @@ void ED_view3d_smooth_view_ex(
}
if (rv3d->viewlock & RV3D_BOXVIEW) {
- view3d_boxview_copy(sa, ar);
+ view3d_boxview_copy(sa, region);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
void ED_view3d_smooth_view(bContext *C,
View3D *v3d,
- ARegion *ar,
+ ARegion *region,
const int smooth_viewtx,
const struct V3D_SmoothParams *sview)
{
@@ -310,13 +310,13 @@ void ED_view3d_smooth_view(bContext *C,
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
- ED_view3d_smooth_view_ex(depsgraph, wm, win, sa, v3d, ar, smooth_viewtx, sview);
+ ED_view3d_smooth_view_ex(depsgraph, wm, win, sa, v3d, region, smooth_viewtx, sview);
}
/* only meant for timer usage */
-static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool sync_boxview)
+static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *region, bool sync_boxview)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
struct SmoothView3DStore *sms = rv3d->sms;
float step, step_inv;
@@ -385,7 +385,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
}
if (sync_boxview && (rv3d->viewlock & RV3D_BOXVIEW)) {
- view3d_boxview_copy(CTX_wm_area(C), ar);
+ view3d_boxview_copy(CTX_wm_area(C), region);
}
/* note: this doesn't work right because the v3d->lens is now used in ortho mode r51636,
@@ -397,22 +397,22 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
}
else {
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
}
static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
View3D *v3d = CTX_wm_view3d(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
/* escape if not our timer */
if (rv3d->smooth_timer == NULL || rv3d->smooth_timer != event->customdata) {
return OPERATOR_PASS_THROUGH;
}
- view3d_smoothview_apply(C, v3d, ar, true);
+ view3d_smoothview_apply(C, v3d, region, true);
return OPERATOR_FINISHED;
}
@@ -421,19 +421,19 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
* Apply the smoothview immediately, use when we need to start a new view operation.
* (so we don't end up half-applying a view operation when pressing keys quickly).
*/
-void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *ar)
+void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *region)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
if (rv3d && rv3d->sms) {
rv3d->sms->time_allowed = 0.0; /* force finishing */
- view3d_smoothview_apply(C, v3d, ar, false);
+ view3d_smoothview_apply(C, v3d, region, false);
/* force update of view matrix so tools that run immediately after
* can use them without redrawing first */
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
- ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL, false);
+ ED_view3d_update_viewmat(depsgraph, scene, v3d, region, NULL, NULL, NULL, false);
}
}
@@ -462,13 +462,13 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
{
const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
ObjectTfmProtectedChannels obtfm;
- ED_view3d_context_user_region(C, &v3d, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d, &region);
+ rv3d = region->regiondata;
ED_view3d_lastview_store(rv3d);
@@ -489,10 +489,10 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
static bool view3d_camera_to_view_poll(bContext *C)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
- if (ED_view3d_context_user_region(C, &v3d, &ar)) {
- RegionView3D *rv3d = ar->regiondata;
+ if (ED_view3d_context_user_region(C, &v3d, &region)) {
+ RegionView3D *rv3d = region->regiondata;
if (v3d && v3d->camera && !ID_IS_LINKED(v3d->camera)) {
if (rv3d && (rv3d->viewlock & RV3D_LOCKED) == 0) {
if (rv3d->persp != RV3D_CAMOB) {
@@ -651,7 +651,7 @@ static void sync_viewport_camera_smoothview(bContext *C,
static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
{
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
RegionView3D *rv3d;
Scene *scene = CTX_data_scene(C);
@@ -660,8 +660,8 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
/* no NULL check is needed, poll checks */
- ED_view3d_context_user_region(C, &v3d, &ar);
- rv3d = ar->regiondata;
+ ED_view3d_context_user_region(C, &v3d, &region);
+ rv3d = region->regiondata;
if (ob) {
Object *camera_old = (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL;
@@ -678,7 +678,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
ED_view3d_smooth_view(C,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.camera_old = camera_old,
@@ -732,15 +732,18 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
/**
* \param rect: optional for picking (can be NULL).
*/
-void view3d_winmatrix_set(Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, const rcti *rect)
+void view3d_winmatrix_set(Depsgraph *depsgraph,
+ ARegion *region,
+ const View3D *v3d,
+ const rcti *rect)
{
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
rctf viewplane;
float clipsta, clipend;
bool is_ortho;
is_ortho = ED_view3d_viewplane_get(
- depsgraph, v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
+ depsgraph, v3d, rv3d, region->winx, region->winy, &viewplane, &clipsta, &clipend, NULL);
rv3d->is_persp = !is_ortho;
#if 0
@@ -758,10 +761,10 @@ void view3d_winmatrix_set(Depsgraph *depsgraph, ARegion *ar, const View3D *v3d,
if (rect) { /* picking */
rctf r;
- r.xmin = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmin / (float)ar->winx));
- r.ymin = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymin / (float)ar->winy));
- r.xmax = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmax / (float)ar->winx));
- r.ymax = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymax / (float)ar->winy));
+ r.xmin = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmin / (float)region->winx));
+ r.ymin = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymin / (float)region->winy));
+ r.xmax = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmax / (float)region->winx));
+ r.ymax = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymax / (float)region->winy));
viewplane = r;
}
@@ -991,7 +994,7 @@ int view3d_opengl_select(ViewContext *vc,
Depsgraph *depsgraph = vc->depsgraph;
Scene *scene = vc->scene;
View3D *v3d = vc->v3d;
- ARegion *ar = vc->ar;
+ ARegion *region = vc->region;
rcti rect;
int hits = 0;
const bool use_obedit_skip = (OBEDIT_FROM_VIEW_LAYER(vc->view_layer) != NULL) &&
@@ -1093,7 +1096,8 @@ int view3d_opengl_select(ViewContext *vc,
/* Important we use the 'viewmat' and don't re-calculate since
* the object & bone view locking takes 'rect' into account, see: T51629. */
- ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect);
+ ED_view3d_draw_setup_view(
+ vc->win, depsgraph, scene, region, v3d, vc->rv3d->viewmat, NULL, &rect);
if (!XRAY_ACTIVE(v3d)) {
GPU_depth_test(true);
@@ -1117,7 +1121,7 @@ int view3d_opengl_select(ViewContext *vc,
};
draw_surface = false;
DRW_draw_select_loop(depsgraph,
- ar,
+ region,
v3d,
use_obedit_skip,
draw_surface,
@@ -1147,7 +1151,7 @@ int view3d_opengl_select(ViewContext *vc,
/* If are not in wireframe mode, we need to use the mesh surfaces to check for hits */
draw_surface = (v3d->shading.type > OB_WIRE) || !XRAY_ENABLED(v3d);
DRW_draw_select_loop(depsgraph,
- ar,
+ region,
v3d,
use_obedit_skip,
draw_surface,
@@ -1161,7 +1165,7 @@ int view3d_opengl_select(ViewContext *vc,
}
G.f &= ~G_FLAG_PICKSEL;
- ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
+ ED_view3d_draw_setup_view(vc->win, depsgraph, scene, region, v3d, vc->rv3d->viewmat, NULL, NULL);
if (!XRAY_ACTIVE(v3d)) {
GPU_depth_test(false);
@@ -1287,16 +1291,16 @@ static bool view3d_localview_init(const Depsgraph *depsgraph,
return false;
}
- ARegion *ar;
+ ARegion *region;
v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
memcpy(v3d->localvd, v3d, sizeof(View3D));
v3d->local_view_uuid = local_view_bit;
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
bool ok_dist = true;
/* New view values. */
@@ -1324,7 +1328,7 @@ static bool view3d_localview_init(const Depsgraph *depsgraph,
if (ok_dist) {
dist_new = ED_view3d_radius_to_dist(
- v3d, ar, depsgraph, rv3d->persp, true, (size / 2) * VIEW3D_MARGIN);
+ v3d, region, depsgraph, rv3d->persp, true, (size / 2) * VIEW3D_MARGIN);
if (rv3d->persp == RV3D_PERSP) {
/* Don't zoom closer than the near clipping plane. */
@@ -1337,7 +1341,7 @@ static bool view3d_localview_init(const Depsgraph *depsgraph,
win,
sa,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.camera_old = camera_old,
@@ -1382,9 +1386,9 @@ static void view3d_localview_exit(const Depsgraph *depsgraph,
MEM_freeN(v3d->localvd);
v3d->localvd = NULL;
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
if (rv3d->localvd == NULL) {
continue;
@@ -1405,7 +1409,7 @@ static void view3d_localview_exit(const Depsgraph *depsgraph,
win,
sa,
v3d,
- ar,
+ region,
smooth_viewtx,
&(const V3D_SmoothParams){
.camera_old = camera_old_rv3d,
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 846bf11ee9d..fcacc24b0c8 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -187,7 +187,7 @@ typedef struct WalkInfo {
/* context stuff */
RegionView3D *rv3d;
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
struct Depsgraph *depsgraph;
Scene *scene;
@@ -290,7 +290,7 @@ static void walkApply_ndof(bContext *C, WalkInfo *walk, bool is_confirm);
static int walkApply(bContext *C, struct WalkInfo *walk, bool force_autokey);
static float getVelocityZeroTime(const float gravity, const float velocity);
-static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg)
+static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *region, void *arg)
{
/* draws an aim/cross in the center */
WalkInfo *walk = arg;
@@ -302,13 +302,13 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a
if (ED_view3d_cameracontrol_object_get(walk->v3d_camera_control)) {
ED_view3d_calc_camera_border(
- walk->scene, walk->depsgraph, ar, walk->v3d, walk->rv3d, &viewborder, false);
+ walk->scene, walk->depsgraph, region, walk->v3d, walk->rv3d, &viewborder, false);
xoff = viewborder.xmin + BLI_rctf_size_x(&viewborder) * 0.5f;
yoff = viewborder.ymin + BLI_rctf_size_y(&viewborder) * 0.5f;
}
else {
- xoff = walk->ar->winx / 2;
- yoff = walk->ar->winy / 2;
+ xoff = walk->region->winx / 2;
+ yoff = walk->region->winy / 2;
}
GPUVertFormat *format = immVertexFormat();
@@ -452,7 +452,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->rv3d = CTX_wm_region_view3d(C);
walk->v3d = CTX_wm_view3d(C);
- walk->ar = CTX_wm_region(C);
+ walk->region = CTX_wm_region(C);
walk->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
walk->scene = CTX_data_scene(C);
@@ -546,12 +546,12 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->time_lastdraw = PIL_check_seconds_timer();
walk->draw_handle_pixel = ED_region_draw_cb_activate(
- walk->ar->type, drawWalkPixel, walk, REGION_DRAW_POST_PIXEL);
+ walk->region->type, drawWalkPixel, walk, REGION_DRAW_POST_PIXEL);
walk->rv3d->rflag |= RV3D_NAVIGATING;
walk->snap_context = ED_transform_snap_object_context_create_view3d(
- bmain, walk->scene, CTX_data_ensure_evaluated_depsgraph(C), 0, walk->ar, walk->v3d);
+ bmain, walk->scene, CTX_data_ensure_evaluated_depsgraph(C), 0, walk->region, walk->v3d);
walk->v3d_camera_control = ED_view3d_cameracontrol_acquire(
walk->depsgraph,
@@ -561,24 +561,24 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
(U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
/* center the mouse */
- walk->center_mval[0] = walk->ar->winx * 0.5f;
- walk->center_mval[1] = walk->ar->winy * 0.5f;
+ walk->center_mval[0] = walk->region->winx * 0.5f;
+ walk->center_mval[1] = walk->region->winy * 0.5f;
#ifdef USE_PIXELSIZE_NATIVE_SUPPORT
- walk->center_mval[0] += walk->ar->winrct.xmin;
- walk->center_mval[1] += walk->ar->winrct.ymin;
+ walk->center_mval[0] += walk->region->winrct.xmin;
+ walk->center_mval[1] += walk->region->winrct.ymin;
WM_cursor_compatible_xy(win, &walk->center_mval[0], &walk->center_mval[1]);
- walk->center_mval[0] -= walk->ar->winrct.xmin;
- walk->center_mval[1] -= walk->ar->winrct.ymin;
+ walk->center_mval[0] -= walk->region->winrct.xmin;
+ walk->center_mval[1] -= walk->region->winrct.ymin;
#endif
copy_v2_v2_int(walk->prev_mval, walk->center_mval);
WM_cursor_warp(win,
- walk->ar->winrct.xmin + walk->center_mval[0],
- walk->ar->winrct.ymin + walk->center_mval[1]);
+ walk->region->winrct.xmin + walk->center_mval[0],
+ walk->region->winrct.ymin + walk->center_mval[1]);
/* remove the mouse cursor temporarily */
WM_cursor_modal_set(win, WM_CURSOR_NONE);
@@ -616,7 +616,7 @@ static int walkEnd(bContext *C, WalkInfo *walk)
WM_event_remove_timer(CTX_wm_manager(C), win, walk->timer);
- ED_region_draw_cb_exit(walk->ar->type, walk->draw_handle_pixel);
+ ED_region_draw_cb_exit(walk->region->type, walk->draw_handle_pixel);
ED_transform_snap_object_context_destroy(walk->snap_context);
@@ -639,8 +639,8 @@ static int walkEnd(bContext *C, WalkInfo *walk)
{
/* center the mouse */
WM_cursor_warp(win,
- walk->ar->winrct.xmin + walk->center_mval[0],
- walk->ar->winrct.ymin + walk->center_mval[1]);
+ walk->region->winrct.xmin + walk->center_mval[0],
+ walk->region->winrct.ymin + walk->center_mval[1]);
}
if (walk->state == WALK_CONFIRM) {
@@ -670,8 +670,8 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event)
* ideally we shouldn't have to worry about this, see: T45361 */
wmWindow *win = CTX_wm_window(C);
WM_cursor_warp(win,
- walk->ar->winrct.xmin + walk->center_mval[0],
- walk->ar->winrct.ymin + walk->center_mval[1]);
+ walk->region->winrct.xmin + walk->center_mval[0],
+ walk->region->winrct.ymin + walk->center_mval[1]);
}
return;
}
@@ -708,8 +708,8 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event)
#endif
{
WM_cursor_warp(win,
- walk->ar->winrct.xmin + walk->center_mval[0],
- walk->ar->winrct.ymin + walk->center_mval[1]);
+ walk->region->winrct.xmin + walk->center_mval[0],
+ walk->region->winrct.ymin + walk->center_mval[1]);
copy_v2_v2_int(walk->prev_mval, walk->center_mval);
}
}
@@ -964,7 +964,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
* a walk loop where the user can move move the view as if they are in a walk game
*/
RegionView3D *rv3d = walk->rv3d;
- ARegion *ar = walk->ar;
+ ARegion *region = walk->region;
/* 3x3 copy of the view matrix so we can move along the view axis */
float mat[3][3];
@@ -1032,7 +1032,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
float y;
/* relative offset */
- y = (float)moffset[1] / ar->winy;
+ y = (float)moffset[1] / region->winy;
/* speed factor */
y *= WALK_ROTATE_FAC;
@@ -1072,7 +1072,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
}
/* relative offset */
- x = (float)moffset[0] / ar->winx;
+ x = (float)moffset[0] / region->winx;
/* speed factor */
x *= WALK_ROTATE_FAC;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 37cfa846657..d8700a3dba4 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -71,7 +71,7 @@
* and being able to set it to zero is handy. */
// #define USE_NUM_NO_ZERO
-static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg);
+static void drawTransformApply(const struct bContext *C, ARegion *region, void *arg);
static void initSnapSpatial(TransInfo *t, float r_snap[3]);
@@ -84,8 +84,8 @@ bool transdata_check_local_islands(TransInfo *t, short around)
void setTransformViewMatrices(TransInfo *t)
{
- if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = t->ar->regiondata;
+ if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = t->region->regiondata;
copy_m4_m4(t->viewmat, rv3d->viewmat);
copy_m4_m4(t->viewinv, rv3d->viewinv);
@@ -174,14 +174,14 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy)
void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy)
{
- if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
+ if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
if (t->options & CTX_PAINT_CURVE) {
r_vec[0] = dx;
r_vec[1] = dy;
}
else {
const float mval_f[2] = {(float)dx, (float)dy};
- ED_view3d_win_to_delta(t->ar, mval_f, r_vec, t->zfac);
+ ED_view3d_win_to_delta(t->region, mval_f, r_vec, t->zfac);
}
}
else if (t->spacetype == SPACE_IMAGE) {
@@ -203,7 +203,7 @@ void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy)
convertViewVec2D(t->view, r_vec, dx, dy);
}
else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
- convertViewVec2D(&t->ar->v2d, r_vec, dx, dy);
+ convertViewVec2D(&t->region->v2d, r_vec, dx, dy);
}
else if (t->spacetype == SPACE_CLIP) {
if (t->options & CTX_MASK) {
@@ -225,8 +225,8 @@ void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy)
void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag)
{
if (t->spacetype == SPACE_VIEW3D) {
- if (t->ar->regiontype == RGN_TYPE_WINDOW) {
- if (ED_view3d_project_int_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
+ if (t->region->regiontype == RGN_TYPE_WINDOW) {
+ if (ED_view3d_project_int_global(t->region, vec, adr, flag) != V3D_PROJ_RET_OK) {
/* this is what was done in 2.64, perhaps we can be smarter? */
adr[0] = (int)2140000000.0f;
adr[1] = (int)2140000000.0f;
@@ -244,7 +244,7 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
BKE_mask_coord_to_image(sima->image, &sima->iuser, v, v);
- ED_image_point_pos__reverse(sima, t->ar, v, v);
+ ED_image_point_pos__reverse(sima, t->region, v, v);
adr[0] = v[0];
adr[1] = v[1];
@@ -309,7 +309,7 @@ void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DPr
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v);
- ED_clip_point_stable_pos__reverse(sc, t->ar, v, v);
+ ED_clip_point_stable_pos__reverse(sc, t->region, v, v);
adr[0] = v[0];
adr[1] = v[1];
@@ -348,12 +348,12 @@ void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV
adr[0] = vec[0];
adr[1] = vec[1];
}
- else if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+ else if (t->region->regiontype == RGN_TYPE_WINDOW) {
/* allow points behind the view [#33643] */
- if (ED_view3d_project_float_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
+ if (ED_view3d_project_float_global(t->region, vec, adr, flag) != V3D_PROJ_RET_OK) {
/* XXX, 2.64 and prior did this, weak! */
- adr[0] = t->ar->winx / 2.0f;
- adr[1] = t->ar->winy / 2.0f;
+ adr[0] = t->region->winx / 2.0f;
+ adr[1] = t->region->winy / 2.0f;
}
return;
}
@@ -434,7 +434,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
else if (t->spacetype == SPACE_VIEW3D) {
if (t->options & CTX_PAINT_CURVE) {
wmWindow *window = CTX_wm_window(C);
- WM_paint_cursor_tag_redraw(window, t->ar);
+ WM_paint_cursor_tag_redraw(window, t->region);
}
else {
/* Do we need more refined tags? */
@@ -480,7 +480,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
}
else if (t->options & CTX_PAINT_CURVE) {
wmWindow *window = CTX_wm_window(C);
- WM_paint_cursor_tag_redraw(window, t->ar);
+ WM_paint_cursor_tag_redraw(window, t->region);
}
else if (t->flag & T_CURSOR) {
ED_area_tag_redraw(t->sa);
@@ -1513,11 +1513,11 @@ bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], floa
return success;
}
-static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *ar)
+static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *region)
{
/* Don't show overlays when not the active view and when overlay is disabled: T57139 */
bool ok = false;
- if (ar == t->ar) {
+ if (region == t->region) {
ok = true;
}
else {
@@ -1532,11 +1532,11 @@ static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegi
return ok;
}
-static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
+static void drawTransformView(const struct bContext *C, ARegion *region, void *arg)
{
TransInfo *t = arg;
- if (!transinfo_show_overlay(C, t, ar)) {
+ if (!transinfo_show_overlay(C, t, region)) {
return;
}
@@ -1546,7 +1546,7 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
drawPropCircle(C, t);
drawSnapping(C, t);
- if (ar == t->ar) {
+ if (region == t->region) {
/* edge slide, vert slide */
drawEdgeSlide(t);
drawVertSlide(t);
@@ -1558,13 +1558,13 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
/* just draw a little warning message in the top-right corner of the viewport
* to warn that autokeying is enabled */
-static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
+static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *region)
{
const char *printable = IFACE_("Auto Keying On");
float printable_size[2];
int xco, yco;
- const rcti *rect = ED_region_visible_rect(ar);
+ const rcti *rect = ED_region_visible_rect(region);
const int font_id = BLF_default();
BLF_width_and_height(
@@ -1598,15 +1598,15 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
GPU_blend(false);
}
-static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg)
+static void drawTransformPixel(const struct bContext *C, ARegion *region, void *arg)
{
TransInfo *t = arg;
- if (!transinfo_show_overlay(C, t, ar)) {
+ if (!transinfo_show_overlay(C, t, region)) {
return;
}
- if (ar == t->ar) {
+ if (region == t->region) {
Scene *scene = t->scene;
ViewLayer *view_layer = t->view_layer;
Object *ob = OBACT(view_layer);
@@ -1617,10 +1617,10 @@ static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg)
* AND only for the active region (as showing all is too overwhelming)
*/
if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) {
- if (ar == t->ar) {
+ if (region == t->region) {
if (t->flag & (T_OBJECT | T_POSE)) {
if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
- drawAutoKeyWarning(t, ar);
+ drawAutoKeyWarning(t, region);
}
}
}
@@ -1867,7 +1867,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
static void initSnapSpatial(TransInfo *t, float r_snap[3])
{
if (t->spacetype == SPACE_VIEW3D) {
- RegionView3D *rv3d = t->ar->regiondata;
+ RegionView3D *rv3d = t->region->regiondata;
if (rv3d) {
View3D *v3d = t->sa->spacedata.first;
@@ -1967,11 +1967,11 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
if (t->spacetype == SPACE_VIEW3D) {
t->draw_handle_apply = ED_region_draw_cb_activate(
- t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);
+ t->region->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);
t->draw_handle_view = ED_region_draw_cb_activate(
- t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_pixel = ED_region_draw_cb_activate(
- t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
+ t->region->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C),
SPACE_TYPE_ANY,
RGN_TYPE_ANY,
@@ -1981,7 +1981,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_IMAGE) {
t->draw_handle_view = ED_region_draw_cb_activate(
- t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C),
SPACE_TYPE_ANY,
RGN_TYPE_ANY,
@@ -1991,7 +1991,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_CLIP) {
t->draw_handle_view = ED_region_draw_cb_activate(
- t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C),
SPACE_TYPE_ANY,
RGN_TYPE_ANY,
@@ -2001,7 +2001,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_NODE) {
t->draw_handle_view = ED_region_draw_cb_activate(
- t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C),
SPACE_TYPE_ANY,
RGN_TYPE_ANY,
@@ -2011,7 +2011,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_GRAPH) {
t->draw_handle_view = ED_region_draw_cb_activate(
- t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C),
SPACE_TYPE_ANY,
RGN_TYPE_ANY,
@@ -2021,7 +2021,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_ACTION) {
t->draw_handle_view = ED_region_draw_cb_activate(
- t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C),
SPACE_TYPE_ANY,
RGN_TYPE_ANY,
@@ -2250,7 +2250,7 @@ void transformApply(bContext *C, TransInfo *t)
t->context = NULL;
}
-static void drawTransformApply(const bContext *C, ARegion *UNUSED(ar), void *arg)
+static void drawTransformApply(const bContext *C, ARegion *UNUSED(region), void *arg)
{
TransInfo *t = arg;
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 826e22bbace..2a4268ad939 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -582,7 +582,7 @@ typedef struct TransInfo {
/** Only valid (non null) during an operator called function. */
struct bContext *context;
struct ScrArea *sa;
- struct ARegion *ar;
+ struct ARegion *region;
struct Depsgraph *depsgraph;
struct Scene *scene;
struct ViewLayer *view_layer;
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 5bcc1387a1b..1db2ffa0ed4 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -846,8 +846,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
}
else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) {
/* only scale y */
- rcti *mask = &t->ar->v2d.mask;
- rctf *datamask = &t->ar->v2d.cur;
+ rcti *mask = &t->region->v2d.mask;
+ rctf *datamask = &t->region->v2d.cur;
float xsize = BLI_rctf_size_x(datamask);
float ysize = BLI_rctf_size_y(datamask);
float xmask = BLI_rcti_size_x(mask);
@@ -1055,7 +1055,7 @@ static void setNearestAxis3d(TransInfo *t)
* projecting them with ED_view3d_win_to_delta and then get the length of that vector.
*/
zfac = mul_project_m4_v3_zfac(t->persmat, t->center_global);
- zfac = len_v3(t->persinv[0]) * 2.0f / t->ar->winx * zfac * 30.0f;
+ zfac = len_v3(t->persinv[0]) * 2.0f / t->region->winx * zfac * 30.0f;
for (i = 0; i < 3; i++) {
float axis[3], axis_2d[2];
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index 55f08d501ec..009164057ce 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -206,8 +206,8 @@ static void set_prop_dist(TransInfo *t, const bool with_dist)
const bool use_island = transdata_check_local_islands(t, t->around);
if (t->flag & T_PROP_PROJECTED) {
- if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = t->ar->regiondata;
+ if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = t->region->regiondata;
normalize_v3_v3(_proj_vec, rv3d->viewinv[2]);
proj_vec = _proj_vec;
}
@@ -2768,9 +2768,9 @@ void createTransData(bContext *C, TransInfo *t)
}
/* Check if we're transforming the camera from the camera */
- if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
+ if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
View3D *v3d = t->view;
- RegionView3D *rv3d = t->ar->regiondata;
+ RegionView3D *rv3d = t->region->regiondata;
if ((rv3d->persp == RV3D_CAMOB) && v3d->camera) {
/* we could have a flag to easily check an object is being transformed */
if (v3d->camera->id.tag & LIB_TAG_DOIT) {
diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c
index 42e8523d4cb..f1bc54f12d1 100644
--- a/source/blender/editors/transform/transform_convert_action.c
+++ b/source/blender/editors/transform/transform_convert_action.c
@@ -297,8 +297,8 @@ void createTransActionData(bContext *C, TransInfo *t)
TransData2D *td2d = NULL;
tGPFtransdata *tfd = NULL;
- rcti *mask = &t->ar->v2d.mask;
- rctf *datamask = &t->ar->v2d.cur;
+ rcti *mask = &t->region->v2d.mask;
+ rctf *datamask = &t->region->v2d.cur;
float xsize = BLI_rctf_size_x(datamask);
float ysize = BLI_rctf_size_y(datamask);
@@ -313,7 +313,7 @@ void createTransActionData(bContext *C, TransInfo *t)
int count = 0;
float cfra;
- float ypos = 1.0f / ((ysize / xsize) * (xmask / ymask)) * BLI_rctf_cent_y(&t->ar->v2d.cur);
+ float ypos = 1.0f / ((ysize / xsize) * (xmask / ymask)) * BLI_rctf_cent_y(&t->region->v2d.cur);
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0) {
diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c
index 502679efedf..95a385a5a50 100644
--- a/source/blender/editors/transform/transform_convert_graph.c
+++ b/source/blender/editors/transform/transform_convert_graph.c
@@ -226,8 +226,8 @@ void createTransGraphEditData(bContext *C, TransInfo *t)
{
SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
Scene *scene = t->scene;
- ARegion *ar = t->ar;
- View2D *v2d = &ar->v2d;
+ ARegion *region = t->region;
+ View2D *v2d = &region->v2d;
TransData *td = NULL;
TransData2D *td2d = NULL;
diff --git a/source/blender/editors/transform/transform_convert_mask.c b/source/blender/editors/transform/transform_convert_mask.c
index 32152442acf..65244a09b73 100644
--- a/source/blender/editors/transform/transform_convert_mask.c
+++ b/source/blender/editors/transform/transform_convert_mask.c
@@ -333,7 +333,7 @@ void createTransMaskingData(bContext *C, TransInfo *t)
return;
}
- ED_mask_get_aspect(t->sa, t->ar, &asp[0], &asp[1]);
+ ED_mask_get_aspect(t->sa, t->region, &asp[0], &asp[1]);
tc->data_len = (is_prop_edit) ? count : countsel;
td = tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Mask Editing)");
@@ -409,7 +409,7 @@ void flushTransMasking(TransInfo *t)
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t);
- ED_mask_get_aspect(t->sa, t->ar, &asp[0], &asp[1]);
+ ED_mask_get_aspect(t->sa, t->region, &asp[0], &asp[1]);
inv[0] = 1.0f / asp[0];
inv[1] = 1.0f / asp[1];
diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c
index b68b79adbd8..a8bde661342 100644
--- a/source/blender/editors/transform/transform_convert_tracking.c
+++ b/source/blender/editors/transform/transform_convert_tracking.c
@@ -518,7 +518,7 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
void createTransTrackingData(bContext *C, TransInfo *t)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
int width, height;
@@ -537,7 +537,7 @@ void createTransTrackingData(bContext *C, TransInfo *t)
return;
}
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
/* transformation was called from graph editor */
createTransTrackingCurvesData(C, t);
}
diff --git a/source/blender/editors/transform/transform_draw_cursors.c b/source/blender/editors/transform/transform_draw_cursors.c
index dc2ebdca56a..f3105c8eb36 100644
--- a/source/blender/editors/transform/transform_draw_cursors.c
+++ b/source/blender/editors/transform/transform_draw_cursors.c
@@ -148,9 +148,9 @@ static void drawArc(float angle_start, float angle_end, int segments, float size
*/
bool transform_draw_cursor_poll(bContext *C)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region && region->regiontype == RGN_TYPE_WINDOW) {
return 1;
}
return 0;
@@ -181,8 +181,8 @@ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customd
projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
/* Offset the values for the area region. */
const float offset[2] = {
- t->ar->winrct.xmin,
- t->ar->winrct.ymin,
+ t->region->winrct.xmin,
+ t->region->winrct.ymin,
};
for (int i = 0; i < 2; i++) {
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 7d9a122f802..3fe1b99adfb 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -369,10 +369,10 @@ static void recalcData_actedit(TransInfo *t)
ac.view_layer = t->view_layer;
ac.obact = OBACT(view_layer);
ac.sa = t->sa;
- ac.ar = t->ar;
+ ac.region = t->region;
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
- ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
+ ac.regiontype = (t->region) ? t->region->regiontype : 0;
ANIM_animdata_context_getdata(&ac);
@@ -422,10 +422,10 @@ static void recalcData_graphedit(TransInfo *t)
ac.view_layer = t->view_layer;
ac.obact = OBACT(view_layer);
ac.sa = t->sa;
- ac.ar = t->ar;
+ ac.region = t->region;
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
- ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
+ ac.regiontype = (t->region) ? t->region->regiontype : 0;
ANIM_animdata_context_getdata(&ac);
@@ -1368,7 +1368,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
Object *obact = OBACT(view_layer);
const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT;
ToolSettings *ts = CTX_data_tool_settings(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
bGPdata *gpd = CTX_data_gpencil_data(C);
@@ -1378,7 +1378,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->scene = sce;
t->view_layer = view_layer;
t->sa = sa;
- t->ar = ar;
+ t->region = region;
t->settings = ts;
t->reports = op ? op->reports : NULL;
@@ -1463,7 +1463,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* background mode */
t->spacetype = SPACE_EMPTY;
}
- else if ((ar == NULL) && (sa->spacetype == SPACE_VIEW3D)) {
+ else if ((region == NULL) && (sa->spacetype == SPACE_VIEW3D)) {
/* running in the text editor */
t->spacetype = SPACE_EMPTY;
}
@@ -1560,7 +1560,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
else if (t->spacetype == SPACE_IMAGE) {
SpaceImage *sima = sa->spacedata.first;
// XXX for now, get View2D from the active region
- t->view = &ar->v2d;
+ t->view = &region->v2d;
t->around = sima->around;
if (ED_space_image_show_uvedit(sima, OBACT(t->view_layer))) {
@@ -1579,17 +1579,17 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
else if (t->spacetype == SPACE_NODE) {
// XXX for now, get View2D from the active region
- t->view = &ar->v2d;
+ t->view = &region->v2d;
t->around = V3D_AROUND_CENTER_BOUNDS;
}
else if (t->spacetype == SPACE_GRAPH) {
SpaceGraph *sipo = sa->spacedata.first;
- t->view = &ar->v2d;
+ t->view = &region->v2d;
t->around = sipo->around;
}
else if (t->spacetype == SPACE_CLIP) {
SpaceClip *sclip = sa->spacedata.first;
- t->view = &ar->v2d;
+ t->view = &region->v2d;
t->around = sclip->around;
if (ED_space_clip_check_show_trackedit(sclip)) {
@@ -1600,9 +1600,9 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
else {
- if (ar) {
+ if (region) {
// XXX for now, get View2D from the active region
- t->view = &ar->v2d;
+ t->view = &region->v2d;
// XXX for now, the center point is the midpoint of the data
}
else {
@@ -1818,13 +1818,13 @@ void freeTransCustomDataForMode(TransInfo *t)
void postTrans(bContext *C, TransInfo *t)
{
if (t->draw_handle_view) {
- ED_region_draw_cb_exit(t->ar->type, t->draw_handle_view);
+ ED_region_draw_cb_exit(t->region->type, t->draw_handle_view);
}
if (t->draw_handle_apply) {
- ED_region_draw_cb_exit(t->ar->type, t->draw_handle_apply);
+ ED_region_draw_cb_exit(t->region->type, t->draw_handle_apply);
}
if (t->draw_handle_pixel) {
- ED_region_draw_cb_exit(t->ar->type, t->draw_handle_pixel);
+ ED_region_draw_cb_exit(t->region->type, t->draw_handle_pixel);
}
if (t->draw_handle_cursor) {
WM_paint_cursor_end(CTX_wm_manager(C), t->draw_handle_cursor);
@@ -2003,10 +2003,10 @@ void calculateCenterCursor(TransInfo *t, float r_center[3])
/* If edit or pose mode, move cursor in local space */
if (t->options & CTX_PAINT_CURVE) {
- if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) !=
+ if (ED_view3d_project_float_global(t->region, cursor, r_center, V3D_PROJ_TEST_NOP) !=
V3D_PROJ_RET_OK) {
- r_center[0] = t->ar->winx / 2.0f;
- r_center[1] = t->ar->winy / 2.0f;
+ r_center[0] = t->region->winx / 2.0f;
+ r_center[1] = t->region->winy / 2.0f;
}
r_center[2] = 0.0f;
}
@@ -2046,8 +2046,8 @@ void calculateCenterCursor2D(TransInfo *t, float r_center[2])
}
else if (t->options & CTX_PAINT_CURVE) {
if (t->spacetype == SPACE_IMAGE) {
- r_center[0] = UI_view2d_view_to_region_x(&t->ar->v2d, cursor[0]);
- r_center[1] = UI_view2d_view_to_region_y(&t->ar->v2d, cursor[1]);
+ r_center[0] = UI_view2d_view_to_region_x(&t->region->v2d, cursor[0]);
+ r_center[1] = UI_view2d_view_to_region_y(&t->region->v2d, cursor[1]);
}
}
else {
@@ -2229,7 +2229,7 @@ void calculateCenter(TransInfo *t)
/* for panning from cameraview */
if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) {
- if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
+ if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) {
if (t->flag & T_CAMERA) {
float axis[3];
@@ -2262,8 +2262,8 @@ void calculateCenter(TransInfo *t)
* We need special case here as well, since ED_view3d_calc_zfac will crash when called
* for a region different from RGN_TYPE_WINDOW.
*/
- if (t->ar->regiontype == RGN_TYPE_WINDOW) {
- t->zfac = ED_view3d_calc_zfac(t->ar->regiondata, t->center_global, NULL);
+ if (t->region->regiontype == RGN_TYPE_WINDOW) {
+ t->zfac = ED_view3d_calc_zfac(t->region->regiondata, t->center_global, NULL);
}
else {
t->zfac = 0.0f;
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index 558e14750d6..74f5924b717 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -87,10 +87,10 @@ static void gizmo2d_pivot_point_message_subscribe(struct wmGizmoGroup *gzgroup,
/* Additional args. */
bScreen *screen,
ScrArea *sa,
- ARegion *ar)
+ ARegion *region)
{
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
@@ -256,9 +256,9 @@ static bool gizmo2d_calc_center(const bContext *C, float r_center[2])
/**
* Convert origin (or any other point) from view to region space.
*/
-BLI_INLINE void gizmo2d_origin_to_region(ARegion *ar, float *r_origin)
+BLI_INLINE void gizmo2d_origin_to_region(ARegion *region, float *r_origin)
{
- UI_view2d_view_to_region_fl(&ar->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]);
+ UI_view2d_view_to_region_fl(&region->v2d, r_origin[0], r_origin[1], &r_origin[0], &r_origin[1]);
}
/**
@@ -269,14 +269,14 @@ static int gizmo2d_modal(bContext *C,
const wmEvent *UNUSED(event),
eWM_GizmoFlagTweak UNUSED(tweak_flag))
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float origin[3];
gizmo2d_calc_center(C, origin);
- gizmo2d_origin_to_region(ar, origin);
+ gizmo2d_origin_to_region(region, origin);
WM_gizmo_set_matrix_location(widget, origin);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
return OPERATOR_RUNNING_MODAL;
}
@@ -480,19 +480,19 @@ static void gizmo2d_xform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
GizmoGroup2D *ggd = gzgroup->customdata;
float origin[3] = {UNPACK2(ggd->origin), 0.0f};
float origin_aa[3] = {UNPACK2(ggd->origin), 0.0f};
- gizmo2d_origin_to_region(ar, origin);
+ gizmo2d_origin_to_region(region, origin);
for (int i = 0; i < ARRAY_SIZE(ggd->translate_xy); i++) {
wmGizmo *gz = ggd->translate_xy[i];
WM_gizmo_set_matrix_location(gz, origin);
}
- UI_view2d_view_to_region_m4(&ar->v2d, ggd->cage->matrix_space);
+ UI_view2d_view_to_region_m4(&region->v2d, ggd->cage->matrix_space);
WM_gizmo_set_matrix_offset_location(ggd->cage, origin_aa);
ggd->cage->matrix_offset[0][0] = (ggd->max[0] - ggd->min[0]);
ggd->cage->matrix_offset[1][1] = (ggd->max[1] - ggd->min[1]);
@@ -504,8 +504,8 @@ static void gizmo2d_xform_no_cage_message_subscribe(const struct bContext *C,
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, ar);
+ ARegion *region = CTX_wm_region(C);
+ gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, region);
}
void ED_widgetgroup_gizmo2d_xform_callbacks_set(wmGizmoGroupType *gzgt)
@@ -575,7 +575,7 @@ static void gizmo2d_resize_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
GizmoGroup_Resize2D *ggd = gzgroup->customdata;
float origin[3] = {UNPACK2(ggd->origin), 0.0f};
@@ -589,7 +589,7 @@ static void gizmo2d_resize_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup
}
}
- gizmo2d_origin_to_region(ar, origin);
+ gizmo2d_origin_to_region(region, origin);
for (int i = 0; i < ARRAY_SIZE(ggd->gizmo_xy); i++) {
wmGizmo *gz = ggd->gizmo_xy[i];
@@ -660,8 +660,8 @@ static void gizmo2d_resize_message_subscribe(const struct bContext *C,
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, ar);
+ ARegion *region = CTX_wm_region(C);
+ gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, region);
}
void ED_widgetgroup_gizmo2d_resize_callbacks_set(wmGizmoGroupType *gzgt)
@@ -718,7 +718,7 @@ static void gizmo2d_rotate_refresh(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
GizmoGroup_Rotate2D *ggd = gzgroup->customdata;
float origin[3] = {UNPACK2(ggd->origin), 0.0f};
@@ -732,7 +732,7 @@ static void gizmo2d_rotate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup
}
}
- gizmo2d_origin_to_region(ar, origin);
+ gizmo2d_origin_to_region(region, origin);
wmGizmo *gz = ggd->gizmo;
WM_gizmo_set_matrix_location(gz, origin);
@@ -776,8 +776,8 @@ static void gizmo2d_rotate_message_subscribe(const struct bContext *C,
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, ar);
+ ARegion *region = CTX_wm_region(C);
+ gizmo2d_pivot_point_message_subscribe(gzgroup, mbus, screen, sa, region);
}
void ED_widgetgroup_gizmo2d_rotate_callbacks_set(wmGizmoGroupType *gzgt)
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 46add93b2e1..02767156ef4 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -637,11 +637,11 @@ bool gimbal_axis(Object *ob, float gmat[3][3])
void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3])
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = CTX_data_edit_object(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
Object *ob = OBACT(view_layer);
const short orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type;
const short orientation_index_custom = scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom;
@@ -735,7 +735,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
struct TransformBounds *tbounds)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
/* TODO(sergey): This function is used from operator's modal() and from gizmo's refresh().
* Is it fine to possibly evaluate dependency graph here? */
@@ -743,7 +743,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = sa->spacedata.first;
Object *obedit = CTX_data_edit_object(C);
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
Base *base;
Object *ob = OBACT(view_layer);
bGPdata *gpd = CTX_data_gpencil_data(C);
@@ -1245,12 +1245,12 @@ static void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
Scene *scene,
bScreen *screen,
ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
const void *type_fn)
{
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
@@ -1369,7 +1369,7 @@ static void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
void drawDial3d(const TransInfo *t)
{
if (t->mode == TFM_ROTATION && t->spacetype == SPACE_VIEW3D) {
- wmGizmo *gz = wm_gizmomap_modal_get(t->ar->gizmo_map);
+ wmGizmo *gz = wm_gizmomap_modal_get(t->region->gizmo_map);
if (gz == NULL) {
/* We only draw Dial3d if the operator has been called by a gizmo. */
return;
@@ -1411,7 +1411,7 @@ void drawDial3d(const TransInfo *t)
mat_basis[2][3] = -dot_v3v3(mat_basis[2], mat_basis[3]);
if (ED_view3d_win_to_3d_on_plane(
- t->ar, mat_basis[2], (float[2]){UNPACK2(t->mouse.imval)}, false, mat_basis[1])) {
+ t->region, mat_basis[2], (float[2]){UNPACK2(t->mouse.imval)}, false, mat_basis[1])) {
sub_v3_v3(mat_basis[1], mat_basis[3]);
normalize_v3(mat_basis[1]);
cross_v3_v3v3(mat_basis[0], mat_basis[1], mat_basis[2]);
@@ -1428,7 +1428,7 @@ void drawDial3d(const TransInfo *t)
mat_basis[3][3] = 1.0f;
copy_m4_m4(mat_final, mat_basis);
- scale *= ED_view3d_pixel_size_no_ui_scale(t->ar->regiondata, mat_final[3]);
+ scale *= ED_view3d_pixel_size_no_ui_scale(t->region->regiondata, mat_final[3]);
mul_mat3_m4_fl(mat_final, scale);
if (activeSnap(t) && (!transformModeUseSnap(t) ||
@@ -1554,8 +1554,8 @@ static int gizmo_modal(bContext *C,
return OPERATOR_RUNNING_MODAL;
}
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
struct TransformBounds tbounds;
if (ED_transform_calc_gizmo_stats(C,
@@ -1567,7 +1567,7 @@ static int gizmo_modal(bContext *C,
WM_gizmo_set_matrix_location(widget, rv3d->twmat[3]);
}
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
return OPERATOR_RUNNING_MODAL;
}
@@ -1739,8 +1739,8 @@ static void WIDGETGROUP_gizmo_refresh(const bContext *C, wmGizmoGroup *gzgroup)
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
struct TransformBounds tbounds;
if (scene->toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK) {
@@ -1845,17 +1845,17 @@ static void WIDGETGROUP_gizmo_message_subscribe(const bContext *C,
Scene *scene = CTX_data_scene(C);
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_gizmo);
+ ARegion *region = CTX_wm_region(C);
+ gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, region, VIEW3D_GGT_xform_gizmo);
}
static void WIDGETGROUP_gizmo_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
GizmoGroup *ggd = gzgroup->customdata;
// ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
// View3D *v3d = sa->spacedata.first;
- RegionView3D *rv3d = ar->regiondata;
+ RegionView3D *rv3d = region->regiondata;
float viewinv_m3[3][3];
copy_m3_m4(viewinv_m3, rv3d->viewinv);
float idot[3];
@@ -2168,8 +2168,8 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmGizmoGroup
static void WIDGETGROUP_xform_cage_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
Scene *scene = CTX_data_scene(C);
struct XFormCageWidgetGroup *xgzgroup = gzgroup->customdata;
@@ -2248,8 +2248,8 @@ static void WIDGETGROUP_xform_cage_message_subscribe(const bContext *C,
Scene *scene = CTX_data_scene(C);
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_cage);
+ ARegion *region = CTX_wm_region(C);
+ gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, region, VIEW3D_GGT_xform_cage);
}
static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
@@ -2384,8 +2384,8 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou
static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzgroup)
{
Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
- RegionView3D *rv3d = ar->regiondata;
+ ARegion *region = CTX_wm_region(C);
+ RegionView3D *rv3d = region->regiondata;
struct XFormShearWidgetGroup *xgzgroup = gzgroup->customdata;
struct TransformBounds tbounds;
@@ -2461,8 +2461,8 @@ static void WIDGETGROUP_xform_shear_message_subscribe(const bContext *C,
Scene *scene = CTX_data_scene(C);
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
- gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, ar, VIEW3D_GGT_xform_shear);
+ ARegion *region = CTX_wm_region(C);
+ gizmo_xform_message_subscribe(gzgroup, mbus, scene, screen, sa, region, VIEW3D_GGT_xform_shear);
}
static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
index fb33471cf3f..8b5db2b57ec 100644
--- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
@@ -469,11 +469,11 @@ static void gizmo_mesh_extrude_message_subscribe(const bContext *C,
struct wmMsgBus *mbus)
{
GizmoExtrudeGroup *ggd = gzgroup->customdata;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
/* Subscribe to view properties */
wmMsgSubscribeValue msg_sub_value_gz_tag_refresh = {
- .owner = ar,
+ .owner = region,
.user_data = gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
};
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 8dc403c45d2..fb929b60739 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -93,7 +93,7 @@ static void InputHorizontalRatio(TransInfo *t,
const double mval[2],
float output[3])
{
- const int winx = t->ar ? t->ar->winx : 1;
+ const int winx = t->region ? t->region->winx : 1;
output[0] = ((mval[0] - mi->imval[0]) / winx) * 2.0f;
}
@@ -113,7 +113,7 @@ static void InputHorizontalAbsolute(TransInfo *t,
static void InputVerticalRatio(TransInfo *t, MouseInput *mi, const double mval[2], float output[3])
{
- const int winy = t->ar ? t->ar->winy : 1;
+ const int winy = t->region ? t->region->winy : 1;
/* Flip so dragging up increases (matching viewport zoom). */
output[0] = ((mval[1] - mi->imval[1]) / winy) * -2.0f;
@@ -153,10 +153,10 @@ void setCustomPoints(TransInfo *UNUSED(t),
void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2])
{
BLI_ASSERT_UNIT_V2(dir);
- const int win_axis = t->ar ?
- ((abs((int)(t->ar->winx * dir[0])) + abs((int)(t->ar->winy * dir[1]))) /
- 2) :
- 1;
+ const int win_axis = t->region ? ((abs((int)(t->region->winx * dir[0])) +
+ abs((int)(t->region->winy * dir[1]))) /
+ 2) :
+ 1;
const int mval_start[2] = {
mi->imval[0] + dir[0] * win_axis,
mi->imval[1] + dir[1] * win_axis,
diff --git a/source/blender/editors/transform/transform_mode_bend.c b/source/blender/editors/transform/transform_mode_bend.c
index daa2e583e2f..d4c39ac969b 100644
--- a/source/blender/editors/transform/transform_mode_bend.c
+++ b/source/blender/editors/transform/transform_mode_bend.c
@@ -289,7 +289,7 @@ void initBend(TransInfo *t)
curs = t->scene->cursor.location;
copy_v3_v3(data->warp_sta, curs);
- ED_view3d_win_to_3d((View3D *)t->sa->spacedata.first, t->ar, curs, mval_fl, data->warp_end);
+ ED_view3d_win_to_3d((View3D *)t->sa->spacedata.first, t->region, curs, mval_fl, data->warp_end);
copy_v3_v3(data->warp_nor, t->viewinv[2]);
normalize_v3(data->warp_nor);
diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c
index 27b5dbba488..fb43d75567c 100644
--- a/source/blender/editors/transform/transform_mode_edge_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_slide.c
@@ -320,7 +320,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
{
TransDataEdgeSlideVert *sv;
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
- ARegion *ar = t->ar;
+ ARegion *region = t->region;
View3D *v3d = NULL;
RegionView3D *rv3d = NULL;
float projectMat[4][4];
@@ -335,7 +335,7 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
if (t->spacetype == SPACE_VIEW3D) {
/* background mode support */
v3d = t->sa ? t->sa->spacedata.first : NULL;
- rv3d = t->ar ? t->ar->regiondata : NULL;
+ rv3d = t->region ? t->region->regiondata : NULL;
}
if (!rv3d) {
@@ -387,26 +387,26 @@ static void calcEdgeSlide_mval_range(TransInfo *t,
/* This test is only relevant if object is not wire-drawn! See [#32068]. */
bool is_visible = !use_occlude_geometry ||
- BMBVH_EdgeVisible(bmbvh, e, t->depsgraph, ar, v3d, tc->obedit);
+ BMBVH_EdgeVisible(bmbvh, e, t->depsgraph, region, v3d, tc->obedit);
if (!is_visible && !use_calc_direction) {
continue;
}
if (sv->v_side[1]) {
- ED_view3d_project_float_v3_m4(ar, sv->v_side[1]->co, sco_b, projectMat);
+ ED_view3d_project_float_v3_m4(region, sv->v_side[1]->co, sco_b, projectMat);
}
else {
add_v3_v3v3(sco_b, v->co, sv->dir_side[1]);
- ED_view3d_project_float_v3_m4(ar, sco_b, sco_b, projectMat);
+ ED_view3d_project_float_v3_m4(region, sco_b, sco_b, projectMat);
}
if (sv->v_side[0]) {
- ED_view3d_project_float_v3_m4(ar, sv->v_side[0]->co, sco_a, projectMat);
+ ED_view3d_project_float_v3_m4(region, sv->v_side[0]->co, sco_a, projectMat);
}
else {
add_v3_v3v3(sco_a, v->co, sv->dir_side[0]);
- ED_view3d_project_float_v3_m4(ar, sco_a, sco_a, projectMat);
+ ED_view3d_project_float_v3_m4(region, sco_a, sco_a, projectMat);
}
/* global direction */
@@ -479,7 +479,7 @@ static void calcEdgeSlide_even(TransInfo *t,
TransDataEdgeSlideVert *sv = sld->sv;
if (sld->totsv > 0) {
- ARegion *ar = t->ar;
+ ARegion *region = t->region;
RegionView3D *rv3d = NULL;
float projectMat[4][4];
@@ -491,7 +491,7 @@ static void calcEdgeSlide_even(TransInfo *t,
if (t->spacetype == SPACE_VIEW3D) {
/* background mode support */
- rv3d = t->ar ? t->ar->regiondata : NULL;
+ rv3d = t->region ? t->region->regiondata : NULL;
}
if (!rv3d) {
@@ -506,7 +506,7 @@ static void calcEdgeSlide_even(TransInfo *t,
/* Set length */
sv->edge_len = len_v3v3(sv->dir_side[0], sv->dir_side[1]);
- ED_view3d_project_float_v2_m4(ar, sv->v->co, v_proj, projectMat);
+ ED_view3d_project_float_v2_m4(region, sv->v->co, v_proj, projectMat);
dist_sq = len_squared_v2v2(mval, v_proj);
if (dist_sq < dist_min_sq) {
dist_min_sq = dist_sq;
@@ -859,7 +859,7 @@ static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *t
/* use for visibility checks */
if (t->spacetype == SPACE_VIEW3D) {
v3d = t->sa ? t->sa->spacedata.first : NULL;
- rv3d = t->ar ? t->ar->regiondata : NULL;
+ rv3d = t->region ? t->region->regiondata : NULL;
use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE &&
!XRAY_ENABLED(v3d));
}
@@ -900,7 +900,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t
if (t->spacetype == SPACE_VIEW3D) {
/* background mode support */
v3d = t->sa ? t->sa->spacedata.first : NULL;
- rv3d = t->ar ? t->ar->regiondata : NULL;
+ rv3d = t->region ? t->region->regiondata : NULL;
}
sld->curr_sv_index = 0;
@@ -1044,7 +1044,7 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *t
/* use for visibility checks */
if (t->spacetype == SPACE_VIEW3D) {
v3d = t->sa ? t->sa->spacedata.first : NULL;
- rv3d = t->ar ? t->ar->regiondata : NULL;
+ rv3d = t->region ? t->region->regiondata : NULL;
use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE &&
!XRAY_ENABLED(v3d));
}
diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c
index 4009a0fb3f9..ae775b5db24 100644
--- a/source/blender/editors/transform/transform_mode_vert_slide.c
+++ b/source/blender/editors/transform/transform_mode_vert_slide.c
@@ -98,8 +98,8 @@ static void calcVertSlideCustomPoints(struct TransInfo *t)
int mval_ofs[2], mval_start[2], mval_end[2];
- ED_view3d_project_float_v2_m4(t->ar, co_orig_3d, co_orig_2d, sld->proj_mat);
- ED_view3d_project_float_v2_m4(t->ar, co_curr_3d, co_curr_2d, sld->proj_mat);
+ ED_view3d_project_float_v2_m4(t->region, co_orig_3d, co_orig_2d, sld->proj_mat);
+ ED_view3d_project_float_v2_m4(t->region, co_curr_3d, co_curr_2d, sld->proj_mat);
ARRAY_SET_ITEMS(mval_ofs, t->mouse.imval[0] - co_orig_2d[0], t->mouse.imval[1] - co_orig_2d[1]);
ARRAY_SET_ITEMS(mval_start, co_orig_2d[0] + mval_ofs[0], co_orig_2d[1] + mval_ofs[1]);
@@ -136,7 +136,7 @@ static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2])
for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
float co_2d[2];
- ED_view3d_project_float_v2_m4(t->ar, sv->co_orig_3d, co_2d, sld->proj_mat);
+ ED_view3d_project_float_v2_m4(t->region, sv->co_orig_3d, co_2d, sld->proj_mat);
dist_sq = len_squared_v2v2(mval_fl, co_2d);
if (dist_sq < dist_min_sq) {
@@ -165,7 +165,7 @@ static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2]
/* first get the direction of the original mouse position */
sub_v2_v2v2(dir, imval_fl, mval_fl);
- ED_view3d_win_to_delta(t->ar, dir, dir, t->zfac);
+ ED_view3d_win_to_delta(t->region, dir, dir, t->zfac);
normalize_v3(dir);
for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
@@ -280,9 +280,9 @@ static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc)
if (t->spacetype == SPACE_VIEW3D) {
/* view vars */
RegionView3D *rv3d = NULL;
- ARegion *ar = t->ar;
+ ARegion *region = t->region;
- rv3d = ar ? ar->regiondata : NULL;
+ rv3d = region ? region->regiondata : NULL;
if (rv3d) {
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, sld->proj_mat);
}
@@ -468,9 +468,9 @@ void drawVertSlide(TransInfo *t)
mul_v3_m4v3(
co_orig_3d, TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat, curr_sv->co_orig_3d);
- zfac = ED_view3d_calc_zfac(t->ar->regiondata, co_orig_3d, NULL);
+ zfac = ED_view3d_calc_zfac(t->region->regiondata, co_orig_3d, NULL);
- ED_view3d_win_to_delta(t->ar, mval_ofs, co_dest_3d, zfac);
+ ED_view3d_win_to_delta(t->region, mval_ofs, co_dest_3d, zfac);
invert_m4_m4(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->imat,
TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 39f6f24eb8d..ee1353a28fa 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -1248,8 +1248,8 @@ static int transform_from_gizmo_invoke(bContext *C,
{
bToolRef *tref = WM_toolsystem_ref_from_context(C);
if (tref) {
- ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *gzmap = ar->gizmo_map;
+ ARegion *region = CTX_wm_region(C);
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_xform_gizmo") : NULL;
if (gzgroup != NULL) {
PointerRNA gzg_ptr;
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index ea4f1eedd81..3f08f795d32 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -471,8 +471,8 @@ void initTransformOrientation(bContext *C, TransInfo *t)
break;
case V3D_ORIENT_VIEW:
- if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
- RegionView3D *rv3d = t->ar->regiondata;
+ if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
+ RegionView3D *rv3d = t->region->regiondata;
float mat[3][3];
BLI_strncpy(t->spacename, TIP_("view"), sizeof(t->spacename));
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 4b6ab2045c0..8336fd7890b 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -283,7 +283,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_NODE) {
if (validSnap(t)) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
TransSnapPoint *p;
float size;
@@ -304,13 +304,13 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
immUniformColor4ubv(col);
}
- ED_node_draw_snap(&ar->v2d, p->co, size, 0, pos);
+ ED_node_draw_snap(&region->v2d, p->co, size, 0, pos);
}
if (t->tsnap.status & POINT_INIT) {
immUniformColor4ubv(activeCol);
- ED_node_draw_snap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos);
+ ED_node_draw_snap(&region->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder, pos);
}
immUnbindProgram();
@@ -373,7 +373,7 @@ void applyProject(TransInfo *t)
copy_v3_v3(iloc, td->ob->obmat[3]);
}
- if (ED_view3d_project_float_global(t->ar, iloc, mval_fl, V3D_PROJ_TEST_NOP) ==
+ if (ED_view3d_project_float_global(t->region, iloc, mval_fl, V3D_PROJ_TEST_NOP) ==
V3D_PROJ_RET_OK) {
if (ED_transform_snap_object_project_view3d(
t->tsnap.object_context,
@@ -686,7 +686,7 @@ static void initSnappingMode(TransInfo *t)
if (t->spacetype == SPACE_VIEW3D) {
if (t->tsnap.object_context == NULL) {
t->tsnap.object_context = ED_transform_snap_object_context_create_view3d(
- bmain, t->scene, t->depsgraph, 0, t->ar, t->view);
+ bmain, t->scene, t->depsgraph, 0, t->region, t->view);
ED_transform_snap_object_context_set_editmesh_callbacks(
t->tsnap.object_context,
@@ -847,7 +847,7 @@ eRedrawFlag updateSelectedSnapPoint(TransInfo *t)
for (p = t->tsnap.points.first; p; p = p->next) {
float dist_sq;
- if (ED_view3d_project_float_global(t->ar, p->co, screen_loc, V3D_PROJ_TEST_NOP) !=
+ if (ED_view3d_project_float_global(t->region, p->co, screen_loc, V3D_PROJ_TEST_NOP) !=
V3D_PROJ_RET_OK) {
continue;
}
@@ -936,7 +936,7 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
else {
if (t->spacetype == SPACE_VIEW3D) {
if (t->options & CTX_PAINT_CURVE) {
- if (ED_view3d_project_float_global(t->ar, point, point, V3D_PROJ_TEST_NOP) !=
+ if (ED_view3d_project_float_global(t->region, point, point, V3D_PROJ_TEST_NOP) !=
V3D_PROJ_RET_OK) {
zero_v3(point); /* no good answer here... */
}
@@ -1108,7 +1108,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
Image *ima = ED_space_image(t->sa->spacedata.first);
float co[2];
- UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&t->region->v2d, t->mval[0], t->mval[1], &co[0], &co[1]);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
@@ -1504,14 +1504,14 @@ static NodeBorder snapNodeBorder(int snap_node_mode)
static bool snapNode(ToolSettings *ts,
SpaceNode *UNUSED(snode),
- ARegion *ar,
+ ARegion *region,
bNode *node,
const int mval[2],
float r_loc[2],
float *r_dist_px,
char *r_node_border)
{
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
NodeBorder border = snapNodeBorder(ts->snap_node_mode);
bool retval = false;
rcti totr;
@@ -1564,7 +1564,7 @@ static bool snapNode(ToolSettings *ts,
static bool snapNodes(ToolSettings *ts,
SpaceNode *snode,
- ARegion *ar,
+ ARegion *region,
const int mval[2],
eSnapSelect snap_select,
float r_loc[2],
@@ -1578,8 +1578,8 @@ static bool snapNodes(ToolSettings *ts,
*r_node_border = 0;
for (node = ntree->nodes.first; node; node = node->next) {
- if (snapNodeTest(&ar->v2d, node, snap_select)) {
- retval |= snapNode(ts, snode, ar, node, mval, r_loc, r_dist_px, r_node_border);
+ if (snapNodeTest(&region->v2d, node, snap_select)) {
+ retval |= snapNode(ts, snode, region, node, mval, r_loc, r_dist_px, r_node_border);
}
}
@@ -1591,7 +1591,7 @@ bool snapNodesTransform(
{
return snapNodes(t->settings,
t->sa->spacedata.first,
- t->ar,
+ t->region,
mval,
t->tsnap.modeSelect,
r_loc,
@@ -1691,7 +1691,7 @@ void snapSequenceBounds(TransInfo *t, const int mval[2])
}
/* convert to frame range */
- UI_view2d_region_to_view(&t->ar->v2d, mval[0], mval[1], &xmouse, &ymouse);
+ UI_view2d_region_to_view(&t->region->v2d, mval[0], mval[1], &xmouse, &ymouse);
mframe = round_fl_to_int(xmouse);
/* now find the closest sequence */
frame = BKE_sequencer_find_next_prev_edit(t->scene, mframe, SEQ_SIDE_BOTH, true, false, true);
@@ -1723,7 +1723,7 @@ static void applyGridIncrement(
if (use_aspect) {
/* custom aspect for fcurve */
if (t->spacetype == SPACE_GRAPH) {
- View2D *v2d = &t->ar->v2d;
+ View2D *v2d = &t->region->v2d;
Scene *scene = t->scene;
SpaceGraph *sipo = t->sa->spacedata.first;
asp_local[0] = UI_view2d_grid_resolution_x__frames_or_seconds(
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 2365d3d77d7..c9970e7e49c 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -121,7 +121,7 @@ struct SnapObjectContext {
bool use_v3d;
struct {
const struct View3D *v3d;
- const struct ARegion *ar;
+ const struct ARegion *region;
} v3d_data;
/* Object -> SnapObjectData map */
@@ -2872,13 +2872,13 @@ SnapObjectContext *ED_transform_snap_object_context_create_view3d(Main *bmain,
Depsgraph *depsgraph,
int flag,
/* extra args for view3d */
- const ARegion *ar,
+ const ARegion *region,
const View3D *v3d)
{
SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, flag);
sctx->use_v3d = true;
- sctx->v3d_data.ar = ar;
+ sctx->v3d_data.region = region;
sctx->v3d_data.v3d = v3d;
return sctx;
@@ -3034,15 +3034,15 @@ static short transform_snap_context_project_view3d_mixed_impl(
float loc[3], no[3], obmat[4][4];
int index = -1;
- const ARegion *ar = sctx->v3d_data.ar;
- const RegionView3D *rv3d = ar->regiondata;
+ const ARegion *region = sctx->v3d_data.region;
+ const RegionView3D *rv3d = region->regiondata;
bool use_occlusion_test = params->use_occlusion_test && !XRAY_ENABLED(sctx->v3d_data.v3d);
if (snap_to_flag & SCE_SNAP_MODE_FACE || use_occlusion_test) {
float ray_start[3], ray_normal[3];
if (!ED_view3d_win_to_ray_clipped_ex(sctx->depsgraph,
- sctx->v3d_data.ar,
+ sctx->v3d_data.region,
sctx->v3d_data.v3d,
mval,
NULL,
@@ -3083,8 +3083,8 @@ static short transform_snap_context_project_view3d_mixed_impl(
SnapData snapdata;
copy_m4_m4(snapdata.pmat, rv3d->persmat);
- snapdata.win_size[0] = ar->winx;
- snapdata.win_size[1] = ar->winy;
+ snapdata.win_size[0] = region->winx;
+ snapdata.win_size[1] = region->winy;
copy_v2_v2(snapdata.mval, mval);
snapdata.view_proj = rv3d->is_persp ? VIEW_PROJ_PERSP : VIEW_PROJ_ORTHO;
@@ -3230,7 +3230,7 @@ bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx,
float ray_start[3], ray_normal[3];
if (!ED_view3d_win_to_ray_clipped_ex(sctx->depsgraph,
- sctx->v3d_data.ar,
+ sctx->v3d_data.region,
sctx->v3d_data.v3d,
mval,
NULL,
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 72376b977eb..c3eae53eda0 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -434,13 +434,13 @@ void unpack_menu(bContext *C,
/**
* Callback that draws a line between the mouse and a position given as the initial argument.
*/
-void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info)
+void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *region, void *arg_info)
{
wmWindow *win = CTX_wm_window(C);
const float *mval_src = (float *)arg_info;
const float mval_dst[2] = {
- win->eventstate->x - ar->winrct.xmin,
- win->eventstate->y - ar->winrct.ymin,
+ win->eventstate->x - region->winrct.xmin,
+ win->eventstate->y - region->winrct.ymin,
};
const uint shdr_pos = GPU_vertformat_attr_add(
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 528fca85fa7..d9345808d28 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -99,11 +99,11 @@ static int draw_uvs_face_check(const ToolSettings *ts)
/* ------------------------- */
-void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
+void ED_image_draw_cursor(ARegion *region, const float cursor[2])
{
float zoom[2], x_fac, y_fac;
- UI_view2d_scale_get_inverse(&ar->v2d, &zoom[0], &zoom[1]);
+ UI_view2d_scale_get_inverse(&region->v2d, &zoom[0], &zoom[1]);
mul_v2_fl(zoom, 256.0f * UI_DPI_FAC);
x_fac = zoom[0];
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index ffa142dfcf3..7172db788f1 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -2836,10 +2836,10 @@ static int uv_select_exec(bContext *C, wmOperator *op)
static int uv_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return uv_select_exec(C, op);
@@ -2905,10 +2905,10 @@ static int uv_select_loop_exec(bContext *C, wmOperator *op)
static int uv_select_loop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float co[2];
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
return uv_select_loop_exec(C, op);
@@ -2988,9 +2988,9 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent
if (event) {
/* invoke */
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
RNA_float_set_array(op->ptr, "location", co);
}
else {
@@ -3497,7 +3497,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
const ToolSettings *ts = scene->toolsettings;
ViewLayer *view_layer = CTX_data_view_layer(C);
Image *ima = CTX_data_edit_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
BMFace *efa;
BMLoop *l;
BMIter iter, liter;
@@ -3510,7 +3510,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
/* get rectangle from operator */
WM_operator_properties_border_to_rctf(op, &rectf);
- UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf);
+ UI_view2d_region_to_view_rctf(&region->v2d, &rectf, &rectf);
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
const bool select = (sel_op != SEL_OP_SUB);
@@ -3654,7 +3654,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const ToolSettings *ts = scene->toolsettings;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
BMFace *efa;
BMLoop *l;
BMIter iter, liter;
@@ -3674,12 +3674,12 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
/* compute ellipse size and location, not a circle since we deal
* with non square image. ellipse is normalized, r = 1.0. */
ED_space_image_get_size(sima, &width, &height);
- ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;
- UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);
+ UI_view2d_region_to_view(&region->v2d, x, y, &offset[0], &offset[1]);
bool changed_multi = false;
@@ -3791,7 +3791,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
SpaceImage *sima = CTX_wm_space_image(C);
Image *ima = CTX_data_edit_image(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
const ToolSettings *ts = scene->toolsettings;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -3838,7 +3838,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
uv_poly_center(efa, cent, cd_loop_uv_offset);
if (UI_view2d_view_to_region_clip(
- &ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]) &&
+ &region->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]) &&
BLI_rcti_isect_pt_v(&rect, screen_uv) &&
BLI_lasso_is_point_inside(
mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) {
@@ -3862,7 +3862,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
if ((select) != (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (UI_view2d_view_to_region_clip(
- &ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]) &&
+ &region->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]) &&
BLI_rcti_isect_pt_v(&rect, screen_uv) &&
BLI_lasso_is_point_inside(
mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) {
@@ -4954,10 +4954,10 @@ static int uv_set_2d_cursor_exec(bContext *C, wmOperator *op)
static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
float location[2];
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
if (event->mval[1] <= 16) {
SpaceImage *sima = CTX_wm_space_image(C);
if (sima && ED_space_image_show_cache(sima)) {
@@ -4966,7 +4966,8 @@ static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e
}
}
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+ UI_view2d_region_to_view(
+ &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);
return uv_set_2d_cursor_exec(C, op);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 5d3d016e6c1..5544c5cee63 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1753,7 +1753,7 @@ static void stitch_draw_vbo(GPUVertBuf *vbo, GPUPrimType prim_type, const float
}
/* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */
-static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
+static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
{
StitchStateContainer *ssc = (StitchStateContainer *)arg;
@@ -2254,8 +2254,8 @@ static bool goto_next_island(StitchStateContainer *ssc)
static int stitch_init_all(bContext *C, wmOperator *op)
{
- ARegion *ar = CTX_wm_region(C);
- if (!ar) {
+ ARegion *region = CTX_wm_region(C);
+ if (!region) {
return 0;
}
@@ -2399,7 +2399,8 @@ static int stitch_init_all(bContext *C, wmOperator *op)
stitch_update_header(ssc, C);
- ssc->draw_handle = ED_region_draw_cb_activate(ar->type, stitch_draw, ssc, REGION_DRAW_POST_VIEW);
+ ssc->draw_handle = ED_region_draw_cb_activate(
+ region->type, stitch_draw, ssc, REGION_DRAW_POST_VIEW);
return 1;
}
@@ -2548,10 +2549,10 @@ static StitchState *stitch_select(bContext *C,
/* add uv under mouse to processed uv's */
float co[2];
UvNearestHit hit = UV_NEAREST_HIT_INIT;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
Image *ima = CTX_data_edit_image(C);
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
if (ssc->mode == STITCH_VERT) {
if (uv_find_nearest_vert_multi(scene, ima, ssc->objects, ssc->objects_len, co, 0.0f, &hit)) {
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index fb48b1377f1..a198ebb6f20 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1809,7 +1809,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
const Scene *scene = CTX_data_scene(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Camera *camera = ED_view3d_camera_data_get(v3d, rv3d);
@@ -1901,7 +1901,8 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- BLI_uvproject_from_view(luv->uv, l->v->co, rv3d->persmat, rotmat, ar->winx, ar->winy);
+ BLI_uvproject_from_view(
+ luv->uv, l->v->co, rv3d->persmat, rotmat, region->winx, region->winy);
}
changed = true;
}
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 8fec5354d36..189f5542ea0 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -178,7 +178,7 @@ typedef struct Panel {
* - #ARegion.panels_category_active (#PanelCategoryStack)
* is basically a list of strings (category id's).
*
- * Clicking on a tab moves it to the front of ar->panels_category_active,
+ * Clicking on a tab moves it to the front of region->panels_category_active,
* If the context changes so this tab is no longer displayed,
* then the first-most tab in #ARegion.panels_category_active is used.
*
@@ -417,7 +417,7 @@ typedef struct ARegion {
short flag;
/** Current split size in unscaled pixels (if zero it uses regiontype).
- * To convert to pixels use: `UI_DPI_FAC * ar->sizex + 0.5f`.
+ * To convert to pixels use: `UI_DPI_FAC * region->sizex + 0.5f`.
* However to get the current region size, you should usually use winx/winy from above, not this!
*/
short sizex, sizey;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 97959ba8899..8123d02714a 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -579,16 +579,16 @@ static void area_region_from_regiondata(bScreen *sc,
ARegion **r_ar)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
*r_sa = NULL;
*r_ar = NULL;
for (sa = sc->areabase.first; sa; sa = sa->next) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiondata == regiondata) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region->regiondata == regiondata) {
*r_sa = sa;
- *r_ar = ar;
+ *r_ar = region;
return;
}
}
@@ -612,9 +612,9 @@ static bool rna_Space_bool_from_region_flag_get_by_type(PointerRNA *ptr,
const int region_flag)
{
ScrArea *sa = rna_area_from_space(ptr);
- ARegion *ar = BKE_area_find_region_type(sa, region_type);
- if (ar) {
- return (ar->flag & region_flag);
+ ARegion *region = BKE_area_find_region_type(sa, region_type);
+ if (region) {
+ return (region->flag & region_flag);
}
return false;
}
@@ -625,11 +625,11 @@ static void rna_Space_bool_from_region_flag_set_by_type(PointerRNA *ptr,
bool value)
{
ScrArea *sa = rna_area_from_space(ptr);
- ARegion *ar = BKE_area_find_region_type(sa, region_type);
- if (ar && (ar->alignment != RGN_ALIGN_NONE)) {
- SET_FLAG_FROM_TEST(ar->flag, value, region_flag);
+ ARegion *region = BKE_area_find_region_type(sa, region_type);
+ if (region && (region->alignment != RGN_ALIGN_NONE)) {
+ SET_FLAG_FROM_TEST(region->flag, value, region_flag);
}
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
}
static void rna_Space_bool_from_region_flag_update_by_type(bContext *C,
@@ -638,22 +638,22 @@ static void rna_Space_bool_from_region_flag_update_by_type(bContext *C,
const int region_flag)
{
ScrArea *sa = rna_area_from_space(ptr);
- ARegion *ar = BKE_area_find_region_type(sa, region_type);
- if (ar) {
+ ARegion *region = BKE_area_find_region_type(sa, region_type);
+ if (region) {
if (region_flag == RGN_FLAG_HIDDEN) {
/* Only support animation when the area is in the current context. */
- if (ar->overlap && (sa == CTX_wm_area(C))) {
- ED_region_visibility_change_update_animated(C, sa, ar);
+ if (region->overlap && (sa == CTX_wm_area(C))) {
+ ED_region_visibility_change_update_animated(C, sa, region);
}
else {
- ED_region_visibility_change_update(C, sa, ar);
+ ED_region_visibility_change_update(C, sa, region);
}
}
else if (region_flag == RGN_FLAG_HIDDEN_BY_USER) {
- if (!(ar->flag & RGN_FLAG_HIDDEN_BY_USER) != !(ar->flag & RGN_FLAG_HIDDEN)) {
- ED_region_toggle_hidden(C, ar);
+ if (!(region->flag & RGN_FLAG_HIDDEN_BY_USER) != !(region->flag & RGN_FLAG_HIDDEN)) {
+ ED_region_toggle_hidden(C, region);
- if ((ar->flag & RGN_FLAG_HIDDEN_BY_USER) == 0) {
+ if ((region->flag & RGN_FLAG_HIDDEN_BY_USER) == 0) {
ED_area_type_hud_ensure(C, sa);
}
}
@@ -774,12 +774,12 @@ static void rna_Space_show_region_hud_update(bContext *C, PointerRNA *ptr)
static bool rna_Space_view2d_sync_get(PointerRNA *ptr)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- View2D *v2d = &ar->v2d;
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (region) {
+ View2D *v2d = &region->v2d;
return (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME) != 0;
}
@@ -789,12 +789,12 @@ static bool rna_Space_view2d_sync_get(PointerRNA *ptr)
static void rna_Space_view2d_sync_set(PointerRNA *ptr, bool value)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- View2D *v2d = &ar->v2d;
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (region) {
+ View2D *v2d = &region->v2d;
if (value) {
v2d->flag |= V2D_VIEWSYNC_SCREEN_TIME;
}
@@ -809,14 +809,14 @@ static void rna_Space_view2d_sync_update(Main *UNUSED(bmain),
PointerRNA *ptr)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
+ if (region) {
bScreen *sc = (bScreen *)ptr->owner_id;
- View2D *v2d = &ar->v2d;
+ View2D *v2d = &region->v2d;
UI_view2d_sync(sc, sa, v2d, V2D_LOCK_SET);
}
@@ -879,8 +879,8 @@ static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
void *regiondata = NULL;
if (sa) {
ListBase *regionbase = (sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase;
- ARegion *ar = regionbase->last; /* always last in list, weak .. */
- regiondata = ar->regiondata;
+ ARegion *region = regionbase->last; /* always last in list, weak .. */
+ regiondata = region->regiondata;
}
return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
@@ -893,16 +893,17 @@ static void rna_SpaceView3D_region_quadviews_begin(CollectionPropertyIterator *i
ScrArea *sa = rna_area_from_space(ptr);
int i = 3;
- ARegion *ar = ((sa && sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase)->last;
+ ARegion *region =
+ ((sa && sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase)->last;
ListBase lb = {NULL, NULL};
- if (ar && ar->alignment == RGN_ALIGN_QSPLIT) {
- while (i-- && ar) {
- ar = ar->prev;
+ if (region && region->alignment == RGN_ALIGN_QSPLIT) {
+ while (i-- && region) {
+ region = region->prev;
}
if (i < 0) {
- lb.first = ar;
+ lb.first = region;
}
}
@@ -921,11 +922,11 @@ static void rna_RegionView3D_quadview_update(Main *UNUSED(main),
PointerRNA *ptr)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
- rna_area_region_from_regiondata(ptr, &sa, &ar);
- if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) {
- ED_view3d_quadview_update(sa, ar, false);
+ rna_area_region_from_regiondata(ptr, &sa, &region);
+ if (sa && region && region->alignment == RGN_ALIGN_QSPLIT) {
+ ED_view3d_quadview_update(sa, region, false);
}
}
@@ -935,11 +936,11 @@ static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main),
PointerRNA *ptr)
{
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
- rna_area_region_from_regiondata(ptr, &sa, &ar);
- if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT) {
- ED_view3d_quadview_update(sa, ar, true);
+ rna_area_region_from_regiondata(ptr, &sa, &region);
+ if (sa && region && region->alignment == RGN_ALIGN_QSPLIT) {
+ ED_view3d_quadview_update(sa, region, true);
}
}
@@ -1508,15 +1509,15 @@ static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
{
SpaceImage *sima = (SpaceImage *)ptr->data;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
values[0] = values[1] = 1;
/* find aregion */
sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- ED_space_image_get_zoom(sima, ar, &values[0], &values[1]);
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (region) {
+ ED_space_image_get_zoom(sima, region, &values[0], &values[1]);
}
}
@@ -2209,9 +2210,9 @@ static void rna_SpaceNodeEditor_cursor_location_from_region(SpaceNode *snode,
int x,
int y)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
+ UI_view2d_region_to_view(&region->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
snode->cursor[0] /= UI_DPI_FAC;
snode->cursor[1] /= UI_DPI_FAC;
}
diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c
index cbaa407646f..84c80e56d0d 100644
--- a/source/blender/makesrna/intern/rna_space_api.c
+++ b/source/blender/makesrna/intern/rna_space_api.c
@@ -35,11 +35,11 @@ static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d, bContext *C)
bScreen *sc = (bScreen *)id;
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
- area_region_from_regiondata(sc, rv3d, &sa, &ar);
+ area_region_from_regiondata(sc, rv3d, &sa, &region);
- if (sa && ar && sa->spacetype == SPACE_VIEW3D) {
+ if (sa && region && sa->spacetype == SPACE_VIEW3D) {
Main *bmain = CTX_data_main(C);
View3D *v3d = sa->spacedata.first;
wmWindowManager *wm = CTX_wm_manager(C);
@@ -51,7 +51,7 @@ static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d, bContext *C)
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true);
- ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL, false);
+ ED_view3d_update_viewmat(depsgraph, scene, v3d, region, NULL, NULL, NULL, false);
break;
}
}
@@ -64,9 +64,9 @@ static void rna_SpaceTextEditor_region_location_from_cursor(
bScreen *sc = (bScreen *)id;
ScrArea *sa = BKE_screen_find_area_from_space(sc, (SpaceLink *)st);
if (sa) {
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ ARegion *region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
const int cursor_co[2] = {line, column};
- ED_text_region_location_from_cursor(st, ar, cursor_co, r_pixel_pos);
+ ED_text_region_location_from_cursor(st, region, cursor_co, r_pixel_pos);
}
}
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 0bd6769d3ad..da12c782052 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -259,9 +259,9 @@ static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr)
for (bScreen *screen = G_MAIN->screens.first; screen; screen = screen->id.next) {
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->gizmo_map) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->gizmo_map) {
+ wmGizmoMap *gzmap = region->gizmo_map;
for (wmGizmoGroup *gzgroup = WM_gizmomap_group_list(gzmap)->first; gzgroup;
gzgroup = gzgroup->next) {
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index b0e0dd27c7d..f09440a1ceb 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -211,7 +211,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self,
struct Scene *scene;
struct ViewLayer *view_layer;
View3D *v3d;
- ARegion *ar;
+ ARegion *region;
struct RV3DMatrixStore *rv3d_mats;
BPY_GPU_OFFSCREEN_CHECK_OBJ(self);
@@ -234,7 +234,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self,
(!(scene = PyC_RNA_AsPointer(py_scene, "Scene")) ||
!(view_layer = PyC_RNA_AsPointer(py_view_layer, "ViewLayer")) ||
!(v3d = PyC_RNA_AsPointer(py_view3d, "SpaceView3D")) ||
- !(ar = PyC_RNA_AsPointer(py_region, "Region")))) {
+ !(region = PyC_RNA_AsPointer(py_region, "Region")))) {
return NULL;
}
@@ -242,7 +242,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self,
depsgraph = BKE_scene_get_depsgraph(G_MAIN, scene, view_layer, true);
- rv3d_mats = ED_view3d_mats_rv3d_backup(ar->regiondata);
+ rv3d_mats = ED_view3d_mats_rv3d_backup(region->regiondata);
GPU_offscreen_bind(self->ofs, true);
@@ -250,7 +250,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self,
scene,
v3d->shading.type,
v3d,
- ar,
+ region,
GPU_offscreen_width(self->ofs),
GPU_offscreen_height(self->ofs),
(float(*)[4])py_mat_view->matrix,
@@ -264,7 +264,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self,
GPU_offscreen_unbind(self->ofs, true);
- ED_view3d_mats_rv3d_restore(ar->regiondata, rv3d_mats);
+ ED_view3d_mats_rv3d_restore(region->regiondata, rv3d_mats);
MEM_freeN(rv3d_mats);
Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index e44fda1e892..b321a482b1d 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -58,7 +58,7 @@ static const EnumPropertyItem region_draw_mode_items[] = {
{0, NULL, 0, NULL, NULL},
};
-static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata)
+static void cb_region_draw(const bContext *C, ARegion *UNUSED(region), void *customdata)
{
PyObject *cb_func, *cb_args, *result;
PyGILState_STATE gilstate;
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 2cb91f6cadf..6781f055fc2 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -188,7 +188,7 @@ void WM_lib_reload(struct Library *lib, struct bContext *C, struct ReportList *r
/* mouse cursors */
void WM_cursor_set(struct wmWindow *win, int curs);
-bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const ARegion *ar);
+bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const ARegion *region);
void WM_cursor_modal_set(struct wmWindow *win, int curs);
void WM_cursor_modal_restore(struct wmWindow *win);
void WM_cursor_wait(bool val);
@@ -205,14 +205,14 @@ struct wmPaintCursor *WM_paint_cursor_activate(
void *customdata);
bool WM_paint_cursor_end(struct wmWindowManager *wm, struct wmPaintCursor *handle);
-void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar);
+void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *region);
void WM_cursor_warp(struct wmWindow *win, int x, int y);
void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y);
/* handlers */
-typedef bool (*EventHandlerPoll)(const ARegion *ar, const struct wmEvent *event);
+typedef bool (*EventHandlerPoll)(const ARegion *region, const struct wmEvent *event);
struct wmEventHandler_Keymap *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap);
struct wmEventHandler_Keymap *WM_event_add_keymap_handler_poll(ListBase *handlers,
wmKeyMap *keymap,
@@ -628,7 +628,7 @@ void WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op);
/* Gesture manager API */
struct wmGesture *WM_gesture_new(struct wmWindow *window,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct wmEvent *event,
int type);
void WM_gesture_end(struct wmWindow *win, struct wmGesture *gesture);
@@ -669,7 +669,7 @@ void wmWindowViewport(struct wmWindow *win);
/* OpenGL utilities with safety check */
void wmOrtho2(float x1, float x2, float y1, float y2);
/* use for conventions (avoid hard-coded offsets all over) */
-void wmOrtho2_region_pixelspace(const struct ARegion *ar);
+void wmOrtho2_region_pixelspace(const struct ARegion *region);
void wmOrtho2_pixelspace(const float x, const float y);
void wmGetProjectionMatrix(float mat[4][4], const struct rcti *winrct);
@@ -768,14 +768,14 @@ void *WM_draw_cb_activate(struct wmWindow *win,
void WM_draw_cb_exit(struct wmWindow *win, void *handle);
void WM_redraw_windows(struct bContext *C);
-void WM_draw_region_viewport_ensure(struct ARegion *ar, short space_type);
-void WM_draw_region_viewport_bind(struct ARegion *ar);
-void WM_draw_region_viewport_unbind(struct ARegion *ar);
+void WM_draw_region_viewport_ensure(struct ARegion *region, short space_type);
+void WM_draw_region_viewport_bind(struct ARegion *region);
+void WM_draw_region_viewport_unbind(struct ARegion *region);
/* Region drawing */
-void WM_draw_region_free(struct ARegion *ar);
-struct GPUViewport *WM_draw_region_get_viewport(struct ARegion *ar, int view);
-struct GPUViewport *WM_draw_region_get_bound_viewport(struct ARegion *ar);
+void WM_draw_region_free(struct ARegion *region);
+struct GPUViewport *WM_draw_region_get_viewport(struct ARegion *region, int view);
+struct GPUViewport *WM_draw_region_get_bound_viewport(struct ARegion *region);
void WM_main_playanim(int argc, const char **argv);
@@ -834,7 +834,7 @@ bool WM_event_is_ime_switch(const struct wmEvent *event);
/* wm_tooltip.c */
typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
int *pass,
double *r_pass_delay,
bool *r_exit_on_event);
@@ -842,18 +842,18 @@ typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *C,
void WM_tooltip_immediate_init(struct bContext *C,
struct wmWindow *win,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
wmTooltipInitFn init);
void WM_tooltip_timer_init_ex(struct bContext *C,
struct wmWindow *win,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
wmTooltipInitFn init,
double delay);
void WM_tooltip_timer_init(struct bContext *C,
struct wmWindow *win,
struct ScrArea *sa,
- struct ARegion *ar,
+ struct ARegion *region,
wmTooltipInitFn init);
void WM_tooltip_timer_clear(struct bContext *C, struct wmWindow *win);
void WM_tooltip_clear(struct bContext *C, struct wmWindow *win);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 8c278319fd5..b9dd6b3923d 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -892,7 +892,7 @@ typedef struct wmTooltipState {
struct ARegion *region;
/** Create the tooltip region (assign to 'region'). */
struct ARegion *(*init)(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
int *pass,
double *pass_delay,
bool *r_exit_on_event);
diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
index 7b07546f668..44c1804aa4d 100644
--- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h
+++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h
@@ -234,7 +234,7 @@ void WM_gizmo_do_msg_notify_tag_refresh(struct bContext *C,
struct wmMsgSubscribeValue *msg_val);
void WM_gizmo_target_property_subscribe_all(struct wmGizmo *gz,
struct wmMsgBus *mbus,
- struct ARegion *ar);
+ struct ARegion *region);
void WM_gizmo_target_property_anim_autokey(struct bContext *C,
const struct wmGizmo *gz,
@@ -295,12 +295,12 @@ bool WM_gizmomap_tag_delay_refresh_for_tweak_check(struct wmGizmoMap *gzmap);
void WM_gizmomap_draw(struct wmGizmoMap *gzmap,
const struct bContext *C,
const eWM_GizmoFlagMapDrawStep drawstep);
-void WM_gizmomap_add_handlers(struct ARegion *ar, struct wmGizmoMap *gzmap);
+void WM_gizmomap_add_handlers(struct ARegion *region, struct wmGizmoMap *gzmap);
bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *gzmap, const int action);
bool WM_gizmomap_cursor_set(const struct wmGizmoMap *gzmap, struct wmWindow *win);
void WM_gizmomap_message_subscribe(struct bContext *C,
struct wmGizmoMap *gzmap,
- struct ARegion *ar,
+ struct ARegion *region,
struct wmMsgBus *mbus);
bool WM_gizmomap_is_any_selected(const struct wmGizmoMap *gzmap);
bool WM_gizmomap_minmax(const struct wmGizmoMap *gzmap,
@@ -309,8 +309,11 @@ bool WM_gizmomap_minmax(const struct wmGizmoMap *gzmap,
float r_min[3],
float r_max[3]);
-struct ARegion *WM_gizmomap_tooltip_init(
- struct bContext *C, struct ARegion *ar, int *pass, double *pass_delay, bool *r_exit_on_event);
+struct ARegion *WM_gizmomap_tooltip_init(struct bContext *C,
+ struct ARegion *region,
+ int *pass,
+ double *pass_delay,
+ bool *r_exit_on_event);
/* -------------------------------------------------------------------- */
/* wmGizmoMapType */
@@ -334,7 +337,7 @@ void WM_gizmomaptype_group_init_runtime(const struct Main *bmain,
struct wmGizmoGroupType *gzgt);
wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(struct wmGizmoMapType *gzmap_type,
struct wmGizmoGroupType *gzgt,
- struct ARegion *ar);
+ struct ARegion *region);
void WM_gizmomaptype_group_unlink(struct bContext *C,
struct Main *bmain,
struct wmGizmoMapType *gzmap_type,
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
index 5ef77090ea0..f2cd847fe75 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.c
@@ -301,8 +301,8 @@ void WM_gizmo_group_remove_by_tool(bContext *C,
for (bScreen *sc = bmain->screens.first; sc; sc = sc->id.next) {
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
if (sa->runtime.tool == tref) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if (gzmap && gzmap->type == gzmap_type) {
wmGizmoGroup *gzgroup, *gzgroup_next;
for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup_next) {
@@ -310,7 +310,7 @@ void WM_gizmo_group_remove_by_tool(bContext *C,
if (gzgroup->type == gzgt) {
BLI_assert(gzgroup->parent_gzmap == gzmap);
wm_gizmogroup_free(C, gzgroup);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
}
}
}
@@ -356,8 +356,8 @@ bool wm_gizmogroup_is_any_selected(const wmGizmoGroup *gzgroup)
static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- ARegion *ar = CTX_wm_region(C);
- wmGizmoMap *gzmap = ar->gizmo_map;
+ ARegion *region = CTX_wm_region(C);
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoMapSelectState *msel = &gzmap->gzmap_context.select;
wmGizmo *highlight = gzmap->gzmap_context.highlight;
@@ -391,7 +391,7 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
}
if (redraw) {
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
}
return OPERATOR_FINISHED;
@@ -583,8 +583,8 @@ static int gizmo_tweak_modal(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);
- wmGizmoMap *gzmap = ar->gizmo_map;
+ ARegion *region = CTX_wm_region(C);
+ wmGizmoMap *gzmap = region->gizmo_map;
wmGizmo *gz = gzmap->gzmap_context.highlight;
/* Needed for single click actions which don't enter modal state. */
@@ -909,10 +909,10 @@ void WM_gizmomaptype_group_init_runtime(const Main *bmain,
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) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = lb->first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if (gzmap && gzmap->type == gzmap_type) {
- WM_gizmomaptype_group_init_runtime_with_region(gzmap_type, gzgt, ar);
+ WM_gizmomaptype_group_init_runtime_with_region(gzmap_type, gzgt, region);
}
}
}
@@ -922,9 +922,9 @@ void WM_gizmomaptype_group_init_runtime(const Main *bmain,
wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(wmGizmoMapType *gzmap_type,
wmGizmoGroupType *gzgt,
- ARegion *ar)
+ ARegion *region)
{
- wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = region->gizmo_map;
BLI_assert(gzmap && gzmap->type == gzmap_type);
UNUSED_VARS_NDEBUG(gzmap_type);
@@ -941,7 +941,7 @@ wmGizmoGroup *WM_gizmomaptype_group_init_runtime_with_region(wmGizmoMapType *gzm
wm_gizmomap_highlight_set(gzmap, NULL, NULL, 0);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
return gzgroup;
}
@@ -964,8 +964,8 @@ void WM_gizmomaptype_group_unlink(bContext *C,
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) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = lb->first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if (gzmap && gzmap->type == gzmap_type) {
wmGizmoGroup *gzgroup, *gzgroup_next;
for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup_next) {
@@ -973,7 +973,7 @@ void WM_gizmomaptype_group_unlink(bContext *C,
if (gzgroup->type == gzgt) {
BLI_assert(gzgroup->parent_gzmap == gzmap);
wm_gizmogroup_free(C, gzgroup);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
}
}
}
@@ -1131,8 +1131,8 @@ void WM_gizmo_group_unlink_delayed_ptr_from_space(wmGizmoGroupType *gzgt,
wmGizmoMapType *gzmap_type,
ScrArea *sa)
{
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if (gzmap && gzmap->type == gzmap_type) {
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
if (gzgroup->type == gzgt) {
@@ -1172,10 +1172,10 @@ void WM_gizmo_group_refresh(const bContext *C, wmGizmoGroup *gzgroup)
wmGizmo *gz = wm_gizmomap_highlight_get(gzmap);
if (!gz || gz->parent_gzgroup != gzgroup) {
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
- BLI_assert(ar->gizmo_map == gzmap);
+ ARegion *region = CTX_wm_region(C);
+ BLI_assert(region->gizmo_map == gzmap);
/* Check if the tweak event originated from this region. */
- if ((win->tweak != NULL) && BLI_rcti_compare(&ar->winrct, &win->tweak->winrct)) {
+ if ((win->tweak != NULL) && BLI_rcti_compare(&region->winrct, &win->tweak->winrct)) {
/* We need to run refresh again. */
gzgroup->init_flag &= ~WM_GIZMOGROUP_INIT_REFRESH;
WM_gizmomap_tag_refresh_drawstep(gzmap, WM_gizmomap_drawstep_from_gizmo_group(gzgroup));
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 1bf60c212c8..28690fec2d8 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -577,7 +577,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
const int hotspot)
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
View3D *v3d = sa->spacedata.first;
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
rcti rect;
@@ -588,7 +588,7 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
BLI_rcti_init_pt_radius(&rect, co, hotspot);
ED_view3d_draw_setup_view(
- CTX_wm_window(C), depsgraph, CTX_data_scene(C), ar, v3d, NULL, NULL, &rect);
+ CTX_wm_window(C), depsgraph, CTX_data_scene(C), region, v3d, NULL, NULL, &rect);
bool use_select_bias = false;
@@ -608,15 +608,15 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
}
ED_view3d_draw_setup_view(
- CTX_wm_window(C), depsgraph, CTX_data_scene(C), ar, v3d, NULL, NULL, NULL);
+ CTX_wm_window(C), depsgraph, CTX_data_scene(C), region, v3d, NULL, NULL, NULL);
if (use_select_bias && (hits > 1)) {
float co_direction[3];
float co_screen[3] = {co[0], co[1], 0.0f};
- ED_view3d_win_to_vector(ar, (float[2]){UNPACK2(co)}, co_direction);
+ ED_view3d_win_to_vector(region, (float[2]){UNPACK2(co)}, co_direction);
- RegionView3D *rv3d = ar->regiondata;
- const int viewport[4] = {0, 0, ar->winx, ar->winy};
+ RegionView3D *rv3d = region->regiondata;
+ const int viewport[4] = {0, 0, region->winx, region->winy};
float co_3d_origin[3];
/* Avoid multiple calculations. */
@@ -802,9 +802,9 @@ wmGizmo *wm_gizmomap_highlight_find(wmGizmoMap *gzmap,
return gz;
}
-void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap)
+void WM_gizmomap_add_handlers(ARegion *region, wmGizmoMap *gzmap)
{
- LISTBASE_FOREACH (wmEventHandler *, handler_base, &ar->handlers) {
+ LISTBASE_FOREACH (wmEventHandler *, handler_base, &region->handlers) {
if (handler_base->type == WM_HANDLER_TYPE_GIZMO) {
wmEventHandler_Gizmo *handler = (wmEventHandler_Gizmo *)handler_base;
if (handler->gizmo_map == gzmap) {
@@ -815,9 +815,9 @@ void WM_gizmomap_add_handlers(ARegion *ar, wmGizmoMap *gzmap)
wmEventHandler_Gizmo *handler = MEM_callocN(sizeof(*handler), __func__);
handler->head.type = WM_HANDLER_TYPE_GIZMO;
- BLI_assert(gzmap == ar->gizmo_map);
+ BLI_assert(gzmap == region->gizmo_map);
handler->gizmo_map = gzmap;
- BLI_addtail(&ar->handlers, handler);
+ BLI_addtail(&region->handlers, handler);
}
void wm_gizmomaps_handled_modal_update(bContext *C, wmEvent *event, wmEventHandler_Op *handler)
@@ -978,16 +978,16 @@ void wm_gizmomap_handler_context_op(bContext *C, wmEventHandler_Op *handler)
printf("internal error: modal gizmo-map handler has invalid area\n");
}
else {
- ARegion *ar;
+ ARegion *region;
CTX_wm_area_set(C, sa);
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == handler->context.region) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region == handler->context.region) {
break;
}
}
/* XXX no warning print here, after full-area and back regions are remade */
- if (ar) {
- CTX_wm_region_set(C, ar);
+ if (region) {
+ CTX_wm_region_set(C, region);
}
}
}
@@ -1046,8 +1046,8 @@ bool wm_gizmomap_highlight_set(wmGizmoMap *gzmap, const bContext *C, wmGizmo *gz
/* tag the region for redraw */
if (C) {
- ARegion *ar = CTX_wm_region(C);
- ED_region_tag_redraw_editor_overlays(ar);
+ ARegion *region = CTX_wm_region(C);
+ ED_region_tag_redraw_editor_overlays(region);
}
return true;
@@ -1161,7 +1161,7 @@ ListBase *wm_gizmomap_groups_get(wmGizmoMap *gzmap)
void WM_gizmomap_message_subscribe(bContext *C,
wmGizmoMap *gzmap,
- ARegion *ar,
+ ARegion *region,
struct wmMsgBus *mbus)
{
for (wmGizmoGroup *gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
@@ -1173,7 +1173,7 @@ void WM_gizmomap_message_subscribe(bContext *C,
if (gz->flag & WM_GIZMO_HIDDEN) {
continue;
}
- WM_gizmo_target_property_subscribe_all(gz, mbus, ar);
+ WM_gizmo_target_property_subscribe_all(gz, mbus, region);
}
if (gzgroup->type->message_subscribe != NULL) {
gzgroup->type->message_subscribe(C, gzgroup, mbus);
@@ -1189,12 +1189,12 @@ void WM_gizmomap_message_subscribe(bContext *C,
* \{ */
struct ARegion *WM_gizmomap_tooltip_init(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
int *UNUSED(r_pass),
double *UNUSED(pass_delay),
bool *r_exit_on_event)
{
- wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = region->gizmo_map;
*r_exit_on_event = false;
if (gzmap) {
wmGizmo *gz = gzmap->gzmap_context.highlight;
@@ -1375,8 +1375,8 @@ void WM_gizmoconfig_update(struct Main *bmain)
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if (gzmap != NULL && gzmap->tag_remove_group) {
gzmap->tag_remove_group = false;
@@ -1385,7 +1385,7 @@ void WM_gizmoconfig_update(struct Main *bmain)
gzgroup_next = gzgroup->next;
if (gzgroup->tag_remove) {
wm_gizmogroup_free(NULL, gzgroup);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
}
}
}
@@ -1412,8 +1412,8 @@ void WM_reinit_gizmomap_all(Main *bmain)
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
- for (ARegion *ar = regionbase->first; ar; ar = ar->next) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = regionbase->first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if ((gzmap != NULL) && (gzmap->is_init == false)) {
WM_gizmomap_reinit(gzmap);
}
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 87e23c0f03e..469d24c109d 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c
@@ -315,11 +315,12 @@ void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C),
wmMsgSubscribeKey *UNUSED(msg_key),
wmMsgSubscribeValue *msg_val)
{
- ARegion *ar = msg_val->owner;
+ ARegion *region = msg_val->owner;
wmGizmoMap *gzmap = msg_val->user_data;
- ED_region_tag_redraw(ar); /* Could possibly avoid a full redraw and only tag for editor overlays
- redraw in some cases, see ED_region_tag_redraw_editor_overlays(). */
+ ED_region_tag_redraw(
+ region); /* Could possibly avoid a full redraw and only tag for editor overlays
+ redraw in some cases, see ED_region_tag_redraw_editor_overlays(). */
WM_gizmomap_tag_refresh(gzmap);
}
@@ -327,7 +328,7 @@ void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C),
* Runs on the "prepare draw" pass,
* drawing the region clears.
*/
-void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, ARegion *ar)
+void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus, ARegion *region)
{
if (gz->type->target_property_defs_len) {
wmGizmoProperty *gz_prop_array = WM_gizmo_target_property_array(gz);
@@ -339,8 +340,8 @@ void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus,
&gz_prop->ptr,
gz_prop->prop,
&(const wmMsgSubscribeValue){
- .owner = ar,
- .user_data = ar,
+ .owner = region,
+ .user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
},
__func__);
@@ -348,7 +349,7 @@ void WM_gizmo_target_property_subscribe_all(wmGizmo *gz, struct wmMsgBus *mbus,
&gz_prop->ptr,
gz_prop->prop,
&(const wmMsgSubscribeValue){
- .owner = ar,
+ .owner = region,
.user_data = gz->parent_gzgroup->parent_gzmap,
.notify = WM_gizmo_do_msg_notify_tag_refresh,
},
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
index 87d475a4da1..812dd8edd3c 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_type.c
@@ -138,8 +138,8 @@ static void gizmotype_unlink(bContext *C, Main *bmain, wmGizmoType *gzt)
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) {
- wmGizmoMap *gzmap = ar->gizmo_map;
+ for (ARegion *region = lb->first; region; region = region->next) {
+ wmGizmoMap *gzmap = region->gizmo_map;
if (gzmap) {
wmGizmoGroup *gzgroup;
for (gzgroup = gzmap->groups.first; gzgroup; gzgroup = gzgroup->next) {
@@ -148,7 +148,7 @@ static void gizmotype_unlink(bContext *C, Main *bmain, wmGizmoType *gzt)
BLI_assert(gzgroup->parent_gzmap == gzmap);
if (gz->type == gzt) {
WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gz, C);
- ED_region_tag_redraw_editor_overlays(ar);
+ ED_region_tag_redraw_editor_overlays(region);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 41987f6d6d7..f69bc822f44 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -183,9 +183,9 @@ void WM_cursor_set(wmWindow *win, int curs)
}
}
-bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const ARegion *ar)
+bool WM_cursor_set_from_tool(struct wmWindow *win, const ScrArea *sa, const ARegion *region)
{
- if (ar && (ar->regiontype != RGN_TYPE_WINDOW)) {
+ if (region && (region->regiontype != RGN_TYPE_WINDOW)) {
return false;
}
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index e2462bb59b1..a45c8af0b5a 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -223,7 +223,7 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
{
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
const char *name;
name = dropbox_active(C, &win->handlers, drag, event);
@@ -236,7 +236,7 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *e
return name;
}
- name = dropbox_active(C, &ar->handlers, drag, event);
+ name = dropbox_active(C, &region->handlers, drag, event);
if (name) {
return name;
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 0d33ce87366..9ccff2a3e3d 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -74,31 +74,31 @@
/* ******************* paint cursor *************** */
-static void wm_paintcursor_draw(bContext *C, ScrArea *sa, ARegion *ar)
+static void wm_paintcursor_draw(bContext *C, ScrArea *sa, ARegion *region)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
bScreen *screen = WM_window_get_active_screen(win);
wmPaintCursor *pc;
- if (ar->visible && ar == screen->active_region) {
+ if (region->visible && region == screen->active_region) {
for (pc = wm->paintcursors.first; pc; pc = pc->next) {
if ((pc->space_type != SPACE_TYPE_ANY) && (sa->spacetype != pc->space_type)) {
continue;
}
- if ((pc->region_type != RGN_TYPE_ANY) && (ar->regiontype != pc->region_type)) {
+ if ((pc->region_type != RGN_TYPE_ANY) && (region->regiontype != pc->region_type)) {
continue;
}
if (pc->poll == NULL || pc->poll(C)) {
/* Prevent drawing outside region. */
glEnable(GL_SCISSOR_TEST);
- glScissor(ar->winrct.xmin,
- ar->winrct.ymin,
- BLI_rcti_size_x(&ar->winrct) + 1,
- BLI_rcti_size_y(&ar->winrct) + 1);
+ glScissor(region->winrct.xmin,
+ region->winrct.ymin,
+ BLI_rcti_size_x(&region->winrct) + 1,
+ BLI_rcti_size_y(&region->winrct) + 1);
if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) {
int x = 0, y = 0;
@@ -115,17 +115,20 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *sa, ARegion *ar)
}
}
-static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eStereoViews sview)
+static bool wm_draw_region_stereo_set(Main *bmain,
+ ScrArea *sa,
+ ARegion *region,
+ eStereoViews sview)
{
/* We could detect better when stereo is actually needed, by inspecting the
* image in the image editor and sequencer. */
- if (!ELEM(ar->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) {
+ if (!ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) {
return false;
}
switch (sa->spacetype) {
case SPACE_IMAGE: {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
SpaceImage *sima = sa->spacedata.first;
sima->iuser.multiview_eye = sview;
return true;
@@ -133,7 +136,7 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt
break;
}
case SPACE_VIEW3D: {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
View3D *v3d = sa->spacedata.first;
if (v3d->camera && v3d->camera->type == OB_CAMERA) {
Camera *cam = v3d->camera->data;
@@ -148,7 +151,7 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt
break;
}
case SPACE_NODE: {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (region->regiontype == RGN_TYPE_WINDOW) {
SpaceNode *snode = sa->spacedata.first;
if ((snode->flag & SNODE_BACKDRAW) && ED_node_is_compositor(snode)) {
Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
@@ -162,10 +165,10 @@ static bool wm_draw_region_stereo_set(Main *bmain, ScrArea *sa, ARegion *ar, eSt
SpaceSeq *sseq = sa->spacedata.first;
sseq->multiview_eye = sview;
- if (ar->regiontype == RGN_TYPE_PREVIEW) {
+ if (region->regiontype == RGN_TYPE_PREVIEW) {
return true;
}
- else if (ar->regiontype == RGN_TYPE_WINDOW) {
+ else if (region->regiontype == RGN_TYPE_WINDOW) {
return (sseq->draw_flag & SEQ_DRAW_BACKDROP) != 0;
}
}
@@ -183,19 +186,19 @@ static void wm_area_mark_invalid_backbuf(ScrArea *sa)
}
}
-static void wm_region_test_gizmo_do_draw(ARegion *ar, bool tag_redraw)
+static void wm_region_test_gizmo_do_draw(ARegion *region, bool tag_redraw)
{
- if (ar->gizmo_map == NULL) {
+ if (region->gizmo_map == NULL) {
return;
}
- wmGizmoMap *gzmap = ar->gizmo_map;
+ wmGizmoMap *gzmap = region->gizmo_map;
for (wmGizmoGroup *gzgroup = WM_gizmomap_group_list(gzmap)->first; gzgroup;
gzgroup = gzgroup->next) {
for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
if (gz->do_draw) {
if (tag_redraw) {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
gz->do_draw = false;
}
@@ -206,30 +209,30 @@ static void wm_region_test_gizmo_do_draw(ARegion *ar, bool tag_redraw)
static void wm_region_test_render_do_draw(const Scene *scene,
struct Depsgraph *depsgraph,
ScrArea *sa,
- ARegion *ar)
+ ARegion *region)
{
/* tag region for redraw from render engine preview running inside of it */
- if (sa->spacetype == SPACE_VIEW3D && ar->regiontype == RGN_TYPE_WINDOW) {
- RegionView3D *rv3d = ar->regiondata;
+ if (sa->spacetype == SPACE_VIEW3D && region->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = region->regiondata;
RenderEngine *engine = rv3d->render_engine;
- GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
+ GPUViewport *viewport = WM_draw_region_get_viewport(region, 0);
if (engine && (engine->flag & RE_ENGINE_DO_DRAW)) {
View3D *v3d = sa->spacedata.first;
rcti border_rect;
/* do partial redraw when possible */
- if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect)) {
- ED_region_tag_redraw_partial(ar, &border_rect, false);
+ if (ED_view3d_calc_render_border(scene, depsgraph, v3d, region, &border_rect)) {
+ ED_region_tag_redraw_partial(region, &border_rect, false);
}
else {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
engine->flag &= ~RE_ENGINE_DO_DRAW;
}
else if (viewport && GPU_viewport_do_update(viewport)) {
- ED_region_tag_redraw_no_rebuild(ar);
+ ED_region_tag_redraw_no_rebuild(region);
}
}
}
@@ -239,9 +242,9 @@ static bool wm_region_use_viewport_by_type(short space_type, short region_type)
return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE) && region_type == RGN_TYPE_WINDOW);
}
-static bool wm_region_use_viewport(ScrArea *sa, ARegion *ar)
+static bool wm_region_use_viewport(ScrArea *sa, ARegion *region)
{
- return wm_region_use_viewport_by_type(sa->spacetype, ar->regiontype);
+ return wm_region_use_viewport_by_type(sa->spacetype, region->regiontype);
}
/********************** draw all **************************/
@@ -293,20 +296,20 @@ static void wm_draw_callbacks(wmWindow *win)
* change. It also means we can share a single context for multiple windows,
* so that for example VAOs can be shared between windows. */
-static void wm_draw_region_buffer_free(ARegion *ar)
+static void wm_draw_region_buffer_free(ARegion *region)
{
- if (ar->draw_buffer) {
+ if (region->draw_buffer) {
for (int view = 0; view < 2; view++) {
- if (ar->draw_buffer->offscreen[view]) {
- GPU_offscreen_free(ar->draw_buffer->offscreen[view]);
+ if (region->draw_buffer->offscreen[view]) {
+ GPU_offscreen_free(region->draw_buffer->offscreen[view]);
}
- if (ar->draw_buffer->viewport[view]) {
- GPU_viewport_free(ar->draw_buffer->viewport[view]);
+ if (region->draw_buffer->viewport[view]) {
+ GPU_viewport_free(region->draw_buffer->viewport[view]);
}
}
- MEM_freeN(ar->draw_buffer);
- ar->draw_buffer = NULL;
+ MEM_freeN(region->draw_buffer);
+ region->draw_buffer = NULL;
}
}
@@ -329,36 +332,37 @@ static void wm_draw_offscreen_texture_parameters(GPUOffScreen *offscreen)
glBindTexture(GL_TEXTURE_2D, 0);
}
-static void wm_draw_region_buffer_create(ARegion *ar, bool stereo, bool use_viewport)
+static void wm_draw_region_buffer_create(ARegion *region, bool stereo, bool use_viewport)
{
- if (ar->draw_buffer) {
- if (ar->draw_buffer->stereo != stereo) {
+ if (region->draw_buffer) {
+ if (region->draw_buffer->stereo != stereo) {
/* Free draw buffer on stereo changes. */
- wm_draw_region_buffer_free(ar);
+ wm_draw_region_buffer_free(region);
}
else {
/* Free offscreen buffer on size changes. Viewport auto resizes. */
- GPUOffScreen *offscreen = ar->draw_buffer->offscreen[0];
- if (offscreen && (GPU_offscreen_width(offscreen) != ar->winx ||
- GPU_offscreen_height(offscreen) != ar->winy)) {
- wm_draw_region_buffer_free(ar);
+ GPUOffScreen *offscreen = region->draw_buffer->offscreen[0];
+ if (offscreen && (GPU_offscreen_width(offscreen) != region->winx ||
+ GPU_offscreen_height(offscreen) != region->winy)) {
+ wm_draw_region_buffer_free(region);
}
}
}
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
if (use_viewport) {
/* Allocate viewport which includes an offscreen buffer with depth
* multisample, etc. */
- ar->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer");
- ar->draw_buffer->viewport[0] = GPU_viewport_create();
- ar->draw_buffer->viewport[1] = (stereo) ? GPU_viewport_create() : NULL;
+ region->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer");
+ region->draw_buffer->viewport[0] = GPU_viewport_create();
+ region->draw_buffer->viewport[1] = (stereo) ? GPU_viewport_create() : NULL;
}
else {
/* Allocate offscreen buffer if it does not exist. This one has no
* depth or multisample buffers. 3D view creates own buffers with
* the data it needs. */
- GPUOffScreen *offscreen = GPU_offscreen_create(ar->winx, ar->winy, 0, false, false, NULL);
+ GPUOffScreen *offscreen = GPU_offscreen_create(
+ region->winx, region->winy, 0, false, false, NULL);
if (!offscreen) {
return;
}
@@ -367,7 +371,7 @@ static void wm_draw_region_buffer_create(ARegion *ar, bool stereo, bool use_view
GPUOffScreen *offscreen_right = NULL;
if (stereo) {
- offscreen_right = GPU_offscreen_create(ar->winx, ar->winy, 0, false, false, NULL);
+ offscreen_right = GPU_offscreen_create(region->winx, region->winy, 0, false, false, NULL);
if (!offscreen_right) {
GPU_offscreen_free(offscreen);
@@ -377,57 +381,57 @@ static void wm_draw_region_buffer_create(ARegion *ar, bool stereo, bool use_view
wm_draw_offscreen_texture_parameters(offscreen_right);
}
- ar->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer");
- ar->draw_buffer->offscreen[0] = offscreen;
- ar->draw_buffer->offscreen[1] = offscreen_right;
+ region->draw_buffer = MEM_callocN(sizeof(wmDrawBuffer), "wmDrawBuffer");
+ region->draw_buffer->offscreen[0] = offscreen;
+ region->draw_buffer->offscreen[1] = offscreen_right;
}
- ar->draw_buffer->bound_view = -1;
- ar->draw_buffer->stereo = stereo;
+ region->draw_buffer->bound_view = -1;
+ region->draw_buffer->stereo = stereo;
}
}
-static void wm_draw_region_bind(ARegion *ar, int view)
+static void wm_draw_region_bind(ARegion *region, int view)
{
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
return;
}
- if (ar->draw_buffer->viewport[view]) {
- GPU_viewport_bind(ar->draw_buffer->viewport[view], &ar->winrct);
+ if (region->draw_buffer->viewport[view]) {
+ GPU_viewport_bind(region->draw_buffer->viewport[view], &region->winrct);
}
else {
- GPU_offscreen_bind(ar->draw_buffer->offscreen[view], false);
+ GPU_offscreen_bind(region->draw_buffer->offscreen[view], false);
/* For now scissor is expected by region drawing, we could disable it
* and do the enable/disable in the specific cases that setup scissor. */
glEnable(GL_SCISSOR_TEST);
- glScissor(0, 0, ar->winx, ar->winy);
+ glScissor(0, 0, region->winx, region->winy);
}
- ar->draw_buffer->bound_view = view;
+ region->draw_buffer->bound_view = view;
}
-static void wm_draw_region_unbind(ARegion *ar, int view)
+static void wm_draw_region_unbind(ARegion *region, int view)
{
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
return;
}
- ar->draw_buffer->bound_view = -1;
+ region->draw_buffer->bound_view = -1;
- if (ar->draw_buffer->viewport[view]) {
- GPU_viewport_unbind(ar->draw_buffer->viewport[view]);
+ if (region->draw_buffer->viewport[view]) {
+ GPU_viewport_unbind(region->draw_buffer->viewport[view]);
}
else {
glDisable(GL_SCISSOR_TEST);
- GPU_offscreen_unbind(ar->draw_buffer->offscreen[view], false);
+ GPU_offscreen_unbind(region->draw_buffer->offscreen[view], false);
}
}
-static void wm_draw_region_blit(ARegion *ar, int view)
+static void wm_draw_region_blit(ARegion *region, int view)
{
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
return;
}
@@ -436,43 +440,44 @@ static void wm_draw_region_blit(ARegion *ar, int view)
view = 0;
}
else if (view > 0) {
- if (ar->draw_buffer->viewport[view] == NULL && ar->draw_buffer->offscreen[view] == NULL) {
+ if (region->draw_buffer->viewport[view] == NULL &&
+ region->draw_buffer->offscreen[view] == NULL) {
/* Region does not need stereo or failed to allocate stereo buffers. */
view = 0;
}
}
- if (ar->draw_buffer->viewport[view]) {
- GPU_viewport_draw_to_screen(ar->draw_buffer->viewport[view], &ar->winrct);
+ if (region->draw_buffer->viewport[view]) {
+ GPU_viewport_draw_to_screen(region->draw_buffer->viewport[view], &region->winrct);
}
else {
GPU_offscreen_draw_to_screen(
- ar->draw_buffer->offscreen[view], ar->winrct.xmin, ar->winrct.ymin);
+ region->draw_buffer->offscreen[view], region->winrct.xmin, region->winrct.ymin);
}
}
-GPUTexture *wm_draw_region_texture(ARegion *ar, int view)
+GPUTexture *wm_draw_region_texture(ARegion *region, int view)
{
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
return NULL;
}
- if (ar->draw_buffer->viewport[view]) {
- return GPU_viewport_color_texture(ar->draw_buffer->viewport[view]);
+ if (region->draw_buffer->viewport[view]) {
+ return GPU_viewport_color_texture(region->draw_buffer->viewport[view]);
}
else {
- return GPU_offscreen_color_texture(ar->draw_buffer->offscreen[view]);
+ return GPU_offscreen_color_texture(region->draw_buffer->offscreen[view]);
}
}
-void wm_draw_region_blend(ARegion *ar, int view, bool blend)
+void wm_draw_region_blend(ARegion *region, int view, bool blend)
{
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
return;
}
/* Alpha is always 1, except when blend timer is running. */
- float alpha = ED_region_blend_alpha(ar);
+ float alpha = ED_region_blend_alpha(region);
if (alpha <= 0.0f) {
return;
}
@@ -482,13 +487,13 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
}
/* setup actual texture */
- GPUTexture *texture = wm_draw_region_texture(ar, view);
+ GPUTexture *texture = wm_draw_region_texture(region, view);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(texture));
/* wmOrtho for the screen has this same offset */
- const float halfx = GLA_PIXEL_OFS / (BLI_rcti_size_x(&ar->winrct) + 1);
- const float halfy = GLA_PIXEL_OFS / (BLI_rcti_size_y(&ar->winrct) + 1);
+ const float halfx = GLA_PIXEL_OFS / (BLI_rcti_size_x(&region->winrct) + 1);
+ const float halfy = GLA_PIXEL_OFS / (BLI_rcti_size_y(&region->winrct) + 1);
if (blend) {
/* GL_ONE because regions drawn offscreen have premultiplied alpha. */
@@ -499,7 +504,7 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR);
GPU_shader_bind(shader);
- rcti rect_geo = ar->winrct;
+ rcti rect_geo = region->winrct;
rect_geo.xmax += 1;
rect_geo.ymax += 1;
@@ -513,13 +518,13 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
alpha_easing = 1.0f - alpha_easing * alpha_easing;
/* Slide vertical panels */
- float ofs_x = BLI_rcti_size_x(&ar->winrct) * (1.0f - alpha_easing);
- if (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_RIGHT) {
+ float ofs_x = BLI_rcti_size_x(&region->winrct) * (1.0f - alpha_easing);
+ if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_RIGHT) {
rect_geo.xmin += ofs_x;
rect_tex.xmax *= alpha_easing;
alpha = 1.0f;
}
- else if (RGN_ALIGN_ENUM_FROM_MASK(ar->alignment) == RGN_ALIGN_LEFT) {
+ else if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_LEFT) {
rect_geo.xmax -= ofs_x;
rect_tex.xmin += 1.0f - alpha_easing;
alpha = 1.0f;
@@ -549,23 +554,23 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
}
}
-GPUViewport *WM_draw_region_get_viewport(ARegion *ar, int view)
+GPUViewport *WM_draw_region_get_viewport(ARegion *region, int view)
{
- if (!ar->draw_buffer) {
+ if (!region->draw_buffer) {
return NULL;
}
- return ar->draw_buffer->viewport[view];
+ return region->draw_buffer->viewport[view];
}
-GPUViewport *WM_draw_region_get_bound_viewport(ARegion *ar)
+GPUViewport *WM_draw_region_get_bound_viewport(ARegion *region)
{
- if (!ar->draw_buffer || ar->draw_buffer->bound_view == -1) {
+ if (!region->draw_buffer || region->draw_buffer->bound_view == -1) {
return NULL;
}
- int view = ar->draw_buffer->bound_view;
- return ar->draw_buffer->viewport[view];
+ int view = region->draw_buffer->bound_view;
+ return region->draw_buffer->viewport[view];
}
static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
@@ -580,17 +585,18 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
CTX_wm_area_set(C, sa);
/* Compute UI layouts for dynamically size regions. */
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
/* Dynamic region may have been flagged as too small because their size on init is 0.
* ARegion.visible is false then, as expected. The layout should still be created then, so
* the region size can be updated (it may turn out to be not too small then). */
- const bool ignore_visibility = (ar->flag & RGN_FLAG_DYNAMIC_SIZE) &&
- (ar->flag & RGN_FLAG_TOO_SMALL) &&
- !(ar->flag & RGN_FLAG_HIDDEN);
-
- if ((ar->visible || ignore_visibility) && ar->do_draw && ar->type && ar->type->layout) {
- CTX_wm_region_set(C, ar);
- ED_region_do_layout(C, ar);
+ const bool ignore_visibility = (region->flag & RGN_FLAG_DYNAMIC_SIZE) &&
+ (region->flag & RGN_FLAG_TOO_SMALL) &&
+ !(region->flag & RGN_FLAG_HIDDEN);
+
+ if ((region->visible || ignore_visibility) && region->do_draw && region->type &&
+ region->type->layout) {
+ CTX_wm_region_set(C, region);
+ ED_region_do_layout(C, region);
CTX_wm_region_set(C, NULL);
}
}
@@ -605,13 +611,13 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
}
/* Then do actual drawing of regions. */
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->visible && ar->do_draw) {
- CTX_wm_region_set(C, ar);
- bool use_viewport = wm_region_use_viewport(sa, ar);
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->visible && region->do_draw) {
+ CTX_wm_region_set(C, region);
+ bool use_viewport = wm_region_use_viewport(sa, region);
- if (stereo && wm_draw_region_stereo_set(bmain, sa, ar, STEREO_LEFT_ID)) {
- wm_draw_region_buffer_create(ar, true, use_viewport);
+ if (stereo && wm_draw_region_stereo_set(bmain, sa, region, STEREO_LEFT_ID)) {
+ wm_draw_region_buffer_create(region, true, use_viewport);
for (int view = 0; view < 2; view++) {
eStereoViews sview;
@@ -620,22 +626,22 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
}
else {
sview = STEREO_RIGHT_ID;
- wm_draw_region_stereo_set(bmain, sa, ar, sview);
+ wm_draw_region_stereo_set(bmain, sa, region, sview);
}
- wm_draw_region_bind(ar, view);
- ED_region_do_draw(C, ar);
- wm_draw_region_unbind(ar, view);
+ wm_draw_region_bind(region, view);
+ ED_region_do_draw(C, region);
+ wm_draw_region_unbind(region, view);
}
}
else {
- wm_draw_region_buffer_create(ar, false, use_viewport);
- wm_draw_region_bind(ar, 0);
- ED_region_do_draw(C, ar);
- wm_draw_region_unbind(ar, 0);
+ wm_draw_region_buffer_create(region, false, use_viewport);
+ wm_draw_region_bind(region, 0);
+ ED_region_do_draw(C, region);
+ wm_draw_region_unbind(region, 0);
}
- ar->do_draw = false;
+ region->do_draw = false;
CTX_wm_region_set(C, NULL);
}
}
@@ -645,25 +651,25 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
}
/* Draw menus into their own framebuffer. */
- for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->visible) {
- CTX_wm_menu_set(C, ar);
+ for (ARegion *region = screen->regionbase.first; region; region = region->next) {
+ if (region->visible) {
+ CTX_wm_menu_set(C, region);
- if (ar->type && ar->type->layout) {
+ if (region->type && region->type->layout) {
/* UI code reads the OpenGL state, but we have to refresh
* the UI layout beforehand in case the menu size changes. */
- wmViewport(&ar->winrct);
- ar->type->layout(C, ar);
+ wmViewport(&region->winrct);
+ region->type->layout(C, region);
}
- wm_draw_region_buffer_create(ar, false, false);
- wm_draw_region_bind(ar, 0);
+ wm_draw_region_buffer_create(region, false, false);
+ wm_draw_region_bind(region, 0);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
- ED_region_do_draw(C, ar);
- wm_draw_region_unbind(ar, 0);
+ ED_region_do_draw(C, region);
+ wm_draw_region_unbind(region, 0);
- ar->do_draw = false;
+ region->do_draw = false;
CTX_wm_menu_set(C, NULL);
}
}
@@ -688,20 +694,20 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
/* Blit non-overlapping area regions. */
ED_screen_areas_iter(win, screen, sa)
{
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->visible && ar->overlap == false) {
- if (view == -1 && ar->draw_buffer && ar->draw_buffer->stereo) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->visible && region->overlap == false) {
+ if (view == -1 && region->draw_buffer && region->draw_buffer->stereo) {
/* Stereo drawing from textures. */
if (win->stereo3d_format->display_mode == S3D_DISPLAY_ANAGLYPH) {
- wm_stereo3d_draw_anaglyph(win, ar);
+ wm_stereo3d_draw_anaglyph(win, region);
}
else {
- wm_stereo3d_draw_interlace(win, ar);
+ wm_stereo3d_draw_interlace(win, region);
}
}
else {
/* Blit from offscreen buffer. */
- wm_draw_region_blit(ar, view);
+ wm_draw_region_blit(region, view);
}
}
}
@@ -711,13 +717,13 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
if (wm->paintcursors.first) {
ED_screen_areas_iter(win, screen, sa)
{
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->visible && ar == screen->active_region) {
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->visible && region == screen->active_region) {
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
/* make region ready for draw, scissor, pixelspace */
- wm_paintcursor_draw(C, sa, ar);
+ wm_paintcursor_draw(C, sa, region);
CTX_wm_region_set(C, NULL);
CTX_wm_area_set(C, NULL);
@@ -731,9 +737,9 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
/* Blend in overlapping area regions */
ED_screen_areas_iter(win, screen, sa)
{
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->visible && ar->overlap) {
- wm_draw_region_blend(ar, 0, true);
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->visible && region->overlap) {
+ wm_draw_region_blend(region, 0, true);
}
}
}
@@ -743,9 +749,9 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
wm_draw_callbacks(win);
/* Blend in floating regions (menus). */
- for (ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->visible) {
- wm_draw_region_blend(ar, 0, true);
+ for (ARegion *region = screen->regionbase.first; region; region = region->next) {
+ if (region->visible) {
+ wm_draw_region_blend(region, 0, true);
}
}
@@ -839,26 +845,26 @@ static bool wm_draw_update_test_window(Main *bmain, wmWindow *win)
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true);
bScreen *screen = WM_window_get_active_screen(win);
- ARegion *ar;
+ ARegion *region;
bool do_draw = false;
- for (ar = screen->regionbase.first; ar; ar = ar->next) {
- if (ar->do_draw_overlay) {
+ for (region = screen->regionbase.first; region; region = region->next) {
+ if (region->do_draw_overlay) {
screen->do_draw_paintcursor = true;
- ar->do_draw_overlay = false;
+ region->do_draw_overlay = false;
}
- if (ar->visible && ar->do_draw) {
+ if (region->visible && region->do_draw) {
do_draw = true;
}
}
ED_screen_areas_iter(win, screen, sa)
{
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- wm_region_test_gizmo_do_draw(ar, true);
- wm_region_test_render_do_draw(scene, depsgraph, sa, ar);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ wm_region_test_gizmo_do_draw(region, true);
+ wm_region_test_render_do_draw(scene, depsgraph, sa, region);
- if (ar->visible && ar->do_draw) {
+ if (region->visible && region->do_draw) {
do_draw = true;
}
}
@@ -895,8 +901,8 @@ static void wm_draw_update_clear_window(wmWindow *win)
ED_screen_areas_iter(win, screen, sa)
{
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- wm_region_test_gizmo_do_draw(ar, false);
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ wm_region_test_gizmo_do_draw(region, false);
}
}
@@ -905,7 +911,7 @@ static void wm_draw_update_clear_window(wmWindow *win)
screen->do_draw_drag = false;
}
-void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(ar))
+void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(region))
{
if (win) {
bScreen *screen = WM_window_get_active_screen(win);
@@ -959,27 +965,27 @@ void wm_draw_update(bContext *C)
}
}
-void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(ar))
+void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region))
{
bScreen *screen = WM_window_get_active_screen(win);
screen->do_draw = true;
}
-void WM_draw_region_free(ARegion *ar)
+void WM_draw_region_free(ARegion *region)
{
- wm_draw_region_buffer_free(ar);
- ar->visible = 0;
+ wm_draw_region_buffer_free(region);
+ region->visible = 0;
}
-void wm_draw_region_test(bContext *C, ScrArea *sa, ARegion *ar)
+void wm_draw_region_test(bContext *C, ScrArea *sa, ARegion *region)
{
/* Function for redraw timer benchmark. */
- bool use_viewport = wm_region_use_viewport(sa, ar);
- wm_draw_region_buffer_create(ar, false, use_viewport);
- wm_draw_region_bind(ar, 0);
- ED_region_do_draw(C, ar);
- wm_draw_region_unbind(ar, 0);
- ar->do_draw = false;
+ bool use_viewport = wm_region_use_viewport(sa, region);
+ wm_draw_region_buffer_create(region, false, use_viewport);
+ wm_draw_region_bind(region, 0);
+ ED_region_do_draw(C, region);
+ wm_draw_region_unbind(region, 0);
+ region->do_draw = false;
}
void WM_redraw_windows(bContext *C)
@@ -1005,20 +1011,20 @@ void WM_redraw_windows(bContext *C)
*
* \{ */
-void WM_draw_region_viewport_ensure(ARegion *ar, short space_type)
+void WM_draw_region_viewport_ensure(ARegion *region, short space_type)
{
- bool use_viewport = wm_region_use_viewport_by_type(space_type, ar->regiontype);
- wm_draw_region_buffer_create(ar, false, use_viewport);
+ bool use_viewport = wm_region_use_viewport_by_type(space_type, region->regiontype);
+ wm_draw_region_buffer_create(region, false, use_viewport);
}
-void WM_draw_region_viewport_bind(ARegion *ar)
+void WM_draw_region_viewport_bind(ARegion *region)
{
- wm_draw_region_bind(ar, 0);
+ wm_draw_region_bind(region, 0);
}
-void WM_draw_region_viewport_unbind(ARegion *ar)
+void WM_draw_region_viewport_unbind(ARegion *region)
{
- wm_draw_region_unbind(ar, 0);
+ wm_draw_region_unbind(region, 0);
}
/** \} */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 6247cc5d5ea..3a7383bf38d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -507,7 +507,7 @@ void wm_event_do_notifiers(bContext *C)
/* pass */
}
else {
- ARegion *ar;
+ ARegion *region;
/* XXX context in notifiers? */
CTX_wm_window_set(C, win);
@@ -520,15 +520,15 @@ void wm_event_do_notifiers(bContext *C)
# endif
ED_screen_do_listen(C, note);
- for (ar = screen->regionbase.first; ar; ar = ar->next) {
- ED_region_do_listen(win, NULL, ar, note, scene);
+ for (region = screen->regionbase.first; region; region = region->next) {
+ ED_region_do_listen(win, NULL, region, note, scene);
}
ED_screen_areas_iter(win, screen, sa)
{
ED_area_do_listen(win, sa, note, scene);
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- ED_region_do_listen(win, sa, ar, note, scene);
+ for (region = sa->regionbase.first; region; region = region->next) {
+ ED_region_do_listen(win, sa, region, note, scene);
}
}
}
@@ -644,13 +644,13 @@ static int wm_handler_ui_call(bContext *C,
static void wm_handler_ui_cancel(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (!ar) {
+ if (!region) {
return;
}
- LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &ar->handlers) {
+ LISTBASE_FOREACH_MUTABLE (wmEventHandler *, handler_base, &region->handlers) {
if (handler_base->type == WM_HANDLER_TYPE_UI) {
wmEventHandler_UI *handler = (wmEventHandler_UI *)handler_base;
BLI_assert(handler->handle_fn != NULL);
@@ -824,9 +824,9 @@ void WM_operator_region_active_win_set(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if (sa) {
- ARegion *ar = CTX_wm_region(C);
- if (ar && ar->regiontype == RGN_TYPE_WINDOW) {
- sa->region_active_win = BLI_findindex(&sa->regionbase, ar);
+ ARegion *region = CTX_wm_region(C);
+ if (region && region->regiontype == RGN_TYPE_WINDOW) {
+ sa->region_active_win = BLI_findindex(&sa->regionbase, region);
}
}
}
@@ -1199,11 +1199,11 @@ static wmOperator *wm_operator_create(wmWindowManager *wm,
static void wm_region_mouse_co(bContext *C, wmEvent *event)
{
- ARegion *ar = CTX_wm_region(C);
- if (ar) {
+ ARegion *region = CTX_wm_region(C);
+ if (region) {
/* compatibility convention */
- event->mval[0] = event->x - ar->winrct.xmin;
- event->mval[1] = event->y - ar->winrct.ymin;
+ event->mval[0] = event->x - region->winrct.xmin;
+ event->mval[1] = event->y - region->winrct.ymin;
}
else {
/* these values are invalid (avoid odd behavior by relying on old mval values) */
@@ -1330,17 +1330,18 @@ static int wm_operator_invoke(bContext *C,
if (wrap) {
const rcti *winrect = NULL;
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ScrArea *sa = CTX_wm_area(C);
/* Wrap only in X for header. */
- if (ar && ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER)) {
+ if (region &&
+ ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER)) {
wrap = WM_CURSOR_WRAP_X;
}
- if (ar && ar->regiontype == RGN_TYPE_WINDOW &&
- BLI_rcti_isect_pt_v(&ar->winrct, &event->x)) {
- winrect = &ar->winrct;
+ if (region && region->regiontype == RGN_TYPE_WINDOW &&
+ BLI_rcti_isect_pt_v(&region->winrct, &event->x)) {
+ winrect = &region->winrct;
}
else if (sa && BLI_rcti_isect_pt_v(&sa->totrct, &event->x)) {
winrect = &sa->totrct;
@@ -1441,7 +1442,7 @@ static int wm_operator_call_internal(bContext *C,
/* forces operator to go to the region window/channels/preview, for header menus
* but we stay in the same region if we are already in one
*/
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ScrArea *area = CTX_wm_area(C);
int type = RGN_TYPE_WINDOW;
@@ -1463,7 +1464,7 @@ static int wm_operator_call_internal(bContext *C,
break;
}
- if (!(ar && ar->regiontype == type) && area) {
+ if (!(region && region->regiontype == type) && area) {
ARegion *ar1;
if (type == RGN_TYPE_WINDOW) {
ar1 = BKE_area_find_region_active_win(area);
@@ -1480,32 +1481,32 @@ static int wm_operator_call_internal(bContext *C,
retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
/* set region back */
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
return retval;
}
case WM_OP_EXEC_AREA:
case WM_OP_INVOKE_AREA: {
/* remove region from context */
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
CTX_wm_region_set(C, NULL);
retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
return retval;
}
case WM_OP_EXEC_SCREEN:
case WM_OP_INVOKE_SCREEN: {
/* remove region + area from context */
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
ScrArea *area = CTX_wm_area(C);
CTX_wm_region_set(C, NULL);
CTX_wm_area_set(C, NULL);
retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only, true);
CTX_wm_area_set(C, area);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
return retval;
}
@@ -1668,31 +1669,31 @@ static void wm_handler_op_context(bContext *C, wmEventHandler_Op *handler, const
}
}
else {
- ARegion *ar;
+ ARegion *region;
wmOperator *op = handler->op ? (handler->op->opm ? handler->op->opm : handler->op) : NULL;
CTX_wm_area_set(C, sa);
if (op && (op->flag & OP_IS_MODAL_CURSOR_REGION)) {
- ar = BKE_area_find_region_xy(sa, handler->context.region_type, event->x, event->y);
- if (ar) {
- handler->context.region = ar;
+ region = BKE_area_find_region_xy(sa, handler->context.region_type, event->x, event->y);
+ if (region) {
+ handler->context.region = region;
}
}
else {
- ar = NULL;
+ region = NULL;
}
- if (ar == NULL) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar == handler->context.region) {
+ if (region == NULL) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (region == handler->context.region) {
break;
}
}
}
/* XXX no warning print here, after full-area and back regions are remade */
- if (ar) {
- CTX_wm_region_set(C, ar);
+ if (region) {
+ CTX_wm_region_set(C, region);
}
}
}
@@ -2109,12 +2110,12 @@ static int wm_handler_operator_call(bContext *C,
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
if (gzgt != NULL) {
if ((gzgt->flag & WM_GIZMOGROUPTYPE_TOOL_INIT) != 0) {
- ARegion *ar = CTX_wm_region(C);
- if (ar != NULL) {
+ ARegion *region = CTX_wm_region(C);
+ if (region != NULL) {
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&gzgt->gzmap_params);
WM_gizmo_group_type_ensure_ptr_ex(gzgt, gzmap_type);
wmGizmoGroup *gzgroup = WM_gizmomaptype_group_init_runtime_with_region(
- gzmap_type, gzgt, ar);
+ gzmap_type, gzgt, region);
/* We can't rely on drawing to initialize gizmo's since disabling
* overlays/gizmos will prevent pre-drawing setup calls. (see T60905) */
WM_gizmogroup_ensure_init(C, gzgroup);
@@ -2928,12 +2929,12 @@ static bool wm_event_inside_rect(const wmEvent *event, const rcti *rect)
return false;
}
-static bool wm_event_inside_region(const wmEvent *event, const ARegion *ar)
+static bool wm_event_inside_region(const wmEvent *event, const ARegion *region)
{
if (wm_event_always_pass(event)) {
return true;
}
- return ED_region_contains_xy(ar, &event->x);
+ return ED_region_contains_xy(region, &event->x);
}
static ScrArea *area_event_inside(bContext *C, const int xy[2])
@@ -2956,25 +2957,25 @@ static ARegion *region_event_inside(bContext *C, const int xy[2])
{
bScreen *screen = CTX_wm_screen(C);
ScrArea *area = CTX_wm_area(C);
- ARegion *ar;
+ ARegion *region;
if (screen && area) {
- for (ar = area->regionbase.first; ar; ar = ar->next) {
- if (BLI_rcti_isect_pt_v(&ar->winrct, xy)) {
- return ar;
+ for (region = area->regionbase.first; region; region = region->next) {
+ if (BLI_rcti_isect_pt_v(&region->winrct, xy)) {
+ return region;
}
}
}
return NULL;
}
-static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *ar)
+static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *region)
{
- if (ar) {
+ if (region) {
for (; pc; pc = pc->next) {
if (pc->poll == NULL || pc->poll(C)) {
wmWindow *win = CTX_wm_window(C);
- WM_paint_cursor_tag_redraw(win, ar);
+ WM_paint_cursor_tag_redraw(win, region);
}
}
}
@@ -2987,14 +2988,14 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event)
wmWindowManager *wm = CTX_wm_manager(C);
if (wm->paintcursors.first) {
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
- if (ar) {
- wm_paintcursor_tag(C, wm->paintcursors.first, ar);
+ if (region) {
+ wm_paintcursor_tag(C, wm->paintcursors.first, region);
}
/* if previous position was not in current region, we have to set a temp new context */
- if (ar == NULL || !BLI_rcti_isect_pt_v(&ar->winrct, &event->prevx)) {
+ if (region == NULL || !BLI_rcti_isect_pt_v(&region->winrct, &event->prevx)) {
ScrArea *sa = CTX_wm_area(C);
CTX_wm_area_set(C, area_event_inside(C, &event->prevx));
@@ -3003,7 +3004,7 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event)
wm_paintcursor_tag(C, wm->paintcursors.first, CTX_wm_region(C));
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
}
}
}
@@ -3204,7 +3205,7 @@ void wm_event_do_handlers(bContext *C)
wm_tweakevent_test(C, event, action);
if ((action & WM_HANDLER_BREAK) == 0) {
- ARegion *ar;
+ ARegion *region;
/* Note: setting subwin active should be done here, after modal handlers have been done */
if (event->type == MOUSEMOVE) {
@@ -3239,10 +3240,10 @@ void wm_event_do_handlers(bContext *C)
CTX_wm_area_set(C, sa);
if ((action & WM_HANDLER_BREAK) == 0) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (wm_event_inside_region(event, ar)) {
+ for (region = sa->regionbase.first; region; region = region->next) {
+ if (wm_event_inside_region(event, region)) {
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
/* call even on non mouse events, since the */
wm_region_mouse_co(C, event);
@@ -3255,7 +3256,7 @@ void wm_event_do_handlers(bContext *C)
}
}
- action |= wm_handlers_do(C, event, &ar->handlers);
+ action |= wm_handlers_do(C, event, &region->handlers);
/* fileread case (python), [#29489] */
if (CTX_wm_window(C) == NULL) {
@@ -3568,9 +3569,9 @@ wmKeyMap *WM_event_get_keymap_from_toolsystem_fallback(wmWindowManager *wm,
if (tref_rt->gizmo_group[0] != '\0' && tref_rt->keymap_fallback[0] != '\n') {
wmGizmoMap *gzmap = NULL;
wmGizmoGroup *gzgroup = NULL;
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->gizmo_map != NULL) {
- gzmap = ar->gizmo_map;
+ for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ if (region->gizmo_map != NULL) {
+ gzmap = region->gizmo_map;
gzgroup = WM_gizmomap_group_find(gzmap, tref_rt->gizmo_group);
if (gzgroup != NULL) {
break;
@@ -3689,10 +3690,10 @@ static bool event_or_prev_in_rect(const wmEvent *event, const rcti *rect)
}
}
-static bool handler_region_v2d_mask_test(const ARegion *ar, const wmEvent *event)
+static bool handler_region_v2d_mask_test(const ARegion *region, const wmEvent *event)
{
- rcti rect = ar->v2d.mask;
- BLI_rcti_translate(&rect, ar->winrct.xmin, ar->winrct.ymin);
+ rcti rect = region->v2d.mask;
+ BLI_rcti_translate(&rect, region->winrct.xmin, region->winrct.ymin);
return event_or_prev_in_rect(event, &rect);
}
@@ -4879,15 +4880,15 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
cd->state_event = *win->eventstate;
/* Find active region and associated area. */
- ARegion *ar = screen->active_region;
- if (ar == NULL) {
+ ARegion *region = screen->active_region;
+ if (region == NULL) {
return;
}
ScrArea *sa = NULL;
ED_screen_areas_iter(win, screen, sa_iter)
{
- if (BLI_findindex(&sa_iter->regionbase, ar) != -1) {
+ if (BLI_findindex(&sa_iter->regionbase, region) != -1) {
sa = sa_iter;
break;
}
@@ -4900,7 +4901,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
if (ELEM(sa->spacetype, SPACE_STATUSBAR, SPACE_TOPBAR)) {
return;
}
- if (ELEM(ar->regiontype,
+ if (ELEM(region->regiontype,
RGN_TYPE_HEADER,
RGN_TYPE_TOOL_HEADER,
RGN_TYPE_FOOTER,
@@ -4909,14 +4910,15 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
return;
}
/* Fallback to window. */
- if (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (ELEM(region->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
}
/* Detect changes to the state. */
{
bToolRef *tref = NULL;
- if ((ar->regiontype == RGN_TYPE_WINDOW) && ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK)) {
+ if ((region->regiontype == RGN_TYPE_WINDOW) &&
+ ((1 << sa->spacetype) & WM_TOOLSYSTEM_SPACE_MASK)) {
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
WorkSpace *workspace = WM_window_get_active_workspace(win);
const bToolKey tkey = {
@@ -4925,7 +4927,7 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
};
tref = WM_toolsystem_ref_find(workspace, &tkey);
}
- wm_event_cursor_store(&cd->state, win->eventstate, sa->spacetype, ar->regiontype, tref);
+ wm_event_cursor_store(&cd->state, win->eventstate, sa->spacetype, region->regiontype, tref);
if (memcmp(&cd->state, &cd_prev.state, sizeof(cd->state)) == 0) {
return;
}
@@ -4958,10 +4960,10 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
CTX_wm_window_set(C, win);
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
ListBase *handlers[] = {
- &ar->handlers,
+ &region->handlers,
&sa->handlers,
&win->handlers,
};
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 160fbe95b25..1ce56ad2dfc 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1219,7 +1219,7 @@ static ImBuf *blend_file_thumb(const bContext *C,
/* screen if no camera found */
ScrArea *sa = NULL;
- ARegion *ar = NULL;
+ ARegion *region = NULL;
View3D *v3d = NULL;
/* In case we are given a valid thumbnail data, just generate image from it. */
@@ -1235,8 +1235,8 @@ static ImBuf *blend_file_thumb(const bContext *C,
if ((scene->camera == NULL) && (screen != NULL)) {
sa = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0);
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (region) {
v3d = sa->spacedata.first;
}
}
@@ -1268,7 +1268,7 @@ static ImBuf *blend_file_thumb(const bContext *C,
scene,
OB_SOLID,
v3d,
- ar,
+ region,
BLEN_THUMB_SIZE * 2,
BLEN_THUMB_SIZE * 2,
IB_rect,
@@ -2813,12 +2813,12 @@ static void wm_block_autorun_warning_enable_scripts(bContext *C,
/* Build the autorun warning dialog UI */
static uiBlock *block_create_autorun_warning(struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
void *UNUSED(arg1))
{
wmWindowManager *wm = CTX_wm_manager(C);
uiStyle *style = UI_style_get_dpi();
- uiBlock *block = UI_block_begin(C, ar, "autorun_warning_popup", UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, "autorun_warning_popup", UI_EMBOSS);
UI_block_flag_enable(
block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
@@ -3049,7 +3049,9 @@ static void wm_block_file_close_save_button(uiBlock *block, wmGenericCallback *p
static const char *close_file_dialog_name = "file_close_popup";
-static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegion *ar, void *arg1)
+static uiBlock *block_create__close_file_dialog(struct bContext *C,
+ struct ARegion *region,
+ void *arg1)
{
wmGenericCallback *post_action = (wmGenericCallback *)arg1;
Main *bmain = CTX_data_main(C);
@@ -3075,7 +3077,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
int title_width = MAX2(UI_fontstyle_string_width(fs, title), U.widget_unit * 22);
/* Create dialog */
- uiBlock *block = UI_block_begin(C, ar, close_file_dialog_name, UI_EMBOSS);
+ uiBlock *block = UI_block_begin(C, region, close_file_dialog_name, UI_EMBOSS);
style = UI_style_get_dpi();
UI_block_flag_enable(
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index bd9a6464332..ffb37544e49 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -51,7 +51,7 @@
#include "BIF_glutil.h"
/* context checked on having screen, window and area */
-wmGesture *WM_gesture_new(wmWindow *window, const ARegion *ar, const wmEvent *event, int type)
+wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent *event, int type)
{
wmGesture *gesture = MEM_callocN(sizeof(wmGesture), "new gesture");
@@ -59,7 +59,7 @@ wmGesture *WM_gesture_new(wmWindow *window, const ARegion *ar, const wmEvent *ev
gesture->type = type;
gesture->event_type = event->type;
- gesture->winrct = ar->winrct;
+ gesture->winrct = region->winrct;
gesture->user_data.use_free = true; /* Free if userdata is set. */
gesture->modal_state = GESTURE_MODAL_NOP;
diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c
index c78f0d7376d..82bc591e2a4 100644
--- a/source/blender/windowmanager/intern/wm_gesture_ops.c
+++ b/source/blender/windowmanager/intern/wm_gesture_ops.c
@@ -175,14 +175,14 @@ static bool gesture_box_apply(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
wmWindow *win = CTX_wm_window(C);
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
const bool wait_for_input = !ISTWEAK(event->type) && RNA_boolean_get(op->ptr, "wait_for_input");
if (wait_for_input) {
- op->customdata = WM_gesture_new(win, ar, event, WM_GESTURE_CROSS_RECT);
+ op->customdata = WM_gesture_new(win, region, event, WM_GESTURE_CROSS_RECT);
}
else {
- op->customdata = WM_gesture_new(win, ar, event, WM_GESTURE_RECT);
+ op->customdata = WM_gesture_new(win, region, event, WM_GESTURE_RECT);
}
{
@@ -538,10 +538,10 @@ static void gesture_tweak_modal(bContext *C, const wmEvent *event)
/* This isn't very nice but needed to redraw gizmos which are hidden while tweaking,
* See #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK for details. */
- ARegion *ar = CTX_wm_region(C);
- if ((ar != NULL) && (ar->gizmo_map != NULL)) {
- if (WM_gizmomap_tag_delay_refresh_for_tweak_check(ar->gizmo_map)) {
- ED_region_tag_redraw(ar);
+ ARegion *region = CTX_wm_region(C);
+ if ((region != NULL) && (region->gizmo_map != NULL)) {
+ if (WM_gizmomap_tag_delay_refresh_for_tweak_check(region->gizmo_map)) {
+ ED_region_tag_redraw(region);
}
}
}
@@ -553,12 +553,12 @@ void wm_tweakevent_test(bContext *C, const wmEvent *event, int action)
wmWindow *win = CTX_wm_window(C);
if (win->tweak == NULL) {
- const ARegion *ar = CTX_wm_region(C);
+ const ARegion *region = CTX_wm_region(C);
- if (ar) {
+ if (region) {
if (event->val == KM_PRESS) {
if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
- win->tweak = WM_gesture_new(win, ar, event, WM_GESTURE_TWEAK);
+ win->tweak = WM_gesture_new(win, region, event, WM_GESTURE_TWEAK);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 9d587ff9e9b..0aa146bbc83 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -1450,7 +1450,7 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C,
{
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmKeyMapItem *found = NULL;
/* look into multiple handler lists to find the item */
@@ -1471,40 +1471,40 @@ static wmKeyMapItem *wm_keymap_item_find_props(const bContext *C,
if (found == NULL) {
if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
if (sa) {
- if (!(ar && ar->regiontype == RGN_TYPE_WINDOW)) {
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (!(region && region->regiontype == RGN_TYPE_WINDOW)) {
+ region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
}
- if (ar) {
+ if (region) {
found = wm_keymap_item_find_handlers(
- C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ C, &region->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
}
}
}
else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
- if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS)) {
- ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+ if (!(region && region->regiontype == RGN_TYPE_CHANNELS)) {
+ region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
}
- if (ar) {
+ if (region) {
found = wm_keymap_item_find_handlers(
- C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ C, &region->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
}
}
else if (ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
- if (!(ar && ar->regiontype == RGN_TYPE_PREVIEW)) {
- ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+ if (!(region && region->regiontype == RGN_TYPE_PREVIEW)) {
+ region = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
}
- if (ar) {
+ if (region) {
found = wm_keymap_item_find_handlers(
- C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ C, &region->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
}
}
else {
- if (ar) {
+ if (region) {
found = wm_keymap_item_find_handlers(
- C, &ar->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
+ C, &region->handlers, opname, opcontext, properties, is_strict, params, r_keymap);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c
index e3fe8892515..7244b0a0d9a 100644
--- a/source/blender/windowmanager/intern/wm_operator_type.c
+++ b/source/blender/windowmanager/intern/wm_operator_type.c
@@ -444,12 +444,12 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (wrap) {
- ARegion *ar = CTX_wm_region(C);
- if (ar) {
- bounds[0] = ar->winrct.xmin;
- bounds[1] = ar->winrct.ymax;
- bounds[2] = ar->winrct.xmax;
- bounds[3] = ar->winrct.ymin;
+ ARegion *region = CTX_wm_region(C);
+ if (region) {
+ bounds[0] = region->winrct.xmin;
+ bounds[1] = region->winrct.ymax;
+ bounds[2] = region->winrct.xmax;
+ bounds[3] = region->winrct.ymin;
}
}
diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c
index 44afa708136..d0abdec1376 100644
--- a/source/blender/windowmanager/intern/wm_operator_utils.c
+++ b/source/blender/windowmanager/intern/wm_operator_utils.c
@@ -63,7 +63,7 @@ typedef struct ValueInteraction {
struct {
ScrArea *sa;
- ARegion *ar;
+ ARegion *region;
} context_vars;
} ValueInteraction;
@@ -75,7 +75,7 @@ static void interactive_value_init(bContext *C,
{
inter->context_vars.sa = CTX_wm_area(C);
- inter->context_vars.ar = CTX_wm_region(C);
+ inter->context_vars.region = CTX_wm_region(C);
inter->init.mval[0] = event->mval[0];
inter->init.mval[1] = event->mval[1];
@@ -111,7 +111,7 @@ static bool interactive_value_update(ValueInteraction *inter,
const int mval_curr = event->mval[mval_axis];
const int mval_init = inter->init.mval[mval_axis];
float value_delta = (inter->init.prop_value +
- (((float)(mval_curr - mval_init) / inter->context_vars.ar->winx) *
+ (((float)(mval_curr - mval_init) / inter->context_vars.region->winx) *
value_range)) *
value_scale;
if (event->ctrl) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 02ac94112ad..fc23cec3044 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1000,7 +1000,7 @@ struct EnumSearchMenu {
};
/** Generic enum search invoke popup. */
-static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg)
+static uiBlock *wm_enum_search_menu(bContext *C, ARegion *region, void *arg)
{
struct EnumSearchMenu *search_menu = arg;
wmWindow *win = CTX_wm_window(C);
@@ -1015,7 +1015,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg)
uiBlock *block;
uiBut *but;
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
@@ -1314,7 +1314,7 @@ static void wm_block_redo_cancel_cb(bContext *C, void *arg_op)
}
}
-static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
+static uiBlock *wm_block_create_redo(bContext *C, ARegion *region, void *arg_op)
{
wmOperator *op = arg_op;
uiBlock *block;
@@ -1322,7 +1322,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
uiStyle *style = UI_style_get_dpi();
int width = 15 * UI_UNIT_X;
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_flag_disable(block, UI_BLOCK_LOOP);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR);
@@ -1395,7 +1395,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
}
/* Dialogs are popups that require user verification (click OK) before exec */
-static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
+static uiBlock *wm_block_dialog_create(bContext *C, ARegion *region, void *userData)
{
wmOpPopUp *data = userData;
wmOperator *op = data->op;
@@ -1403,7 +1403,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
uiLayout *layout;
uiStyle *style = UI_style_get_dpi();
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_flag_disable(block, UI_BLOCK_LOOP);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR);
@@ -1439,12 +1439,12 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
UI_block_bounds_set_popup(
block, 6 * U.dpi_fac, (const int[2]){data->width / -2, data->height / 2});
- UI_block_active_only_flagged_buttons(C, ar, block);
+ UI_block_active_only_flagged_buttons(C, region, block);
return block;
}
-static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
+static uiBlock *wm_operator_ui_create(bContext *C, ARegion *region, void *userData)
{
wmOpPopUp *data = userData;
wmOperator *op = data->op;
@@ -1452,7 +1452,7 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
uiLayout *layout;
uiStyle *style = UI_style_get_dpi();
- block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
+ block = UI_block_begin(C, region, __func__, UI_EMBOSS);
UI_block_flag_disable(block, UI_BLOCK_LOOP);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_MOVEMOUSE_QUIT);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_REGULAR);
@@ -1693,14 +1693,14 @@ struct SearchPopupInit_Data {
int size[2];
};
-static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *userdata)
+static uiBlock *wm_block_search_menu(bContext *C, ARegion *region, void *userdata)
{
const struct SearchPopupInit_Data *init_data = userdata;
static char search[256] = "";
uiBlock *block;
uiBut *but;
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
@@ -3141,19 +3141,19 @@ static void redraw_timer_step(bContext *C,
struct Depsgraph *depsgraph,
wmWindow *win,
ScrArea *sa,
- ARegion *ar,
+ ARegion *region,
const int type,
const int cfra)
{
if (type == eRTDrawRegion) {
- if (ar) {
- wm_draw_region_test(C, sa, ar);
+ if (region) {
+ wm_draw_region_test(C, sa, region);
}
}
else if (type == eRTDrawRegionSwap) {
CTX_wm_menu_set(C, NULL);
- ED_region_tag_redraw(ar);
+ ED_region_tag_redraw(region);
wm_draw_update(C);
CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
@@ -3179,7 +3179,7 @@ static void redraw_timer_step(bContext *C,
CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, ar);
+ CTX_wm_region_set(C, region);
}
else if (type == eRTDrawWindowSwap) {
redraw_timer_window_swap(C);
@@ -3215,7 +3215,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = CTX_wm_region(C);
+ ARegion *region = CTX_wm_region(C);
wmWindowManager *wm = CTX_wm_manager(C);
double time_start, time_delta;
const int type = RNA_enum_get(op->ptr, "type");
@@ -3236,7 +3236,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
wm_window_make_drawable(wm, win);
for (a = 0; a < iter; a++) {
- redraw_timer_step(C, bmain, scene, depsgraph, win, sa, ar, type, cfra);
+ redraw_timer_step(C, bmain, scene, depsgraph, win, sa, region, type, cfra);
iter_steps += 1;
if (time_limit != 0.0) {
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c
index 7f6eebb95ab..97490f7cc3b 100644
--- a/source/blender/windowmanager/intern/wm_splash_screen.c
+++ b/source/blender/windowmanager/intern/wm_splash_screen.c
@@ -67,7 +67,7 @@ static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg
UI_popup_block_close(C, win, arg_block);
}
-static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused);
+static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *arg_unused);
static void wm_block_splash_refreshmenu(bContext *C, void *UNUSED(arg_block), void *UNUSED(arg))
{
@@ -255,13 +255,13 @@ static ImBuf *wm_block_splash_image(int r_unit_size[2])
#endif
}
-static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg))
+static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSED(arg))
{
uiBlock *block;
uiBut *but;
uiStyle *style = UI_style_get_dpi();
- block = UI_block_begin(C, ar, "splash", UI_EMBOSS);
+ block = UI_block_begin(C, region, "splash", UI_EMBOSS);
/* note on UI_BLOCK_NO_WIN_CLIP, the window size is not always synchronized
* with the OS when the splash shows, window clipping in this case gives
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 735d44a00b5..c5f8fb71b60 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -66,14 +66,14 @@ static eGPUInterlaceShader interlace_gpu_id_from_type(eStereo3dInterlaceType int
}
}
-void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar)
+void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *region)
{
bool swap = (win->stereo3d_format->flag & S3D_INTERLACE_SWAP) != 0;
enum eStereo3dInterlaceType interlace_type = win->stereo3d_format->interlace_type;
/* wmOrtho for the screen has this same offset */
- float halfx = GLA_PIXEL_OFS / ar->winx;
- float halfy = GLA_PIXEL_OFS / ar->winy;
+ float halfx = GLA_PIXEL_OFS / region->winx;
+ float halfy = GLA_PIXEL_OFS / region->winy;
GPUVertFormat *format = immVertexFormat();
uint texcoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -81,7 +81,7 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar)
/* leave GL_TEXTURE0 as the latest active texture */
for (int view = 1; view >= 0; view--) {
- GPUTexture *texture = wm_draw_region_texture(ar, view);
+ GPUTexture *texture = wm_draw_region_texture(region, view);
glActiveTexture(GL_TEXTURE0 + view);
glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(texture));
}
@@ -95,16 +95,16 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar)
immBegin(GPU_PRIM_TRI_FAN, 4);
immAttr2f(texcoord, halfx, halfy);
- immVertex2f(pos, ar->winrct.xmin, ar->winrct.ymin);
+ immVertex2f(pos, region->winrct.xmin, region->winrct.ymin);
immAttr2f(texcoord, 1.0f + halfx, halfy);
- immVertex2f(pos, ar->winrct.xmax + 1, ar->winrct.ymin);
+ immVertex2f(pos, region->winrct.xmax + 1, region->winrct.ymin);
immAttr2f(texcoord, 1.0f + halfx, 1.0f + halfy);
- immVertex2f(pos, ar->winrct.xmax + 1, ar->winrct.ymax + 1);
+ immVertex2f(pos, region->winrct.xmax + 1, region->winrct.ymax + 1);
immAttr2f(texcoord, halfx, 1.0f + halfy);
- immVertex2f(pos, ar->winrct.xmin, ar->winrct.ymax + 1);
+ immVertex2f(pos, region->winrct.xmin, region->winrct.ymax + 1);
immEnd();
immUnbindProgram();
@@ -115,7 +115,7 @@ void wm_stereo3d_draw_interlace(wmWindow *win, ARegion *ar)
}
}
-void wm_stereo3d_draw_anaglyph(wmWindow *win, ARegion *ar)
+void wm_stereo3d_draw_anaglyph(wmWindow *win, ARegion *region)
{
for (int view = 0; view < 2; view++) {
int bit = view + 1;
@@ -141,7 +141,7 @@ void wm_stereo3d_draw_anaglyph(wmWindow *win, ARegion *ar)
break;
}
- wm_draw_region_blend(ar, view, false);
+ wm_draw_region_blend(region, view, false);
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 5ef78723a2a..5483d79c075 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -118,9 +118,9 @@ static void wmOrtho2_offset(const float x, const float y, const float ofs)
}
/* Default pixel alignment for regions. */
-void wmOrtho2_region_pixelspace(const ARegion *ar)
+void wmOrtho2_region_pixelspace(const ARegion *region)
{
- wmOrtho2_offset(ar->winx, ar->winy, -0.01f);
+ wmOrtho2_offset(region->winx, region->winy, -0.01f);
}
void wmOrtho2_pixelspace(const float x, const float y)
diff --git a/source/blender/windowmanager/intern/wm_tooltip.c b/source/blender/windowmanager/intern/wm_tooltip.c
index b192ea94010..da2afda5e24 100644
--- a/source/blender/windowmanager/intern/wm_tooltip.c
+++ b/source/blender/windowmanager/intern/wm_tooltip.c
@@ -43,7 +43,7 @@ double WM_tooltip_time_closed(void)
}
void WM_tooltip_immediate_init(
- bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init)
+ bContext *C, wmWindow *win, ScrArea *sa, ARegion *region, wmTooltipInitFn init)
{
WM_tooltip_timer_clear(C, win);
@@ -52,13 +52,13 @@ void WM_tooltip_immediate_init(
screen->tool_tip = MEM_callocN(sizeof(*screen->tool_tip), __func__);
}
screen->tool_tip->area_from = sa;
- screen->tool_tip->region_from = ar;
+ screen->tool_tip->region_from = region;
screen->tool_tip->init = init;
WM_tooltip_init(C, win);
}
void WM_tooltip_timer_init_ex(
- bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init, double delay)
+ bContext *C, wmWindow *win, ScrArea *sa, ARegion *region, wmTooltipInitFn init, double delay)
{
WM_tooltip_timer_clear(C, win);
@@ -68,15 +68,15 @@ void WM_tooltip_timer_init_ex(
screen->tool_tip = MEM_callocN(sizeof(*screen->tool_tip), __func__);
}
screen->tool_tip->area_from = sa;
- screen->tool_tip->region_from = ar;
+ screen->tool_tip->region_from = region;
screen->tool_tip->timer = WM_event_add_timer(wm, win, TIMER, delay);
screen->tool_tip->init = init;
}
void WM_tooltip_timer_init(
- bContext *C, wmWindow *win, ScrArea *sa, ARegion *ar, wmTooltipInitFn init)
+ bContext *C, wmWindow *win, ScrArea *sa, ARegion *region, wmTooltipInitFn init)
{
- WM_tooltip_timer_init_ex(C, win, sa, ar, init, UI_TOOLTIP_DELAY);
+ WM_tooltip_timer_init_ex(C, win, sa, region, init, UI_TOOLTIP_DELAY);
}
void WM_tooltip_timer_clear(bContext *C, wmWindow *win)
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 1de8ec997a8..5bb9de87e82 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -82,8 +82,8 @@ void wm_autosave_location(char *filepath);
void WM_OT_splash(wmOperatorType *ot);
/* wm_stereo.c */
-void wm_stereo3d_draw_interlace(wmWindow *win, struct ARegion *ar);
-void wm_stereo3d_draw_anaglyph(wmWindow *win, struct ARegion *ar);
+void wm_stereo3d_draw_interlace(wmWindow *win, struct ARegion *region);
+void wm_stereo3d_draw_anaglyph(wmWindow *win, struct ARegion *region);
void wm_stereo3d_draw_sidebyside(wmWindow *win, int view);
void wm_stereo3d_draw_topbottom(wmWindow *win, int view);
diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h
index 0a07eb998cf..4a62558bf91 100644
--- a/source/blender/windowmanager/wm_draw.h
+++ b/source/blender/windowmanager/wm_draw.h
@@ -44,10 +44,10 @@ struct wmWindow;
/* wm_draw.c */
void wm_draw_update(struct bContext *C);
-void wm_draw_region_clear(struct wmWindow *win, struct ARegion *ar);
-void wm_draw_region_blend(struct ARegion *ar, int view, bool blend);
-void wm_draw_region_test(struct bContext *C, struct ScrArea *sa, struct ARegion *ar);
+void wm_draw_region_clear(struct wmWindow *win, struct ARegion *region);
+void wm_draw_region_blend(struct ARegion *region, int view, bool blend);
+void wm_draw_region_test(struct bContext *C, struct ScrArea *sa, struct ARegion *region);
-struct GPUTexture *wm_draw_region_texture(struct ARegion *ar, int view);
+struct GPUTexture *wm_draw_region_texture(struct ARegion *region, int view);
#endif /* __WM_DRAW_H__ */
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 97c5980e3e7..ffa5baae9f1 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -45,7 +45,7 @@ enum eWM_EventHandlerType {
WM_HANDLER_TYPE_KEYMAP,
};
-typedef bool (*EventHandlerPoll)(const ARegion *ar, const wmEvent *event);
+typedef bool (*EventHandlerPoll)(const ARegion *region, const wmEvent *event);
typedef struct wmEventHandler {
struct wmEventHandler *next, *prev;