| 
									
										
										
										
											2019-11-20 16:12:32 -05: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. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2019 Blender Foundation. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-07 09:50:34 +02:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup bke | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-04 10:56:56 -05:00
										 |  |  | #include "DNA_curveprofile_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-02 15:07:49 +01:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-23 17:02:49 +02:00
										 |  |  | struct BlendDataReader; | 
					
						
							| 
									
										
										
										
											2020-09-30 11:51:13 +10:00
										 |  |  | struct BlendWriter; | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | struct CurveProfile; | 
					
						
							|  |  |  | struct CurveProfilePoint; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_set_defaults(struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-04 10:56:56 -05:00
										 |  |  | struct CurveProfile *BKE_curveprofile_add(eCurveProfilePresets preset); | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_free_data(struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_free(struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_copy_data(struct CurveProfile *target, const struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct CurveProfile *BKE_curveprofile_copy(const struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-24 11:50:01 -04:00
										 |  |  | bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, | 
					
						
							|  |  |  |                                   const bool handle_1, | 
					
						
							|  |  |  |                                   const bool snap, | 
					
						
							|  |  |  |                                   const float delta[2]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool BKE_curveprofile_move_point(struct CurveProfile *profile, | 
					
						
							|  |  |  |                                  struct CurveProfilePoint *point, | 
					
						
							|  |  |  |                                  const bool snap, | 
					
						
							|  |  |  |                                  const float delta[2]); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | bool BKE_curveprofile_remove_point(struct CurveProfile *profile, struct CurveProfilePoint *point); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, const short flag); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct CurveProfilePoint *BKE_curveprofile_insert(struct CurveProfile *profile, float x, float y); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_selected_handle_set(struct CurveProfile *profile, int type_1, int type_2); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_reverse(struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_reset(struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_create_samples(struct CurveProfile *profile, | 
					
						
							| 
									
										
										
										
											2020-09-04 20:59:13 +02:00
										 |  |  |                                      int n_segments, | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  |                                      bool sample_straight_edges, | 
					
						
							|  |  |  |                                      struct CurveProfilePoint *r_samples); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 13:02:21 +10:00
										 |  |  | void BKE_curveprofile_init(struct CurveProfile *profile, short segments_len); | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Called for a complete update of the widget after modifications */ | 
					
						
							| 
									
										
										
										
											2020-06-24 11:50:01 -04:00
										 |  |  | enum { | 
					
						
							|  |  |  |   PROF_UPDATE_NONE = 0, | 
					
						
							|  |  |  |   PROF_UPDATE_REMOVE_DOUBLES = (1 << 0), | 
					
						
							|  |  |  |   PROF_UPDATE_CLIP = (1 << 1), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | void BKE_curveprofile_update(struct CurveProfile *profile, const int update_flags); | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Need to find the total length of the curve to sample a portion of it */ | 
					
						
							|  |  |  | float BKE_curveprofile_total_length(const struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void BKE_curveprofile_create_samples_even_spacing(struct CurveProfile *profile, | 
					
						
							| 
									
										
										
										
											2020-09-04 20:59:13 +02:00
										 |  |  |                                                   int n_segments, | 
					
						
							| 
									
										
										
										
											2019-11-21 23:06:06 +11:00
										 |  |  |                                                   struct CurveProfilePoint *r_samples); | 
					
						
							| 
									
										
										
										
											2019-11-20 16:12:32 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Length portion is the fraction of the total path length where we want the location */ | 
					
						
							|  |  |  | void BKE_curveprofile_evaluate_length_portion(const struct CurveProfile *profile, | 
					
						
							|  |  |  |                                               float length_portion, | 
					
						
							|  |  |  |                                               float *x_out, | 
					
						
							|  |  |  |                                               float *y_out); | 
					
						
							| 
									
										
										
										
											2020-03-02 15:07:49 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-23 17:02:49 +02:00
										 |  |  | void BKE_curveprofile_blend_write(struct BlendWriter *writer, const struct CurveProfile *profile); | 
					
						
							|  |  |  | void BKE_curveprofile_blend_read(struct BlendDataReader *reader, struct CurveProfile *profile); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-02 15:07:49 +01:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 |