Fix loaded collection try to connect outside its context.

This commit is contained in:
Tanasart 2025-02-13 13:35:41 +07:00
parent cbf3c51db9
commit 1a7d14dc30
14 changed files with 114 additions and 94 deletions

View file

@ -218,6 +218,7 @@
{"name":"bool","order":2,"path":"folders/nodes/icons/value/bool.yy",},
{"name":"color","order":10,"path":"folders/nodes/icons/value/color.yy",},
{"name":"gradient","order":12,"path":"folders/nodes/icons/value/gradient.yy",},
{"name":null,"order":9,"path":"folders/panels/runner.yy",},
{"name":"matrix","order":4,"path":"folders/nodes/icons/value/matrix.yy",},
{"name":"mesh","order":9,"path":"folders/nodes/icons/value/mesh.yy",},
{"name":"number","order":1,"path":"folders/nodes/icons/value/number.yy",},
@ -270,6 +271,7 @@
{"name":"rotator","order":2,"path":"folders/widgets/rotator.yy",},
{"name":"sliders","order":3,"path":"folders/widgets/sliders.yy",},
{"name":"text","order":4,"path":"folders/widgets/text.yy",},
{"name":"runner","order":12,"path":"folders/panels/_others/runner.yy",},
],
"ResourceOrderSettings":[
{"name":"ac_disappear","order":2,"path":"animcurves/ac_disappear/ac_disappear.yy",},
@ -436,8 +438,8 @@
{"name":"__node_value_object","order":3,"path":"scripts/__node_value_object/__node_value_object.yy",},
{"name":"__node_value_processor","order":2,"path":"scripts/__node_value_processor/__node_value_processor.yy",},
{"name":"__node","order":1,"path":"scripts/__node/__node.yy",},
{"name":"__panel_empty","order":11,"path":"scripts/__panel_empty/__panel_empty.yy",},
{"name":"__panel_linear_setting","order":12,"path":"scripts/__panel_linear_setting/__panel_linear_setting.yy",},
{"name":"__panel_empty","order":12,"path":"scripts/__panel_empty/__panel_empty.yy",},
{"name":"__panel_linear_setting","order":13,"path":"scripts/__panel_linear_setting/__panel_linear_setting.yy",},
{"name":"__path","order":1,"path":"scripts/__path/__path.yy",},
{"name":"__pbBox","order":4,"path":"scripts/__pbBox/__pbBox.yy",},
{"name":"__polygon","order":2,"path":"scripts/__polygon/__polygon.yy",},
@ -1352,7 +1354,7 @@
{"name":"panel_image_array_editor","order":1,"path":"scripts/panel_image_array_editor/panel_image_array_editor.yy",},
{"name":"panel_inspector","order":1,"path":"scripts/panel_inspector/panel_inspector.yy",},
{"name":"panel_keyframe_driver","order":2,"path":"scripts/panel_keyframe_driver/panel_keyframe_driver.yy",},
{"name":"panel_menu","order":10,"path":"scripts/panel_menu/panel_menu.yy",},
{"name":"panel_menu","order":11,"path":"scripts/panel_menu/panel_menu.yy",},
{"name":"panel_node_align","order":3,"path":"scripts/panel_node_align/panel_node_align.yy",},
{"name":"panel_node_custom_import","order":2,"path":"scripts/panel_node_custom_import/panel_node_custom_import.yy",},
{"name":"panel_node_data_gen","order":1,"path":"scripts/panel_node_data_gen/panel_node_data_gen.yy",},

View file

@ -347,6 +347,7 @@
{"$GMFolder":"","%Name":"rotator","folderPath":"folders/widgets/rotator.yy","name":"rotator","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"sliders","folderPath":"folders/widgets/sliders.yy","name":"sliders","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"text","folderPath":"folders/widgets/text.yy","name":"text","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"runner","folderPath":"folders/panels/runner.yy","name":"runner","resourceType":"GMFolder","resourceVersion":"2.0",},
],
"IncludedFiles":[
{"$GMIncludedFile":"","%Name":"Addons.zip","CopyToMask":-1,"filePath":"datafiles/data","name":"Addons.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -1314,11 +1315,7 @@
{"$GMIncludedFile":"","%Name":"Canvas.png","CopyToMask":-1,"filePath":"datafiles/data/Welcome files/Templates","name":"Canvas.png","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Canvas.pxc","CopyToMask":-1,"filePath":"datafiles/data/Welcome files/Templates","name":"Canvas.pxc","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles/data/Welcome files","name":"Welcome files.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dllcredits.txt","ConfigValues":{
"Itch":{
"CopyToMask":"0",
},
},"CopyToMask":0,"filePath":"datafiles","name":"dllcredits.txt","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dllcredits.txt","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":0,"filePath":"datafiles","name":"dllcredits.txt","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"dlltest1.dll","CopyToMask":-1,"filePath":"datafiles","name":"dlltest1.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"ffmpeg.exe","CopyToMask":-1,"filePath":"datafiles/ffmpeg/bin","name":"ffmpeg.exe","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"LICENSE","CopyToMask":-1,"filePath":"datafiles/ffmpeg","name":"LICENSE","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -1337,11 +1334,7 @@
{"$GMIncludedFile":"","%Name":"mf.dll","CopyToMask":-1,"filePath":"datafiles","name":"mf.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"mfcore.dll","CopyToMask":-1,"filePath":"datafiles","name":"mfcore.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"mfplat.dll","CopyToMask":-1,"filePath":"datafiles","name":"mfplat.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"PixelComposer_profile-2.provisionprofile","ConfigValues":{
"Itch":{
"CopyToMask":"2",
},
},"CopyToMask":-1,"filePath":"datafiles","name":"PixelComposer_profile-2.provisionprofile","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"PixelComposer_profile-2.provisionprofile","ConfigValues":{"Itch":{"CopyToMask":"2",},},"CopyToMask":-1,"filePath":"datafiles","name":"PixelComposer_profile-2.provisionprofile","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"data.win","CopyToMask":-1,"filePath":"datafiles/report","name":"data.win","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"execute_shell_simple_ext_x64.dll","CopyToMask":-1,"filePath":"datafiles/report","name":"execute_shell_simple_ext_x64.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
{"$GMIncludedFile":"","%Name":"options.ini","CopyToMask":-1,"filePath":"datafiles/report","name":"options.ini","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
@ -2843,6 +2836,7 @@
{"id":{"name":"sh_color_picker_hue","path":"shaders/sh_color_picker_hue/sh_color_picker_hue.yy",},},
{"id":{"name":"sh_color_picker_side_hue","path":"shaders/sh_color_picker_side_hue/sh_color_picker_side_hue.yy",},},
{"id":{"name":"sh_color_picker_side_value","path":"shaders/sh_color_picker_side_value/sh_color_picker_side_value.yy",},},
{"id":{"name":"panel_collection_runner","path":"scripts/panel_collection_runner/panel_collection_runner.yy",},},
{"id":{"name":"sh_color_picker_value","path":"shaders/sh_color_picker_value/sh_color_picker_value.yy",},},
{"id":{"name":"sh_color_remove","path":"shaders/sh_color_remove/sh_color_remove.yy",},},
{"id":{"name":"sh_color_replace","path":"shaders/sh_color_replace/sh_color_replace.yy",},},

Binary file not shown.

View file

@ -55,8 +55,7 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_
var _node = appended_list[i];
_node.loadGroup(context);
if(_node.group == context)
array_push(node_create, _node);
if(_node.group == context) array_push(node_create, _node);
}
} catch(e) {
log_warning("APPEND, node", exception_print(e));
@ -80,14 +79,17 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_
printIf(log, $"Apply deserialize time: {current_time - t}"); t = current_time;
try {
for(var i = 0; i < array_length(appended_list); i++)
appended_list[i].preConnect();
var _conn_list = array_substract(appended_list, node_create);
for(var i = 0; i < array_length(_conn_list); i++)
_conn_list[i].preConnect();
for(var i = 0; i < array_length(appended_list); i++)
appended_list[i].connect();
for(var i = 0; i < array_length(_conn_list); i++)
_conn_list[i].connect();
for(var i = 0; i < array_length(_conn_list); i++)
_conn_list[i].postConnect();
for(var i = 0; i < array_length(appended_list); i++)
appended_list[i].postConnect();
} catch(e) {
log_warning("APPEND, connect", exception_print(e));
}

View file

@ -106,6 +106,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static getGraphPreviewSurface = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static getPreviewValues = function() { var _in = array_safe_get(inputs, 0, noone); return _in == noone? noone : _in.getValue(); }
static drawNodeDef = drawNode;

View file

@ -666,8 +666,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
var _keyframe = _data[i];
var _time = array_safe_get_fast(_keyframe, 0);
if(scale && _time <= 1)
_time = round(_time * (TOTAL_FRAMES - 1));
if(scale) _time = round(_time * (TOTAL_FRAMES - 1));
var value = array_safe_get_fast(_keyframe, 1);
var ease_in = array_safe_get_fast(_keyframe, 2, [0, 1]);

View file

@ -64,10 +64,6 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
static step = function() {
__step_mask_modifier();
var _typ = getSingleValue(11);
inputs[ 3].setVisible(_typ == 0);
inputs[12].setVisible(_typ == 1);
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
@ -91,6 +87,9 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
_shay = _dim[1] / 2 - _lgh[1];
}
inputs[ 3].setVisible(_posi == 0);
inputs[12].setVisible(_posi == 1);
surface_set_shader(pass1, sh_outline_only);
shader_set_f("dimension", _dim);
shader_set_f("borderSize", _border);
@ -102,7 +101,8 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE
draw_surface_ext_safe(surface_apply_gaussian(pass1, _size, false, cl), 0, 0, 1, 1, 0, cl, _stre * _color_get_alpha(cl));
var _s = surface_apply_gaussian(pass1, _size, false, cl, 2);
draw_surface_ext_safe(_s, 0, 0, 1, 1, 0, cl, _stre * _color_get_alpha(cl));
BLEND_ALPHA_MULP
draw_surface_safe(_surf);
BLEND_NORMAL

View file

@ -2225,7 +2225,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(name_custom) name = _map[$ "name"] ?? name;
if(struct_has(_map, "raw_value"))
animator.deserialize(_map[$ "raw_value"] ?? scale);
animator.deserialize(_map[$ "raw_value"], scale);
if(bypass_junc)
bypass_junc.visible = _map[$ "bypass"] ?? false;

View file

@ -0,0 +1,11 @@
function Panel_Collection_Runner() : PanelContent() constructor {
title = "Runner";
w = max(ui(320), WIN_W - ui(200));
h = max(ui(320), WIN_H - ui(200));
auto_pin = true;
function drawContent(panel) {
}
}

View file

@ -0,0 +1,14 @@
{
"$GMScript":"v1",
"%Name":"panel_collection_runner",
"isCompatibility":false,
"isDnD":false,
"name":"panel_collection_runner",
"parent":{
"name":"runner",
"path":"folders/panels/runner.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
"tags":[],
}

View file

@ -510,6 +510,8 @@
function call_panel_Globalvar() { panelAdd("Panel_Globalvar", true); }
function call_panel_File_Explorer() { panelAdd("Panel_File_Explorer", true); }
function call_panel_Collection_Runner() { dialogPanelCall(new Panel_Collection_Runner()); }
function __fnInit_Panels() {
registerFunction("", "Preferences", "", MOD_KEY.none, call_dialog_preference ).setMenu("preference", THEME.gear)
@ -542,5 +544,7 @@
registerFunction("", "Console Panel", "", MOD_KEY.none, call_panel_Console ).setMenuAlt("Console", "console_panel")
registerFunction("", "Globalvar Panel", "", MOD_KEY.none, call_panel_Globalvar ).setMenuAlt("Globalvar", "globalvar_panel")
registerFunction("", "File Explorer Panel", "", MOD_KEY.none, call_panel_File_Explorer ).setMenuAlt("File", "file_explorer_panel")
registerFunction("", "Collection Runner Panel", "", MOD_KEY.none, call_panel_Collection_Runner ).setMenuAlt("Runner", "collection_runner_panel")
}
#endregion

View file

@ -241,6 +241,12 @@ function Panel_Inspector() : PanelContent() constructor {
global_drawer = new GlobalVarDrawer();
GM_Explore_draw_init();
metadata_default_button = button(function() /*=>*/ { json_save_struct(DIRECTORY + "meta.json", PROJECT.meta.serialize()); })
.setIcon(THEME.save, 0, COLORS._main_icon_light, .75)
.setTooltip(__txtx("panel_inspector_set_default", "Set as default"));
metadata_buttons = [ metadata_default_button ];
#endregion
#region ---- workshop ----
@ -449,68 +455,55 @@ function Panel_Inspector() : PanelContent() constructor {
for( var i = 0, n = array_length(meta_display); i < n; i++ ) {
if(i == 3 && PANEL_GRAPH.getCurrentContext() == noone) continue;
var _meta = meta_display[i];
var _txt = array_safe_get_fast(_meta, 0);
var _tag = array_safe_get_fast(_meta, 2);
var _meta = meta_display[i];
var _txt = array_safe_get_fast(_meta, 0);
var _tag = array_safe_get_fast(_meta, 2);
var _butts = noone;
switch(_tag) { // header
case "globalvar" :
var _bw = ui(28);
var _bh = lbh - ui(4);
var _x1 = con_w;
var _y1 = yy + ui(2);
var _butts = global_drawer.editing? global_buttons_editing : global_buttons;
var _amo = array_length(_butts);
var _tw = (_bw + ui(4)) * _amo;
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, con_w - _tw, yy, _tw, lbh, COLORS.panel_inspector_group_bg, 1);
global_button_edit.icon = global_drawer.editing? THEME.accept_16 : THEME.gear_16;
global_button_edit.icon_blend = global_drawer.editing? COLORS._main_value_positive : COLORS._main_icon_light;
for (var j = 0, m = array_length(_butts); j < m; j++) {
_x1 -= _bw + ui(4);
var _b = _butts[j];
_b.setFocusHover(pFOCUS, _hover);
_b.draw(_x1 + ui(2), _y1, _bw, _bh, _m, THEME.button_hide_fill);
if(_b.inBBOX(_m)) contentPane.hover_content = true;
}
_x1 -= ui(4);
var cc = COLORS.panel_inspector_group_bg;
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, _x1, yy + lbh)) {
cc = COLORS.panel_inspector_group_hover;
if(pFOCUS) {
if(DOUBLE_CLICK) _cAll = _meta[1]? -1 : 1;
else if(mouse_press(mb_left)) _meta[1] = !_meta[1];
}
}
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, 0, yy, _x1, lbh, cc, 1);
break;
default :
var _x1 = con_w;
var cc = COLORS.panel_inspector_group_bg;
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, _x1, yy + lbh)) {
cc = COLORS.panel_inspector_group_hover;
if(pFOCUS) {
if(DOUBLE_CLICK) _cAll = _meta[1]? -1 : 1;
else if(mouse_press(mb_left)) _meta[1] = !_meta[1];
}
}
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, 0, yy, con_w, lbh, cc, 1);
case "metadata" : _butts = metadata_buttons; break;
case "globalvar" : _butts = global_drawer.editing? global_buttons_editing : global_buttons; break;
}
var _x1 = con_w;
var _y1 = yy + ui(2);
if(is_array(_butts)) {
var _bw = ui(28);
var _bh = lbh - ui(4);
var _amo = array_length(_butts);
var _tw = (_bw + ui(4)) * _amo;
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, con_w - _tw, yy, _tw, lbh, COLORS.panel_inspector_group_bg, 1);
global_button_edit.icon = global_drawer.editing? THEME.accept_16 : THEME.gear_16;
global_button_edit.icon_blend = global_drawer.editing? COLORS._main_value_positive : COLORS._main_icon_light;
for (var j = 0, m = array_length(_butts); j < m; j++) {
_x1 -= _bw + ui(4);
var _b = _butts[j];
_b.setFocusHover(pFOCUS, _hover);
_b.draw(_x1 + ui(2), _y1, _bw, _bh, _m, THEME.button_hide_fill);
if(_b.inBBOX(_m)) contentPane.hover_content = true;
}
_x1 -= ui(4);
}
var cc = COLORS.panel_inspector_group_bg;
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, _x1, yy + lbh)) {
cc = COLORS.panel_inspector_group_hover;
if(pFOCUS) {
if(DOUBLE_CLICK) _cAll = _meta[1]? -1 : 1;
else if(mouse_press(mb_left)) _meta[1] = !_meta[1];
}
}
draw_sprite_stretched_ext(THEME.box_r5_clr, 0, 0, yy, _x1, lbh, cc, 1);
draw_sprite_ui(THEME.arrow, _meta[1]? 0 : 3, ui(16), yy + lbh / 2, 1, 1, 0, COLORS.panel_inspector_group_bg, 1);
draw_set_text(viewMode? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text_inner);
@ -1320,7 +1313,7 @@ function Panel_Inspector() : PanelContent() constructor {
if(is(inspecting, Node_Frame)) inspectGroup = 0;
title = inspecting.renamed? inspecting.display_name : inspecting.name;
title = inspecting.getDisplayName();
inspecting.inspectorStep();
drawInspectingNode();
@ -1331,9 +1324,10 @@ function Panel_Inspector() : PanelContent() constructor {
var context = PANEL_GRAPH.getCurrentContext();
if(context == noone && file_exists_empty(PROJECT.path))
txt = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), "");
else if(context != noone)
txt = context.name;
txt = filename_name_only(PROJECT.path);
else if(is(context, Node))
txt = context.getDisplayName();
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
var ss = min(.5, (w - ui(96)) / string_width(txt));
@ -1349,9 +1343,6 @@ function Panel_Inspector() : PanelContent() constructor {
var bx = w - ui(44);
var by = ui(12);
if(buttonInstant(THEME.button_hide_fill, bx, by, ui(32), ui(32), [mx, my], pHOVER, pFOCUS, __txtx("panel_inspector_set_default", "Set Metadata as default"), THEME.save, 0, COLORS._main_icon) == 2)
json_save_struct(DIRECTORY + "meta.json", PROJECT.meta.serialize());
by += ui(36);
if(STEAM_ENABLED && !workshop_uploading) {
if(PROJECT.path == "") {

View file

@ -225,6 +225,7 @@ function Panel_Menu() : PanelContent() constructor {
MENU_ITEMS.notification_panel,
MENU_ITEMS.globalvar_panel,
MENU_ITEMS.file_explorer_panel,
MENU_ITEMS.collection_runner_panel,
menuItemShelf(__txt("Nodes"), function(_dat) {
return submenuCall(_dat, [

View file

@ -225,6 +225,7 @@ void main() { #region
if(mode == 0) {
vec2 uv = fract(tri.xy / sca);
colr = gradientEval(random(uv));
} else if(mode == 2) {
vec2 uv = fract((_pos * vec2(1., c30) - tri.xy) + vec2(0.5, 0.));