Pixel-Composer/scripts/node_3d_scene/node_3d_scene.gml

54 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-08-14 19:22:04 +02:00
function Node_3D_Scene(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constructor {
name = "3D Scene";
2023-08-17 16:56:54 +02:00
outputs[| 0] = nodeValue("Scene", self, JUNCTION_CONNECT.output, VALUE_TYPE.d3Scene, noone);
2023-08-14 19:22:04 +02:00
setIsDynamicInput(1);
2023-08-16 20:16:31 +02:00
object_lists = [];
static createNewInput = function() { #region
2023-08-14 19:22:04 +02:00
var index = ds_list_size(inputs);
inputs[| index] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Mesh, noone )
.setVisible(true, true);
} #endregion
2023-08-14 19:22:04 +02:00
if(!LOADING && !APPENDING) createNewInput();
static refreshDynamicInput = function() { #region
2023-08-14 19:22:04 +02:00
var _l = ds_list_create();
for( var i = 0; i < ds_list_size(inputs); i++ ) {
if(i < input_fix_len || inputs[| i].value_from)
ds_list_add(_l, inputs[| i]);
else
delete inputs[| i];
}
for( var i = 0; i < ds_list_size(_l); i++ )
_l[| i].index = i;
ds_list_destroy(inputs);
inputs = _l;
createNewInput();
} #endregion
2023-08-14 19:22:04 +02:00
static onValueFromUpdate = function(index) { #region
2023-08-14 19:22:04 +02:00
if(index < input_fix_len) return;
if(LOADING || APPENDING) return;
refreshDynamicInput();
} #endregion
2023-08-14 19:22:04 +02:00
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
2023-08-17 16:56:54 +02:00
var _scene = new __3dGroup();
2023-08-16 20:16:31 +02:00
2023-08-14 19:22:04 +02:00
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) {
2023-08-17 16:56:54 +02:00
var _obj = _data[i];
2023-08-14 19:22:04 +02:00
if(_obj == noone) continue;
2023-08-17 16:56:54 +02:00
array_push(_scene.objects, _obj);
2023-08-14 19:22:04 +02:00
}
2023-08-17 16:56:54 +02:00
return _scene;
} #endregion
2023-08-14 19:22:04 +02:00
}