| 
									
										
										
										
											2022-02-11 09:07:11 +11:00
										 |  |  | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 
					
						
							| 
									
										
										
										
											2019-10-29 00:45:05 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup editors | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define SNAP_MIN_DISTANCE 30
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* For enum. */ | 
					
						
							|  |  |  | #include "DNA_space_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool peelObjectsTransform(struct TransInfo *t, | 
					
						
							|  |  |  |                           const float mval[2], | 
					
						
							| 
									
										
										
										
											2022-01-07 11:38:08 +11:00
										 |  |  |                           bool use_peel_object, | 
					
						
							| 
									
										
										
										
											2019-10-29 00:45:05 +11:00
										 |  |  |                           /* return args */ | 
					
						
							|  |  |  |                           float r_loc[3], | 
					
						
							|  |  |  |                           float r_no[3], | 
					
						
							|  |  |  |                           float *r_thickness); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | short snapObjectsTransform(struct TransInfo *t, | 
					
						
							|  |  |  |                            const float mval[2], | 
					
						
							|  |  |  |                            float *dist_px, | 
					
						
							|  |  |  |                            /* return args */ | 
					
						
							|  |  |  |                            float r_loc[3], | 
					
						
							|  |  |  |                            float r_no[3]); | 
					
						
							|  |  |  | bool snapNodesTransform(struct TransInfo *t, | 
					
						
							|  |  |  |                         const int mval[2], | 
					
						
							|  |  |  |                         /* return args */ | 
					
						
							|  |  |  |                         float r_loc[2], | 
					
						
							|  |  |  |                         float *r_dist_px, | 
					
						
							|  |  |  |                         char *r_node_border); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool transformModeUseSnap(const TransInfo *t); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-29 20:13:55 +10:00
										 |  |  | bool transform_snap_increment_ex(const TransInfo *t, bool use_local_space, float *r_val); | 
					
						
							|  |  |  | bool transform_snap_increment(const TransInfo *t, float *val); | 
					
						
							| 
									
										
										
										
											2020-08-31 10:14:40 -03:00
										 |  |  | bool transform_snap_grid(TransInfo *t, float *val); | 
					
						
							| 
									
										
										
										
											2019-10-29 00:45:05 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | bool activeSnap(const TransInfo *t); | 
					
						
							| 
									
										
										
										
											2021-06-26 16:57:03 +10:00
										 |  |  | bool activeSnap_with_project(const TransInfo *t); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-29 00:45:05 +11:00
										 |  |  | bool validSnap(const TransInfo *t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void initSnapping(struct TransInfo *t, struct wmOperator *op); | 
					
						
							|  |  |  | void freeSnapping(struct TransInfo *t); | 
					
						
							|  |  |  | void applyProject(TransInfo *t); | 
					
						
							|  |  |  | void applyGridAbsolute(TransInfo *t); | 
					
						
							|  |  |  | void applySnapping(TransInfo *t, float *vec); | 
					
						
							|  |  |  | void resetSnapping(TransInfo *t); | 
					
						
							|  |  |  | eRedrawFlag handleSnapping(TransInfo *t, const struct wmEvent *event); | 
					
						
							|  |  |  | void drawSnapping(const struct bContext *C, TransInfo *t); | 
					
						
							|  |  |  | bool usingSnappingNormal(const TransInfo *t); | 
					
						
							|  |  |  | bool validSnappingNormal(const TransInfo *t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void getSnapPoint(const TransInfo *t, float vec[3]); | 
					
						
							|  |  |  | void addSnapPoint(TransInfo *t); | 
					
						
							|  |  |  | eRedrawFlag updateSelectedSnapPoint(TransInfo *t); | 
					
						
							|  |  |  | void removeSnapPoint(TransInfo *t); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-22 09:07:51 -03:00
										 |  |  | float transform_snap_distance_len_squared_fn(TransInfo *t, const float p1[3], const float p2[3]); | 
					
						
							| 
									
										
										
										
											2021-06-29 20:12:19 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* transform_snap_sequencer.c */ | 
					
						
							| 
									
										
										
										
											2021-12-09 00:55:11 +11:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-29 20:12:19 +02:00
										 |  |  | struct TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo *t); | 
					
						
							|  |  |  | void transform_snap_sequencer_data_free(struct TransSeqSnapData *data); | 
					
						
							| 
									
										
										
										
											2021-06-29 18:08:41 -03:00
										 |  |  | bool transform_snap_sequencer_calc(struct TransInfo *t); | 
					
						
							|  |  |  | void transform_snap_sequencer_apply_translate(TransInfo *t, float *vec); | 
					
						
							| 
									
										
										
										
											2021-08-19 09:52:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* transform_snap_animation.c */ | 
					
						
							| 
									
										
										
										
											2021-12-09 00:55:11 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * This function returns the snapping 'mode' for Animation Editors only. | 
					
						
							|  |  |  |  * We cannot use the standard snapping due to NLA-strip scaling complexities. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * TODO: these modifier checks should be accessible from the key-map. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-08-19 09:52:09 -03:00
										 |  |  | short getAnimEdit_SnapMode(TransInfo *t); | 
					
						
							| 
									
										
										
										
											2021-08-19 10:28:43 -03:00
										 |  |  | void snapFrameTransform(TransInfo *t, | 
					
						
							| 
									
										
										
										
											2022-01-07 11:38:08 +11:00
										 |  |  |                         eAnimEdit_AutoSnap autosnap, | 
					
						
							|  |  |  |                         float val_initial, | 
					
						
							|  |  |  |                         float val_final, | 
					
						
							| 
									
										
										
										
											2021-08-19 10:28:43 -03:00
										 |  |  |                         float *r_val_final); | 
					
						
							| 
									
										
										
										
											2021-12-09 00:55:11 +11:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * This function is used by Animation Editor specific transform functions to do | 
					
						
							|  |  |  |  * the Snap Keyframe to Nearest Frame/Marker | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-08-19 10:28:43 -03:00
										 |  |  | void transform_snap_anim_flush_data(TransInfo *t, | 
					
						
							|  |  |  |                                     TransData *td, | 
					
						
							| 
									
										
										
										
											2022-01-07 11:38:08 +11:00
										 |  |  |                                     eAnimEdit_AutoSnap autosnap, | 
					
						
							| 
									
										
										
										
											2021-08-19 10:28:43 -03:00
										 |  |  |                                     float *r_val_final); |