Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "BLI_array.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_mball.h"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_tracking.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_transverts.h"
#include "view3d_intern.h"
Go to the source code of this file.
Returns the center position of a tracking marker visible on the viewport (useful to snap to).
Definition at line 719 of file view3d_snap.c.
References BKE_object_movieclip_get(), BKE_tracking_camera_get_reconstructed_interpolate(), BKE_tracking_get_camera_object_matrix(), BKE_tracking_object_get_tracks(), MovieTrackingTrack::bundle_pos, RenderData::cfra, copy_m4_m4(), ListBase::first, MovieTrackingTrack::flag, MovieTrackingObject::flag, INIT_MINMAX, invert_m4(), max, mid_v3_v3v3(), min, minmax_v3v3_v3(), mul_m4_m4m4(), mul_v3_m4v3(), MovieTrackingTrack::next, MovieTrackingObject::next, MovieTracking::objects, Object::obmat, pos, Scene::r, scene, TRACK_HAS_BUNDLE, TRACK_SELECTED, MovieClip::tracking, and TRACKING_OBJECT_CAMERA.
Referenced by snap_curs_to_sel_ex().
Calculates the bounding box corners (min and max) for obedit. The returned values are in global space.
Definition at line 1000 of file view3d_snap.c.
References Freestyle::a, add_v3_v3(), BKE_mball_minmax_ex(), copy_m3_m4(), copy_v3_v3(), Object::data, ED_transverts_check_obedit(), ED_transverts_create_from_obedit(), ED_transverts_free(), TransVert::flag, TransVert::loc, TransVert::maploc, minmax_v3v3_v3(), mul_m3_v3(), NULL, OB_MBALL, Object::obmat, SELECT, TM_ALL_JOINTS, TM_CALC_MAPLOC, TransVertStore::transverts, TransVertStore::transverts_tot, TX_VERT_USE_MAPLOC, and Object::type.
Referenced by viewselected_exec().
bool ED_view3d_snap_selected_to_location | ( | bContext * | C, |
const float | snap_target_global[3], | ||
const int | pivot_point | ||
) |
Definition at line 573 of file view3d_snap.c.
References C, and snap_selected_to_location().
Referenced by object_transform_to_mouse_exec().
|
static |
Calculates the center position of the active object in global space.
NOTE: this could be exported to be a generic function. see: calculateCenterActive
Definition at line 920 of file view3d_snap.c.
References C, CTX_data_active_object(), ED_object_calc_active_center(), and NULL.
Referenced by snap_curs_to_active_exec(), snap_selected_to_active_exec(), and snap_selected_to_location().
|
static |
Definition at line 929 of file view3d_snap.c.
References C, CTX_data_scene(), Scene::cursor, DEG_id_tag_update(), Scene::id, ID_RECALC_COPY_ON_WRITE, View3DCursor::location, NC_SPACE, ND_SPACE_VIEW3D, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, scene, snap_calc_active_center(), and WM_event_add_notifier().
Referenced by VIEW3D_OT_snap_cursor_to_active().
|
static |
Snaps the 3D cursor location to the origin and clears cursor rotation.
Definition at line 964 of file view3d_snap.c.
References BKE_scene_cursor_mat3_to_rot(), C, CTX_data_scene(), Scene::cursor, DEG_id_tag_update(), Scene::id, ID_RECALC_COPY_ON_WRITE, View3DCursor::location, NC_SPACE, ND_SPACE_VIEW3D, NULL, OPERATOR_FINISHED, scene, unit_m3(), WM_event_add_notifier(), and zero_v3().
Referenced by VIEW3D_OT_snap_cursor_to_center().
|
static |
Snaps the 3D cursor location to its nearest point on the grid.
Definition at line 674 of file view3d_snap.c.
References C, CTX_data_scene(), CTX_wm_region(), CTX_wm_view3d(), Scene::cursor, DEG_id_tag_update(), ED_view3d_grid_view_scale(), floorf, Scene::id, ID_RECALC_COPY_ON_WRITE, View3DCursor::location, NC_SPACE, ND_SPACE_VIEW3D, NULL, OPERATOR_FINISHED, scene, and WM_event_add_notifier().
Referenced by VIEW3D_OT_snap_cursor_to_grid().
Snaps the 3D cursor location to the median point of the selection.
Definition at line 773 of file view3d_snap.c.
References add_v3_v3(), BKE_editmesh_from_object(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BMEditMesh::bm, bPoseChannel::bone, BONE_SELECTED, bundle_midpoint(), C, bPose::chanbase, copy_m3_m4(), copy_v3_v3(), count, CTX_data_active_object(), CTX_data_edit_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_view3d(), Object::data, DEG_get_evaluated_object(), DEG_get_evaluated_view_layer(), DEG_get_original_object(), depsgraph, ED_transverts_check_obedit(), ED_transverts_create_from_obedit(), ED_transverts_free(), ListBase::first, Bone::flag, View3D::flag2, FOREACH_SELECTED_OBJECT_BEGIN, FOREACH_SELECTED_OBJECT_END, INIT_MINMAX, Bone::layer, bArmature::layer, TransVert::loc, max, MEM_freeN, mid_v3_v3v3(), min, minmax_v3v3_v3(), Object::mode, mul_m3_v3(), mul_m4_v3(), mul_v3_fl(), bPoseChannel::next, NULL, OB_CAMERA, OB_MESH, OB_MODE_POSE, Object::obmat, Object::pose, bPoseChannel::pose_head, scene, TM_ALL_JOINTS, TM_SKIP_HANDLES, BMesh::totvertsel, TransVertStore::transverts, TransVertStore::transverts_tot, Object::type, V3D_AROUND_CENTER_BOUNDS, V3D_SHOW_RECONSTRUCTION, and zero_v3().
Referenced by snap_curs_to_sel_exec(), and snap_selected_to_location().
|
static |
Definition at line 880 of file view3d_snap.c.
References C, CTX_data_scene(), Scene::cursor, DEG_id_tag_update(), Scene::id, ID_RECALC_COPY_ON_WRITE, View3DCursor::location, NC_SPACE, ND_SPACE_VIEW3D, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, scene, snap_curs_to_sel_ex(), Scene::toolsettings, ToolSettings::transform_pivot_point, and WM_event_add_notifier().
Referenced by VIEW3D_OT_snap_cursor_to_selected().
|
static |
Snaps every individual object center to its nearest point on the grid.
Definition at line 53 of file view3d_snap.c.
References Freestyle::a, add_v3_v3(), ANIM_get_keyingset_for_autokeying(), ANIM_KS_LOCATION_ID, BKE_armature_loc_pose_to_bone(), BKE_editmesh_from_object(), BKE_object_pose_array_get(), BKE_object_where_is_calc_ex(), BKE_pose_channel_find_name(), BKE_scene_graph_evaluated_ensure(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_array_append, BLI_array_declare, BLI_array_len, BMEditMesh::bm, bPoseChannel::bone, BONE_CONNECTED, BONE_SELECTED, C, bPose::chanbase, copy_m3_m4(), copy_v3_v3(), CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_region(), CTX_wm_view3d(), Object::data, DEG_get_evaluated_view_layer(), DEG_get_original_object(), DEG_id_tag_update(), depsgraph, ED_autokeyframe_object(), ED_autokeyframe_pchan(), ED_object_data_xform_container_create(), ED_object_data_xform_container_destroy(), ED_object_data_xform_container_item_ensure(), ED_object_data_xform_container_update_all(), ED_object_xform_skip_child_container_create(), ED_object_xform_skip_child_container_destroy(), ED_object_xform_skip_child_container_item_ensure_from_array(), ED_object_xform_skip_child_container_update_all(), ED_transverts_check_obedit(), ED_transverts_create_from_obedit(), ED_transverts_free(), ED_transverts_update_obedit(), ED_view3d_grid_view_scale(), ListBase::first, bPose::flag, Bone::flag, floorf, FOREACH_SELECTED_EDITABLE_OBJECT_BEGIN, FOREACH_SELECTED_EDITABLE_OBJECT_END, Object::id, ID_RECALC_GEOMETRY, ID_RECALC_TRANSFORM, Object::imat, invert_m3_m3(), invert_m4_m4(), Bone::layer, bArmature::layer, TransVert::loc, bPoseChannel::loc, Object::loc, MEM_freeN, MEM_malloc_arrayN, mul_m3_v3(), mul_m4_v3(), bPoseChannel::name, NC_OBJECT, ND_TRANSFORM, bPoseChannel::next, NULL, OB_LOCK_LOCX, OB_LOCK_LOCY, OB_LOCK_LOCZ, OB_MESH, OBEDIT_FROM_OBACT, Object::obmat, OBPOSE_FROM_OBACT, OPERATOR_FINISHED, Object::parent, Object::pose, POSE_DO_UNLOCK, POSE_LOCKED, bPoseChannel::pose_mat, bPoseChannel::protectflag, Object::protectflag, SCE_XFORM_DATA_ORIGIN, SCE_XFORM_SKIP_CHILDREN, scene, sub_v3_v3(), Scene::toolsettings, BMesh::totvertsel, ToolSettings::transform_flag, TransVertStore::transverts, TransVertStore::transverts_tot, Object::type, and WM_event_add_notifier().
Referenced by VIEW3D_OT_snap_selected_to_grid().
|
static |
Snaps each selected object to the location of the active selected object.
Definition at line 637 of file view3d_snap.c.
References BKE_report(), C, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::reports, RPT_ERROR, snap_calc_active_center(), and snap_selected_to_location().
Referenced by VIEW3D_OT_snap_selected_to_active().
|
static |
Definition at line 593 of file view3d_snap.c.
References C, CTX_data_scene(), Scene::cursor, View3DCursor::location, OPERATOR_CANCELLED, OPERATOR_FINISHED, wmOperator::ptr, RNA_boolean_get(), scene, snap_selected_to_location(), Scene::toolsettings, and ToolSettings::transform_pivot_point.
Referenced by VIEW3D_OT_snap_selected_to_cursor().
|
static |
Snaps the selection as a whole (use_offset=true) or each selected object to the given location.
snap_target_global | a location in global space to snap to (eg. 3D cursor or active object). |
use_offset | if the selected objects should maintain their relative offsets and be snapped by the selection pivot point (median, active), or if every object origin should be snapped to the given location. |
Definition at line 297 of file view3d_snap.c.
References Freestyle::a, add_v3_v3(), add_v3_v3v3(), ANIM_get_keyingset_for_autokeying(), ANIM_KS_LOCATION_ID, BKE_armature_bone_flag_test_recursive(), BKE_armature_loc_pose_to_bone(), BKE_editmesh_from_object(), BKE_object_flag_test_recursive(), BKE_object_get_parent_matrix(), BKE_object_pose_array_get(), BKE_scene_graph_evaluated_ensure(), BKE_view_layer_array_from_objects_in_edit_mode_unique_data, BLI_array_append, BLI_array_declare, BLI_array_len, BMEditMesh::bm, bPoseChannel::bone, BONE_CONNECTED, BONE_SELECTED, BONE_TRANSFORM, C, bPose::chanbase, copy_m3_m4(), copy_v3_v3(), CTX_data_active_object(), CTX_data_depsgraph_pointer(), CTX_data_edit_object(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_view3d(), Object::data, DEG_get_evaluated_object(), DEG_id_tag_update(), depsgraph, ED_autokeyframe_object(), ED_autokeyframe_pchan(), ED_object_data_xform_container_create(), ED_object_data_xform_container_destroy(), ED_object_data_xform_container_item_ensure(), ED_object_data_xform_container_update_all(), ED_object_xform_skip_child_container_create(), ED_object_xform_skip_child_container_destroy(), ED_object_xform_skip_child_container_item_ensure_from_array(), ED_object_xform_skip_child_container_update_all(), ED_transverts_check_obedit(), ED_transverts_create_from_obedit(), ED_transverts_free(), ED_transverts_update_obedit(), ListBase::first, bPose::flag, Bone::flag, FOREACH_SELECTED_EDITABLE_OBJECT_BEGIN, FOREACH_SELECTED_EDITABLE_OBJECT_END, Object::id, ID_RECALC_GEOMETRY, ID_RECALC_TRANSFORM, Object::imat, invert_m3_m3(), invert_m4_m4(), TransVert::loc, bPoseChannel::loc, Object::loc, MEM_freeN, mul_m3_m4m4(), mul_m3_v3(), mul_m4_v3(), mul_v3_m3v3(), mul_v3_m4v3(), NC_OBJECT, ND_TRANSFORM, bPoseChannel::next, NULL, OB_DONE, OB_LOCK_LOCX, OB_LOCK_LOCY, OB_LOCK_LOCZ, OB_MESH, Main::objects, Object::obmat, OBPOSE_FROM_OBACT, Bone::parent, Object::parent, Object::parentinv, PBONE_VISIBLE, Object::pose, POSE_DO_UNLOCK, POSE_LOCKED, bPoseChannel::pose_mat, bPoseChannel::protectflag, Object::protectflag, SCE_XFORM_DATA_ORIGIN, SCE_XFORM_SKIP_CHILDREN, scene, snap_calc_active_center(), snap_curs_to_sel_ex(), sub_v3_v3(), sub_v3_v3v3(), Scene::toolsettings, BMesh::totvertsel, ToolSettings::transform_flag, TransVertStore::transverts, TransVertStore::transverts_tot, Object::type, V3D_AROUND_ACTIVE, and WM_event_add_notifier().
Referenced by ED_view3d_snap_selected_to_location(), snap_selected_to_active_exec(), and snap_selected_to_cursor_exec().
void VIEW3D_OT_snap_cursor_to_active | ( | wmOperatorType * | ot | ) |
Definition at line 942 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and snap_curs_to_active_exec().
Referenced by view3d_operatortypes().
void VIEW3D_OT_snap_cursor_to_center | ( | wmOperatorType * | ot | ) |
Definition at line 979 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and snap_curs_to_center_exec().
Referenced by view3d_operatortypes().
void VIEW3D_OT_snap_cursor_to_grid | ( | wmOperatorType * | ot | ) |
Definition at line 694 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_region_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and snap_curs_to_grid_exec().
Referenced by view3d_operatortypes().
void VIEW3D_OT_snap_cursor_to_selected | ( | wmOperatorType * | ot | ) |
Definition at line 893 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and snap_curs_to_sel_exec().
Referenced by view3d_operatortypes().
void VIEW3D_OT_snap_selected_to_active | ( | wmOperatorType * | ot | ) |
Definition at line 652 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and snap_selected_to_active_exec().
Referenced by view3d_operatortypes().
void VIEW3D_OT_snap_selected_to_cursor | ( | wmOperatorType * | ot | ) |
Definition at line 608 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), snap_selected_to_cursor_exec(), and wmOperatorType::srna.
Referenced by view3d_operatortypes().
void VIEW3D_OT_snap_selected_to_grid | ( | wmOperatorType * | ot | ) |
Definition at line 267 of file view3d_snap.c.
References wmOperatorType::description, ED_operator_region_view3d_active(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and snap_sel_to_grid_exec().
Referenced by view3d_operatortypes().