mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
Array composite
This commit is contained in:
parent
f9dd8a8964
commit
523153a7d5
11 changed files with 174 additions and 13 deletions
|
@ -1036,6 +1036,7 @@
|
|||
{"name":"Steamworks","order":2,"path":"extensions/Steamworks/Steamworks.yy",},
|
||||
{"name":"sh_vertex_pnt_light","order":4,"path":"shaders/sh_vertex_pnt_light/sh_vertex_pnt_light.yy",},
|
||||
{"name":"surfaceBox","order":22,"path":"scripts/surfaceBox/surfaceBox.yy",},
|
||||
{"name":"s_node_array_composite","order":17,"path":"sprites/s_node_array_composite/s_node_array_composite.yy",},
|
||||
{"name":"node_gradient_palette","order":11,"path":"scripts/node_gradient_palette/node_gradient_palette.yy",},
|
||||
{"name":"s_node_csv_file_read","order":9,"path":"sprites/s_node_csv_file_read/s_node_csv_file_read.yy",},
|
||||
{"name":"node_fluid_domain","order":1,"path":"scripts/node_fluid_domain/node_fluid_domain.yy",},
|
||||
|
@ -1265,6 +1266,7 @@
|
|||
{"name":"s_discord","order":7,"path":"sprites/s_discord/s_discord.yy",},
|
||||
{"name":"panel_nodes","order":2,"path":"scripts/panel_nodes/panel_nodes.yy",},
|
||||
{"name":"sh_gradient_points","order":19,"path":"shaders/sh_gradient_points/sh_gradient_points.yy",},
|
||||
{"name":"node_array_composite","order":17,"path":"scripts/node_array_composite/node_array_composite.yy",},
|
||||
{"name":"s_node_vfx_turb","order":5,"path":"sprites/s_node_vfx_turb/s_node_vfx_turb.yy",},
|
||||
{"name":"o_dialog_l_system","order":1,"path":"objects/o_dialog_l_system/o_dialog_l_system.yy",},
|
||||
{"name":"node_surface_to_color","order":2,"path":"scripts/node_surface_to_color/node_surface_to_color.yy",},
|
||||
|
|
|
@ -1684,6 +1684,7 @@
|
|||
{"id":{"name":"Steamworks","path":"extensions/Steamworks/Steamworks.yy",},},
|
||||
{"id":{"name":"sh_vertex_pnt_light","path":"shaders/sh_vertex_pnt_light/sh_vertex_pnt_light.yy",},},
|
||||
{"id":{"name":"surfaceBox","path":"scripts/surfaceBox/surfaceBox.yy",},},
|
||||
{"id":{"name":"s_node_array_composite","path":"sprites/s_node_array_composite/s_node_array_composite.yy",},},
|
||||
{"id":{"name":"node_gradient_palette","path":"scripts/node_gradient_palette/node_gradient_palette.yy",},},
|
||||
{"id":{"name":"s_node_csv_file_read","path":"sprites/s_node_csv_file_read/s_node_csv_file_read.yy",},},
|
||||
{"id":{"name":"node_fluid_domain","path":"scripts/node_fluid_domain/node_fluid_domain.yy",},},
|
||||
|
@ -1951,6 +1952,7 @@
|
|||
{"id":{"name":"s_discord","path":"sprites/s_discord/s_discord.yy",},},
|
||||
{"id":{"name":"panel_nodes","path":"scripts/panel_nodes/panel_nodes.yy",},},
|
||||
{"id":{"name":"sh_gradient_points","path":"shaders/sh_gradient_points/sh_gradient_points.yy",},},
|
||||
{"id":{"name":"node_array_composite","path":"scripts/node_array_composite/node_array_composite.yy",},},
|
||||
{"id":{"name":"s_node_vfx_turb","path":"sprites/s_node_vfx_turb/s_node_vfx_turb.yy",},},
|
||||
{"id":{"name":"o_dialog_l_system","path":"objects/o_dialog_l_system/o_dialog_l_system.yy",},},
|
||||
{"id":{"name":"GmlLua","path":"scripts/GmlLua/GmlLua.yy",},},
|
||||
|
|
|
@ -35,6 +35,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
drag_py = 0;
|
||||
drag_cx = 0;
|
||||
drag_cy = 0;
|
||||
drag_rot_axis = new BBMOD_Quaternion();
|
||||
|
||||
drag_original = 0;
|
||||
|
||||
|
@ -341,18 +342,20 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
|
||||
if(drag_axis != noone) { #region
|
||||
var mAng = point_direction(cx, cy, _mx, _my);
|
||||
var _n = BBMOD_VEC3_FORWARD;
|
||||
|
||||
if(drag_rot_axis == undefined) {
|
||||
drag_rot_axis = BBMOD_VEC3_FORWARD;
|
||||
|
||||
switch(drag_axis) {
|
||||
case 0 : _n = new BBMOD_Vec3(-1, 0, 0); break;
|
||||
case 1 : _n = new BBMOD_Vec3( 0, 0, -1); break;
|
||||
case 2 : _n = new BBMOD_Vec3( 0, -1, 0); break;
|
||||
case 0 : drag_rot_axis = new BBMOD_Vec3(-1, 0, 0); break;
|
||||
case 1 : drag_rot_axis = new BBMOD_Vec3( 0, 0, -1); break;
|
||||
case 2 : drag_rot_axis = new BBMOD_Vec3( 0, -1, 0); break;
|
||||
}
|
||||
|
||||
if(_axis == 0)
|
||||
_n = _qrot.Rotate(_n).Normalize();
|
||||
if(_axis == 0) drag_rot_axis = _qrot.Rotate(drag_rot_axis).Normalize();
|
||||
}
|
||||
|
||||
var _nv = _qview.Rotate(_qinv.Rotate(_n));
|
||||
var _nv = _qview.Rotate(_qinv.Rotate(drag_rot_axis));
|
||||
draw_line_round(cx, cy, cx + _nv.X * 100, cy + _nv.Y * 100, 2);
|
||||
|
||||
if(drag_prev != undefined) {
|
||||
|
@ -360,7 +363,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
drag_dist += _rd;
|
||||
var _dist = value_snap(drag_dist, _sny);
|
||||
|
||||
var _currR = new BBMOD_Quaternion().FromAxisAngle(_n, _dist);
|
||||
var _currR = new BBMOD_Quaternion().FromAxisAngle(drag_rot_axis, _dist);
|
||||
var _val = _currR.Mul(drag_val);
|
||||
var _Nrot = _val.ToArray();
|
||||
|
||||
|
@ -377,9 +380,10 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
|
|||
if(_hover != noone && mouse_press(mb_left, active)) { #region
|
||||
drag_axis = _hover;
|
||||
drag_prev = undefined;
|
||||
|
||||
drag_val = _qrot.Clone();
|
||||
drag_dist = 0;
|
||||
|
||||
drag_rot_axis = undefined;
|
||||
} #endregion
|
||||
} #endregion
|
||||
|
||||
|
|
55
scripts/node_array_composite/node_array_composite.gml
Normal file
55
scripts/node_array_composite/node_array_composite.gml
Normal file
|
@ -0,0 +1,55 @@
|
|||
function Node_Array_Composite(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Array Composite";
|
||||
previewable = false;
|
||||
|
||||
w = 96;
|
||||
h = 32 + 24;
|
||||
min_h = h;
|
||||
|
||||
inputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
|
||||
.setArrayDepth(1)
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[| 1] = nodeValue("Compose", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
|
||||
.setArrayDepth(1)
|
||||
.setVisible(true, true);
|
||||
|
||||
outputs[| 0] = nodeValue("Array", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0)
|
||||
.setArrayDepth(1);
|
||||
|
||||
static composite = function(arr, com) {
|
||||
__tmp_com = com;
|
||||
__tmp_len = array_length(com);
|
||||
|
||||
return array_map(arr, function(val, ind) {
|
||||
var ret = array_create(__tmp_len);
|
||||
|
||||
for( var i = 0; i < __tmp_len; i++ )
|
||||
ret[i] = __tmp_com[i] * val;
|
||||
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
|
||||
static update = function(frame = PROJECT.animator.current_frame) {
|
||||
var _arr = getInputData(0);
|
||||
var _ker = getInputData(1);
|
||||
|
||||
if(array_empty(_arr) || array_empty(_ker)) return;
|
||||
|
||||
var res;
|
||||
|
||||
if(is_array(_arr[0])) {
|
||||
for( var i = 0, n = array_length(_arr); i < n; i++ )
|
||||
res[i] = composite(_arr[i], _ker);
|
||||
} else
|
||||
res = composite(_arr, _ker);
|
||||
|
||||
outputs[| 0].setValue(res);
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_array_composite, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
}
|
||||
}
|
11
scripts/node_array_composite/node_array_composite.yy
Normal file
11
scripts/node_array_composite/node_array_composite.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_array_composite",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "array",
|
||||
"path": "folders/nodes/data/value/array.yy",
|
||||
},
|
||||
}
|
12
scripts/node_array_composite/node_counter.yy
Normal file
12
scripts/node_array_composite/node_counter.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "variable",
|
||||
"path": "folders/nodes/data/variable.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_counter",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
function Node_Array_Convolute(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Array Convulute";
|
||||
name = "Array Convolute";
|
||||
previewable = false;
|
||||
|
||||
w = 96;
|
||||
|
|
|
@ -555,6 +555,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
addNodeObject(values, "Array Zip", s_node_array_zip, "Node_Array_Zip", [1, Node_Array_Zip]).setVersion(1138);
|
||||
addNodeObject(values, "Array Copy", s_node_array_copy, "Node_Array_Copy", [1, Node_Array_Copy]).setVersion(1144);
|
||||
addNodeObject(values, "Array Convolute",s_node_array_convolute, "Node_Array_Convolute", [1, Node_Array_Convolute]).setVersion(11540);
|
||||
addNodeObject(values, "Array Composite",s_node_array_composite, "Node_Array_Composite", [1, Node_Array_Composite]).setVersion(11540);
|
||||
addNodeObject(values, "Sort Number", s_node_array_sort, "Node_Array_Sort", [1, Node_Array_Sort], ["array sort"]).setVersion(1120);
|
||||
addNodeObject(values, "Shuffle Array", s_node_array_shuffle, "Node_Array_Shuffle", [1, Node_Array_Shuffle], ["array shuffle"]).setVersion(1120);
|
||||
addNodeObject(values, "Loop Array", s_node_loop_array, "Node_Iterate_Each", [1, Node_Iterate_Each], ["iterate each", "for each", "array loop"], "Create group that iterate to each member in an array.");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
74
sprites/s_node_array_composite/s_node_array_composite.yy
Normal file
74
sprites/s_node_array_composite/s_node_array_composite.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_array_composite",
|
||||
"bbox_bottom": 54,
|
||||
"bbox_left": 0,
|
||||
"bbox_right": 63,
|
||||
"bbox_top": 8,
|
||||
"bboxMode": 0,
|
||||
"collisionKind": 1,
|
||||
"collisionTolerance": 0,
|
||||
"DynamicTexturePage": false,
|
||||
"edgeFiltering": false,
|
||||
"For3D": false,
|
||||
"frames": [
|
||||
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"c1e32408-dacc-44fe-8390-c5f18908faa2",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"40e42c52-1820-48c6-8bc4-61e7472c8235","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "array",
|
||||
"path": "folders/nodes/icons/value/array.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_array_composite",
|
||||
"autoRecord": true,
|
||||
"backdropHeight": 768,
|
||||
"backdropImageOpacity": 0.5,
|
||||
"backdropImagePath": "",
|
||||
"backdropWidth": 1366,
|
||||
"backdropXOffset": 0.0,
|
||||
"backdropYOffset": 0.0,
|
||||
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
|
||||
"eventStubScript": null,
|
||||
"eventToFunction": {},
|
||||
"length": 1.0,
|
||||
"lockOrigin": false,
|
||||
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
|
||||
"playback": 1,
|
||||
"playbackSpeed": 30.0,
|
||||
"playbackSpeedType": 0,
|
||||
"showBackdrop": true,
|
||||
"showBackdropImage": false,
|
||||
"timeUnits": 1,
|
||||
"tracks": [
|
||||
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
|
||||
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"c1e32408-dacc-44fe-8390-c5f18908faa2","path":"sprites/s_node_array_composite/s_node_array_composite.yy",},},},"Disabled":false,"id":"9d9b1791-593c-49f6-b7dd-58470a49a413","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
|
||||
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||
],
|
||||
"visibleRange": null,
|
||||
"volume": 1.0,
|
||||
"xorigin": 32,
|
||||
"yorigin": 32,
|
||||
},
|
||||
"swatchColours": null,
|
||||
"swfPrecision": 2.525,
|
||||
"textureGroupId": {
|
||||
"name": "Default",
|
||||
"path": "texturegroups/Default",
|
||||
},
|
||||
"type": 0,
|
||||
"VTile": false,
|
||||
"width": 64,
|
||||
}
|
Loading…
Reference in a new issue