Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dc1248 opened this issue Jul 16, 2023 · 8 comments · Fixed by #27
Closed

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

dc1248 opened this issue Jul 16, 2023 · 8 comments · Fixed by #27

Comments

@dc1248
Copy link

dc1248 commented Jul 16, 2023

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

Other than that, love it!

@imjp94
Copy link
Owner

imjp94 commented Jul 18, 2023

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

@dc1248
Copy link
Author

dc1248 commented Jul 27, 2023

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:

@axikita
Copy link

axikita commented Sep 24, 2023

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.

@dc1248
Copy link
Author

dc1248 commented Sep 24, 2023

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.

@imjp94
Copy link
Owner

imjp94 commented Sep 25, 2023

@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 =)

@dc1248
Copy link
Author

dc1248 commented Sep 25, 2023

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

@32kda
Copy link

32kda commented Nov 2, 2023

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

image

tmilker added a commit to tmilker/gd-blender-3d-shortcuts that referenced this issue Dec 2, 2023
@tmilker
Copy link
Contributor

tmilker commented Dec 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants