Blender V5.0
editcurve_add.cc
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#include "DNA_curve_types.h"
10#include "DNA_object_types.h"
11#include "DNA_scene_types.h"
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_listbase.h"
16#include "BLI_math_matrix.h"
17#include "BLI_math_vector.h"
18
19#include "BLT_translation.hh"
20
21#include "BKE_context.hh"
22#include "BKE_curve.hh"
23#include "BKE_layer.hh"
24
25#include "DEG_depsgraph.hh"
26
27#include "RNA_access.hh"
28
29#include "WM_api.hh"
30#include "WM_types.hh"
31
32#include "ED_curve.hh"
33#include "ED_object.hh"
34#include "ED_screen.hh"
35#include "ED_view3d.hh"
36
37#include "curve_intern.hh"
38
39static const float nurbcircle[8][2] = {
40 {0.0, -1.0},
41 {-1.0, -1.0},
42 {-1.0, 0.0},
43 {-1.0, 1.0},
44 {0.0, 1.0},
45 {1.0, 1.0},
46 {1.0, 0.0},
47 {1.0, -1.0},
48};
49
50/************ add primitive, used by object/ module ****************/
51
52static const char *get_curve_defname(int type)
53{
54 int stype = type & CU_PRIMITIVE;
55
56 if ((type & CU_TYPE) == CU_BEZIER) {
57 switch (stype) {
58 case CU_PRIM_CURVE:
59 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "BézierCurve");
60 case CU_PRIM_CIRCLE:
61 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "BézierCircle");
62 case CU_PRIM_PATH:
63 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "CurvePath");
64 default:
66 }
67 }
68 else {
69 switch (stype) {
70 case CU_PRIM_CURVE:
71 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsCurve");
72 case CU_PRIM_CIRCLE:
73 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsCircle");
74 case CU_PRIM_PATH:
75 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsPath");
76 default:
78 }
79 }
80}
81
82static const char *get_surf_defname(int type)
83{
84 int stype = type & CU_PRIMITIVE;
85
86 switch (stype) {
87 case CU_PRIM_CURVE:
88 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCurve");
89 case CU_PRIM_CIRCLE:
90 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCircle");
91 case CU_PRIM_PATCH:
92 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfPatch");
93 case CU_PRIM_TUBE:
94 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCylinder");
95 case CU_PRIM_SPHERE:
96 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfSphere");
97 case CU_PRIM_DONUT:
98 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfTorus");
99 default:
101 }
102}
103
105 bContext *C, Object *obedit, float mat[4][4], int type, int newob)
106{
107 static int xzproj = 0; /* this function calls itself... */
108 ListBase *editnurb = object_editcurve_get(obedit);
110 Nurb *nu = nullptr;
111 BezTriple *bezt;
112 BPoint *bp;
113 Curve *cu = (Curve *)obedit->data;
114 float vec[3], zvec[3] = {0.0f, 0.0f, 1.0f};
115 float umat[4][4], viewmat[4][4];
116 float fac;
117 int a, b;
118 const float grid = 1.0f;
119 const int cutype = (type & CU_TYPE); /* poly, bezier, nurbs, etc */
120 const int stype = (type & CU_PRIMITIVE);
121
122 unit_m4(umat);
123 unit_m4(viewmat);
124
125 if (rv3d) {
126 copy_m4_m4(viewmat, rv3d->viewmat);
127 copy_v3_v3(zvec, rv3d->viewinv[2]);
128 }
129
130 BKE_nurbList_flag_set(editnurb, SELECT, false);
131
132 /* these types call this function to return a Nurb */
133 if (!ELEM(stype, CU_PRIM_TUBE, CU_PRIM_DONUT)) {
134 nu = MEM_callocN<Nurb>("addNurbprim");
135 nu->type = cutype;
136 nu->resolu = cu->resolu;
137 nu->resolv = cu->resolv;
138 }
139
140 switch (stype) {
141 case CU_PRIM_CURVE: /* curve */
142 nu->resolu = cu->resolu;
143 if (cutype == CU_BEZIER) {
144 nu->pntsu = 2;
145 nu->bezt = MEM_calloc_arrayN<BezTriple>(nu->pntsu, "addNurbprim1");
146 bezt = nu->bezt;
147 bezt->h1 = bezt->h2 = HD_ALIGN;
148 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
149 bezt->radius = 1.0;
150
151 bezt->vec[1][0] += -grid;
152 bezt->vec[0][0] += -1.5f * grid;
153 bezt->vec[0][1] += -0.5f * grid;
154 bezt->vec[2][0] += -0.5f * grid;
155 bezt->vec[2][1] += 0.5f * grid;
156 for (a = 0; a < 3; a++) {
157 mul_m4_v3(mat, bezt->vec[a]);
158 }
159
160 bezt++;
161 bezt->h1 = bezt->h2 = HD_ALIGN;
162 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
163 bezt->radius = bezt->weight = 1.0;
164
165 bezt->vec[0][0] = 0;
166 bezt->vec[0][1] = 0;
167 bezt->vec[1][0] = grid;
168 bezt->vec[1][1] = 0;
169 bezt->vec[2][0] = grid * 2;
170 bezt->vec[2][1] = 0;
171 for (a = 0; a < 3; a++) {
172 mul_m4_v3(mat, bezt->vec[a]);
173 }
174
176 }
177 else {
178
179 nu->pntsu = 4;
180 nu->pntsv = 1;
181 nu->orderu = 4;
182 nu->bp = MEM_calloc_arrayN<BPoint>(nu->pntsu, "addNurbprim3");
183
184 bp = nu->bp;
185 for (a = 0; a < 4; a++, bp++) {
186 bp->vec[3] = 1.0;
187 bp->f1 = SELECT;
188 bp->radius = bp->weight = 1.0;
189 }
190
191 bp = nu->bp;
192 bp->vec[0] += -1.5f * grid;
193 bp++;
194 bp->vec[0] += -grid;
195 bp->vec[1] += grid;
196 bp++;
197 bp->vec[0] += grid;
198 bp->vec[1] += grid;
199 bp++;
200 bp->vec[0] += 1.5f * grid;
201
202 bp = nu->bp;
203 for (a = 0; a < 4; a++, bp++) {
204 mul_m4_v3(mat, bp->vec);
205 }
206
207 if (cutype == CU_NURBS) {
208 nu->knotsu = nullptr; /* nurbs_knot_calc_u allocates */
210 }
211 }
212 break;
213 case CU_PRIM_PATH: /* 5 point path */
214 nu->pntsu = 5;
215 nu->pntsv = 1;
216 nu->orderu = 5;
217 nu->flagu = CU_NURB_ENDPOINT; /* endpoint */
218 nu->resolu = cu->resolu;
219 nu->bp = MEM_calloc_arrayN<BPoint>(nu->pntsu, "addNurbprim3");
220
221 bp = nu->bp;
222 for (a = 0; a < 5; a++, bp++) {
223 bp->vec[3] = 1.0;
224 bp->f1 = SELECT;
225 bp->radius = bp->weight = 1.0;
226 }
227
228 bp = nu->bp;
229 bp->vec[0] += -2.0f * grid;
230 bp++;
231 bp->vec[0] += -grid;
232 bp++;
233 bp++;
234 bp->vec[0] += grid;
235 bp++;
236 bp->vec[0] += 2.0f * grid;
237
238 bp = nu->bp;
239 for (a = 0; a < 5; a++, bp++) {
240 mul_m4_v3(mat, bp->vec);
241 }
242
243 if (cutype == CU_NURBS) {
244 nu->knotsu = nullptr; /* nurbs_knot_calc_u allocates */
246 }
247
248 break;
249 case CU_PRIM_CIRCLE: /* circle */
250 nu->resolu = cu->resolu;
251
252 if (cutype == CU_BEZIER) {
253 nu->pntsu = 4;
254 nu->bezt = MEM_calloc_arrayN<BezTriple>(nu->pntsu, "addNurbprim1");
255 nu->flagu = CU_NURB_CYCLIC;
256 bezt = nu->bezt;
257
258 bezt->h1 = bezt->h2 = HD_AUTO;
259 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
260 bezt->vec[1][0] += -grid;
261 for (a = 0; a < 3; a++) {
262 mul_m4_v3(mat, bezt->vec[a]);
263 }
264 bezt->radius = bezt->weight = 1.0;
265
266 bezt++;
267 bezt->h1 = bezt->h2 = HD_AUTO;
268 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
269 bezt->vec[1][1] += grid;
270 for (a = 0; a < 3; a++) {
271 mul_m4_v3(mat, bezt->vec[a]);
272 }
273 bezt->radius = bezt->weight = 1.0;
274
275 bezt++;
276 bezt->h1 = bezt->h2 = HD_AUTO;
277 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
278 bezt->vec[1][0] += grid;
279 for (a = 0; a < 3; a++) {
280 mul_m4_v3(mat, bezt->vec[a]);
281 }
282 bezt->radius = bezt->weight = 1.0;
283
284 bezt++;
285 bezt->h1 = bezt->h2 = HD_AUTO;
286 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
287 bezt->vec[1][1] += -grid;
288 for (a = 0; a < 3; a++) {
289 mul_m4_v3(mat, bezt->vec[a]);
290 }
291 bezt->radius = bezt->weight = 1.0;
292
294 }
295 else if (cutype == CU_NURBS) { /* nurb */
296 nu->pntsu = 8;
297 nu->pntsv = 1;
298 nu->orderu = 3;
299 nu->bp = MEM_calloc_arrayN<BPoint>(nu->pntsu, "addNurbprim6");
301 bp = nu->bp;
302
303 for (a = 0; a < 8; a++) {
304 bp->f1 = SELECT;
305 if (xzproj == 0) {
306 bp->vec[0] += nurbcircle[a][0] * grid;
307 bp->vec[1] += nurbcircle[a][1] * grid;
308 }
309 else {
310 bp->vec[0] += 0.25f * nurbcircle[a][0] * grid - 0.75f * grid;
311 bp->vec[2] += 0.25f * nurbcircle[a][1] * grid;
312 }
313 if (a & 1) {
314 bp->vec[3] = 0.5 * M_SQRT2;
315 }
316 else {
317 bp->vec[3] = 1.0;
318 }
319 mul_m4_v3(mat, bp->vec);
320 bp->radius = bp->weight = 1.0;
321
322 bp++;
323 }
324
326 }
327 break;
328 case CU_PRIM_PATCH: /* 4x4 patch */
329 if (cutype == CU_NURBS) { /* nurb */
330
331 nu->pntsu = 4;
332 nu->pntsv = 4;
333 nu->orderu = 4;
334 nu->orderv = 4;
335 nu->flag = CU_SMOOTH;
336 nu->bp = MEM_calloc_arrayN<BPoint>((4 * 4), "addNurbprim6");
337 nu->flagu = 0;
338 nu->flagv = 0;
339 bp = nu->bp;
340
341 for (a = 0; a < 4; a++) {
342 for (b = 0; b < 4; b++) {
343 bp->f1 = SELECT;
344 fac = float(a) - 1.5f;
345 bp->vec[0] += fac * grid;
346 fac = float(b) - 1.5f;
347 bp->vec[1] += fac * grid;
348 if (ELEM(a, 1, 2) && ELEM(b, 1, 2)) {
349 bp->vec[2] += grid;
350 }
351 mul_m4_v3(mat, bp->vec);
352 bp->vec[3] = 1.0;
353 bp++;
354 }
355 }
356
359 }
360 break;
361 case CU_PRIM_TUBE: /* Cylinder */
362 if (cutype == CU_NURBS) {
363 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
364 nu->resolu = cu->resolu;
365 nu->flag = CU_SMOOTH;
366 BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
367 vec[0] = vec[1] = 0.0;
368 vec[2] = -grid;
369
370 mul_mat3_m4_v3(mat, vec);
371
372 ed_editnurb_translate_flag(editnurb, SELECT, vec, CU_IS_2D(cu));
374 mul_v3_fl(vec, -2.0f);
375 ed_editnurb_translate_flag(editnurb, SELECT, vec, CU_IS_2D(cu));
376
377 BLI_remlink(editnurb, nu);
378
379 a = nu->pntsu * nu->pntsv;
380 bp = nu->bp;
381 while (a-- > 0) {
382 bp->f1 |= SELECT;
383 bp++;
384 }
385 }
386 break;
387 case CU_PRIM_SPHERE: /* sphere */
388 if (cutype == CU_NURBS) {
389 const float tmp_cent[3] = {0.0f, 0.0f, 0.0f};
390 const float tmp_vec[3] = {0.0f, 0.0f, 1.0f};
391
392 nu->pntsu = 5;
393 nu->pntsv = 1;
394 nu->orderu = 3;
395 nu->resolu = cu->resolu;
396 nu->resolv = cu->resolv;
397 nu->flag = CU_SMOOTH;
398 nu->bp = MEM_calloc_arrayN<BPoint>(nu->pntsu, "addNurbprim6");
399 nu->flagu = 0;
400 bp = nu->bp;
401
402 for (a = 0; a < 5; a++) {
403 bp->f1 = SELECT;
404 bp->vec[0] += nurbcircle[a][0] * grid;
405 bp->vec[2] += nurbcircle[a][1] * grid;
406 if (a & 1) {
407 bp->vec[3] = 0.5 * M_SQRT2;
408 }
409 else {
410 bp->vec[3] = 1.0;
411 }
412 mul_m4_v3(mat, bp->vec);
413 bp++;
414 }
417
418 BLI_addtail(editnurb, nu); /* temporal for spin */
419
420 if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
421 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, tmp_cent);
422 }
423 else if (U.flag & USER_ADD_VIEWALIGNED) {
424 ed_editnurb_spin(viewmat, nullptr, obedit, zvec, mat[3]);
425 }
426 else {
427 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, mat[3]);
428 }
429
431
432 a = nu->pntsu * nu->pntsv;
433 bp = nu->bp;
434 while (a-- > 0) {
435 bp->f1 |= SELECT;
436 bp++;
437 }
438 BLI_remlink(editnurb, nu);
439 }
440 break;
441 case CU_PRIM_DONUT: /* torus */
442 if (cutype == CU_NURBS) {
443 const float tmp_cent[3] = {0.0f, 0.0f, 0.0f};
444 const float tmp_vec[3] = {0.0f, 0.0f, 1.0f};
445
446 xzproj = 1;
447 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
448 xzproj = 0;
449 nu->resolu = cu->resolu;
450 nu->resolv = cu->resolv;
451 nu->flag = CU_SMOOTH;
452 BLI_addtail(editnurb, nu); /* temporal for spin */
453
454 /* same as above */
455 if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
456 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, tmp_cent);
457 }
458 else if (U.flag & USER_ADD_VIEWALIGNED) {
459 ed_editnurb_spin(viewmat, nullptr, obedit, zvec, mat[3]);
460 }
461 else {
462 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, mat[3]);
463 }
464
465 BLI_remlink(editnurb, nu);
466
467 a = nu->pntsu * nu->pntsv;
468 bp = nu->bp;
469 while (a-- > 0) {
470 bp->f1 |= SELECT;
471 bp++;
472 }
473 }
474 break;
475
476 default: /* should never happen */
477 BLI_assert_msg(0, "invalid nurbs type");
478 return nullptr;
479 }
480
481 BLI_assert(nu != nullptr);
482
483 if (nu) { /* should always be set */
484 nu->flag |= CU_SMOOTH;
485 cu->actnu = BLI_listbase_count(editnurb);
486 cu->actvert = CU_ACT_NONE;
487
488 if (CU_IS_2D(cu)) {
490 }
491 }
492
493 return nu;
494}
495
496static wmOperatorStatus curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
497{
498 Main *bmain = CTX_data_main(C);
499 Scene *scene = CTX_data_scene(C);
500 ViewLayer *view_layer = CTX_data_view_layer(C);
501 BKE_view_layer_synced_ensure(scene, view_layer);
502 Object *obedit = BKE_view_layer_edit_object_get(view_layer);
503 ListBase *editnurb;
504 Nurb *nu;
505 bool newob = false;
506 bool enter_editmode;
507 ushort local_view_bits;
508 float loc[3], rot[3];
509 float mat[4][4];
510
512
514 C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
515
516 if (!isSurf) { /* adding curve */
517 if (obedit == nullptr || obedit->type != OB_CURVES_LEGACY) {
518 const char *name = get_curve_defname(type);
519 Curve *cu;
520
522 C, OB_CURVES_LEGACY, name, loc, rot, true, local_view_bits);
523 newob = true;
524
525 cu = (Curve *)obedit->data;
526
527 if (type & CU_PRIM_PATH) {
528 cu->flag |= CU_PATH | CU_3D;
529 }
530 }
531 else {
533 }
534 }
535 else { /* adding surface */
536 if (obedit == nullptr || obedit->type != OB_SURF) {
537 const char *name = get_surf_defname(type);
538 obedit = blender::ed::object::add_type(C, OB_SURF, name, loc, rot, true, local_view_bits);
539 newob = true;
540 }
541 else {
543 }
544 }
545
546 float radius = RNA_float_get(op->ptr, "radius");
547 float scale[3];
548 copy_v3_fl(scale, radius);
549 blender::ed::object::new_primitive_matrix(C, obedit, loc, rot, scale, mat);
550
551 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, type, newob);
552 editnurb = object_editcurve_get(obedit);
553 BLI_addtail(editnurb, nu);
554
555 /* userdef */
556 if (newob && !enter_editmode) {
558 }
559
561
562 return OPERATOR_FINISHED;
563}
564
566{
567 return curvesurf_prim_add(C, op, type, 0);
568}
569
571{
572 return curvesurf_prim_add(C, op, type, 1);
573}
574
575/* ******************** Curves ******************* */
576
581
583{
584 /* identifiers */
585 ot->name = "Add Bézier";
586 ot->description = "Construct a Bézier Curve";
587 ot->idname = "CURVE_OT_primitive_bezier_curve_add";
588
589 /* API callbacks. */
592
593 /* flags */
595
598}
599
604
606{
607 /* identifiers */
608 ot->name = "Add Bézier Circle";
609 ot->description = "Construct a Bézier Circle";
610 ot->idname = "CURVE_OT_primitive_bezier_circle_add";
611
612 /* API callbacks. */
615
616 /* flags */
618
621}
622
627
629{
630 /* identifiers */
631 ot->name = "Add Nurbs Curve";
632 ot->description = "Construct a Nurbs Curve";
633 ot->idname = "CURVE_OT_primitive_nurbs_curve_add";
634
635 /* API callbacks. */
638
639 /* flags */
641
644}
645
650
652{
653 /* identifiers */
654 ot->name = "Add Nurbs Circle";
655 ot->description = "Construct a Nurbs Circle";
656 ot->idname = "CURVE_OT_primitive_nurbs_circle_add";
657
658 /* API callbacks. */
661
662 /* flags */
664
667}
668
673
675{
676 /* identifiers */
677 ot->name = "Add Path";
678 ot->description = "Construct a Path";
679 ot->idname = "CURVE_OT_primitive_nurbs_path_add";
680
681 /* API callbacks. */
684
685 /* flags */
687
690}
691
692/* **************** NURBS surfaces ********************** */
697
699{
700 /* identifiers */
701 ot->name = "Add Surface Curve";
702 ot->description = "Construct a Nurbs surface Curve";
703 ot->idname = "SURFACE_OT_primitive_nurbs_surface_curve_add";
704
705 /* API callbacks. */
708
709 /* flags */
711
714}
715
720
722{
723 /* identifiers */
724 ot->name = "Add Surface Circle";
725 ot->description = "Construct a Nurbs surface Circle";
726 ot->idname = "SURFACE_OT_primitive_nurbs_surface_circle_add";
727
728 /* API callbacks. */
731
732 /* flags */
734
737}
738
743
745{
746 /* identifiers */
747 ot->name = "Add Surface Patch";
748 ot->description = "Construct a Nurbs surface Patch";
749 ot->idname = "SURFACE_OT_primitive_nurbs_surface_surface_add";
750
751 /* API callbacks. */
754
755 /* flags */
757
760}
761
766
768{
769 /* identifiers */
770 ot->name = "Add Surface Cylinder";
771 ot->description = "Construct a Nurbs surface Cylinder";
772 ot->idname = "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
773
774 /* API callbacks. */
777
778 /* flags */
780
783}
784
789
791{
792 /* identifiers */
793 ot->name = "Add Surface Sphere";
794 ot->description = "Construct a Nurbs surface Sphere";
795 ot->idname = "SURFACE_OT_primitive_nurbs_surface_sphere_add";
796
797 /* API callbacks. */
800
801 /* flags */
803
806}
807
812
814{
815 /* identifiers */
816 ot->name = "Add Surface Torus";
817 ot->description = "Construct a Nurbs surface Torus";
818 ot->idname = "SURFACE_OT_primitive_nurbs_surface_torus_add";
819
820 /* API callbacks. */
823
824 /* flags */
826
829}
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_nurb_handles_calc(Nurb *nu)
Definition curve.cc:3957
void BKE_nurb_project_2d(Nurb *nu)
Definition curve.cc:684
#define CU_IS_2D(cu)
Definition BKE_curve.hh:89
void BKE_nurb_knot_calc_u(Nurb *nu)
Definition curve.cc:1189
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1194
void BKE_nurbList_flag_set(ListBase *editnurb, uint8_t flag, bool set)
Definition curve.cc:4341
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_edit_object_get(const ViewLayer *view_layer)
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:524
#define M_SQRT2
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void unit_m4(float m[4][4])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl(float r[3], float f)
unsigned short ushort
#define ELEM(...)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define CTX_DATA_(context, msgid)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ CU_NURB_CYCLIC
@ CU_NURB_ENDPOINT
@ CU_NURB_BEZIER
#define CU_ACT_NONE
@ CU_SMOOTH
@ CU_3D
@ CU_PATH
@ CU_PRIM_SPHERE
@ CU_PRIM_CURVE
@ CU_BEZIER
@ CU_PRIMITIVE
@ CU_TYPE
@ CU_PRIM_DONUT
@ CU_PRIM_TUBE
@ CU_PRIM_CIRCLE
@ CU_NURBS
@ CU_PRIM_PATCH
@ CU_PRIM_PATH
@ HD_AUTO
@ HD_ALIGN
Object is a sort of wrapper for general info.
@ OB_SURF
@ OB_CURVES_LEGACY
@ USER_ADD_VIEWALIGNED
@ OPERATOR_FINISHED
bool ED_operator_scene_editable(bContext *C)
RegionView3D * ED_view3d_context_rv3d(bContext *C)
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
#define ND_DRAW
Definition WM_types.hh:461
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NC_OBJECT
Definition WM_types.hh:379
#define U
nullptr float
#define SELECT
void ed_editnurb_translate_flag(ListBase *editnurb, uint8_t flag, const float vec[3], bool is_2d)
bool ed_editnurb_extrude_flag(EditNurb *editnurb, uint8_t flag)
bool ed_editnurb_spin(float viewmat[4][4], View3D *v3d, Object *obedit, const float axis[3], const float cent[3])
ListBase * object_editcurve_get(Object *ob)
Definition editcurve.cc:92
static wmOperatorStatus add_primitive_nurbs_surface_surface_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_nurbs_surface_sphere_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
static const char * get_surf_defname(int type)
void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
static wmOperatorStatus add_primitive_nurbs_surface_curve_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
static wmOperatorStatus add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
static wmOperatorStatus add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_bezier_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_curve_path_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
static wmOperatorStatus surf_prim_add(bContext *C, wmOperator *op, int type)
static wmOperatorStatus add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op)
Nurb * ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type, int newob)
static wmOperatorStatus curve_prim_add(bContext *C, wmOperator *op, int type)
void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot)
static wmOperatorStatus add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_nurbs_surface_circle_exec(bContext *C, wmOperator *op)
static wmOperatorStatus curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
static const float nurbcircle[8][2]
static const char * get_curve_defname(int type)
void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
#define rot(x, k)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void add_unit_props_radius(wmOperatorType *ot)
Object * add_type(bContext *C, int type, const char *name, const float loc[3], const float rot[3], bool enter_editmode, unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL
float new_primitive_matrix(bContext *C, Object *obedit, const float loc[3], const float rot[3], const float scale[3], float primmat[4][4])
void add_generic_props(wmOperatorType *ot, bool do_editmode)
void add_generic_get_opts(bContext *C, wmOperator *op, char view_align_axis, float r_loc[3], float r_rot[3], float r_scale[3], bool *r_enter_editmode, unsigned short *r_local_view_bits, bool *r_is_view_aligned)
bool editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag)
const char * name
float RNA_float_get(PointerRNA *ptr, const char *name)
uint8_t f1
float vec[4]
float vec[3][3]
short resolv
short resolu
EditNurb * editnurb
short flagu
short orderu
short orderv
float * knotsu
short flag
short type
BezTriple * bezt
BPoint * bp
short resolu
short resolv
short flagv
float viewmat[4][4]
float viewinv[4][4]
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4237
void WM_operator_view3d_unit_defaults(bContext *C, wmOperator *op)