2023-08-19 12:42:50 +02:00
|
|
|
function nodeValue(_name, _node, _connect, _type, _value, _tooltip = "") { return new NodeValue(_name, _node, _connect, _type, _value, _tooltip); }
|
2024-01-22 10:26:25 +01:00
|
|
|
function nodeValueMap(_name, _node, _junc = noone) { return new NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone).setVisible(false, false).setMapped(_junc); }
|
|
|
|
function nodeValueGradientRange(_name, _node, _junc = noone) { return new NodeValue(_name, _node, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 1, 0 ]).setDisplay(VALUE_DISPLAY.gradient_range).setVisible(false, false).setMapped(_junc); }
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constructor {
|
2024-03-24 10:02:54 +01:00
|
|
|
static DISPLAY_DATA_KEYS = [ "linked", "angle_display", "bone_id", "unit", "atlas_crop" ];
|
2023-10-02 08:57:44 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- main ----
|
2023-12-07 15:08:09 +01:00
|
|
|
active = true;
|
2024-04-23 11:53:16 +02:00
|
|
|
from = noone;
|
2023-12-07 15:08:09 +01:00
|
|
|
node = _node;
|
|
|
|
x = node.x;
|
|
|
|
y = node.y;
|
|
|
|
index = _connect == JUNCTION_CONNECT.input? ds_list_size(node.inputs) : ds_list_size(node.outputs);
|
|
|
|
type = _type;
|
2023-08-19 12:42:50 +02:00
|
|
|
forward = true;
|
|
|
|
_initName = _name;
|
2023-09-28 15:10:41 +02:00
|
|
|
|
2023-11-20 05:10:55 +01:00
|
|
|
node.will_setHeight = true;
|
|
|
|
|
2023-09-28 15:10:41 +02:00
|
|
|
static updateName = function(_name) {
|
|
|
|
name = _name;
|
2023-10-12 14:14:08 +02:00
|
|
|
internalName = string_to_var(name);
|
2023-09-28 15:10:41 +02:00
|
|
|
name_custom = true;
|
|
|
|
} updateName(_name);
|
|
|
|
|
|
|
|
name_custom = false;
|
2023-09-11 16:08:58 +02:00
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
case VALUE_TYPE.PCXnode :
|
|
|
|
accept_array = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
if(struct_has(node, "inputMap")) {
|
|
|
|
if(_connect == JUNCTION_CONNECT.input) node.inputMap[? internalName] = self;
|
|
|
|
else if(_connect == JUNCTION_CONNECT.output) node.outputMap[? internalName] = self;
|
|
|
|
}
|
|
|
|
|
2024-03-19 09:49:29 +01:00
|
|
|
tooltip = _tooltip;
|
|
|
|
editWidget = noone;
|
|
|
|
editWidgetRaw = noone;
|
2024-03-26 04:03:45 +01:00
|
|
|
graphWidget = noone;
|
2024-03-28 14:18:02 +01:00
|
|
|
graphWidgetH = 0;
|
2024-03-29 05:20:49 +01:00
|
|
|
graphWidgetP = new widgetParam(0, 0, 0, 0, 0);
|
2024-03-19 09:49:29 +01:00
|
|
|
mapWidget = noone;
|
2023-12-07 15:08:09 +01:00
|
|
|
active_tooltip = "";
|
2023-09-28 13:15:29 +02:00
|
|
|
|
|
|
|
tags = VALUE_TAG.none;
|
2024-05-23 02:17:13 +02:00
|
|
|
|
|
|
|
is_dummy = false;
|
|
|
|
dummy_get = noone;
|
2023-08-19 12:42:50 +02:00
|
|
|
#endregion
|
2023-03-02 07:59:14 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- connection ----
|
2023-12-19 14:30:34 +01:00
|
|
|
connect_type = _connect;
|
|
|
|
value_from = noone;
|
|
|
|
value_from_loop = noone;
|
|
|
|
|
|
|
|
value_to = [];
|
|
|
|
value_to_loop = [];
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
accept_array = true;
|
|
|
|
array_depth = 0;
|
|
|
|
auto_connect = true;
|
|
|
|
setFrom_condition = -1;
|
2023-10-07 09:09:18 +02:00
|
|
|
|
|
|
|
onSetFrom = noone;
|
|
|
|
onSetTo = noone;
|
2023-08-19 12:42:50 +02:00
|
|
|
#endregion
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- animation ----
|
2024-01-16 09:56:20 +01:00
|
|
|
if(_type == VALUE_TYPE.color) {
|
|
|
|
if(is_array(_value)) {
|
|
|
|
for( var i = 0, n = array_length(_value); i < n; i++ )
|
2024-04-20 05:00:28 +02:00
|
|
|
_value[i] = cola(_value[i], _color_get_alpha(_value[i]));
|
2024-01-16 09:56:20 +01:00
|
|
|
} else
|
2024-04-20 05:00:28 +02:00
|
|
|
_value = cola(_value, _color_get_alpha(_value));
|
2024-01-16 09:56:20 +01:00
|
|
|
}
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
key_inter = CURVE_TYPE.linear;
|
|
|
|
|
|
|
|
is_anim = false;
|
|
|
|
sep_axis = false;
|
2023-10-09 07:36:20 +02:00
|
|
|
animable = true;
|
2023-08-19 12:42:50 +02:00
|
|
|
sepable = is_array(_value) && array_length(_value) > 1;
|
|
|
|
animator = new valueAnimator(_value, self, false);
|
|
|
|
animators = [];
|
2024-01-16 09:56:20 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
if(is_array(_value))
|
|
|
|
for( var i = 0, n = array_length(_value); i < n; i++ ) {
|
|
|
|
animators[i] = new valueAnimator(_value[i], self, true);
|
|
|
|
animators[i].index = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
on_end = KEYFRAME_END.hold;
|
|
|
|
loop_range = -1;
|
|
|
|
#endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- value ----
|
2024-05-18 04:26:19 +02:00
|
|
|
def_val = variable_clone(_value);
|
2023-08-22 11:51:45 +02:00
|
|
|
def_length = is_array(def_val)? array_length(def_val) : 0;
|
2024-04-11 05:51:13 +02:00
|
|
|
def_depth = array_get_depth(def_val);
|
2023-08-19 12:42:50 +02:00
|
|
|
unit = new nodeValueUnit(self);
|
2023-11-26 13:16:38 +01:00
|
|
|
def_unit = VALUE_UNIT.constant;
|
2023-08-19 12:42:50 +02:00
|
|
|
dyna_depo = ds_list_create();
|
2023-11-09 04:36:03 +01:00
|
|
|
value_tag = "";
|
2023-08-19 12:42:50 +02:00
|
|
|
|
2023-11-24 10:41:53 +01:00
|
|
|
is_modified = false;
|
2023-09-09 13:52:16 +02:00
|
|
|
cache_value = [ false, false, undefined, undefined ];
|
2023-08-19 12:42:50 +02:00
|
|
|
cache_array = [ false, false ];
|
|
|
|
use_cache = true;
|
2024-05-24 07:44:36 +02:00
|
|
|
record_value = true;
|
2023-08-19 12:42:50 +02:00
|
|
|
|
|
|
|
process_array = true;
|
2023-09-18 13:54:55 +02:00
|
|
|
dynamic_array = false;
|
2023-08-19 12:42:50 +02:00
|
|
|
validateValue = true;
|
2024-04-08 14:52:24 +02:00
|
|
|
runInUI = false;
|
2023-08-19 12:42:50 +02:00
|
|
|
|
|
|
|
fullUpdate = false;
|
2023-10-02 08:57:44 +02:00
|
|
|
|
|
|
|
attributes = {};
|
2023-10-07 09:09:18 +02:00
|
|
|
|
|
|
|
node.inputs_data[index] = _value;
|
2023-10-12 14:14:08 +02:00
|
|
|
node.input_value_map[$ internalName] = _value;
|
2024-01-08 08:10:50 +01:00
|
|
|
|
2024-04-01 11:10:01 +02:00
|
|
|
__curr_get_val = [ 0, 0 ];
|
2024-06-02 04:15:18 +02:00
|
|
|
|
2024-06-10 05:53:25 +02:00
|
|
|
validator = noone;
|
2023-08-19 12:42:50 +02:00
|
|
|
#endregion
|
2023-05-03 21:42:17 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- draw ----
|
2023-10-30 14:21:34 +01:00
|
|
|
draw_line_shift_x = 0;
|
|
|
|
draw_line_shift_y = 0;
|
|
|
|
draw_line_thick = 1;
|
|
|
|
draw_line_shift_hover = false;
|
|
|
|
draw_line_blend = 1;
|
2024-01-26 14:38:50 +01:00
|
|
|
draw_line_feed = false;
|
2023-10-30 14:21:34 +01:00
|
|
|
drawLineIndex = 1;
|
|
|
|
draw_line_vb = noone;
|
|
|
|
draw_junction_index = type;
|
2023-08-19 12:42:50 +02:00
|
|
|
|
|
|
|
junction_drawing = [ THEME.node_junctions_single, type ];
|
2024-04-03 09:40:37 +02:00
|
|
|
hover_in_graph = false;
|
2023-08-19 12:42:50 +02:00
|
|
|
|
|
|
|
drag_type = 0;
|
|
|
|
drag_mx = 0;
|
|
|
|
drag_my = 0;
|
|
|
|
drag_sx = 0;
|
|
|
|
drag_sy = 0;
|
2024-06-04 06:48:23 +02:00
|
|
|
drag_rx = 0;
|
|
|
|
drag_ry = 0;
|
2023-10-15 15:04:42 +02:00
|
|
|
|
|
|
|
color = -1;
|
|
|
|
color_display = 0;
|
2023-11-27 11:40:28 +01:00
|
|
|
|
|
|
|
draw_bg = c_black;
|
|
|
|
draw_fg = c_black;
|
|
|
|
|
|
|
|
draw_blend = 1;
|
|
|
|
draw_blend_color = 1;
|
2024-04-22 14:13:03 +02:00
|
|
|
|
|
|
|
__overlay_hover = [];
|
2023-08-19 12:42:50 +02:00
|
|
|
#endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- timeline ----
|
|
|
|
show_graph = false;
|
|
|
|
graph_h = ui(64);
|
|
|
|
#endregion
|
2022-08-30 07:36:37 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- inspector ----
|
2023-09-11 16:08:58 +02:00
|
|
|
visible = _connect == JUNCTION_CONNECT.output || _type == VALUE_TYPE.surface || _type == VALUE_TYPE.path || _type == VALUE_TYPE.PCXnode;
|
2023-08-19 12:42:50 +02:00
|
|
|
show_in_inspector = true;
|
2024-03-29 05:20:49 +01:00
|
|
|
visible_in_list = true;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
display_type = VALUE_DISPLAY._default;
|
|
|
|
if(_type == VALUE_TYPE.curve) display_type = VALUE_DISPLAY.curve;
|
|
|
|
else if(_type == VALUE_TYPE.d3vertex) display_type = VALUE_DISPLAY.d3vertex;
|
2023-10-06 11:51:11 +02:00
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
display_data = {};
|
2023-10-06 11:51:11 +02:00
|
|
|
display_attribute = noone;
|
2023-09-08 12:27:22 +02:00
|
|
|
|
|
|
|
popup_dialog = noone;
|
2023-08-19 12:42:50 +02:00
|
|
|
#endregion
|
2023-04-15 14:48:29 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- graph ----
|
|
|
|
value_validation = VALIDATION.pass;
|
|
|
|
error_notification = noone;
|
|
|
|
|
|
|
|
extract_node = "";
|
|
|
|
#endregion
|
2023-03-08 07:35:51 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- expression ----
|
|
|
|
expUse = false;
|
|
|
|
expression = "";
|
|
|
|
expTree = noone;
|
2023-10-12 14:14:08 +02:00
|
|
|
expContext = {
|
|
|
|
name: name,
|
|
|
|
node_name: node.display_name,
|
|
|
|
value: 0,
|
|
|
|
node_values: node.input_value_map,
|
|
|
|
};
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
express_edit = new textArea(TEXTBOX_INPUT.text, function(str) {
|
|
|
|
expression = str;
|
|
|
|
expressionUpdate();
|
|
|
|
});
|
|
|
|
express_edit.autocomplete_server = pxl_autocomplete_server;
|
2023-10-12 14:14:08 +02:00
|
|
|
express_edit.autocomplete_context = expContext;
|
2023-08-19 12:42:50 +02:00
|
|
|
express_edit.function_guide_server = pxl_function_guide_server;
|
|
|
|
express_edit.parser_server = pxl_document_parser;
|
2023-09-07 20:59:14 +02:00
|
|
|
express_edit.format = TEXT_AREA_FORMAT.codeLUA;
|
2023-08-19 12:42:50 +02:00
|
|
|
express_edit.font = f_code;
|
|
|
|
express_edit.boxColor = COLORS._main_value_positive;
|
|
|
|
express_edit.align = fa_left;
|
|
|
|
#endregion
|
2023-05-28 20:00:51 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
#region ---- serialization ----
|
|
|
|
con_node = -1;
|
|
|
|
con_index = -1;
|
|
|
|
#endregion
|
2023-07-21 12:40:20 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============= META =============
|
|
|
|
|
2024-05-23 02:17:13 +02:00
|
|
|
static setDummy = function(get_node) { #region
|
|
|
|
is_dummy = true;
|
|
|
|
dummy_get = get_node;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static setActive = function(_active, _tooltip) { #region
|
|
|
|
INLINE
|
|
|
|
active = _active;
|
|
|
|
active_tooltip = _tooltip;
|
2023-02-14 02:51:14 +01:00
|
|
|
|
|
|
|
return self;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static setWindows = function() { #region
|
|
|
|
INLINE
|
|
|
|
setActive(OS == os_windows, "Not available on MacOS");
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static nonValidate = function() { #region
|
|
|
|
validateValue = false;
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static nonForward = function() { #region
|
|
|
|
forward = false;
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
/////============= NAME =============
|
|
|
|
|
2023-09-28 15:10:41 +02:00
|
|
|
static getName = function() { #region
|
|
|
|
if(name_custom) return name;
|
|
|
|
return __txt_junction_name(instanceof(node), connect_type, index, name);
|
|
|
|
} #endregion
|
|
|
|
|
2023-11-20 05:10:55 +01:00
|
|
|
static setName = function(_name) { #region
|
|
|
|
INLINE
|
|
|
|
name = _name;
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============= VALUE ============
|
|
|
|
|
|
|
|
static setType = function(_type) { #region
|
|
|
|
if(type == _type) return false;
|
2023-12-07 15:08:09 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
type = _type;
|
|
|
|
draw_junction_index = type;
|
|
|
|
updateColor();
|
|
|
|
|
|
|
|
return true;
|
2023-12-07 15:08:09 +01:00
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static setDefault = function(vals) { #region
|
|
|
|
if(LOADING || APPENDING) return self;
|
2023-12-07 15:08:09 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
ds_list_clear(animator.values);
|
|
|
|
for( var i = 0, n = array_length(vals); i < n; i++ )
|
|
|
|
ds_list_add(animator.values, new valueKey(vals[i][0], vals[i][1], animator));
|
|
|
|
|
2023-12-07 15:08:09 +01:00
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2023-11-26 13:16:38 +01:00
|
|
|
static resetValue = function() { #region
|
|
|
|
unit.mode = def_unit;
|
2024-05-27 03:41:41 +02:00
|
|
|
setValue(unit.apply(variable_clone(def_val)));
|
2024-03-02 10:08:44 +01:00
|
|
|
attributes.mapped = false;
|
|
|
|
|
2023-11-26 13:16:38 +01:00
|
|
|
is_modified = false;
|
|
|
|
} #endregion
|
2023-05-16 21:28:16 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static setUnitRef = function(ref, mode = VALUE_UNIT.constant) { #region
|
2024-06-02 05:28:43 +02:00
|
|
|
express_edit.side_button = unit.triggerButton;
|
|
|
|
|
2024-06-04 06:48:23 +02:00
|
|
|
if(is_instanceof(editWidget, textBox))
|
|
|
|
editWidget.side_button = unit.triggerButton;
|
|
|
|
|
2023-03-08 07:35:51 +01:00
|
|
|
unit.reference = ref;
|
|
|
|
unit.mode = mode;
|
2023-11-26 13:16:38 +01:00
|
|
|
def_unit = mode;
|
2023-03-08 07:35:51 +01:00
|
|
|
cache_value[0] = false;
|
2022-12-27 04:00:50 +01:00
|
|
|
|
|
|
|
return self;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-12-27 04:00:50 +01:00
|
|
|
|
2024-06-10 05:53:25 +02:00
|
|
|
static setValidator = function(val) {
|
|
|
|
validator = val;
|
2024-06-02 04:15:18 +02:00
|
|
|
|
|
|
|
return self;
|
2024-06-10 05:53:25 +02:00
|
|
|
}
|
2024-06-02 04:15:18 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static rejectArray = function() { #region
|
2022-12-21 02:30:23 +01:00
|
|
|
accept_array = false;
|
2022-01-13 05:24:03 +01:00
|
|
|
return self;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static setArrayDepth = function(aDepth) { #region
|
2023-03-07 14:29:47 +01:00
|
|
|
array_depth = aDepth;
|
|
|
|
return self;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-03-07 14:29:47 +01:00
|
|
|
|
2023-09-18 13:54:55 +02:00
|
|
|
static setArrayDynamic = function() { #region
|
|
|
|
dynamic_array = true;
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static rejectArrayProcess = function() { #region
|
2023-05-28 20:00:51 +02:00
|
|
|
process_array = false;
|
|
|
|
return self;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-05-28 20:00:51 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static setDropKey = function() { #region
|
2023-03-26 07:13:36 +02:00
|
|
|
switch(type) {
|
|
|
|
case VALUE_TYPE.integer : drop_key = "Number"; break;
|
|
|
|
case VALUE_TYPE.float : drop_key = "Number"; break;
|
|
|
|
case VALUE_TYPE.boolean : drop_key = "Bool"; break;
|
|
|
|
case VALUE_TYPE.color :
|
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY.palette : drop_key = "Palette"; break;
|
|
|
|
default : drop_key = "Color";
|
|
|
|
}
|
|
|
|
break;
|
2023-05-28 20:00:51 +02:00
|
|
|
case VALUE_TYPE.gradient : drop_key = "Gradient"; break;
|
2023-03-26 07:13:36 +02:00
|
|
|
case VALUE_TYPE.path : drop_key = "Asset"; break;
|
|
|
|
case VALUE_TYPE.text : drop_key = "Text"; break;
|
|
|
|
case VALUE_TYPE.pathnode : drop_key = "Path"; break;
|
|
|
|
case VALUE_TYPE.struct : drop_key = "Struct"; break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
drop_key = "None";
|
|
|
|
}
|
2023-10-31 13:33:36 +01:00
|
|
|
} setDropKey(); #endregion
|
2023-03-26 07:13:36 +02:00
|
|
|
|
2024-06-13 07:19:25 +02:00
|
|
|
mappedJunc = noone;
|
|
|
|
mapped_vec4 = false;
|
|
|
|
|
|
|
|
static setMappable = function(index, vec4 = false) { #region
|
2024-05-28 04:57:00 +02:00
|
|
|
attributes.mapped = false;
|
|
|
|
attributes.map_index = index;
|
2024-06-13 07:19:25 +02:00
|
|
|
mapped_vec4 = vec4;
|
2024-05-28 04:57:00 +02:00
|
|
|
|
|
|
|
mapButton = button(function() {
|
|
|
|
attributes.mapped = !attributes.mapped;
|
2024-06-09 06:27:50 +02:00
|
|
|
|
2024-06-23 09:36:51 +02:00
|
|
|
if(type == VALUE_TYPE.integer || type == VALUE_TYPE.float) {
|
|
|
|
if(attributes.mapped) setValue(mapped_vec4? [ 0, 0, 0, 0 ] : [ 0, 0 ]);
|
|
|
|
else setValue(def_val);
|
|
|
|
setArrayDepth(attributes.mapped);
|
|
|
|
}
|
2024-05-28 04:57:00 +02:00
|
|
|
|
|
|
|
node.triggerRender();
|
|
|
|
})
|
|
|
|
.setIcon( THEME.value_use_surface, [ function() { return attributes.mapped; } ], COLORS._main_icon )
|
|
|
|
.setTooltip("Toggle map");
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
case VALUE_TYPE.gradient :
|
|
|
|
mapWidget = noone;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default :
|
2024-06-13 07:19:25 +02:00
|
|
|
mapWidget = vec4?
|
2024-06-19 09:04:03 +02:00
|
|
|
new vectorRangeBox(4, TEXTBOX_INPUT.number, function(val, index) { return setValueDirect(val, index); }) :
|
|
|
|
new rangeBox( TEXTBOX_INPUT.number, function(val, index) { return setValueDirect(val, index); });
|
2024-05-28 04:57:00 +02:00
|
|
|
mapWidget.side_button = mapButton;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
editWidget.side_button = mapButton;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static setMapped = function(junc) { #region
|
|
|
|
mappedJunc = junc;
|
|
|
|
isTimelineVisible = function() { INLINE return is_anim && value_from == noone && mappedJunc.attributes.mapped; }
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static mappableStep = function() { #region
|
|
|
|
editWidget = mapWidget && attributes.mapped? mapWidget : editWidgetRaw;
|
|
|
|
setArrayDepth(attributes.mapped);
|
|
|
|
|
|
|
|
var inp = node.inputs[| attributes.map_index];
|
|
|
|
var vis = attributes.mapped && show_in_inspector;
|
|
|
|
|
|
|
|
if(inp.visible != vis) {
|
|
|
|
inp.visible = vis;
|
|
|
|
node.refreshNodeDisplay();
|
|
|
|
}
|
2024-06-09 06:27:50 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
/////========== ANIMATION ==========
|
|
|
|
|
|
|
|
static setAnimable = function(_anim) { #region
|
|
|
|
animable = _anim;
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static isAnimable = function() { #region
|
|
|
|
if(type == VALUE_TYPE.PCXnode) return false;
|
|
|
|
if(display_type == VALUE_DISPLAY.text_array) return false;
|
|
|
|
return animable;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static setAnim = function(anim, record = false) { #region
|
|
|
|
if(is_anim == anim) return;
|
|
|
|
if(record) {
|
|
|
|
recordAction(ACTION_TYPE.custom, function(data) {
|
|
|
|
setAnim(data.is_anim);
|
|
|
|
data.is_anim = !data.is_anim;
|
|
|
|
}, { anim: is_anim });
|
|
|
|
}
|
|
|
|
is_anim = anim;
|
|
|
|
|
|
|
|
if(is_anim) {
|
|
|
|
if(ds_list_empty(animator.values))
|
|
|
|
ds_list_add(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(), animator));
|
|
|
|
animator.values[| 0].time = CURRENT_FRAME;
|
|
|
|
animator.updateKeyMap();
|
|
|
|
|
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ ) {
|
|
|
|
if(ds_list_empty(animators[i].values))
|
|
|
|
ds_list_add(animators[i].values, new valueKey(CURRENT_FRAME, animators[i].getValue(), animators[i]));
|
|
|
|
animators[i].values[| 0].time = CURRENT_FRAME;
|
|
|
|
animators[i].updateKeyMap();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
var _val = animator.getValue();
|
|
|
|
ds_list_clear(animator.values);
|
|
|
|
animator.values[| 0] = new valueKey(0, _val, animator);
|
|
|
|
animator.updateKeyMap();
|
|
|
|
|
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ ) {
|
|
|
|
var _val = animators[i].getValue();
|
|
|
|
ds_list_clear(animators[i].values);
|
|
|
|
animators[i].values[| 0] = new valueKey(0, _val, animators[i]);
|
|
|
|
animators[i].updateKeyMap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(type == VALUE_TYPE.gradient && struct_has(attributes, "map_index"))
|
|
|
|
node.inputs[| attributes.map_index + 1].setAnim(anim);
|
|
|
|
|
|
|
|
node.refreshTimeline();
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
/////============ DISPLAY ===========
|
|
|
|
|
|
|
|
static setVisible = function(inspector) { #region
|
|
|
|
if(connect_type == JUNCTION_CONNECT.input) {
|
|
|
|
show_in_inspector = inspector;
|
|
|
|
visible = argument_count > 1? argument[1] : visible;
|
|
|
|
} else
|
|
|
|
visible = inspector;
|
|
|
|
node.will_setHeight = true;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static setDisplay = function(_type = VALUE_DISPLAY._default, _data = {}) { #region
|
|
|
|
display_type = _type;
|
|
|
|
display_data = _data;
|
|
|
|
resetDisplay();
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2024-04-23 04:59:59 +02:00
|
|
|
static resetDisplay = function() { #region //////////////////// RESET DISPLAY ////////////////////
|
2022-01-13 05:24:03 +01:00
|
|
|
editWidget = noone;
|
|
|
|
switch(display_type) {
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.button : #region
|
2024-04-08 07:13:46 +02:00
|
|
|
var _onClick;
|
|
|
|
|
2024-05-17 09:01:36 +02:00
|
|
|
if(struct_has(display_data, "onClick"))
|
2024-04-08 07:13:46 +02:00
|
|
|
_onClick = method(node, display_data.onClick);
|
|
|
|
else
|
|
|
|
_onClick = function() { setAnim(true); setValueDirect(true); };
|
|
|
|
|
|
|
|
editWidget = button(_onClick).setText(struct_try_get(display_data, "name", "Trigger"));
|
|
|
|
runInUI = struct_try_get(display_data, "UI", false);
|
2023-10-03 07:14:28 +02:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
visible = false;
|
2024-04-08 07:13:46 +02:00
|
|
|
rejectArray();
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
return; #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
case VALUE_TYPE.float :
|
|
|
|
case VALUE_TYPE.integer :
|
2023-02-14 02:51:14 +01:00
|
|
|
var _txt = TEXTBOX_INPUT.number;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY._default : #region
|
2024-03-24 04:58:08 +01:00
|
|
|
editWidget = new textBox(_txt, function(val) { return setValueInspector(val); } );
|
2024-03-31 11:10:14 +02:00
|
|
|
editWidget.setSlidable();
|
2023-10-03 04:29:58 +02:00
|
|
|
|
2024-05-17 15:25:01 +02:00
|
|
|
if(struct_has(display_data, "slide_speed")) editWidget.setSlidable(display_data.slide_speed);
|
|
|
|
if(struct_has(display_data, "unit")) editWidget.unit = display_data.unit;
|
|
|
|
if(struct_has(display_data, "front_button")) editWidget.front_button = display_data.front_button;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
extract_node = "Node_Number";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.range : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new rangeBox(_txt, function(val, index) { return setValueInspector(val, index); } );
|
2023-09-27 14:55:21 +02:00
|
|
|
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2023-09-27 14:55:21 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(!struct_has(display_data, "linked")) display_data.linked = false;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Number";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.vector : #region
|
2023-01-09 03:14:20 +01:00
|
|
|
var val = animator.getValue();
|
2023-09-16 20:26:35 +02:00
|
|
|
var len = array_length(val);
|
2023-09-15 20:12:02 +02:00
|
|
|
|
|
|
|
if(len <= 4) {
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new vectorBox(len, function(val, index) { return setValueInspector(val, index); }, unit );
|
2023-09-27 14:55:21 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(struct_has(display_data, "label")) editWidget.axis = display_data.label;
|
|
|
|
if(struct_has(display_data, "linkable")) editWidget.linkable = display_data.linkable;
|
|
|
|
if(struct_has(display_data, "per_line")) editWidget.per_line = display_data.per_line;
|
|
|
|
if(struct_has(display_data, "linked")) editWidget.linked = display_data.linked;
|
2024-06-20 08:55:04 +02:00
|
|
|
if(struct_has(display_data, "slideSpeed")) editWidget.setSlideSpeed(display_data.slideSpeed);
|
2023-10-02 04:53:30 +02:00
|
|
|
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2023-09-27 14:55:21 +02:00
|
|
|
|
2023-09-15 20:12:02 +02:00
|
|
|
if(len == 2) {
|
2024-03-24 08:01:24 +01:00
|
|
|
var _dim = struct_try_get(display_data, "useGlobal", true);
|
2023-07-15 20:01:29 +02:00
|
|
|
extract_node = [ "Node_Vector2", "Node_Path" ];
|
2023-11-09 04:36:03 +01:00
|
|
|
|
2024-05-19 07:55:09 +02:00
|
|
|
if(_dim && array_equals(def_val, DEF_SURF)) {
|
2023-11-09 04:36:03 +01:00
|
|
|
value_tag = "dimension";
|
|
|
|
node.attributes.use_project_dimension = true;
|
|
|
|
editWidget.side_button = button(function() {
|
|
|
|
node.attributes.use_project_dimension = !node.attributes.use_project_dimension;
|
|
|
|
node.triggerRender();
|
|
|
|
}).setIcon(THEME.node_use_project, 0, COLORS._main_icon).setTooltip("Use project dimension");
|
|
|
|
}
|
2023-09-15 20:12:02 +02:00
|
|
|
} else if(len == 3)
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Vector3";
|
2023-09-15 20:12:02 +02:00
|
|
|
else if(len == 4)
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Vector4";
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + string(array_safe_get_fast(global.displaySuffix_Axis, i));
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.vector_range : #region
|
2023-01-09 03:14:20 +01:00
|
|
|
var val = animator.getValue();
|
|
|
|
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) { return setValueInspector(val, index); }, unit );
|
2023-09-27 14:55:21 +02:00
|
|
|
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2023-09-27 14:55:21 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(!struct_has(display_data, "linked")) display_data.linked = false;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2024-05-25 04:51:52 +02:00
|
|
|
if(array_length(val) == 2) extract_node = "Node_Vector2";
|
|
|
|
else if(array_length(val) == 3) extract_node = "Node_Vector3";
|
|
|
|
else if(array_length(val) == 4) extract_node = "Node_Vector4";
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + string(array_safe_get_fast(global.displaySuffix_VecRange, i));
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.rotation : #region
|
2023-10-03 11:27:36 +02:00
|
|
|
var _step = struct_try_get(display_data, "step", -1);
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
editWidget = new rotator(function(val) {
|
2024-02-01 05:26:02 +01:00
|
|
|
return setValueInspector(val);
|
2023-10-03 11:27:36 +02:00
|
|
|
}, _step );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
extract_node = "Node_Number";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.rotation_range : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new rotatorRange(function(val, index) { return setValueInspector(val, index); } );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-09-11 16:08:58 +02:00
|
|
|
extract_node = "Node_Vector2";
|
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-05-25 04:51:52 +02:00
|
|
|
case VALUE_DISPLAY.rotation_random : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new rotatorRandom(function(val, index) { return setValueInspector(val, index); } );
|
2023-09-11 16:08:58 +02:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Vector2";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.slider : #region
|
2023-10-02 08:57:44 +02:00
|
|
|
var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]);
|
|
|
|
|
2024-03-24 04:58:08 +01:00
|
|
|
editWidget = new textBox(TEXTBOX_INPUT.number, function(val) { return setValueInspector(toNumber(val)); } )
|
|
|
|
.setSlidable(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ]);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-10-08 04:14:35 +02:00
|
|
|
if(struct_has(display_data, "update_stat"))
|
|
|
|
editWidget.update_stat = display_data.update_stat;
|
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Number";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.slider_range : #region
|
2023-10-02 08:57:44 +02:00
|
|
|
var _range = struct_try_get(display_data, "range", [ 0, 1, 0.01 ]);
|
|
|
|
|
2024-03-24 04:58:08 +01:00
|
|
|
editWidget = new sliderRange(_range[2], type == VALUE_TYPE.integer, [ _range[0], _range[1] ],
|
2024-06-19 09:04:03 +02:00
|
|
|
function(val, index) { return setValueInspector(val, index); } );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Range, i);
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Vector2";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.area : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new areaBox(function(val, index) { return setValueInspector(val, index); }, unit);
|
2023-11-23 13:39:35 +01:00
|
|
|
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2024-01-29 14:33:55 +01:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
editWidget.onSurfaceSize = struct_try_get(display_data, "onSurfaceSize", noone);
|
|
|
|
editWidget.showShape = struct_try_get(display_data, "useShape", true);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Area, i, "");
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Area";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.padding : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new paddingBox(function(val, index) { return setValueInspector(val, index); }, unit);
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Padding, i);
|
2023-07-21 12:40:20 +02:00
|
|
|
|
|
|
|
extract_node = "Node_Vector4";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.corner : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new cornerBox(function(val, index) { return setValueInspector(val, index); }, unit);
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2023-07-21 12:40:20 +02:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-03-31 05:36:11 +02:00
|
|
|
animators[i].suffix = " " + array_safe_get_fast(global.displaySuffix_Padding, i);
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Vector4";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.puppet_control : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new controlPointBox(function(val, index) { return setValueInspector(val, index); });
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
extract_node = "";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.enum_scroll : #region
|
2023-10-02 08:57:44 +02:00
|
|
|
if(!is_struct(display_data)) display_data = { data: display_data };
|
|
|
|
var choices = __txt_junction_data(instanceof(node), connect_type, index, display_data.data);
|
2023-09-28 15:10:41 +02:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
editWidget = new scrollBox(choices, function(val) {
|
2022-01-13 05:24:03 +01:00
|
|
|
if(val == -1) return;
|
2024-02-01 05:26:02 +01:00
|
|
|
return setValueInspector(toNumber(val));
|
2022-01-13 05:24:03 +01:00
|
|
|
} );
|
2023-10-02 08:57:44 +02:00
|
|
|
if(struct_has(display_data, "update_hover"))
|
|
|
|
editWidget.update_hover = display_data.update_hover;
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
rejectConnect();
|
2023-08-19 12:42:50 +02:00
|
|
|
key_inter = CURVE_TYPE.cut;
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.enum_button : #region
|
2023-10-02 08:57:44 +02:00
|
|
|
if(!is_struct(display_data)) display_data = { data: display_data };
|
|
|
|
var choices = __txt_junction_data(instanceof(node), connect_type, index, display_data.data);
|
2023-09-28 15:10:41 +02:00
|
|
|
|
2024-05-25 04:51:52 +02:00
|
|
|
editWidget = new buttonGroup(choices, function(val) { return setValueInspector(val); } );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
rejectConnect();
|
2023-08-19 12:42:50 +02:00
|
|
|
key_inter = CURVE_TYPE.cut;
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-09-15 20:12:02 +02:00
|
|
|
case VALUE_DISPLAY.matrix : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit );
|
2023-12-03 15:07:20 +01:00
|
|
|
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-05-17 15:25:01 +02:00
|
|
|
animators[i].suffix = $" {i}";
|
|
|
|
|
|
|
|
extract_node = "";
|
|
|
|
break; #endregion
|
|
|
|
|
|
|
|
case VALUE_DISPLAY.boolean_grid : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new matrixGrid(_txt, display_data.size, function(val, index) { return setValueInspector(val, index); }, unit );
|
2024-05-17 15:25:01 +02:00
|
|
|
|
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
|
|
|
animators[i].suffix = $" {i}";
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-06-21 20:36:53 +02:00
|
|
|
extract_node = "";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.transform : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new transformBox(function(val, index) { return setValueInspector(val, index); });
|
2023-06-21 20:36:53 +02:00
|
|
|
|
2023-07-05 15:09:52 +02:00
|
|
|
extract_node = "Node_Transform_Array";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
case VALUE_DISPLAY.toggle : #region
|
2024-05-25 04:51:52 +02:00
|
|
|
editWidget = new toggleGroup(display_data.data, function(val) { return setValueInspector(val); } );
|
2023-08-08 20:33:17 +02:00
|
|
|
|
|
|
|
rejectConnect();
|
2023-08-19 12:42:50 +02:00
|
|
|
key_inter = CURVE_TYPE.cut;
|
2023-08-08 20:33:17 +02:00
|
|
|
extract_node = "";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-09-05 20:31:36 +02:00
|
|
|
case VALUE_DISPLAY.d3quarternion : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new quarternionBox(function(val, index) { return setValueInspector(val, index); });
|
2023-09-05 20:31:36 +02:00
|
|
|
|
2023-10-31 13:33:36 +01:00
|
|
|
extract_node = "Node_Vector4";
|
2024-05-01 14:28:15 +02:00
|
|
|
display_data.angle_display = QUARTERNION_DISPLAY.euler;
|
2023-09-05 20:31:36 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-01-23 11:01:19 +01:00
|
|
|
case VALUE_DISPLAY.path_anchor : #region
|
2024-06-19 09:04:03 +02:00
|
|
|
editWidget = new pathAnchorBox(function(val, index) { return setValueInspector(val, index); });
|
2024-01-23 11:01:19 +01:00
|
|
|
|
|
|
|
extract_node = "Node_Path_Anchor";
|
|
|
|
break; #endregion
|
2023-09-05 20:31:36 +02:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
break;
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.boolean : #region
|
2024-02-01 05:26:02 +01:00
|
|
|
if(name == "Active") editWidget = new checkBoxActive(function() { return setValueInspector(!animator.getValue()); } );
|
|
|
|
else editWidget = new checkBox( function() { return setValueInspector(!animator.getValue()); } );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
key_inter = CURVE_TYPE.cut;
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Boolean";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.color : #region
|
2022-01-13 05:24:03 +01:00
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY._default :
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new buttonColor(function(color) { return setValueInspector(color); } );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-03-05 07:16:44 +01:00
|
|
|
graph_h = ui(16);
|
2023-01-09 03:14:20 +01:00
|
|
|
extract_node = "Node_Color";
|
|
|
|
break;
|
2024-05-25 04:51:52 +02:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
case VALUE_DISPLAY.palette :
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new buttonPalette(function(color) { return setValueInspector(color); } );
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
extract_node = "Node_Palette";
|
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.gradient : #region
|
|
|
|
editWidget = new buttonGradient(function(gradient) { return setValueInspector(gradient); } );
|
2023-05-28 20:00:51 +02:00
|
|
|
|
|
|
|
extract_node = "Node_Gradient_Out";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.path : #region
|
2022-01-13 05:24:03 +01:00
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY.path_array :
|
2024-06-19 05:41:07 +02:00
|
|
|
editWidget = new pathArrayBox(self, display_data.filter, function(path) { setValueInspector(path); } );
|
2023-01-01 02:06:02 +01:00
|
|
|
break;
|
2024-05-25 04:51:52 +02:00
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
case VALUE_DISPLAY.path_load :
|
2024-02-01 05:26:02 +01:00
|
|
|
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueInspector(str); } );
|
2023-10-04 05:52:20 +02:00
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
editWidget.align = fa_left;
|
2023-10-04 05:52:20 +02:00
|
|
|
editWidget.side_button = button(function() {
|
2024-05-16 15:28:45 +02:00
|
|
|
var path = display_data.filter == "dir"? get_directory("") : get_open_filename_pxc(display_data.filter, "");
|
2023-10-04 05:52:20 +02:00
|
|
|
key_release();
|
|
|
|
if(path == "") return noone;
|
2024-02-01 05:26:02 +01:00
|
|
|
return setValueInspector(path);
|
2023-10-04 05:52:20 +02:00
|
|
|
}, THEME.button_path_icon);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
extract_node = "Node_String";
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
case VALUE_DISPLAY.path_save :
|
2024-02-01 05:26:02 +01:00
|
|
|
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { setValueInspector(str); } );
|
2023-10-04 05:52:20 +02:00
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
editWidget.align = fa_left;
|
2023-10-04 05:52:20 +02:00
|
|
|
editWidget.side_button = button(function() {
|
2024-05-16 15:28:45 +02:00
|
|
|
var path = get_save_filename_pxc(display_data.filter, "");
|
2023-10-04 05:52:20 +02:00
|
|
|
key_release();
|
|
|
|
if(path == "") return noone;
|
2024-02-01 05:26:02 +01:00
|
|
|
return setValueInspector(path);
|
2023-10-04 05:52:20 +02:00
|
|
|
}, THEME.button_path_icon);
|
2023-01-09 03:14:20 +01:00
|
|
|
|
|
|
|
extract_node = "Node_String";
|
2022-01-13 05:24:03 +01:00
|
|
|
break;
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2022-12-16 09:18:09 +01:00
|
|
|
case VALUE_DISPLAY.path_font :
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new fontScrollBox( function(val) { return setValueInspector(DIRECTORY + "Fonts/" + FONT_INTERNAL[val]); } );
|
2022-12-16 09:18:09 +01:00
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.curve : #region
|
2022-01-13 05:24:03 +01:00
|
|
|
display_type = VALUE_DISPLAY.curve;
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new curveBox(function(_modified) { return setValueInspector(_modified); });
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.text : #region
|
2023-02-21 04:48:50 +01:00
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY._default :
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
2023-02-21 04:48:50 +01:00
|
|
|
extract_node = "Node_String";
|
|
|
|
break;
|
2023-08-31 18:49:57 +02:00
|
|
|
|
|
|
|
case VALUE_DISPLAY.text_box :
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new textBox(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
2023-08-31 18:49:57 +02:00
|
|
|
extract_node = "Node_String";
|
|
|
|
break;
|
2023-02-21 04:48:50 +01:00
|
|
|
|
2023-09-07 20:59:14 +02:00
|
|
|
case VALUE_DISPLAY.codeLUA :
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
2023-02-21 04:48:50 +01:00
|
|
|
|
|
|
|
editWidget.font = f_code;
|
2023-09-07 20:59:14 +02:00
|
|
|
editWidget.format = TEXT_AREA_FORMAT.codeLUA;
|
|
|
|
editWidget.min_lines = 4;
|
|
|
|
extract_node = "Node_String";
|
|
|
|
break;
|
2023-12-05 13:49:18 +01:00
|
|
|
|
2023-09-08 12:27:22 +02:00
|
|
|
case VALUE_DISPLAY.codeHLSL:
|
2024-04-08 07:13:46 +02:00
|
|
|
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
2023-09-07 20:59:14 +02:00
|
|
|
|
2023-09-08 19:47:48 +02:00
|
|
|
editWidget.autocomplete_server = hlsl_autocomplete_server;
|
|
|
|
editWidget.function_guide_server = hlsl_function_guide_server;
|
|
|
|
editWidget.parser_server = hlsl_document_parser;
|
|
|
|
editWidget.autocomplete_object = node;
|
2023-12-05 13:49:18 +01:00
|
|
|
|
2024-04-22 14:13:03 +02:00
|
|
|
editWidget.font = f_code;
|
|
|
|
editWidget.format = TEXT_AREA_FORMAT.codeHLSL;
|
2023-02-21 04:48:50 +01:00
|
|
|
editWidget.min_lines = 4;
|
|
|
|
extract_node = "Node_String";
|
|
|
|
break;
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2023-12-05 13:49:18 +01:00
|
|
|
case VALUE_DISPLAY.text_tunnel :
|
2024-04-22 14:13:03 +02:00
|
|
|
editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueInspector(str); });
|
|
|
|
|
|
|
|
editWidget.autocomplete_server = tunnel_autocomplete_server;
|
|
|
|
|
2023-12-05 13:49:18 +01:00
|
|
|
extract_node = "Node_String";
|
|
|
|
break;
|
|
|
|
|
2023-02-21 04:48:50 +01:00
|
|
|
case VALUE_DISPLAY.text_array :
|
2023-10-02 08:57:44 +02:00
|
|
|
editWidget = new textArrayBox(function() { return animator.values[| 0].value; }, display_data.data, function() { node.doUpdate(); });
|
2023-02-21 04:48:50 +01:00
|
|
|
break;
|
2023-01-04 02:30:04 +01:00
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.d3Material : #region
|
|
|
|
editWidget = new materialBox(function(ind) {
|
|
|
|
var res = setValueInspector(ind);
|
|
|
|
node.triggerRender();
|
|
|
|
return res;
|
2023-10-02 08:57:44 +02:00
|
|
|
} );
|
2023-10-06 11:51:11 +02:00
|
|
|
|
|
|
|
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
|
2022-09-27 06:37:28 +02:00
|
|
|
show_in_inspector = true;
|
2023-07-18 17:51:40 +02:00
|
|
|
extract_node = "Node_Canvas";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.surface : #region
|
|
|
|
editWidget = new surfaceBox(function(ind) { return setValueInspector(ind); } );
|
|
|
|
|
|
|
|
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
|
|
|
|
show_in_inspector = true;
|
|
|
|
extract_node = "Node_Canvas";
|
|
|
|
break; #endregion
|
2024-04-22 14:13:03 +02:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
case VALUE_TYPE.pathnode : #region
|
2023-07-15 20:01:29 +02:00
|
|
|
extract_node = "Node_Path";
|
2023-08-19 12:42:50 +02:00
|
|
|
break; #endregion
|
|
|
|
}
|
|
|
|
|
2024-05-26 04:51:14 +02:00
|
|
|
if(is_struct(display_data) && struct_has(display_data, "side_button") && editWidget.side_button == noone)
|
2024-05-24 07:44:36 +02:00
|
|
|
editWidget.side_button = display_data.side_button;
|
|
|
|
|
2024-03-19 09:49:29 +01:00
|
|
|
editWidgetRaw = editWidget;
|
2024-03-31 11:10:14 +02:00
|
|
|
if(editWidget) graphWidget = editWidget.clone();
|
2024-03-19 09:49:29 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
for( var i = 0, n = ds_list_size(animator.values); i < n; i++ ) {
|
|
|
|
animator.values[| i].ease_in_type = key_inter;
|
|
|
|
animator.values[| i].ease_out_type = key_inter;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-03-26 07:13:36 +02:00
|
|
|
|
|
|
|
setDropKey();
|
2023-11-27 11:40:28 +01:00
|
|
|
updateColor();
|
2023-10-31 13:33:36 +01:00
|
|
|
} resetDisplay(); #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============ RENDER ============
|
|
|
|
|
|
|
|
static isRendered = function() { #region
|
|
|
|
if(type == VALUE_TYPE.node) return true;
|
2023-12-22 14:46:54 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
if(value_from == noone) return true;
|
2023-12-22 14:46:54 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
var controlNode = value_from.from? value_from.from : value_from.node;
|
|
|
|
if(!controlNode.active) return true;
|
|
|
|
if(!controlNode.isRenderActive()) return true;
|
2023-12-08 12:53:31 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
return controlNode.rendered;
|
2023-12-08 12:53:31 +01:00
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static isActiveDynamic = function(frame = CURRENT_FRAME) { #region
|
2023-11-27 11:40:28 +01:00
|
|
|
INLINE
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
if(value_from_loop) return true;
|
|
|
|
if(value_from != noone) return false;
|
2023-10-07 16:23:40 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
if(expUse) {
|
|
|
|
if(!is_struct(expTree)) return false;
|
|
|
|
var res = expTree.isDynamic();
|
|
|
|
|
|
|
|
switch(res) {
|
|
|
|
case EXPRESS_TREE_ANIM.none : return false;
|
|
|
|
case EXPRESS_TREE_ANIM.base_value : force_requeue = true; return is_anim;
|
|
|
|
case EXPRESS_TREE_ANIM.animated : force_requeue = true; return true;
|
|
|
|
}
|
|
|
|
}
|
2023-10-07 16:23:40 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
return is_anim;
|
2023-10-07 16:23:40 +02:00
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============= CACHE ============
|
2024-03-14 14:35:19 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static uncache = function() { #region
|
|
|
|
use_cache = false;
|
|
|
|
return self;
|
2023-10-16 10:09:17 +02:00
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static resetCache = function() { cache_value[0] = false; }
|
2023-06-17 14:30:49 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============== GET =============
|
2022-08-30 07:36:37 +02:00
|
|
|
|
2024-06-02 05:28:43 +02:00
|
|
|
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) { #region
|
|
|
|
var typeFrom = nodeFrom == undefined? VALUE_TYPE.any : nodeFrom.type;
|
2023-01-17 08:11:55 +01:00
|
|
|
|
2024-05-11 14:56:19 +02:00
|
|
|
if(applyUnit && display_type == VALUE_DISPLAY.d3quarternion && display_data.angle_display == QUARTERNION_DISPLAY.euler)
|
|
|
|
return quarternionFromEuler(value[0], value[1], value[2]);
|
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
#region color compatibility [ color, palette, gradient ]
|
|
|
|
if(type == VALUE_TYPE.gradient && typeFrom == VALUE_TYPE.color) {
|
2023-10-03 11:27:36 +02:00
|
|
|
if(is_instanceof(value, gradientObject))
|
2023-08-23 20:01:09 +02:00
|
|
|
return value;
|
2023-10-03 11:27:36 +02:00
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
if(is_array(value)) {
|
|
|
|
var amo = array_length(value);
|
|
|
|
var grad = array_create(amo);
|
|
|
|
for( var i = 0; i < amo; i++ )
|
|
|
|
grad[i] = new gradientKey(i / amo, value[i]);
|
|
|
|
var g = new gradientObject();
|
|
|
|
g.keys = grad;
|
|
|
|
return g;
|
|
|
|
}
|
2023-10-03 11:27:36 +02:00
|
|
|
|
|
|
|
if(is_real(value)) return new gradientObject(value);
|
|
|
|
return new gradientObject(0);
|
2023-08-23 20:01:09 +02:00
|
|
|
}
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
if(display_type == VALUE_DISPLAY.palette && !is_array(value)) {
|
|
|
|
return [ value ];
|
|
|
|
}
|
|
|
|
#endregion
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
if(display_type == VALUE_DISPLAY.area) { #region
|
2023-10-02 08:57:44 +02:00
|
|
|
|
2024-06-02 05:28:43 +02:00
|
|
|
if(!is_undefined(nodeFrom) && struct_has(nodeFrom.display_data, "onSurfaceSize")) {
|
2024-05-27 03:41:41 +02:00
|
|
|
var surf = nodeFrom.display_data.onSurfaceSize();
|
2024-03-31 05:36:11 +02:00
|
|
|
var dispType = array_safe_get_fast(value, 5, AREA_MODE.area);
|
2024-05-27 03:41:41 +02:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
switch(dispType) {
|
|
|
|
case AREA_MODE.area :
|
|
|
|
break;
|
2023-08-01 11:16:23 +02:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
case AREA_MODE.padding :
|
2024-05-27 03:41:41 +02:00
|
|
|
var ww = unit.mode == VALUE_UNIT.reference? 1 : surf[0];
|
|
|
|
var hh = unit.mode == VALUE_UNIT.reference? 1 : surf[1];
|
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
var cx = (ww - value[0] + value[2]) / 2
|
|
|
|
var cy = (value[1] + hh - value[3]) / 2;
|
|
|
|
var sw = abs((ww - value[0]) - value[2]) / 2;
|
|
|
|
var sh = abs(value[1] - (hh - value[3])) / 2;
|
2024-05-27 03:41:41 +02:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
value = [cx, cy, sw, sh, value[4], value[5]];
|
|
|
|
break;
|
2023-08-01 11:16:23 +02:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
case AREA_MODE.two_point :
|
|
|
|
var cx = (value[0] + value[2]) / 2
|
|
|
|
var cy = (value[1] + value[3]) / 2;
|
|
|
|
var sw = abs(value[0] - value[2]) / 2;
|
|
|
|
var sh = abs(value[1] - value[3]) / 2;
|
2024-03-28 08:33:28 +01:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
value = [cx, cy, sw, sh, value[4], value[5]];
|
|
|
|
break;
|
|
|
|
}
|
2023-08-01 11:16:23 +02:00
|
|
|
}
|
2024-03-31 05:36:11 +02:00
|
|
|
|
|
|
|
return applyUnit? unit.apply(value, arrIndex) : value;
|
2023-08-23 20:01:09 +02:00
|
|
|
} #endregion
|
2023-08-01 11:16:23 +02:00
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
if(type == VALUE_TYPE.text) { #region
|
2023-02-21 04:48:50 +01:00
|
|
|
switch(display_type) {
|
2023-08-23 20:01:09 +02:00
|
|
|
case VALUE_DISPLAY.text_array : return value;
|
|
|
|
default: return string_real(value);
|
2023-02-21 04:48:50 +01:00
|
|
|
}
|
2023-08-23 20:01:09 +02:00
|
|
|
} #endregion
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-03-02 07:59:14 +01:00
|
|
|
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);
|
2024-05-11 14:56:19 +02:00
|
|
|
|
2023-01-01 02:06:02 +01:00
|
|
|
if(typeFrom == VALUE_TYPE.boolean && type == VALUE_TYPE.text)
|
|
|
|
return value? "true" : "false";
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2023-09-09 13:52:16 +02:00
|
|
|
if(type == VALUE_TYPE.integer || type == VALUE_TYPE.float) { #region
|
2023-01-01 02:06:02 +01:00
|
|
|
if(typeFrom == VALUE_TYPE.text)
|
|
|
|
value = toNumber(value);
|
|
|
|
|
2024-04-13 07:32:04 +02:00
|
|
|
value = applyUnit? unit.apply(value, arrIndex) : value;
|
|
|
|
|
|
|
|
if(value_tag == "dimension") {
|
|
|
|
for( var i = 0, n = array_length(value); i < n; i++ )
|
|
|
|
value[i] = clamp(value[i], 0, 8192);
|
|
|
|
}
|
|
|
|
|
2024-06-10 05:53:25 +02:00
|
|
|
if(validator != noone)
|
|
|
|
value = validator.validate(value);
|
2024-06-02 04:15:18 +02:00
|
|
|
|
2024-04-13 07:32:04 +02:00
|
|
|
return value;
|
2023-09-09 13:52:16 +02:00
|
|
|
} #endregion
|
2023-03-28 06:58:28 +02:00
|
|
|
|
|
|
|
if(type == VALUE_TYPE.surface && connect_type == JUNCTION_CONNECT.input && !is_surface(value) && def_val == USE_DEF)
|
|
|
|
return DEF_SURFACE;
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
return value;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2024-04-01 06:34:02 +02:00
|
|
|
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
|
|
|
|
|
2024-05-24 07:44:36 +02:00
|
|
|
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region ////Get value
|
2023-06-13 14:42:06 +02:00
|
|
|
if(type == VALUE_TYPE.trigger)
|
2024-04-08 07:13:46 +02:00
|
|
|
return _getValue(_time, false, 0, false);
|
2023-09-09 13:52:16 +02:00
|
|
|
|
2024-04-01 11:10:01 +02:00
|
|
|
//global.cache_call++;
|
2023-07-25 20:12:40 +02:00
|
|
|
if(useCache && use_cache) {
|
2023-05-16 21:28:16 +02:00
|
|
|
var cache_hit = cache_value[0];
|
2023-11-17 06:24:31 +01:00
|
|
|
cache_hit &= !isActiveDynamic(_time) || cache_value[1] == _time;
|
2023-05-16 21:28:16 +02:00
|
|
|
cache_hit &= cache_value[2] != undefined;
|
2023-09-09 13:52:16 +02:00
|
|
|
cache_hit &= cache_value[3] == applyUnit;
|
2023-05-16 21:28:16 +02:00
|
|
|
cache_hit &= connect_type == JUNCTION_CONNECT.input;
|
2023-07-28 19:41:57 +02:00
|
|
|
cache_hit &= unit.reference == noone || unit.mode == VALUE_UNIT.constant;
|
2023-07-23 20:21:35 +02:00
|
|
|
|
2023-07-14 20:34:35 +02:00
|
|
|
if(cache_hit) {
|
2024-04-01 11:10:01 +02:00
|
|
|
//global.cache_hit++;
|
2023-10-02 14:41:44 +02:00
|
|
|
return cache_value[2];
|
2023-07-14 20:34:35 +02:00
|
|
|
}
|
2023-05-16 21:28:16 +02:00
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-09-09 13:52:16 +02:00
|
|
|
var val = _getValue(_time, applyUnit, arrIndex, log);
|
2024-04-24 03:46:53 +02:00
|
|
|
|
2024-04-11 05:51:13 +02:00
|
|
|
if(!accept_array && array_get_depth(val) > def_depth) {
|
|
|
|
noti_warning($"{name} does not accept array data.",, node);
|
|
|
|
return 0;
|
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
draw_junction_index = type;
|
2023-10-07 16:23:40 +02:00
|
|
|
if(type == VALUE_TYPE.surface || type == VALUE_TYPE.any) {
|
2023-10-06 11:51:11 +02:00
|
|
|
var _sval = val;
|
|
|
|
if(is_array(_sval) && !array_empty(_sval))
|
|
|
|
_sval = _sval[0];
|
|
|
|
if(is_instanceof(_sval, SurfaceAtlas))
|
|
|
|
draw_junction_index = VALUE_TYPE.atlas;
|
|
|
|
}
|
|
|
|
|
2023-05-16 21:28:16 +02:00
|
|
|
if(useCache) {
|
|
|
|
cache_value[0] = true;
|
2023-07-23 20:21:35 +02:00
|
|
|
cache_value[1] = _time;
|
2023-05-16 21:28:16 +02:00
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2024-04-01 11:10:01 +02:00
|
|
|
cache_value[2] = val;
|
2023-09-09 13:52:16 +02:00
|
|
|
cache_value[3] = applyUnit;
|
2024-04-01 11:10:01 +02:00
|
|
|
|
2024-05-08 06:44:41 +02:00
|
|
|
updateColor(val);
|
2023-07-23 20:21:35 +02:00
|
|
|
|
2023-09-14 16:29:39 +02:00
|
|
|
return val;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static _getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, log = false) { #region
|
2024-04-01 11:10:01 +02:00
|
|
|
|
|
|
|
getValueRecursive(self.__curr_get_val, _time);
|
|
|
|
var val = __curr_get_val[0];
|
|
|
|
var nod = __curr_get_val[1];
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
var typ = nod.type;
|
|
|
|
var dis = nod.display_type;
|
2022-01-18 05:31:19 +01:00
|
|
|
|
2023-08-22 11:51:45 +02:00
|
|
|
if(connect_type == JUNCTION_CONNECT.output)
|
|
|
|
return val;
|
|
|
|
|
2024-04-11 05:51:13 +02:00
|
|
|
if(typ == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) { #region Dimension conversion
|
2022-01-18 05:31:19 +01:00
|
|
|
if(is_array(val)) {
|
2023-01-01 02:06:02 +01:00
|
|
|
var eqSize = true;
|
|
|
|
var sArr = [];
|
|
|
|
var _osZ = 0;
|
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(val); i < n; i++ ) {
|
2023-01-01 02:06:02 +01:00
|
|
|
if(!is_surface(val[i])) continue;
|
|
|
|
|
2024-07-02 08:56:01 +02:00
|
|
|
var surfSz = surface_get_dimension(val[i]);
|
2023-01-01 02:06:02 +01:00
|
|
|
array_push(sArr, surfSz);
|
|
|
|
|
|
|
|
if(i && !array_equals(surfSz, _osZ))
|
|
|
|
eqSize = false;
|
|
|
|
|
|
|
|
_osZ = surfSz;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(eqSize) return _osZ;
|
|
|
|
return sArr;
|
|
|
|
} else if (is_surface(val))
|
2023-09-08 21:37:36 +02:00
|
|
|
return [ surface_get_width_safe(val), surface_get_height_safe(val) ];
|
2024-04-11 05:51:13 +02:00
|
|
|
return [ 1, 1 ];
|
2024-04-01 06:34:02 +02:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
} #endregion
|
2022-01-18 05:31:19 +01:00
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
if(type == VALUE_TYPE.d3Material) { #region
|
|
|
|
if(nod == self) {
|
|
|
|
return def_val;
|
|
|
|
|
|
|
|
} else if(typ == VALUE_TYPE.surface) {
|
|
|
|
if(!is_array(val)) return def_val.clone(val);
|
|
|
|
|
|
|
|
var _val = array_create(array_length(val));
|
|
|
|
for( var i = 0, n = array_length(val); i < n; i++ )
|
2024-05-03 12:18:44 +02:00
|
|
|
_val[i] = def_val.clone(val[i]);
|
2024-04-08 07:13:46 +02:00
|
|
|
|
|
|
|
return _val;
|
|
|
|
}
|
|
|
|
} #endregion
|
|
|
|
|
2024-04-23 11:53:16 +02:00
|
|
|
if(PROJECT.attributes.strict) return val;
|
|
|
|
|
2023-08-22 11:51:45 +02:00
|
|
|
val = arrayBalance(val);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
if(isArray(val) && array_length(val) < 1024) { #region Process data
|
2023-09-18 13:54:55 +02:00
|
|
|
var _val = array_create(array_length(val));
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(val); i < n; i++ )
|
2023-09-18 13:54:55 +02:00
|
|
|
_val[i] = valueProcess(val[i], nod, applyUnit, arrIndex);
|
|
|
|
return _val;
|
2024-04-01 06:34:02 +02:00
|
|
|
|
2024-03-31 05:36:11 +02:00
|
|
|
} #endregion
|
2022-12-16 09:18:09 +01:00
|
|
|
|
2023-09-18 13:54:55 +02:00
|
|
|
return valueProcess(val, nod, applyUnit, arrIndex);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-01 11:10:01 +02:00
|
|
|
static getValueRecursive = function(arr = __curr_get_val, _time = CURRENT_FRAME) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-01 11:10:01 +02:00
|
|
|
arr[@ 0] = __getAnimValue(_time);
|
|
|
|
arr[@ 1] = self;
|
2023-06-13 14:42:06 +02:00
|
|
|
|
2023-12-19 14:30:34 +01:00
|
|
|
if(value_from_loop && value_from_loop.bypassConnection() && value_from_loop.junc_out)
|
2024-04-01 11:10:01 +02:00
|
|
|
value_from_loop.getValue(arr);
|
2024-04-01 06:34:02 +02:00
|
|
|
|
2023-12-19 14:30:34 +01:00
|
|
|
else if(value_from && value_from != self)
|
2024-04-01 11:10:01 +02:00
|
|
|
value_from.getValueRecursive(arr, _time);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-07-11 20:36:44 +02:00
|
|
|
if(expUse && is_struct(expTree) && expTree.validate()) {
|
2023-07-14 20:34:35 +02:00
|
|
|
|
2024-04-30 05:57:34 +02:00
|
|
|
if(global.EVALUATE_HEAD == self) {
|
2023-09-19 14:21:55 +02:00
|
|
|
noti_warning($"Expression evaluation error : recursive call detected.");
|
2024-04-01 06:34:02 +02:00
|
|
|
|
2024-04-30 05:57:34 +02:00
|
|
|
} else if(global.EVALUATE_HEAD == noone) {
|
2023-07-29 10:10:48 +02:00
|
|
|
|
2023-07-14 20:34:35 +02:00
|
|
|
global.EVALUATE_HEAD = self;
|
2023-10-12 14:14:08 +02:00
|
|
|
expContext = {
|
2024-04-01 11:10:01 +02:00
|
|
|
name : name,
|
|
|
|
node_name : node.display_name,
|
|
|
|
value : arr[0],
|
|
|
|
node_values : node.input_value_map,
|
2023-07-14 20:34:35 +02:00
|
|
|
};
|
2023-08-02 19:11:57 +02:00
|
|
|
|
2023-10-12 14:14:08 +02:00
|
|
|
var _exp_res = expTree.eval(variable_clone(expContext));
|
2024-04-30 05:57:34 +02:00
|
|
|
|
2023-11-26 13:16:38 +01:00
|
|
|
printIf(global.LOG_EXPRESSION, $">>>> Result = {_exp_res}");
|
2023-09-19 14:21:55 +02:00
|
|
|
|
2023-08-02 19:11:57 +02:00
|
|
|
if(is_undefined(_exp_res)) {
|
2024-04-01 11:10:01 +02:00
|
|
|
arr[@ 0] = 0;
|
2024-04-30 05:57:34 +02:00
|
|
|
noti_warning("Expression returns undefine values.");
|
|
|
|
|
2023-08-02 19:11:57 +02:00
|
|
|
} else
|
2024-04-01 11:10:01 +02:00
|
|
|
arr[@ 0] = _exp_res;
|
2023-07-14 20:34:35 +02:00
|
|
|
}
|
2024-04-30 05:57:34 +02:00
|
|
|
|
|
|
|
global.EVALUATE_HEAD = noone;
|
2023-10-12 12:25:38 +02:00
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-04-24 03:46:53 +02:00
|
|
|
static arrayBalance = function(val) { #region
|
|
|
|
if(!is_array(def_val))
|
|
|
|
return val;
|
|
|
|
|
|
|
|
if(isDynamicArray())
|
|
|
|
return val;
|
|
|
|
|
|
|
|
if(isArray(val))
|
|
|
|
return val;
|
|
|
|
|
|
|
|
if(!is_array(val))
|
|
|
|
return array_create(def_length, val);
|
|
|
|
|
|
|
|
if(array_length(val) < def_length)
|
|
|
|
array_resize(val, def_length);
|
|
|
|
|
|
|
|
return val;
|
|
|
|
} #endregion
|
|
|
|
|
2024-04-23 11:53:16 +02:00
|
|
|
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) {
|
2024-07-03 05:24:37 +02:00
|
|
|
var val = array_create(array_length(animators));
|
2024-04-23 11:53:16 +02:00
|
|
|
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
|
|
|
|
|
2024-01-23 07:51:28 +01:00
|
|
|
static isTimelineVisible = function() { INLINE return is_anim && value_from == noone; }
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
show_val = [];
|
2024-05-27 03:41:41 +02:00
|
|
|
static showValue = function() { #region ////showValue
|
2024-03-31 11:10:14 +02:00
|
|
|
INLINE
|
2023-08-02 19:11:57 +02:00
|
|
|
|
2024-04-03 09:40:37 +02:00
|
|
|
var val = 0;
|
2023-08-01 11:16:23 +02:00
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
if(value_from != noone || is_anim || expUse)
|
2024-05-27 03:41:41 +02:00
|
|
|
val = getValue(CURRENT_FRAME, false);
|
2024-03-31 11:10:14 +02:00
|
|
|
|
|
|
|
else if(sep_axis) {
|
|
|
|
show_val = array_verify(show_val, array_length(animators));
|
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-04-03 09:40:37 +02:00
|
|
|
show_val[i] = ds_list_empty(animators[i].values)? 0 : animators[i].processType(animators[i].values[| 0].value);
|
2024-03-31 11:10:14 +02:00
|
|
|
val = show_val;
|
2024-04-03 09:40:37 +02:00
|
|
|
} else
|
|
|
|
val = ds_list_empty(animator.values)? 0 : animator.processType(animator.values[| 0].value);
|
2023-09-14 16:29:39 +02:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return val;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static unitConvert = function(mode) { #region
|
|
|
|
var _v = animator.values;
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(_v); i++ )
|
|
|
|
_v[| i].value = unit.convertUnit(_v[| i].value, mode);
|
|
|
|
} #endregion
|
|
|
|
|
2023-09-18 13:54:55 +02:00
|
|
|
static isDynamicArray = function() { #region
|
|
|
|
if(dynamic_array) return true;
|
|
|
|
|
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY.curve :
|
|
|
|
case VALUE_DISPLAY.palette :
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
} #endregion
|
2023-10-02 08:57:44 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static isArray = function(val = undefined) { #region
|
2023-11-30 10:55:37 +01:00
|
|
|
var _cac = val == undefined;
|
|
|
|
|
|
|
|
if(_cac) {
|
2023-10-28 04:07:43 +02:00
|
|
|
if(cache_array[0]) return cache_array[1];
|
2023-02-14 02:51:14 +01:00
|
|
|
val = getValue();
|
2023-11-30 10:55:37 +01:00
|
|
|
cache_array[0] = true;
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
|
|
|
|
2024-06-23 07:30:42 +02:00
|
|
|
var _dep = array_get_depth(val) > array_depth + typeArray(display_type);
|
|
|
|
if(_cac) cache_array[1] = _dep;
|
|
|
|
return _dep;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static arrayLength = function(val = undefined) { #region
|
2023-11-18 03:47:11 +01:00
|
|
|
val ??= getValue();
|
2023-02-28 09:43:01 +01:00
|
|
|
|
|
|
|
if(!isArray(val))
|
2023-09-18 13:54:55 +02:00
|
|
|
return -1;
|
2023-02-28 09:43:01 +01:00
|
|
|
|
|
|
|
if(array_depth == 0 && !typeArray(display_type))
|
|
|
|
return array_length(val);
|
|
|
|
|
2023-08-24 11:59:05 +02:00
|
|
|
var ar = val;
|
|
|
|
var _depth = max(0, array_depth + typeArray(display_type) - 1);
|
|
|
|
repeat(_depth)
|
2023-02-28 09:43:01 +01:00
|
|
|
ar = ar[0];
|
|
|
|
|
|
|
|
return array_length(ar);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============== SET =============
|
|
|
|
|
|
|
|
static onValidate = function() { #region
|
|
|
|
if(!validateValue) return;
|
|
|
|
var _val = value_validation, str = "";
|
|
|
|
value_validation = VALIDATION.pass;
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
case VALUE_TYPE.path:
|
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY.path_load:
|
|
|
|
var path = animator.getValue();
|
|
|
|
if(is_array(path)) path = path[0];
|
|
|
|
|
|
|
|
if(!is_string(path) || path == "") {
|
|
|
|
str = $"Path invalid: {path}";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(path_get(path) == -1) {
|
|
|
|
value_validation = VALIDATION.error;
|
|
|
|
str = $"File not exist: {path}";
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case VALUE_DISPLAY.path_array:
|
|
|
|
var paths = animator.getValue();
|
|
|
|
if(is_array(paths)) {
|
|
|
|
for( var i = 0, n = array_length(paths); i < n; i++ ) {
|
|
|
|
if(path_get(paths[i]) != -1) continue;
|
|
|
|
value_validation = VALIDATION.error;
|
|
|
|
str = "File not exist: " + string(paths[i]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
value_validation = VALIDATION.error;
|
|
|
|
str = "File not exist: " + string(paths);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
node.onValidate();
|
|
|
|
|
|
|
|
if(_val == value_validation) return self;
|
|
|
|
|
|
|
|
#region notification
|
|
|
|
if(value_validation == VALIDATION.error && error_notification == noone) {
|
|
|
|
error_notification = noti_error(str);
|
|
|
|
error_notification.onClick = function() { PANEL_GRAPH.focusNode(node); };
|
|
|
|
}
|
|
|
|
|
|
|
|
if(value_validation == VALIDATION.pass && error_notification != noone) {
|
|
|
|
noti_remove(error_notification);
|
|
|
|
error_notification = noone;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2024-05-24 07:44:36 +02:00
|
|
|
static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { #region ////Set value
|
2022-12-27 04:00:50 +01:00
|
|
|
val = unit.invApply(val);
|
2023-03-21 03:01:53 +01:00
|
|
|
return setValueDirect(val, noone, record, time, _update);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-12-27 04:00:50 +01:00
|
|
|
|
2023-09-16 20:26:35 +02:00
|
|
|
static overrideValue = function(_val) { #region
|
|
|
|
ds_list_clear(animator.values);
|
|
|
|
ds_list_add(animator.values, new valueKey(0, _val, animator));
|
|
|
|
|
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ ) {
|
|
|
|
ds_list_clear(animators[i].values);
|
2024-03-31 05:36:11 +02:00
|
|
|
ds_list_add(animators[i].values, new valueKey(0, array_safe_get_fast(_val, i), animators[i]));
|
2023-09-16 20:26:35 +02:00
|
|
|
}
|
|
|
|
} #endregion
|
|
|
|
|
2024-06-19 09:04:03 +02:00
|
|
|
static setValueInspector = function(_val = 0, index = noone, time = CURRENT_FRAME) { #region
|
2024-02-01 05:26:02 +01:00
|
|
|
INLINE
|
2024-05-01 14:28:15 +02:00
|
|
|
|
2024-02-01 05:26:02 +01:00
|
|
|
var res = false;
|
2024-06-04 06:48:23 +02:00
|
|
|
var val = unit.invApply(_val);
|
2024-02-01 05:26:02 +01:00
|
|
|
|
|
|
|
if(PANEL_INSPECTOR && PANEL_INSPECTOR.inspectGroup == 1) {
|
|
|
|
var ind = self.index;
|
|
|
|
|
|
|
|
for( var i = 0, n = array_length(PANEL_INSPECTOR.inspectings); i < n; i++ ) {
|
|
|
|
var _node = PANEL_INSPECTOR.inspectings[i];
|
|
|
|
if(ind >= ds_list_size(_node.inputs)) continue;
|
|
|
|
|
2024-05-11 14:56:19 +02:00
|
|
|
var r = _node.inputs[| ind].setValueDirect(val, index);
|
2024-02-01 05:26:02 +01:00
|
|
|
if(_node == node) res = r;
|
|
|
|
}
|
2024-03-31 11:10:14 +02:00
|
|
|
} else {
|
2024-06-19 09:04:03 +02:00
|
|
|
res = setValueDirect(val, index, time);
|
2024-03-31 11:10:14 +02:00
|
|
|
}
|
|
|
|
|
2024-02-01 05:26:02 +01:00
|
|
|
return res;
|
|
|
|
} #endregion
|
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static setValueDirect = function(val = 0, index = noone, record = true, time = CURRENT_FRAME, _update = true) { #region
|
2023-11-24 10:41:53 +01:00
|
|
|
is_modified = true;
|
2023-03-21 03:01:53 +01:00
|
|
|
var updated = false;
|
2024-01-26 14:38:50 +01:00
|
|
|
var _val = val;
|
|
|
|
var _inp = connect_type == JUNCTION_CONNECT.input;
|
2024-05-01 14:28:15 +02:00
|
|
|
|
2024-05-24 07:44:36 +02:00
|
|
|
record &= record_value;
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
if(sep_axis) {
|
|
|
|
if(index == noone) {
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2024-01-26 14:38:50 +01:00
|
|
|
updated |= animators[i].setValue(val[i], _inp && record, time);
|
2023-03-21 03:01:53 +01:00
|
|
|
} else
|
2024-04-08 14:52:24 +02:00
|
|
|
updated = animators[index].setValue(val, _inp && record, time);
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
} else {
|
|
|
|
if(index != noone) {
|
2024-01-26 14:38:50 +01:00
|
|
|
_val = animator.getValue(time);
|
|
|
|
if(_inp) _val = variable_clone(_val);
|
|
|
|
|
2023-03-21 03:01:53 +01:00
|
|
|
_val[index] = val;
|
2024-01-26 14:38:50 +01:00
|
|
|
}
|
|
|
|
|
2024-05-01 14:28:15 +02:00
|
|
|
updated = animator.setValue(_val, _inp && record, time);
|
2023-03-21 03:01:53 +01:00
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-23 15:39:24 +02:00
|
|
|
if(type == VALUE_TYPE.gradient) updated = true;
|
|
|
|
if(display_type == VALUE_DISPLAY.palette) updated = true;
|
2023-01-04 02:30:04 +01:00
|
|
|
|
2023-12-19 14:30:34 +01:00
|
|
|
for( var i = 0, n = array_length(value_to_loop); i < n; i++ )
|
|
|
|
value_to_loop[i].updateValue();
|
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
if(!updated) return false;
|
|
|
|
|
2024-01-26 14:38:50 +01:00
|
|
|
if(value_tag == "dimension")
|
2023-11-09 04:36:03 +01:00
|
|
|
node.attributes.use_project_dimension = false;
|
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
draw_junction_index = type;
|
|
|
|
if(type == VALUE_TYPE.surface) {
|
|
|
|
var _sval = val;
|
|
|
|
if(is_array(_sval) && !array_empty(_sval))
|
|
|
|
_sval = _sval[0];
|
2024-06-19 09:04:03 +02:00
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
if(is_instanceof(_sval, SurfaceAtlas))
|
|
|
|
draw_junction_index = VALUE_TYPE.atlas;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-11-27 11:40:28 +01:00
|
|
|
if(connect_type == JUNCTION_CONNECT.output) {
|
|
|
|
if(self.index == 0) {
|
|
|
|
node.preview_value = getValue();
|
2024-05-08 06:44:41 +02:00
|
|
|
node.preview_array = $"[{array_shape(node.preview_value)}]";
|
2023-11-27 11:40:28 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2023-10-06 11:51:11 +02:00
|
|
|
|
2024-05-08 06:44:41 +02:00
|
|
|
if(is_instanceof(node, Node) && self.index >= 0)
|
2023-10-24 11:23:20 +02:00
|
|
|
node.setInputData(self.index, animator.getValue(time));
|
2023-10-06 11:51:11 +02:00
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
if(tags == VALUE_TAG.updateInTrigger || tags == VALUE_TAG.updateOutTrigger) return true;
|
2023-10-06 11:51:11 +02:00
|
|
|
|
2023-10-08 08:02:38 +02:00
|
|
|
if(_update) {
|
2023-10-31 13:33:36 +01:00
|
|
|
if(!IS_PLAYING) node.triggerRender();
|
2023-10-08 08:02:38 +02:00
|
|
|
node.valueUpdate(self.index);
|
|
|
|
node.clearCacheForward();
|
|
|
|
}
|
2023-10-31 13:33:36 +01:00
|
|
|
|
2023-11-22 10:21:50 +01:00
|
|
|
if(fullUpdate) RENDER_ALL
|
2023-10-06 11:51:11 +02:00
|
|
|
|
|
|
|
if(!LOADING) PROJECT.modified = true;
|
|
|
|
|
|
|
|
cache_value[0] = false;
|
2022-08-30 07:36:37 +02:00
|
|
|
onValidate();
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
return true;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-06-12 04:46:02 +02:00
|
|
|
static getString = function() { #region
|
|
|
|
var val = showValue();
|
|
|
|
|
|
|
|
if(type == VALUE_TYPE.text) return val;
|
|
|
|
return json_beautify(val);
|
|
|
|
} #endregion
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static setString = function(str) { #region
|
|
|
|
if(connect_type == JUNCTION_CONNECT.output) return;
|
2024-06-12 04:46:02 +02:00
|
|
|
if(type == VALUE_TYPE.text) { setValue(str); return; }
|
2024-05-28 04:57:00 +02:00
|
|
|
|
2024-06-12 04:46:02 +02:00
|
|
|
var _dat = json_try_parse(str);
|
|
|
|
|
|
|
|
if(typeArray(display_type) && !is_array(_dat))
|
|
|
|
_dat = [ _dat ];
|
|
|
|
|
|
|
|
setValue(_dat);
|
2024-05-28 04:57:00 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
/////=========== CONNECT ===========
|
|
|
|
|
|
|
|
static rejectConnect = function() { #region
|
|
|
|
auto_connect = false;
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static isConnectable = function(_valueFrom, checkRecur = true, log = false) { #region
|
2023-01-09 03:14:20 +01:00
|
|
|
if(_valueFrom == -1 || _valueFrom == undefined || _valueFrom == noone) {
|
2023-12-19 14:30:34 +01:00
|
|
|
if(log) noti_warning($"LOAD: Cannot set node connection from {_valueFrom} to {name} of node {node.name}.",, node);
|
|
|
|
return -1;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2022-01-25 10:58:11 +01:00
|
|
|
if(_valueFrom == value_from) {
|
2023-12-19 14:30:34 +01:00
|
|
|
if(log) noti_warning("whaT");
|
2024-06-20 10:56:43 +02:00
|
|
|
return -2;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(_valueFrom == self) {
|
2023-12-19 14:30:34 +01:00
|
|
|
if(log) noti_warning("setFrom: Self connection is not allowed.",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -3;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-03-05 07:16:44 +01:00
|
|
|
if(!typeCompatible(_valueFrom.type, type)) {
|
2024-05-10 05:14:55 +02:00
|
|
|
noti_warning($"Connection error: Incompatible type {_valueFrom.type} to {type}",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -4;
|
2023-02-19 02:13:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(typeIncompatible(_valueFrom, self)) {
|
2024-05-10 05:14:55 +02:00
|
|
|
noti_warning("Connection error: Incompatible type",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -5;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(connect_type == _valueFrom.connect_type) {
|
2023-12-19 14:30:34 +01:00
|
|
|
if(log) noti_warning("setFrom: Connect type mismatch",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -6;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(checkRecur && _valueFrom.searchNodeBackward(node)) {
|
2023-12-19 14:30:34 +01:00
|
|
|
if(log) noti_warning("setFrom: Cyclic connection not allowed.",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -7;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-02-14 02:51:14 +01:00
|
|
|
|
|
|
|
if(!accept_array && isArray(_valueFrom.getValue())) {
|
2024-05-10 05:14:55 +02:00
|
|
|
noti_warning($"Connection error: {name} does not support array input.",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -8;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-01-25 06:49:00 +01:00
|
|
|
|
|
|
|
if(!accept_array && _valueFrom.type == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) {
|
2023-12-19 14:30:34 +01:00
|
|
|
if(log) noti_warning("setFrom: Array mismatch",, node);
|
2024-06-20 10:56:43 +02:00
|
|
|
return -9;
|
2024-05-28 04:57:00 +02:00
|
|
|
}
|
2023-12-03 05:02:04 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
return 1;
|
2023-10-27 13:55:31 +02:00
|
|
|
} #endregion
|
|
|
|
|
2024-05-23 14:40:30 +02:00
|
|
|
static triggerSetFrom = function() { node.valueUpdate(index); }
|
|
|
|
|
2024-05-23 10:59:39 +02:00
|
|
|
static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region ////Set from
|
2023-09-16 20:26:35 +02:00
|
|
|
|
2024-05-23 10:59:39 +02:00
|
|
|
if(is_dummy) {
|
|
|
|
var _targ = dummy_get();
|
|
|
|
dummy_target = _targ;
|
|
|
|
UNDO_HOLDING = true;
|
|
|
|
var _res = _targ.setFrom(_valueFrom, _update, checkRecur, log);
|
|
|
|
UNDO_HOLDING = false;
|
|
|
|
|
|
|
|
recordAction(ACTION_TYPE.junction_connect, self, [ _targ, _valueFrom ]);
|
|
|
|
return _res;
|
|
|
|
}
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
if(_valueFrom == noone)
|
|
|
|
return removeFrom();
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-12-19 14:30:34 +01:00
|
|
|
var conn = isConnectable(_valueFrom, checkRecur, log);
|
|
|
|
if(conn < 0) return conn;
|
2023-01-25 06:49:00 +01:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
if(setFrom_condition != -1 && !setFrom_condition(_valueFrom))
|
2023-07-25 20:12:40 +02:00
|
|
|
return -2;
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-01-25 06:49:00 +01:00
|
|
|
if(value_from != noone)
|
2023-12-19 14:30:34 +01:00
|
|
|
array_remove(value_from.value_to, self);
|
2022-01-25 10:58:11 +01:00
|
|
|
|
2022-09-23 13:28:42 +02:00
|
|
|
var _o = animator.getValue();
|
2022-01-13 05:24:03 +01:00
|
|
|
recordAction(ACTION_TYPE.junction_connect, self, value_from);
|
|
|
|
value_from = _valueFrom;
|
2023-12-19 14:30:34 +01:00
|
|
|
array_push(_valueFrom.value_to, self);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
node.valueUpdate(index, _o);
|
2023-01-04 02:30:04 +01:00
|
|
|
if(_update && connect_type == JUNCTION_CONNECT.input) {
|
2023-11-02 14:37:13 +01:00
|
|
|
node.valueFromUpdate(index);
|
2022-12-12 09:08:03 +01:00
|
|
|
node.triggerRender();
|
2023-02-23 07:02:19 +01:00
|
|
|
node.clearCacheForward();
|
2023-03-29 15:02:03 +02:00
|
|
|
|
2023-03-31 06:59:08 +02:00
|
|
|
UPDATE |= RENDER_TYPE.partial;
|
2022-12-12 09:08:03 +01:00
|
|
|
}
|
2022-01-16 05:17:35 +01:00
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
cache_array[0] = false;
|
|
|
|
cache_value[0] = false;
|
|
|
|
|
2023-09-09 13:52:16 +02:00
|
|
|
if(!LOADING) {
|
|
|
|
draw_line_shift_x = 0;
|
|
|
|
draw_line_shift_y = 0;
|
|
|
|
PROJECT.modified = true;
|
|
|
|
}
|
2023-03-28 06:58:28 +02:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
RENDER_ALL_REORDER
|
2023-10-07 09:09:18 +02:00
|
|
|
|
|
|
|
if(onSetFrom != noone) onSetFrom(_valueFrom);
|
|
|
|
if(_valueFrom.onSetTo != noone) _valueFrom.onSetTo(self);
|
|
|
|
|
2022-01-16 05:17:35 +01:00
|
|
|
return true;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static removeFrom = function(_remove_list = true) { #region
|
2023-02-14 02:51:14 +01:00
|
|
|
recordAction(ACTION_TYPE.junction_disconnect, self, value_from);
|
2022-01-26 06:57:34 +01:00
|
|
|
if(_remove_list && value_from != noone)
|
2023-12-19 14:30:34 +01:00
|
|
|
array_remove(value_from.value_to, self);
|
2022-01-13 05:24:03 +01:00
|
|
|
value_from = noone;
|
|
|
|
|
2023-01-04 02:30:04 +01:00
|
|
|
if(connect_type == JUNCTION_CONNECT.input)
|
2023-11-02 14:37:13 +01:00
|
|
|
node.valueFromUpdate(index);
|
2023-04-14 12:23:25 +02:00
|
|
|
node.clearCacheForward();
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-09-29 04:22:41 +02:00
|
|
|
PROJECT.modified = true;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
RENDER_ALL_REORDER
|
2023-02-14 02:51:14 +01:00
|
|
|
return false;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-12-19 14:30:34 +01:00
|
|
|
static removeFromLoop = function(_remove_list = true) { #region
|
|
|
|
if(value_from_loop != noone)
|
2024-04-08 07:13:46 +02:00
|
|
|
value_from_loop.destroy();
|
2023-12-19 14:30:34 +01:00
|
|
|
|
|
|
|
PROJECT.modified = true;
|
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static checkConnection = function(_remove_list = true) { #region
|
2024-05-07 06:53:51 +02:00
|
|
|
if(value_from == noone) return;
|
2022-01-26 06:57:34 +01:00
|
|
|
if(value_from.node.active) return;
|
|
|
|
|
|
|
|
removeFrom(_remove_list);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static searchNodeBackward = function(_node) { #region
|
2022-01-13 05:24:03 +01:00
|
|
|
if(node == _node) return true;
|
|
|
|
for(var i = 0; i < ds_list_size(node.inputs); i++) {
|
|
|
|
var _in = node.inputs[| i].value_from;
|
|
|
|
if(_in && _in.searchNodeBackward(_node))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static hasJunctionFrom = function() { INLINE return value_from != noone || value_from_loop != noone; }
|
|
|
|
|
|
|
|
static getJunctionTo = function() { #region
|
|
|
|
var _junc_to = [];
|
|
|
|
|
|
|
|
for(var i = 0; i < array_length(value_to); i++) {
|
|
|
|
var _to = value_to[i];
|
|
|
|
if(!_to.node.active || _to.value_from == noone) continue;
|
|
|
|
if(_to.value_from != self) continue;
|
|
|
|
|
|
|
|
array_push(_junc_to, _to);
|
|
|
|
}
|
|
|
|
|
|
|
|
return _junc_to;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
/////============= DRAW =============
|
|
|
|
|
|
|
|
static setColor = function(col) { #region
|
|
|
|
color = col;
|
|
|
|
updateColor();
|
|
|
|
|
|
|
|
if(value_from != noone)
|
|
|
|
value_from.setColor(col);
|
|
|
|
|
|
|
|
return self;
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static updateColor = function(val = undefined) { #region
|
|
|
|
INLINE
|
|
|
|
|
|
|
|
if(color == -1) {
|
|
|
|
draw_bg = isArray(val)? value_color_bg_array(draw_junction_index) : value_color_bg(draw_junction_index);
|
|
|
|
draw_fg = value_color(draw_junction_index);
|
|
|
|
} else {
|
|
|
|
draw_bg = isArray(val)? merge_color(color, colorMultiply(color, CDEF.main_dkgrey), 0.5) : value_color_bg(draw_junction_index);
|
|
|
|
draw_fg = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
color_display = type == VALUE_TYPE.action? #8fde5d : draw_fg;
|
2022-12-27 04:00:50 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-12-27 04:00:50 +01:00
|
|
|
|
2024-03-14 14:35:19 +01:00
|
|
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
2023-04-05 20:13:27 +02:00
|
|
|
if(type != VALUE_TYPE.integer && type != VALUE_TYPE.float) return -1;
|
2023-08-02 19:11:57 +02:00
|
|
|
if(value_from != noone) return -1;
|
|
|
|
if(expUse) return -1;
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2024-03-14 14:35:19 +01:00
|
|
|
var arc = 9;
|
|
|
|
|
2023-04-05 20:13:27 +02:00
|
|
|
switch(display_type) {
|
|
|
|
case VALUE_DISPLAY._default :
|
2024-03-14 14:35:19 +01:00
|
|
|
var _angle = argument_count > arc + 0? argument[arc + 0] : 0;
|
|
|
|
var _scale = argument_count > arc + 1? argument[arc + 1] : 1;
|
2024-07-02 12:18:32 +02:00
|
|
|
var _spr = argument_count > arc + 2? argument[arc + 2] : 0;
|
2024-05-07 06:53:51 +02:00
|
|
|
return preview_overlay_scalar(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _angle, _scale, _spr);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-04-05 20:13:27 +02:00
|
|
|
case VALUE_DISPLAY.rotation :
|
2024-03-14 14:35:19 +01:00
|
|
|
var _rad = argument_count > arc + 0? argument[ arc + 0] : 64;
|
2024-05-07 06:53:51 +02:00
|
|
|
return preview_overlay_rotation(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad);
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-04-05 20:13:27 +02:00
|
|
|
case VALUE_DISPLAY.vector :
|
2024-06-26 12:52:24 +02:00
|
|
|
var _typ = argument_count > arc + 0? argument[arc + 0] : 0;
|
2024-03-14 14:35:19 +01:00
|
|
|
var _sca = argument_count > arc + 1? argument[arc + 1] : 1;
|
2024-06-26 12:52:24 +02:00
|
|
|
return preview_overlay_vector(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _typ);
|
2024-01-22 10:26:25 +01:00
|
|
|
|
|
|
|
case VALUE_DISPLAY.gradient_range :
|
2024-03-14 14:35:19 +01:00
|
|
|
var _dim = argument[arc];
|
2024-01-22 10:26:25 +01:00
|
|
|
|
|
|
|
if(mappedJunc.attributes.mapped)
|
2024-05-07 06:53:51 +02:00
|
|
|
return preview_overlay_gradient_range(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _dim);
|
2024-01-22 10:26:25 +01:00
|
|
|
break;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-04-05 20:13:27 +02:00
|
|
|
case VALUE_DISPLAY.area :
|
2024-03-14 14:35:19 +01:00
|
|
|
var _flag = argument_count > arc + 0? argument[arc + 0] : 0b0011;
|
2024-05-07 06:53:51 +02:00
|
|
|
return preview_overlay_area(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _flag, struct_try_get(display_data, "onSurfaceSize"));
|
2022-09-23 13:28:42 +02:00
|
|
|
|
2023-04-05 20:13:27 +02:00
|
|
|
case VALUE_DISPLAY.puppet_control :
|
2024-05-07 06:53:51 +02:00
|
|
|
return preview_overlay_puppet(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-04-05 20:13:27 +02:00
|
|
|
|
2023-01-17 08:11:55 +01:00
|
|
|
return -1;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
static drawJunction_fast = function(_s, _mx, _my) { #region
|
|
|
|
INLINE
|
|
|
|
|
2024-05-23 10:59:39 +02:00
|
|
|
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node);
|
|
|
|
var _hov = hov && abs(_mx - x) + abs(_my - y) < _s;
|
|
|
|
var _aa = 0.75 + (!is_dummy * 0.25);
|
2024-03-31 11:10:14 +02:00
|
|
|
|
|
|
|
draw_set_color(draw_fg);
|
2024-05-23 10:59:39 +02:00
|
|
|
draw_set_alpha(_aa);
|
2024-03-31 11:10:14 +02:00
|
|
|
draw_circle(x, y, _s, false);
|
2024-05-23 10:59:39 +02:00
|
|
|
draw_set_alpha(1);
|
|
|
|
|
|
|
|
return _hov;
|
2024-03-31 11:10:14 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static drawJunction = function(_s, _mx, _my) { #region
|
|
|
|
_s /= 2;
|
|
|
|
|
2024-06-28 08:40:21 +02:00
|
|
|
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node);
|
|
|
|
var _d = 24 * _s;
|
2024-05-22 04:46:29 +02:00
|
|
|
var is_hover = hov && point_in_rectangle(_mx, _my, x - _d, y - _d, x + _d - 1, y + _d - 1);
|
2024-04-03 09:40:37 +02:00
|
|
|
hover_in_graph = is_hover;
|
2023-11-03 14:43:28 +01:00
|
|
|
|
2024-05-23 10:59:39 +02:00
|
|
|
if(is_dummy) {
|
|
|
|
__draw_sprite_ext(THEME.node_junction_add, is_hover, x, y, _s, _s, 0, c_white, 0.5 + 0.5 * is_hover);
|
|
|
|
|
|
|
|
} else if(type == VALUE_TYPE.action) {
|
2023-11-27 11:40:28 +01:00
|
|
|
var _cbg = c_white;
|
|
|
|
|
|
|
|
if(draw_blend != -1)
|
|
|
|
_cbg = merge_color(draw_blend_color, _cbg, draw_blend);
|
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
__draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, _s, _s, 0, _cbg, 1);
|
2023-10-15 15:04:42 +02:00
|
|
|
} else {
|
2023-11-27 11:40:28 +01:00
|
|
|
var _cbg = draw_bg;
|
|
|
|
var _cfg = draw_fg;
|
|
|
|
|
|
|
|
if(draw_blend != -1) {
|
|
|
|
_cbg = merge_color(draw_blend_color, _cbg, draw_blend);
|
|
|
|
_cfg = merge_color(draw_blend_color, _cfg, draw_blend);
|
|
|
|
}
|
2024-06-28 08:40:21 +02:00
|
|
|
|
|
|
|
var _bgS, _fgS;
|
|
|
|
|
|
|
|
if(_s > .5) {
|
|
|
|
_bgS = THEME.node_junctions_bg_x2;
|
|
|
|
_fgS = is_hover? THEME.node_junctions_outline_hover_x2 : THEME.node_junctions_outline_x2;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
_bgS = THEME.node_junctions_bg;
|
|
|
|
_fgS = is_hover? THEME.node_junctions_outline_hover : THEME.node_junctions_outline;
|
|
|
|
_s *= 2;
|
|
|
|
}
|
|
|
|
|
2024-03-31 11:10:14 +02:00
|
|
|
__draw_sprite_ext(_bgS, draw_junction_index, x, y, _s, _s, 0, _cbg, 1);
|
|
|
|
__draw_sprite_ext(_fgS, draw_junction_index, x, y, _s, _s, 0, _cfg, 1);
|
2023-10-15 15:04:42 +02:00
|
|
|
}
|
2023-07-12 16:28:32 +02:00
|
|
|
|
2022-09-27 06:37:28 +02:00
|
|
|
return is_hover;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-09-27 06:37:28 +02:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static drawNameBG = function(_s) { #region
|
2022-09-27 06:37:28 +02:00
|
|
|
draw_set_text(f_p1, fa_left, fa_center);
|
2022-12-10 05:06:01 +01:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
var tw = string_width(name) + 32;
|
2022-09-27 06:37:28 +02:00
|
|
|
var th = string_height(name) + 16;
|
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
if(type == VALUE_TYPE.action) {
|
|
|
|
var tx = x;
|
|
|
|
draw_sprite_stretched_ext(THEME.node_junction_name_bg, 0, tx - tw / 2, y - th, tw, th, c_white, 0.5);
|
|
|
|
} else if(connect_type == JUNCTION_CONNECT.input) {
|
2022-09-27 06:37:28 +02:00
|
|
|
var tx = x - 12 * _s;
|
2023-03-28 06:58:28 +02:00
|
|
|
draw_sprite_stretched_ext(THEME.node_junction_name_bg, 0, tx - tw + 16, y - th / 2, tw, th, c_white, 0.5);
|
2022-09-27 06:37:28 +02:00
|
|
|
} else {
|
|
|
|
var tx = x + 12 * _s;
|
2023-03-28 06:58:28 +02:00
|
|
|
draw_sprite_stretched_ext(THEME.node_junction_name_bg, 0, tx - 16, y - th / 2, tw, th, c_white, 0.5);
|
2022-01-26 06:57:34 +01:00
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static drawName = function(_s, _mx, _my) { #region
|
2024-04-03 09:40:37 +02:00
|
|
|
|
2024-05-02 12:02:17 +02:00
|
|
|
var _draw_cc = COLORS._main_text;
|
2024-05-23 10:59:39 +02:00
|
|
|
var _draw_aa = 0.8 + hover_in_graph * 0.2;
|
2022-09-27 06:37:28 +02:00
|
|
|
draw_set_text(f_p1, fa_left, fa_center, _draw_cc);
|
2024-05-02 12:02:17 +02:00
|
|
|
draw_set_alpha(_draw_aa);
|
2022-09-27 06:37:28 +02:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
if(type == VALUE_TYPE.action) {
|
|
|
|
var tx = x;
|
|
|
|
draw_set_text(f_p1, fa_center, fa_center, _draw_cc);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(tx, y - (line_get_height() + 16) / 2, name);
|
2024-04-03 09:40:37 +02:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
} else if(connect_type == JUNCTION_CONNECT.input) {
|
2022-09-27 06:37:28 +02:00
|
|
|
var tx = x - 12 * _s;
|
|
|
|
draw_set_halign(fa_right);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(tx, y, name);
|
2024-04-03 09:40:37 +02:00
|
|
|
|
2022-09-27 06:37:28 +02:00
|
|
|
} else {
|
|
|
|
var tx = x + 12 * _s;
|
|
|
|
draw_set_halign(fa_left);
|
2023-12-11 05:45:12 +01:00
|
|
|
draw_text_int(tx, y, name);
|
2024-04-03 09:40:37 +02:00
|
|
|
|
2022-09-27 06:37:28 +02:00
|
|
|
}
|
2024-05-02 12:02:17 +02:00
|
|
|
|
|
|
|
draw_set_alpha(1);
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-26 06:57:34 +01:00
|
|
|
|
2024-06-20 10:56:43 +02:00
|
|
|
static drawConnectionsRaw = function(params = {}) { return drawJuncConnection(value_from, self, params); }
|
|
|
|
static drawConnections = function(params = {}) {
|
|
|
|
if(value_from == noone || !value_from.node.active || !isVisible())
|
|
|
|
return noone;
|
2023-12-19 14:30:34 +01:00
|
|
|
return drawJuncConnection(value_from, self, params);
|
2024-06-20 10:56:43 +02:00
|
|
|
}
|
2023-07-25 20:12:40 +02:00
|
|
|
|
2023-10-24 11:23:20 +02:00
|
|
|
static drawConnectionMouse = function(params, _mx, _my, target) { #region
|
|
|
|
var ss = params.s;
|
2024-01-26 14:38:50 +01:00
|
|
|
var aa = params.aa; // 1
|
2023-10-24 11:23:20 +02:00
|
|
|
|
2023-08-13 09:00:58 +02:00
|
|
|
var drawCorner = type == VALUE_TYPE.action;
|
2023-08-13 09:51:36 +02:00
|
|
|
if(target != noone)
|
2023-08-13 09:00:58 +02:00
|
|
|
drawCorner |= target.type == VALUE_TYPE.action;
|
|
|
|
|
2023-10-31 05:30:42 +01:00
|
|
|
var corner = PREFERENCES.connection_line_corner * ss;
|
|
|
|
var th = max(1, PREFERENCES.connection_line_width * ss);
|
2023-08-13 09:00:58 +02:00
|
|
|
|
2023-10-24 11:23:20 +02:00
|
|
|
var sx = x;
|
|
|
|
var sy = y;
|
|
|
|
|
|
|
|
corner *= aa;
|
|
|
|
th *= aa;
|
|
|
|
ss *= aa;
|
|
|
|
sx *= aa;
|
|
|
|
sy *= aa;
|
|
|
|
_mx *= aa;
|
|
|
|
_my *= aa;
|
|
|
|
|
2023-10-15 15:04:42 +02:00
|
|
|
var col = color_display;
|
2023-08-13 09:00:58 +02:00
|
|
|
draw_set_color(col);
|
|
|
|
|
2023-10-16 13:54:31 +02:00
|
|
|
var _action = type == VALUE_TYPE.action;
|
|
|
|
var _output = connect_type == JUNCTION_CONNECT.output;
|
|
|
|
|
2023-10-31 05:30:42 +01:00
|
|
|
switch(PREFERENCES.curve_connection_line) {
|
2023-10-24 11:23:20 +02:00
|
|
|
case 0 : draw_line_width(sx, sy, _mx, _my, th); break;
|
2023-08-13 09:00:58 +02:00
|
|
|
case 1 :
|
|
|
|
if(drawCorner) {
|
2023-10-24 11:23:20 +02:00
|
|
|
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);
|
2023-08-13 09:00:58 +02:00
|
|
|
} else {
|
2023-10-24 11:23:20 +02:00
|
|
|
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);
|
2023-08-13 09:00:58 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2 :
|
|
|
|
if(drawCorner) {
|
2023-10-24 11:23:20 +02:00
|
|
|
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);
|
2023-08-13 09:00:58 +02:00
|
|
|
} else {
|
2023-10-24 11:23:20 +02:00
|
|
|
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);
|
2023-08-13 09:00:58 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3 :
|
|
|
|
if(drawCorner) {
|
2023-10-24 11:23:20 +02:00
|
|
|
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);
|
2023-08-13 09:00:58 +02:00
|
|
|
} else {
|
2023-10-24 11:23:20 +02:00
|
|
|
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);
|
2023-08-13 09:00:58 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-11-09 04:02:41 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static isVisible = function() { #region
|
2023-10-06 11:51:11 +02:00
|
|
|
if(!node.active) return false;
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
if(connect_type == JUNCTION_CONNECT.output)
|
2023-12-19 14:30:34 +01:00
|
|
|
return visible || !array_empty(value_to);
|
2023-10-06 11:51:11 +02:00
|
|
|
|
|
|
|
if(value_from) return true;
|
|
|
|
if(!visible) return false;
|
|
|
|
|
2024-03-14 14:35:19 +01:00
|
|
|
if(index == -1) return true;
|
|
|
|
|
2024-03-29 05:20:49 +01:00
|
|
|
return visible_in_list;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////========== EXPRESSION ==========
|
2023-01-09 03:14:20 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static setUseExpression = function(useExp) { #region
|
|
|
|
INLINE
|
|
|
|
if(expUse == useExp) return;
|
|
|
|
expUse = useExp;
|
|
|
|
node.triggerRender();
|
|
|
|
} #endregion
|
2023-10-18 14:58:55 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static setExpression = function(_expression) { #region
|
|
|
|
expUse = true;
|
|
|
|
expression = _expression;
|
|
|
|
expressionUpdate();
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-06-01 10:32:21 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static expressionUpdate = function() { #region
|
|
|
|
expTree = evaluateFunctionList(expression);
|
|
|
|
resetCache();
|
|
|
|
node.triggerRender();
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-03-26 07:13:36 +02:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////=========== SERIALIZE ===========
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static serialize = function(scale = false, preset = false) { #region
|
2023-06-13 14:42:06 +02:00
|
|
|
var _map = {};
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
_map.visible = visible;
|
2023-10-30 14:21:34 +01:00
|
|
|
_map.color = color;
|
2023-04-07 21:25:27 +02:00
|
|
|
|
|
|
|
if(connect_type == JUNCTION_CONNECT.output)
|
|
|
|
return _map;
|
|
|
|
|
2023-07-15 20:01:29 +02:00
|
|
|
_map.name = name;
|
2023-06-13 14:42:06 +02:00
|
|
|
_map.on_end = on_end;
|
2023-07-12 21:00:05 +02:00
|
|
|
_map.loop_range = loop_range;
|
2023-06-13 14:42:06 +02:00
|
|
|
_map.unit = unit.mode;
|
|
|
|
_map.sep_axis = sep_axis;
|
|
|
|
_map.shift_x = draw_line_shift_x;
|
|
|
|
_map.shift_y = draw_line_shift_y;
|
2023-11-24 10:41:53 +01:00
|
|
|
_map.is_modified= is_modified;
|
2023-09-28 13:15:29 +02:00
|
|
|
|
|
|
|
if(!preset && value_from) {
|
|
|
|
_map.from_node = value_from.node.node_id;
|
|
|
|
|
2023-10-06 11:51:11 +02:00
|
|
|
if(value_from.tags != 0) _map.from_index = value_from.tags;
|
|
|
|
else _map.from_index = value_from.index;
|
2023-09-28 13:15:29 +02:00
|
|
|
} else {
|
|
|
|
_map.from_node = -1;
|
|
|
|
_map.from_index = -1;
|
|
|
|
}
|
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
_map.global_use = expUse;
|
|
|
|
_map.global_key = expression;
|
|
|
|
_map.anim = is_anim;
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
_map.raw_value = animator.serialize(scale);
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
var _anims = [];
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(animators); i < n; i++ )
|
2023-06-13 14:42:06 +02:00
|
|
|
array_push(_anims, animators[i].serialize(scale));
|
2023-10-30 14:21:34 +01:00
|
|
|
_map.animators = _anims;
|
2023-10-02 08:57:44 +02:00
|
|
|
_map.display_data = display_data;
|
|
|
|
_map.attributes = attributes;
|
2023-10-30 14:21:34 +01:00
|
|
|
_map.name_custom = name_custom;
|
2023-09-28 15:10:41 +02:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
return _map;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-12-21 02:30:23 +01:00
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static applyDeserialize = function(_map, scale = false, preset = false) { #region
|
2022-12-22 03:09:55 +01:00
|
|
|
if(_map == undefined) return;
|
2023-06-17 18:59:20 +02:00
|
|
|
if(_map == noone) return;
|
|
|
|
if(!is_struct(_map)) return;
|
2023-01-01 02:06:02 +01:00
|
|
|
|
2023-06-17 18:59:20 +02:00
|
|
|
visible = struct_try_get(_map, "visible", visible);
|
2023-10-30 14:21:34 +01:00
|
|
|
color = struct_try_get(_map, "color", -1);
|
|
|
|
|
2024-05-11 03:26:44 +02:00
|
|
|
updateColor();
|
|
|
|
|
2023-04-07 21:25:27 +02:00
|
|
|
if(connect_type == JUNCTION_CONNECT.output)
|
|
|
|
return;
|
|
|
|
|
2023-10-18 14:58:55 +02:00
|
|
|
//print($" > Applying deserialize to junction {name} 0");
|
2023-06-13 14:42:06 +02:00
|
|
|
on_end = struct_try_get(_map, "on_end");
|
2023-07-12 21:00:05 +02:00
|
|
|
loop_range = struct_try_get(_map, "loop_range", -1);
|
2023-06-13 14:42:06 +02:00
|
|
|
unit.mode = struct_try_get(_map, "unit");
|
|
|
|
expUse = struct_try_get(_map, "global_use");
|
|
|
|
expression = struct_try_get(_map, "global_key");
|
2023-07-12 21:00:05 +02:00
|
|
|
expTree = evaluateFunctionList(expression);
|
2023-04-15 14:48:29 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
sep_axis = struct_try_get(_map, "sep_axis");
|
2023-10-18 14:58:55 +02:00
|
|
|
setAnim(struct_try_get(_map, "anim"));
|
2023-03-21 03:01:53 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
draw_line_shift_x = struct_try_get(_map, "shift_x");
|
|
|
|
draw_line_shift_y = struct_try_get(_map, "shift_y");
|
2023-11-24 10:41:53 +01:00
|
|
|
is_modified = struct_try_get(_map, "is_modified", true);
|
2022-12-27 04:00:50 +01:00
|
|
|
|
2023-12-22 14:46:54 +01:00
|
|
|
struct_append(attributes, struct_try_get(_map, "attributes"))
|
2023-09-28 15:10:41 +02:00
|
|
|
name_custom = struct_try_get(_map, "name_custom", false);
|
2023-10-15 15:04:42 +02:00
|
|
|
if(name_custom) name = struct_try_get(_map, "name", name);
|
2023-09-28 15:10:41 +02:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
animator.deserialize(struct_try_get(_map, "raw_value"), scale);
|
2022-12-27 13:30:02 +01:00
|
|
|
|
2023-06-13 14:42:06 +02:00
|
|
|
if(struct_has(_map, "animators")) {
|
2023-06-17 14:30:49 +02:00
|
|
|
var anims = _map.animators;
|
|
|
|
var amo = min(array_length(anims), array_length(animators));
|
|
|
|
for( var i = 0; i < amo; i++ )
|
2023-06-13 14:42:06 +02:00
|
|
|
animators[i].deserialize(anims[i], scale);
|
2023-03-21 03:01:53 +01:00
|
|
|
}
|
|
|
|
|
2023-02-14 02:51:14 +01:00
|
|
|
if(!preset) {
|
2023-06-13 14:42:06 +02:00
|
|
|
con_node = struct_try_get(_map, "from_node", -1);
|
|
|
|
con_index = struct_try_get(_map, "from_index", -1);
|
2023-02-14 02:51:14 +01:00
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-10-02 08:57:44 +02:00
|
|
|
if(struct_has(_map, "display_data")) {
|
|
|
|
for( var i = 0, n = array_length(DISPLAY_DATA_KEYS); i < n; i++ )
|
|
|
|
struct_try_override(display_data, _map.display_data, DISPLAY_DATA_KEYS[i]);
|
|
|
|
}
|
2022-12-27 13:30:02 +01:00
|
|
|
|
2023-10-07 16:23:40 +02:00
|
|
|
if(connect_type == JUNCTION_CONNECT.input && index >= 0) {
|
2023-10-14 08:00:35 +02:00
|
|
|
var _value = animator.getValue(0);
|
|
|
|
node.inputs_data[index] = _value;
|
|
|
|
node.input_value_map[$ internalName] = _value;
|
2023-10-07 16:23:40 +02:00
|
|
|
}
|
|
|
|
|
2023-12-22 14:46:54 +01:00
|
|
|
attributeApply();
|
2022-08-30 07:36:37 +02:00
|
|
|
onValidate();
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-12-22 14:46:54 +01:00
|
|
|
static attributeApply = function() { #region
|
2024-03-19 09:49:29 +01:00
|
|
|
if(struct_has(attributes, "mapped") && attributes.mapped)
|
|
|
|
mappableStep();
|
2023-12-22 14:46:54 +01:00
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static connect = function(log = false) { #region
|
2024-04-11 05:51:13 +02:00
|
|
|
//print($"{node} | {con_node} : {con_index}");
|
|
|
|
|
2022-09-21 06:09:40 +02:00
|
|
|
if(con_node == -1 || con_index == -1)
|
|
|
|
return true;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2022-09-21 06:09:40 +02:00
|
|
|
var _node = con_node;
|
2022-12-21 02:30:23 +01:00
|
|
|
if(APPENDING) {
|
2022-09-21 06:09:40 +02:00
|
|
|
_node = GetAppendID(con_node);
|
2023-02-28 09:43:01 +01:00
|
|
|
if(_node == noone)
|
2022-12-21 02:30:23 +01:00
|
|
|
return true;
|
|
|
|
}
|
2023-08-08 18:45:00 +02:00
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
if(!ds_map_exists(PROJECT.nodeMap, _node)) {
|
2023-06-13 14:42:06 +02:00
|
|
|
var txt = $"Node connect error : Node ID {_node} not found.";
|
|
|
|
log_warning("LOAD", $"[Connect] {txt}", node);
|
2022-12-21 02:30:23 +01:00
|
|
|
return false;
|
|
|
|
}
|
2022-01-19 03:05:13 +01:00
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
var _nd = PROJECT.nodeMap[? _node];
|
2022-12-21 02:30:23 +01:00
|
|
|
var _ol = ds_list_size(_nd.outputs);
|
2023-02-14 02:51:14 +01:00
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node);
|
|
|
|
|
2024-05-08 06:44:41 +02:00
|
|
|
if(con_index == VALUE_TAG.updateInTrigger) return setFrom(_nd.updatedInTrigger);
|
|
|
|
else if(con_index == VALUE_TAG.updateOutTrigger) return setFrom(_nd.updatedOutTrigger);
|
2023-10-06 11:51:11 +02:00
|
|
|
else if(con_index < _ol) {
|
2023-07-25 20:12:40 +02:00
|
|
|
var _set = setFrom(_nd.outputs[| con_index], false, true);
|
|
|
|
if(_set) return true;
|
|
|
|
|
|
|
|
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Not connectable.", node);
|
|
|
|
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Condition not met.", node);
|
2022-12-21 02:30:23 +01:00
|
|
|
|
|
|
|
return false;
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist.", node);
|
2022-01-19 03:05:13 +01:00
|
|
|
return false;
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2022-01-19 06:11:17 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////============= MISC =============
|
|
|
|
|
|
|
|
static extractNode = function(_type = extract_node) { #region
|
|
|
|
if(_type == "") return noone;
|
|
|
|
|
|
|
|
var ext = nodeBuild(_type, node.x, node.y);
|
|
|
|
ext.x -= ext.w + 32;
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(ext.outputs); i++ ) {
|
|
|
|
if(setFrom(ext.outputs[| i])) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
var animFrom = animator.values;
|
|
|
|
var len = 2;
|
|
|
|
|
|
|
|
switch(_type) {
|
|
|
|
case "Node_Vector4": len++;
|
|
|
|
case "Node_Vector3": len++;
|
|
|
|
case "Node_Vector2":
|
|
|
|
for( var j = 0; j < len; j++ ) {
|
|
|
|
var animTo = ext.inputs[| j].animator;
|
|
|
|
var animLs = animTo.values;
|
|
|
|
|
|
|
|
ext.inputs[| j].setAnim(is_anim);
|
|
|
|
ds_list_clear(animLs);
|
|
|
|
}
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(animFrom); i++ ) {
|
|
|
|
for( var j = 0; j < len; j++ ) {
|
|
|
|
var animTo = ext.inputs[| j].animator;
|
|
|
|
var animLs = animTo.values;
|
|
|
|
var a = animFrom[| i].clone(animTo);
|
|
|
|
|
|
|
|
a.value = a.value[j];
|
|
|
|
ds_list_add(animLs, a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "Node_Path":
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
var animTo = ext.inputs[| 0].animator;
|
|
|
|
var animLs = animTo.values;
|
|
|
|
|
|
|
|
ext.inputs[| 0].setAnim(is_anim);
|
|
|
|
ds_list_clear(animLs);
|
|
|
|
|
|
|
|
for( var i = 0; i < ds_list_size(animFrom); i++ )
|
|
|
|
ds_list_add(animLs, animFrom[| i].clone(animTo));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ext.doUpdate();
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static dragValue = function() { #region
|
|
|
|
if(drop_key == "None") return;
|
|
|
|
|
|
|
|
DRAGGING = {
|
|
|
|
type: drop_key,
|
|
|
|
data: showValue(),
|
|
|
|
}
|
|
|
|
|
|
|
|
if(type == VALUE_TYPE.path) {
|
|
|
|
DRAGGING.data = new FileObject(node.name, DRAGGING.data);
|
|
|
|
DRAGGING.data.getSpr();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(connect_type == JUNCTION_CONNECT.input)
|
|
|
|
DRAGGING.from = self;
|
|
|
|
} #endregion
|
|
|
|
|
2023-08-19 12:42:50 +02:00
|
|
|
static destroy = function() { #region
|
2023-02-23 07:02:19 +01:00
|
|
|
if(error_notification != noone) {
|
|
|
|
noti_remove(error_notification);
|
|
|
|
error_notification = noone;
|
|
|
|
}
|
2023-08-19 12:42:50 +02:00
|
|
|
} #endregion
|
2023-02-23 07:02:19 +01:00
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
static cleanUp = function() {}
|
2024-01-26 14:38:50 +01:00
|
|
|
|
|
|
|
static toString = function() { return (connect_type == JUNCTION_CONNECT.input? "Input" : "Output") + $" junction {index} of [{name}]: {node}"; }
|
2023-12-19 14:30:34 +01:00
|
|
|
}
|
|
|
|
|
2024-05-28 04:57:00 +02:00
|
|
|
/////========== FUNCTIONS ==========
|
|
|
|
|
2024-01-26 14:38:50 +01:00
|
|
|
function drawJuncConnection(from, to, params) { #region
|
2023-12-19 14:30:34 +01:00
|
|
|
#region parameters
|
2024-01-26 14:38:50 +01:00
|
|
|
var log = params.log;
|
|
|
|
var high = params.highlight;
|
|
|
|
var bg = params.bg;
|
|
|
|
var aa = params.aa;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
|
|
|
var _x = params.x;
|
|
|
|
var _y = params.y;
|
|
|
|
var _s = params.s;
|
|
|
|
var mx = params.mx;
|
|
|
|
var my = params.my;
|
|
|
|
var _active = params.active;
|
|
|
|
var cur_layer = params.cur_layer;
|
|
|
|
var max_layer = params.max_layer;
|
|
|
|
|
|
|
|
var hovering = noone;
|
|
|
|
|
|
|
|
var jx = to.x;
|
|
|
|
var jy = to.y;
|
|
|
|
|
|
|
|
var frx = from.x;
|
|
|
|
var fry = from.y;
|
|
|
|
|
|
|
|
var fromIndex = from.drawLineIndex;
|
|
|
|
var toIndex = to.drawLineIndex;
|
|
|
|
|
2024-01-26 14:38:50 +01:00
|
|
|
if(params.minx != 0 && params.maxx != 0) {
|
2023-12-19 14:30:34 +01:00
|
|
|
var minx = params.minx;
|
|
|
|
var miny = params.miny;
|
|
|
|
var maxx = params.maxx;
|
|
|
|
var maxy = params.maxy;
|
|
|
|
|
|
|
|
if(jx < minx && frx < minx) return noone;
|
|
|
|
if(jx > maxx && frx > maxx) return noone;
|
|
|
|
|
|
|
|
if(jy < miny && fry < miny) return noone;
|
|
|
|
if(jy > maxy && fry > maxy) return noone;
|
|
|
|
}
|
|
|
|
|
2024-01-26 14:38:50 +01:00
|
|
|
var shx = to.draw_line_shift_x * _s;
|
|
|
|
var shy = to.draw_line_shift_y * _s;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
|
|
|
var cx = round((frx + jx) / 2 + shx);
|
|
|
|
var cy = round((fry + jy) / 2 + shy);
|
|
|
|
|
|
|
|
var hover = false;
|
2024-01-26 14:38:50 +01:00
|
|
|
var th = max(1, PREFERENCES.connection_line_width * _s);
|
|
|
|
to.draw_line_shift_hover = false;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
|
|
|
var downDirection = to.type == VALUE_TYPE.action || from.type == VALUE_TYPE.action;
|
2024-06-20 10:56:43 +02:00
|
|
|
// if(downDirection) print($"{to} : {from}");
|
2023-12-19 14:30:34 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region +++++ CHECK HOVER +++++
|
|
|
|
var hovDist = max(th * 2, 6);
|
|
|
|
|
2023-12-20 14:02:49 +01:00
|
|
|
if(PANEL_GRAPH.pHOVER) {
|
2024-01-26 14:38:50 +01:00
|
|
|
if(from.node == to.node) {
|
2024-01-10 06:36:33 +01:00
|
|
|
hover = distance_line_feedback(mx, my, jx, jy, frx, fry, _s) < hovDist;
|
2023-12-20 14:02:49 +01:00
|
|
|
} else {
|
|
|
|
switch(PREFERENCES.curve_connection_line) {
|
|
|
|
case 0 :
|
|
|
|
hover = distance_to_line(mx, my, jx, jy, frx, fry) < hovDist;
|
|
|
|
break;
|
|
|
|
case 1 :
|
|
|
|
if(downDirection) hover = distance_to_curve_corner(mx, my, jx, jy, frx, fry, _s) < hovDist;
|
|
|
|
else hover = distance_to_curve(mx, my, jx, jy, frx, fry, cx, cy, _s) < hovDist;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
2023-12-20 14:02:49 +01:00
|
|
|
if(PANEL_GRAPH.value_focus == noone)
|
2024-01-26 14:38:50 +01:00
|
|
|
to.draw_line_shift_hover = hover;
|
2023-12-20 14:02:49 +01:00
|
|
|
break;
|
|
|
|
case 2 :
|
|
|
|
if(downDirection) hover = distance_to_elbow_corner(mx, my, frx, fry, jx, jy) < hovDist;
|
|
|
|
else hover = distance_to_elbow(mx, my, frx, fry, jx, jy, cx, cy, _s, fromIndex, toIndex) < hovDist;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
2023-12-20 14:02:49 +01:00
|
|
|
if(PANEL_GRAPH.value_focus == noone)
|
2024-01-26 14:38:50 +01:00
|
|
|
to.draw_line_shift_hover = hover;
|
2023-12-20 14:02:49 +01:00
|
|
|
break;
|
|
|
|
case 3 :
|
|
|
|
if(downDirection) hover = distance_to_elbow_diag_corner(mx, my, frx, fry, jx, jy) < hovDist;
|
|
|
|
else hover = distance_to_elbow_diag(mx, my, frx, fry, jx, jy, cx, cy, _s, fromIndex, toIndex) < hovDist;
|
2023-12-19 14:30:34 +01:00
|
|
|
|
2023-12-20 14:02:49 +01:00
|
|
|
if(PANEL_GRAPH.value_focus == noone)
|
2024-01-26 14:38:50 +01:00
|
|
|
to.draw_line_shift_hover = hover;
|
2023-12-20 14:02:49 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-19 14:30:34 +01:00
|
|
|
|
|
|
|
if(_active && hover)
|
|
|
|
hovering = self;
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region draw parameters
|
|
|
|
var thicken = false;
|
|
|
|
thicken |= PANEL_GRAPH.nodes_junction_d == self;
|
|
|
|
thicken |= _active && PANEL_GRAPH.junction_hovering == self && PANEL_GRAPH.value_focus == noone;
|
|
|
|
thicken |= instance_exists(o_dialog_add_node) && o_dialog_add_node.junction_hovering == self;
|
|
|
|
|
|
|
|
th *= thicken? 2 : 1;
|
|
|
|
|
|
|
|
var corner = PREFERENCES.connection_line_corner * _s;
|
|
|
|
|
|
|
|
var ty = LINE_STYLE.solid;
|
2024-03-21 13:57:44 +01:00
|
|
|
if(to.type == VALUE_TYPE.node || struct_try_get(params, "dashed"))
|
2023-12-19 14:30:34 +01:00
|
|
|
ty = LINE_STYLE.dashed;
|
|
|
|
|
|
|
|
var c0, c1;
|
|
|
|
var _selc = to.node.branch_drawing && from.node.branch_drawing;
|
|
|
|
|
|
|
|
if(high) {
|
|
|
|
var _fade = PREFERENCES.connection_line_highlight_fade;
|
|
|
|
var _colr = _selc? 1 : _fade;
|
|
|
|
|
|
|
|
c0 = merge_color(bg, from.color_display, _colr);
|
|
|
|
c1 = merge_color(bg, to.color_display, _colr);
|
|
|
|
|
|
|
|
to.draw_blend_color = bg;
|
|
|
|
to.draw_blend = _colr;
|
|
|
|
from.draw_blend = max(from.draw_blend, _colr);
|
|
|
|
} else {
|
|
|
|
c0 = from.color_display;
|
|
|
|
c1 = to.color_display;
|
|
|
|
|
|
|
|
to.draw_blend_color = bg;
|
|
|
|
to.draw_blend = -1;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region +++++ DRAW LINE +++++
|
|
|
|
var ss = _s * aa;
|
|
|
|
jx *= aa;
|
|
|
|
jy *= aa;
|
|
|
|
frx *= aa;
|
|
|
|
fry *= aa;
|
|
|
|
th *= aa;
|
|
|
|
cx *= aa;
|
|
|
|
cy *= aa;
|
|
|
|
corner *= aa;
|
|
|
|
th = max(1, round(th));
|
|
|
|
|
|
|
|
draw_set_color(c0);
|
|
|
|
|
2024-01-26 14:38:50 +01:00
|
|
|
if(from.node == to.node) {
|
2023-12-20 14:02:49 +01:00
|
|
|
draw_line_feedback(jx, jy, frx, fry, th, c1, c0, ss);
|
|
|
|
} else {
|
|
|
|
switch(PREFERENCES.curve_connection_line) {
|
|
|
|
case 0 :
|
|
|
|
if(ty == LINE_STYLE.solid) draw_line_width_color(jx, jy, frx, fry, th, c1, c0);
|
|
|
|
else draw_line_dashed_color(jx, jy, frx, fry, th, c1, c0, 6 * ss);
|
|
|
|
break;
|
|
|
|
case 1 :
|
|
|
|
if(downDirection) draw_line_curve_corner(jx, jy, frx, fry, ss, th, c0, c1);
|
|
|
|
else draw_line_curve_color(jx, jy, frx, fry, cx, cy, ss, th, c0, c1, ty);
|
|
|
|
break;
|
|
|
|
case 2 :
|
|
|
|
if(downDirection) draw_line_elbow_corner(frx, fry, jx, jy, ss, th, c0, c1, corner, fromIndex, toIndex, ty);
|
|
|
|
else draw_line_elbow_color(frx, fry, jx, jy, cx, cy, ss, th, c0, c1, corner, fromIndex, toIndex, ty);
|
|
|
|
break;
|
|
|
|
case 3 :
|
|
|
|
if(downDirection) draw_line_elbow_diag_corner(frx, fry, jx, jy, ss, th, c0, c1, corner, fromIndex, toIndex, ty);
|
|
|
|
else draw_line_elbow_diag_color(frx, fry, jx, jy, cx, cy, ss, th, c0, c1, corner, fromIndex, toIndex, ty);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-12-19 14:30:34 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
return hovering;
|
|
|
|
} #endregion
|