Blender  V2.93
BKE_curveprofile.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright (C) 2019 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
26 #include "DNA_curveprofile_types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct BlendDataReader;
33 struct BlendWriter;
34 struct CurveProfile;
35 struct CurveProfilePoint;
36 
38 
40 
41 void BKE_curveprofile_free_data(struct CurveProfile *profile);
42 
43 void BKE_curveprofile_free(struct CurveProfile *profile);
44 
45 void BKE_curveprofile_copy_data(struct CurveProfile *target, const struct CurveProfile *profile);
46 
47 struct CurveProfile *BKE_curveprofile_copy(const struct CurveProfile *profile);
48 
50  const bool handle_1,
51  const bool snap,
52  const float delta[2]);
53 
54 bool BKE_curveprofile_move_point(struct CurveProfile *profile,
55  struct CurveProfilePoint *point,
56  const bool snap,
57  const float delta[2]);
58 
59 bool BKE_curveprofile_remove_point(struct CurveProfile *profile, struct CurveProfilePoint *point);
60 
61 void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, const short flag);
62 
63 struct CurveProfilePoint *BKE_curveprofile_insert(struct CurveProfile *profile, float x, float y);
64 
65 void BKE_curveprofile_selected_handle_set(struct CurveProfile *profile, int type_1, int type_2);
66 
68 
70 
72 
74  int n_segments,
75  bool sample_straight_edges,
76  struct CurveProfilePoint *r_samples);
77 
78 void BKE_curveprofile_init(struct CurveProfile *profile, short segments_len);
79 
80 /* Called for a complete update of the widget after modifications */
81 enum {
84  PROF_UPDATE_CLIP = (1 << 1),
85 };
86 void BKE_curveprofile_update(struct CurveProfile *profile, const int update_flags);
87 
88 /* Need to find the total length of the curve to sample a portion of it */
90 
92  int n_segments,
93  struct CurveProfilePoint *r_samples);
94 
95 /* Length portion is the fraction of the total path length where we want the location */
97  float length_portion,
98  float *x_out,
99  float *y_out);
100 
101 void BKE_curveprofile_blend_write(struct BlendWriter *writer, const struct CurveProfile *profile);
103 
104 #ifdef __cplusplus
105 }
106 #endif
@ PROF_UPDATE_CLIP
@ PROF_UPDATE_REMOVE_DOUBLES
@ PROF_UPDATE_NONE
void BKE_curveprofile_selected_handle_set(struct CurveProfile *profile, int type_1, int type_2)
Definition: curveprofile.c:335
bool BKE_curveprofile_remove_point(struct CurveProfile *profile, struct CurveProfilePoint *point)
Definition: curveprofile.c:192
void BKE_curveprofile_reset_view(struct CurveProfile *profile)
Definition: curveprofile.c:441
void BKE_curveprofile_blend_read(struct BlendDataReader *reader, struct CurveProfile *profile)
void BKE_curveprofile_create_samples_even_spacing(struct CurveProfile *profile, int n_segments, struct CurveProfilePoint *r_samples)
void BKE_curveprofile_update(struct CurveProfile *profile, const int update_flags)
Definition: curveprofile.c:905
void BKE_curveprofile_copy_data(struct CurveProfile *target, const struct CurveProfile *profile)
void BKE_curveprofile_evaluate_length_portion(const struct CurveProfile *profile, float length_portion, float *x_out, float *y_out)
void BKE_curveprofile_init(struct CurveProfile *profile, short segments_len)
Definition: curveprofile.c:966
struct CurveProfilePoint * BKE_curveprofile_insert(struct CurveProfile *profile, float x, float y)
Definition: curveprofile.c:275
void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, const short flag)
Definition: curveprofile.c:229
bool BKE_curveprofile_move_point(struct CurveProfile *profile, struct CurveProfilePoint *point, const bool snap, const float delta[2])
Definition: curveprofile.c:141
bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, const bool handle_1, const bool snap, const float delta[2])
Definition: curveprofile.c:93
void BKE_curveprofile_create_samples(struct CurveProfile *profile, int n_segments, bool sample_straight_edges, struct CurveProfilePoint *r_samples)
Definition: curveprofile.c:689
void BKE_curveprofile_set_defaults(struct CurveProfile *profile)
Definition: curveprofile.c:864
struct CurveProfile * BKE_curveprofile_copy(const struct CurveProfile *profile)
void BKE_curveprofile_reset(struct CurveProfile *profile)
Definition: curveprofile.c:451
void BKE_curveprofile_blend_write(struct BlendWriter *writer, const struct CurveProfile *profile)
struct CurveProfile * BKE_curveprofile_add(eCurveProfilePresets preset)
Definition: curveprofile.c:887
float BKE_curveprofile_total_length(const struct CurveProfile *profile)
void BKE_curveprofile_free(struct CurveProfile *profile)
Definition: curveprofile.c:53
void BKE_curveprofile_free_data(struct CurveProfile *profile)
Definition: curveprofile.c:46
void BKE_curveprofile_reverse(struct CurveProfile *profile)
Definition: curveprofile.c:362
eCurveProfilePresets
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
vector snap(vector a, vector b)
Definition: node_math.h:72
struct CurveProfile * profile