- Fix error when setting globalvar value.

This commit is contained in:
MakhamDev 2023-10-24 16:23:20 +07:00
parent 78ca7fbb37
commit dd5603e38a
25 changed files with 334 additions and 97 deletions

View file

@ -419,6 +419,7 @@
{"name":"fd_rectangle_create_view","order":3,"path":"scripts/fd_rectangle_create_view/fd_rectangle_create_view.yy",},
{"name":"node_fluid_vortex","order":8,"path":"scripts/node_fluid_vortex/node_fluid_vortex.yy",},
{"name":"node_pb_draw_angle","order":7,"path":"scripts/node_pb_draw_angle/node_pb_draw_angle.yy",},
{"name":"s_node_3d_set_material","order":20,"path":"sprites/s_node_3d_set_material/s_node_3d_set_material.yy",},
{"name":"s_node_replace_palette","order":59,"path":"sprites/s_node_replace_palette/s_node_replace_palette.yy",},
{"name":"sh_cell_noise_round","order":4,"path":"shaders/sh_cell_noise_round/sh_cell_noise_round.yy",},
{"name":"s_node_cross_product_2d","order":12,"path":"sprites/s_node_cross_product_2d/s_node_cross_product_2d.yy",},
@ -794,6 +795,7 @@
{"name":"node_image_gif","order":6,"path":"scripts/node_image_gif/node_image_gif.yy",},
{"name":"node_iterator_each_output","order":2,"path":"scripts/node_iterator_each_output/node_iterator_each_output.yy",},
{"name":"s_node_strandSim_render_texture","order":5,"path":"sprites/s_node_strandSim_render_texture/s_node_strandSim_render_texture.yy",},
{"name":"node_3d_set_material","order":2,"path":"scripts/node_3d_set_material/node_3d_set_material.yy",},
{"name":"sh_fd_advect_material_a_8_glsl","order":3,"path":"shaders/sh_fd_advect_material_a_8_glsl/sh_fd_advect_material_a_8_glsl.yy",},
{"name":"node_color_remove","order":2,"path":"scripts/node_color_remove/node_color_remove.yy",},
{"name":"s_node_3d_light_directi","order":17,"path":"sprites/s_node_3d_light_directi/s_node_3d_light_directi.yy",},
@ -1498,6 +1500,7 @@
{"name":"fd_rectangle_set_target","order":18,"path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",},
{"name":"node_wav_file_read","order":17,"path":"scripts/node_wav_file_read/node_wav_file_read.yy",},
{"name":"s_node_vfx_render_output","order":12,"path":"sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy",},
{"name":"s_node_3d_discretize","order":19,"path":"sprites/s_node_3d_discretize/s_node_3d_discretize.yy",},
{"name":"draw_line_dashed","order":7,"path":"scripts/draw_line_dashed/draw_line_dashed.yy",},
{"name":"pseudo_regex","order":7,"path":"scripts/pseudo_regex/pseudo_regex.yy",},
{"name":"node_invert","order":6,"path":"scripts/node_invert/node_invert.yy",},

View file

@ -992,6 +992,7 @@
{"id":{"name":"fd_rectangle_create_view","path":"scripts/fd_rectangle_create_view/fd_rectangle_create_view.yy",},},
{"id":{"name":"node_fluid_vortex","path":"scripts/node_fluid_vortex/node_fluid_vortex.yy",},},
{"id":{"name":"node_pb_draw_angle","path":"scripts/node_pb_draw_angle/node_pb_draw_angle.yy",},},
{"id":{"name":"s_node_3d_set_material","path":"sprites/s_node_3d_set_material/s_node_3d_set_material.yy",},},
{"id":{"name":"s_node_replace_palette","path":"sprites/s_node_replace_palette/s_node_replace_palette.yy",},},
{"id":{"name":"sh_cell_noise_round","path":"shaders/sh_cell_noise_round/sh_cell_noise_round.yy",},},
{"id":{"name":"s_node_cross_product_2d","path":"sprites/s_node_cross_product_2d/s_node_cross_product_2d.yy",},},
@ -1425,6 +1426,7 @@
{"id":{"name":"node_VCT","path":"scripts/node_VCT/node_VCT.yy",},},
{"id":{"name":"boneObject","path":"scripts/boneObject/boneObject.yy",},},
{"id":{"name":"s_node_strandSim_render_texture","path":"sprites/s_node_strandSim_render_texture/s_node_strandSim_render_texture.yy",},},
{"id":{"name":"node_3d_set_material","path":"scripts/node_3d_set_material/node_3d_set_material.yy",},},
{"id":{"name":"sh_fd_advect_material_a_8_glsl","path":"shaders/sh_fd_advect_material_a_8_glsl/sh_fd_advect_material_a_8_glsl.yy",},},
{"id":{"name":"node_color_remove","path":"scripts/node_color_remove/node_color_remove.yy",},},
{"id":{"name":"FileDropper","path":"extensions/FileDropper/FileDropper.yy",},},
@ -2232,6 +2234,7 @@
{"id":{"name":"fd_rectangle_set_target","path":"scripts/fd_rectangle_set_target/fd_rectangle_set_target.yy",},},
{"id":{"name":"node_wav_file_read","path":"scripts/node_wav_file_read/node_wav_file_read.yy",},},
{"id":{"name":"s_node_vfx_render_output","path":"sprites/s_node_vfx_render_output/s_node_vfx_render_output.yy",},},
{"id":{"name":"s_node_3d_discretize","path":"sprites/s_node_3d_discretize/s_node_3d_discretize.yy",},},
{"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},},
{"id":{"name":"pseudo_regex","path":"scripts/pseudo_regex/pseudo_regex.yy",},},
{"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},},

View file

@ -193,21 +193,27 @@ function __3dObject() constructor {
} #endregion
static clone = function() { #region
static clone = function(_vertex = true) { #region
var _obj = new __3dObject();
_obj.vertex = array_create(array_length(vertex));
for( var i = 0, n = array_length(vertex); i < n; i++ ) {
_obj.vertex[i] = array_create(array_length(vertex[i]));
if(_vertex) {
_obj.vertex = array_create(array_length(vertex));
for( var i = 0, n = array_length(vertex); i < n; i++ ) {
_obj.vertex[i] = array_create(array_length(vertex[i]));
for( var j = 0, m = array_length(vertex[i]); j < m; j++ )
_obj.vertex[i][j] = vertex[i][j].clone();
for( var j = 0, m = array_length(vertex[i]); j < m; j++ )
_obj.vertex[i][j] = vertex[i][j].clone();
}
}
_obj.VF = VF;
_obj.render_type = render_type;
_obj.custom_shader = custom_shader;
_obj.object_counts = object_counts;
_obj.transform = transform.clone();
_obj.size = size.clone();
_obj.materials = array_clone(materials);
_obj.material_index = array_clone(material_index);
_obj.materials = materials;
_obj.material_index = material_index;
_obj.texture_flip = texture_flip;
return _obj;

View file

@ -7,6 +7,7 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
return;
}
corner = min(corner, abs(y1 - y0) / 2);
var sample = floor(corner / 8);
sample = clamp(sample, 0, 8);
if(sample == 0) corner = 0;
@ -32,7 +33,7 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
var rx = _x1 - _x0;
var ry = _y1 - _y0;
if(inv) {
if(inv) {
var cm = merge_color(c1, c2, 0.5);
var ofl = cy < _y0 || cy > _y1;
@ -43,6 +44,9 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
var cS = min(corner, 16 * _s);
if(xx1 > xx0 && !ofl) {
if(abs(y1 - y0) < abs(xx1 - xx0))
cS = 0;
var cS0 = min(cS, abs(cy - y0) - rrx / 2);
cS0 = max(0, cS0);
@ -52,7 +56,7 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
var top = abs(cy - y0) < rrx / 2;
var bot = abs(y1 - cy) < rrx / 2;
if(top) {
if(top) {
draw_line_width_color(x0, y0, xx0, y0, thick, c1, c1);
draw_line_width_color(xx1 + cS, y1, x1, y1, thick, c2, c2);
@ -119,7 +123,7 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
if(corY0) draw_corner(xx0, yC0 - corY0 * iy, xx0, yC0, xx0 + _corY0, yC0 + _corY0 * iy, thick, cm, sample);
if(corY1) draw_corner(xx1, yC1 + corY1 * iy, xx1, yC1, xx1 - _corY1, yC1 - _corY1 * iy, thick, cm, sample);
}
} else {
} else {
var cR0 = min(cS, abs(y0 - cy) / 2);
var cR1 = min(cS, abs(y1 - cy) / 2);
@ -147,7 +151,7 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
if(cS) draw_corner(xx0 - cR0, y0, xx0, y0, xx0, y0 + cR0 * iy0, thick, c1);
if(cS) draw_corner(xx1, y1 - cR1 * iy1, xx1, y1, xx1 + cR1, y1, thick, c2);
if(abs(crX0 - crX3) == abs(crY0 - crY3)) {
if(abs(crX0 - crX3) == abs(crY0 - crY3)) {
var cR = min(cS, abs(xx1 - xx0) / 2);
var _cR = cR / sqrt(2);
@ -159,7 +163,7 @@ function draw_line_elbow_diag_color(x0, y0, x1, y1, cx = noone, cy = noone, _s =
draw_corner( crX0, crY0 - cR * iy0, crX0, crY0, crX0 - _cR, crY0 + _cR * iy0, thick, cm, sample);
draw_corner(crX3 + _cR, crY3 - _cR * iy1, crX3, crY3, crX3, crY3 + cR * iy1, thick, cm, sample);
}
} else {
} else {
draw_line_width_color( crX0, y0 + cR0 * iy0, crX0, crY0 - crn0 * iy0, thick, c1, cm);
draw_line_width_color(crX1 - crn0 * ix, crY1, crX2 + crn1 * ix, crY2, thick, cm, cm);
draw_line_width_color( crX3, crY3 + crn1 * iy1, crX3, y1 - cR1 * iy1, thick, cm, c2);

View file

@ -250,5 +250,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
if(struct_has(_load_content, "timelines") && !array_empty(_load_content.timelines.contents))
PROJECT.timelines.deserialize(_load_content.timelines);
PANEL_GRAPH.toCenterNode();
return true;
}

View file

@ -1,11 +1,15 @@
function Node_3D_Round_Vertex(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _group) constructor {
name = "Discretize vertex";
inputs[| in_mesh + 0] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
static processData = function(_output, _data, _output_index, _array_index = 0) {
var _obj = _data[0];
var _stp = _data[in_mesh + 0];
if(!is_instanceof(_obj, __3dObject)) return noone;
var _res = new __3dObject();
var _res = _obj.clone(false);
_res.vertex = array_create(array_length(_obj.vertex));
for( var i = 0, n = array_length(_obj.vertex); i < n; i++ ) {
@ -13,23 +17,16 @@ function Node_3D_Round_Vertex(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y,
for( var j = 0, m = array_length(_obj.vertex[i]); j < m; j++ ) {
var _v = _obj.vertex[i][j].clone();
//_v.x = value_snap(_v.x, 0);
//_v.y = value_snap(_v.y, 0);
//_v.z = value_snap(_v.z, 0);
_v.x = value_snap(_v.x, _stp);
_v.y = value_snap(_v.y, _stp);
_v.z = value_snap(_v.z, _stp);
_res.vertex[i][j] = _v;
}
}
_res.object_counts = _obj.object_counts;
_res.transform = _obj.transform.clone();
_res.size = _obj.size.clone();
_res.materials = array_clone(_obj.materials);
_res.material_index = array_clone(_obj.material_index);
_res.texture_flip = _obj.texture_flip;
_res.build();
_res.VB = _res.build();
return _res;
}
}
}

View file

@ -0,0 +1,26 @@
function Node_3D_Set_Material(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _group) constructor {
name = "Set Material";
inputs[| in_mesh + 0] = nodeValue("Materials", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Material, noone)
.setVisible(true, true)
.setArrayDepth(1);
static processData = function(_output, _data, _output_index, _array_index = 0) {
var _obj = _data[0];
var _mat = _data[in_mesh + 0];
if(!is_instanceof(_obj, __3dObject)) return noone;
if(!is_array(_mat)) _mat = [ _mat ];
var _res = _obj.clone(false);
if(array_length(_mat) != array_length(_obj.materials))
array_resize(_mat, array_length(_obj.materials));
_res.vertex = _obj.vertex;
_res.VB = _obj.VB;
_res.materials = _mat;
return _res;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_3d_set_material",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "d3d modifier",
"path": "folders/nodes/data/3D/d3d modifier.yy",
},
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "variable",
"path": "folders/nodes/data/variable.yy",
},
"resourceVersion": "1.0",
"name": "node_counter",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -142,7 +142,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
#region --- attributes ----
attributes = {
update_graph: true,
show_update_trigger: false
show_update_trigger: false,
color: -1,
};
attributeEditors = [
@ -789,7 +790,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
static getColor = function() { #region
gml_pragma("forceinline");
return timeline_item.color == -1? color : timeline_item.color;
return attributes.color == -1? color : attributes.color;
} #endregion
static drawNodeBase = function(xx, yy, _s) { #region

View file

@ -3,6 +3,7 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
color = COLORS.node_blend_feedback;
icon = THEME.feedback;
update_on_frame = true;
reset_all_child = true;
if(!LOADING && !APPENDING && !CLONING) {
@ -14,12 +15,6 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
output.inputs[| 1].setFrom(input.outputs[| 1]);
}
static doStepBegin = function() {
if(!PROJECT.animator.frame_progress) return;
setRenderStatus(false);
RENDER_ALL //force full render
}
static getNextNodes = function() {
var allReady = true;
for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
@ -28,7 +23,7 @@ function Node_Feedback(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
allReady &= _in.isRenderable()
}
if(!allReady) return [];
return __nodeLeafList(getNodeList());

View file

@ -6,7 +6,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inParent = undefined;
attributes.input_priority = group == noone? 0 : group.getInputFreeOrder();
attributes.input_priority = 0;
if(!CLONING && !LOADING && !APPENDING && group != noone) attributes.input_priority = group.getInputFreeOrder();
w = 96;
h = 32 + 24;
@ -363,7 +364,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
if(PROJECT.version < 11520) attributes.input_priority = getInputData(5);
onValueUpdate();
if(CLONING) attributes.input_priority = group.getInputFreeOrder();
group.sortIO();
} #endregion

View file

@ -4,7 +4,8 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
color = COLORS.node_blend_collection;
previewable = false;
attributes.input_priority = group == noone? 0 : group.getOutputFreeOrder();
attributes.input_priority = 0;
if(!CLONING && !LOADING && !APPENDING && group != noone) attributes.input_priority = group.getOutputFreeOrder();
w = 96;
h = 32 + 24;
@ -18,9 +19,7 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
outParent = undefined;
output_index = -1;
_onSetDisplayName = function() {
attributes.inherit_name = false;
}
_onSetDisplayName = function() { attributes.inherit_name = false; }
static setRenderStatus = function(result) { #region
if(rendered == result) return;

View file

@ -416,7 +416,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
addNodeObject(d3d, "Point Light", s_node_3d_light_point, "Node_3D_Light_Point", [1, Node_3D_Light_Point]).setVersion(11510);
ds_list_add(d3d, "Modify");
/**/ addNodeObject(d3d, "Discretize vertex", s_node_3d_light_directi, "Node_3D_Round_Vertex", [1, Node_3D_Round_Vertex]).setVersion(11560);
addNodeObject(d3d, "Discretize vertex", s_node_3d_discretize, "Node_3D_Round_Vertex", [1, Node_3D_Round_Vertex]).setVersion(11560);
addNodeObject(d3d, "Set Material", s_node_3d_set_material, "Node_3D_Set_Material", [1, Node_3D_Set_Material]).setVersion(11560);
ds_list_add(d3d, "Legacy"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////
addNodeObject(d3d, "3D Plane", s_node_3d_plane, "__Node_3D_Plane", [1, __Node_3D_Plane],, "Put 2D image on a plane in 3D space.").isDeprecated();

View file

@ -1353,8 +1353,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
} #endregion
if(typeFrom == VALUE_TYPE.surface && type == VALUE_TYPE.d3Material)
return new __d3dMaterial(value);
if(typeFrom == VALUE_TYPE.surface && type == VALUE_TYPE.d3Material) { #region
if(!is_array(value)) return new __d3dMaterial(value);
var _val = array_create(array_length(value));
for( var i = 0, n = array_length(value); i < n; i++ )
_val[i] = new __d3dMaterial(value[i]);
return _val;
} #endregion
if((typeFrom == VALUE_TYPE.integer || typeFrom == VALUE_TYPE.float || typeFrom == VALUE_TYPE.boolean) && type == VALUE_TYPE.color)
return value >= 1? value : make_color_hsv(0, 0, value * 255);
@ -1710,7 +1715,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(connect_type == JUNCTION_CONNECT.output) return;
node.setInputData(self.index, animator.getValue(time));
if(is_instanceof(node, Node))
node.setInputData(self.index, animator.getValue(time));
if(tags != VALUE_TAG.none) return true;
@ -2173,7 +2179,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return hovering;
} #endregion
static drawConnectionMouse = function(_mx, _my, ss, target) { #region
static drawConnectionMouse = function(params, _mx, _my, target) { #region
var ss = params.s;
var aa = struct_try_get(params, "aa", 1);
var drawCorner = type == VALUE_TYPE.action;
if(target != noone)
drawCorner |= target.type == VALUE_TYPE.action;
@ -2181,6 +2190,17 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var corner = PREF_MAP[? "connection_line_corner"] * ss;
var th = max(1, PREF_MAP[? "connection_line_width"] * ss);
var sx = x;
var sy = y;
corner *= aa;
th *= aa;
ss *= aa;
sx *= aa;
sy *= aa;
_mx *= aa;
_my *= aa;
var col = color_display;
draw_set_color(col);
@ -2188,34 +2208,32 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var _output = connect_type == JUNCTION_CONNECT.output;
switch(PREF_MAP[? "curve_connection_line"]) {
case 0 :
draw_line_width(x, y, _mx, _my, th);
break;
case 0 : draw_line_width(sx, sy, _mx, _my, th); break;
case 1 :
if(drawCorner) {
if(_action) draw_line_curve_corner(_mx, _my, x, y, ss, th, col, col);
else draw_line_curve_corner(x, y, _mx, _my, ss, th, col, col);
if(_action) draw_line_curve_corner(_mx, _my, sx, sy, ss, th, col, col);
else draw_line_curve_corner(sx, sy, _mx, _my, ss, th, col, col);
} else {
if(_output) draw_line_curve_color(_mx, _my, x, y,,, ss, th, col, col);
else draw_line_curve_color(x, y, _mx, _my,,, ss, th, col, col);
if(_output) draw_line_curve_color(_mx, _my, sx, sy,,, ss, th, col, col);
else draw_line_curve_color(sx, sy, _mx, _my,,, ss, th, col, col);
}
break;
case 2 :
if(drawCorner) {
if(_action) draw_line_elbow_corner(_mx, _my, x, y, ss, th, col, col, corner);
else draw_line_elbow_corner(x, y, _mx, _my, ss, th, col, col, corner);
if(_action) draw_line_elbow_corner(_mx, _my, sx, sy, ss, th, col, col, corner);
else draw_line_elbow_corner(sx, sy, _mx, _my, ss, th, col, col, corner);
} else {
if(_output) draw_line_elbow_color(x, y, _mx, _my,,, ss, th, col, col, corner);
else draw_line_elbow_color(_mx, _my, x, y,,, ss, th, col, col, corner);
if(_output) draw_line_elbow_color(sx, sy, _mx, _my,,, ss, th, col, col, corner);
else draw_line_elbow_color(_mx, _my, sx, sy,,, ss, th, col, col, corner);
}
break;
case 3 :
if(drawCorner) {
if(_action) draw_line_elbow_diag_corner(_mx, _my, x, y, ss, th, col, col, corner);
else draw_line_elbow_diag_corner(x, y, _mx, _my, ss, th, col, col, corner);
if(_action) draw_line_elbow_diag_corner(_mx, _my, sx, sy, ss, th, col, col, corner);
else draw_line_elbow_diag_corner(sx, sy, _mx, _my, ss, th, col, col, corner);
} else {
if(_output) draw_line_elbow_diag_color(x, y, _mx, _my,,, ss, th, col, col, corner);
else draw_line_elbow_diag_color(_mx, _my, x, y,,, ss, th, col, col, corner);
if(_output) draw_line_elbow_diag_color(sx, sy, _mx, _my,,, ss, th, col, col, corner);
else draw_line_elbow_diag_color(_mx, _my, sx, sy,,, ss, th, col, col, corner);
}
break;
}

View file

@ -289,7 +289,7 @@ function Panel_Animation() : PanelContent() constructor {
var _clrs = COLORS.labels;
var _item = array_create(array_length(_clrs));
function setSelectingItemColor(color) { if(context_selecting_item == noone) return; context_selecting_item.item.color = color; }
function setSelectingItemColor(color) { if(context_selecting_item == noone) return; context_selecting_item.item.setColor(color); }
for( var i = 0, n = array_length(_clrs); i < n; i++ ) {
_item[i] = [

View file

@ -93,7 +93,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
connection_aa = 2;
connection_surface = surface_create(1, 1);
connection_surface_aa = surface_create(1, 1);
connection_draw_mouse = noone;
connection_draw_target = noone;
value_focus = noone;
value_dragging = noone;
value_draggings = [];
@ -445,10 +448,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
#region node color
function setSelectingNodeColor(color) {
if(node_hover == noone) return;
node_hover.timeline_item.color = color;
node_hover.attributes.color = color;
for(var i = 0; i < ds_list_size(nodes_select_list); i++)
nodes_select_list[| i].timeline_item.color = color;
nodes_select_list[| i].attributes.color = color;
}
var _clrs = COLORS.labels;
@ -938,6 +941,26 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _hov = nodes_list[| i].drawConnections(_params);
if(_hov != noone && is_struct(_hov)) hov = _hov;
}
if(value_dragging && connection_draw_mouse != noone) {
var _cmx = connection_draw_mouse[0];
var _cmy = connection_draw_mouse[1];
var _cmt = connection_draw_target;
if(array_empty(value_draggings))
value_dragging.drawConnectionMouse(_params, _cmx, _cmy, _cmt);
else {
var _stIndex = array_find(value_draggings, value_dragging);
for( var i = 0, n = array_length(value_draggings); i < n; i++ ) {
var _dmx = _cmx;
var _dmy = value_draggings[i].connect_type == JUNCTION_CONNECT.output? _cmy + (i - _stIndex) * 24 * graph_s : _cmy;
value_draggings[i].drawConnectionMouse(_params, _dmx, _dmy, _cmt);
}
}
}
printIf(log, "Draw connection: " + string(current_time - t)); t = current_time;
surface_reset_target();
@ -948,11 +971,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
draw_surface(connection_surface, 0, 0);
surface_reset_shader();
BLEND_ALPHA
shader_set(sh_FXAA);
shader_set_dim("dimension", connection_surface_aa);
draw_surface(connection_surface_aa, 0, 0);
shader_reset();
BLEND_ALPHA_MULP
draw_surface(connection_surface_aa, 0, 0);
BLEND_NORMAL
junction_hovering = (node_hovering == noone && !is_struct(node_hovering))? hov : noone;
@ -1168,18 +1188,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _mmx = target != noone? target.x : _mx;
var _mmy = target != noone? target.y : _my;
if(array_empty(value_draggings))
value_dragging.drawConnectionMouse(_mmx, _mmy, graph_s, target);
else {
var _stIndex = array_find(value_draggings, value_dragging);
for( var i = 0, n = array_length(value_draggings); i < n; i++ ) {
var _dmx = _mmx;
var _dmy = value_draggings[i].connect_type == JUNCTION_CONNECT.output? _mmy + (i - _stIndex) * 24 * graph_s : _mmy;
value_draggings[i].drawConnectionMouse(_dmx, _dmy, graph_s, target);
}
}
connection_draw_mouse = [ _mmx, _mmy ];
connection_draw_target = target;
value_dragging.drawJunction(graph_s, value_dragging.x, value_dragging.y);
if(target)
@ -1221,6 +1231,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
value_dragging = noone;
connection_draw_mouse = noone;
}
} else if(!value_dragging && value_focus && mouse_press(mb_left, pFOCUS) && !key_mod_press(ALT)) {
value_dragging = value_focus;

View file

@ -7,6 +7,7 @@ function timelineItem() constructor {
parent = noone;
static setColor = function(color) { self.color = color; }
static getColor = function() { return color; }
static drawLabel = function(_x, _y, _w, _msx, _msy) {}
@ -40,13 +41,13 @@ function timelineItemNode(node) : timelineItem() constructor {
var lh = ui(20);
var res = 0;
var col = color;
var col = getColor();
var cxt = _item.contexts;
if(col == -1)
for( var i = array_length(cxt) - 1; i >= 0; i-- ) {
var _context = cxt[i];
if(_context.item.color == -1) continue;
col = _context.item.color;
if(_context.item.getColor() == -1) continue;
col = _context.item.getColor();
break;
}
if(col == -1) col = CDEF.main_grey;
@ -99,19 +100,20 @@ function timelineItemNode(node) : timelineItem() constructor {
return res;
} #endregion
static setColor = function(color) { node.attributes.color = color; }
static getColor = function() { return node.attributes.color; }
static serialize = function() { #region
var _map = {};
_map.type = "Node";
_map.show = show;
_map.color = color;
_map.node_id = node.node_id;
return _map;
} #endregion
static deserialize = function(_map) { #region
color = _map.color;
show = struct_try_get(_map, "show", true);
var _node_id = _map.node_id;
@ -128,14 +130,14 @@ function timelineItemGroup() : timelineItem() constructor {
tb_name = new textBox(TEXTBOX_INPUT.text, function(val) { name = val; renaming = false; });
contents = [];
static rename = function() {
static rename = function() { #region
renaming = true;
tb_name.setFocusHover(true, true);
run_in(1, function() {
tb_name._current_text = name;
tb_name.activate();
});
}
} #endregion
static drawLabel = function(_item, _x, _y, _w, _msx, _msy, hover, focus, itHover, fdHover, nameType, alpha = 1) { #region
var lx = _x + _item.depth * ui(12) + ui(2);
@ -144,13 +146,13 @@ function timelineItemGroup() : timelineItem() constructor {
var lh = ui(20);
var res = 0;
var hig = true;
var col = color;
var col = getColor();
var cxt = _item.contexts;
if(col == -1)
for( var i = array_length(cxt) - 1; i >= 0; i-- ) {
var _context = cxt[i];
if(_context.item.color == -1) continue;
col = _context.item.color;
if(_context.item.getColor() == -1) continue;
col = _context.item.getColor();
hig = false;
break;
}
@ -193,10 +195,6 @@ function timelineItemGroup() : timelineItem() constructor {
return res;
} #endregion
static setColor = function(color) {
self.color = color;
}
static addItem = function(_item) { #region
array_push(contents, _item);
_item.parent = self;

View file

@ -19,7 +19,9 @@ void main() {
wei += samp.a;
}
col /= wei;
float alph = wei / (down * down);
col /= wei;
col.a = alph;
gl_FragColor = col;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_3d_discretize",
"bbox_bottom": 61,
"bbox_left": 6,
"bbox_right": 57,
"bbox_top": 2,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"faee4b11-e77e-4cf6-95a9-b45d1256cc7f",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"e5d1deb2-5e60-4fd1-9d72-fd1e6bbac9a2","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "3D",
"path": "folders/nodes/icons/3D.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_3d_discretize",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"faee4b11-e77e-4cf6-95a9-b45d1256cc7f","path":"sprites/s_node_3d_discretize/s_node_3d_discretize.yy",},},},"Disabled":false,"id":"5ec1ab24-4339-470d-ae19-af9df1281bf9","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_3d_set_material",
"bbox_bottom": 61,
"bbox_left": 6,
"bbox_right": 57,
"bbox_top": 2,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"c983d974-a1e0-4657-b9ac-dc2a61853066",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"b84ffdf9-7817-4097-abb0-2f1a97dd02bc","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "3D",
"path": "folders/nodes/icons/3D.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_3d_set_material",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"c983d974-a1e0-4657-b9ac-dc2a61853066","path":"sprites/s_node_3d_set_material/s_node_3d_set_material.yy",},},},"Disabled":false,"id":"b89afaa1-c21f-4174-894f-7679efaf7620","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}