| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2016 Blender Foundation. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup edgizmolib | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 23:16:34 +02:00
										 |  |  | #ifndef __GIZMO_LIBRARY_INTERN_H__
 | 
					
						
							|  |  |  | #define __GIZMO_LIBRARY_INTERN_H__
 | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | /* distance around which gizmos respond to input (and get highlighted) */ | 
					
						
							|  |  |  | #define GIZMO_HOTSPOT 14.0f
 | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  |  * Data for common interactions. Used in gizmo_library_utils.c functions. | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | typedef struct GizmoCommonData { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float range_fac; /* factor for arrow min/max distance */ | 
					
						
							|  |  |  |   float offset; | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /* property range for constrained gizmos */ | 
					
						
							|  |  |  |   float range; | 
					
						
							|  |  |  |   /* min/max value for constrained gizmos */ | 
					
						
							|  |  |  |   float min, max; | 
					
						
							| 
									
										
										
										
											2018-12-03 13:01:04 +11:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   uint is_custom_range_set : 1; | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | } GizmoCommonData; | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | typedef struct GizmoInteraction { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float init_value; /* initial property value */ | 
					
						
							|  |  |  |   float init_mval[2]; | 
					
						
							|  |  |  |   float init_offset; | 
					
						
							|  |  |  |   float init_matrix_final[4][4]; | 
					
						
							|  |  |  |   float init_matrix_basis[4][4]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* offset of last handling step */ | 
					
						
							|  |  |  |   float prev_offset; | 
					
						
							|  |  |  |   /* Total offset added by precision tweaking.
 | 
					
						
							|  |  |  |    * Needed to allow toggling precision on/off without causing jumps */ | 
					
						
							|  |  |  |   float precision_offset; | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | } GizmoInteraction; | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | float gizmo_offset_from_value(GizmoCommonData *data, | 
					
						
							|  |  |  |                               const float value, | 
					
						
							|  |  |  |                               const bool constrained, | 
					
						
							|  |  |  |                               const bool inverted); | 
					
						
							|  |  |  | float gizmo_value_from_offset(GizmoCommonData *data, | 
					
						
							|  |  |  |                               GizmoInteraction *inter, | 
					
						
							|  |  |  |                               const float offset, | 
					
						
							|  |  |  |                               const bool constrained, | 
					
						
							|  |  |  |                               const bool inverted, | 
					
						
							|  |  |  |                               const bool use_precision); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void gizmo_property_data_update(struct wmGizmo *gz, | 
					
						
							|  |  |  |                                 GizmoCommonData *data, | 
					
						
							|  |  |  |                                 wmGizmoProperty *gz_prop, | 
					
						
							|  |  |  |                                 const bool constrained, | 
					
						
							|  |  |  |                                 const bool inverted); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void gizmo_property_value_reset(bContext *C, | 
					
						
							|  |  |  |                                 const struct wmGizmo *gz, | 
					
						
							|  |  |  |                                 GizmoInteraction *inter, | 
					
						
							|  |  |  |                                 wmGizmoProperty *gz_prop); | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* -------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4]); | 
					
						
							| 
									
										
										
										
											2016-10-07 16:34:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | bool gizmo_window_project_2d(bContext *C, | 
					
						
							|  |  |  |                              const struct wmGizmo *gz, | 
					
						
							|  |  |  |                              const float mval[2], | 
					
						
							|  |  |  |                              int axis, | 
					
						
							|  |  |  |                              bool use_offset, | 
					
						
							|  |  |  |                              float r_co[2]); | 
					
						
							| 
									
										
										
										
											2017-06-08 07:16:47 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | bool gizmo_window_project_3d( | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     bContext *C, const struct wmGizmo *gz, const float mval[2], bool use_offset, float r_co[3]); | 
					
						
							| 
									
										
										
										
											2018-05-09 22:37:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-08 07:16:47 +10:00
										 |  |  | /* -------------------------------------------------------------------- */ | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | /* Gizmo drawing */ | 
					
						
							| 
									
										
										
										
											2017-06-08 07:16:47 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-14 23:16:34 +02:00
										 |  |  | #include "gizmo_geometry.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-08 07:16:47 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, | 
					
						
							|  |  |  |                                 const bool select, | 
					
						
							|  |  |  |                                 const float color[4]); | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  | void wm_gizmo_vec_draw( | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type); | 
					
						
							| 
									
										
										
										
											2017-06-08 07:16:47 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | #endif /* __GIZMO_LIBRARY_INTERN_H__ */
 |