mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-03-03 22:24:48 +01:00
strict
This commit is contained in:
parent
712bdfa613
commit
3a3f39a170
30 changed files with 2337 additions and 843 deletions
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-18 12:08:08
|
// 2024-04-23 16:48:26
|
||||||
function LOAD(safe = false) { #region
|
function LOAD(safe = false) { #region
|
||||||
if(DEMO) return false;
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-18 11:54:26
|
// 2024-04-23 16:48:08
|
||||||
function LOAD(safe = false) { #region
|
function LOAD(safe = false) { #region
|
||||||
if(DEMO) return false;
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-16 12:09:31
|
// 2024-04-23 16:12:42
|
||||||
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
|
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
|
||||||
|
|
||||||
#macro INAME internalName == ""? name : internalName
|
#macro INAME internalName == ""? name : internalName
|
||||||
|
@ -938,6 +938,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
|
|
||||||
static refreshNodeDisplay = function() { #region
|
static refreshNodeDisplay = function() { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
if(IS_PLAYING) return;
|
||||||
|
|
||||||
updateIO();
|
updateIO();
|
||||||
setHeight();
|
setHeight();
|
||||||
|
@ -1450,8 +1451,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(preview_amount) txt = $"{preview_amount} x {txt}";
|
if(preview_amount) txt = $"{preview_amount} x {txt}";
|
||||||
|
|
||||||
switch(format) {
|
switch(format) {
|
||||||
|
case surface_rgba8unorm : break;
|
||||||
case surface_rgba4unorm : txt += showFormat? " 4RGBA" : " 4R"; break;
|
case surface_rgba4unorm : txt += showFormat? " 4RGBA" : " 4R"; break;
|
||||||
case surface_rgba8unorm : txt += showFormat? "8RGBA" : "8R"; break;
|
|
||||||
case surface_rgba16float : txt += showFormat? " 16RGBA" : " 16R"; break;
|
case surface_rgba16float : txt += showFormat? " 16RGBA" : " 16R"; break;
|
||||||
case surface_rgba32float : txt += showFormat? " 32RGBA" : " 32R"; break;
|
case surface_rgba32float : txt += showFormat? " 32RGBA" : " 32R"; break;
|
||||||
case surface_r8unorm : txt += showFormat? " 8BW" : " 8B"; break;
|
case surface_r8unorm : txt += showFormat? " 8BW" : " 8B"; break;
|
||||||
|
@ -1469,32 +1470,33 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(!active) return;
|
if(!active) return;
|
||||||
if(_s * w < 64) return;
|
if(_s * w < 64) return;
|
||||||
|
|
||||||
draw_set_text(f_p2, fa_center, fa_top, COLORS.panel_graph_node_dimension);
|
draw_set_text(f_p3, fa_center, fa_top, COLORS.panel_graph_node_dimension);
|
||||||
var tx = xx + w * _s / 2;
|
var tx = xx + w * _s / 2;
|
||||||
var ty = yy + (h + 4) * _s - 2;
|
var ty = yy + (h + 4) * _s - 2;
|
||||||
|
|
||||||
if(struct_get(display_parameter, "show_dimension")) {
|
if(struct_get(display_parameter, "show_dimension")) {
|
||||||
var txt = string(getNodeDimension(_s > 0.65));
|
var txt = string(getNodeDimension(_s > 0.65));
|
||||||
draw_text(round(tx), round(ty), txt);
|
draw_text(round(tx), round(ty), txt);
|
||||||
ty += line_get_height(f_p2) - 2;
|
ty += string_height(txt) - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_font(f_p3);
|
|
||||||
|
|
||||||
if(struct_get(display_parameter, "show_compute")) {
|
if(struct_get(display_parameter, "show_compute")) {
|
||||||
var rt = 0, unit = "";
|
var rt = 0, unit = "";
|
||||||
|
|
||||||
if(render_time == 0) {
|
if(render_time == 0) {
|
||||||
draw_set_color(COLORS._main_text_sub);
|
draw_set_color(COLORS._main_text_sub);
|
||||||
unit = "us";
|
unit = "us";
|
||||||
|
|
||||||
} else if(render_time < 1000) {
|
} else if(render_time < 1000) {
|
||||||
rt = round(render_time / 10) * 10;
|
rt = round(render_time / 10) * 10;
|
||||||
unit = "us";
|
unit = "us";
|
||||||
draw_set_color(COLORS.speed[2]);
|
draw_set_color(COLORS.speed[2]);
|
||||||
|
|
||||||
} else if(render_time < 1000000) {
|
} else if(render_time < 1000000) {
|
||||||
rt = string_format(render_time / 1000, -1, 2);
|
rt = string_format(render_time / 1000, -1, 2);
|
||||||
unit = "ms";
|
unit = "ms";
|
||||||
draw_set_color(COLORS.speed[1]);
|
draw_set_color(COLORS.speed[1]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rt = string_format(render_time / 1000000, -1, 2);
|
rt = string_format(render_time / 1000000, -1, 2);
|
||||||
unit = "s";
|
unit = "s";
|
||||||
|
@ -1503,7 +1505,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
|
|
||||||
if(render_cached) draw_set_color(COLORS._main_text_sub);
|
if(render_cached) draw_set_color(COLORS._main_text_sub);
|
||||||
|
|
||||||
draw_text(round(tx), round(ty), string(rt) + " " + unit);
|
draw_text(round(tx), round(ty), $"{rt} {unit}");
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-20 09:03:18
|
// 2024-04-23 16:53:10
|
||||||
enum KEY_TYPE { normal, adder }
|
enum KEY_TYPE { normal, adder }
|
||||||
enum CURVE_TYPE { linear, bezier, cut }
|
enum CURVE_TYPE { linear, bezier, cut }
|
||||||
enum DRIVER_TYPE { none, linear, wiggle, sine }
|
enum DRIVER_TYPE { none, linear, wiggle, sine }
|
||||||
|
@ -428,6 +428,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
||||||
static processType = function(_val) { #region
|
static processType = function(_val) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
|
if(PROJECT.attributes.strict) return _val;
|
||||||
var _res = _val;
|
var _res = _val;
|
||||||
|
|
||||||
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
||||||
|
@ -444,7 +445,6 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
||||||
|
|
||||||
if(is_array(_val)) return _val;
|
if(is_array(_val)) return _val;
|
||||||
if(is_struct(_val)) return _val;
|
if(is_struct(_val)) return _val;
|
||||||
//if(is_undefined(_val)) return 0;
|
|
||||||
|
|
||||||
switch(prop.type) {
|
switch(prop.type) {
|
||||||
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-20 09:02:54
|
// 2024-04-23 16:51:49
|
||||||
enum KEY_TYPE { normal, adder }
|
enum KEY_TYPE { normal, adder }
|
||||||
enum CURVE_TYPE { linear, bezier, cut }
|
enum CURVE_TYPE { linear, bezier, cut }
|
||||||
enum DRIVER_TYPE { none, linear, wiggle, sine }
|
enum DRIVER_TYPE { none, linear, wiggle, sine }
|
||||||
|
@ -428,6 +428,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
||||||
static processType = function(_val) { #region
|
static processType = function(_val) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
|
if(PROJECT.attributes.strict) return _val;
|
||||||
var _res = _val;
|
var _res = _val;
|
||||||
|
|
||||||
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
||||||
|
@ -444,13 +445,12 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
||||||
|
|
||||||
if(is_array(_val)) return _val;
|
if(is_array(_val)) return _val;
|
||||||
if(is_struct(_val)) return _val;
|
if(is_struct(_val)) return _val;
|
||||||
//if(is_undefined(_val)) return 0;
|
|
||||||
|
|
||||||
switch(prop.type) {
|
switch(prop.type) {
|
||||||
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
||||||
case VALUE_TYPE.float : return _val;
|
case VALUE_TYPE.float : return _val;
|
||||||
case VALUE_TYPE.text : return is_string(_val)? _val : string_real(_val);
|
case VALUE_TYPE.text : return is_string(_val)? _val : string_real(_val);
|
||||||
case VALUE_TYPE.color : return _val;
|
case VALUE_TYPE.color : return is_real(_val)? cola(_val) : _val;
|
||||||
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
|
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 14:53:29
|
// 2024-04-23 11:37:03
|
||||||
function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Pin";
|
name = "Pin";
|
||||||
setDimension(32, 32);
|
setDimension(32, 32);
|
||||||
|
@ -96,7 +96,7 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
|
|
||||||
if(renamed && display_name != "" && display_name != "Pin") {
|
if(renamed && display_name != "" && display_name != "Pin") {
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, display_name, _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, display_name, _s * 0.4, _s * 0.4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 14:45:48
|
// 2024-04-23 11:37:02
|
||||||
function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Pin";
|
name = "Pin";
|
||||||
setDimension(32, 32);
|
setDimension(32, 32);
|
||||||
|
@ -95,8 +95,8 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
hover_scale_to = 0;
|
hover_scale_to = 0;
|
||||||
|
|
||||||
if(renamed && display_name != "" && display_name != "Pin") {
|
if(renamed && display_name != "" && display_name != "Pin") {
|
||||||
draw_set_text(f_p0, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, display_name, _s, _s, 0);
|
draw_text_transformed(xx, yy - 12 * _s, display_name, _s * 0.4, _s * 0.4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 19:31:48
|
// 2024-04-23 11:37:11
|
||||||
function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Tunnel In";
|
name = "Tunnel In";
|
||||||
color = COLORS.node_blend_tunnel;
|
color = COLORS.node_blend_tunnel;
|
||||||
|
@ -245,7 +245,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
hover_scale_to = 0;
|
hover_scale_to = 0;
|
||||||
|
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 19:31:03
|
// 2024-04-23 11:37:09
|
||||||
function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Tunnel In";
|
name = "Tunnel In";
|
||||||
color = COLORS.node_blend_tunnel;
|
color = COLORS.node_blend_tunnel;
|
||||||
|
@ -245,7 +245,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
hover_scale_to = 0;
|
hover_scale_to = 0;
|
||||||
|
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 19:32:35
|
// 2024-04-23 11:37:07
|
||||||
function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Tunnel Out";
|
name = "Tunnel Out";
|
||||||
color = COLORS.node_blend_tunnel;
|
color = COLORS.node_blend_tunnel;
|
||||||
|
@ -179,7 +179,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
hover_scale_to = 0;
|
hover_scale_to = 0;
|
||||||
|
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 19:32:21
|
// 2024-04-22 19:32:35
|
||||||
function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
name = "Tunnel Out";
|
name = "Tunnel Out";
|
||||||
color = COLORS.node_blend_tunnel;
|
color = COLORS.node_blend_tunnel;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-23 09:27:33
|
// 2024-04-23 16:49:02
|
||||||
#region ---- global names ----
|
#region ---- global names ----
|
||||||
global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ];
|
global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ];
|
||||||
|
|
||||||
|
@ -526,6 +526,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
#region ---- main ----
|
#region ---- main ----
|
||||||
active = true;
|
active = true;
|
||||||
|
from = noone;
|
||||||
node = _node;
|
node = _node;
|
||||||
x = node.x;
|
x = node.x;
|
||||||
y = node.y;
|
y = node.y;
|
||||||
|
@ -1615,7 +1616,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
||||||
|
|
||||||
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region
|
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region //Get value
|
||||||
if(type == VALUE_TYPE.trigger)
|
if(type == VALUE_TYPE.trigger)
|
||||||
return _getValue(_time, false, 0, false);
|
return _getValue(_time, false, 0, false);
|
||||||
|
|
||||||
|
@ -1662,36 +1663,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return val;
|
return val;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static __getAnimValue = function(_time = CURRENT_FRAME) { #region
|
|
||||||
|
|
||||||
if(value_tag == "dimension" && node.attributes.use_project_dimension)
|
|
||||||
return PROJECT.attributes.surface_dimension;
|
|
||||||
|
|
||||||
if(!is_anim) {
|
|
||||||
if(sep_axis) {
|
|
||||||
if(ds_list_empty(animators[i].values)) return 0;
|
|
||||||
|
|
||||||
var val = array_verify(val, array_length(animators));
|
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
||||||
val[i] = animators[i].processType(animators[i].values[| 0].value);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ds_list_empty(animator.values)) return 0;
|
|
||||||
|
|
||||||
return animator.processType(animator.values[| 0].value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sep_axis) {
|
|
||||||
var val = [];
|
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
||||||
val[i] = animators[i].getValue(_time);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
return animator.getValue(_time);
|
|
||||||
} #endregion
|
|
||||||
|
|
||||||
static arrayBalance = function(val) { #region // Balance array (generate uniform array from single values)
|
static arrayBalance = function(val) { #region // Balance array (generate uniform array from single values)
|
||||||
if(!is_array(def_val))
|
if(!is_array(def_val))
|
||||||
return val;
|
return val;
|
||||||
|
@ -1774,6 +1745,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
if(PROJECT.attributes.strict) return val;
|
||||||
|
|
||||||
val = arrayBalance(val);
|
val = arrayBalance(val);
|
||||||
|
|
||||||
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
||||||
|
@ -1826,6 +1799,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
static __getAnimValue = function(_time = CURRENT_FRAME) { #region
|
||||||
|
|
||||||
|
if(value_tag == "dimension" && node.attributes.use_project_dimension)
|
||||||
|
return PROJECT.attributes.surface_dimension;
|
||||||
|
|
||||||
|
if(!is_anim) {
|
||||||
|
if(sep_axis) {
|
||||||
|
if(ds_list_empty(animators[i].values)) return 0;
|
||||||
|
|
||||||
|
var val = array_verify(val, array_length(animators));
|
||||||
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
|
val[i] = animators[i].processType(animators[i].values[| 0].value);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ds_list_empty(animator.values)) return 0;
|
||||||
|
|
||||||
|
return animator.processType(animator.values[| 0].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sep_axis) {
|
||||||
|
var val = [];
|
||||||
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
|
val[i] = animators[i].getValue(_time);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return animator.getValue(_time);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
static setAnim = function(anim, record = false) { #region
|
static setAnim = function(anim, record = false) { #region
|
||||||
if(is_anim == anim) return;
|
if(is_anim == anim) return;
|
||||||
if(record) {
|
if(record) {
|
||||||
|
@ -2145,7 +2148,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
if(value_from == noone) return true;
|
if(value_from == noone) return true;
|
||||||
|
|
||||||
var controlNode = struct_has(value_from, "from")? value_from.from : value_from.node;
|
var controlNode = value_from.from? value_from.from : value_from.node;
|
||||||
if(!controlNode.active) return true;
|
if(!controlNode.active) return true;
|
||||||
if(!controlNode.isRenderActive()) return true;
|
if(!controlNode.isRenderActive()) return true;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-23 09:26:39
|
// 2024-04-23 16:40:38
|
||||||
#region ---- global names ----
|
#region ---- global names ----
|
||||||
global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ];
|
global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ];
|
||||||
|
|
||||||
|
@ -526,6 +526,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
#region ---- main ----
|
#region ---- main ----
|
||||||
active = true;
|
active = true;
|
||||||
|
from = noone;
|
||||||
node = _node;
|
node = _node;
|
||||||
x = node.x;
|
x = node.x;
|
||||||
y = node.y;
|
y = node.y;
|
||||||
|
@ -1615,7 +1616,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
||||||
|
|
||||||
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region
|
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region //Get value
|
||||||
if(type == VALUE_TYPE.trigger)
|
if(type == VALUE_TYPE.trigger)
|
||||||
return _getValue(_time, false, 0, false);
|
return _getValue(_time, false, 0, false);
|
||||||
|
|
||||||
|
@ -1662,36 +1663,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return val;
|
return val;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static __getAnimValue = function(_time = CURRENT_FRAME) { #region
|
|
||||||
|
|
||||||
if(value_tag == "dimension" && node.attributes.use_project_dimension)
|
|
||||||
return PROJECT.attributes.surface_dimension;
|
|
||||||
|
|
||||||
if(!is_anim) {
|
|
||||||
if(sep_axis) {
|
|
||||||
if(ds_list_empty(animators[i].values)) return 0;
|
|
||||||
|
|
||||||
var val = array_verify(val, array_length(animators));
|
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
||||||
val[i] = animators[i].processType(animators[i].values[| 0].value);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ds_list_empty(animator.values)) return 0;
|
|
||||||
|
|
||||||
return animator.processType(animator.values[| 0].value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sep_axis) {
|
|
||||||
var val = [];
|
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
||||||
val[i] = animators[i].getValue(_time);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
return animator.getValue(_time);
|
|
||||||
} #endregion
|
|
||||||
|
|
||||||
static arrayBalance = function(val) { #region // Balance array (generate uniform array from single values)
|
static arrayBalance = function(val) { #region // Balance array (generate uniform array from single values)
|
||||||
if(!is_array(def_val))
|
if(!is_array(def_val))
|
||||||
return val;
|
return val;
|
||||||
|
@ -1774,6 +1745,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
if(PROJECT.strict) return val;
|
||||||
|
|
||||||
val = arrayBalance(val);
|
val = arrayBalance(val);
|
||||||
|
|
||||||
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
||||||
|
@ -1826,6 +1799,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
static __getAnimValue = function(_time = CURRENT_FRAME) { #region
|
||||||
|
|
||||||
|
if(value_tag == "dimension" && node.attributes.use_project_dimension)
|
||||||
|
return PROJECT.attributes.surface_dimension;
|
||||||
|
|
||||||
|
if(!is_anim) {
|
||||||
|
if(sep_axis) {
|
||||||
|
if(ds_list_empty(animators[i].values)) return 0;
|
||||||
|
|
||||||
|
var val = array_verify(val, array_length(animators));
|
||||||
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
|
val[i] = animators[i].processType(animators[i].values[| 0].value);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ds_list_empty(animator.values)) return 0;
|
||||||
|
|
||||||
|
return animator.processType(animator.values[| 0].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sep_axis) {
|
||||||
|
var val = [];
|
||||||
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
|
val[i] = animators[i].getValue(_time);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return animator.getValue(_time);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
static setAnim = function(anim, record = false) { #region
|
static setAnim = function(anim, record = false) { #region
|
||||||
if(is_anim == anim) return;
|
if(is_anim == anim) return;
|
||||||
if(record) {
|
if(record) {
|
||||||
|
@ -2145,7 +2148,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
if(value_from == noone) return true;
|
if(value_from == noone) return true;
|
||||||
|
|
||||||
var controlNode = struct_has(value_from, "from")? value_from.from : value_from.node;
|
var controlNode = value_from.from? value_from.from : value_from.node;
|
||||||
if(!controlNode.active) return true;
|
if(!controlNode.active) return true;
|
||||||
if(!controlNode.isRenderActive()) return true;
|
if(!controlNode.isRenderActive()) return true;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-21 14:43:36
|
// 2024-04-23 16:50:47
|
||||||
#region funtion calls
|
#region funtion calls
|
||||||
function __fnInit_Inspector() {
|
function __fnInit_Inspector() {
|
||||||
__registerFunction("inspector_copy_prop", panel_inspector_copy_prop);
|
__registerFunction("inspector_copy_prop", panel_inspector_copy_prop);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-14 12:50:09
|
// 2024-04-23 16:49:06
|
||||||
#region funtion calls
|
#region funtion calls
|
||||||
function __fnInit_Inspector() {
|
function __fnInit_Inspector() {
|
||||||
__registerFunction("inspector_copy_prop", panel_inspector_copy_prop);
|
__registerFunction("inspector_copy_prop", panel_inspector_copy_prop);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 17:51:56
|
// 2024-04-23 15:29:21
|
||||||
#region preference
|
#region preference
|
||||||
globalvar PREFERENCES, PREFERENCES_DEF, HOTKEYS_DATA;
|
globalvar PREFERENCES, PREFERENCES_DEF, HOTKEYS_DATA;
|
||||||
PREFERENCES = {};
|
PREFERENCES = {};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 2024-04-22 17:28:13
|
// 2024-04-23 11:00:26
|
||||||
#region preference
|
#region preference
|
||||||
globalvar PREFERENCES, PREFERENCES_DEF, HOTKEYS_DATA;
|
globalvar PREFERENCES, PREFERENCES_DEF, HOTKEYS_DATA;
|
||||||
PREFERENCES = {};
|
PREFERENCES = {};
|
||||||
|
|
146
#backups/scripts/project_data/project_data.gml.backup0
Normal file
146
#backups/scripts/project_data/project_data.gml.backup0
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
// 2024-04-23 16:49:39
|
||||||
|
#region global
|
||||||
|
globalvar PROJECTS, PROJECT;
|
||||||
|
PROJECT = noone;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region project
|
||||||
|
function Project() constructor {
|
||||||
|
active = true; /// @is {bool}
|
||||||
|
|
||||||
|
meta = __getdefaultMetaData();
|
||||||
|
path = ""; /// @is {string}
|
||||||
|
thumbnail = "";
|
||||||
|
version = SAVE_VERSION; /// @is {number}
|
||||||
|
seed = irandom_range(100000, 999999); /// @is {number}
|
||||||
|
|
||||||
|
modified = false; /// @is {bool}
|
||||||
|
readonly = false; /// @is {bool}
|
||||||
|
safeMode = false;
|
||||||
|
|
||||||
|
nodes = ds_list_create();
|
||||||
|
nodeArray = [];
|
||||||
|
nodeMap = ds_map_create();
|
||||||
|
nodeNameMap = ds_map_create();
|
||||||
|
nodeTopo = ds_list_create();
|
||||||
|
|
||||||
|
animator = new AnimationManager();
|
||||||
|
globalNode = new Node_Global();
|
||||||
|
nodeController = new __Node_Controller(self);
|
||||||
|
|
||||||
|
previewGrid = { #region
|
||||||
|
show : false,
|
||||||
|
snap : false,
|
||||||
|
size : [ 16, 16 ],
|
||||||
|
opacity : 0.5,
|
||||||
|
color : COLORS.panel_preview_grid,
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
graphGrid = { #region
|
||||||
|
show : true,
|
||||||
|
show_origin : false,
|
||||||
|
snap : true,
|
||||||
|
size : 16,
|
||||||
|
opacity : 0.05,
|
||||||
|
color : c_white,
|
||||||
|
highlight : 12,
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
addons = {};
|
||||||
|
|
||||||
|
onion_skin = { #region
|
||||||
|
enabled: false,
|
||||||
|
range: [ -1, 1 ],
|
||||||
|
step: 1,
|
||||||
|
color: [ c_red, c_blue ],
|
||||||
|
alpha: 0.5,
|
||||||
|
on_top: true,
|
||||||
|
}; #endregion
|
||||||
|
|
||||||
|
#region =================== ATTRIBUTES ===================
|
||||||
|
attributes = {
|
||||||
|
strict : false,
|
||||||
|
surface_dimension : [ 32, 32 ],
|
||||||
|
palette : [ cola(c_black), cola(c_white) ],
|
||||||
|
palette_fix : false,
|
||||||
|
}
|
||||||
|
|
||||||
|
attributeEditor = [
|
||||||
|
[ "Default Surface", "surface_dimension", new vectorBox(2, function(ind, val) { attributes.surface_dimension[ind] = val; RENDER_ALL return true; }),
|
||||||
|
function(junc) {
|
||||||
|
if(!is_struct(junc)) return;
|
||||||
|
if(!is_instanceof(junc, NodeValue)) return;
|
||||||
|
|
||||||
|
var attr = attributes.surface_dimension;
|
||||||
|
var _val = junc.getValue();
|
||||||
|
var _res = [ attr[0], attr[1] ];
|
||||||
|
|
||||||
|
switch(junc.type) {
|
||||||
|
case VALUE_TYPE.float :
|
||||||
|
case VALUE_TYPE.integer :
|
||||||
|
if(is_real(_val))
|
||||||
|
_res = [ _val, _val ];
|
||||||
|
else if(is_array(_val) && array_length(_val) >= 2) {
|
||||||
|
_res[0] = is_real(_val[0])? _val[0] : 1;
|
||||||
|
_res[1] = is_real(_val[1])? _val[1] : 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VALUE_TYPE.surface :
|
||||||
|
if(is_array(_val)) _val = array_safe_get_fast(_val, 0);
|
||||||
|
if(is_surface(_val))
|
||||||
|
_res = surface_get_dimension(_val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
attr[0] = _res[0];
|
||||||
|
attr[1] = _res[1];
|
||||||
|
} ],
|
||||||
|
|
||||||
|
[ "Palette", "palette", new buttonPalette(function(pal) { setPalette(pal); RENDER_ALL return true; }),
|
||||||
|
function(junc) {
|
||||||
|
if(!is_struct(junc)) return;
|
||||||
|
if(!is_instanceof(junc, NodeValue)) return;
|
||||||
|
if(junc.type != VALUE_TYPE.color) return;
|
||||||
|
if(junc.display_type != VALUE_DISPLAY.palette) return;
|
||||||
|
|
||||||
|
setPalette(junc.getValue());
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
[ "Strict", "strict", new checkBox(function() { attributes.strict = !attributes.strict; RENDER_ALL return true; }), function() {} ],
|
||||||
|
];
|
||||||
|
|
||||||
|
static setPalette = function(pal = noone) {
|
||||||
|
if(pal != noone) attributes.palette = pal;
|
||||||
|
palettes = paletteToArray(attributes.palette);
|
||||||
|
} setPalette();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
timelines = new timelineItemGroup();
|
||||||
|
|
||||||
|
notes = [];
|
||||||
|
|
||||||
|
static cleanup = function() { #region
|
||||||
|
if(!ds_map_empty(nodeMap))
|
||||||
|
array_map(ds_map_keys_to_array(nodeMap), function(_key, _ind) {
|
||||||
|
var _node = nodeMap[? _key];
|
||||||
|
_node.active = false;
|
||||||
|
_node.cleanUp();
|
||||||
|
});
|
||||||
|
|
||||||
|
ds_list_destroy(nodes);
|
||||||
|
ds_map_destroy(nodeMap);
|
||||||
|
ds_map_destroy(nodeNameMap);
|
||||||
|
|
||||||
|
gc_collect();
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
static toString = function() { return $"ProjectObject [{path}]"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function __initProject() {
|
||||||
|
PROJECT = new Project();
|
||||||
|
PROJECTS = [ PROJECT ];
|
||||||
|
}
|
||||||
|
#endregion
|
146
#backups/scripts/project_data/project_data.gml.backup1
Normal file
146
#backups/scripts/project_data/project_data.gml.backup1
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
// 2024-04-23 16:49:37
|
||||||
|
#region global
|
||||||
|
globalvar PROJECTS, PROJECT;
|
||||||
|
PROJECT = noone;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region project
|
||||||
|
function Project() constructor {
|
||||||
|
active = true; /// @is {bool}
|
||||||
|
|
||||||
|
meta = __getdefaultMetaData();
|
||||||
|
path = ""; /// @is {string}
|
||||||
|
thumbnail = "";
|
||||||
|
version = SAVE_VERSION; /// @is {number}
|
||||||
|
seed = irandom_range(100000, 999999); /// @is {number}
|
||||||
|
|
||||||
|
modified = false; /// @is {bool}
|
||||||
|
readonly = false; /// @is {bool}
|
||||||
|
safeMode = false;
|
||||||
|
|
||||||
|
nodes = ds_list_create();
|
||||||
|
nodeArray = [];
|
||||||
|
nodeMap = ds_map_create();
|
||||||
|
nodeNameMap = ds_map_create();
|
||||||
|
nodeTopo = ds_list_create();
|
||||||
|
|
||||||
|
animator = new AnimationManager();
|
||||||
|
globalNode = new Node_Global();
|
||||||
|
nodeController = new __Node_Controller(self);
|
||||||
|
|
||||||
|
previewGrid = { #region
|
||||||
|
show : false,
|
||||||
|
snap : false,
|
||||||
|
size : [ 16, 16 ],
|
||||||
|
opacity : 0.5,
|
||||||
|
color : COLORS.panel_preview_grid,
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
graphGrid = { #region
|
||||||
|
show : true,
|
||||||
|
show_origin : false,
|
||||||
|
snap : true,
|
||||||
|
size : 16,
|
||||||
|
opacity : 0.05,
|
||||||
|
color : c_white,
|
||||||
|
highlight : 12,
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
addons = {};
|
||||||
|
|
||||||
|
onion_skin = { #region
|
||||||
|
enabled: false,
|
||||||
|
range: [ -1, 1 ],
|
||||||
|
step: 1,
|
||||||
|
color: [ c_red, c_blue ],
|
||||||
|
alpha: 0.5,
|
||||||
|
on_top: true,
|
||||||
|
}; #endregion
|
||||||
|
|
||||||
|
#region =================== ATTRIBUTES ===================
|
||||||
|
attributes = {
|
||||||
|
strict : false,
|
||||||
|
surface_dimension : [ 32, 32 ],
|
||||||
|
palette : [ cola(c_black), cola(c_white) ],
|
||||||
|
palette_fix : false,
|
||||||
|
}
|
||||||
|
|
||||||
|
attributeEditor = [
|
||||||
|
[ "Default Surface", "surface_dimension", new vectorBox(2, function(ind, val) { attributes.surface_dimension[ind] = val; RENDER_ALL return true; }),
|
||||||
|
function(junc) {
|
||||||
|
if(!is_struct(junc)) return;
|
||||||
|
if(!is_instanceof(junc, NodeValue)) return;
|
||||||
|
|
||||||
|
var attr = attributes.surface_dimension;
|
||||||
|
var _val = junc.getValue();
|
||||||
|
var _res = [ attr[0], attr[1] ];
|
||||||
|
|
||||||
|
switch(junc.type) {
|
||||||
|
case VALUE_TYPE.float :
|
||||||
|
case VALUE_TYPE.integer :
|
||||||
|
if(is_real(_val))
|
||||||
|
_res = [ _val, _val ];
|
||||||
|
else if(is_array(_val) && array_length(_val) >= 2) {
|
||||||
|
_res[0] = is_real(_val[0])? _val[0] : 1;
|
||||||
|
_res[1] = is_real(_val[1])? _val[1] : 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VALUE_TYPE.surface :
|
||||||
|
if(is_array(_val)) _val = array_safe_get_fast(_val, 0);
|
||||||
|
if(is_surface(_val))
|
||||||
|
_res = surface_get_dimension(_val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
attr[0] = _res[0];
|
||||||
|
attr[1] = _res[1];
|
||||||
|
} ],
|
||||||
|
|
||||||
|
[ "Palette", "palette", new buttonPalette(function(pal) { setPalette(pal); RENDER_ALL return true; }),
|
||||||
|
function(junc) {
|
||||||
|
if(!is_struct(junc)) return;
|
||||||
|
if(!is_instanceof(junc, NodeValue)) return;
|
||||||
|
if(junc.type != VALUE_TYPE.color) return;
|
||||||
|
if(junc.display_type != VALUE_DISPLAY.palette) return;
|
||||||
|
|
||||||
|
setPalette(junc.getValue());
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
[ "Strict", "strict", new checkBox(function() { attributes.strict = !attributes.strict; RENDER_ALL return true; }), function() {} ],
|
||||||
|
];
|
||||||
|
|
||||||
|
static setPalette = function(pal = noone) {
|
||||||
|
if(pal != noone) attributes.palette = pal;
|
||||||
|
palettes = paletteToArray(attributes.palette);
|
||||||
|
} setPalette();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
timelines = new timelineItemGroup();
|
||||||
|
|
||||||
|
notes = [];
|
||||||
|
|
||||||
|
static cleanup = function() { #region
|
||||||
|
if(!ds_map_empty(nodeMap))
|
||||||
|
array_map(ds_map_keys_to_array(nodeMap), function(_key, _ind) {
|
||||||
|
var _node = nodeMap[? _key];
|
||||||
|
_node.active = false;
|
||||||
|
_node.cleanUp();
|
||||||
|
});
|
||||||
|
|
||||||
|
ds_list_destroy(nodes);
|
||||||
|
ds_map_destroy(nodeMap);
|
||||||
|
ds_map_destroy(nodeNameMap);
|
||||||
|
|
||||||
|
gc_collect();
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
static toString = function() { return $"ProjectObject [{path}]"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
function __initProject() {
|
||||||
|
PROJECT = new Project();
|
||||||
|
PROJECTS = [ PROJECT ];
|
||||||
|
}
|
||||||
|
#endregion
|
232
#backups/scripts/save_function/save_function.gml.backup0
Normal file
232
#backups/scripts/save_function/save_function.gml.backup0
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
// 2024-04-23 16:48:30
|
||||||
|
globalvar SAVING;
|
||||||
|
SAVING = false;
|
||||||
|
|
||||||
|
function NEW() { #region
|
||||||
|
CALL("new");
|
||||||
|
|
||||||
|
PROJECT = new Project();
|
||||||
|
array_push(PROJECTS, PROJECT);
|
||||||
|
|
||||||
|
var graph = new Panel_Graph(PROJECT);
|
||||||
|
PANEL_GRAPH.panel.setContent(graph, true);
|
||||||
|
PANEL_GRAPH = graph;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function save_serialize(project = PROJECT, _outMap = false) { #region
|
||||||
|
var _map = {};
|
||||||
|
_map.version = SAVE_VERSION;
|
||||||
|
|
||||||
|
var _node_list = [];
|
||||||
|
var _key = ds_map_find_first(project.nodeMap);
|
||||||
|
|
||||||
|
repeat(ds_map_size(project.nodeMap)) {
|
||||||
|
var _node = project.nodeMap[? _key];
|
||||||
|
|
||||||
|
if(_node.active)
|
||||||
|
array_push(_node_list, _node.serialize());
|
||||||
|
|
||||||
|
_key = ds_map_find_next(project.nodeMap, _key);
|
||||||
|
}
|
||||||
|
_map.nodes = _node_list;
|
||||||
|
|
||||||
|
var _anim_map = {};
|
||||||
|
_anim_map.frames_total = project.animator.frames_total;
|
||||||
|
_anim_map.framerate = project.animator.framerate;
|
||||||
|
_anim_map.frame_range = project.animator.frame_range;
|
||||||
|
_map.animator = _anim_map;
|
||||||
|
|
||||||
|
_map.metadata = PROJECT.meta.serialize();
|
||||||
|
_map.global_node = project.globalNode.serialize();
|
||||||
|
_map.onion_skin = project.onion_skin;
|
||||||
|
|
||||||
|
_map.previewGrid = project.previewGrid;
|
||||||
|
_map.graphGrid = project.graphGrid;
|
||||||
|
_map.attributes = project.attributes;
|
||||||
|
|
||||||
|
_map.timelines = project.timelines.serialize();
|
||||||
|
_map.notes = array_map(project.notes, function(note) { return note.serialize(); } );
|
||||||
|
|
||||||
|
var prev = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
|
if(!is_surface(prev)) _map.preview = "";
|
||||||
|
else _map.preview = surface_encode(surface_size_lim(prev, 128, 128));
|
||||||
|
|
||||||
|
var _addon = {};
|
||||||
|
with(_addon_custom) {
|
||||||
|
var _ser = lua_call(thread, "serialize");
|
||||||
|
_addon[$ name] = PREFERENCES.save_file_minify? json_stringify_minify(_ser) : json_stringify(_ser);
|
||||||
|
}
|
||||||
|
_map.addon = _addon;
|
||||||
|
|
||||||
|
if(_outMap) return _map;
|
||||||
|
|
||||||
|
return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SET_PATH(project, path) { #region
|
||||||
|
if(path == "") {
|
||||||
|
project.readonly = false;
|
||||||
|
} else if(!project.readonly) {
|
||||||
|
ds_list_remove(RECENT_FILES, path);
|
||||||
|
ds_list_insert(RECENT_FILES, 0, path);
|
||||||
|
while(ds_list_size(RECENT_FILES) > 64)
|
||||||
|
ds_list_delete(RECENT_FILES, ds_list_size(RECENT_FILES) - 1);
|
||||||
|
RECENT_SAVE();
|
||||||
|
RECENT_REFRESH();
|
||||||
|
//project.path = filename_name(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
project.path = path;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_ALL() { #region
|
||||||
|
for( var i = 0, n = array_length(PROJECTS); i < n; i++ )
|
||||||
|
SAVE(PROJECTS[i]);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE(project = PROJECT) { #region
|
||||||
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
if(project.path == "" || project.readonly)
|
||||||
|
return SAVE_AS(project);
|
||||||
|
return SAVE_AT(project, project.path);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_AS(project = PROJECT) { #region
|
||||||
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
var path = get_save_filename("Pixel Composer project (.pxc)|*.pxc|Compressed Pixel Composer project (.cpxc)|*.cpxc", "");
|
||||||
|
key_release();
|
||||||
|
if(path == "") return false;
|
||||||
|
|
||||||
|
if(filename_ext(path) != ".pxc" && filename_ext(path) != ".cpxc")
|
||||||
|
path += ".pxc";
|
||||||
|
|
||||||
|
if(file_exists_empty(path))
|
||||||
|
log_warning("SAVE", "Overrided file : " + path);
|
||||||
|
SAVE_AT(project, path);
|
||||||
|
SET_PATH(project, path);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
|
||||||
|
CALL("save");
|
||||||
|
|
||||||
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
SAVING = true;
|
||||||
|
//if(TESTING && string_char_at(filename_name(path), 1) != "[")
|
||||||
|
// path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}";
|
||||||
|
|
||||||
|
if(file_exists_empty(path)) file_delete(path);
|
||||||
|
var _ext = filename_ext(path);
|
||||||
|
if(_ext == ".pxc") file_text_write_all(path, save_serialize(project));
|
||||||
|
else if(_ext == ".cpxc") buffer_save(buffer_compress_string(save_serialize(project)), path);
|
||||||
|
|
||||||
|
SAVING = false;
|
||||||
|
project.readonly = false;
|
||||||
|
project.modified = false;
|
||||||
|
|
||||||
|
log_message("FILE", log + path, THEME.noti_icon_file_save);
|
||||||
|
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////// COLLECTION ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { #region
|
||||||
|
var _content = {};
|
||||||
|
_content.version = SAVE_VERSION;
|
||||||
|
|
||||||
|
var _nodes = [];
|
||||||
|
var cx = 0;
|
||||||
|
var cy = 0;
|
||||||
|
for(var i = 0; i < ds_list_size(_list); i++) {
|
||||||
|
cx += _list[| i].x;
|
||||||
|
cy += _list[| i].y;
|
||||||
|
}
|
||||||
|
cx = round((cx / ds_list_size(_list)) / 32) * 32;
|
||||||
|
cy = round((cy / ds_list_size(_list)) / 32) * 32;
|
||||||
|
|
||||||
|
if(save_surface) {
|
||||||
|
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
|
if(is_surface(preview_surface)) {
|
||||||
|
var icon_path = string_copy(_path, 1, string_length(_path) - 5) + ".png";
|
||||||
|
surface_save_safe(preview_surface, icon_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var i = 0; i < ds_list_size(_list); i++)
|
||||||
|
SAVE_NODE(_nodes, _list[| i], cx, cy, true, context);
|
||||||
|
_content.nodes = _nodes;
|
||||||
|
|
||||||
|
json_save_struct(_path, _content, !PREFERENCES.save_file_minify);
|
||||||
|
|
||||||
|
if(metadata != noone) {
|
||||||
|
var _meta = metadata.serialize();
|
||||||
|
var _dir = filename_dir(_path);
|
||||||
|
var _name = filename_name_only(_path);
|
||||||
|
var _mpath = $"{_dir}/{_name}.meta";
|
||||||
|
|
||||||
|
json_save_struct(_mpath, _meta, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pane = findPanel("Panel_Collection");
|
||||||
|
if(pane) pane.refreshContext();
|
||||||
|
|
||||||
|
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
|
||||||
|
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { #region
|
||||||
|
if(save_surface) {
|
||||||
|
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
|
if(is_surface(preview_surface)) {
|
||||||
|
var icon_path = string_replace(_path, filename_ext(_path), "") + ".png";
|
||||||
|
surface_save_safe(preview_surface, icon_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _content = {};
|
||||||
|
_content.version = SAVE_VERSION;
|
||||||
|
|
||||||
|
var _nodes = [];
|
||||||
|
SAVE_NODE(_nodes, _node, _node.x, _node.y, true, context);
|
||||||
|
_content.nodes = _nodes;
|
||||||
|
|
||||||
|
json_save_struct(_path, _content, !PREFERENCES.save_file_minify);
|
||||||
|
|
||||||
|
if(metadata != noone) {
|
||||||
|
var _meta = metadata.serialize();
|
||||||
|
var _dir = filename_dir(_path);
|
||||||
|
var _name = filename_name_only(_path);
|
||||||
|
var _mpath = $"{_dir}/{_name}.meta";
|
||||||
|
|
||||||
|
_meta.version = SAVE_VERSION;
|
||||||
|
json_save_struct(_mpath, _meta, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pane = findPanel("Panel_Collection");
|
||||||
|
if(pane) pane.refreshContext();
|
||||||
|
|
||||||
|
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
|
||||||
|
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) { #region
|
||||||
|
if(struct_has(_node, "nodes")) {
|
||||||
|
for(var i = 0; i < ds_list_size(_node.nodes); i++)
|
||||||
|
SAVE_NODE(_arr, _node.nodes[| i], dx, dy, scale, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
var m = _node.serialize(scale);
|
||||||
|
m.x -= dx;
|
||||||
|
m.y -= dy;
|
||||||
|
|
||||||
|
var c = context == noone? noone : context.node_id;
|
||||||
|
if(m.group == c) m.group = noone;
|
||||||
|
|
||||||
|
array_push(_arr, m);
|
||||||
|
} #endregion
|
232
#backups/scripts/save_function/save_function.gml.backup1
Normal file
232
#backups/scripts/save_function/save_function.gml.backup1
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
// 2024-04-23 16:48:01
|
||||||
|
globalvar SAVING;
|
||||||
|
SAVING = false;
|
||||||
|
|
||||||
|
function NEW() { #region
|
||||||
|
CALL("new");
|
||||||
|
|
||||||
|
PROJECT = new Project();
|
||||||
|
array_push(PROJECTS, PROJECT);
|
||||||
|
|
||||||
|
var graph = new Panel_Graph(PROJECT);
|
||||||
|
PANEL_GRAPH.panel.setContent(graph, true);
|
||||||
|
PANEL_GRAPH = graph;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function save_serialize(project = PROJECT, _outMap = false) { #region
|
||||||
|
var _map = {};
|
||||||
|
_map.version = SAVE_VERSION;
|
||||||
|
|
||||||
|
var _node_list = [];
|
||||||
|
var _key = ds_map_find_first(project.nodeMap);
|
||||||
|
|
||||||
|
repeat(ds_map_size(project.nodeMap)) {
|
||||||
|
var _node = project.nodeMap[? _key];
|
||||||
|
|
||||||
|
if(_node.active)
|
||||||
|
array_push(_node_list, _node.serialize());
|
||||||
|
|
||||||
|
_key = ds_map_find_next(project.nodeMap, _key);
|
||||||
|
}
|
||||||
|
_map.nodes = _node_list;
|
||||||
|
|
||||||
|
var _anim_map = {};
|
||||||
|
_anim_map.frames_total = project.animator.frames_total;
|
||||||
|
_anim_map.framerate = project.animator.framerate;
|
||||||
|
_anim_map.frame_range = project.animator.frame_range;
|
||||||
|
_map.animator = _anim_map;
|
||||||
|
|
||||||
|
_map.metadata = PROJECT.meta.serialize();
|
||||||
|
_map.global_node = project.globalNode.serialize();
|
||||||
|
_map.onion_skin = project.onion_skin;
|
||||||
|
|
||||||
|
_map.previewGrid = project.previewGrid;
|
||||||
|
_map.graphGrid = project.graphGrid;
|
||||||
|
_map.attributes = project.attributes;
|
||||||
|
|
||||||
|
_map.timelines = project.timelines.serialize();
|
||||||
|
_map.notes = array_map(project.notes, function(note) { return note.serialize(); } );
|
||||||
|
|
||||||
|
var prev = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
|
if(!is_surface(prev)) _map.preview = "";
|
||||||
|
else _map.preview = surface_encode(surface_size_lim(prev, 128, 128));
|
||||||
|
|
||||||
|
var _addon = {};
|
||||||
|
with(_addon_custom) {
|
||||||
|
var _ser = lua_call(thread, "serialize");
|
||||||
|
_addon[$ name] = PREFERENCES.save_file_minify? json_stringify_minify(_ser) : json_stringify(_ser);
|
||||||
|
}
|
||||||
|
_map.addon = _addon;
|
||||||
|
|
||||||
|
if(_outMap) return _map;
|
||||||
|
|
||||||
|
return PREFERENCES.save_file_minify? json_stringify_minify(_map) : json_stringify(_map, true);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SET_PATH(project, path) { #region
|
||||||
|
if(path == "") {
|
||||||
|
project.readonly = false;
|
||||||
|
} else if(!project.readonly) {
|
||||||
|
ds_list_remove(RECENT_FILES, path);
|
||||||
|
ds_list_insert(RECENT_FILES, 0, path);
|
||||||
|
while(ds_list_size(RECENT_FILES) > 64)
|
||||||
|
ds_list_delete(RECENT_FILES, ds_list_size(RECENT_FILES) - 1);
|
||||||
|
RECENT_SAVE();
|
||||||
|
RECENT_REFRESH();
|
||||||
|
//project.path = filename_name(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
project.path = path;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_ALL() { #region
|
||||||
|
for( var i = 0, n = array_length(PROJECTS); i < n; i++ )
|
||||||
|
SAVE(PROJECTS[i]);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE(project = PROJECT) { #region
|
||||||
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
if(project.path == "" || project.readonly)
|
||||||
|
return SAVE_AS(project);
|
||||||
|
return SAVE_AT(project, project.path);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_AS(project = PROJECT) { #region
|
||||||
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
var path = get_save_filename("Pixel Composer project (.pxc)|*.pxc|Compressed Pixel Composer project (.cpxc)|*.cpxc", "");
|
||||||
|
key_release();
|
||||||
|
if(path == "") return false;
|
||||||
|
|
||||||
|
if(filename_ext(path) != ".pxc" && filename_ext(path) != ".cpxc")
|
||||||
|
path += ".pxc";
|
||||||
|
|
||||||
|
if(file_exists_empty(path))
|
||||||
|
log_warning("SAVE", "Overrided file : " + path);
|
||||||
|
SAVE_AT(project, path);
|
||||||
|
SET_PATH(project, path);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
|
||||||
|
CALL("save");
|
||||||
|
|
||||||
|
if(DEMO) return false;
|
||||||
|
|
||||||
|
SAVING = true;
|
||||||
|
//if(TESTING && string_char_at(filename_name(path), 1) != "[")
|
||||||
|
// path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}";
|
||||||
|
|
||||||
|
if(file_exists_empty(path)) file_delete(path);
|
||||||
|
var _ext = filename_ext(path);
|
||||||
|
if(_ext == ".pxc") file_text_write_all(path, save_serialize(project));
|
||||||
|
else if(_ext == ".cpxc") buffer_save(buffer_compress_string(save_serialize(project)), path);
|
||||||
|
|
||||||
|
SAVING = false;
|
||||||
|
project.readonly = false;
|
||||||
|
project.modified = false;
|
||||||
|
|
||||||
|
log_message("FILE", log + path, THEME.noti_icon_file_save);
|
||||||
|
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////// COLLECTION ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { #region
|
||||||
|
var _content = {};
|
||||||
|
_content.version = SAVE_VERSION;
|
||||||
|
|
||||||
|
var _nodes = [];
|
||||||
|
var cx = 0;
|
||||||
|
var cy = 0;
|
||||||
|
for(var i = 0; i < ds_list_size(_list); i++) {
|
||||||
|
cx += _list[| i].x;
|
||||||
|
cy += _list[| i].y;
|
||||||
|
}
|
||||||
|
cx = round((cx / ds_list_size(_list)) / 32) * 32;
|
||||||
|
cy = round((cy / ds_list_size(_list)) / 32) * 32;
|
||||||
|
|
||||||
|
if(save_surface) {
|
||||||
|
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
|
if(is_surface(preview_surface)) {
|
||||||
|
var icon_path = string_copy(_path, 1, string_length(_path) - 5) + ".png";
|
||||||
|
surface_save_safe(preview_surface, icon_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var i = 0; i < ds_list_size(_list); i++)
|
||||||
|
SAVE_NODE(_nodes, _list[| i], cx, cy, true, context);
|
||||||
|
_content.nodes = _nodes;
|
||||||
|
|
||||||
|
json_save_struct(_path, _content, !PREFERENCES.save_file_minify);
|
||||||
|
|
||||||
|
if(metadata != noone) {
|
||||||
|
var _meta = metadata.serialize();
|
||||||
|
var _dir = filename_dir(_path);
|
||||||
|
var _name = filename_name_only(_path);
|
||||||
|
var _mpath = $"{_dir}/{_name}.meta";
|
||||||
|
|
||||||
|
json_save_struct(_mpath, _meta, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pane = findPanel("Panel_Collection");
|
||||||
|
if(pane) pane.refreshContext();
|
||||||
|
|
||||||
|
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
|
||||||
|
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) { #region
|
||||||
|
if(save_surface) {
|
||||||
|
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
|
if(is_surface(preview_surface)) {
|
||||||
|
var icon_path = string_replace(_path, filename_ext(_path), "") + ".png";
|
||||||
|
surface_save_safe(preview_surface, icon_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _content = {};
|
||||||
|
_content.version = SAVE_VERSION;
|
||||||
|
|
||||||
|
var _nodes = [];
|
||||||
|
SAVE_NODE(_nodes, _node, _node.x, _node.y, true, context);
|
||||||
|
_content.nodes = _nodes;
|
||||||
|
|
||||||
|
json_save_struct(_path, _content, !PREFERENCES.save_file_minify);
|
||||||
|
|
||||||
|
if(metadata != noone) {
|
||||||
|
var _meta = metadata.serialize();
|
||||||
|
var _dir = filename_dir(_path);
|
||||||
|
var _name = filename_name_only(_path);
|
||||||
|
var _mpath = $"{_dir}/{_name}.meta";
|
||||||
|
|
||||||
|
_meta.version = SAVE_VERSION;
|
||||||
|
json_save_struct(_mpath, _meta, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pane = findPanel("Panel_Collection");
|
||||||
|
if(pane) pane.refreshContext();
|
||||||
|
|
||||||
|
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
|
||||||
|
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
|
function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) { #region
|
||||||
|
if(struct_has(_node, "nodes")) {
|
||||||
|
for(var i = 0; i < ds_list_size(_node.nodes); i++)
|
||||||
|
SAVE_NODE(_arr, _node.nodes[| i], dx, dy, scale, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
var m = _node.serialize(scale);
|
||||||
|
m.x -= dx;
|
||||||
|
m.y -= dy;
|
||||||
|
|
||||||
|
var c = context == noone? noone : context.node_id;
|
||||||
|
if(m.group == c) m.group = noone;
|
||||||
|
|
||||||
|
array_push(_arr, m);
|
||||||
|
} #endregion
|
|
@ -937,6 +937,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
|
|
||||||
static refreshNodeDisplay = function() { #region
|
static refreshNodeDisplay = function() { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
if(IS_PLAYING) return;
|
||||||
|
|
||||||
updateIO();
|
updateIO();
|
||||||
setHeight();
|
setHeight();
|
||||||
|
@ -1449,8 +1450,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(preview_amount) txt = $"{preview_amount} x {txt}";
|
if(preview_amount) txt = $"{preview_amount} x {txt}";
|
||||||
|
|
||||||
switch(format) {
|
switch(format) {
|
||||||
|
case surface_rgba8unorm : break;
|
||||||
case surface_rgba4unorm : txt += showFormat? " 4RGBA" : " 4R"; break;
|
case surface_rgba4unorm : txt += showFormat? " 4RGBA" : " 4R"; break;
|
||||||
case surface_rgba8unorm : txt += showFormat? "8RGBA" : "8R"; break;
|
|
||||||
case surface_rgba16float : txt += showFormat? " 16RGBA" : " 16R"; break;
|
case surface_rgba16float : txt += showFormat? " 16RGBA" : " 16R"; break;
|
||||||
case surface_rgba32float : txt += showFormat? " 32RGBA" : " 32R"; break;
|
case surface_rgba32float : txt += showFormat? " 32RGBA" : " 32R"; break;
|
||||||
case surface_r8unorm : txt += showFormat? " 8BW" : " 8B"; break;
|
case surface_r8unorm : txt += showFormat? " 8BW" : " 8B"; break;
|
||||||
|
@ -1468,32 +1469,33 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
if(!active) return;
|
if(!active) return;
|
||||||
if(_s * w < 64) return;
|
if(_s * w < 64) return;
|
||||||
|
|
||||||
draw_set_text(f_p2, fa_center, fa_top, COLORS.panel_graph_node_dimension);
|
draw_set_text(f_p3, fa_center, fa_top, COLORS.panel_graph_node_dimension);
|
||||||
var tx = xx + w * _s / 2;
|
var tx = xx + w * _s / 2;
|
||||||
var ty = yy + (h + 4) * _s - 2;
|
var ty = yy + (h + 4) * _s - 2;
|
||||||
|
|
||||||
if(struct_get(display_parameter, "show_dimension")) {
|
if(struct_get(display_parameter, "show_dimension")) {
|
||||||
var txt = string(getNodeDimension(_s > 0.65));
|
var txt = string(getNodeDimension(_s > 0.65));
|
||||||
draw_text(round(tx), round(ty), txt);
|
draw_text(round(tx), round(ty), txt);
|
||||||
ty += line_get_height(f_p2) - 2;
|
ty += string_height(txt) - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_set_font(f_p3);
|
|
||||||
|
|
||||||
if(struct_get(display_parameter, "show_compute")) {
|
if(struct_get(display_parameter, "show_compute")) {
|
||||||
var rt = 0, unit = "";
|
var rt = 0, unit = "";
|
||||||
|
|
||||||
if(render_time == 0) {
|
if(render_time == 0) {
|
||||||
draw_set_color(COLORS._main_text_sub);
|
draw_set_color(COLORS._main_text_sub);
|
||||||
unit = "us";
|
unit = "us";
|
||||||
|
|
||||||
} else if(render_time < 1000) {
|
} else if(render_time < 1000) {
|
||||||
rt = round(render_time / 10) * 10;
|
rt = round(render_time / 10) * 10;
|
||||||
unit = "us";
|
unit = "us";
|
||||||
draw_set_color(COLORS.speed[2]);
|
draw_set_color(COLORS.speed[2]);
|
||||||
|
|
||||||
} else if(render_time < 1000000) {
|
} else if(render_time < 1000000) {
|
||||||
rt = string_format(render_time / 1000, -1, 2);
|
rt = string_format(render_time / 1000, -1, 2);
|
||||||
unit = "ms";
|
unit = "ms";
|
||||||
draw_set_color(COLORS.speed[1]);
|
draw_set_color(COLORS.speed[1]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rt = string_format(render_time / 1000000, -1, 2);
|
rt = string_format(render_time / 1000000, -1, 2);
|
||||||
unit = "s";
|
unit = "s";
|
||||||
|
@ -1502,7 +1504,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
|
|
||||||
if(render_cached) draw_set_color(COLORS._main_text_sub);
|
if(render_cached) draw_set_color(COLORS._main_text_sub);
|
||||||
|
|
||||||
draw_text(round(tx), round(ty), string(rt) + " " + unit);
|
draw_text(round(tx), round(ty), $"{rt} {unit}");
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
|
|
@ -427,6 +427,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
||||||
static processType = function(_val) { #region
|
static processType = function(_val) { #region
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
|
if(PROJECT.attributes.strict) return _val;
|
||||||
var _res = _val;
|
var _res = _val;
|
||||||
|
|
||||||
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
|
||||||
|
@ -443,7 +444,6 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
||||||
|
|
||||||
if(is_array(_val)) return _val;
|
if(is_array(_val)) return _val;
|
||||||
if(is_struct(_val)) return _val;
|
if(is_struct(_val)) return _val;
|
||||||
//if(is_undefined(_val)) return 0;
|
|
||||||
|
|
||||||
switch(prop.type) {
|
switch(prop.type) {
|
||||||
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
case VALUE_TYPE.integer : return prop.unit.mode == VALUE_UNIT.constant? round(_val) : _val;
|
||||||
|
|
|
@ -95,7 +95,7 @@ function Node_Pin(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||||
|
|
||||||
if(renamed && display_name != "" && display_name != "Pin") {
|
if(renamed && display_name != "" && display_name != "Pin") {
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, display_name, _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, display_name, _s * 0.4, _s * 0.4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
|
|
|
@ -244,7 +244,7 @@ function Node_Tunnel_In(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
||||||
hover_scale_to = 0;
|
hover_scale_to = 0;
|
||||||
|
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
|
@ -178,7 +178,7 @@ function Node_Tunnel_Out(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
hover_scale_to = 0;
|
hover_scale_to = 0;
|
||||||
|
|
||||||
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
draw_set_text(f_sdf, fa_center, fa_bottom, COLORS._main_text);
|
||||||
draw_text_transformed(xx, yy - 12, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
draw_text_transformed(xx, yy - 12 * _s, string(inputs[| 0].getValue()), _s * 0.4, _s * 0.4, 0);
|
||||||
|
|
||||||
return drawJunctions(_x, _y, _mx, _my, _s);
|
return drawJunctions(_x, _y, _mx, _my, _s);
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
|
@ -525,6 +525,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
#region ---- main ----
|
#region ---- main ----
|
||||||
active = true;
|
active = true;
|
||||||
|
from = noone;
|
||||||
node = _node;
|
node = _node;
|
||||||
x = node.x;
|
x = node.x;
|
||||||
y = node.y;
|
y = node.y;
|
||||||
|
@ -1614,7 +1615,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
||||||
|
|
||||||
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region
|
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region //Get value
|
||||||
if(type == VALUE_TYPE.trigger)
|
if(type == VALUE_TYPE.trigger)
|
||||||
return _getValue(_time, false, 0, false);
|
return _getValue(_time, false, 0, false);
|
||||||
|
|
||||||
|
@ -1661,36 +1662,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
return val;
|
return val;
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
static __getAnimValue = function(_time = CURRENT_FRAME) { #region
|
|
||||||
|
|
||||||
if(value_tag == "dimension" && node.attributes.use_project_dimension)
|
|
||||||
return PROJECT.attributes.surface_dimension;
|
|
||||||
|
|
||||||
if(!is_anim) {
|
|
||||||
if(sep_axis) {
|
|
||||||
if(ds_list_empty(animators[i].values)) return 0;
|
|
||||||
|
|
||||||
var val = array_verify(val, array_length(animators));
|
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
||||||
val[i] = animators[i].processType(animators[i].values[| 0].value);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ds_list_empty(animator.values)) return 0;
|
|
||||||
|
|
||||||
return animator.processType(animator.values[| 0].value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sep_axis) {
|
|
||||||
var val = [];
|
|
||||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
||||||
val[i] = animators[i].getValue(_time);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
return animator.getValue(_time);
|
|
||||||
} #endregion
|
|
||||||
|
|
||||||
static arrayBalance = function(val) { #region // Balance array (generate uniform array from single values)
|
static arrayBalance = function(val) { #region // Balance array (generate uniform array from single values)
|
||||||
if(!is_array(def_val))
|
if(!is_array(def_val))
|
||||||
return val;
|
return val;
|
||||||
|
@ -1773,6 +1744,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
if(PROJECT.attributes.strict) return val;
|
||||||
|
|
||||||
val = arrayBalance(val);
|
val = arrayBalance(val);
|
||||||
|
|
||||||
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
||||||
|
@ -1825,6 +1798,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
}
|
}
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
|
static __getAnimValue = function(_time = CURRENT_FRAME) { #region
|
||||||
|
|
||||||
|
if(value_tag == "dimension" && node.attributes.use_project_dimension)
|
||||||
|
return PROJECT.attributes.surface_dimension;
|
||||||
|
|
||||||
|
if(!is_anim) {
|
||||||
|
if(sep_axis) {
|
||||||
|
if(ds_list_empty(animators[i].values)) return 0;
|
||||||
|
|
||||||
|
var val = array_verify(val, array_length(animators));
|
||||||
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
|
val[i] = animators[i].processType(animators[i].values[| 0].value);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ds_list_empty(animator.values)) return 0;
|
||||||
|
|
||||||
|
return animator.processType(animator.values[| 0].value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sep_axis) {
|
||||||
|
var val = [];
|
||||||
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||||
|
val[i] = animators[i].getValue(_time);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
return animator.getValue(_time);
|
||||||
|
} #endregion
|
||||||
|
|
||||||
static setAnim = function(anim, record = false) { #region
|
static setAnim = function(anim, record = false) { #region
|
||||||
if(is_anim == anim) return;
|
if(is_anim == anim) return;
|
||||||
if(record) {
|
if(record) {
|
||||||
|
@ -2144,7 +2147,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||||
|
|
||||||
if(value_from == noone) return true;
|
if(value_from == noone) return true;
|
||||||
|
|
||||||
var controlNode = struct_has(value_from, "from")? value_from.from : value_from.node;
|
var controlNode = value_from.from? value_from.from : value_from.node;
|
||||||
if(!controlNode.active) return true;
|
if(!controlNode.active) return true;
|
||||||
if(!controlNode.isRenderActive()) return true;
|
if(!controlNode.isRenderActive()) return true;
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
|
|
||||||
#region =================== ATTRIBUTES ===================
|
#region =================== ATTRIBUTES ===================
|
||||||
attributes = {
|
attributes = {
|
||||||
|
strict : false,
|
||||||
surface_dimension : [ 32, 32 ],
|
surface_dimension : [ 32, 32 ],
|
||||||
palette : [ cola(c_black), cola(c_white) ],
|
palette : [ cola(c_black), cola(c_white) ],
|
||||||
palette_fix : false,
|
palette_fix : false,
|
||||||
|
@ -105,6 +106,8 @@
|
||||||
setPalette(junc.getValue());
|
setPalette(junc.getValue());
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
[ "Strict", "strict", new checkBox(function() { attributes.strict = !attributes.strict; RENDER_ALL return true; }), function() {} ],
|
||||||
];
|
];
|
||||||
|
|
||||||
static setPalette = function(pal = noone) {
|
static setPalette = function(pal = noone) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ function save_serialize(project = PROJECT, _outMap = false) { #region
|
||||||
_map.attributes = project.attributes;
|
_map.attributes = project.attributes;
|
||||||
|
|
||||||
_map.timelines = project.timelines.serialize();
|
_map.timelines = project.timelines.serialize();
|
||||||
_map.notes = array_map(project.notes, function(note) { return node.serialize(); } );
|
_map.notes = array_map(project.notes, function(note) { return note.serialize(); } );
|
||||||
|
|
||||||
var prev = PANEL_PREVIEW.getNodePreviewSurface();
|
var prev = PANEL_PREVIEW.getNodePreviewSurface();
|
||||||
if(!is_surface(prev)) _map.preview = "";
|
if(!is_surface(prev)) _map.preview = "";
|
||||||
|
|
Loading…
Add table
Reference in a new issue