From 824c5f432360e2fd916d8a1542f9161f96f2a900 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Fri, 12 Jul 2024 07:34:22 +0700 Subject: [PATCH] - [Preview Panel] Fix 3D preview depth error. --- scripts/node_processor/node_processor.gml | 2 ++ scripts/node_shadow/node_shadow.gml | 9 ++++++--- scripts/panel_preview/panel_preview.gml | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index c8c0237b4..ed60cf257 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -41,6 +41,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct static getSingleValue = function(_index, _arr = preview_index, output = false) { var _l = output? outputs : inputs; + if(_index < 0 || _index >= ds_list_size(_l)) return 0; + var _n = _l[| _index]; var _in = output? _n.getValue() : getInputData(_index); diff --git a/scripts/node_shadow/node_shadow.gml b/scripts/node_shadow/node_shadow.gml index 1a2399866..1b908d880 100644 --- a/scripts/node_shadow/node_shadow.gml +++ b/scripts/node_shadow/node_shadow.gml @@ -56,7 +56,10 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var ww = surface_get_width_safe(_surf) * _s; var hh = surface_get_height_safe(_surf) * _s; - var hv = inputs[| 3].drawOverlay(hover, active, _x + ww / 2, _y + hh / 2, _s, _mx, _my, _snx, _sny); _hov |= hv; + var _typ = getSingleValue(11); + + if(_typ == 0) { var hv = inputs[| 3].drawOverlay(hover, active, _x + ww / 2, _y + hh / 2, _s, _mx, _my, _snx, _sny); _hov |= hv; } + else if(_typ == 1) { var hv = inputs[| 12].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); _hov |= hv; } return _hov; } @@ -87,8 +90,8 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var _shay = _shf[1]; if(_posi == 1) { - _shax = _lgh[0] - _dim[0] / 2; - _shay = _lgh[1] - _dim[1] / 2; + _shax = _dim[0] / 2 - _lgh[0]; + _shay = _dim[1] / 2 - _lgh[1]; } surface_set_shader(pass1, sh_outline_only); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index bda3a2df2..2e1fd0a5a 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -950,6 +950,8 @@ function Panel_Preview() : PanelContent() constructor { } #endregion function draw3DPolygon(_node) { #region + surface_depth_disable(false); + _node.previewing = 1; d3_scene_preview = struct_has(_node, "scene")? _node.scene : d3_scene; @@ -1134,6 +1136,8 @@ function Panel_Preview() : PanelContent() constructor { #endregion d3_scene_preview.camera.resetCamera(); + + surface_depth_disable(true); } #endregion function draw3DSdf(_node) { #region