2023-10-09 16:07:33 +02:00
|
|
|
function VFX_PREVIEW_NODE() {
|
|
|
|
if(!is_instanceof(group, Node_VFX_Group)) return self;
|
|
|
|
return group.getPreviewingNode();
|
|
|
|
}
|
|
|
|
|
2023-02-28 09:43:01 +01:00
|
|
|
function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group) constructor {
|
2022-12-13 09:20:36 +01:00
|
|
|
name = "VFX";
|
2022-12-16 09:18:09 +01:00
|
|
|
color = COLORS.node_blend_vfx;
|
2023-02-14 05:32:32 +01:00
|
|
|
icon = THEME.vfx;
|
2023-10-10 07:12:42 +02:00
|
|
|
update_on_frame = true;
|
|
|
|
managedRenderOrder = true;
|
2023-10-09 16:07:33 +02:00
|
|
|
|
2024-06-08 13:31:27 +02:00
|
|
|
topoList = [];
|
2023-10-09 16:07:33 +02:00
|
|
|
ungroupable = false;
|
|
|
|
preview_node = noone;
|
2023-10-10 07:12:42 +02:00
|
|
|
allCached = false;
|
2023-10-09 16:07:33 +02:00
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
inputs[0] = nodeValue_Bool("Loop", self, true )
|
2023-10-09 16:07:33 +02:00
|
|
|
.rejectArray();
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
custom_input_index = array_length(inputs);
|
2022-12-13 09:20:36 +01:00
|
|
|
|
2024-05-03 13:40:46 +02:00
|
|
|
if(NODE_NEW_MANUAL) { #region
|
2022-12-13 09:20:36 +01:00
|
|
|
var input = nodeBuild("Node_VFX_Spawner", -256, -32, self);
|
2023-10-09 16:07:33 +02:00
|
|
|
var output = nodeBuild("Node_VFX_Renderer_Output", 256 + 32 * 5, -32, self);
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
output.inputs[output.input_fix_len + 1].setFrom(input.outputs[0]);
|
2023-10-09 16:07:33 +02:00
|
|
|
preview_node = output;
|
2023-10-10 07:12:42 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static getNextNodes = function() { return allCached? getNextNodesExternal() : getNextNodesInternal(); }
|
|
|
|
|
|
|
|
insp2UpdateTooltip = "Clear cache";
|
|
|
|
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
|
2023-10-09 16:07:33 +02:00
|
|
|
|
2023-10-10 07:12:42 +02:00
|
|
|
static onInspector2Update = function() { #region
|
2024-06-08 13:31:27 +02:00
|
|
|
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
|
|
|
|
var node = nodes[i];
|
2023-10-10 07:12:42 +02:00
|
|
|
node.clearCache();
|
|
|
|
}
|
|
|
|
} #endregion
|
|
|
|
|
|
|
|
static reset = function() { #region
|
2024-06-08 13:31:27 +02:00
|
|
|
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
|
|
|
|
var node = nodes[i];
|
2023-10-10 07:12:42 +02:00
|
|
|
if(!struct_has(node, "reset")) continue;
|
|
|
|
node.reset();
|
2023-10-09 16:07:33 +02:00
|
|
|
}
|
2022-12-13 09:20:36 +01:00
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
var loop = getInputData(0);
|
|
|
|
if(!loop) return;
|
|
|
|
|
2024-01-10 08:37:15 +01:00
|
|
|
if(IS_PLAYING)
|
2023-10-09 16:07:33 +02:00
|
|
|
for( var i = 0; i < TOTAL_FRAMES; i++ )
|
2024-06-25 11:53:40 +02:00
|
|
|
for( var j = 0, m = array_length(topoList); j < m; j++ ) {
|
|
|
|
var node = topoList[j];
|
2023-11-30 08:55:33 +01:00
|
|
|
var _ins = instanceof(node);
|
|
|
|
|
|
|
|
if(!string_pos("Node_VFX", _ins))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(_ins == "Node_VFX_Renderer" || _ins == "Node_VFX_Renderer_Output")
|
|
|
|
continue;
|
2023-10-09 16:07:33 +02:00
|
|
|
|
2023-10-10 07:12:42 +02:00
|
|
|
node.doUpdate(i);
|
2023-10-09 16:07:33 +02:00
|
|
|
}
|
|
|
|
|
2024-06-08 13:31:27 +02:00
|
|
|
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
|
|
|
|
var node = nodes[i];
|
2023-10-10 07:12:42 +02:00
|
|
|
if(!struct_has(node, "resetSeed")) continue;
|
|
|
|
node.resetSeed();
|
2023-10-09 16:07:33 +02:00
|
|
|
}
|
2023-10-10 07:12:42 +02:00
|
|
|
} #endregion
|
2023-10-09 16:07:33 +02:00
|
|
|
|
2023-10-10 07:12:42 +02:00
|
|
|
static update = function() { #region
|
2024-01-19 09:33:37 +01:00
|
|
|
if(IS_FIRST_FRAME)
|
2024-06-25 11:53:40 +02:00
|
|
|
topoList = NodeListSort(nodes);
|
2023-10-10 07:12:42 +02:00
|
|
|
|
|
|
|
allCached = true;
|
2024-06-08 13:31:27 +02:00
|
|
|
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
|
|
|
|
var node = nodes[i];
|
2023-10-10 07:12:42 +02:00
|
|
|
if(!node.recoverCache()) allCached = false;
|
|
|
|
}
|
|
|
|
|
2024-01-19 09:33:37 +01:00
|
|
|
if(!allCached && IS_FIRST_FRAME)
|
2023-10-09 16:07:33 +02:00
|
|
|
reset();
|
2023-10-10 07:12:42 +02:00
|
|
|
|
|
|
|
if(allCached) {
|
2024-06-08 13:31:27 +02:00
|
|
|
for( var i = 0, n = array_length(nodes); i < n; i++ )
|
|
|
|
nodes[i].setRenderStatus(true);
|
2023-10-10 07:12:42 +02:00
|
|
|
setRenderStatus(true);
|
2023-10-09 16:07:33 +02:00
|
|
|
}
|
2023-10-10 07:12:42 +02:00
|
|
|
} #endregion
|
2023-03-08 14:59:54 +01:00
|
|
|
|
2023-10-09 16:07:33 +02:00
|
|
|
static ononDoubleClick = function(panel) { #region
|
|
|
|
preview_node = noone;
|
|
|
|
|
2024-06-08 13:31:27 +02:00
|
|
|
for( var i = 0, n = array_length(nodes); i < n; i++ ) {
|
|
|
|
var node = nodes[i];
|
2023-10-09 16:07:33 +02:00
|
|
|
if(is_instanceof(node, Node_VFX_Renderer_Output) ||
|
|
|
|
is_instanceof(node, Node_VFX_Renderer)) {
|
|
|
|
preview_node = node;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-10-10 07:12:42 +02:00
|
|
|
|
|
|
|
PANEL_PREVIEW.setNodePreview(self);
|
2023-10-09 16:07:33 +02:00
|
|
|
} #endregion
|
|
|
|
|
|
|
|
getPreviewingNode = function() { return preview_node; }
|
2022-12-13 09:20:36 +01:00
|
|
|
}
|