diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-15 13:16:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-15 13:16:39 +0400 |
commit | 917714acf72340bbea363c81773887c6c532c7d8 (patch) | |
tree | f987aa296bb053949b2dbecf7931f4a73dc3a2db /source/blender/editors | |
parent | 3bb9c4adf985aff5e8e213807f3db0d7cd7556e7 (diff) | |
parent | 5c93135ef9a1e7265ead3b92b10ea9a4ef82b909 (diff) |
svn merge ^/trunk/blender -r43345:43381
Diffstat (limited to 'source/blender/editors')
40 files changed, 293 insertions, 511 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index aa61afbac78..5b246e63a20 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -277,78 +277,12 @@ static void ANIM_OT_previewrange_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -/* ****************** time display toggle operator ****************************/ - -static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *curarea= CTX_wm_area(C); - - if (curarea == NULL) - return OPERATOR_CANCELLED; - - /* simply toggle draw frames flag in applicable spaces */ - // XXX or should relevant spaces define their own version of this? - switch (curarea->spacetype) { - case SPACE_TIME: /* TimeLine */ - { - SpaceTime *stime= CTX_wm_space_time(C); - stime->flag ^= TIME_DRAWFRAMES; - } - break; - case SPACE_ACTION: /* Action Editor */ - { - SpaceAction *saction= CTX_wm_space_action(C); - saction->flag ^= SACTION_DRAWTIME; - } - break; - case SPACE_IPO: /* Graph Editor */ - { - SpaceIpo *sipo= CTX_wm_space_graph(C); - sipo->flag ^= SIPO_DRAWTIME; - } - break; - case SPACE_NLA: /* NLA Editor */ - { - SpaceNla *snla= CTX_wm_space_nla(C); - snla->flag ^= SNLA_DRAWTIME; - } - break; - case SPACE_SEQ: /* Sequencer */ - { - SpaceSeq *sseq= CTX_wm_space_seq(C); - sseq->flag ^= SEQ_DRAWFRAMES; - } - break; - - default: /* editor doesn't show frames */ - return OPERATOR_CANCELLED; // XXX or should we pass through instead? - } - - ED_area_tag_redraw(curarea); - - return OPERATOR_FINISHED; -} - -static void ANIM_OT_time_toggle(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Toggle Frames/Seconds"; - ot->idname= "ANIM_OT_time_toggle"; - ot->description= "Toggle whether timing is displayed in frames or seconds for active timeline view"; - - /* api callbacks */ - ot->exec= toggle_time_exec; - - ot->poll= ED_operator_animview_active; -} - /* ************************** registration **********************************/ void ED_operatortypes_anim(void) { /* Animation Editors only -------------------------- */ WM_operatortype_append(ANIM_OT_change_frame); - WM_operatortype_append(ANIM_OT_time_toggle); WM_operatortype_append(ANIM_OT_previewrange_set); WM_operatortype_append(ANIM_OT_previewrange_clear); @@ -382,11 +316,14 @@ void ED_operatortypes_anim(void) void ED_keymap_anim(wmKeyConfig *keyconf) { wmKeyMap *keymap= WM_keymap_find(keyconf, "Animation", 0, 0); + wmKeyMapItem *kmi; /* frame management */ /* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons */ WM_keymap_add_item(keymap, "ANIM_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0); - WM_keymap_verify_item(keymap, "ANIM_OT_time_toggle", TKEY, KM_PRESS, KM_CTRL, 0); + + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TKEY, KM_PRESS, KM_CTRL, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_seconds"); /* preview range */ WM_keymap_verify_item(keymap, "ANIM_OT_previewrange_set", PKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 87254c20c0f..40d909380a0 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -99,7 +99,6 @@ void POSE_OT_copy(struct wmOperatorType *ot); void POSE_OT_paste(struct wmOperatorType *ot); void POSE_OT_select_all(struct wmOperatorType *ot); -void POSE_OT_select_inverse(struct wmOperatorType *ot); void POSE_OT_select_parent(struct wmOperatorType *ot); void POSE_OT_select_hierarchy(struct wmOperatorType *ot); void POSE_OT_select_linked(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index d559aef6fe2..c4bd9382939 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -114,7 +114,6 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSE_OT_paste); WM_operatortype_append(POSE_OT_select_all); - WM_operatortype_append(POSE_OT_select_inverse); WM_operatortype_append(POSE_OT_select_parent); WM_operatortype_append(POSE_OT_select_hierarchy); @@ -322,7 +321,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "flipped", 1); WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "POSE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(WM_keymap_add_item(keymap, "POSE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d751bf89176..11f07e3051e 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -5031,38 +5031,6 @@ void POSE_OT_transforms_clear(wmOperatorType *ot) /* ***************** selections ********************** */ -static int pose_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) -{ - - /* Set the flags */ - CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) - { - if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) { - pchan->bone->flag ^= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL); - } - } - CTX_DATA_END; - - WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, NULL); - - return OPERATOR_FINISHED; -} - -void POSE_OT_select_inverse(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Select Inverse"; - ot->idname= "POSE_OT_select_inverse"; - ot->description= "Flip the selection status of bones (selected -> unselected, unselected -> selected)"; - - /* api callbacks */ - ot->exec= pose_select_inverse_exec; - ot->poll= ED_operator_posemode; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - -} static int pose_de_select_all_exec(bContext *C, wmOperator *op) { int action = RNA_enum_get(op->ptr, "action"); diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 3287ebfb92f..2014345e163 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -106,7 +106,6 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(struct wmOperatorType *ot); void CURVE_OT_de_select_first(struct wmOperatorType *ot); void CURVE_OT_de_select_last(struct wmOperatorType *ot); void CURVE_OT_select_all(struct wmOperatorType *ot); -void CURVE_OT_select_inverse(struct wmOperatorType *ot); void CURVE_OT_select_linked(struct wmOperatorType *ot); void CURVE_OT_select_linked_pick(struct wmOperatorType *ot); void CURVE_OT_select_row(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 1384b86065b..cef86c8d1d3 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -116,7 +116,6 @@ void ED_operatortypes_curve(void) WM_operatortype_append(CURVE_OT_de_select_first); WM_operatortype_append(CURVE_OT_de_select_last); WM_operatortype_append(CURVE_OT_select_all); - WM_operatortype_append(CURVE_OT_select_inverse); WM_operatortype_append(CURVE_OT_select_linked); WM_operatortype_append(CURVE_OT_select_linked_pick); WM_operatortype_append(CURVE_OT_select_row); @@ -224,10 +223,11 @@ void ED_keymap_curve(wmKeyConfig *keyconf) 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); + RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "CURVE_OT_select_row", RKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "CURVE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "CURVE_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 2f5272e37b0..9326e0cbf55 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2749,64 +2749,6 @@ void CURVE_OT_reveal(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -/********************** select invert operator *********************/ - -static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; - ListBase *editnurb= object_editcurve_get(obedit); - Nurb *nu; - BPoint *bp; - BezTriple *bezt; - int a; - - cu->lastsel= NULL; - - for(nu= editnurb->first; nu; nu= nu->next) { - if(nu->type == CU_BEZIER) { - bezt= nu->bezt; - a= nu->pntsu; - while(a--) { - if(bezt->hide==0) { - bezt->f2 ^= SELECT; /* always do the center point */ - if((cu->drawflag & CU_HIDE_HANDLES)==0) { - bezt->f1 ^= SELECT; - bezt->f3 ^= SELECT; - } - } - bezt++; - } - } - else { - bp= nu->bp; - a= nu->pntsu*nu->pntsv; - while(a--) { - swap_selection_bpoint(bp); - bp++; - } - } - } - - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); - - return OPERATOR_FINISHED; -} - -void CURVE_OT_select_inverse(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Select Inverse"; - ot->idname= "CURVE_OT_select_inverse"; - - /* api callbacks */ - ot->exec= select_inverse_exec; - ot->poll= ED_operator_editsurfcurve; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - /********************** subdivide operator *********************/ /** Divide the line segments associated with the currently selected diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 959deecd990..362fc9fcef9 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -270,8 +270,8 @@ int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); -struct ARegion *ED_view3d_context_region_unlock(struct bContext *C); -int ED_operator_rv3d_unlock_poll(struct bContext *C); +int ED_view3d_context_user_region(struct bContext *C, struct View3D **v3d_r, struct ARegion **ar_r); +int ED_operator_rv3d_user_region_poll(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index e4cc605e3f5..e31d7e39d89 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -444,7 +444,7 @@ extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *r /* interface_draw.c */ extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); -void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha); +void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha); void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index bf2f66e95f8..f5c62f65512 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -130,9 +130,12 @@ typedef struct uiWidgetType { static float cornervec[WIDGET_CURVE_RESOLU][2]= {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}}; -static float jit[8][2]= {{0.468813 , -0.481430}, {-0.155755 , -0.352820}, -{0.219306 , -0.238501}, {-0.393286 , -0.110949}, {-0.024699 , 0.013908}, -{0.343805 , 0.147431}, {-0.272855 , 0.269918}, {0.095909 , 0.388710}}; +#define WIDGET_AA_JITTER 8 +static float jit[WIDGET_AA_JITTER][2]= { + { 0.468813 , -0.481430}, {-0.155755 , -0.352820}, + { 0.219306 , -0.238501}, {-0.393286 , -0.110949}, + {-0.024699 , 0.013908}, { 0.343805 , 0.147431}, + {-0.272855 , 0.269918}, { 0.095909 , 0.388710}}; static float num_tria_vert[3][2]= { {-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}}; @@ -192,7 +195,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y glVertexPointer(2, GL_FLOAT, 0, tri_arr); /* for each AA step */ - for(j=0; j<8; j++) { + for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); glDrawArrays(GL_TRIANGLES, 0, 3); glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); @@ -212,7 +215,7 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m color[3] *= 0.125f; glColor4fv(color); - for(j=0; j<8; j++) { + for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); uiDrawBox(mode, minx, miny, maxx, maxy, rad); glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); @@ -749,6 +752,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */ float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */ + const unsigned char tcol[4] = {wcol->outline[0], + wcol->outline[1], + wcol->outline[2], + UCHAR_MAX / WIDGET_AA_JITTER}; + widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip); if(wtb->emboss) { @@ -757,11 +765,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) glEnableClientState(GL_VERTEX_ARRAY); - for(j=0; j<8; j++) { + for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); /* outline */ - glColor4ub(wcol->outline[0], wcol->outline[1], wcol->outline[2], 32); + glColor4ubv(tcol); glVertexPointer(2, GL_FLOAT, 0, quad_strip); glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2); @@ -782,16 +790,20 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) /* decoration */ if(wtb->tria1.tot || wtb->tria2.tot) { + const unsigned char tcol[4] = {wcol->item[0], + wcol->item[1], + wcol->item[2], + (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)}; /* for each AA step */ - for(j=0; j<8; j++) { + for (j = 0; j < WIDGET_AA_JITTER; j++) { glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); if(wtb->tria1.tot) { - glColor4ub(wcol->item[0], wcol->item[1], wcol->item[2], 32); + glColor4ubv(tcol); widget_trias_draw(&wtb->tria1); } if(wtb->tria2.tot) { - glColor4ub(wcol->item[0], wcol->item[1], wcol->item[2], 32); + glColor4ubv(tcol); widget_trias_draw(&wtb->tria2); } @@ -1875,7 +1887,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* ************ custom buttons, old stuff ************** */ /* draws in resolution of 20x4 colors */ -void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) +void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha) { int a; float h= hsv[0], s= hsv[1], v= hsv[2]; @@ -2489,10 +2501,8 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat if (color_profile) linearrgb_to_srgb_v3_v3(col, col); - wcol->inner[0]= FTOCHAR(col[0]); - wcol->inner[1]= FTOCHAR(col[1]); - wcol->inner[2]= FTOCHAR(col[2]); - wcol->inner[3]= FTOCHAR(col[3]); + F4TOCHAR4(col, wcol->inner); + wcol->shaded = 0; wcol->alpha_check = (wcol->inner[3] < 255); diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 0a118903758..97e4132482d 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -1688,34 +1688,6 @@ void EDBM_select_swap(BMEditMesh *em) /* exported for UV */ // if (EM_texFaceCheck()) } -static int select_inverse_mesh_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *obedit= CTX_data_edit_object(C); - BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh; - - EDBM_select_swap(em); - - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit); - - return OPERATOR_FINISHED; -} - -void MESH_OT_select_inverse(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Select Inverse"; - ot->idname= "MESH_OT_select_inverse"; - ot->description= "Select inverse of (un)selected vertices, edges or faces"; - - /* api callbacks */ - ot->exec= select_inverse_mesh_exec; - ot->poll= ED_operator_editmesh; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - - static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event) { Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 207ef32c50e..c6ed64e8dae 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -205,7 +205,6 @@ void MESH_OT_select_all(struct wmOperatorType *ot); void MESH_OT_bmesh_test(struct wmOperatorType *ot); void MESH_OT_select_more(struct wmOperatorType *ot); void MESH_OT_select_less(struct wmOperatorType *ot); -void MESH_OT_select_inverse(struct wmOperatorType *ot); void MESH_OT_select_non_manifold(struct wmOperatorType *ot); void MESH_OT_select_linked(struct wmOperatorType *ot); void MESH_OT_select_linked_pick(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 61451179ca3..872cfbec9a2 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -63,7 +63,6 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_select_all); WM_operatortype_append(MESH_OT_select_more); WM_operatortype_append(MESH_OT_select_less); - WM_operatortype_append(MESH_OT_select_inverse); WM_operatortype_append(MESH_OT_select_non_manifold); WM_operatortype_append(MESH_OT_select_linked); WM_operatortype_append(MESH_OT_select_linked_pick); @@ -255,25 +254,30 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) /* selecting */ /* standard mouse selection goes via space_view3d */ - WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0); - kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0); - RNA_boolean_set(kmi->ptr, "extend", 1); + kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); - WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0); - kmi= WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "extend", 1); + kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "extend", FALSE); + kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "extend", TRUE); WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(WM_keymap_add_item(keymap, "MESH_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0); WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1); + kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "deselect", FALSE); + kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "deselect", TRUE); WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0); @@ -283,13 +287,17 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0); /* hide */ - WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1); + kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0); + RNA_boolean_set(kmi->ptr, "unselected", FALSE); + kmi = WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "unselected", TRUE); WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); /* tools */ - WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1); + kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "inside", FALSE); + kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "inside", TRUE); WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0); @@ -321,8 +329,10 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_vert_connect", YKEY, KM_PRESS, 0, 0); /* use KM_CLICK because same key is used for tweaks */ - WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0)->ptr, "rotate_source", 0); + kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "rotate_source", TRUE); + kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0); + RNA_boolean_set(kmi->ptr, "rotate_source", FALSE); WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index dfb990d9d49..da8009ecc22 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -181,45 +181,6 @@ void MBALL_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } -/***************************** Select inverse operator *****************************/ - -/* Invert metaball selection */ -static int select_inverse_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *obedit= CTX_data_edit_object(C); - MetaBall *mb = (MetaBall*)obedit->data; - MetaElem *ml; - - ml= mb->editelems->first; - if(ml) { - while(ml) { - if(ml->flag & SELECT) - ml->flag &= ~SELECT; - else - ml->flag |= SELECT; - ml= ml->next; - } - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, mb); - } - - return OPERATOR_FINISHED; -} - -void MBALL_OT_select_inverse_metaelems(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Inverse"; - ot->description= "Select inverse of (un)selected metaelements"; - ot->idname= "MBALL_OT_select_inverse_metaelems"; - - /* callback functions */ - ot->exec= select_inverse_metaelems_exec; - ot->poll= ED_operator_editmball; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - /***************************** Select random operator *****************************/ /* Random metaball selection */ diff --git a/source/blender/editors/metaball/mball_intern.h b/source/blender/editors/metaball/mball_intern.h index 792fa80e0c5..1cb4c19fc72 100644 --- a/source/blender/editors/metaball/mball_intern.h +++ b/source/blender/editors/metaball/mball_intern.h @@ -43,7 +43,6 @@ void MBALL_OT_delete_metaelems(struct wmOperatorType *ot); void MBALL_OT_duplicate_metaelems(struct wmOperatorType *ot); void MBALL_OT_select_all(struct wmOperatorType *ot); -void MBALL_OT_select_inverse_metaelems(struct wmOperatorType *ot); void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot); #endif diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index 4d04fc3e80e..4f90578c665 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -48,7 +48,6 @@ void ED_operatortypes_metaball(void) WM_operatortype_append(MBALL_OT_reveal_metaelems); WM_operatortype_append(MBALL_OT_select_all); - WM_operatortype_append(MBALL_OT_select_inverse_metaelems); WM_operatortype_append(MBALL_OT_select_random_metaelems); } @@ -70,6 +69,6 @@ void ED_keymap_metaball(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MBALL_OT_duplicate_metaelems", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "MBALL_OT_select_inverse_metaelems", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(WM_keymap_add_item(keymap, "MBALL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 48b1630025c..536b2f70c31 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -226,20 +226,18 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); int a, values[20], layer; - + if(v3d) { layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact; - - for(a=0; a<20; a++) - values[a]= (layer & (1<<a)); } else { layer = scene->layact; + } - for(a=0; a<20; a++) - values[a]= (layer & (1<<a)); + for (a=0; a<20; a++) { + values[a]= (layer & (1<<a)); } - + RNA_boolean_set_array(op->ptr, "layers", values); } } diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 6120891be88..f8b6d89d397 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -96,7 +96,6 @@ void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot); /* object_select.c */ void OBJECT_OT_select_all(struct wmOperatorType *ot); -void OBJECT_OT_select_inverse(struct wmOperatorType *ot); void OBJECT_OT_select_random(struct wmOperatorType *ot); void OBJECT_OT_select_by_type(struct wmOperatorType *ot); void OBJECT_OT_select_by_layer(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 57c54f256d4..a86e5f343c1 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -94,7 +94,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_make_links_data); WM_operatortype_append(OBJECT_OT_move_to_layer); - WM_operatortype_append(OBJECT_OT_select_inverse); WM_operatortype_append(OBJECT_OT_select_random); WM_operatortype_append(OBJECT_OT_select_all); WM_operatortype_append(OBJECT_OT_select_same_group); @@ -298,7 +297,8 @@ void ED_keymap_object(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW3D_OT_game_start", PKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "OBJECT_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); + RNA_enum_set(WM_keymap_add_item(keymap, "OBJECT_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index da69c2a0640..69372ac1a90 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -739,41 +739,6 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) RNA_def_int(ot->srna, "layers", 1, 1, 20, "Layer", "", 1, 20); } -/************************** Select Inverse *************************/ - -static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) -{ - CTX_DATA_BEGIN(C, Base*, base, visible_bases) { - if (base->flag & SELECT) - ED_base_object_select(base, BA_DESELECT); - else - ED_base_object_select(base, BA_SELECT); - } - CTX_DATA_END; - - /* undo? */ - WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_select_inverse(wmOperatorType *ot) -{ - - /* identifiers */ - ot->name= "Select Inverse"; - ot->description = "Invert selection of all visible objects"; - ot->idname= "OBJECT_OT_select_inverse"; - - /* api callbacks */ - ot->exec= object_select_inverse_exec; - ot->poll= objects_selectable_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - -} - /**************************** (De)select All ****************************/ static int object_select_all_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3993707dbb9..a912fb5f81b 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -254,13 +254,21 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) } else if(pset->edittype == PE_TYPE_SOFTBODY && pid->type == PTCACHE_TYPE_SOFTBODY) { if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) + { + pset->flag |= PE_FADE_TIME; + // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB; PE_create_particle_edit(scene, ob, pid->cache, NULL); + } edit = pid->cache->edit; break; } else if(pset->edittype == PE_TYPE_CLOTH && pid->type == PTCACHE_TYPE_CLOTH) { if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) + { + pset->flag |= PE_FADE_TIME; + // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB; PE_create_particle_edit(scene, ob, pid->cache, NULL); + } edit = pid->cache->edit; break; } @@ -1872,43 +1880,6 @@ void PARTICLE_OT_select_more(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) -{ - PEData data; - PTCacheEdit *edit; - POINT_P; KEY_K; - - PE_set_data(C, &data); - - edit= PE_get_current(data.scene, data.ob); - - LOOP_VISIBLE_POINTS { - LOOP_KEYS { - key->flag ^= PEK_SELECT; - point->flag |= PEP_EDIT_RECALC; /* redraw selection only */ - } - } - - PE_update_selection(data.scene, data.ob, 1); - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob); - - return OPERATOR_FINISHED; -} - -void PARTICLE_OT_select_inverse(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Select Inverse"; - ot->idname= "PARTICLE_OT_select_inverse"; - - /* api callbacks */ - ot->exec= select_inverse_exec; - ot->poll= PE_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - /************************ rekey operator ************************/ static void rekey_particle(PEData *data, int pa_index) @@ -3659,8 +3630,14 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) PE_update_object(scene, ob, 1); } - WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); - + if(edit->psys) + WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); + else + { + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + } + bedit->lastmouse[0]= mouse[0]; bedit->lastmouse[1]= mouse[1]; bedit->first= 0; diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index 0dae8b362cd..db6d63f6396 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -42,7 +42,6 @@ void PARTICLE_OT_select_tips(struct wmOperatorType *ot); void PARTICLE_OT_select_linked(struct wmOperatorType *ot); void PARTICLE_OT_select_less(struct wmOperatorType *ot); void PARTICLE_OT_select_more(struct wmOperatorType *ot); -void PARTICLE_OT_select_inverse(struct wmOperatorType *ot); void PARTICLE_OT_hide(struct wmOperatorType *ot); void PARTICLE_OT_reveal(struct wmOperatorType *ot); diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index e39b4b97d72..ba0465b866f 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -51,7 +51,6 @@ static void operatortypes_particle(void) WM_operatortype_append(PARTICLE_OT_select_linked); WM_operatortype_append(PARTICLE_OT_select_less); WM_operatortype_append(PARTICLE_OT_select_more); - WM_operatortype_append(PARTICLE_OT_select_inverse); WM_operatortype_append(PARTICLE_OT_hide); WM_operatortype_append(PARTICLE_OT_reveal); @@ -95,11 +94,12 @@ static void keymap_particle(wmKeyConfig *keyconf) keymap->poll= PE_poll; WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1); - WM_keymap_add_item(keymap, "PARTICLE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index a3783bdb342..06e15f4a5f6 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -83,6 +83,9 @@ typedef struct OGLRender { RegionView3D *rv3d; ARegion *ar; + ScrArea *prevsa; + ARegion *prevar; + short obcenter_dia_back; /* temp overwrite */ Image *ima; @@ -250,6 +253,8 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) { /* new render clears all callbacks */ Scene *scene= CTX_data_scene(C); + ScrArea *prevsa= CTX_wm_area(C); + ARegion *prevar= CTX_wm_region(C); RenderResult *rr; GPUOffScreen *ofs; OGLRender *oglrender; @@ -318,10 +323,12 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->obcenter_dia_back = U.obcenter_dia; U.obcenter_dia = 0; + oglrender->prevsa= prevsa; + oglrender->prevar= prevar; + if(is_view_context) { - oglrender->v3d= CTX_wm_view3d(C); - oglrender->ar= CTX_wm_region(C); - oglrender->rv3d= CTX_wm_region_view3d(C); + ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */ + oglrender->rv3d= oglrender->ar->regiondata; /* MUST be cleared on exit */ oglrender->scene->customdata_mask_modal = (ED_view3d_datamask(oglrender->scene, oglrender->v3d) | @@ -381,6 +388,9 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) oglrender->scene->customdata_mask_modal= 0; + CTX_wm_area_set(C, oglrender->prevsa); + CTX_wm_region_set(C, oglrender->prevar); + MEM_freeN(oglrender); } @@ -488,7 +498,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } if(BKE_imtype_is_movie(scene->r.im_format.imtype)) { - ok= oglrender->mh->append_movie(&scene->r, CFRA, (int*)ibuf->rect, oglrender->sizex, oglrender->sizey, oglrender->reports); + ok= oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int*)ibuf->rect, + oglrender->sizex, oglrender->sizey, oglrender->reports); if(ok) { printf("Append frame %d", scene->r.cfra); BKE_reportf(op->reports, RPT_INFO, "Appended frame: %d", scene->r.cfra); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 043def31a23..e32277e3789 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -302,7 +302,9 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float if(sj->dumprect) { if(mh) { - if(mh->append_movie(&rd, rd.cfra, (int *)sj->dumprect, sj->dumpsx, sj->dumpsy, &sj->reports)) { + if(mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect, + sj->dumpsx, sj->dumpsy, &sj->reports)) + { BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra); printf("Appended frame %d\n", rd.cfra); } else diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 50583c2bbfb..b7c4404c143 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1784,16 +1784,7 @@ static void scale_tri(float insetCos[4][3], float *origCos[4], const float inset } #endif //PROJ_DEBUG_NOSEAMBLEED -static float Vec2Lenf_nosqrt(const float *v1, const float *v2) -{ - float x, y; - - x = v1[0]-v2[0]; - y = v1[1]-v2[1]; - return x*x+y*y; -} - -static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const float v2_2) +static float len_squared_v2v2_alt(const float *v1, const float v2_1, const float v2_2) { float x, y; @@ -1802,7 +1793,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa return x*x+y*y; } -/* note, use a squared value so we can use Vec2Lenf_nosqrt +/* note, use a squared value so we can use len_squared_v2v2 * be sure that you have done a bounds check first or this may fail */ /* only give bucket_bounds as an arg because we need it elsewhere */ static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds) @@ -1826,21 +1817,21 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s if (cent[0] < bucket_bounds->xmin) { /* lower left out of radius test */ if (cent[1] < bucket_bounds->ymin) { - return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmin, bucket_bounds->ymin) < radius_squared) ? 1 : 0; + return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymin) < radius_squared) ? 1 : 0; } /* top left test */ else if (cent[1] > bucket_bounds->ymax) { - return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmin, bucket_bounds->ymax) < radius_squared) ? 1 : 0; + return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymax) < radius_squared) ? 1 : 0; } } else if (cent[0] > bucket_bounds->xmax) { /* lower right out of radius test */ if (cent[1] < bucket_bounds->ymin) { - return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmax, bucket_bounds->ymin) < radius_squared) ? 1 : 0; + return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymin) < radius_squared) ? 1 : 0; } /* top right test */ else if (cent[1] > bucket_bounds->ymax) { - return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmax, bucket_bounds->ymax) < radius_squared) ? 1 : 0; + return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymax) < radius_squared) ? 1 : 0; } } @@ -3901,8 +3892,7 @@ static void *do_projectpaint_thread(void *ph_v) projPixel = (ProjPixel *)node->link; - /*dist = len_v2v2(projPixel->projCoSS, pos);*/ /* correct but uses a sqrtf */ - dist_nosqrt = Vec2Lenf_nosqrt(projPixel->projCoSS, pos); + dist_nosqrt = len_squared_v2v2(projPixel->projCoSS, pos); /*if (dist < radius) {*/ /* correct but uses a sqrtf */ if (dist_nosqrt <= radius_squared) { diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 90e99519600..eecf62421c8 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -182,43 +182,11 @@ static void GRAPH_OT_cursor_set(wmOperatorType *ot) RNA_def_float(ot->srna, "value", 0, FLT_MIN, FLT_MAX, "Value", "", -100.0f, 100.0f); } -/* Toggle Handles ----------------------------------------------------------------- */ - -static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op)) -{ - SpaceIpo *sipo= CTX_wm_space_graph(C); - ARegion *ar= CTX_wm_region(C); - - if (sipo == NULL) - return OPERATOR_CANCELLED; - - /* toggle flag to hide handles */ - sipo->flag ^= SIPO_NOHANDLES; - - /* request refresh of keys area */ - ED_region_tag_redraw(ar); - - return OPERATOR_FINISHED; -} - -static void GRAPH_OT_view_togglehandles (wmOperatorType *ot) -{ - /* identification */ - ot->name= "Show/Hide All Handles"; - ot->idname= "GRAPH_OT_handles_view_toggle"; - ot->description= "Toggle whether handles are drawn on all keyframes that need them"; - - /* callbacks */ - ot->exec= view_toggle_handles_exec; - ot->poll= ED_operator_graphedit_active; -} - /* ************************** registration - operator types **********************************/ void graphedit_operatortypes(void) { /* view */ - WM_operatortype_append(GRAPH_OT_view_togglehandles); WM_operatortype_append(GRAPH_OT_cursor_set); WM_operatortype_append(GRAPH_OT_previewrange_set); @@ -290,7 +258,9 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap) wmKeyMapItem *kmi; /* view */ - WM_keymap_add_item(keymap, "GRAPH_OT_handles_view_toggle", HKEY, KM_PRESS, KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", HKEY, KM_PRESS, KM_CTRL, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.show_handles"); + /* NOTE: 'ACTIONMOUSE' not 'LEFTMOUSE', as user may have swapped mouse-buttons * This keymap is supposed to override ANIM_OT_change_frame, which does the same except it doesn't do y-values */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index c1268ec61f0..617dd172c05 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -201,7 +201,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter; + int filter, mapping_flag; SpaceIpo *sipo= (SpaceIpo *)ac->sl; KeyframeEditData ked; @@ -226,8 +226,12 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho ked.data= &rectf; /* treat handles separately? */ - if (incl_handles) + if (incl_handles) { ked.iterflags |= KEYFRAME_ITER_INCL_HANDLES; + mapping_flag= 0; + } + else + mapping_flag= ANIM_UNITCONV_ONLYKEYS; /* loop over data, doing border select */ for (ale= anim_data.first; ale; ale= ale->next) { @@ -235,7 +239,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho FCurve *fcu= (FCurve *)ale->key_data; /* apply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYKEYS); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, mapping_flag); /* apply NLA mapping to all the keyframes, since it's easier than trying to * guess when a callback might use something different @@ -274,7 +278,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, incl_handles==0); /* unapply unit corrections */ - ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE|ANIM_UNITCONV_ONLYKEYS); + ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, ale->key_data, ANIM_UNITCONV_RESTORE|mapping_flag); } /* cleanup */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 999a25f57b5..06674513868 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2016,14 +2016,14 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) hist->data_r[i] = rgb[0]; hist->data_g[i] = rgb[1]; hist->data_b[i] = rgb[2]; - hist->data_luma[i] = (0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2]); + hist->data_luma[i] = rgb_to_luma(rgb); } else if (ibuf->rect) { cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x); hist->data_r[i] = (float)cp[0]/255.0f; hist->data_g[i] = (float)cp[1]/255.0f; hist->data_b[i] = (float)cp[2]/255.0f; - hist->data_luma[i] = (0.299f*cp[0] + 0.587f*cp[1] + 0.114f*cp[2])/255; + hist->data_luma[i] = (float)rgb_to_luma_byte(cp)/255.0f; } } } diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 4359e3a6652..812bdbc678f 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -122,7 +122,7 @@ void SEQUENCER_OT_rebuild_proxy(struct wmOperatorType *ot); void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot); /* sequencer_select.c */ -void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot); +void SEQUENCER_OT_select_all(struct wmOperatorType *ot); void SEQUENCER_OT_select(struct wmOperatorType *ot); void SEQUENCER_OT_select_more(struct wmOperatorType *ot); void SEQUENCER_OT_select_less(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 07ca56cde8b..883a09ff328 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -92,8 +92,7 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_change_path); /* sequencer_select.c */ - WM_operatortype_append(SEQUENCER_OT_select_all_toggle); - WM_operatortype_append(SEQUENCER_OT_select_inverse); + WM_operatortype_append(SEQUENCER_OT_select_all); WM_operatortype_append(SEQUENCER_OT_select); WM_operatortype_append(SEQUENCER_OT_select_more); WM_operatortype_append(SEQUENCER_OT_select_less); @@ -133,8 +132,8 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SEQUENCER_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0); + RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT); RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0)->ptr, "type", SEQ_CUT_SOFT); RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", SEQ_CUT_HARD); diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 8c189d96062..2bb40ce51f4 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -29,16 +29,17 @@ #include <math.h> #include <string.h> +#include "BLI_math_color.h" #include "BLI_utildefines.h" - - #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" #include "sequencer_intern.h" -static void rgb_to_yuv(float rgb[3], float yuv[3]) +/* XXX, why is this function better then BLI_math version? + * only difference is it does some normalize after, need to double check on this - campbell */ +static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) { yuv[0]= 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2]; yuv[1]= 0.492f*(rgb[2] - yuv[0]); @@ -169,10 +170,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) for (x = 0; x < ibuf->x; x++) { unsigned char * rgb = src + 4 * (ibuf->x * y + x); - float v = 1.0 * - ( 0.299*rgb[0] - + 0.587*rgb[1] - + 0.114*rgb[2]) / 255.0; + float v = (float)rgb_to_luma_byte(rgb) / 255.0; unsigned char * p = tgt; p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1); @@ -215,10 +213,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) for (x = 0; x < ibuf->x; x++) { float * rgb = src + 4 * (ibuf->x * y + x); - float v = 1.0f * - ( 0.299f*rgb[0] - + 0.587f*rgb[1] - + 0.114f*rgb[2]); + float v = rgb_to_luma(rgb); unsigned char * p = tgt; CLAMP(v, 0.0f, 1.0f); @@ -583,7 +578,7 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g, rgb[0]= (float)r/255.0f; rgb[1]= (float)g/255.0f; rgb[2]= (float)b/255.0f; - rgb_to_yuv(rgb, yuv); + rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) + (int) ((yuv[1] * (w - 3) + 1))); @@ -634,7 +629,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) rgb[0]= (float)src1[0]/255.0f; rgb[1]= (float)src1[1]/255.0f; rgb[2]= (float)src1[2]/255.0f; - rgb_to_yuv(rgb, yuv); + rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) + (int) ((yuv[1] * (w - 3) + 1))); @@ -684,7 +679,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) CLAMP(rgb[1], 0.0f, 1.0f); CLAMP(rgb[2], 0.0f, 1.0f); - rgb_to_yuv(rgb, yuv); + rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) + (int) ((yuv[1] * (w - 3) + 1))); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 9eb900ed427..a6568950a01 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -179,8 +179,6 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int recurs_sel_seq(seq); } -// remove this function, replace with invert operator -//void swap_select_seq(Scene *scene) #if 0 static void select_neighbor_from_last(Scene *scene, int lr) { @@ -214,48 +212,65 @@ static void select_neighbor_from_last(Scene *scene, int lr) #endif /* (de)select operator */ -static int sequencer_deselect_exec(bContext *C, wmOperator *UNUSED(op)) +static int sequencer_de_select_all_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - Editing *ed= seq_give_editing(scene, FALSE); + int action = RNA_enum_get(op->ptr, "action"); + + Scene *scene = CTX_data_scene(C); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - int desel = 0; - for(seq= ed->seqbasep->first; seq; seq=seq->next) { - if(seq->flag & SEQ_ALLSEL) { - desel= 1; - break; + if (action == SEL_TOGGLE) { + action = SEL_SELECT; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + if (seq->flag & SEQ_ALLSEL) { + action = SEL_DESELECT; + break; + } } } - for(seq= ed->seqbasep->first; seq; seq=seq->next) { - if (desel) { - seq->flag &= ~SEQ_ALLSEL; - } - else { - seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); - seq->flag |= SELECT; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { + switch (action) { + case SEL_SELECT: + seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); + seq->flag |= SELECT; + break; + case SEL_DESELECT: + seq->flag &= ~SEQ_ALLSEL; + break; + case SEL_INVERT: + if (seq->flag & SEQ_ALLSEL) { + seq->flag &= ~SEQ_ALLSEL; + } + else { + seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL); + seq->flag |= SELECT; + } + break; } } - WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); + return OPERATOR_FINISHED; } -void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot) +void SEQUENCER_OT_select_all(struct wmOperatorType *ot) { /* identifiers */ ot->name= "Select or Deselect All"; - ot->idname= "SEQUENCER_OT_select_all_toggle"; + ot->idname= "SEQUENCER_OT_select_all"; ot->description="Select or deselect all strips"; /* api callbacks */ - ot->exec= sequencer_deselect_exec; + ot->exec= sequencer_de_select_all_exec; ot->poll= sequencer_edit_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + WM_operator_properties_select_all(ot); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index ce8ddc3c361..a1c8ef953cb 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3252,6 +3252,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D bglPolygonOffset(rv3d->dist, 0.0); glDepthMask(1); glDisable(GL_LINE_STIPPLE); + glDisable(GL_BLEND); GPU_disable_material(); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 196af34137a..f2906ca9559 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -154,15 +154,23 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C) /* ideally would return an rv3d but in some cases the region is needed too * so return that, the caller can then access the ar->regiondata */ -ARegion *ED_view3d_context_region_unlock(bContext *C) +int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r) { ScrArea *sa= CTX_wm_area(C); + + *v3d_r = NULL; + *ar_r = NULL; + if(sa && sa->spacetype==SPACE_VIEW3D) { ARegion *ar= CTX_wm_region(C); + View3D *v3d = (View3D *)sa->spacedata.first; + if(ar) { RegionView3D *rv3d= ar->regiondata; if(rv3d && rv3d->viewlock == 0) { - return ar; + *v3d_r = v3d; + *ar_r = ar; + return 1; } else { ARegion *ar_unlock_user= NULL; @@ -182,12 +190,22 @@ ARegion *ED_view3d_context_region_unlock(bContext *C) } /* camera/perspective view get priority when the active region is locked */ - if(ar_unlock_user) return ar_unlock_user; - if(ar_unlock) return ar_unlock; + if(ar_unlock_user) { + *v3d_r = v3d; + *ar_r = ar_unlock_user; + return 1; + } + + if(ar_unlock) { + *v3d_r = v3d; + *ar_r = ar_unlock; + return 1; + } } } } - return NULL; + + return 0; } /* Most of the time this isn't needed since you could assume the view matrix was diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8a0fa5324be..224df5b9f80 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2653,13 +2653,16 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float q1, float static int viewnumpad_exec(bContext *C, wmOperator *op) { - View3D *v3d = CTX_wm_view3d(C); - ARegion *ar= ED_view3d_context_region_unlock(C); - RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */ + View3D *v3d; + ARegion *ar; + RegionView3D *rv3d; Scene *scene= CTX_data_scene(C); - static int perspo=RV3D_PERSP; + static int perspo = RV3D_PERSP; int viewnum, align_active, nextperspo; + ED_view3d_context_user_region(C, &v3d, &ar); + rv3d = ar->regiondata; + viewnum = RNA_enum_get(op->ptr, "type"); align_active = RNA_boolean_get(op->ptr, "align_active"); @@ -2783,7 +2786,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot) /* api callbacks */ ot->exec= viewnumpad_exec; - ot->poll= ED_operator_rv3d_unlock_poll; + ot->poll= ED_operator_rv3d_user_region_poll; /* flags */ ot->flag= 0; @@ -2801,12 +2804,16 @@ static EnumPropertyItem prop_view_orbit_items[] = { static int vieworbit_exec(bContext *C, wmOperator *op) { - View3D *v3d= CTX_wm_view3d(C); - ARegion *ar= ED_view3d_context_region_unlock(C); - RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */ + View3D *v3d; + ARegion *ar; + RegionView3D *rv3d; float phi, q1[4], new_quat[4]; int orbitdir; + /* no NULL check is needed, poll checks */ + ED_view3d_context_user_region(C, &v3d, &ar); + rv3d = ar->regiondata; + orbitdir = RNA_enum_get(op->ptr, "type"); if(rv3d->viewlock==0) { @@ -2852,7 +2859,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot) /* api callbacks */ ot->exec= vieworbit_exec; - ot->poll= ED_operator_rv3d_unlock_poll; + ot->poll= ED_operator_rv3d_user_region_poll; /* flags */ ot->flag= 0; @@ -2909,8 +2916,13 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot) static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op)) { - ARegion *ar= ED_view3d_context_region_unlock(C); - RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */ + View3D *v3d_dummy; + ARegion *ar; + RegionView3D *rv3d; + + /* no NULL check is needed, poll checks */ + ED_view3d_context_user_region(C, &v3d_dummy, &ar); + rv3d = ar->regiondata; if(rv3d->viewlock==0) { if(rv3d->persp!=RV3D_ORTHO) @@ -2932,7 +2944,7 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot) /* api callbacks */ ot->exec= viewpersportho_exec; - ot->poll= ED_operator_rv3d_unlock_poll; + ot->poll= ED_operator_rv3d_user_region_poll; /* flags */ ot->flag= 0; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index c9639376d1d..419b07214a5 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -466,13 +466,18 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot) static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) -{ - View3D *v3d = CTX_wm_view3d(C); - ARegion *ar= ED_view3d_context_region_unlock(C); - RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */ +{ + View3D *v3d; + ARegion *ar; + RegionView3D *rv3d; + Scene *scene= CTX_data_scene(C); Object *ob = CTX_data_active_object(C); + /* no NULL check is needed, poll checks */ + ED_view3d_context_user_region(C, &v3d, &ar); + rv3d = ar->regiondata; + if(ob) { Object *camera_old= (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL; rv3d->persp= RV3D_CAMOB; @@ -489,9 +494,12 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -int ED_operator_rv3d_unlock_poll(bContext *C) +int ED_operator_rv3d_user_region_poll(bContext *C) { - return ED_view3d_context_region_unlock(C) != NULL; + View3D *v3d_dummy; + ARegion *ar_dummy; + + return ED_view3d_context_user_region(C, &v3d_dummy, &ar_dummy); } void VIEW3D_OT_object_as_camera(wmOperatorType *ot) @@ -504,7 +512,7 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot) /* api callbacks */ ot->exec= view3d_setobjectascamera_exec; - ot->poll= ED_operator_rv3d_unlock_poll; + ot->poll= ED_operator_rv3d_user_region_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 3ff5f7bbcba..debc17137f4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1410,18 +1410,21 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) if (t->flag & T_MODAL) { /* save settings if not set in operator */ - if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_struct_property_is_set(op->ptr, "proportional")) { + if ( (prop = RNA_struct_find_property(op->ptr, "proportional")) && !RNA_property_is_set(op->ptr, prop)) + { if (t->obedit) ts->proportional = proportional; else ts->proportional_objects = (proportional != PROP_EDIT_OFF); } - if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_struct_property_is_set(op->ptr, "proportional_size")) { + if ( (prop = RNA_struct_find_property(op->ptr, "proportional_size")) && !RNA_property_is_set(op->ptr, prop)) + { ts->proportional_size = t->prop_size; } - - if (RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && !RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff")) { + + if ( (prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && !RNA_property_is_set(op->ptr, prop)) + { ts->prop_mode = t->prop_mode; } @@ -1432,8 +1435,9 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) ts->snap_flag &= ~SCE_SNAP; } - if(t->spacetype == SPACE_VIEW3D) { - if (RNA_struct_find_property(op->ptr, "constraint_orientation") && !RNA_struct_property_is_set(op->ptr, "constraint_orientation")) { + if (t->spacetype == SPACE_VIEW3D) { + if ( (prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && !RNA_property_is_set(op->ptr, prop)) + { View3D *v3d = t->view; v3d->twmode = t->current_orientation; @@ -1448,17 +1452,17 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) RNA_float_set(op->ptr, "proportional_size", t->prop_size); } - if (RNA_struct_find_property(op->ptr, "axis")) + if ((prop = RNA_struct_find_property(op->ptr, "axis"))) { - RNA_float_set_array(op->ptr, "axis", t->axis); + RNA_property_float_set_array(op->ptr, prop, t->axis); } - if (RNA_struct_find_property(op->ptr, "mirror")) + if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) { - RNA_boolean_set(op->ptr, "mirror", t->flag & T_MIRROR); + RNA_property_boolean_set(op->ptr, prop, t->flag & T_MIRROR); } - if (RNA_struct_find_property(op->ptr, "constraint_axis")) + if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) { /* constraint orientation can be global, event if user selects something else * so use the orientation in the constraint if set @@ -1482,7 +1486,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } - RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis); + RNA_property_boolean_set_array(op->ptr, prop, constraint_axis); } } @@ -1490,6 +1494,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int mode) { int options = 0; + PropertyRNA *prop; t->context = C; @@ -1497,9 +1502,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int t->state = TRANS_STARTING; - if(RNA_struct_find_property(op->ptr, "texture_space")) - if(RNA_boolean_get(op->ptr, "texture_space")) + if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) + { + if(RNA_property_boolean_get(op->ptr, prop)) { options |= CTX_TEXTURE; + } + } t->options = options; @@ -1706,10 +1714,9 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int /* overwrite initial values if operator supplied a non-null vector */ - if (RNA_struct_property_is_set(op->ptr, "value")) + if ( (prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) { float values[4]= {0}; /* incase value isn't length 4, avoid uninitialized memory */ - PropertyRNA *prop= RNA_struct_find_property(op->ptr, "value"); if(RNA_property_array_check(prop)) { RNA_float_get_array(op->ptr, "value", values); @@ -1723,19 +1730,19 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } /* Transformation axis from operator */ - if (RNA_struct_find_property(op->ptr, "axis") && RNA_struct_property_is_set(op->ptr, "axis")) + if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) { - RNA_float_get_array(op->ptr, "axis", t->axis); + RNA_property_float_get_array(op->ptr, prop, t->axis); normalize_v3(t->axis); copy_v3_v3(t->axis_orig, t->axis); } /* Constraint init from operator */ - if (RNA_struct_find_property(op->ptr, "constraint_axis") && RNA_struct_property_is_set(op->ptr, "constraint_axis")) + if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { int constraint_axis[3]; - RNA_boolean_get_array(op->ptr, "constraint_axis", constraint_axis); + RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) { @@ -2636,7 +2643,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) /* local constraint shouldn't alter center */ if ((t->around == V3D_LOCAL) && ( (t->flag & (T_OBJECT|T_POSE)) || - ((t->flag & T_EDIT) && (t->settings->selectmode & SCE_SELECT_FACE)) || + ((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE))) || (t->obedit && t->obedit->type == OB_ARMATURE)) ) { @@ -2923,7 +2930,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short /* local constraint shouldn't alter center */ if (around == V3D_LOCAL) { if ( (t->flag & (T_OBJECT|T_POSE)) || - (t->settings->selectmode & SCE_SELECT_FACE) || + (t->settings->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE)) || (t->obedit && t->obedit->type == OB_ARMATURE)) { center = td->center; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 595303c0da4..a506c1a902c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1931,6 +1931,19 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f } } +static void get_edge_center(float cent_r[3], BMesh *bm, BMVert *eve) +{ + BMEdge *eed; + BMIter iter; + + BM_ITER(eed, &iter, bm, BM_EDGES_OF_VERT, eve) { + if (BM_Selected(bm, eed)) { + mid_v3_v3v3(cent_r, eed->v1->co, eed->v2->co); + break; + } + } +} + /* way to overwrite what data is edited with transform * static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key) */ static void VertsToTransData(TransInfo *t, TransData *td, BMEditMesh *em, BMVert *eve, float *bweight) @@ -1942,8 +1955,13 @@ static void VertsToTransData(TransInfo *t, TransData *td, BMEditMesh *em, BMVert td->loc = eve->co; copy_v3_v3(td->center, td->loc); - if(t->around==V3D_LOCAL && (em->selectmode & SCE_SELECT_FACE)) - get_face_center(td->center, em->bm, eve); + + if(t->around==V3D_LOCAL) { + if(em->selectmode & SCE_SELECT_FACE) + get_face_center(td->center, em->bm, eve); + else if(em->selectmode & SCE_SELECT_EDGE) + get_edge_center(td->center, em->bm, eve); + } copy_v3_v3(td->iloc, td->loc); // Setting normals diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 36512b93460..f2c720ff4dc 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3505,10 +3505,10 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) keymap->poll= ED_operator_uvedit; /* pick selection */ - WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", 1); - WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_ALT, 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "extend", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", FALSE); + RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE); + RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "extend", FALSE); + RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "extend", TRUE); /* border/circle selection */ WM_keymap_add_item(keymap, "UV_OT_select_border", BKEY, KM_PRESS, 0, 0); @@ -3516,8 +3516,8 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "UV_OT_circle_select", CKEY, KM_PRESS, 0, 0); /* selection manipulation */ - WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0)->ptr, "extend", FALSE); + RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0)->ptr, "extend", FALSE); RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "extend", TRUE); RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE); |