Ray Cast Selection

add-ons

(uruburei) #21

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


(Zimlorog) #22

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


#23

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'}

(Darcvizer) #24

yes


#25

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


(Darcvizer) #26

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


(Michael Knubben) #27

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!


(Darcvizer) #28

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.


(Zimlorog) #29

Here’s my setup.


(mattaudio) #30

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