[Bf-blender-cvs] [4b0b016d069] soc-2021-knife-tools: Knife: Setting to toggle X-Ray

Cian Jinks noreply at git.blender.org
Sat Sep 4 15:00:37 CEST 2021


Commit: 4b0b016d069a8c78b2157a94fc4e3909827b5c3d
Author: Cian Jinks
Date:   Sat Sep 4 13:58:52 2021 +0100
Branches: soc-2021-knife-tools
https://developer.blender.org/rB4b0b016d069a8c78b2157a94fc4e3909827b5c3d

Knife: Setting to toggle X-Ray

Knife tool xray (depth testing) was previously only toggle-able by the 'V' modal key.
This patch exposes an RNA boolean in the knife tool settings for toggling xray.

===================================================================

M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
M	source/blender/editors/mesh/editmesh_knife.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index a6acb281052..c9ce3e221c2 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -1080,6 +1080,8 @@ class _defs_edit_mesh:
                 layout.prop(props, "use_occlude_geometry")
                 row = layout.row()
                 layout.prop(props, "only_selected")
+                row = layout.row()
+                layout.prop(props, "xray")
                 region_is_header = bpy.context.region.type == 'TOOL_HEADER'
                 if region_is_header:
                     show_extra = True
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index c3f00fdf002..6ed4f59ab46 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -4126,6 +4126,7 @@ static void knifetool_init(bContext *C,
                            KnifeTool_OpData *kcd,
                            const bool only_select,
                            const bool cut_through,
+                           const bool xray,
                            const int visible_measurements,
                            const int angle_snapping,
                            const float angle_snapping_increment,
@@ -4163,6 +4164,7 @@ static void knifetool_init(bContext *C,
   kcd->is_interactive = is_interactive;
   kcd->cut_through = cut_through;
   kcd->only_select = only_select;
+  kcd->depth_test = xray;
   kcd->dist_angle_mode = visible_measurements;
   kcd->show_dist_angle = (kcd->dist_angle_mode != KNF_MEASUREMENT_NONE);
   kcd->angle_snapping_mode = angle_snapping;
@@ -4804,6 +4806,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
   const bool only_select = RNA_boolean_get(op->ptr, "only_selected");
   const bool cut_through = !RNA_boolean_get(op->ptr, "use_occlude_geometry");
+  const bool xray = !RNA_boolean_get(op->ptr, "xray");
   const int visible_measurements = RNA_enum_get(op->ptr, "visible_measurements");
   const int angle_snapping = RNA_enum_get(op->ptr, "angle_snapping");
   const bool wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input");
@@ -4823,6 +4826,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event)
                  kcd,
                  only_select,
                  cut_through,
+                 xray,
                  visible_measurements,
                  angle_snapping,
                  angle_snapping_increment,
@@ -4915,6 +4919,7 @@ void MESH_OT_knife_tool(wmOperatorType *ot)
                   "Occlude Geometry",
                   "Only cut the front most geometry");
   RNA_def_boolean(ot->srna, "only_selected", false, "Only Selected", "Only cut selected geometry");
+  RNA_def_boolean(ot->srna, "xray", true, "X-Ray", "Show cuts through geometry");
 
   RNA_def_enum(ot->srna,
                "visible_measurements",
@@ -4981,6 +4986,7 @@ void EDBM_mesh_knife(bContext *C, ViewContext *vc, LinkNode *polys, bool use_tag
   {
     const bool only_select = false;
     const bool is_interactive = false; /* Can enable for testing. */
+    const bool xray = false;
     const int visible_measurements = KNF_MEASUREMENT_NONE;
     const int angle_snapping = KNF_CONSTRAIN_ANGLE_MODE_NONE;
     const float angle_snapping_increment = KNIFE_DEFAULT_ANGLE_SNAPPING_INCREMENT;
@@ -4992,6 +4998,7 @@ void EDBM_mesh_knife(bContext *C, ViewContext *vc, LinkNode *polys, bool use_tag
                    kcd,
                    only_select,
                    cut_through,
+                   xray,
                    visible_measurements,
                    angle_snapping,
                    angle_snapping_increment,



More information about the Bf-blender-cvs mailing list