Blender V5.3
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.hh"
16#include "BLI_math_matrix_c.hh"
17#include "BLI_math_vector_c.hh"
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
39namespace blender {
40
41static const float nurbcircle[8][2] = {
42 {0.0, -1.0},
43 {-1.0, -1.0},
44 {-1.0, 0.0},
45 {-1.0, 1.0},
46 {0.0, 1.0},
47 {1.0, 1.0},
48 {1.0, 0.0},
49 {1.0, -1.0},
50};
51
52/************ add primitive, used by object/ module ****************/
53
54static const char *get_curve_defname(int type)
55{
56 int stype = type & CU_PRIMITIVE;
57
58 if ((type & CU_TYPE) == CU_BEZIER) {
59 switch (stype) {
60 case CU_PRIM_CURVE:
61 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "BézierCurve");
62 case CU_PRIM_CIRCLE:
63 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "BézierCircle");
64 case CU_PRIM_PATH:
65 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "CurvePath");
66 default:
68 }
69 }
70 else {
71 switch (stype) {
72 case CU_PRIM_CURVE:
73 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsCurve");
74 case CU_PRIM_CIRCLE:
75 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsCircle");
76 case CU_PRIM_PATH:
77 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsPath");
78 default:
80 }
81 }
82}
83
84static const char *get_surf_defname(int type)
85{
86 int stype = type & CU_PRIMITIVE;
87
88 switch (stype) {
89 case CU_PRIM_CURVE:
90 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCurve");
91 case CU_PRIM_CIRCLE:
92 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCircle");
93 case CU_PRIM_PATCH:
94 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfPatch");
95 case CU_PRIM_TUBE:
96 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCylinder");
97 case CU_PRIM_SPHERE:
98 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfSphere");
99 case CU_PRIM_DONUT:
100 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfTorus");
101 default:
103 }
104}
105
107 bContext *C, Object *obedit, float mat[4][4], int type, int newob)
108{
109 static int xzproj = 0; /* this function calls itself... */
110 ListBaseT<Nurb> *editnurb = object_editcurve_get(obedit);
112 Nurb *nu = nullptr;
113 BezTriple *bezt;
114 BPoint *bp;
115 Curve *cu = id_cast<Curve *>(obedit->data);
116 float vec[3], zvec[3] = {0.0f, 0.0f, 1.0f};
117 float umat[4][4], viewmat[4][4];
118 float fac;
119 int a, b;
120 const float grid = 1.0f;
121 const eNurbType cutype = eNurbType(type & CU_TYPE); /* poly, bezier, nurbs, etc */
122 const int stype = (type & CU_PRIMITIVE);
123
124 unit_m4(umat);
125 unit_m4(viewmat);
126
127 if (rv3d) {
128 copy_m4_m4(viewmat, rv3d->viewmat);
129 copy_v3_v3(zvec, rv3d->viewinv[2]);
130 }
131
132 BKE_nurbList_flag_set(editnurb, BEZT_FLAG_SELECT, false);
133
134 /* these types call this function to return a Nurb */
135 if (!ELEM(stype, CU_PRIM_TUBE, CU_PRIM_DONUT)) {
136 nu = MEM_new<Nurb>("addNurbprim");
137 nu->type = cutype;
138 nu->resolu = cu->resolu;
139 nu->resolv = cu->resolv;
140 }
141
142 switch (stype) {
143 case CU_PRIM_CURVE: /* curve */
144 nu->resolu = cu->resolu;
145 if (cutype == CU_BEZIER) {
146 nu->pntsu = 2;
147 nu->bezt = MEM_new_array_zeroed<BezTriple>(nu->pntsu, "addNurbprim1");
148 bezt = nu->bezt;
149 bezt->h1 = bezt->h2 = HD_ALIGN;
150 bezt->f1 = bezt->f2 = bezt->f3 = BEZT_FLAG_SELECT;
151 bezt->radius = 1.0;
152
153 bezt->vec[1][0] += -grid;
154 bezt->vec[0][0] += -1.5f * grid;
155 bezt->vec[0][1] += -0.5f * grid;
156 bezt->vec[2][0] += -0.5f * grid;
157 bezt->vec[2][1] += 0.5f * grid;
158 for (a = 0; a < 3; a++) {
159 mul_m4_v3(mat, bezt->vec[a]);
160 }
161
162 bezt++;
163 bezt->h1 = bezt->h2 = HD_ALIGN;
164 bezt->f1 = bezt->f2 = bezt->f3 = BEZT_FLAG_SELECT;
165 bezt->radius = bezt->weight = 1.0;
166
167 bezt->vec[0][0] = 0;
168 bezt->vec[0][1] = 0;
169 bezt->vec[1][0] = grid;
170 bezt->vec[1][1] = 0;
171 bezt->vec[2][0] = grid * 2;
172 bezt->vec[2][1] = 0;
173 for (a = 0; a < 3; a++) {
174 mul_m4_v3(mat, bezt->vec[a]);
175 }
176
178 }
179 else {
180
181 nu->pntsu = 4;
182 nu->pntsv = 1;
183 nu->orderu = 4;
184 nu->bp = MEM_new_array_zeroed<BPoint>(nu->pntsu, "addNurbprim3");
185
186 bp = nu->bp;
187 for (a = 0; a < 4; a++, bp++) {
188 bp->vec[3] = 1.0;
189 bp->f1 = SELECT;
190 bp->radius = bp->weight = 1.0;
191 }
192
193 bp = nu->bp;
194 bp->vec[0] += -1.5f * grid;
195 bp++;
196 bp->vec[0] += -grid;
197 bp->vec[1] += grid;
198 bp++;
199 bp->vec[0] += grid;
200 bp->vec[1] += grid;
201 bp++;
202 bp->vec[0] += 1.5f * grid;
203
204 bp = nu->bp;
205 for (a = 0; a < 4; a++, bp++) {
206 mul_m4_v3(mat, bp->vec);
207 }
208
209 if (cutype == CU_NURBS) {
210 nu->knotsu = nullptr; /* nurbs_knot_calc_u allocates */
212 }
213 }
214 break;
215 case CU_PRIM_PATH: /* 5 point path */
216 nu->pntsu = 5;
217 nu->pntsv = 1;
218 nu->orderu = 5;
219 nu->flagu = CU_NURB_ENDPOINT; /* endpoint */
220 nu->resolu = cu->resolu;
221 nu->bp = MEM_new_array_zeroed<BPoint>(nu->pntsu, "addNurbprim3");
222
223 bp = nu->bp;
224 for (a = 0; a < 5; a++, bp++) {
225 bp->vec[3] = 1.0;
226 bp->f1 = SELECT;
227 bp->radius = bp->weight = 1.0;
228 }
229
230 bp = nu->bp;
231 bp->vec[0] += -2.0f * grid;
232 bp++;
233 bp->vec[0] += -grid;
234 bp++;
235 bp++;
236 bp->vec[0] += grid;
237 bp++;
238 bp->vec[0] += 2.0f * grid;
239
240 bp = nu->bp;
241 for (a = 0; a < 5; a++, bp++) {
242 mul_m4_v3(mat, bp->vec);
243 }
244
245 if (cutype == CU_NURBS) {
246 nu->knotsu = nullptr; /* nurbs_knot_calc_u allocates */
248 }
249
250 break;
251 case CU_PRIM_CIRCLE: /* circle */
252 nu->resolu = cu->resolu;
253
254 if (cutype == CU_BEZIER) {
255 nu->pntsu = 4;
256 nu->bezt = MEM_new_array_zeroed<BezTriple>(nu->pntsu, "addNurbprim1");
257 nu->flagu = CU_NURB_CYCLIC;
258 bezt = nu->bezt;
259
260 bezt->h1 = bezt->h2 = HD_AUTO;
261 bezt->f1 = bezt->f2 = bezt->f3 = BEZT_FLAG_SELECT;
262 bezt->vec[1][0] += -grid;
263 for (a = 0; a < 3; a++) {
264 mul_m4_v3(mat, bezt->vec[a]);
265 }
266 bezt->radius = bezt->weight = 1.0;
267
268 bezt++;
269 bezt->h1 = bezt->h2 = HD_AUTO;
270 bezt->f1 = bezt->f2 = bezt->f3 = BEZT_FLAG_SELECT;
271 bezt->vec[1][1] += grid;
272 for (a = 0; a < 3; a++) {
273 mul_m4_v3(mat, bezt->vec[a]);
274 }
275 bezt->radius = bezt->weight = 1.0;
276
277 bezt++;
278 bezt->h1 = bezt->h2 = HD_AUTO;
279 bezt->f1 = bezt->f2 = bezt->f3 = BEZT_FLAG_SELECT;
280 bezt->vec[1][0] += grid;
281 for (a = 0; a < 3; a++) {
282 mul_m4_v3(mat, bezt->vec[a]);
283 }
284 bezt->radius = bezt->weight = 1.0;
285
286 bezt++;
287 bezt->h1 = bezt->h2 = HD_AUTO;
288 bezt->f1 = bezt->f2 = bezt->f3 = BEZT_FLAG_SELECT;
289 bezt->vec[1][1] += -grid;
290 for (a = 0; a < 3; a++) {
291 mul_m4_v3(mat, bezt->vec[a]);
292 }
293 bezt->radius = bezt->weight = 1.0;
294
296 }
297 else if (cutype == CU_NURBS) { /* nurb */
298 nu->pntsu = 8;
299 nu->pntsv = 1;
300 nu->orderu = 3;
301 nu->bp = MEM_new_array_zeroed<BPoint>(nu->pntsu, "addNurbprim6");
303 bp = nu->bp;
304
305 for (a = 0; a < 8; a++) {
306 bp->f1 = SELECT;
307 if (xzproj == 0) {
308 bp->vec[0] += nurbcircle[a][0] * grid;
309 bp->vec[1] += nurbcircle[a][1] * grid;
310 }
311 else {
312 bp->vec[0] += 0.25f * nurbcircle[a][0] * grid - 0.75f * grid;
313 bp->vec[2] += 0.25f * nurbcircle[a][1] * grid;
314 }
315 if (a & 1) {
316 bp->vec[3] = 0.5 * M_SQRT2;
317 }
318 else {
319 bp->vec[3] = 1.0;
320 }
321 mul_m4_v3(mat, bp->vec);
322 bp->radius = bp->weight = 1.0;
323
324 bp++;
325 }
326
328 }
329 break;
330 case CU_PRIM_PATCH: /* 4x4 patch */
331 if (cutype == CU_NURBS) { /* nurb */
332
333 nu->pntsu = 4;
334 nu->pntsv = 4;
335 nu->orderu = 4;
336 nu->orderv = 4;
337 nu->flag = CU_SMOOTH;
338 nu->bp = MEM_new_array_zeroed<BPoint>((4 * 4), "addNurbprim6");
339 nu->flagu = {};
340 nu->flagv = {};
341 bp = nu->bp;
342
343 for (a = 0; a < 4; a++) {
344 for (b = 0; b < 4; b++) {
345 bp->f1 = SELECT;
346 fac = float(a) - 1.5f;
347 bp->vec[0] += fac * grid;
348 fac = float(b) - 1.5f;
349 bp->vec[1] += fac * grid;
350 if (ELEM(a, 1, 2) && ELEM(b, 1, 2)) {
351 bp->vec[2] += grid;
352 }
353 mul_m4_v3(mat, bp->vec);
354 bp->vec[3] = 1.0;
355 bp++;
356 }
357 }
358
361 }
362 break;
363 case CU_PRIM_TUBE: /* Cylinder */
364 if (cutype == CU_NURBS) {
365 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
366 nu->resolu = cu->resolu;
367 nu->flag = CU_SMOOTH;
368 BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
369 vec[0] = vec[1] = 0.0;
370 vec[2] = -grid;
371
372 mul_mat3_m4_v3(mat, vec);
373
376 mul_v3_fl(vec, -2.0f);
378
379 BLI_remlink(editnurb, nu);
380
381 a = nu->pntsu * nu->pntsv;
382 bp = nu->bp;
383 while (a-- > 0) {
384 bp->f1 |= SELECT;
385 bp++;
386 }
387 }
388 break;
389 case CU_PRIM_SPHERE: /* sphere */
390 if (cutype == CU_NURBS) {
391 const float tmp_cent[3] = {0.0f, 0.0f, 0.0f};
392 const float tmp_vec[3] = {0.0f, 0.0f, 1.0f};
393
394 nu->pntsu = 5;
395 nu->pntsv = 1;
396 nu->orderu = 3;
397 nu->resolu = cu->resolu;
398 nu->resolv = cu->resolv;
399 nu->flag = CU_SMOOTH;
400 nu->bp = MEM_new_array_zeroed<BPoint>(nu->pntsu, "addNurbprim6");
401 nu->flagu = {};
402 bp = nu->bp;
403
404 for (a = 0; a < 5; a++) {
405 bp->f1 = SELECT;
406 bp->vec[0] += nurbcircle[a][0] * grid;
407 bp->vec[2] += nurbcircle[a][1] * grid;
408 if (a & 1) {
409 bp->vec[3] = 0.5 * M_SQRT2;
410 }
411 else {
412 bp->vec[3] = 1.0;
413 }
414 mul_m4_v3(mat, bp->vec);
415 bp++;
416 }
419
420 BLI_addtail(editnurb, nu); /* temporal for spin */
421
422 if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
423 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, tmp_cent);
424 }
425 else if (U.flag & USER_ADD_VIEWALIGNED) {
426 ed_editnurb_spin(viewmat, nullptr, obedit, zvec, mat[3]);
427 }
428 else {
429 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, mat[3]);
430 }
431
433
434 a = nu->pntsu * nu->pntsv;
435 bp = nu->bp;
436 while (a-- > 0) {
437 bp->f1 |= SELECT;
438 bp++;
439 }
440 BLI_remlink(editnurb, nu);
441 }
442 break;
443 case CU_PRIM_DONUT: /* torus */
444 if (cutype == CU_NURBS) {
445 const float tmp_cent[3] = {0.0f, 0.0f, 0.0f};
446 const float tmp_vec[3] = {0.0f, 0.0f, 1.0f};
447
448 xzproj = 1;
449 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
450 xzproj = 0;
451 nu->resolu = cu->resolu;
452 nu->resolv = cu->resolv;
453 nu->flag = CU_SMOOTH;
454 BLI_addtail(editnurb, nu); /* temporal for spin */
455
456 /* same as above */
457 if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
458 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, tmp_cent);
459 }
460 else if (U.flag & USER_ADD_VIEWALIGNED) {
461 ed_editnurb_spin(viewmat, nullptr, obedit, zvec, mat[3]);
462 }
463 else {
464 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, mat[3]);
465 }
466
467 BLI_remlink(editnurb, nu);
468
469 a = nu->pntsu * nu->pntsv;
470 bp = nu->bp;
471 while (a-- > 0) {
472 bp->f1 |= SELECT;
473 bp++;
474 }
475 }
476 break;
477
478 default: /* should never happen */
479 BLI_assert_msg(0, "invalid nurbs type");
480 return nullptr;
481 }
482
483 BLI_assert(nu != nullptr);
484
485 if (nu) { /* should always be set */
486 nu->flag |= CU_SMOOTH;
487 cu->actnu = editnurb->count();
488 cu->actvert = CU_ACT_NONE;
489
490 if (CU_IS_2D(cu)) {
492 }
493 }
494
495 return nu;
496}
497
498static wmOperatorStatus curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
499{
500 Main *bmain = CTX_data_main(C);
501 Scene *scene = CTX_data_scene(C);
502 ViewLayer *view_layer = CTX_data_view_layer(C);
503 BKE_view_layer_synced_ensure(*bmain, scene, view_layer);
504 Object *obedit = BKE_view_layer_edit_object_get(view_layer);
505 ListBaseT<Nurb> *editnurb;
506 Nurb *nu;
507 bool newob = false;
508 bool enter_editmode;
509 ushort local_view_bits;
510 float loc[3], rot[3];
511 float mat[4][4];
512
514
516 C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
517
518 if (!isSurf) { /* adding curve */
519 if (obedit == nullptr || obedit->type != OB_CURVES_LEGACY) {
520 const char *name = get_curve_defname(type);
521 Curve *cu;
522
523 obedit = ed::object::add_type(C, OB_CURVES_LEGACY, name, loc, rot, true, local_view_bits);
524 newob = true;
525
526 cu = id_cast<Curve *>(obedit->data);
527
528 if (type & CU_PRIM_PATH) {
529 cu->flag |= CU_PATH | CU_3D;
530 }
531 }
532 else {
534 }
535 }
536 else { /* adding surface */
537 if (obedit == nullptr || obedit->type != OB_SURF) {
538 const char *name = get_surf_defname(type);
539 obedit = ed::object::add_type(C, OB_SURF, name, loc, rot, true, local_view_bits);
540 newob = true;
541 }
542 else {
544 }
545 }
546
547 float radius = RNA_float_get(op->ptr, "radius");
548 float scale[3];
549 copy_v3_fl(scale, radius);
550 ed::object::new_primitive_matrix(C, obedit, loc, rot, scale, mat);
551
552 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, type, newob);
553 editnurb = object_editcurve_get(obedit);
554 BLI_addtail(editnurb, nu);
555
556 /* userdef */
557 if (newob && !enter_editmode) {
559 }
560
562
563 return OPERATOR_FINISHED;
564}
565
567{
568 return curvesurf_prim_add(C, op, type, 0);
569}
570
572{
573 return curvesurf_prim_add(C, op, type, 1);
574}
575
576/* ******************** Curves ******************* */
577
582
584{
585 /* identifiers */
586 ot->name = "Add Bézier";
587 ot->description = "Construct a Bézier Curve";
588 ot->idname = "CURVE_OT_primitive_bezier_curve_add";
589
590 /* API callbacks. */
593
594 /* flags */
596
599}
600
605
607{
608 /* identifiers */
609 ot->name = "Add Bézier Circle";
610 ot->description = "Construct a Bézier Circle";
611 ot->idname = "CURVE_OT_primitive_bezier_circle_add";
612
613 /* API callbacks. */
616
617 /* flags */
619
622}
623
628
630{
631 /* identifiers */
632 ot->name = "Add Nurbs Curve";
633 ot->description = "Construct a Nurbs Curve";
634 ot->idname = "CURVE_OT_primitive_nurbs_curve_add";
635
636 /* API callbacks. */
639
640 /* flags */
642
645}
646
651
653{
654 /* identifiers */
655 ot->name = "Add Nurbs Circle";
656 ot->description = "Construct a Nurbs Circle";
657 ot->idname = "CURVE_OT_primitive_nurbs_circle_add";
658
659 /* API callbacks. */
662
663 /* flags */
665
668}
669
674
676{
677 /* identifiers */
678 ot->name = "Add Path";
679 ot->description = "Construct a Path";
680 ot->idname = "CURVE_OT_primitive_nurbs_path_add";
681
682 /* API callbacks. */
685
686 /* flags */
688
691}
692
693/* **************** NURBS surfaces ********************** */
698
700{
701 /* identifiers */
702 ot->name = "Add Surface Curve";
703 ot->description = "Construct a NURBS surface curve";
704 ot->idname = "SURFACE_OT_primitive_nurbs_surface_curve_add";
705
706 /* API callbacks. */
709
710 /* flags */
712
715}
716
721
723{
724 /* identifiers */
725 ot->name = "Add Surface Circle";
726 ot->description = "Construct a NURBS surface circle";
727 ot->idname = "SURFACE_OT_primitive_nurbs_surface_circle_add";
728
729 /* API callbacks. */
732
733 /* flags */
735
738}
739
744
746{
747 /* identifiers */
748 ot->name = "Add Surface Patch";
749 ot->description = "Construct a NURBS surface patch";
750 ot->idname = "SURFACE_OT_primitive_nurbs_surface_surface_add";
751
752 /* API callbacks. */
755
756 /* flags */
758
761}
762
767
769{
770 /* identifiers */
771 ot->name = "Add Surface Cylinder";
772 ot->description = "Construct a NURBS surface cylinder";
773 ot->idname = "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
774
775 /* API callbacks. */
778
779 /* flags */
781
784}
785
790
792{
793 /* identifiers */
794 ot->name = "Add Surface Sphere";
795 ot->description = "Construct a NURBS surface sphere";
796 ot->idname = "SURFACE_OT_primitive_nurbs_surface_sphere_add";
797
798 /* API callbacks. */
801
802 /* flags */
804
807}
808
813
815{
816 /* identifiers */
817 ot->name = "Add Surface Torus";
818 ot->description = "Construct a NURBS surface torus";
819 ot->idname = "SURFACE_OT_primitive_nurbs_surface_torus_add";
820
821 /* API callbacks. */
824
825 /* flags */
827
830}
831
832} // namespace blender
#define CU_IS_2D(cu)
Definition BKE_curve.hh:93
#define SELECT
Definition BKE_mask.hh:19
#define M_SQRT2
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define CTX_DATA_(context, msgid)
#define CU_ACT_NONE
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ND_DRAW
Definition WM_types.hh:502
#define NC_OBJECT
Definition WM_types.hh:392
#define ELEM(...)
#define BLI_assert_msg(a, msg)
#define rot(x, k)
float3x3 scale(float3x3 mat, float2 scale)
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)
BMesh Iterators.
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool ED_operator_scene_editable(bContext *C)
static wmOperatorStatus add_primitive_bezier_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
static wmOperatorStatus add_primitive_nurbs_surface_sphere_exec(bContext *C, wmOperator *op)
bool ed_editnurb_extrude_flag(EditNurb *editnurb, eBezTriple_Flag flag)
unsigned short ushort
Definition BKE_text.h:56
void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
static wmOperatorStatus curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
static wmOperatorStatus add_primitive_curve_path_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
void BKE_nurbList_flag_set(ListBaseT< Nurb > *editnurb, eBezTriple_Flag flag, bool set)
Definition curve.cc:4376
static wmOperatorStatus add_primitive_nurbs_surface_curve_exec(bContext *C, wmOperator *op)
RegionView3D * ED_view3d_context_rv3d(bContext *C)
void BKE_nurb_project_2d(Nurb *nu)
Definition curve.cc:707
static const float nurbcircle[8][2]
ViewLayer * CTX_data_view_layer(const bContext *C)
MINLINE void mul_v3_fl(float r[3], float f)
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1219
static const char * get_surf_defname(int type)
void mul_m4_v3(const float M[4][4], float r[3])
void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
void WM_operator_view3d_unit_defaults(bContext *C, wmOperator *op)
Nurb * ED_curve_add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type, int newob)
void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
void BKE_nurb_handles_calc(Nurb *nu)
Definition curve.cc:3992
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
Object * BKE_view_layer_edit_object_get(const ViewLayer *view_layer)
void DEG_id_tag_update(ID *id, unsigned int flags)
void ed_editnurb_translate_flag(ListBaseT< Nurb > *editnurb, eBezTriple_Flag flag, const float vec[3], bool is_2d)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void unit_m4(float m[4][4])
ListBaseT< Nurb > * object_editcurve_get(Object *ob)
Definition editcurve.cc:95
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
static wmOperatorStatus add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_nurbs_surface_surface_exec(bContext *C, wmOperator *op)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
Main * CTX_data_main(const bContext *C)
MINLINE void copy_v3_fl(float r[3], float f)
static wmOperatorStatus curve_prim_add(bContext *C, wmOperator *op, int type)
void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
static wmOperatorStatus add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op)
Scene * CTX_data_scene(const bContext *C)
static wmOperatorStatus add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
static wmOperatorStatus add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
void copy_m4_m4(float m1[4][4], const float m2[4][4])
static wmOperatorStatus surf_prim_add(bContext *C, wmOperator *op, int type)
void BKE_nurb_knot_calc_u(Nurb *nu)
Definition curve.cc:1214
bool ed_editnurb_spin(float viewmat[4][4], View3D *v3d, Object *obedit, const float axis[3], const float cent[3])
void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot)
void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
float RNA_float_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus add_primitive_nurbs_surface_circle_exec(bContext *C, wmOperator *op)
static const char * get_curve_defname(int type)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eBezTriple_Flag f2
eBezTriple_Handle h2
eBezTriple_Flag f3
eBezTriple_Flag f1
eBezTriple_Handle h1
EditNurb * editnurb
BezTriple * bezt
eNurbKnotFlag flagu
eNurbKnotFlag flagv
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165