Some XK buttons don't work for event actions + interesting anim behavior

Stuck at a level? Need help with R'n'D or anything R'n'D related? Post here!

Moderators: Zomis, Flumminator

Post Reply
Eizzoux
Posts: 307
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

Some XK buttons don't work for event actions + interesting anim behavior

Post by Eizzoux » Thu Mar 14, 2019 7:10 am

Maybe I just don't get it, but I tried to make zoom out button in editor by setting 'anim_event_action: XK_minus', but that just doesn't work for some reason.

Code: Select all

global.anim_10.part_1.EDITOR.anim_event:		click
global.anim_10.part_1.EDITOR.anim_event_action:		XK_minus
global.anim_10.part_1.EDITOR.class:			window
I checked if 'XK_minus' is correct, set [-] for snap shortcut, opened 'setup.conf', found 'shortcut.snap_left: XK_minus # -', but yes, it's is correct. Instead, it actually blocks any of zoom buttons ('-', '0', '+') and only unblocks when you click anywhere except the anim.
So I tried at least do 'XK_0', but still the same actions. I'm a little bit frazzled :?:

What's more interesting, it actually keeps the global anim button pressed when I hold on it despite the fact that there's only one anim part with just two anim frames.

Code: Select all

gfx.global.anim_10.part_1.EDITOR.frames:	2
gfx.global.anim_10.part_1.EDITOR.delay:		4
gfx.global.anim_10.part_1.EDITOR.anim_mode:	linear
gfx.global.anim_10.part_1.EDITOR.xoffset:	1
gfx.global.anim_10.part_1.EDITOR.yoffset:	1
I assume that's because it kinda clicks the anim rapidly every frame without stopping when '.delay: 4', not really sure.
Nothing in here...*

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Some XK buttons don't work for event actions + interesting anim behavior

Post by Holger » Thu Mar 14, 2019 8:40 am

That's interesting... I will check what's going on there, and see what can be done about it! :?

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Some XK buttons don't work for event actions + interesting anim behavior

Post by Holger » Sun Mar 17, 2019 7:42 pm

Maybe I just don't get it, but I tried to make zoom out button in editor by setting 'anim_event_action: XK_minus', but that just doesn't work for some reason.
Found the reason for this unwanted behaviour: The code contained a check that prevented key events from being handled when a mouse button is pressed. Not sure anymore which edge case I wanted to handle with this condition (and usually you probably do not press any keys while holding the mouse button pressed), but in this case it prevented global animation key event actions from being processed, as the mouse button is pressed and a key event is injected into the event queue by the animation's event action.

Fixed this!

I have created a new executable at the usual "development" location. Creating zoom in/out buttons works fine now (just created a test set by myself, but your existing definitions should just work fine now).
What's more interesting, it actually keeps the global anim button pressed when I hold on it despite the fact that there's only one anim part with just two anim frames.
Not able to reproduce what you described. When using your definitions (one single animation part with a two-frame animation), the animation just plays as defined, by endlessly changing between those two animation frames, regardless of the animation being clicked or not (because the "click" event will just restart the animation, then continuing the two-frame animation sequence again).

To create a button that works as expected, create two animation parts instead, one being normal (first part), one being pressed (second part), with the first part changing to the second part when being clicked (then triggering the event action to zoom in or out).

Eizzoux
Posts: 307
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

Re: Some XK buttons don't work for event actions + interesting anim behavior

Post by Eizzoux » Tue Mar 19, 2019 8:32 am

Holger wrote:
Sun Mar 17, 2019 7:42 pm
I have created a new executable at the usual "development" location. Creating zoom in/out buttons works fine now (just created a test set by myself, but your existing definitions should just work fine now).

To create a button that works as expected, create two animation parts instead, one being normal (first part), one being pressed (second part), with the first part changing to the second part when being clicked (then triggering the event action to zoom in or out).
Yeah, I tried this too, and it works perfectly... Even in my method of creating the Undo button:

Code: Select all

global.anim_23.part_1.EDITOR.anim_event:	click
global.anim_23.part_1.EDITOR.class:		window
global.anim_23.part_2.EDITOR.anim_event:	unclick:any
global.anim_23.part_2.EDITOR.anim_delay_fixed:	100
global.anim_23.part_2.EDITOR.class:		window
global.anim_24.EDITOR.anim_event:		click:anim_23.part_1
global.anim_24.EDITOR.anim_event_action:	XK_Shift_L
global.anim_24.EDITOR.style:			multiple_actions
global.anim_25.EDITOR.anim_event:		click:anim_23.part_1
global.anim_25.EDITOR.anim_event_action:	XK_U
The ''anim_delay_fixed' is here just because when I click 'anim_23.part_1' with empty undo/redo buffers, it changes to 'anim_23.part_2', brings out the undo/redo buffers request and freezes the second part of anim because it waits for you to unclick only after closing the request. Same thing can also happen with 'anim_X.part.X.anim_event_action: editor.button.exit' when you haven't saved any changes yet or when you're saving changes with 'anim_X.part.X.anim_event_action: editor.button.save'.
Still good changes, hoping for new official update release :D
Nothing in here...*

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Some XK buttons don't work for event actions + interesting anim behavior

Post by Holger » Tue Mar 19, 2019 4:50 pm

Looks great -- very well engineered!

Do you really need the additional "XK_Shift_L" event action to make the "XK_U" (for "redo") work? I thought it would already have worked without, but apparently not (never tested this). Will have a look at it, but great to know that you solved it by yourself (using the "multiple_actions" option) anyway! :)

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Some XK buttons don't work for event actions + interesting anim behavior

Post by Holger » Fri Mar 22, 2019 9:51 am

Do you really need the additional "XK_Shift_L" event action to make the "XK_U" (for "redo") work?
I have tested this case, too: You can just use "XK_u" for "undo" and "XK_U" for "redo" -- no need for "XK_Shift_L"!

I have tested this with "XK_plus" and "XK_minus" for two zoom in/out buttons, and with "XK_u" and "XK_U" for two undo/redo buttons, and it works as expected.

But thanks for the clever trick with the delay which is needed to "unclick" the button when a request opens after clicking!

BTW: I have uploaded a new EXE for testing, but it should not have changed anything regarding the above issues (but you might like to work with the latest development version).

Post Reply