Blender V4.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
9#include "DNA_anim_types.h"
10#include "DNA_object_types.h"
11#include "DNA_scene_types.h"
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_math_matrix.h"
16#include "BLI_math_vector.h"
17
18#include "BLT_translation.hh"
19
20#include "BKE_context.hh"
21#include "BKE_curve.hh"
22#include "BKE_layer.hh"
23
24#include "DEG_depsgraph.hh"
25
26#include "RNA_access.hh"
27
28#include "WM_api.hh"
29#include "WM_types.hh"
30
31#include "ED_curve.hh"
32#include "ED_object.hh"
33#include "ED_screen.hh"
34#include "ED_view3d.hh"
35
36#include "curve_intern.hh"
37
38static const float nurbcircle[8][2] = {
39 {0.0, -1.0},
40 {-1.0, -1.0},
41 {-1.0, 0.0},
42 {-1.0, 1.0},
43 {0.0, 1.0},
44 {1.0, 1.0},
45 {1.0, 0.0},
46 {1.0, -1.0},
47};
48
49/************ add primitive, used by object/ module ****************/
50
51static const char *get_curve_defname(int type)
52{
53 int stype = type & CU_PRIMITIVE;
54
55 if ((type & CU_TYPE) == CU_BEZIER) {
56 switch (stype) {
57 case CU_PRIM_CURVE:
58 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "BézierCurve");
59 case CU_PRIM_CIRCLE:
60 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "BézierCircle");
61 case CU_PRIM_PATH:
62 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "CurvePath");
63 default:
65 }
66 }
67 else {
68 switch (stype) {
69 case CU_PRIM_CURVE:
70 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsCurve");
71 case CU_PRIM_CIRCLE:
72 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsCircle");
73 case CU_PRIM_PATH:
74 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "NurbsPath");
75 default:
77 }
78 }
79}
80
81static const char *get_surf_defname(int type)
82{
83 int stype = type & CU_PRIMITIVE;
84
85 switch (stype) {
86 case CU_PRIM_CURVE:
87 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCurve");
88 case CU_PRIM_CIRCLE:
89 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCircle");
90 case CU_PRIM_PATCH:
91 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfPatch");
92 case CU_PRIM_TUBE:
93 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfCylinder");
94 case CU_PRIM_SPHERE:
95 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfSphere");
96 case CU_PRIM_DONUT:
97 return CTX_DATA_(BLT_I18NCONTEXT_ID_CURVE_LEGACY, "SurfTorus");
98 default:
100 }
101}
102
104 bContext *C, Object *obedit, float mat[4][4], int type, int newob)
105{
106 static int xzproj = 0; /* this function calls itself... */
107 ListBase *editnurb = object_editcurve_get(obedit);
109 Nurb *nu = nullptr;
110 BezTriple *bezt;
111 BPoint *bp;
112 Curve *cu = (Curve *)obedit->data;
113 float vec[3], zvec[3] = {0.0f, 0.0f, 1.0f};
114 float umat[4][4], viewmat[4][4];
115 float fac;
116 int a, b;
117 const float grid = 1.0f;
118 const int cutype = (type & CU_TYPE); /* poly, bezier, nurbs, etc */
119 const int stype = (type & CU_PRIMITIVE);
120
121 unit_m4(umat);
122 unit_m4(viewmat);
123
124 if (rv3d) {
125 copy_m4_m4(viewmat, rv3d->viewmat);
126 copy_v3_v3(zvec, rv3d->viewinv[2]);
127 }
128
129 BKE_nurbList_flag_set(editnurb, SELECT, false);
130
131 /* these types call this function to return a Nurb */
132 if (!ELEM(stype, CU_PRIM_TUBE, CU_PRIM_DONUT)) {
133 nu = (Nurb *)MEM_callocN(sizeof(Nurb), "addNurbprim");
134 nu->type = cutype;
135 nu->resolu = cu->resolu;
136 nu->resolv = cu->resolv;
137 }
138
139 switch (stype) {
140 case CU_PRIM_CURVE: /* curve */
141 nu->resolu = cu->resolu;
142 if (cutype == CU_BEZIER) {
143 nu->pntsu = 2;
144 nu->bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple) * nu->pntsu, "addNurbprim1");
145 bezt = nu->bezt;
146 bezt->h1 = bezt->h2 = HD_ALIGN;
147 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
148 bezt->radius = 1.0;
149
150 bezt->vec[1][0] += -grid;
151 bezt->vec[0][0] += -1.5f * grid;
152 bezt->vec[0][1] += -0.5f * grid;
153 bezt->vec[2][0] += -0.5f * grid;
154 bezt->vec[2][1] += 0.5f * grid;
155 for (a = 0; a < 3; a++) {
156 mul_m4_v3(mat, bezt->vec[a]);
157 }
158
159 bezt++;
160 bezt->h1 = bezt->h2 = HD_ALIGN;
161 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
162 bezt->radius = bezt->weight = 1.0;
163
164 bezt->vec[0][0] = 0;
165 bezt->vec[0][1] = 0;
166 bezt->vec[1][0] = grid;
167 bezt->vec[1][1] = 0;
168 bezt->vec[2][0] = grid * 2;
169 bezt->vec[2][1] = 0;
170 for (a = 0; a < 3; a++) {
171 mul_m4_v3(mat, bezt->vec[a]);
172 }
173
175 }
176 else {
177
178 nu->pntsu = 4;
179 nu->pntsv = 1;
180 nu->orderu = 4;
181 nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim3");
182
183 bp = nu->bp;
184 for (a = 0; a < 4; a++, bp++) {
185 bp->vec[3] = 1.0;
186 bp->f1 = SELECT;
187 bp->radius = bp->weight = 1.0;
188 }
189
190 bp = nu->bp;
191 bp->vec[0] += -1.5f * grid;
192 bp++;
193 bp->vec[0] += -grid;
194 bp->vec[1] += grid;
195 bp++;
196 bp->vec[0] += grid;
197 bp->vec[1] += grid;
198 bp++;
199 bp->vec[0] += 1.5f * grid;
200
201 bp = nu->bp;
202 for (a = 0; a < 4; a++, bp++) {
203 mul_m4_v3(mat, bp->vec);
204 }
205
206 if (cutype == CU_NURBS) {
207 nu->knotsu = nullptr; /* nurbs_knot_calc_u allocates */
209 }
210 }
211 break;
212 case CU_PRIM_PATH: /* 5 point path */
213 nu->pntsu = 5;
214 nu->pntsv = 1;
215 nu->orderu = 5;
216 nu->flagu = CU_NURB_ENDPOINT; /* endpoint */
217 nu->resolu = cu->resolu;
218 nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim3");
219
220 bp = nu->bp;
221 for (a = 0; a < 5; a++, bp++) {
222 bp->vec[3] = 1.0;
223 bp->f1 = SELECT;
224 bp->radius = bp->weight = 1.0;
225 }
226
227 bp = nu->bp;
228 bp->vec[0] += -2.0f * grid;
229 bp++;
230 bp->vec[0] += -grid;
231 bp++;
232 bp++;
233 bp->vec[0] += grid;
234 bp++;
235 bp->vec[0] += 2.0f * grid;
236
237 bp = nu->bp;
238 for (a = 0; a < 5; a++, bp++) {
239 mul_m4_v3(mat, bp->vec);
240 }
241
242 if (cutype == CU_NURBS) {
243 nu->knotsu = nullptr; /* nurbs_knot_calc_u allocates */
245 }
246
247 break;
248 case CU_PRIM_CIRCLE: /* circle */
249 nu->resolu = cu->resolu;
250
251 if (cutype == CU_BEZIER) {
252 nu->pntsu = 4;
253 nu->bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple) * nu->pntsu, "addNurbprim1");
254 nu->flagu = CU_NURB_CYCLIC;
255 bezt = nu->bezt;
256
257 bezt->h1 = bezt->h2 = HD_AUTO;
258 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
259 bezt->vec[1][0] += -grid;
260 for (a = 0; a < 3; a++) {
261 mul_m4_v3(mat, bezt->vec[a]);
262 }
263 bezt->radius = bezt->weight = 1.0;
264
265 bezt++;
266 bezt->h1 = bezt->h2 = HD_AUTO;
267 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
268 bezt->vec[1][1] += grid;
269 for (a = 0; a < 3; a++) {
270 mul_m4_v3(mat, bezt->vec[a]);
271 }
272 bezt->radius = bezt->weight = 1.0;
273
274 bezt++;
275 bezt->h1 = bezt->h2 = HD_AUTO;
276 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
277 bezt->vec[1][0] += grid;
278 for (a = 0; a < 3; a++) {
279 mul_m4_v3(mat, bezt->vec[a]);
280 }
281 bezt->radius = bezt->weight = 1.0;
282
283 bezt++;
284 bezt->h1 = bezt->h2 = HD_AUTO;
285 bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
286 bezt->vec[1][1] += -grid;
287 for (a = 0; a < 3; a++) {
288 mul_m4_v3(mat, bezt->vec[a]);
289 }
290 bezt->radius = bezt->weight = 1.0;
291
293 }
294 else if (cutype == CU_NURBS) { /* nurb */
295 nu->pntsu = 8;
296 nu->pntsv = 1;
297 nu->orderu = 3;
298 nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim6");
300 bp = nu->bp;
301
302 for (a = 0; a < 8; a++) {
303 bp->f1 = SELECT;
304 if (xzproj == 0) {
305 bp->vec[0] += nurbcircle[a][0] * grid;
306 bp->vec[1] += nurbcircle[a][1] * grid;
307 }
308 else {
309 bp->vec[0] += 0.25f * nurbcircle[a][0] * grid - 0.75f * grid;
310 bp->vec[2] += 0.25f * nurbcircle[a][1] * grid;
311 }
312 if (a & 1) {
313 bp->vec[3] = 0.5 * M_SQRT2;
314 }
315 else {
316 bp->vec[3] = 1.0;
317 }
318 mul_m4_v3(mat, bp->vec);
319 bp->radius = bp->weight = 1.0;
320
321 bp++;
322 }
323
325 }
326 break;
327 case CU_PRIM_PATCH: /* 4x4 patch */
328 if (cutype == CU_NURBS) { /* nurb */
329
330 nu->pntsu = 4;
331 nu->pntsv = 4;
332 nu->orderu = 4;
333 nu->orderv = 4;
334 nu->flag = CU_SMOOTH;
335 nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * (4 * 4), "addNurbprim6");
336 nu->flagu = 0;
337 nu->flagv = 0;
338 bp = nu->bp;
339
340 for (a = 0; a < 4; a++) {
341 for (b = 0; b < 4; b++) {
342 bp->f1 = SELECT;
343 fac = float(a) - 1.5f;
344 bp->vec[0] += fac * grid;
345 fac = float(b) - 1.5f;
346 bp->vec[1] += fac * grid;
347 if (ELEM(a, 1, 2) && ELEM(b, 1, 2)) {
348 bp->vec[2] += grid;
349 }
350 mul_m4_v3(mat, bp->vec);
351 bp->vec[3] = 1.0;
352 bp++;
353 }
354 }
355
358 }
359 break;
360 case CU_PRIM_TUBE: /* Cylinder */
361 if (cutype == CU_NURBS) {
362 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
363 nu->resolu = cu->resolu;
364 nu->flag = CU_SMOOTH;
365 BLI_addtail(editnurb, nu); /* temporal for extrude and translate */
366 vec[0] = vec[1] = 0.0;
367 vec[2] = -grid;
368
369 mul_mat3_m4_v3(mat, vec);
370
371 ed_editnurb_translate_flag(editnurb, SELECT, vec, CU_IS_2D(cu));
373 mul_v3_fl(vec, -2.0f);
374 ed_editnurb_translate_flag(editnurb, SELECT, vec, CU_IS_2D(cu));
375
376 BLI_remlink(editnurb, nu);
377
378 a = nu->pntsu * nu->pntsv;
379 bp = nu->bp;
380 while (a-- > 0) {
381 bp->f1 |= SELECT;
382 bp++;
383 }
384 }
385 break;
386 case CU_PRIM_SPHERE: /* sphere */
387 if (cutype == CU_NURBS) {
388 const float tmp_cent[3] = {0.0f, 0.0f, 0.0f};
389 const float tmp_vec[3] = {0.0f, 0.0f, 1.0f};
390
391 nu->pntsu = 5;
392 nu->pntsv = 1;
393 nu->orderu = 3;
394 nu->resolu = cu->resolu;
395 nu->resolv = cu->resolv;
396 nu->flag = CU_SMOOTH;
397 nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim6");
398 nu->flagu = 0;
399 bp = nu->bp;
400
401 for (a = 0; a < 5; a++) {
402 bp->f1 = SELECT;
403 bp->vec[0] += nurbcircle[a][0] * grid;
404 bp->vec[2] += nurbcircle[a][1] * grid;
405 if (a & 1) {
406 bp->vec[3] = 0.5 * M_SQRT2;
407 }
408 else {
409 bp->vec[3] = 1.0;
410 }
411 mul_m4_v3(mat, bp->vec);
412 bp++;
413 }
416
417 BLI_addtail(editnurb, nu); /* temporal for spin */
418
419 if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
420 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, tmp_cent);
421 }
422 else if (U.flag & USER_ADD_VIEWALIGNED) {
423 ed_editnurb_spin(viewmat, nullptr, obedit, zvec, mat[3]);
424 }
425 else {
426 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, mat[3]);
427 }
428
430
431 a = nu->pntsu * nu->pntsv;
432 bp = nu->bp;
433 while (a-- > 0) {
434 bp->f1 |= SELECT;
435 bp++;
436 }
437 BLI_remlink(editnurb, nu);
438 }
439 break;
440 case CU_PRIM_DONUT: /* torus */
441 if (cutype == CU_NURBS) {
442 const float tmp_cent[3] = {0.0f, 0.0f, 0.0f};
443 const float tmp_vec[3] = {0.0f, 0.0f, 1.0f};
444
445 xzproj = 1;
446 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
447 xzproj = 0;
448 nu->resolu = cu->resolu;
449 nu->resolv = cu->resolv;
450 nu->flag = CU_SMOOTH;
451 BLI_addtail(editnurb, nu); /* temporal for spin */
452
453 /* same as above */
454 if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
455 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, tmp_cent);
456 }
457 else if (U.flag & USER_ADD_VIEWALIGNED) {
458 ed_editnurb_spin(viewmat, nullptr, obedit, zvec, mat[3]);
459 }
460 else {
461 ed_editnurb_spin(umat, nullptr, obedit, tmp_vec, mat[3]);
462 }
463
464 BLI_remlink(editnurb, nu);
465
466 a = nu->pntsu * nu->pntsv;
467 bp = nu->bp;
468 while (a-- > 0) {
469 bp->f1 |= SELECT;
470 bp++;
471 }
472 }
473 break;
474
475 default: /* should never happen */
476 BLI_assert_msg(0, "invalid nurbs type");
477 return nullptr;
478 }
479
480 BLI_assert(nu != nullptr);
481
482 if (nu) { /* should always be set */
483 nu->flag |= CU_SMOOTH;
484 cu->actnu = BLI_listbase_count(editnurb);
485 cu->actvert = CU_ACT_NONE;
486
487 if (CU_IS_2D(cu)) {
489 }
490 }
491
492 return nu;
493}
494
495static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
496{
497 Main *bmain = CTX_data_main(C);
498 Scene *scene = CTX_data_scene(C);
499 ViewLayer *view_layer = CTX_data_view_layer(C);
500 BKE_view_layer_synced_ensure(scene, view_layer);
501 Object *obedit = BKE_view_layer_edit_object_get(view_layer);
502 ListBase *editnurb;
503 Nurb *nu;
504 bool newob = false;
505 bool enter_editmode;
506 ushort local_view_bits;
507 float loc[3], rot[3];
508 float mat[4][4];
509
511
513 C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
514
515 if (!isSurf) { /* adding curve */
516 if (obedit == nullptr || obedit->type != OB_CURVES_LEGACY) {
517 const char *name = get_curve_defname(type);
518 Curve *cu;
519
521 C, OB_CURVES_LEGACY, name, loc, rot, true, local_view_bits);
522 newob = true;
523
524 cu = (Curve *)obedit->data;
525
526 if (type & CU_PRIM_PATH) {
527 cu->flag |= CU_PATH | CU_3D;
528 }
529 }
530 else {
532 }
533 }
534 else { /* adding surface */
535 if (obedit == nullptr || obedit->type != OB_SURF) {
536 const char *name = get_surf_defname(type);
537 obedit = blender::ed::object::add_type(C, OB_SURF, name, loc, rot, true, local_view_bits);
538 newob = true;
539 }
540 else {
542 }
543 }
544
545 float radius = RNA_float_get(op->ptr, "radius");
546 float scale[3];
547 copy_v3_fl(scale, radius);
548 blender::ed::object::new_primitive_matrix(C, obedit, loc, rot, scale, mat);
549
550 nu = ED_curve_add_nurbs_primitive(C, obedit, mat, type, newob);
551 editnurb = object_editcurve_get(obedit);
552 BLI_addtail(editnurb, nu);
553
554 /* userdef */
555 if (newob && !enter_editmode) {
557 }
558
560
561 return OPERATOR_FINISHED;
562}
563
564static int curve_prim_add(bContext *C, wmOperator *op, int type)
565{
566 return curvesurf_prim_add(C, op, type, 0);
567}
568
569static int surf_prim_add(bContext *C, wmOperator *op, int type)
570{
571 return curvesurf_prim_add(C, op, type, 1);
572}
573
574/* ******************** Curves ******************* */
575
577{
578 return curve_prim_add(C, op, CU_BEZIER | CU_PRIM_CURVE);
579}
580
582{
583 /* identifiers */
584 ot->name = "Add Bézier";
585 ot->description = "Construct a Bézier Curve";
586 ot->idname = "CURVE_OT_primitive_bezier_curve_add";
587
588 /* api callbacks */
591
592 /* flags */
594
597}
598
603
605{
606 /* identifiers */
607 ot->name = "Add Bézier Circle";
608 ot->description = "Construct a Bézier Circle";
609 ot->idname = "CURVE_OT_primitive_bezier_circle_add";
610
611 /* api callbacks */
614
615 /* flags */
617
620}
621
623{
624 return curve_prim_add(C, op, CU_NURBS | CU_PRIM_CURVE);
625}
626
628{
629 /* identifiers */
630 ot->name = "Add Nurbs Curve";
631 ot->description = "Construct a Nurbs Curve";
632 ot->idname = "CURVE_OT_primitive_nurbs_curve_add";
633
634 /* api callbacks */
637
638 /* flags */
640
643}
644
649
651{
652 /* identifiers */
653 ot->name = "Add Nurbs Circle";
654 ot->description = "Construct a Nurbs Circle";
655 ot->idname = "CURVE_OT_primitive_nurbs_circle_add";
656
657 /* api callbacks */
660
661 /* flags */
663
666}
667
669{
670 return curve_prim_add(C, op, CU_NURBS | CU_PRIM_PATH);
671}
672
674{
675 /* identifiers */
676 ot->name = "Add Path";
677 ot->description = "Construct a Path";
678 ot->idname = "CURVE_OT_primitive_nurbs_path_add";
679
680 /* api callbacks */
683
684 /* flags */
686
689}
690
691/* **************** NURBS surfaces ********************** */
696
698{
699 /* identifiers */
700 ot->name = "Add Surface Curve";
701 ot->description = "Construct a Nurbs surface Curve";
702 ot->idname = "SURFACE_OT_primitive_nurbs_surface_curve_add";
703
704 /* api callbacks */
707
708 /* flags */
710
713}
714
719
721{
722 /* identifiers */
723 ot->name = "Add Surface Circle";
724 ot->description = "Construct a Nurbs surface Circle";
725 ot->idname = "SURFACE_OT_primitive_nurbs_surface_circle_add";
726
727 /* api callbacks */
730
731 /* flags */
733
736}
737
742
744{
745 /* identifiers */
746 ot->name = "Add Surface Patch";
747 ot->description = "Construct a Nurbs surface Patch";
748 ot->idname = "SURFACE_OT_primitive_nurbs_surface_surface_add";
749
750 /* api callbacks */
753
754 /* flags */
756
759}
760
765
767{
768 /* identifiers */
769 ot->name = "Add Surface Cylinder";
770 ot->description = "Construct a Nurbs surface Cylinder";
771 ot->idname = "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
772
773 /* api callbacks */
776
777 /* flags */
779
782}
783
788
790{
791 /* identifiers */
792 ot->name = "Add Surface Sphere";
793 ot->description = "Construct a Nurbs surface Sphere";
794 ot->idname = "SURFACE_OT_primitive_nurbs_surface_sphere_add";
795
796 /* api callbacks */
799
800 /* flags */
802
805}
806
811
813{
814 /* identifiers */
815 ot->name = "Add Surface Torus";
816 ot->description = "Construct a Nurbs surface Torus";
817 ot->idname = "SURFACE_OT_primitive_nurbs_surface_torus_add";
818
819 /* api callbacks */
822
823 /* flags */
825
828}
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:3955
void BKE_nurb_project_2d(Nurb *nu)
Definition curve.cc:683
#define CU_IS_2D(cu)
Definition BKE_curve.hh:86
void BKE_nurb_knot_calc_u(Nurb *nu)
Definition curve.cc:1181
void BKE_nurb_knot_calc_v(Nurb *nu)
Definition curve.cc:1186
void BKE_nurbList_flag_set(ListBase *editnurb, uint8_t flag, bool set)
Definition curve.cc:4339
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:50
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:57
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:130
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define M_SQRT2
void unit_m4(float m[4][4])
Definition rct.c:1127
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])
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:1041
@ CU_SMOOTH
@ 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
#define CU_ACT_NONE
@ CU_3D
@ CU_PATH
@ HD_AUTO
@ HD_ALIGN
@ CU_NURB_CYCLIC
@ CU_NURB_ENDPOINT
@ CU_NURB_BEZIER
Object is a sort of wrapper for general info.
@ OB_SURF
@ OB_CURVES_LEGACY
@ USER_ADD_VIEWALIGNED
bool ED_operator_scene_editable(bContext *C)
RegionView3D * ED_view3d_context_rv3d(bContext *C)
Read Guarded memory(de)allocation.
@ OPTYPE_UNDO
Definition WM_types.hh:162
@ OPTYPE_REGISTER
Definition WM_types.hh:160
#define ND_DRAW
Definition WM_types.hh:428
#define NC_OBJECT
Definition WM_types.hh:346
unsigned int U
Definition btGjkEpa3.h:78
local_group_size(16, 16) .push_constant(Type b
#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:88
static int 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 int add_primitive_bezier_exec(bContext *C, wmOperator *op)
static int add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
static const char * get_surf_defname(int type)
void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
static int add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
static int add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
static int add_primitive_curve_path_exec(bContext *C, wmOperator *op)
void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
static int 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 int curve_prim_add(bContext *C, wmOperator *op, int type)
void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
static int surf_prim_add(bContext *C, wmOperator *op, int type)
static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
static int add_primitive_nurbs_surface_surface_exec(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_curve_add(wmOperatorType *ot)
static const float nurbcircle[8][2]
static const char * get_curve_defname(int type)
static int add_primitive_nurbs_surface_circle_exec(bContext *C, wmOperator *op)
void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
draw_view in_light_buf[] float
#define rot(x, k)
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
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)
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]
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4125
void WM_operator_view3d_unit_defaults(bContext *C, wmOperator *op)