Open misaki-eymard opened 1 month ago
I find it works on Windows. Maybe this is a macOS bug.
Sorry, my test was not sufficient. I confirmed that it works if you change the default key to another key, although I tried it on Mac PC. Changing the following key settings made it work:
Weights - Strength+: N
Weights - Strength-: O
Also, I found that even with the default key settings, holding down ctrl
works. There should be no reason why "opt + key" combinations should not work, since hotkeys for opening views, such as opt + A
to open the Animation view, work. So in any case, I think there may be some issues specific to Mac PCs.
The problem is related to the fact that when you press opt
on Mac, then you get another character:
opt + '
produce the char æ
(keycode is 75 that is the same of '
)opt + ;
produce the char …
(keycode is 74 that is the same of ;
)Also:
opt + A
produce the char å
(keycode is 29 that is the same of a
)However during hotkeys initialization there is an important difference. In Hotkeys#load
the hotkeys are initialized like this:
opt + '
: { keycode: 0, keyName: ', character: ' }
opt + ;
: { keycode: 0, keyName: ;, character: ; }
opt + A
: { keycode: 29, keyName: A, character: A }
Keycode is 0 for the first two cases because the code doesn't enter this if (repeat
is true):
if (!repeat || keyName.length() != 1) {
try {
keycode = (Integer)Input.Keys.class.getField(keyName).get(null);
} catch (Throwable ex) {
errors.add($("Invalid key name: ") + originalKeyName);
}
}
and in any case it seems there is no mapping available in Input.Keys
for the two keys above.
Consequently, when Hotkeys.fire(char character)
is triggered typing opt + '
, we receive æ
as character
and the line:
Array<Hotkey> charHotkeys = characterToHotkeys.get(character);
won't find the keyword corresponding to opt + '
.
This is confirmed by the fact that if I change the hotkey to opt + æ
, they hotkeys is triggered.
The reason why typing opt + A
works even though it sends the character å
, is because there is also the Hotkeys.fire(int keycode)
.
Pressing opt + A
will send the keycode 29
that is registered in the hotkeys.
The line:
Array<Hotkey> keycodeHotkeys = keycodeToHotkeys.get(keycode);
is able to find the corresponding keycode.
Description: The following hotkeys for changing the
Strength
forAdd
orRemove
Weight mode does not seem to be working:Weights - Strength+: opt + '''
Weights - Strength-: opt + ';'
Expected behavior: When you are selecting
Add
orRemove
in the weight view, you can change theStrength
using the corresponding hotkey.Steps to reproduce:
Add
orRemove
.Strength+
orStrength-
hotkey.The version of Spine in which this issue was found: Spine 4.2.29