Pixel-Composer/scripts/node_VCT/node_VCT.gml

54 lines
1.4 KiB
Text
Raw Normal View History

2023-07-15 20:01:29 +02:00
function Node_VCT(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "VCT";
icon = THEME.vct;
color = COLORS.node_blend_vct;
vct = new VCT(self);
2024-08-18 09:13:41 +02:00
newInput(0, nodeValue_Int("Editor", self, 0))
.setDisplay(VALUE_DISPLAY.button, { name: "Editor", onClick: function() {
2023-07-15 20:01:29 +02:00
vct.createDialog();
} });
2023-07-15 20:01:29 +02:00
2024-09-04 03:57:11 +02:00
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
2023-07-15 20:01:29 +02:00
input_display_list = [ 0,
2023-07-17 19:58:33 +02:00
["Automations", false],
2023-07-15 20:01:29 +02:00
];
2023-08-05 14:00:33 +02:00
static createNewInput = function(key = "") {
2024-08-08 06:57:51 +02:00
var index = array_length(inputs);
2023-07-15 20:01:29 +02:00
var _s = floor((index - input_fix_len) / data_length);
var name = string_title(string_replace_all(key, "_", " "));
var _var = vct[$ key];
2024-08-20 10:15:53 +02:00
newInput(index, nodeValue(name, self, CONNECT_TYPE.input, _var.type, 0))
2023-07-15 20:01:29 +02:00
.setDisplay(_var.disp, _var.disp_data);
2024-11-23 12:08:44 +01:00
inputs[index].attributes.key = key;
2023-07-15 20:01:29 +02:00
array_append(input_display_list, [ index ]);
}
2023-08-17 16:56:54 +02:00
static processData = function(_outSurf, _data, _output_index, _array_index) {
2023-07-15 20:01:29 +02:00
for( var i = 1; i < array_length(_data); i++ )
2024-11-23 12:08:44 +01:00
vct[$ inputs[i].attributes.key].setDirect(_data[i]);
2023-07-18 17:51:40 +02:00
var params = {
2023-10-09 16:07:33 +02:00
frame: CURRENT_FRAME
2023-07-18 17:51:40 +02:00
};
return vct.process(params);
2023-07-15 20:01:29 +02:00
}
static onDoubleClick = function(panel) {
vct.createDialog();
}
static doSerialize = function(_map) {
_map.vct = vct.serialize();
}
static postDeserialize = function() {
vct.deserialize(load_map.vct);
}
}