Skip to content

Commit

Permalink
update callback functions to new signature and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
schl3ck committed May 8, 2022
1 parent 37ba41e commit ac13918
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
5 changes: 1 addition & 4 deletions info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ author = "schl3ck"
category = "Map Editor"

siteid = 109
version = "1.3.0"

[game]
min_version = "2021-08-30"
version = "1.3.1"

[script]
imports = [ "Icons.as", "Permissions.as" ]
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Download it from https://openplanet.nl/files/109. You can also find a tutorial t
You can find the source code to this plugin on [GitHub](https://github.com/schl3ck/OPPlugin-advanced-free-block-mode)

# Changelog
## v1.3.1 - 2022-05-08
* Update callback functions to new signature

## v1.3.0 - 2022-02-20
* Add ability to use modifier keys for keyboard shortcuts
* Organize sections of UI into collapsing headers
Expand Down
14 changes: 7 additions & 7 deletions src/Main.as
Original file line number Diff line number Diff line change
Expand Up @@ -930,26 +930,26 @@ void RenderInterface() {
}
}

bool OnKeyPress(bool down, VirtualKey key) {
UI::InputBlocking OnKeyPress(bool down, VirtualKey key) {
if (settingKeyInfoWaitingForKey !is null) {
if (!ModifierKeys::Handle(down, key)) {
auto keys = ModifierKeys::GetKeys(key);
Keybindings::SetKey(settingKeyInfoWaitingForKey.name, keys);
@settingKeyInfoWaitingForKey = null;
return true;
return UI::InputBlocking::Block;
}
}

if (!settingShowInterface)
return false;
return UI::InputBlocking::DoNothing;
CGameCtnEditorFree@ editor = GetMapEditor();
if (editor is null)
return false;
return UI::InputBlocking::DoNothing;

// maybe handles it twice, but that is no problem
ModifierKeys::Handle(down, key);

if (!down) return false;
if (!down) return UI::InputBlocking::DoNothing;

bool handled = false;
vec3 move = vec3();
Expand Down Expand Up @@ -979,7 +979,7 @@ bool OnKeyPress(bool down, VirtualKey key) {
+ " the block: \\$z"
+ tostring(settingNudgeModeRotation)
);
return false;
return UI::InputBlocking::DoNothing;
}

VirtualKey[] keyCombination = ModifierKeys::GetKeys(key);
Expand Down Expand Up @@ -1087,7 +1087,7 @@ bool OnKeyPress(bool down, VirtualKey key) {
handled = true;
}
}
return handled;
return handled ? UI::InputBlocking::Block : UI::InputBlocking::DoNothing;
}

void FocusCameraOnPivot() {
Expand Down

0 comments on commit ac13918

Please sign in to comment.