Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_edit.c
| Context not available. | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Toggle Automatic XRay | |||||
| * \{ */ | |||||
| static int toggle_xray_auto_exec(bContext *C, wmOperator *op) | |||||
| { | |||||
| ScrArea *area = CTX_wm_area(C); | |||||
| Scene *scene = CTX_data_scene(C); | |||||
| bToolRef *tref = area->runtime.tool; | |||||
| ToolSettings *ts = scene->toolsettings; | |||||
| const bool box_lasso = ts->link_box == true && ts->link_lasso == true && | |||||
| ts->box_auto_xray == ts->lasso_auto_xray; | |||||
| const bool box_circle = ts->link_box == true && ts->link_circle == true && | |||||
| ts->box_auto_xray == ts->circle_auto_xray; | |||||
| const bool circle_lasso = ts->link_circle == true && ts->link_lasso == true && | |||||
| ts->circle_auto_xray == ts->lasso_auto_xray; | |||||
| /* keep the auto xray header button synchronized among linked selection tools */ | |||||
| if (STREQ(tref->idname, "builtin.select_box") || | |||||
| STREQ(tref->idname_fallback, "builtin.select_box")) { | |||||
| if (box_lasso) { | |||||
| ts->lasso_auto_xray ^= true; | |||||
| } | |||||
| if (box_circle) { | |||||
| ts->circle_auto_xray ^= true; | |||||
| } | |||||
| ts->box_auto_xray ^= true; | |||||
| } | |||||
| else if (STREQ(tref->idname, "builtin.select_lasso") || | |||||
| STREQ(tref->idname_fallback, "builtin.select_lasso")) { | |||||
| if (box_lasso) { | |||||
| ts->box_auto_xray ^= true; | |||||
| } | |||||
| if (circle_lasso) { | |||||
| ts->circle_auto_xray ^= true; | |||||
| } | |||||
| ts->lasso_auto_xray ^= true; | |||||
| } | |||||
| else if (STREQ(tref->idname, "builtin.select_circle") || | |||||
| STREQ(tref->idname_fallback, "builtin.select_circle")) { | |||||
| if (box_circle) { | |||||
| ts->box_auto_xray ^= true; | |||||
| } | |||||
| if (circle_lasso) { | |||||
| ts->lasso_auto_xray ^= true; | |||||
| } | |||||
| ts->circle_auto_xray ^= true; | |||||
| } | |||||
| ED_area_tag_redraw(area); | |||||
| return OPERATOR_FINISHED; | |||||
| } | |||||
| void VIEW3D_OT_toggle_xray_auto(wmOperatorType *ot) | |||||
| { | |||||
| /* identifiers */ | |||||
| ot->name = "Toggle Automatic X-Ray"; | |||||
| ot->idname = "VIEW3D_OT_toggle_xray_auto"; | |||||
| ot->description = "Transparent scene display during box, lasso, and circle select"; | |||||
| /* api callbacks */ | |||||
| ot->exec = toggle_xray_auto_exec; | |||||
| ot->poll = ED_operator_view3d_active; | |||||
| } | |||||
| /** \} */ | |||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Toggle Select Through | |||||
| * \{ */ | |||||
| static int toggle_select_through_exec(bContext *C, wmOperator *op) | |||||
| { | |||||
| ScrArea *area = CTX_wm_area(C); | |||||
| Scene *scene = CTX_data_scene(C); | |||||
| bToolRef *tref = area->runtime.tool; | |||||
| ToolSettings *ts = scene->toolsettings; | |||||
| const bool box_lasso = ts->link_box == true && ts->link_lasso == true && | |||||
| ts->box_select_through == ts->lasso_select_through; | |||||
| const bool box_circle = ts->link_box == true && ts->link_circle == true && | |||||
| ts->box_select_through == ts->circle_select_through; | |||||
| const bool circle_lasso = ts->link_circle == true && ts->link_lasso == true && | |||||
| ts->circle_select_through == ts->lasso_select_through; | |||||
| /* keep the select through header button synchronized among linked selection tools */ | |||||
| if (STREQ(tref->idname, "builtin.select_box") || | |||||
| STREQ(tref->idname_fallback, "builtin.select_box")) { | |||||
| if (box_lasso) { | |||||
| ts->lasso_select_through ^= true; | |||||
| } | |||||
| if (box_circle) { | |||||
| ts->circle_select_through ^= true; | |||||
| } | |||||
| ts->box_select_through ^= true; | |||||
| } | |||||
| else if (STREQ(tref->idname, "builtin.select_lasso") || | |||||
| STREQ(tref->idname_fallback, "builtin.select_lasso")) { | |||||
| if (box_lasso) { | |||||
| ts->box_select_through ^= true; | |||||
| } | |||||
| if (circle_lasso) { | |||||
| ts->circle_select_through ^= true; | |||||
| } | |||||
| ts->lasso_select_through ^= true; | |||||
| } | |||||
| else if (STREQ(tref->idname, "builtin.select_circle") || | |||||
| STREQ(tref->idname_fallback, "builtin.select_circle")) { | |||||
| if (box_circle) { | |||||
| ts->box_select_through ^= true; | |||||
| } | |||||
| if (circle_lasso) { | |||||
| ts->lasso_select_through ^= true; | |||||
| } | |||||
| ts->circle_select_through ^= true; | |||||
| } | |||||
| ED_area_tag_redraw(area); | |||||
| return OPERATOR_FINISHED; | |||||
| } | |||||
| void VIEW3D_OT_toggle_select_through(wmOperatorType *ot) | |||||
| { | |||||
| /* identifiers */ | |||||
| ot->name = "Toggle Select Through"; | |||||
| ot->idname = "VIEW3D_OT_toggle_select_through"; | |||||
| ot->description = | |||||
| "Select occluded vertices, edges, and faces with box, lasso, and circle select"; | |||||
| /* api callbacks */ | |||||
| ot->exec = toggle_select_through_exec; | |||||
| ot->poll = ED_operator_view3d_active; | |||||
| } | |||||
| /** \} */ | |||||
| /* -------------------------------------------------------------------- */ | |||||
| /** \name Toggle Facedots | |||||
| * \{ */ | |||||
| static int toggle_facedots_exec(bContext *C, wmOperator *op) | |||||
| { | |||||
| ScrArea *area = CTX_wm_area(C); | |||||
| View3D *v3d = CTX_wm_view3d(C); | |||||
| if (!XRAY_FLAG_ENABLED(v3d)) { | |||||
| v3d->overlay.edit_flag ^= V3D_OVERLAY_EDIT_FACE_DOT; | |||||
| } | |||||
| else { | |||||
| v3d->overlay.edit_flag ^= V3D_OVERLAY_EDIT_FACE_DOT_XRAY; | |||||
| } | |||||
| ED_area_tag_redraw(area); | |||||
| return OPERATOR_FINISHED; | |||||
| } | |||||
| void VIEW3D_OT_toggle_facedots(wmOperatorType *ot) | |||||
| { | |||||
| /* identifiers */ | |||||
| ot->name = "Toggle Facedots"; | |||||
| ot->idname = "VIEW3D_OT_toggle_facedots"; | |||||
| ot->description = | |||||
| "Toggle face center display in the current shading mode"; | |||||
| /* api callbacks */ | |||||
| ot->exec = toggle_facedots_exec; | |||||
| ot->poll = ED_operator_view3d_active; | |||||
| } | |||||
| /** \} */ | |||||
| Context not available. | |||||