forked from bartvdbraak/blender
- remove OBJECT_OT_curve_add
- rename CURVE_OT_primitive_bezier_add --> CURVE_OT_primitive_bezier_curve_add # matches nurbs operator - rename CURVE_OT_primitive_curve_path_add --> CURVE_OT_primitive_nurbs_path_add - fix for warnings from 28923
This commit is contained in:
parent
5664c0397c
commit
a1ada0f21c
@ -206,11 +206,11 @@ class INFO_MT_curve_add(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("curve.primitive_bezier_add", icon='CURVE_BEZCURVE', text="Bezier")
|
||||
layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
|
||||
layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
|
||||
layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
|
||||
layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
|
||||
layout.operator("curve.primitive_curve_path_add", icon='CURVE_PATH', text="Path")
|
||||
layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
|
||||
|
||||
class INFO_MT_armature_add(bpy.types.Menu):
|
||||
bl_idname = "INFO_MT_armature_add"
|
||||
|
@ -85,11 +85,11 @@ void CURVE_OT_tilt_clear(struct wmOperatorType *ot);
|
||||
void CURVE_OT_smooth(struct wmOperatorType *ot);
|
||||
void CURVE_OT_smooth_radius(struct wmOperatorType *ot);
|
||||
|
||||
void CURVE_OT_primitive_bezier_add(struct wmOperatorType *ot);
|
||||
void CURVE_OT_primitive_bezier_curve_add(struct wmOperatorType *ot);
|
||||
void CURVE_OT_primitive_bezier_circle_add(struct wmOperatorType *ot);
|
||||
void CURVE_OT_primitive_nurbs_curve_add(struct wmOperatorType *ot);
|
||||
void CURVE_OT_primitive_nurbs_circle_add(struct wmOperatorType *ot);
|
||||
void CURVE_OT_primitive_curve_path_add(struct wmOperatorType *ot);
|
||||
void CURVE_OT_primitive_nurbs_path_add(struct wmOperatorType *ot);
|
||||
|
||||
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
|
||||
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
|
||||
|
@ -97,11 +97,11 @@ void ED_operatortypes_curve(void)
|
||||
WM_operatortype_append(CURVE_OT_shade_flat);
|
||||
WM_operatortype_append(CURVE_OT_tilt_clear);
|
||||
|
||||
WM_operatortype_append(CURVE_OT_primitive_bezier_add);
|
||||
WM_operatortype_append(CURVE_OT_primitive_bezier_curve_add);
|
||||
WM_operatortype_append(CURVE_OT_primitive_bezier_circle_add);
|
||||
WM_operatortype_append(CURVE_OT_primitive_nurbs_curve_add);
|
||||
WM_operatortype_append(CURVE_OT_primitive_nurbs_circle_add);
|
||||
WM_operatortype_append(CURVE_OT_primitive_curve_path_add);
|
||||
WM_operatortype_append(CURVE_OT_primitive_nurbs_path_add);
|
||||
|
||||
WM_operatortype_append(CURVE_OT_smooth);
|
||||
WM_operatortype_append(CURVE_OT_smooth_radius);
|
||||
@ -185,8 +185,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
|
||||
/* only set in editmode curve, by space_view3d listener */
|
||||
keymap= WM_keymap_find(keyconf, "Curve", 0, 0);
|
||||
keymap->poll= ED_operator_editsurfcurve;
|
||||
|
||||
WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
WM_keymap_add_menu(keymap, "INFO_MT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0);
|
||||
|
@ -5256,7 +5256,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
|
||||
|
||||
return nu;
|
||||
}
|
||||
static int curve_prim_add(bContext *C, wmOperator *op,int type){
|
||||
|
||||
static int curve_prim_add(bContext *C, wmOperator *op, int type){
|
||||
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb;
|
||||
@ -5300,16 +5301,15 @@ static int curve_prim_add(bContext *C, wmOperator *op,int type){
|
||||
|
||||
static int add_primitive_bezier_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (curve_prim_add(C,op,CU_BEZIER|CU_PRIM_CURVE))
|
||||
return OPERATOR_FINISHED;
|
||||
return curve_prim_add(C, op, CU_BEZIER|CU_PRIM_CURVE);
|
||||
}
|
||||
|
||||
void CURVE_OT_primitive_bezier_add(wmOperatorType *ot)
|
||||
void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Bezier";
|
||||
ot->description= "Construct a Bezier Curve";
|
||||
ot->idname= "CURVE_OT_primitive_bezier_add";
|
||||
ot->idname= "CURVE_OT_primitive_bezier_curve_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= ED_object_add_generic_invoke;
|
||||
@ -5324,8 +5324,7 @@ void CURVE_OT_primitive_bezier_add(wmOperatorType *ot)
|
||||
|
||||
static int add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if(curve_prim_add(C,op,CU_BEZIER|CU_PRIM_CIRCLE))
|
||||
return OPERATOR_FINISHED;
|
||||
return curve_prim_add(C, op, CU_BEZIER|CU_PRIM_CIRCLE);
|
||||
}
|
||||
|
||||
void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
|
||||
@ -5348,8 +5347,7 @@ void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
|
||||
|
||||
static int add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if(curve_prim_add(C,op,CU_NURBS|CU_PRIM_CURVE))
|
||||
return OPERATOR_FINISHED;
|
||||
return curve_prim_add(C, op, CU_NURBS|CU_PRIM_CURVE);
|
||||
}
|
||||
|
||||
void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
|
||||
@ -5372,8 +5370,7 @@ void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
|
||||
|
||||
static int add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if(curve_prim_add(C,op,CU_NURBS|CU_PRIM_CIRCLE))
|
||||
return OPERATOR_FINISHED;
|
||||
return curve_prim_add(C, op, CU_NURBS|CU_PRIM_CIRCLE);
|
||||
}
|
||||
|
||||
void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
|
||||
@ -5396,16 +5393,15 @@ void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
|
||||
|
||||
static int add_primitive_curve_path_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if(curve_prim_add(C,op,CU_NURBS|CU_PRIM_PATH))
|
||||
return OPERATOR_FINISHED;
|
||||
return curve_prim_add(C, op, CU_NURBS|CU_PRIM_PATH);
|
||||
}
|
||||
|
||||
void CURVE_OT_primitive_curve_path_add(wmOperatorType *ot)
|
||||
void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Path";
|
||||
ot->description= "Construct a Path";
|
||||
ot->idname= "CURVE_OT_primitive_curve_path_add";
|
||||
ot->idname= "CURVE_OT_primitive_nurbs_path_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= ED_object_add_generic_invoke;
|
||||
|
@ -467,97 +467,6 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
|
||||
|
||||
/* ***************** add primitives *************** */
|
||||
|
||||
static EnumPropertyItem prop_curve_types[] = {
|
||||
{CU_BEZIER|CU_PRIM_CURVE, "BEZIER_CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", ""},
|
||||
{CU_BEZIER|CU_PRIM_CIRCLE, "BEZIER_CIRCLE", ICON_CURVE_BEZCIRCLE, "Bezier Circle", ""},
|
||||
{CU_NURBS|CU_PRIM_CURVE, "NURBS_CURVE", ICON_CURVE_NCURVE, "NURBS Curve", ""},
|
||||
{CU_NURBS|CU_PRIM_CIRCLE, "NURBS_CIRCLE", ICON_CURVE_NCIRCLE, "NURBS Circle", ""},
|
||||
{CU_NURBS|CU_PRIM_PATH, "PATH", ICON_CURVE_PATH, "Path", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static int object_add_curve_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
ListBase *editnurb;
|
||||
Nurb *nu;
|
||||
int newob= 0, type= RNA_enum_get(op->ptr, "type");
|
||||
int enter_editmode;
|
||||
unsigned int layer;
|
||||
float loc[3], rot[3];
|
||||
float mat[4][4];
|
||||
|
||||
object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
|
||||
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer);
|
||||
|
||||
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_flush_update(&obedit->id, OB_RECALC_DATA);
|
||||
|
||||
ED_object_new_primitive_matrix(C, loc, rot, mat);
|
||||
|
||||
nu= add_nurbs_primitive(C, mat, type, newob);
|
||||
editnurb= curve_get_editcurve(obedit);
|
||||
BLI_addtail(editnurb, nu);
|
||||
|
||||
/* userdef */
|
||||
if (newob && !enter_editmode) {
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int object_add_curve_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
Object *obedit= CTX_data_edit_object(C);
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
|
||||
object_add_generic_invoke_options(C, op);
|
||||
|
||||
pup= uiPupMenuBegin(C, op->type->name, 0);
|
||||
layout= uiPupMenuLayout(pup);
|
||||
if(!obedit || obedit->type == OB_CURVE)
|
||||
uiItemsEnumO(layout, op->type->idname, "type");
|
||||
else
|
||||
uiItemsEnumO(layout, "OBJECT_OT_surface_add", "type");
|
||||
uiPupMenuEnd(C, pup);
|
||||
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_curve_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Curve";
|
||||
ot->description = "Add a curve object to the scene";
|
||||
ot->idname= "OBJECT_OT_curve_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= object_add_curve_invoke;
|
||||
ot->exec= object_add_curve_exec;
|
||||
|
||||
ot->poll= ED_operator_scene_editable;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "type", prop_curve_types, 0, "Primitive", "");
|
||||
|
||||
ED_object_add_generic_props(ot, TRUE);
|
||||
}
|
||||
|
||||
static EnumPropertyItem prop_surface_types[]= {
|
||||
{CU_PRIM_CURVE|CU_NURBS, "NURBS_CURVE", ICON_SURFACE_NCURVE, "NURBS Curve", ""},
|
||||
{CU_PRIM_CIRCLE|CU_NURBS, "NURBS_CIRCLE", ICON_SURFACE_NCIRCLE, "NURBS Circle", ""},
|
||||
|
@ -105,7 +105,6 @@ void OBJECT_OT_select_same_group(struct wmOperatorType *ot);
|
||||
/* object_add.c */
|
||||
void OBJECT_OT_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_add_named(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_curve_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_surface_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_metaball_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_text_add(struct wmOperatorType *ot);
|
||||
|
@ -112,7 +112,6 @@ void ED_operatortypes_object(void)
|
||||
WM_operatortype_append(GROUP_OT_objects_remove_active);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_delete);
|
||||
WM_operatortype_append(OBJECT_OT_curve_add);
|
||||
WM_operatortype_append(OBJECT_OT_text_add);
|
||||
WM_operatortype_append(OBJECT_OT_surface_add);
|
||||
WM_operatortype_append(OBJECT_OT_armature_add);
|
||||
|
Loading…
Reference in New Issue
Block a user