Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-10-05 16:59:09 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-10-05 16:59:09 +0400
commit00ce0c9aae04a461d96dc626bc6651a3ba0211cf (patch)
treed328c4b59f348770cdaf16c2c3fe093b44a2eeba /source/blender/editors/curve
parenteb46c080a2d3b71beb626517e30ae2b5f2e60425 (diff)
Clean up in "add object" code:
* Get rid of ED_object_add_generic_invoke() and all invoke callbacks using it, it was doing nothing exec() callbacks would not do. In fact, its only action (setting part of common add ops properties, like loc, layers, etc.) was needed too by direct exec call, so it was done twice in case of using invoke()! * Replace custom invoke code for metaballs by WM_menu_invoke helper (as already used by lamps). * Add a new OBJECT_OT_empty_add op, to allow direct addition of empties of a given drawtype. * And some general code cleanup (like trailing spaces, empty lines, ...). Did quite a bunch of tests/verifications, but obviously could not tackle all possible scenarios... Anyway, if any, bugs should arize quite quickly (but I don’t expect any! :p ).
Diffstat (limited to 'source/blender/editors/curve')
-rw-r--r--source/blender/editors/curve/editcurve.c68
1 files changed, 28 insertions, 40 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 9c13f4be6a9..afd6bc4c4b5 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6567,18 +6567,18 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
if (!isSurf) { /* adding curve */
if (obedit == NULL || obedit->type != OB_CURVE) {
Curve *cu;
-
+
obedit = ED_object_add_type(C, OB_CURVE, loc, rot, TRUE, layer);
newob = 1;
cu = (Curve *)obedit->data;
cu->flag |= CU_DEFORM_FILL;
-
+
if (type & CU_PRIM_PATH)
cu->flag |= CU_PATH | CU_3D;
- }
+ }
else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
- }
+ }
else { /* adding surface */
if (obedit == NULL || obedit->type != OB_SURF) {
obedit = ED_object_add_type(C, OB_SURF, loc, rot, TRUE, layer);
@@ -6589,7 +6589,6 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
/* rename here, the undo stack checks name for valid undo pushes */
if (newob) {
-
if (obedit->type == OB_CURVE) {
rename_id((ID *)obedit, get_curve_defname(type));
rename_id((ID *)obedit->data, get_curve_defname(type));
@@ -6599,11 +6598,11 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
rename_id((ID *)obedit->data, get_surf_defname(type));
}
}
-
+
/* ED_object_add_type doesnt do an undo, is needed for redo operator on primitive */
if (newob && enter_editmode)
ED_undo_push(C, "Enter Editmode");
-
+
ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
nu = add_nurbs_primitive(C, obedit, mat, type, newob);
@@ -6643,12 +6642,11 @@ void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
ot->name = "Add Bezier";
ot->description = "Construct a Bezier Curve";
ot->idname = "CURVE_OT_primitive_bezier_curve_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_bezier_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6666,12 +6664,11 @@ void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
ot->name = "Add Bezier Circle";
ot->description = "Construct a Bezier Circle";
ot->idname = "CURVE_OT_primitive_bezier_circle_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_bezier_circle_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6689,12 +6686,11 @@ void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
ot->name = "Add Nurbs Curve";
ot->description = "Construct a Nurbs Curve";
ot->idname = "CURVE_OT_primitive_nurbs_curve_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_curve_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6712,12 +6708,11 @@ void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
ot->name = "Add Nurbs Circle";
ot->description = "Construct a Nurbs Circle";
ot->idname = "CURVE_OT_primitive_nurbs_circle_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_circle_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6735,12 +6730,11 @@ void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
ot->name = "Add Path";
ot->description = "Construct a Path";
ot->idname = "CURVE_OT_primitive_nurbs_path_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_curve_path_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6759,12 +6753,11 @@ void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot)
ot->name = "Add Surface Curve";
ot->description = "Construct a Nurbs surface Curve";
ot->idname = "SURFACE_OT_primitive_nurbs_surface_curve_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_surface_curve_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6782,12 +6775,11 @@ void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
ot->name = "Add Surface Circle";
ot->description = "Construct a Nurbs surface Circle";
ot->idname = "SURFACE_OT_primitive_nurbs_surface_circle_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_surface_circle_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6805,12 +6797,11 @@ void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
ot->name = "Add Surface Patch";
ot->description = "Construct a Nurbs surface Patch";
ot->idname = "SURFACE_OT_primitive_nurbs_surface_surface_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_surface_surface_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6828,12 +6819,11 @@ void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
ot->name = "Add Surface Cylinder";
ot->description = "Construct a Nurbs surface Cylinder";
ot->idname = "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_surface_cylinder_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6851,12 +6841,11 @@ void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
ot->name = "Add Surface Sphere";
ot->description = "Construct a Nurbs surface Sphere";
ot->idname = "SURFACE_OT_primitive_nurbs_surface_sphere_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_surface_sphere_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -6874,12 +6863,11 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
ot->name = "Add Surface Torus";
ot->description = "Construct a Nurbs surface Torus";
ot->idname = "SURFACE_OT_primitive_nurbs_surface_torus_add";
-
+
/* api callbacks */
- ot->invoke = ED_object_add_generic_invoke;
ot->exec = add_primitive_nurbs_surface_torus_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;