Ray Cast Selection

thanks and congratulations for the simplicity and great utility of this addon.

Thank you so much, it works perfectly! :+1:

Is there any reason you’re manually doing a raycast when the select operator you’re already using takes the event mouse location directly? I just tested it and was able to achieve the same effect with a much smaller operator. Not undermining your hard work, just curious if there’s a specific reason I don’t understand.

class VIEW3D_OT_raycast_select(Operator):
	bl_idname = "view3d.raycast_select"
	bl_label = "Raycast Select"
	bl_options = {'REGISTER', 'UNDO'}
	
	@classmethod
	def poll(cls, context):
		mode = bpy.context.active_object.mode
		return mode == 'OBJECT' or mode == 'EDIT'

	def modal(self, context, event):
		bpy.ops.view3d.select(extend=True, deselect=False, location=(event.mouse_region_x, event.mouse_region_y))

		if event.value == 'RELEASE':
			return {'FINISHED'}
		return {'RUNNING_MODAL'}

	def invoke(self, context, event):
		if  context.mode == "EDIT_MESH":
			bpy.ops.mesh.select_all(action='DESELECT')
		else:
			bpy.ops.object.select_all(action='DESELECT')
		
		context.window_manager.modal_handler_add(self)
		return {'RUNNING_MODAL'}

yes

Oh, i see- so without the specifc raycast it will just keep going and grab everything under the cursor?

Yes, raycast is a mask
Since I do not know English, I can not explain in detail

Any chance you could add this as an Active Tool in Blender 2.8? That way I could keep all of the other ways to select, and just set a hotkey for this tool, or select it on the left!

No, I think the Active Tool is a piece of shit. I do not want to waste my time for this pile to become more.
Sorry, but it is not in my interest.

2 Likes

Here’s my setup.

1 Like

Modo paint selection :slight_smile: this is awesome, thanks a lot !

Hello,
how do you activate tools when ray cast is set up to left mouse?
If I try to activate bevel tool it continues to select on surface.

I don’t use the new active tools.

If I understand correctly, this addon does just that : https://youtu.be/WPr_g5-T-fM ?

EDIT : indeed.
Thanks for this addon !

Nearly,

This has a conflict of your addon when problem from a curve or bezier.

Yes it is possible :face_with_raised_eyebrow:

1 Like

I also notice this error message when I try to edit a Bezier Curve, it also happens if I use the Bezier Utilities addon version 0.9.1.

I currently use blender-2.81-277875492564-win64.

I was just selecting faces when blender-2.81-883706395ee3-win64 crashed.
And here is what I got in the console:

location: :-1
Traceback (most recent call last):
File “C:\Users\Nadine\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\RayCastSelection.py”, line 34, in poll
mode = bpy.context.active_object.mode
AttributeError: ‘NoneType’ object has no attribute ‘mode’

location: :-1

location: :-1
Traceback (most recent call last):
File “C:\Users\Nadine\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\RayCastSelection.py”, line 34, in poll
mode = bpy.context.active_object.mode
AttributeError: ‘NoneType’ object has no attribute ‘mode’

location: :-1

location: :-1
Traceback (most recent call last):
File “C:\Users\Nadine\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\RayCastSelection.py”, line 34, in poll
mode = bpy.context.active_object.mode
AttributeError: ‘NoneType’ object has no attribute ‘mode’

location: :-1

location: :-1
Traceback (most recent call last):
File “C:\Users\Nadine\AppData\Roaming\Blender Foundation\Blender\2.81\scripts\addons\RayCastSelection.py”, line 34, in poll
mode = bpy.context.active_object.mode
AttributeError: ‘NoneType’ object has no attribute ‘mode’

.
.
.

I am not 100% sure that this crash is caused by Ray Cast Selection but I wanted to report this error anyway. I hope it helps…

How to decrease selecting range under cursor region?
When I try to select edges, it select some near the cursor.
Thanks.

Not like, and there is no such need.