Turn cycle_layers shortcut into select_layer
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"stencil_hide": "z",
|
||||
"decal_mask": "ctrl",
|
||||
"select_material": "shift+number",
|
||||
"cycle_layers": "ctrl+tab",
|
||||
"select_layer": "ctrl+number",
|
||||
"brush_radius": "f",
|
||||
"brush_radius_decrease": "[",
|
||||
"brush_radius_increase": "]",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"stencil_hide": "z",
|
||||
"decal_mask": "ctrl",
|
||||
"select_material": "shift+number",
|
||||
"cycle_layers": "ctrl+tab",
|
||||
"select_layer": "ctrl+number",
|
||||
"brush_radius": "f",
|
||||
"brush_radius_decrease": "[",
|
||||
"brush_radius_increase": "]",
|
||||
|
||||
@@ -317,6 +317,11 @@ class Context {
|
||||
});
|
||||
}
|
||||
|
||||
public static function selectLayer(i: Int) {
|
||||
if (Project.layers.length <= i) return;
|
||||
setLayer(Project.layers[i]);
|
||||
}
|
||||
|
||||
public static function setLayer(l: LayerSlot, isMask = false) {
|
||||
if (l == layer && layerIsMask == isMask) return;
|
||||
layer = l;
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef TKeymap = {
|
||||
public var stencil_hide: String;
|
||||
public var decal_mask: String;
|
||||
public var select_material: String;
|
||||
public var cycle_layers: String;
|
||||
public var select_layer: String;
|
||||
public var brush_radius: String;
|
||||
public var brush_radius_decrease: String;
|
||||
public var brush_radius_increase: String;
|
||||
|
||||
@@ -26,6 +26,7 @@ class Operator {
|
||||
alt == kb.down("alt");
|
||||
if (s.indexOf("+") > 0) {
|
||||
s = s.substr(s.lastIndexOf("+") + 1);
|
||||
if (s == "number") return flag;
|
||||
}
|
||||
else if (shift || ctrl || alt) return flag;
|
||||
var key = (s == "left" || s == "right" || s == "middle") ?
|
||||
|
||||
@@ -165,11 +165,7 @@ class UISidebar {
|
||||
if (!App.uiEnabled) return;
|
||||
|
||||
if (!UINodes.inst.ui.isTyping && !ui.isTyping) {
|
||||
if (Operator.shortcut(Config.keymap.cycle_layers)) {
|
||||
var i = (Project.layers.indexOf(Context.layer) + 1) % Project.layers.length;
|
||||
Context.setLayer(Project.layers[i]);
|
||||
}
|
||||
else if (Operator.shortcut(Config.keymap.toggle_2d_view)) {
|
||||
if (Operator.shortcut(Config.keymap.toggle_2d_view)) {
|
||||
show2DView(View2DLayer);
|
||||
}
|
||||
else if (Operator.shortcut(Config.keymap.toggle_node_editor)) {
|
||||
@@ -270,10 +266,14 @@ class UISidebar {
|
||||
|
||||
var isTyping = ui.isTyping || UIView2D.inst.ui.isTyping || UINodes.inst.ui.isTyping;
|
||||
if (!isTyping) {
|
||||
if (kb.down("shift")) {
|
||||
if (Operator.shortcut(Config.keymap.select_material, ShortcutDown)) {
|
||||
for (i in 1...10) if (kb.started(i + "")) Context.selectMaterial(i - 1);
|
||||
}
|
||||
else if (Operator.shortcut(Config.keymap.select_layer, ShortcutDown)) {
|
||||
for (i in 1...10) if (kb.started(i + "")) Context.selectLayer(i - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Viewport shortcuts
|
||||
var inViewport = mouse.viewX > 0 && mouse.viewX < right &&
|
||||
mouse.viewY > 0 && mouse.viewY < iron.App.h();
|
||||
@@ -344,7 +344,7 @@ class UISidebar {
|
||||
}
|
||||
|
||||
// Viewpoint
|
||||
if (mouse.viewX < iron.App.w()) {
|
||||
if (mouse.viewX < iron.App.w() && !kb.down("control") && !kb.down("shift")) {
|
||||
if (Operator.shortcut(Config.keymap.view_reset)) {
|
||||
ViewportUtil.resetViewport();
|
||||
ViewportUtil.scaleToBounds();
|
||||
|
||||
Reference in New Issue
Block a user