Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_snap.c
| Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) | ||||
| ot->poll = ED_operator_region_view3d_active; | ot->poll = ED_operator_region_view3d_active; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /* *************************************************** */ | /* *************************************************** */ | ||||
| /** Snaps the selection as a whole (use_offset=true) or each selected object to the given location. | /** | ||||
| * Snaps the selection as a whole (use_offset=true) or each selected object to the given location. | |||||
| * | * | ||||
| * \param snap_target_global: a location in global space to snap to | * \param snap_target_global: a location in global space to snap to | ||||
| * (eg. 3D cursor or active object). | * (eg. 3D cursor or active object). | ||||
| * \param use_offset: if the selected objects should maintain their relative offsets | * \param use_offset: if the selected objects should maintain their relative offsets | ||||
| * and be snapped by the selection pivot point (median, active), | * and be snapped by the selection pivot point (median, active), | ||||
| * or if every object origin should be snapped to the given location. | * or if every object origin should be snapped to the given location. | ||||
| */ | */ | ||||
| static int snap_selected_to_location(bContext *C, | static int snap_selected_to_location(bContext *C, | ||||
| ▲ Show 20 Lines • Show All 514 Lines • ▼ Show 20 Lines | void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) | ||||
| ot->poll = ED_operator_view3d_active; | ot->poll = ED_operator_view3d_active; | ||||
| /* flags */ | /* flags */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| } | } | ||||
| /* ********************************************** */ | /* ********************************************** */ | ||||
| /** Calculates the center position of the active object in global space. | /** | ||||
| * Calculates the center position of the active object in global space. | |||||
| * | * | ||||
| * Note: this could be exported to be a generic function. | * Note: this could be exported to be a generic function. | ||||
| * see: calculateCenterActive | * see: #calculateCenterActive | ||||
| */ | */ | ||||
| static bool snap_calc_active_center(bContext *C, const bool select_only, float r_center[3]) | static bool snap_calc_active_center(bContext *C, const bool select_only, float r_center[3]) | ||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| if (ob == NULL) { | if (ob == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return ED_object_calc_active_center(ob, select_only, r_center); | return ED_object_calc_active_center(ob, select_only, r_center); | ||||
| ▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines | |||||