Blender V5.3
DNA_curve_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_ID.h"
12#include "DNA_curve_enums.h"
13#include "DNA_defs.h"
14#include "DNA_listBase.h"
15#include "DNA_object_types.h"
16
17#include "BLI_map.hh"
18
19#include <optional>
20
21namespace blender {
22
23struct AnimData;
24struct Curves;
25struct CurveProfile;
26struct EditFont;
27struct GHash;
28struct Key;
29struct Material;
30struct Object;
31struct VFont;
32
33namespace draw {
34struct CurveBatchCache;
35}
36
37/* These two Lines with # tell `makesdna` this struct can be excluded. */
38#
39#
40struct BevPoint {
41 float vec[3], tilt, radius, weight, offset;
43 float sina, cosa;
45 float dir[3], tan[3], quat[4];
46 short dupe_tag;
47};
48
49/* These two Lines with # tell `makesdna` this struct can be excluded. */
50#
51#
52struct BevList {
53 struct BevList *next, *prev;
54 int nr, dupe_nr;
56 int poly;
57 int hole;
62 float *seglen;
64};
65
118
123#define BEZKEYTYPE(bezt) (eBezTriple_KeyframeType((bezt)->hide))
124#define BEZKEYTYPE_LVALUE(bezt) ((bezt)->hide)
125
129struct BPoint {
130 float vec[4];
132 float tilt;
134 float weight;
137 char _pad1[1];
138 short hide;
140 float radius;
141 char _pad[4];
142};
143
148struct Nurb {
150
151
152 struct Nurb *next = nullptr, *prev = nullptr;
155 short mat_nr = 0;
156 short hide = 0;
159 int pntsu = 0, pntsv = 0;
160 char _pad[4] = {};
162 short resolu = 0, resolv = 0;
163 short orderu = 0, orderv = 0;
165
166 float *knotsu = nullptr, *knotsv = nullptr;
167 BPoint *bp = nullptr;
168 BezTriple *bezt = nullptr;
169
171 short tilt_interp = 0;
172 short radius_interp = 0;
173
174 /* only used for dynamically generated Nurbs created from OB_FONT's */
175 int charidx = 0;
176};
177
178struct CharInfo {
179 float kern = 0;
180 short mat_nr = 0;
182 char _pad[1] = {};
183};
184
185struct TextBox {
186 float x = 0, y = 0, w = 0, h = 0;
187};
188
190
191/* These two Lines with # tell `makesdna` this struct can be excluded. */
192#
193#
194struct EditNurb {
196
197 /* base of nurbs' list (old Curve->editnurb) */
198 ListBaseT<Nurb> nurbs = {nullptr, nullptr};
199
200 /* index data for shape keys */
202
203 /* shape key being edited */
204 int shapenr = 0;
205
211};
212
213struct Curve {
214#ifdef __cplusplus
217 static constexpr ID_Type id_type = ID_CU_LEGACY;
218#endif
219
222 struct AnimData *adt = nullptr;
223
225 ListBaseT<Nurb> nurb = {nullptr, nullptr};
226
228 EditNurb *editnurb = nullptr;
229
230 struct Object *bevobj = nullptr, *taperobj = nullptr, *textoncurve = nullptr;
231 struct Key *key = nullptr;
232 struct Material **mat = nullptr;
233
234 struct CurveProfile *bevel_profile = nullptr;
235
236 float texspace_location[3] = {};
237 float texspace_size[3] = {1, 1, 1};
238
247
249 char _pad0[7] = {};
251 float twist_smooth = 0, smallcaps_scale = 0.75f;
252
253 int pathlen = 100;
254 short bevresol = 4, totcol = 0;
256 float offset = 0.0, extrude = 0, bevel_radius = 0;
257
258 /* default */
259 short resolu = 12, resolv = 12;
260 short resolu_ren = 0, resolv_ren = 0;
261
262 /* edit, index in nurb list */
263 int actnu = 0;
264 /* edit, index in active nurb (BPoint or BezTriple) */
265 int actvert = 0;
266
280 char _pad[1] = {};
281
282 /* font part */
283 float spacing = 1.0f, linedist = 1.0, shear = 0, fsize = 1.0, wordspace = 1.0, ulpos = 0,
284 ulheight = 0.05;
285 float xof = 0, yof = 0;
286 float linewidth = 0;
287
288 /* copy of EditFont vars (wchar_t aligned),
289 * warning! don't use in editmode (storage only) */
290 int pos = 0;
291 int selstart = 0, selend = 0;
292
293 /* text data */
298 int len_char32 = 0;
300 int len = 0;
301 char *str = nullptr;
302 struct EditFont *editfont = nullptr;
303
304 char family[64] = "";
305 struct VFont *vfont = nullptr;
306 struct VFont *vfontb = nullptr;
307 struct VFont *vfonti = nullptr;
308 struct VFont *vfontbi = nullptr;
309
310 struct TextBox *tb = nullptr;
311 int totbox = 0, actbox = 0;
312
313 struct CharInfo *strinfo = nullptr;
315 /* font part end */
316
318 float ctime = 0;
319 float bevfac1 = 0.0f, bevfac2 = 1.0f;
322
323 char _pad2[1] = {};
324
331
339 const struct Curves *curve_eval = nullptr;
340
342
343#ifdef __cplusplus
345 std::optional<int> material_index_max() const;
346#endif
347};
348
349/* **************** CURVE ********************* */
350
351/* checks if the given BezTriple is selected */
352#define BEZT_ISSEL_ANY(bezt) \
353 (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT))
354#define BEZT_ISSEL_ALL(bezt) \
355 (((bezt)->f2 & SELECT) && ((bezt)->f1 & SELECT) && ((bezt)->f3 & SELECT))
356#define BEZT_ISSEL_ALL_HIDDENHANDLES(v3d, bezt) \
357 ((((v3d) != NULL) && ((v3d)->overlay.handle_display == CURVE_HANDLE_NONE)) ? \
358 (bezt)->f2 & SELECT : \
359 BEZT_ISSEL_ALL(bezt))
360#define BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt) \
361 ((((v3d) != NULL) && ((v3d)->overlay.handle_display == CURVE_HANDLE_NONE)) ? \
362 (bezt)->f2 & SELECT : \
363 BEZT_ISSEL_ANY(bezt))
364
365#define BEZT_ISSEL_IDX(bezt, i) \
366 ((i == 0 && (bezt)->f1 & SELECT) || (i == 1 && (bezt)->f2 & SELECT) || \
367 (i == 2 && (bezt)->f3 & SELECT))
368
369#define BEZT_SEL_ALL(bezt) \
370 { \
371 (bezt)->f1 |= BEZT_FLAG_SELECT; \
372 (bezt)->f2 |= BEZT_FLAG_SELECT; \
373 (bezt)->f3 |= BEZT_FLAG_SELECT; \
374 } \
375 ((void)0)
376#define BEZT_DESEL_ALL(bezt) \
377 { \
378 (bezt)->f1 &= ~BEZT_FLAG_SELECT; \
379 (bezt)->f2 &= ~BEZT_FLAG_SELECT; \
380 (bezt)->f3 &= ~BEZT_FLAG_SELECT; \
381 } \
382 ((void)0)
383#define BEZT_SEL_INVERT(bezt) \
384 { \
385 (bezt)->f1 ^= BEZT_FLAG_SELECT; \
386 (bezt)->f2 ^= BEZT_FLAG_SELECT; \
387 (bezt)->f3 ^= BEZT_FLAG_SELECT; \
388 } \
389 ((void)0)
390
391#define BEZT_SEL_IDX(bezt, i) \
392 { \
393 switch (i) { \
394 case 0: \
395 (bezt)->f1 |= BEZT_FLAG_SELECT; \
396 break; \
397 case 1: \
398 (bezt)->f2 |= BEZT_FLAG_SELECT; \
399 break; \
400 case 2: \
401 (bezt)->f3 |= BEZT_FLAG_SELECT; \
402 break; \
403 default: \
404 break; \
405 } \
406 } \
407 ((void)0)
408
409#define BEZT_DESEL_IDX(bezt, i) \
410 { \
411 switch (i) { \
412 case 0: \
413 (bezt)->f1 &= ~BEZT_FLAG_SELECT; \
414 break; \
415 case 1: \
416 (bezt)->f2 &= ~BEZT_FLAG_SELECT; \
417 break; \
418 case 2: \
419 (bezt)->f3 &= ~BEZT_FLAG_SELECT; \
420 break; \
421 default: \
422 break; \
423 } \
424 } \
425 ((void)0)
426
427#define BEZT_IS_AUTOH(bezt) \
428 (ELEM((bezt)->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM((bezt)->h2, HD_AUTO, HD_AUTO_ANIM))
429
430} // namespace blender
ID and Library types, which are fundamental for SDNA.
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:104
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
BMesh Iterators.
@ CU_DEFORM_BOUNDS_OFF
@ CU_FILL_SOLVER_SWEEP_LINE
unsigned char uint8_t
Definition BKE_text.h:79
@ CU_BEVFAC_MAP_RESOLU
@ CU_FILL_RULE_EVEN_ODD
@ CU_TAPER_RADIUS_OVERRIDE
@ CU_TEXSPACE_FLAG_AUTO
Map< const void *, struct CVKeyIndex * > CVKeyIndexMap
@ CU_ALIGN_Y_TOP_BASELINE
struct BevList * prev
struct BevList * next
eBezTriple_Flag f2
eBezTriple_Easing easing
eBezTriple_Handle h2
eBezTriple_Flag f3
eBezTriple_Flag f1
eBezTriple_Auto_Type auto_handle_type
eBezTriple_Interpolation ipo
eBezTriple_Handle h1
draw::CurveBatchCache * batch_cache
struct VFont * vfonti
eCurveTwistMode twist_mode
struct VFont * vfont
ListBaseT< Nurb > nurb
eCurveAlignY align_y
eCurveTaperRadiusMode taper_radius_mode
EditNurb * editnurb
struct TextBox * tb
float texspace_location[3]
eCurveBevfacMapping bevfac2_mapping
struct EditFont * editfont
eCurveSpaceMode spacemode
CurveFillSolverType fill_solver
eCurveOverflow overflow
eCurveBevelMode bevel_mode
struct Object * textoncurve
struct AnimData * adt
struct CurveProfile * bevel_profile
struct Object * bevobj
struct Material ** mat
struct Object * taperobj
CurveFillRuleType fill_rule
eCurveBevfacMapping bevfac1_mapping
struct CharInfo curinfo
struct CharInfo * strinfo
struct Key * key
struct VFont * vfontb
const struct Curves * curve_eval
struct VFont * vfontbi
CVKeyIndexMap * keyindex
ListBaseT< Nurb > nurbs
BezTriple * bezt
struct Nurb * prev
eNurbKnotFlag flagu
eNurbKnotFlag flagv
struct Nurb * next