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 | |
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.
-rw-r--r-- | release/ui/buttons_data_curve.py | 69 | ||||
-rw-r--r-- | release/ui/space_view3d.py | 24 | ||||
-rw-r--r-- | release/ui/space_view3d_toolbar.py | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 1 | ||||
-rw-r--r-- | source/blender/editors/curve/curve_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 94 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 44 | ||||
-rw-r--r-- | source/blender/editors/space_info/info_stats.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 17 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 17 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_manipulator.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_curve_types.h | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_curve.c | 104 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 7 |
16 files changed, 310 insertions, 119 deletions
diff --git a/release/ui/buttons_data_curve.py b/release/ui/buttons_data_curve.py index 46311493ad3..95f9a98da74 100644 --- a/release/ui/buttons_data_curve.py +++ b/release/ui/buttons_data_curve.py @@ -15,6 +15,14 @@ class DataButtonsPanelCurve(DataButtonsPanel): ''' def poll(self, context): return (context.object and context.object.type == 'CURVE' and context.curve) + +class DataButtonsPanelActive(DataButtonsPanel): + ''' + Same as above but for curves only + ''' + def poll(self, context): + curve = context.curve + return (curve and curve.active_spline) class DATA_PT_context_curve(DataButtonsPanel): __show_header__ = False @@ -46,11 +54,11 @@ class DATA_PT_shape_curve(DataButtonsPanel): space = context.space_data is_surf = (ob.type == 'SURFACE') - row = layout.row() - row.itemR(curve, "curve_2d") - row.itemR(curve, "use_twist_correction") + if not is_surf: + row = layout.row() + row.itemR(curve, "curve_2d") + row.itemR(curve, "use_twist_correction") - split = layout.split() col = split.column() @@ -132,64 +140,71 @@ class DATA_PT_pathanim(DataButtonsPanelCurve): col.itemR(curve, "use_stretch") col.itemR(curve, "use_time_offset", text="Offset Children") -class DATA_PT_current_curve(DataButtonsPanel): - __label__ = "Current Curve" +class DATA_PT_active_spline(DataButtonsPanelActive): + __label__ = "Active Spline" def draw(self, context): layout = self.layout ob = context.object - currentcurve = context.curve.curves[0] # XXX + curve = context.curve + act_spline = curve.active_spline is_surf = (ob.type == 'SURFACE') split = layout.split() col = split.column() col.itemL(text="Cyclic:") - if currentcurve.type == 'NURBS': + if act_spline.type == 'NURBS': col.itemL(text="Bezier:") col.itemL(text="Endpoint:") col.itemL(text="Order:") col.itemL(text="Resolution:") - col = split.column() - col.itemR(currentcurve, "cyclic_u", text="U") + col.itemR(act_spline, "cyclic_u", text="U") - if currentcurve.type == 'NURBS': + if act_spline.type == 'NURBS': sub = col.column() - sub.active = (not currentcurve.cyclic_u) - sub.itemR(currentcurve, "bezier_u", text="U") - sub.itemR(currentcurve, "endpoint_u", text="U") + sub.active = (not act_spline.cyclic_u) + sub.itemR(act_spline, "bezier_u", text="U") + sub.itemR(act_spline, "endpoint_u", text="U") sub = col.column() - sub.itemR(currentcurve, "order_u", text="U") - col.itemR(currentcurve, "resolution_u", text="U") + sub.itemR(act_spline, "order_u", text="U") + col.itemR(act_spline, "resolution_u", text="U") if is_surf: col = split.column() - col.itemR(currentcurve, "cyclic_v", text="V") + col.itemR(act_spline, "cyclic_v", text="V") # its a surface, assume its a nurb. sub = col.column() - sub.active = (not currentcurve.cyclic_v) - sub.itemR(currentcurve, "bezier_v", text="V") - sub.itemR(currentcurve, "endpoint_v", text="V") + sub.active = (not act_spline.cyclic_v) + sub.itemR(act_spline, "bezier_v", text="V") + sub.itemR(act_spline, "endpoint_v", text="V") sub = col.column() - sub.itemR(currentcurve, "resolution_v", text="V") - sub.itemR(currentcurve, "order_v", text="V") + sub.itemR(act_spline, "order_v", text="V") + sub.itemR(act_spline, "resolution_v", text="V") + + + if not is_surf: + split = layout.split() + col = split.column() + col.active = (not curve.curve_2d) + + col.itemL(text="Interpolation:") + col.itemR(act_spline, "tilt_interpolation", text="Tilt") + col.itemR(act_spline, "radius_interpolation", text="Radius") split = layout.split() col = split.column() - col.itemL(text="Interpolation:") - col.itemR(currentcurve, "tilt_interpolation", text="Tilt") - col.itemR(currentcurve, "radius_interpolation", text="Radius") - col.itemR(currentcurve, "smooth") + col.itemR(act_spline, "smooth") bpy.types.register(DATA_PT_context_curve) bpy.types.register(DATA_PT_shape_curve) bpy.types.register(DATA_PT_geometry_curve) bpy.types.register(DATA_PT_pathanim) -bpy.types.register(DATA_PT_current_curve) +bpy.types.register(DATA_PT_active_spline) diff --git a/release/ui/space_view3d.py b/release/ui/space_view3d.py index 4281ff2ccab..bc133cbff48 100644 --- a/release/ui/space_view3d.py +++ b/release/ui/space_view3d.py @@ -1209,12 +1209,35 @@ class VIEW3D_PT_3dview_meshdisplay(bpy.types.Panel): col.itemL(text="Normals:") col.itemR(mesh, "draw_normals", text="Face") col.itemR(mesh, "draw_vertex_normals", text="Vertex") + col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size") col.itemS() col.itemL(text="Numerics:") col.itemR(mesh, "draw_edge_lenght") col.itemR(mesh, "draw_edge_angle") col.itemR(mesh, "draw_face_area") + + +class VIEW3D_PT_3dview_curvedisplay(bpy.types.Panel): + __space_type__ = 'VIEW_3D' + __region_type__ = 'UI' + __label__ = "Curve Display" + + def poll(self, context): + editmesh = context.mode == 'EDIT_CURVE' + return (editmesh) + + def draw(self, context): + layout = self.layout + + curve = context.active_object.data + + col = layout.column() + col.itemL(text="Overlays:") + col.itemR(curve, "draw_handles", text="Handles") + col.itemR(curve, "draw_normals", text="Normals") + col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size") + class VIEW3D_PT_background_image(bpy.types.Panel): __space_type__ = 'VIEW_3D' @@ -1326,4 +1349,5 @@ bpy.types.register(VIEW3D_MT_edit_ARMATURE_roll) bpy.types.register(VIEW3D_PT_3dview_properties) # Panels bpy.types.register(VIEW3D_PT_3dview_display) bpy.types.register(VIEW3D_PT_3dview_meshdisplay) +bpy.types.register(VIEW3D_PT_3dview_curvedisplay) bpy.types.register(VIEW3D_PT_background_image) diff --git a/release/ui/space_view3d_toolbar.py b/release/ui/space_view3d_toolbar.py index 63eceb66ff6..73f97dec750 100644 --- a/release/ui/space_view3d_toolbar.py +++ b/release/ui/space_view3d_toolbar.py @@ -107,6 +107,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel): col.itemO("curve.delete") col.itemO("curve.cyclic_toggle") col.itemO("curve.switch_direction") + col.itemO("curve.spline_type_set") layout.itemL(text="Modeling:") diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 6323258ff43..5d0b89220d5 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -119,7 +119,6 @@ typedef struct Global { #define G_GREASEPENCIL (1 << 17) /* #define G_AUTOMATKEYS (1 << 30) also removed */ -#define G_HIDDENHANDLES (1 << 31) /* used for curves only */ /* G.fileflags */ diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index d3bcdcb69bb..a242e424aa0 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -233,7 +233,7 @@ void ED_keymap_curve(wmWindowManager *wm) WM_keymap_add_item(keymap, "CURVE_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0); - RNA_enum_set(WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, 0, 0)->ptr, "mode", TFM_TILT); + RNA_enum_set(WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT); RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1); RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3); RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 871f00a585c..e346ccafde3 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -86,9 +86,6 @@ /* still need to eradicate a few :( */ #define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name) -/* for curve objects in editmode that can have hidden handles */ -#define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) - float nurbcircle[8][2]= { {0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0}, {0.0, 1.0}, { 1.0, 1.0}, { 1.0, 0.0}, { 1.0, -1.0} @@ -213,7 +210,7 @@ int isNurbsel(Nurb *nu) return 0; } -int isNurbsel_count(Nurb *nu) +int isNurbsel_count(Curve *cu, Nurb *nu) { BezTriple *bezt; BPoint *bp; @@ -223,7 +220,7 @@ int isNurbsel_count(Nurb *nu) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if (BEZSELECTED_HIDDENHANDLES(bezt)) sel++; + if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) sel++; bezt++; } } @@ -269,6 +266,8 @@ void load_editNurb(Object *obedit) if(obedit==NULL) return; + set_actNurb(obedit, NULL); + if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu= obedit->data; Nurb *nu, *newnu; @@ -314,11 +313,13 @@ void load_editNurb(Object *obedit) void make_editNurb(Object *obedit) { ListBase *editnurb= curve_get_editcurve(obedit); - Nurb *nu, *newnu; + Nurb *nu, *newnu, *nu_act= NULL; KeyBlock *actkey; if(obedit==NULL) return; + set_actNurb(obedit, NULL); + if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu= obedit->data; @@ -334,6 +335,12 @@ void make_editNurb(Object *obedit) newnu= duplicateNurb(nu); test2DNurb(newnu); // after join, or any other creation of curve BLI_addtail(editnurb, newnu); + + if (nu_act == NULL && isNurbsel(nu)) { + nu_act= newnu; + set_actNurb(obedit, newnu); + } + nu= nu->next; } @@ -343,8 +350,6 @@ void make_editNurb(Object *obedit) key_to_curve(actkey, cu, editnurb); } } - - set_actNurb(obedit, NULL); } void free_editNurb(Object *obedit) @@ -1609,6 +1614,7 @@ void CURVE_OT_select_all_toggle(wmOperatorType *ot) static int hide_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BPoint *bp; @@ -1621,11 +1627,11 @@ static int hide_exec(bContext *C, wmOperator *op) a= nu->pntsu; sel= 0; while(a--) { - if(invert == 0 && BEZSELECTED_HIDDENHANDLES(bezt)) { + if(invert == 0 && BEZSELECTED_HIDDENHANDLES(cu, bezt)) { select_beztriple(bezt, DESELECT, 1, HIDDEN); bezt->hide= 1; } - else if(invert && !BEZSELECTED_HIDDENHANDLES(bezt)) { + else if(invert && !BEZSELECTED_HIDDENHANDLES(cu, bezt)) { select_beztriple(bezt, DESELECT, 1, HIDDEN); bezt->hide= 1; } @@ -1739,6 +1745,7 @@ void CURVE_OT_reveal(wmOperatorType *ot) static int select_inverse_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BPoint *bp; @@ -1752,7 +1759,7 @@ static int select_inverse_exec(bContext *C, wmOperator *op) while(a--) { if(bezt->hide==0) { bezt->f2 ^= SELECT; /* always do the center point */ - if ((G.f & G_HIDDENHANDLES)==0) { + if((cu->drawflag & CU_HIDE_HANDLES)==0) { bezt->f1 ^= SELECT; bezt->f3 ^= SELECT; } @@ -1803,6 +1810,7 @@ void CURVE_OT_select_inverse(wmOperatorType *ot) static int subdivide_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BezTriple *prevbezt, *bezt, *beztnew, *beztn; @@ -1832,7 +1840,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) bezt= prevbezt+1; } while(a--) { - if( BEZSELECTED_HIDDENHANDLES(prevbezt) && BEZSELECTED_HIDDENHANDLES(bezt) ) amount++; + if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount++; prevbezt= bezt; bezt++; } @@ -1856,7 +1864,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) memcpy(beztn, prevbezt, sizeof(BezTriple)); beztn++; - if( BEZSELECTED_HIDDENHANDLES(prevbezt) && BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { memcpy(beztn, bezt, sizeof(BezTriple)); /* midpoint subdividing */ @@ -2351,14 +2359,14 @@ static int convertspline(short type, Nurb *nu) } } else if(nu->type == CU_BEZIER) { /* Bezier */ - if(type==0 || type==4) { /* to Poly or Nurb */ + if(type==CU_POLY || type==CU_NURBS) { nr= 3*nu->pntsu; nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype"); a= nu->pntsu; bezt= nu->bezt; bp= nu->bp; while(a--) { - if(type==0 && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { + if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { /* vector handle becomes 1 poly vertice */ VECCOPY(bp->vec, bezt->vec[1]); bp->vec[3]= 1.0; @@ -2383,15 +2391,15 @@ static int convertspline(short type, Nurb *nu) bezt++; } MEM_freeN(nu->bezt); - nu->bezt= 0; + nu->bezt= NULL; nu->pntsu= nr; nu->pntsv= 1; nu->orderu= 4; nu->orderv= 1; - nu->type |= type; + nu->type = type; if(nu->flagu & CU_CYCLIC) c= nu->orderu-1; else c= 0; - if(type== 4) { + if(type== CU_NURBS) { nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */ nu->flagu += 4; makeknots(nu, 1); @@ -2464,7 +2472,15 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) } } - return (changed)? OPERATOR_FINISHED: OPERATOR_CANCELLED; + if(changed) { + DAG_id_flush_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } void CURVE_OT_spline_type_set(wmOperatorType *ot) @@ -2472,8 +2488,8 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot) static EnumPropertyItem type_items[]= { {CU_POLY, "POLY", 0, "Poly", ""}, {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, - {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, - {CU_BSPLINE, "B_SPLINE", 0, "B-Spline", ""}, +// {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, +// {CU_BSPLINE, "B_SPLINE", 0, "B-Spline", ""}, {CU_NURBS, "NURBS", 0, "NURBS", ""}, {0, NULL, 0, NULL, NULL}}; @@ -2483,6 +2499,7 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot) /* api callbacks */ ot->exec= set_spline_type_exec; + ot->invoke= WM_menu_invoke; ot->poll= ED_operator_editcurve; /* flags */ @@ -2866,6 +2883,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) { /* joins 2 curves */ Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu, *nu1=0, *nu2=0; BezTriple *bezt; @@ -2881,8 +2899,8 @@ static int make_segment_exec(bContext *C, wmOperator *op) if( isNurbsel(nu) ) { if(nu->pntsu>1 && nu->pntsv>1) break; - if(isNurbsel_count(nu)>1) break; - if(isNurbsel_count(nu)==1) { + if(isNurbsel_count(cu, nu)>1) break; + if(isNurbsel_count(cu, nu)==1) { /* only 1 selected, not first or last, a little complex, but intuitive */ if(nu->pntsv==1) { if( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT)); @@ -2902,23 +2920,23 @@ static int make_segment_exec(bContext *C, wmOperator *op) if(nu->type == CU_BEZIER) { bezt= nu->bezt; if(nu1==0) { - if( BEZSELECTED_HIDDENHANDLES(bezt) ) nu1= nu; + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) nu1= nu; else { bezt= bezt+(nu->pntsu-1); - if( BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { nu1= nu; switchdirectionNurb(nu); } } } else if(nu2==0) { - if( BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { nu2= nu; switchdirectionNurb(nu); } else { bezt= bezt+(nu->pntsu-1); - if( BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { nu2= nu; } } @@ -3039,8 +3057,8 @@ void CURVE_OT_make_segment(wmOperatorType *ot) void mouse_nurb(bContext *C, short mval[2], int extend) { Object *obedit= CTX_data_edit_object(C); - ListBase *editnurb= curve_get_editcurve(obedit); Curve *cu= obedit->data; + ListBase *editnurb= curve_get_editcurve(obedit); ViewContext vc; Nurb *nu; BezTriple *bezt=0; @@ -3417,12 +3435,13 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) static int extrude_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; /* first test: curve? */ for(nu= editnurb->first; nu; nu= nu->next) - if(nu->pntsv==1 && isNurbsel_count(nu)==1) + if(nu->pntsv==1 && isNurbsel_count(cu, nu)==1) break; if(obedit->type==OB_CURVE || nu) { @@ -3473,6 +3492,7 @@ void CURVE_OT_extrude(wmOperatorType *ot) static int toggle_cyclic_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BezTriple *bezt; @@ -3496,7 +3516,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) a= nu->pntsu; bezt= nu->bezt; while(a--) { - if( BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { nu->flagu ^= CU_CYCLIC; break; } @@ -3674,8 +3694,8 @@ void CURVE_OT_select_linked(wmOperatorType *ot) static int select_row_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - ListBase *editnurb= curve_get_editcurve(obedit); Curve *cu= obedit->data; + ListBase *editnurb= curve_get_editcurve(obedit); static BPoint *last=0; static int direction=0; Nurb *nu; @@ -4224,6 +4244,7 @@ void CURVE_OT_duplicate(wmOperatorType *ot) static int delete_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu, *next, *nu1; BezTriple *bezt, *bezt1, *bezt2; @@ -4250,7 +4271,7 @@ static int delete_exec(bContext *C, wmOperator *op) a= nu->pntsu; if(a) { while(a) { - if( BEZSELECTED_HIDDENHANDLES(bezt) ); + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ); else break; a--; bezt++; @@ -4295,7 +4316,7 @@ static int delete_exec(bContext *C, wmOperator *op) if(nu->type == CU_BEZIER) { bezt= nu->bezt; for(a=0;a<nu->pntsu;a++) { - if( BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { memmove(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple)); nu->pntsu--; a--; @@ -4355,7 +4376,7 @@ static int delete_exec(bContext *C, wmOperator *op) if(nu->type == CU_BEZIER) { bezt= nu->bezt; for(a=0; a<nu->pntsu-1; a++) { - if( BEZSELECTED_HIDDENHANDLES(bezt) ) { + if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { bezt1= bezt; bezt2= bezt+1; if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ; @@ -4706,7 +4727,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) cent[2]-= obedit->obmat[3][2]; if(rv3d) { - if (!(newname) || U.flag & USER_ADD_VIEWALIGNED || !rv3d) + if (!(newname) || U.flag & USER_ADD_VIEWALIGNED) Mat3CpyMat4(imat, rv3d->viewmat); else Mat3One(imat); @@ -5087,6 +5108,7 @@ Nurb *add_nurbs_primitive(bContext *C, int type, int newname) static int clear_tilt_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); + Curve *cu= obedit->data; ListBase *editnurb= curve_get_editcurve(obedit); Nurb *nu; BezTriple *bezt; @@ -5098,7 +5120,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *op) bezt= nu->bezt; a= nu->pntsu; while(a--) { - if(BEZSELECTED_HIDDENHANDLES(bezt)) bezt->alfa= 0.0; + if(BEZSELECTED_HIDDENHANDLES(cu, bezt)) bezt->alfa= 0.0; bezt++; } } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index af37cd87254..799829a6e87 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -433,9 +433,6 @@ void ED_nla_postop_refresh(bAnimContext *ac); /* ------------- Utility macros ----------------------- */ -/* checks if the given BezTriple is selected */ -#define BEZSELECTED(bezt) (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT)) - /* provide access to Keyframe Type info in BezTriple * NOTE: this is so that we can change it from being stored in 'hide' */ 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 */ diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 7acebbdb72e..60cac0a00fa 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -184,7 +184,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) stats->totvert+=2; } } - else if ELEM3(obedit->type, OB_CURVE, OB_SURF, OB_FONT) { + else if ELEM(obedit->type, OB_CURVE, OB_SURF) { /* OB_FONT has no cu->editnurb */ /* Curve Edit */ Curve *cu= obedit->data; Nurb *nu; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 220952d190f..001021e8d4b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1397,7 +1397,8 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb BezTriple *bezt = &nu->bezt[i]; if(bezt->hide==0) { - if (G.f & G_HIDDENHANDLES) { + + if(cu->drawflag & CU_HIDE_HANDLES) { view3d_project_short_clip(vc->ar, bezt->vec[1], s); if (s[0] != IS_CLIPPED) func(userData, nu, NULL, bezt, 1, s[0], s[1]); @@ -2797,7 +2798,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if(solid) { dl= lb->first; if(dl==NULL) return 1; - + if(dl->nors==0) addnormalsDispList(ob, lb); index3_nors_incr= 0; @@ -2838,7 +2839,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } break; case OB_SURF: - + lb= &((Curve *)ob->data)->disp; if(solid) { @@ -3877,14 +3878,14 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj unsigned int nurbcol[8]= { 0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 }; -static void tekenhandlesN(Nurb *nu, short sel) +static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; float *fp; unsigned int *col; int a; - if(nu->hide || (G.f & G_HIDDENHANDLES)) return; + if(nu->hide || hide_handles) return; glBegin(GL_LINES); @@ -3928,7 +3929,7 @@ static void tekenhandlesN(Nurb *nu, short sel) glEnd(); } -static void tekenvertsN(Nurb *nu, short sel) +static void tekenvertsN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; BPoint *bp; @@ -3951,7 +3952,7 @@ static void tekenvertsN(Nurb *nu, short sel) a= nu->pntsu; while(a--) { if(bezt->hide==0) { - if (G.f & G_HIDDENHANDLES) { + if (hide_handles) { if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]); } else { if((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]); @@ -4083,6 +4084,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Curve *cu = ob->data; Nurb *nu; BevList *bl; + short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); // XXX retopo_matrix_update(v3d); @@ -4095,22 +4097,24 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* first non-selected handles */ for(nu=nurb; nu; nu=nu->next) { if(nu->type == CU_BEZIER) { - tekenhandlesN(nu, 0); + tekenhandlesN(nu, 0, hide_handles); } } draw_editnurb(ob, nurb, 0); draw_editnurb(ob, nurb, 1); /* selected handles */ for(nu=nurb; nu; nu=nu->next) { - if(nu->type == CU_BEZIER) tekenhandlesN(nu, 1); - tekenvertsN(nu, 0); + if(nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES)==0) + tekenhandlesN(nu, 1, hide_handles); + tekenvertsN(nu, 0, hide_handles); } if(v3d->zbuf) glEnable(GL_DEPTH_TEST); /* direction vectors for 3d curve paths when at its lowest, dont render normals */ - if(cu->flag & CU_3D && ts->normalsize > 0.0015) { + if(cu->flag & CU_3D && ts->normalsize > 0.0015 && (cu->drawflag & CU_HIDE_NORMALS)==0) { + UI_ThemeColor(TH_WIRE); for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) { BevPoint *bevp= (BevPoint *)(bl+1); @@ -4145,7 +4149,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, if(v3d->zbuf) glDisable(GL_DEPTH_TEST); for(nu=nurb; nu; nu=nu->next) { - tekenvertsN(nu, 1); + tekenvertsN(nu, 1, hide_handles); } if(v3d->zbuf) glEnable(GL_DEPTH_TEST); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 42954e09060..a7696d9fe31 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -549,13 +549,15 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct { short (*mcords)[2]; short moves; short select; } *data = userData; - + struct { ViewContext vc; short (*mcords)[2]; short moves; short select; } *data = userData; + if (lasso_inside(data->mcords, data->moves, x, y)) { if (bp) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } else { - if (G.f & G_HIDDENHANDLES) { + Curve *cu= data->vc.obedit->data; + + if (cu->drawflag & CU_HIDE_HANDLES) { /* can only be beztindex==0 here since handles are hidden */ bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT); } else { @@ -573,9 +575,10 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short moves, short select) { - struct { short (*mcords)[2]; short moves; short select; } data; + struct { ViewContext vc; short (*mcords)[2]; short moves; short select; } data; /* set vc->editnurb */ + data.vc = *vc; data.mcords = mcords; data.moves = moves; data.select = select; @@ -1196,7 +1199,9 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, if (bp) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } else { - if (G.f & G_HIDDENHANDLES) { + Curve *cu= data->vc.obedit->data; + + if (cu->drawflag & CU_HIDE_HANDLES) { /* can only be beztindex==0 here since handles are hidden */ bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT); } else { @@ -1215,7 +1220,7 @@ static void do_nurbs_box_select(ViewContext *vc, rcti *rect, int select) { struct { ViewContext vc; rcti *rect; int select; } data; - data.vc= *vc; + data.vc = *vc; data.rect = rect; data.select = select; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index d86eddd0a64..504563b797b 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1367,7 +1367,8 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) int a; int count=0, countsel=0; int propmode = t->flag & T_PROP_EDIT; - + short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); + /* to be sure */ if(cu->editnurb==NULL) return; @@ -1376,7 +1377,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) if(nu->type == CU_BEZIER) { for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) { if(bezt->hide==0) { - if (G.f & G_HIDDENHANDLES) { + if (hide_handles) { if(bezt->f2 & SELECT) countsel+=3; if(propmode) count+= 3; } else { @@ -1417,13 +1418,13 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) TransDataCurveHandleFlags *hdata = NULL; if( propmode || - ((bezt->f2 & SELECT) && (G.f & G_HIDDENHANDLES)) || - ((bezt->f1 & SELECT) && (G.f & G_HIDDENHANDLES)==0) + ((bezt->f2 & SELECT) && hide_handles) || + ((bezt->f1 & SELECT) && hide_handles == 0) ) { VECCOPY(td->iloc, bezt->vec[0]); td->loc= bezt->vec[0]; VECCOPY(td->center, bezt->vec[1]); - if (G.f & G_HIDDENHANDLES) { + if (hide_handles) { if(bezt->f2 & SELECT) td->flag= TD_SELECTED; else td->flag= 0; } else { @@ -1478,13 +1479,13 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) tail++; } if( propmode || - ((bezt->f2 & SELECT) && (G.f & G_HIDDENHANDLES)) || - ((bezt->f3 & SELECT) && (G.f & G_HIDDENHANDLES)==0) + ((bezt->f2 & SELECT) && hide_handles) || + ((bezt->f3 & SELECT) && hide_handles == 0) ) { VECCOPY(td->iloc, bezt->vec[2]); td->loc= bezt->vec[2]; VECCOPY(td->center, bezt->vec[1]); - if (G.f & G_HIDDENHANDLES) { + if (hide_handles) { if(bezt->f2 & SELECT) td->flag= TD_SELECTED; else td->flag= 0; } else { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 9fa20c2d674..93bc02d7180 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -260,7 +260,7 @@ int calc_manipulator_stats(const bContext *C) * if handles are hidden then only check the center points. * If 2 or more are selected then only use the center point too. */ - if (G.f & G_HIDDENHANDLES) { + if (cu->drawflag & CU_HIDE_HANDLES) { if (bezt->f2 & SELECT) { calc_tw_center(scene, bezt->vec[1]); totsel++; diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index 8cf9fbbaf40..fe601eefa32 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -145,7 +145,7 @@ typedef struct Curve { struct BoundBox *bb; - ListBase nurb; /* actual data */ + ListBase nurb; /* actual data, called splines in rna */ ListBase disp; ListBase *editnurb; /* edited data, not in file, use pointer so we can check for it */ @@ -163,7 +163,9 @@ typedef struct Curve { float size[3]; float rot[3]; - int texflag; + int texflag; /* keep an int because of give_obdata_texspace() */ + + short drawflag, pad[3]; short pathlen, totcol; short flag, bevresol; @@ -211,6 +213,10 @@ typedef struct Curve { /* texflag */ #define CU_AUTOSPACE 1 +/* drawflag */ +#define CU_HIDE_HANDLES (1 << 0) +#define CU_HIDE_NORMALS (1 << 1) + /* flag */ #define CU_3D 1 #define CU_FRONT 2 @@ -289,6 +295,10 @@ typedef enum eBezTriple_KeyframeType { BEZT_KEYTYPE_BREAKDOWN, /* 'breakdown' keyframe */ } eBezTriple_KeyframeType; +/* checks if the given BezTriple is selected */ +#define BEZSELECTED(bezt) (((bezt)->f2 & SELECT) || ((bezt)->f1 & SELECT) || ((bezt)->f3 & SELECT)) +#define BEZSELECTED_HIDDENHANDLES(cu, bezt) (((cu)->drawflag & CU_HIDE_HANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt)) + /* *************** CHARINFO **************** */ /* flag */ diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 7de5976e12c..3fbdf7aaf7d 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -35,6 +35,8 @@ #include "BKE_font.h" +#include "WM_types.h" + EnumPropertyItem beztriple_handle_type_items[] = { {HD_FREE, "FREE", 0, "Free", ""}, {HD_AUTO, "AUTO", 0, "Auto", ""}, @@ -63,7 +65,6 @@ EnumPropertyItem beztriple_keyframe_type_items[] = { #include "BKE_main.h" #include "WM_api.h" -#include "WM_types.h" StructRNA *rna_Curve_refine(PointerRNA *ptr) { @@ -75,6 +76,22 @@ StructRNA *rna_Curve_refine(PointerRNA *ptr) else return &RNA_Curve; } + +static PointerRNA rna_Curve_active_nurb_get(PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->data; + Nurb *nu= NULL; + + if(cu->editnurb) + nu = BLI_findlink(cu->editnurb, cu->actnu); + + if(nu) + return rna_pointer_inherit_refine(ptr, &RNA_Nurb, nu); + + return rna_pointer_inherit_refine(ptr, NULL, NULL); +} + + static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values) { BezTriple *bt= (BezTriple*)ptr->data; @@ -145,18 +162,22 @@ static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max) static void rna_Curve_2d_set(PointerRNA *ptr, int value) { Curve *cu= (Curve*)ptr->id.data; - Nurb *nu; + Nurb *nu= cu->editnurb ? cu->editnurb->first : cu->nurb.first; if(value) { cu->flag &= ~CU_3D; - for(nu= cu->nurb.first; nu; nu= nu->next) { + for( ; nu; nu= nu->next) { nu->flag |= CU_2D; test2DNurb(nu); + + /* since the handles are moved they need to be auto-located again */ + if(nu->type == CU_BEZIER) + calchandlesNurb(nu); } } else { cu->flag |= CU_3D; - for(nu= cu->nurb.first; nu; nu= nu->next) { + for( ; nu; nu= nu->next) { nu->flag &= ~CU_2D; } } @@ -190,6 +211,39 @@ static void rna_Curve_update_data(bContext *C, PointerRNA *ptr) DAG_id_flush_update(id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, id); } + +static void rna_Nurb_update_handle_data(bContext *C, PointerRNA *ptr) +{ + Nurb *nu= (Nurb*)ptr->data; + + if(nu->type == CU_BEZIER) + calchandlesNurb(nu); + + rna_Curve_update_data(C, ptr); +} + +static void rna_Nurb_update_knot_u(bContext *C, PointerRNA *ptr) +{ + Nurb *nu= (Nurb*)ptr->data; + + clamp_nurb_order_u(nu); + makeknots(nu, 1); + + rna_Curve_update_data(C, ptr); +} + +static void rna_Nurb_update_knot_v(bContext *C, PointerRNA *ptr) +{ + Nurb *nu= (Nurb*)ptr->data; + + clamp_nurb_order_v(nu); + makeknots(nu, 2); + + rna_Curve_update_data(C, ptr); +} + + + #else static void rna_def_bpoint(BlenderRNA *brna) @@ -615,10 +669,26 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "key"); RNA_def_property_ui_text(prop, "Shape Keys", ""); - prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL); RNA_def_property_struct_type(prop, "Nurb"); - RNA_def_property_ui_text(prop, "Curves", "Collection of curves in this curve data object."); + RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object."); + + prop= RNA_def_property(srna, "active_spline", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Nurb"); + RNA_def_property_pointer_funcs(prop, "rna_Curve_active_nurb_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Active Spline", "The active editmode spline"); + + + prop= RNA_def_property(srna, "draw_handles", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES); + RNA_def_property_ui_text(prop, "Draw Handles", "Display bezier handles in editmode."); + RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); + + prop= RNA_def_property(srna, "draw_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_NORMALS); + RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode."); + RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); rna_def_path(brna, srna); @@ -738,18 +808,18 @@ static void rna_def_curve_nurb(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "Nurb", NULL); - RNA_def_struct_ui_text(srna, "Nurb", "Element of a curve, either Nurb, Bezier or Polyline or a character with text objects."); + RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either Nurbs, Bezier or Polyline or a character with text objects."); prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); RNA_def_property_struct_type(prop, "CurvePoint"); RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0, 0, 0); - RNA_def_property_ui_text(prop, "Points", "Collection of points for Poly and Nurbs curves."); + RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline."); prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "BezierCurvePoint"); RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu"); - RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points bezier curves only."); + RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for bezier curves only."); prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE); @@ -787,14 +857,14 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderu"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order U", "Nurbs order in the U direction (For curves and surfaces), Higher values let points influence a greater area"); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_ui_text(prop, "Order U", "Nurbs order in the U direction (For splines and surfaces), Higher values let points influence a greater area"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderv"); RNA_def_property_range(prop, 2, 6); RNA_def_property_ui_text(prop, "Order V", "Nurbs order in the V direction (For surfaces only), Higher values let points influence a greater area"); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE); @@ -812,7 +882,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "cyclic_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_CYCLIC); RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction."); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */ prop= RNA_def_property(srna, "cyclic_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_CYCLIC); @@ -824,22 +894,22 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "endpoint_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagu", 2); RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled)."); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "endpoint_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", 2); RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)."); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); prop= RNA_def_property(srna, "bezier_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagu", 4); RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)."); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "bezier_v", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flagv", 4); RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)."); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); prop= RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bd29443646d..f196001cc9d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -458,6 +458,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_mode_items); RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode."); + prop= RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "normalsize"); + RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view."); + RNA_def_property_range(prop, 0.00001, 1000.0); + RNA_def_property_ui_range(prop, 0.01, 10.0, 0.1, 2); + RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); + prop= RNA_def_property(srna, "automerge_editing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0); RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location."); |