imjp94/gd-blender-3d-shortcuts

Scale operation shortcut conflicts with 3D editor free look shortcut

Closed this issue ยท 11 comments

Scale operation is activating when you have selected object, hold RMB and try to move backwards

imjp94 commented

Confirmed, scale operation shortcut conflicts with 3d editor free look shortcut

But there's nothing we can do about it, as there's no way to tell if the editor is doing free look.
Besides, Y key which used to constrain to y-axis, is also conflicting with "Use Snap" shortcut

Current workaround would be changing editor input mapping

And I think I should document these conflicting shortcuts to README

Can't we just make the function return if we have the right mouse button pressed?

Can't we just make the function return if we have the right mouse button pressed?

Quick fix for free look, working as far as I know, is:

var _already_pressing_left_mouse_button = false

[...]
func _forward_3d_gui_input(camera, event):
	
	var forward = false
	if current_session == SESSION.NONE:
		# solve conflict with free look
		if event is InputEventMouseButton:
			if event.button_index == MOUSE_BUTTON_RIGHT:
				_already_pressing_left_mouse_button = event.is_pressed()
		
		if _is_editing:
			if event is InputEventKey:
				if event.pressed:
					match event.keycode:
						[...]
						KEY_S:
							if not event.ctrl_pressed:
								# solve conflict with free look
								if not _already_pressing_left_mouse_button:
									start_session(SESSION.SCALE, camera, event)
									forward = true
						[...]

I also suggest remapping local space to U and snap grid to I for a better experience (imo)

EDIT:
if you change the local space and snap grid shortcuts the addon will fail some checks. To avoid the errors the KEY_T and KEY_Y may be changed opportunely in the code that pushes the error

Hey @farfalk, thanks for the code, it works great for me!
Do you want to make a pull request, or shall I do it?

And for the shortcut keys of local space and snap grid, I think it is better to respect user's editor setting.

Hey @farfalk, thanks for the code, it works great for me!
Do you want to make a pull request, or shall I do it?

And for the shortcut keys of local space and snap grid, I think it is better to respect user's editor setting.

@imjp94 As you want! I can make a PR by the weekend if you're ok with that :)

Regarding the shortcuts: I noticed your TODOs, I totally agree, but couldn't find a way to read editor settings unfortunately... instead, I found a Godot PR proposing a way to obtain them, so I figured it's still not possible to read them... Have you got any suggestion?

P.s. didn't realize you're the same dev who made YAFSM! Nice to see you again ;)

As you want! I can make a PR by the weekend if you're ok with that :)

Sure, that would be great! Thank you!

Have you got any suggestion?

No, I haven't figure out a solution for this yet

P.s. didn't realize you're the same dev who made YAFSM! Nice to see you again ;)

Haha, nice to see you again too =)

@farfalk

I just figured out a way to get shortcut key for both local space and snap grid, it is as simple as accessing the shortcut property of the local_space_button:

local_space_button.shortcut

It works even if the user change the input mapping in editor settings.

@farfalk

I just figured out a way to get shortcut key for both local space and snap grid, it is as simple as accessing the shortcut property of the local_space_button:

local_space_button.shortcut

It works even if the user change the input mapping in editor settings.

That's nice, good catch! Do you want to handle it yourself or should I try your suggestion in the same PR?

That's nice, good catch! Do you want to handle it yourself or should I try your suggestion in the same PR?

Can you help me to add it to the same PR? It is a small edit anyway, thank you =P

@imjp94 on second thought I don't understand your suggestion... local_space_button is a property of the plugin, populated by

local_space_button = Utils.get_spatial_editor_local_space_button(spatial_editor)

The definition of Utils.get_spatial_editor_local_space_button(spatial_editor) is:

static func get_spatial_editor_local_space_button(spatial_editor):
	var children = recursive_get_children(spatial_editor)
	for child in children:
		if child.get_class() == "Button":
			if child.shortcut:
				if child.shortcut.get_as_text() == OS.get_keycode_string(KEY_T):# TODO: Check if user has custom shortcut
					return child

Your suggestion seems to be to use local_space_button.shortcut inside this code, but that doesn't make sense to me, because it would be a recursion. So: how do you propose to proceed?

@farfalk
Oppss, sorry, I didn't realized that's how I extract the button in the first place...