diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-09-08 11:35:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-09-08 11:35:07 +0400 |
commit | 1d0a567023d89b4e397800eeb164512b40336184 (patch) | |
tree | f74e408485e26ad12428ab69d7a73621e59583c2 /source/blender/editors/object | |
parent | fab4bf0816834744664858cdcca96792a6225ca3 (diff) |
Curve/Surface Editing
- rename "Nurb" to "Spline" in RNA, eg. bpy.data.curves[0].splines[2].type == 'NURBS'
from a user perspective spline is a more generic term while Nurb is misleading when used for beziers and poly lines.
- added curve.active_spline property so the python UI can display the last selected curve.
- set the active spline when entering editmode (uses first selected spline)
- added back Hide Handles as a curve property (removed the global flag), access from the view panel in editmode.
- added hide normal option for curve, normal size access for curve and mesh display.
- changing orderU/V, endpoints, cyclic, bezierU/V now work in editmode and calls update functions.
- entering editmode was crashing with text objects
- curve.switch_direction() crashed (own fault from last commit)
- Tkey for tilt was overridden by Toolbar, made Tilt Ctrl+T.
- OBJECT_OT_mode_set check for compatible modes before running - so curves dont try go into paint mode with V key for eg.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 9e61bbd3fb5..31a604a79df 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -2756,13 +2756,12 @@ void OBJECT_OT_slowparent_clear(wmOperatorType *ot) } /* ******************** **************** */ -// XXX -#define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) /* only in edit mode */ void make_vertex_parent(Scene *scene, Object *obedit, View3D *v3d) { EditVert *eve; Base *base; + Curve *cu= obedit->data; Nurb *nu; BezTriple *bezt; BPoint *bp; @@ -2799,7 +2798,7 @@ void make_vertex_parent(Scene *scene, Object *obedit, View3D *v3d) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(BEZSELECTED_HIDDENHANDLES(bezt)) { + if(BEZSELECTED_HIDDENHANDLES(cu, bezt)) { if(v1==0) v1= nr; else if(v2==0) v2= nr; else if(v3==0) v3= nr; @@ -7264,6 +7263,43 @@ static const char *object_mode_op_string(int mode) return NULL; } +/* checks the mode to be set is compatible with the object + * should be made into a generic function */ +static int object_mode_set_compat(bContext *C, wmOperator *op, Object *ob) +{ + ObjectMode mode = RNA_enum_get(op->ptr, "mode"); + + if(ob) { + switch(ob->type) { + case OB_EMPTY: + case OB_LAMP: + case OB_CAMERA: + if(mode & OB_MODE_OBJECT) + return 1; + return 0; + case OB_MESH: + if(mode & ( OB_MODE_OBJECT|OB_MODE_EDIT|OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT)) + return 1; + return 0; + case OB_CURVE: + case OB_SURF: + case OB_FONT: + case OB_MBALL: + if(mode & (OB_MODE_OBJECT|OB_MODE_EDIT)) + return 1; + return 0; + case OB_LATTICE: + if(mode & (OB_MODE_OBJECT|OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT)) + return 1; + case OB_ARMATURE: + if(mode & (OB_MODE_OBJECT|OB_MODE_EDIT|OB_MODE_POSE)) + return 1; + } + } + + return 0; +} + static int object_mode_set_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_active_object(C); @@ -7271,7 +7307,7 @@ static int object_mode_set_exec(bContext *C, wmOperator *op) ObjectMode restore_mode = ob->mode; int toggle = RNA_boolean_get(op->ptr, "toggle"); - if(!ob) + if(!ob || !object_mode_set_compat(C, op, ob)) return OPERATOR_CANCELLED; /* Exit current mode if it's not the mode we're setting */ |