imjp94/gd-blender-3d-shortcuts

Z shortcut is active in 2D, script editor, etc

Closed this issue ยท 8 comments

dc1248 commented

That's the only one I notice but you should check your code thoroughly.

Other than that, love it!

imjp94 commented

Confirmed, the pie menu is showing up in 2d editor.
Thanks!

dc1248 commented

Gave it a stab today, could not figure it out from the docs, so I started looking at other plugins and found a solution. Sweet.

Add this at the end of _ready():

	connect("main_screen_changed", _main_screen_changed)

func _main_screen_changed(screen_name):
	_is_active = screen_name == "3D"

And change the 9th line of _input() to:
if _is_active and not (event.ctrl_pressed or event.alt_pressed or event.shift_pressed) and current_session == SESSION.NONE:

Thanks for the code snippets, these did the trick for me for the script editor itself.

I noticed that the issue is still cropping up in the other editor windows- for example, while the 3D view is active, I'm unable to type "z" in the shader editor, or in the search bars of the scene or the filesystem tabs, even though that doesn't launch the pie menu, either.

Loving the addon in general, just wanted to chime in with additional notes on this fix.

Oh yeah, that's a problem for all panels in 3D view - bottom, inspector, scene, filesystem, etc. Wait a minute... in my other bug report (#19) I noticed an error message when you press Z in those areas. This code already has all the information it needs.

We need a null check in this function:

func show_debug_draw_pie_menu():
	var spatial_editor_viewport = Utils.get_focused_spatial_editor_viewport(spatial_editor_viewports)
	overlay_control = Utils.get_spatial_editor_viewport_control(spatial_editor_viewport) if spatial_editor_viewport else null
+	if not overlay_control:
+		return false
	if overlay_control_canvas_layer.get_parent() != overlay_control:
		overlay_control.add_child(overlay_control_canvas_layer)
	if debug_draw_pie_menu.get_parent() != overlay_control_canvas_layer:
		overlay_control_canvas_layer.add_child(debug_draw_pie_menu)
		var viewport = Utils.get_spatial_editor_viewport_viewport(spatial_editor_viewport)

	debug_draw_pie_menu.popup(overlay_control.get_global_mouse_position())
+	return true

And we should only consume the Z key if that function actually launches the pie menu:

							if show_debug_draw_pie_menu():
								get_viewport().set_input_as_handled()

If I keep working on this addon I should fork it instead of just posting snippets, lol. Are you still maintaining this @imjp94? What about you @NathanLovato, would you want to take it over if he's not? I don't really want to but I could, as long as I'm using it anyway.

@dc1248
Thanks for debugging the plugin!
And, yes, I am still actively maintaining this project, just got a little busy lately and might not be able to response immediately.

Feel free to fork and make a pull request =)

@imjp94 Thanks, will do! I may attempt some more polishing first, but I'll try to do that fairly soon.

Hello guys. Unfortunately also seeing this in Code Editor, which does not allow to code sometimes(

image

@dc1248 @imjp94 There's now a pull request to fix this issue with dc1248's changes from this thread