Component Selection Distance (2.8 beta source)

I want to fix the selection threshold for single-click near components. It’s way too big. This hurts clicking empty space to deselect. I do not care about keyboard shortcuts to accomplish this.

Faces work fine. It doesn’t select the nearest face in a 20 pixel radius. My knowledge is very limited, but I fixed verts. Edges are the problem, the same fix doesn’t work. I’ve tried a lot of things that do nothing.

Please, somebody help me out.

The magic happens here:
blender-git\blender\source\blender\editors\mesh\editmesh_select.c

I found out where to look from this post:

Changing those values (lines 407 & 408) has no effect on selection threshold.

I already have verts working great, and can adjust their selection threshold to any size I wish.
You can do this by changing line 492 from
if (dist_test < *r_dist)
to
if (dist_test < some value)

For whatever reason, edges work different. Changing the the same area (line 705) doesn’t do anything.

Some more info:
For line 492, just use a value that fits with the hotbox placement and the size/shape of your cursor. I have it working perfectly with my custom cursor (it’s a ripoff from another app)
The original doesn’t fit inside 16 pixels, so I won’t be using small cursor.

The only difference between mine and the one I ripped off is the sides of my box are 1 pixel longer so the hotbox is centered. This cursor is designed around the concept of showing the selection threshold without blocking it’s center. I never even thought about it until I had to use the Blender crosshair for a few minutes.

I set line 492 to (dist_test < 7) because that’s where the center of my box is. Origin is topleft. Verts are (de)selected if inside the box, and they are left alone if they are outside the box.

I stumbled my way into fixing verts by commenting out big swaths of applicable code until I could
1. Build
2. Not crash when selecting
3. Stop selecting
4. Try to wrap my head around what is going on in the remaining commented area
5. Put it back the way it was and play around with stuff until I got somewhere

Right now I’m pretty tired so I probably won’t reply until I get some sleep.
Thanks!

1 Like

Ok awesome got Edges working, just needed some time away. Simple comparison between BMEdge and BMVert showed some things that also needed removing.

In addition to changing the edge section regarding dist_test being less than *r_dist (Line 705) to match up with your vert section (Line 492) you need to comment out Line 683-5.

if (r_eed_zbuf) {
*r_eed_zbuf = eed;
}

You can just do an open comment on 683, it will be closed by the close comment on Line 687.

All the line numbers and composition is obviously going to change as development progresses, just use common sense.

Was about to move on to the next thing I wanted to change when I noticed blender is still using the extremely big selection mode while in xray view. Will do it tomorrow, hopefully it’s easy.

Not even a peep about any of this is kinda surprising. I know I’m not the only one who hates the default selection radius

Fixed xray view to be the same.

Look for “data.hit.dist” in the vert, edge, and face sections (currently lines 518, 733, & 900). Instead of = *r_dist make it equal to your threshold value, 7 for me. You cannot set it directly to 7, it has to go through the same sequence of things (data.hit.dist = data.hit_cycle.dist = data.hit.dist_bias = data.hit_cycle.dist_bias = 7;)

Would be interesting if someone who knows a thing or two about all this moon language and what it does could explain why it isn’t in the settings somewhere. Is it unable to change at runtime? Maybe create an outside program for custom cursor design and setup?

I guess this is the way it is either because there’s not enough interest in making it work better, or it would require rebuild to implement (meaning ~6GB of lib files to download for anyone interested)