|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "DNA_collection_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "DNA_vfont_types.h"#include "BLI_math.h"#include "BLI_utildefines.h"#include "BKE_context.h"#include "BKE_global.h"#include "BKE_main.h"#include "RNA_access.h"#include "RNA_define.h"#include "RNA_enum_types.h"#include "WM_api.h"#include "WM_toolsystem.h"#include "WM_types.h"#include "ED_gizmo_library.h"#include "ED_gizmo_utils.h"#include "ED_screen.h"#include "ED_space_api.h"#include "ED_transform.h"#include "ED_transform_snap_object_context.h"#include "ED_view3d.h"#include "UI_resources.h"#include "GPU_batch.h"#include "GPU_immediate.h"#include "GPU_matrix.h"#include "GPU_state.h"#include "view3d_intern.h"Go to the source code of this file.
Classes | |
| struct | InteractivePlaceData |
| struct | PlacementCursor |
Macros | |
| #define | FADE(v) max_ff(0.0f, (1.0f - square_f(((len_v3v3(v, center) / scale_fade) + resolution_div) * 2.0f))) |
Enumerations | |
Local Types | |
| enum | ePlace_PrimType { PLACE_PRIMITIVE_TYPE_CUBE = 1 , PLACE_PRIMITIVE_TYPE_CYLINDER = 2 , PLACE_PRIMITIVE_TYPE_CONE = 3 , PLACE_PRIMITIVE_TYPE_SPHERE_UV = 4 , PLACE_PRIMITIVE_TYPE_SPHERE_ICO = 5 } |
| enum | ePlace_Origin { PLACE_ORIGIN_BASE = 1 , PLACE_ORIGIN_CENTER = 2 } |
| enum | ePlace_Aspect { PLACE_ASPECT_FREE = 1 , PLACE_ASPECT_FIXED = 2 } |
| enum | ePlace_Depth { PLACE_DEPTH_SURFACE = 1 , PLACE_DEPTH_CURSOR_PLANE = 2 , PLACE_DEPTH_CURSOR_VIEW = 3 } |
| enum | ePlace_Orient { PLACE_ORIENT_SURFACE = 1 , PLACE_ORIENT_DEFAULT = 2 } |
| enum | ePlace_SnapTo { PLACE_SNAP_TO_GEOMETRY = 1 , PLACE_SNAP_TO_DEFAULT = 2 } |
Functions | |
Preview Plane Cursor | |
| static void | preview_plane_cursor_setup (wmGizmoGroup *gzgroup) |
| static void | preview_plane_cursor_visible_set (wmGizmoGroup *gzgroup, bool do_draw) |
| static void | cursor_plane_draw (bContext *C, int x, int y, void *customdata) |
| static void | preview_plane_cursor_free (void *customdata) |
Primitive Drawing (Cube, Cone, Cylinder...) | |
| static void | draw_line_loop (const float coords[][3], int coords_len, const float color[4]) |
| static void | draw_line_pairs (const float coords_a[][3], float coords_b[][3], int coords_len, const float color[4]) |
| static void | draw_line_bounds (const BoundBox *bounds, const float color[4]) |
| static bool | calc_bbox (struct InteractivePlaceData *ipd, BoundBox *bounds) |
| static void | draw_circle_in_quad (const float v1[3], const float v2[3], const float v3[3], const float v4[3], const int resolution, const float color[4]) |
Drawing Callbacks | |
| static void | draw_primitive_view_impl (const struct bContext *C, struct InteractivePlaceData *ipd, const float color[4], int flatten_axis) |
| static void | draw_primitive_view (const struct bContext *C, ARegion *UNUSED(region), void *arg) |
Calculate The Initial Placement Plane | |
Use by both the operator and placement cursor. | |
| static void | view3d_interactive_add_calc_plane (bContext *C, Scene *scene, View3D *v3d, ARegion *region, const float mval_fl[2], wmGizmo *snap_gizmo, const enum ePlace_SnapTo snap_to, const enum ePlace_Depth plane_depth, const enum ePlace_Orient plane_orient, const int plane_axis, const bool plane_axis_auto, float r_co_src[3], float r_matrix_orient[3][3]) |
Placement Gizmo Group | |
This is currently only used for snapping before the tool is initialized, we could show a placement plane here. | |
| static void | WIDGETGROUP_placement_setup (const bContext *UNUSED(C), wmGizmoGroup *gzgroup) |
| void | VIEW3D_GGT_placement (wmGizmoGroupType *gzgt) |
Placement Preview Plane | |
Preview the plane that will be used for placement. Note that we might want to split this into its own file, for now this is coupled with the 3D view placement gizmo. | |
| static void | gizmo_plane_update_cursor (const bContext *C, ARegion *region, const int mval[2], float r_co[3], float r_matrix_orient[3][3], int *r_plane_axis) |
| static void | gizmo_plane_draw_grid (const int resolution, const float scale, const float scale_fade, const float matrix[4][4], const int plane_axis, const float color[4]) |
Variables | |
| static const char * | view3d_gzgt_placement_id = "VIEW3D_GGT_placement" |
| static const float | eps_view_align = 1e-2f |
Internal Utilities | |
| #define | MVAL_MAX_PX_DIST 12.0f |
| static bool | view3d_win_to_3d_on_plane_maybe_fallback (const ARegion *region, const float plane[4], const float mval[2], const float *plane_fallback, float r_out[3]) |
| static int | dot_v3_array_find_max_index (const float dirs[][3], const int dirs_len, const float dir_test[3], bool is_signed) |
| static bool | mat3_align_axis_to_v3 (float mat[3][3], const int axis_align, const float v[3]) |
| static bool | idp_snap_point_from_gizmo_ex (wmGizmo *gz, const char *prop_id, float r_location[3]) |
| static bool | idp_snap_point_from_gizmo (wmGizmo *gz, float r_location[3]) |
| static bool | idp_snap_normal_from_gizmo (wmGizmo *gz, float r_normal[3]) |
| static bool | idp_poject_surface_normal (SnapObjectContext *snap_context, struct Depsgraph *depsgraph, const float mval_fl[2], const float mat_fallback[3][3], const float normal_fallback[3], float r_mat[3][3]) |
| static wmGizmoGroup * | idp_gizmogroup_from_region (ARegion *region) |
| static bool | idp_snap_calc_incremental (Scene *scene, View3D *v3d, ARegion *region, const float co_relative[3], float co[3]) |
| static void | idp_snap_gizmo_update_snap_elements (Scene *scene, enum ePlace_SnapTo snap_to, wmGizmo *gizmo) |
Add Object Modal Operator | |
| enum | { PLACE_MODAL_SNAP_ON , PLACE_MODAL_SNAP_OFF , PLACE_MODAL_FIXED_ASPECT_ON , PLACE_MODAL_FIXED_ASPECT_OFF , PLACE_MODAL_PIVOT_CENTER_ON , PLACE_MODAL_PIVOT_CENTER_OFF } |
| static void | view3d_interactive_add_begin (bContext *C, wmOperator *op, const wmEvent *event) |
| static int | view3d_interactive_add_invoke (bContext *C, wmOperator *op, const wmEvent *event) |
| static void | view3d_interactive_add_exit (bContext *C, wmOperator *op) |
| static void | view3d_interactive_add_cancel (bContext *C, wmOperator *op) |
| void | viewplace_modal_keymap (wmKeyConfig *keyconf) |
| static int | view3d_interactive_add_modal (bContext *C, wmOperator *op, const wmEvent *event) |
| static bool | view3d_interactive_add_poll (bContext *C) |
| void | VIEW3D_OT_interactive_add (struct wmOperatorType *ot) |
Operator to interactively place data.
Currently only adds meshes, but could add other kinds of data including library assets & non-mesh types.
Definition in file view3d_placement.c.
| #define FADE | ( | v | ) | max_ff(0.0f, (1.0f - square_f(((len_v3v3(v, center) / scale_fade) + resolution_div) * 2.0f))) |
| #define MVAL_MAX_PX_DIST 12.0f |
Definition at line 282 of file view3d_placement.c.
| anonymous enum |
| Enumerator | |
|---|---|
| PLACE_MODAL_SNAP_ON | |
| PLACE_MODAL_SNAP_OFF | |
| PLACE_MODAL_FIXED_ASPECT_ON | |
| PLACE_MODAL_FIXED_ASPECT_OFF | |
| PLACE_MODAL_PIVOT_CENTER_ON | |
| PLACE_MODAL_PIVOT_CENTER_OFF | |
Definition at line 1262 of file view3d_placement.c.
| enum ePlace_Aspect |
| Enumerator | |
|---|---|
| PLACE_ASPECT_FREE | |
| PLACE_ASPECT_FIXED | |
Definition at line 94 of file view3d_placement.c.
| enum ePlace_Depth |
| Enumerator | |
|---|---|
| PLACE_DEPTH_SURFACE | |
| PLACE_DEPTH_CURSOR_PLANE | |
| PLACE_DEPTH_CURSOR_VIEW | |
Definition at line 99 of file view3d_placement.c.
| enum ePlace_Orient |
| Enumerator | |
|---|---|
| PLACE_ORIENT_SURFACE | |
| PLACE_ORIENT_DEFAULT | |
Definition at line 105 of file view3d_placement.c.
| enum ePlace_Origin |
| Enumerator | |
|---|---|
| PLACE_ORIGIN_BASE | |
| PLACE_ORIGIN_CENTER | |
Definition at line 89 of file view3d_placement.c.
| enum ePlace_PrimType |
| Enumerator | |
|---|---|
| PLACE_PRIMITIVE_TYPE_CUBE | |
| PLACE_PRIMITIVE_TYPE_CYLINDER | |
| PLACE_PRIMITIVE_TYPE_CONE | |
| PLACE_PRIMITIVE_TYPE_SPHERE_UV | |
| PLACE_PRIMITIVE_TYPE_SPHERE_ICO | |
Definition at line 81 of file view3d_placement.c.
| enum ePlace_SnapTo |
| Enumerator | |
|---|---|
| PLACE_SNAP_TO_GEOMETRY | |
| PLACE_SNAP_TO_DEFAULT | |
Definition at line 110 of file view3d_placement.c.
|
static |
Definition at line 546 of file view3d_placement.c.
References add_v3_v3(), add_v3_v3v3(), ARRAY_SIZE, bounds(), InteractivePlaceData::co_dst, InteractivePlaceData::co_src, compare_v3v3(), copy_v3_v3(), copysignf, fabsf, invert_m3_m3(), InteractivePlaceData::is_centered, InteractivePlaceData::is_fixed_aspect, is_zero_v3(), InteractivePlaceData::matrix_orient, max_ff(), mul_m3_v3(), mul_v3_fl(), mul_v3_v3fl(), normalize_v3_length(), InteractivePlaceData::orient_axis, InteractivePlaceData::step, InteractivePlaceData::step_index, sub_v3_v3(), sub_v3_v3v3(), and zero_v3().
Referenced by draw_primitive_view_impl(), and view3d_interactive_add_modal().
|
static |
Definition at line 1975 of file view3d_placement.c.
References C, ceil_power_of_10(), center, copy_m4_m3(), copy_m4_m4(), copy_v3_v3(), CTX_wm_region(), PlacementCursor::do_draw, dot_v3v3(), ED_view3d_global_to_vector(), ED_view3d_pixel_size(), equals_m4m4(), fabsf, G, G_TRANSFORM_EDIT, G_TRANSFORM_OBJ, ARegion::gizmo_map, gizmo_plane_draw_grid(), gizmo_plane_update_cursor(), GPU_matrix_pop(), GPU_matrix_pop_projection(), GPU_matrix_projection_set, GPU_matrix_push(), GPU_matrix_push_projection(), GPU_matrix_set, PlacementCursor::gzgroup, RegionView3D::is_persp, PlacementCursor::matrix, max_ff(), PlacementCursor::mval_prev, negate_v3_v3(), RegionView3D::ofs, RegionView3D::persmat, PlacementCursor::persmat_prev, PlacementCursor::plane_axis, ARegion::regiondata, RegionView3D::rflag, RV3D_NAVIGATING, square_f(), wmGizmoGroup::type, RegionView3D::viewmat, RegionView3D::winmat, ARegion::winrct, WM_gizmomap_group_find_ptr(), wmViewport(), x, rcti::xmin, y, and rcti::ymin.
Referenced by preview_plane_cursor_setup().
|
static |
Return the index of dirs with the largest dot product compared to dir_test.
Definition at line 234 of file view3d_placement.c.
References dot_v3v3(), and fabsf.
Referenced by view3d_interactive_add_begin().
|
static |
Definition at line 674 of file view3d_placement.c.
References barycentric_weights_v2_quad(), cosf, draw_line_loop(), float(), M_PI, madd_v3_v3fl(), MEM_freeN, MEM_mallocN, quad, sinf, UNPACK4, v1, v2, w(), x, y, and zero_v3().
Referenced by draw_primitive_view_impl().
Definition at line 498 of file view3d_placement.c.
References ARRAY_SIZE, batch, bounds(), GPU_batch_create_ex(), GPU_batch_discard(), GPU_batch_draw(), GPU_BATCH_OWNS_VBO, GPU_batch_program_set_builtin(), GPU_batch_uniform_1f, GPU_batch_uniform_2fv, GPU_batch_uniform_4fv, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINES, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertbuf_attr_set(), GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), GPUBatch, immVertexFormat(), NULL, and pos.
Referenced by draw_primitive_view_impl().
Definition at line 436 of file view3d_placement.c.
References batch, GPU_batch_create_ex(), GPU_batch_discard(), GPU_batch_draw(), GPU_BATCH_OWNS_VBO, GPU_batch_program_set_builtin(), GPU_batch_uniform_1f, GPU_batch_uniform_2fv, GPU_batch_uniform_4fv, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINE_LOOP, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertbuf_attr_set(), GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), GPUBatch, immVertexFormat(), NULL, and pos.
Referenced by draw_circle_in_quad().
|
static |
Definition at line 465 of file view3d_placement.c.
References batch, GPU_batch_create_ex(), GPU_batch_discard(), GPU_batch_draw(), GPU_BATCH_OWNS_VBO, GPU_batch_program_set_builtin(), GPU_batch_uniform_1f, GPU_batch_uniform_2fv, GPU_batch_uniform_4fv, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_LINES, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_vertbuf_attr_set(), GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), GPUBatch, immVertexFormat(), NULL, and pos.
Referenced by draw_primitive_view_impl().
|
static |
Definition at line 816 of file view3d_placement.c.
References C, draw_primitive_view_impl(), GPU_DEPTH_LESS_EQUAL, GPU_DEPTH_NONE, GPU_depth_test(), GPU_depth_test_get(), InteractivePlaceData::is_degenerate_view_align, RegionView3D::is_persp, InteractivePlaceData::region, ARegion::regiondata, InteractivePlaceData::step, InteractivePlaceData::step_index, TH_GIZMO_PRIMARY, UI_GetThemeColor3fv(), InteractivePlaceData::v3d, and XRAY_ENABLED.
Referenced by view3d_interactive_add_begin().
|
static |
Definition at line 715 of file view3d_placement.c.
References ARRAY_SIZE, bounds(), C, calc_bbox(), center, copy_v3_v3(), cross_v3_v3v3(), InteractivePlaceData::degenerate_diagonal_display, dist_signed_to_plane_v3(), draw_circle_in_quad(), draw_line_bounds(), draw_line_pairs(), ELEM, madd_v3_v3fl(), InteractivePlaceData::matrix_orient, mid_v3_v3v3(), mid_v3_v3v3v3v3(), normalize_v3(), InteractivePlaceData::orient_axis, PLACE_PRIMITIVE_TYPE_CONE, PLACE_PRIMITIVE_TYPE_CUBE, PLACE_PRIMITIVE_TYPE_CYLINDER, PLACE_PRIMITIVE_TYPE_SPHERE_ICO, PLACE_PRIMITIVE_TYPE_SPHERE_UV, InteractivePlaceData::plane, plane_from_point_normal_v3(), InteractivePlaceData::primitive_type, InteractivePlaceData::region, ARegion::regiondata, InteractivePlaceData::step, UNPACK4, UNUSED_VARS, and RegionView3D::viewinv.
Referenced by draw_primitive_view().
|
static |
Definition at line 1852 of file view3d_placement.c.
References BLI_assert, center, FADE, float(), GPU_blend(), GPU_BLEND_ADDITIVE, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_PRIM_LINES, GPU_SHADER_3D_SMOOTH_COLOR, GPU_vertformat_attr_add(), immAttr4fv(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immVertex3fv(), immVertexFormat(), MEM_freeN, MEM_mallocN, mul_m4_v3(), UNPACK4, v1, v2, x, and y.
Referenced by cursor_plane_draw().
|
static |
Definition at line 1794 of file view3d_placement.c.
References blender::compositor::area(), BLI_assert, C, CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), CTX_wm_view3d(), ListBase::first, wmGizmoGroup::gizmos, idp_gizmogroup_from_region(), idp_snap_gizmo_update_snap_elements(), NULL, ot, ptr, InteractivePlaceData::region, RNA_boolean_get(), RNA_enum_get(), scene, InteractivePlaceData::snap_gizmo, InteractivePlaceData::snap_to, UNPACK2, InteractivePlaceData::v3d, view3d_interactive_add_calc_plane(), WM_operatortype_find(), and WM_toolsystem_ref_properties_ensure_from_operator.
Referenced by cursor_plane_draw().
|
static |
Definition at line 374 of file view3d_placement.c.
References ARegion::gizmo_map, NULL, view3d_gzgt_placement_id, and WM_gizmomap_group_find().
Referenced by gizmo_plane_update_cursor(), view3d_interactive_add_begin(), and view3d_interactive_add_exit().
|
static |
Calculate a 3x3 orientation matrix from the surface under the cursor.
Definition at line 307 of file view3d_placement.c.
References copy_m3_m4(), copy_m4_m3(), copy_v3_v3(), depsgraph, dot_v3v3(), ED_transform_snap_object_project_view3d_ex(), fabsf, is_zero_v3(), negate_v3(), normal, normalize_m3(), NULL, orthogonalize_m3(), SCE_SNAP_MODE_FACE, and SNAP_ALL.
Referenced by view3d_interactive_add_calc_plane().
|
static |
Calculate 3D view incremental (grid) snapping.
Definition at line 385 of file view3d_placement.c.
References add_v3_v3(), ED_view3d_grid_view_scale(), mul_v3_fl(), NULL, SCE_SNAP_ABS_GRID, SCE_SNAP_MODE_INCREMENT, scene, ToolSettings::snap_flag, ToolSettings::snap_mode, sub_v3_v3(), Scene::toolsettings, and UNLIKELY.
Referenced by view3d_interactive_add_calc_plane(), and view3d_interactive_add_modal().
|
static |
Definition at line 416 of file view3d_placement.c.
References PLACE_SNAP_TO_GEOMETRY, wmGizmo::ptr, RNA_enum_set(), SCE_SNAP_MODE_EDGE, SCE_SNAP_MODE_EDGE_MIDPOINT, SCE_SNAP_MODE_EDGE_PERPENDICULAR, SCE_SNAP_MODE_FACE, SCE_SNAP_MODE_VERTEX, scene, ToolSettings::snap_mode, and Scene::toolsettings.
Referenced by gizmo_plane_update_cursor().
Definition at line 299 of file view3d_placement.c.
References idp_snap_point_from_gizmo_ex().
Referenced by view3d_interactive_add_calc_plane().
Definition at line 294 of file view3d_placement.c.
References idp_snap_point_from_gizmo_ex().
Referenced by view3d_interactive_add_calc_plane().
|
static |
Definition at line 284 of file view3d_placement.c.
References wmGizmo::ptr, RNA_property_float_get_array(), RNA_struct_find_property(), wmGizmo::state, and WM_GIZMO_STATE_HIGHLIGHT.
Referenced by idp_snap_normal_from_gizmo(), and idp_snap_point_from_gizmo().
|
static |
Re-order mat so axis_align uses it's own axis which is closest to v.
Definition at line 257 of file view3d_placement.c.
References copy_m3_m3(), copy_v3_v3(), dot_v3v3(), fabsf, mod_i(), and v.
Referenced by view3d_interactive_add_calc_plane().
|
static |
Definition at line 2102 of file view3d_placement.c.
References G_MAIN, MEM_freeN, NULL, PlacementCursor::paintcursor, UNLIKELY, and WM_paint_cursor_end().
Referenced by preview_plane_cursor_setup().
|
static |
Definition at line 2114 of file view3d_placement.c.
References BLI_assert, cursor_plane_draw(), wmGizmoGroup::customdata, wmGizmoGroup::customdata_free, PlacementCursor::gzgroup, MEM_callocN, NULL, PlacementCursor::paintcursor, preview_plane_cursor_free(), preview_plane_cursor_visible_set(), RGN_TYPE_WINDOW, SPACE_VIEW3D, and WM_paint_cursor_activate().
Referenced by WIDGETGROUP_placement_setup().
|
static |
Definition at line 2127 of file view3d_placement.c.
References wmGizmoGroup::customdata, PlacementCursor::do_draw, and PlacementCursor::gzgroup.
Referenced by preview_plane_cursor_setup(), view3d_interactive_add_begin(), and view3d_interactive_add_exit().
| void VIEW3D_GGT_placement | ( | wmGizmoGroupType * | gzgt | ) |
Definition at line 1769 of file view3d_placement.c.
References ED_gizmo_poll_or_unlink_delayed_from_tool(), wmGizmoGroupType::flag, wmGizmoGroupType::gzmap_params, wmGizmoGroupType::idname, wmGizmoGroupType::name, wmGizmoGroupType::poll, wmGizmoMapType_Params::regionid, RGN_TYPE_WINDOW, wmGizmoGroupType::setup, SPACE_VIEW3D, wmGizmoMapType_Params::spaceid, view3d_gzgt_placement_id, WIDGETGROUP_placement_setup(), WM_GIZMOGROUPTYPE_3D, WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL, and WM_GIZMOGROUPTYPE_SCALE.
Referenced by view3d_widgets().
|
static |
Definition at line 1013 of file view3d_placement.c.
References add_v3_v3v3(), InteractivePlaceData::area, C, InteractivePlaceData::co_dst, InteractivePlaceData::co_src, copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), wmOperator::customdata, wmGizmoGroup::customdata, InteractivePlaceData::degenerate_axis, InteractivePlaceData::degenerate_diagonal, InteractivePlaceData::degenerate_diagonal_display, dot_v3_array_find_max_index(), dot_v3v3(), InteractivePlaceData::draw_handle_view, draw_primitive_view(), ED_gizmotypes_snap_3d_invert_snap_get(), ED_gizmotypes_snap_3d_update(), ED_region_draw_cb_activate(), ED_region_tag_redraw(), eps_view_align, fabsf, ListBase::first, G_MAIN, wmGizmoGroup::gizmos, bToolRef::idname, idp_gizmogroup_from_region(), InteractivePlaceData::is_centered, InteractivePlaceData::is_centered_init, InteractivePlaceData::is_degenerate_view_align, InteractivePlaceData::is_fixed_aspect, InteractivePlaceData::is_fixed_aspect_init, InteractivePlaceData::is_snap_invert, ISTWEAK, InteractivePlaceData::launch_event, InteractivePlaceData::matrix_orient, wmEvent::mval, negate_v3(), negate_v3_v3(), normalize_v3(), normalize_v3_v3(), NULL, InteractivePlaceData::orient_axis, PLACE_ASPECT_FIXED, PLACE_ORIGIN_CENTER, PLACE_PRIMITIVE_TYPE_CONE, PLACE_PRIMITIVE_TYPE_CUBE, PLACE_PRIMITIVE_TYPE_CYLINDER, PLACE_PRIMITIVE_TYPE_SPHERE_ICO, PLACE_PRIMITIVE_TYPE_SPHERE_UV, InteractivePlaceData::plane, plane_from_point_normal_v3(), preview_plane_cursor_visible_set(), InteractivePlaceData::primitive_type, wmOperator::ptr, InteractivePlaceData::region, REGION_DRAW_POST_VIEW, ARegion::regiondata, RNA_boolean_get(), RNA_enum_get(), RNA_property_enum_get(), RNA_property_is_set(), RNA_struct_find_property(), ScrArea::runtime, SCE_SNAP, InteractivePlaceData::scene, ToolSettings::snap_flag, InteractivePlaceData::snap_gizmo, InteractivePlaceData::snap_to, InteractivePlaceData::step, InteractivePlaceData::STEP_BASE, InteractivePlaceData::STEP_DEPTH, InteractivePlaceData::step_index, STREQ, sub_v3_v3v3(), ScrArea_Runtime::tool, Scene::toolsettings, ARegion::type, wmEvent::type, UNPACK2, InteractivePlaceData::use_snap, InteractivePlaceData::use_tool, InteractivePlaceData::v3d, view3d_interactive_add_calc_plane(), InteractivePlaceData::view_plane, RegionView3D::viewinv, and WM_userdef_event_type_from_keymap_type().
Referenced by view3d_interactive_add_invoke(), and view3d_interactive_add_modal().
|
static |
Definition at line 860 of file view3d_placement.c.
References C, View3D::clip_end, copy_m3_m3(), CTX_data_ensure_evaluated_depsgraph(), Scene::cursor, dot_v3v3(), ED_gizmotypes_snap_3d_context_ensure(), ED_gizmotypes_snap_3d_is_enabled(), ED_transform_calc_orientation_from_type(), ED_transform_snap_object_context_create_view3d(), ED_transform_snap_object_context_destroy(), ED_transform_snap_object_project_view3d(), ED_view3d_win_to_3d(), eps_view_align, fabsf, idp_poject_surface_normal(), idp_snap_calc_incremental(), idp_snap_normal_from_gizmo(), idp_snap_point_from_gizmo(), RegionView3D::is_persp, InteractivePlaceData::is_snap_found, View3DCursor::location, mat3_align_axis_to_v3(), negate_v3_v3(), NULL, RegionView3D::ofs, orthogonalize_m3(), PLACE_DEPTH_CURSOR_PLANE, PLACE_DEPTH_CURSOR_VIEW, PLACE_DEPTH_SURFACE, PLACE_ORIENT_SURFACE, PLACE_SNAP_TO_DEFAULT, InteractivePlaceData::plane, plane_from_point_normal_v3(), InteractivePlaceData::region, ARegion::regiondata, SCE_SNAP_MODE_FACE, scene, SNAP_ALL, InteractivePlaceData::snap_gizmo, InteractivePlaceData::snap_to, sub_v3_v3v3(), InteractivePlaceData::v3d, view3d_win_to_3d_on_plane_maybe_fallback(), and RegionView3D::viewinv.
Referenced by gizmo_plane_update_cursor(), and view3d_interactive_add_begin().
|
static |
Definition at line 1257 of file view3d_placement.c.
References C, and view3d_interactive_add_exit().
Referenced by VIEW3D_OT_interactive_add().
|
static |
Definition at line 1235 of file view3d_placement.c.
References C, wmOperator::customdata, wmGizmoGroup::customdata, InteractivePlaceData::draw_handle_view, ED_region_draw_cb_exit(), ED_region_tag_redraw(), idp_gizmogroup_from_region(), MEM_freeN, NULL, preview_plane_cursor_visible_set(), InteractivePlaceData::region, ARegion::type, and UNUSED_VARS.
Referenced by view3d_interactive_add_cancel(), and view3d_interactive_add_modal().
|
static |
Definition at line 1207 of file view3d_placement.c.
References InteractivePlaceData::area, C, CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), CTX_wm_view3d(), wmOperator::customdata, MEM_callocN, OPERATOR_RUNNING_MODAL, wmOperator::ptr, InteractivePlaceData::region, RNA_boolean_get(), InteractivePlaceData::scene, InteractivePlaceData::v3d, view3d_gzgt_placement_id, view3d_interactive_add_begin(), InteractivePlaceData::wait_for_input, WM_event_add_modal_handler(), and WM_gizmo_group_type_ensure().
Referenced by VIEW3D_OT_interactive_add().
|
static |
Definition at line 1296 of file view3d_placement.c.
References InteractivePlaceData::area, ATTR_FALLTHROUGH, BLI_assert, bounds(), C, calc_bbox(), closest_to_plane_normalized_v3(), InteractivePlaceData::co_dst, InteractivePlaceData::co_src, copy_m3_m3(), copy_v3_v3(), cross_v3_v3v3(), CTX_data_ensure_evaluated_depsgraph(), wmOperator::customdata, InteractivePlaceData::degenerate_diagonal, dot_v3v3(), ED_gizmotypes_snap_3d_data_get(), ED_gizmotypes_snap_3d_flag_clear(), ED_gizmotypes_snap_3d_flag_set(), ED_gizmotypes_snap_3d_update(), ED_region_tag_redraw(), ED_SNAPGIZMO_TOGGLE_ALWAYS_TRUE, ELEM, EVT_ESCKEY, EVT_MODAL_MAP, G_MAIN, idp_snap_calc_incremental(), InteractivePlaceData::is_centered, InteractivePlaceData::is_centered_init, InteractivePlaceData::is_degenerate_view_align, InteractivePlaceData::is_fixed_aspect, InteractivePlaceData::is_fixed_aspect_init, InteractivePlaceData::is_snap_found, InteractivePlaceData::is_snap_invert, KM_PRESS, KM_RELEASE, InteractivePlaceData::launch_event, LEFTMOUSE, len_v3v3(), mat3_to_eul(), InteractivePlaceData::matrix_orient, mid_v3_v3v3(), MOUSEMOVE, wmEvent::mval, negate_v3(), normalize_v3(), NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, InteractivePlaceData::orient_axis, ot, PLACE_MODAL_FIXED_ASPECT_OFF, PLACE_MODAL_FIXED_ASPECT_ON, PLACE_MODAL_PIVOT_CENTER_OFF, PLACE_MODAL_PIVOT_CENTER_ON, PLACE_MODAL_SNAP_OFF, PLACE_MODAL_SNAP_ON, PLACE_PRIMITIVE_TYPE_CONE, PLACE_PRIMITIVE_TYPE_CUBE, PLACE_PRIMITIVE_TYPE_CYLINDER, PLACE_PRIMITIVE_TYPE_SPHERE_ICO, PLACE_PRIMITIVE_TYPE_SPHERE_UV, PLACE_SNAP_TO_DEFAULT, InteractivePlaceData::plane, plane_from_point_normal_v3(), InteractivePlaceData::primitive_type, InteractivePlaceData::region, ARegion::regiondata, RIGHTMOUSE, RNA_float_set(), RNA_float_set_array(), ScrArea::runtime, SCE_SNAP, InteractivePlaceData::scene, InteractivePlaceData::snap_co, ToolSettings::snap_flag, InteractivePlaceData::snap_gizmo, InteractivePlaceData::snap_to, InteractivePlaceData::step, InteractivePlaceData::STEP_BASE, InteractivePlaceData::STEP_DEPTH, InteractivePlaceData::step_index, sub_v3_v3(), sub_v3_v3v3(), SWAP, swap_v3_v3(), ScrArea_Runtime::tool, Scene::toolsettings, wmEvent::type, UNPACK2, UNUSED_VARS, InteractivePlaceData::use_snap, InteractivePlaceData::use_tool, InteractivePlaceData::v3d, wmEvent::val, view3d_interactive_add_begin(), view3d_interactive_add_exit(), view3d_win_to_3d_on_plane_maybe_fallback(), InteractivePlaceData::view_plane, RegionView3D::viewinv, InteractivePlaceData::wait_for_input, WM_OP_EXEC_DEFAULT, WM_operator_name_call_ptr(), WM_operator_properties_create_ptr(), WM_operator_properties_free(), WM_operatortype_find(), and WM_toolsystem_ref_properties_init_for_keymap().
Referenced by VIEW3D_OT_interactive_add().
|
static |
Definition at line 1594 of file view3d_placement.c.
References C, CTX_data_mode_enum(), CTX_MODE_EDIT_MESH, CTX_MODE_OBJECT, and ELEM.
Referenced by VIEW3D_OT_interactive_add().
| void VIEW3D_OT_interactive_add | ( | struct wmOperatorType * | ot | ) |
Definition at line 1600 of file view3d_placement.c.
References wmOperatorType::cancel, wmOperatorType::description, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, NULL, ot, PLACE_ASPECT_FIXED, PLACE_ASPECT_FREE, PLACE_DEPTH_CURSOR_PLANE, PLACE_DEPTH_CURSOR_VIEW, PLACE_DEPTH_SURFACE, PLACE_ORIENT_DEFAULT, PLACE_ORIENT_SURFACE, PLACE_ORIGIN_BASE, PLACE_ORIGIN_CENTER, PLACE_PRIMITIVE_TYPE_CONE, PLACE_PRIMITIVE_TYPE_CUBE, PLACE_PRIMITIVE_TYPE_CYLINDER, PLACE_PRIMITIVE_TYPE_SPHERE_ICO, PLACE_PRIMITIVE_TYPE_SPHERE_UV, PLACE_SNAP_TO_DEFAULT, PLACE_SNAP_TO_GEOMETRY, wmOperatorType::poll, InteractivePlaceData::primitive_type, PROP_ENUM, PROP_HIDDEN, PROP_NONE, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property(), RNA_def_property_enum_default(), RNA_def_property_enum_items(), RNA_def_property_flag(), RNA_def_property_ui_text(), rna_enum_axis_xyz_items, wmOperatorType::srna, view3d_interactive_add_cancel(), view3d_interactive_add_invoke(), view3d_interactive_add_modal(), and view3d_interactive_add_poll().
Referenced by view3d_operatortypes().
|
static |
Convenience wrapper to avoid duplicating arguments.
Definition at line 216 of file view3d_placement.c.
References ED_view3d_win_to_3d_on_plane(), ED_view3d_win_to_3d_on_plane_with_fallback(), RegionView3D::is_persp, NULL, and ARegion::regiondata.
Referenced by view3d_interactive_add_calc_plane(), and view3d_interactive_add_modal().
| void viewplace_modal_keymap | ( | wmKeyConfig * | keyconf | ) |
Definition at line 1271 of file view3d_placement.c.
References wmKeyMap::modal_items, NULL, PLACE_MODAL_FIXED_ASPECT_OFF, PLACE_MODAL_FIXED_ASPECT_ON, PLACE_MODAL_PIVOT_CENTER_OFF, PLACE_MODAL_PIVOT_CENTER_ON, PLACE_MODAL_SNAP_OFF, PLACE_MODAL_SNAP_ON, WM_modalkeymap_assign(), WM_modalkeymap_ensure(), and WM_modalkeymap_find().
Referenced by view3d_keymap().
|
static |
Definition at line 1749 of file view3d_placement.c.
References wmGizmo::flag, NULL, preview_plane_cursor_setup(), WM_GIZMO_HIDDEN_KEYMAP, WM_gizmo_new_ptr(), WM_gizmo_set_color(), and WM_gizmotype_find().
Referenced by VIEW3D_GGT_placement().
Dot products below this will be considered view aligned. In this case we can't usefully project the mouse cursor onto the plane, so use a fall-back plane instead.
Definition at line 75 of file view3d_placement.c.
Referenced by view3d_interactive_add_begin(), and view3d_interactive_add_calc_plane().
|
static |
Definition at line 65 of file view3d_placement.c.
Referenced by idp_gizmogroup_from_region(), VIEW3D_GGT_placement(), and view3d_interactive_add_invoke().