From 094b428c17f51f2a5290526702659cf1ddaf09c0 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Thu, 1 Aug 2024 16:29:52 +0700 Subject: [PATCH] - [Graph, Preview Panel] Fix single modifier hotket not triggering (use to activate ctrl, alt click for pan/zoom) --- scripts/globals/globals.gml | 2 +- scripts/hotkey_data/hotkey_data.gml | 3 +-- scripts/key_press/key_press.gml | 4 ++-- scripts/node_rm_cloud/node_rm_cloud.gml | 20 ++++++++++++++------ scripts/panel_graph/panel_graph.gml | 7 ++++--- shaders/sh_rm_cloud/sh_rm_cloud.fsh | 10 +++++----- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 33180cce0..e67bf8e87 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -39,7 +39,7 @@ LATEST_VERSION = 11700; VERSION = 11780; SAVE_VERSION = 11700; - VERSION_STRING = "1.17.9.006"; + VERSION_STRING = "1.17.9.007"; BUILD_NUMBER = 11780; HOTKEYS = ds_map_create(); diff --git a/scripts/hotkey_data/hotkey_data.gml b/scripts/hotkey_data/hotkey_data.gml index 045f42cc7..0ed103af1 100644 --- a/scripts/hotkey_data/hotkey_data.gml +++ b/scripts/hotkey_data/hotkey_data.gml @@ -132,8 +132,7 @@ } function addHotkey(_context, _name, _key, _mod, _action) { - if(is_string(_key)) - _key = key_get_index(_key); + if(is_string(_key)) _key = key_get_index(_key); var key = new hotkeyObject(_context, _name, _key, _mod, _action); diff --git a/scripts/key_press/key_press.gml b/scripts/key_press/key_press.gml index 7a89b3f0d..3cecced38 100644 --- a/scripts/key_press/key_press.gml +++ b/scripts/key_press/key_press.gml @@ -148,7 +148,7 @@ enum MOD_KEY { function key_press(_key, _mod = MOD_KEY.none) { if(WIDGET_CURRENT) return false; - if(_mod == MOD_KEY.none && _key == 0) return false; + if(_mod == MOD_KEY.none && _key == noone) return false; - return keyboard_check_pressed(_key) && HOTKEY_MOD == _mod; + return (_key == noone || keyboard_check_pressed(_key)) && HOTKEY_MOD == _mod; } \ No newline at end of file diff --git a/scripts/node_rm_cloud/node_rm_cloud.gml b/scripts/node_rm_cloud/node_rm_cloud.gml index 1e4cc106f..fdce43199 100644 --- a/scripts/node_rm_cloud/node_rm_cloud.gml +++ b/scripts/node_rm_cloud/node_rm_cloud.gml @@ -32,12 +32,16 @@ function Node_RM_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) inputs[| 10] = nodeValue("Detail Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5) .setDisplay(VALUE_DISPLAY.slider); + inputs[| 11] = nodeValue("Shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Volume", "Plane" ]); + outputs[| 0] = nodeValue("Surface Out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); input_display_list = [ 0, ["Transform", false], 1, 2, 3, ["Camera", false], 4, 5, - ["Cloud", false], 6, 8, 7, 9, 10, + ["Cloud", false], 11, 6, 8, + ["Noise", false], 7, 9, 10, ]; static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {} @@ -56,10 +60,12 @@ function Node_RM_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _fov = _data[4]; var _rng = _data[5]; - var _dens = _data[6]; - var _itrr = _data[7]; - var _thrs = _data[8]; - var _dsca = _data[9]; + var _type = _data[11]; + var _dens = _data[ 6]; + var _thrs = _data[ 8]; + + var _itrr = _data[ 7]; + var _dsca = _data[ 9]; var _datt = _data[10]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); @@ -73,9 +79,11 @@ function Node_RM_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) shader_set_f("fov", _fov); shader_set_2("viewRange", _rng); - shader_set_i("iteration", _itrr); + shader_set_i("type", _type); shader_set_f("density", _dens); shader_set_f("threshold", _thrs); + + shader_set_i("iteration", _itrr); shader_set_f("detailScale", _dsca); shader_set_f("detailAtten", _datt); diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index e123413e8..2b5bbc00c 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -187,11 +187,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { highlight : false, } - connection_param = new connectionParameter(); + connection_param = new connectionParameter(); + show_view_control = 1; bg_color = c_black; - - show_view_control = 1; #endregion #region ---- position ---- @@ -842,9 +841,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(mouse_press(PREFERENCES.pan_mouse_key)) { _doDragging = true; drag_key = PREFERENCES.pan_mouse_key; + } else if(mouse_press(mb_left) && graph_dragging_key) { _doDragging = true; drag_key = mb_left; + } else if(mouse_press(mb_left) && graph_zooming_key) { _doZooming = true; drag_key = mb_left; diff --git a/shaders/sh_rm_cloud/sh_rm_cloud.fsh b/shaders/sh_rm_cloud/sh_rm_cloud.fsh index bd89fe1a8..4378b5f41 100644 --- a/shaders/sh_rm_cloud/sh_rm_cloud.fsh +++ b/shaders/sh_rm_cloud/sh_rm_cloud.fsh @@ -15,6 +15,7 @@ uniform float objectScale; uniform float fov; uniform vec2 viewRange; +uniform int type; uniform float density; uniform int iteration; uniform float threshold; @@ -195,7 +196,10 @@ float volume(vec3 pos, float ratio) { ds *= d1; - return ds; + if(type == 0) return ds; + else if(type == 1) return smoothstep(-.1, .1, pos.y) * ds; + + return 0.; } float marchDensity(vec3 camera, vec3 direction) { @@ -225,10 +229,6 @@ void main() { dir = normalize(vec3((v_vTexcoord - .5) * 2., -z)); eye = vec3(0., 0., 5.); - // vec2 cps = (v_vTexcoord - .5) * 2.; - // dir = vec3(0., 0., -1.); - // eye = vec3(cps, 5.); - dir = normalize(irotMatrix * dir) / objectScale; eye = irotMatrix * eye; eye /= objectScale;