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

Hotkey Support #111

Open
keyle opened this issue Sep 25, 2020 · 3 comments
Open

Hotkey Support #111

keyle opened this issue Sep 25, 2020 · 3 comments

Comments

@keyle
Copy link

keyle commented Sep 25, 2020

Hi there

I'm constantly iterating and having to find "QodotMap" in the scene tree to click Full Build many times. I'm trying to automate this but no luck so far (I tried with _notification NOTIFICATION_WM_FOCUS_IN as bruteforce, no luck)

Godot can see the resource has changed upon editor focus, is there a way to either automate this or set a keyboard shortcut from Project/Tools?

Ideally there would be a checkbox in the Qodot Map panel saying "Auto full build on map changed" or an editor keyboard shortcut...

Thanks

@keyle
Copy link
Author

keyle commented Sep 26, 2020

Ok I mate a simple plugin that will regen from anywhere in the editor via CTRL_R.

I think this should be part of the functionality though, if possible.

ref.

func _unhandled_key_input(event: InputEventKey) -> void:
	if event.is_pressed() and event.scancode == KEY_R and event.control:
		var qodot = get_tree().get_edited_scene_root().find_node("QodotMap")
		if not qodot:
			print("no qodot")
			return
		if qodot.has_method("build_map"):
			qodot.build_map()
		else:
			print("could not find build_map method")

@Pio64
Copy link

Pio64 commented Nov 3, 2020

Related to #91.

@Shfty
Copy link
Member

Shfty commented Nov 7, 2020

As pio mentioned, resource-based auto reloading is already covered by #91. A hotkey for invoking a full rebuild is a good idea though, so I'll rename this issue to cover that.

In terms of an official implementation, hooking directly into _unhandled_key_input with a hardcoded check doesn't seem like the best approach, since the editor already has a hotkey system that will probably conflict with or execute alongside the plugin-side Control+R if some existing binding is registered with the editor.

A brief sweep of the docs doesn't reveal any obvious API for manipulating editor shortcuts, but EditorSettings is probably a good next place to look. Worst-case, the hotkey can be stored in a regular Qodot EditorSettings section and handled manually.

There's also the ShortCut resource type that can couple a key combination to a UI control, which could be a usable entrypoint if applied to the Full Build button in the top bar.

Will need to do some more research and see what the best approach is.

@Shfty Shfty changed the title Option to automatically rebuild on map change? Hotkey support Nov 7, 2020
@Shfty Shfty changed the title Hotkey support Hotkey Support Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants