mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-26 21:08:18 +01:00
Atlas datatype merging
This commit is contained in:
parent
b2cdc639df
commit
147329f3d4
57 changed files with 1024 additions and 587 deletions
|
@ -100,6 +100,7 @@
|
|||
{"name":"generator","order":5,"path":"folders/nodes/data/generator.yy",},
|
||||
{"name":"noise","order":14,"path":"folders/nodes/data/generator/noise.yy",},
|
||||
{"name":"pattern","order":15,"path":"folders/nodes/data/generator/pattern.yy",},
|
||||
{"name":"regions","order":23,"path":"folders/nodes/data/generator/regions.yy",},
|
||||
{"name":"group","order":7,"path":"folders/nodes/data/group.yy",},
|
||||
{"name":"network","order":16,"path":"folders/nodes/data/IO/network.yy",},
|
||||
{"name":"iterate","order":10,"path":"folders/nodes/data/iterate.yy",},
|
||||
|
@ -713,7 +714,6 @@
|
|||
{"name":"sh_d3d_ssao_blur","order":1,"path":"shaders/sh_d3d_ssao_blur/sh_d3d_ssao_blur.yy",},
|
||||
{"name":"panel_addon","order":5,"path":"scripts/panel_addon/panel_addon.yy",},
|
||||
{"name":"s_node_text_splice","order":6,"path":"sprites/s_node_text_splice/s_node_text_splice.yy",},
|
||||
{"name":"__atlas","order":6,"path":"scripts/__atlas/__atlas.yy",},
|
||||
{"name":"__node_3d_transform","order":7,"path":"scripts/__node_3d_transform/__node_3d_transform.yy",},
|
||||
{"name":"__d3d_gizmo","order":2,"path":"scripts/__d3d_gizmo/__d3d_gizmo.yy",},
|
||||
{"name":"sh_draw_single_channel","order":3,"path":"shaders/sh_draw_single_channel/sh_draw_single_channel.yy",},
|
||||
|
@ -968,7 +968,6 @@
|
|||
{"name":"sh_bloom_pass","order":2,"path":"shaders/sh_bloom_pass/sh_bloom_pass.yy",},
|
||||
{"name":"fd_rectangle_draw_view","order":4,"path":"scripts/fd_rectangle_draw_view/fd_rectangle_draw_view.yy",},
|
||||
{"name":"fd_rectangle_set_material_type","order":9,"path":"scripts/fd_rectangle_set_material_type/fd_rectangle_set_material_type.yy",},
|
||||
{"name":"node_seperate_shapes","order":4,"path":"scripts/node_seperate_shapes/node_seperate_shapes.yy",},
|
||||
{"name":"node_fluid_domain_queue","order":9,"path":"scripts/node_fluid_domain_queue/node_fluid_domain_queue.yy",},
|
||||
{"name":"node_sequence_to_anim","order":3,"path":"scripts/node_sequence_to_anim/node_sequence_to_anim.yy",},
|
||||
{"name":"sh_blend_replace","order":50,"path":"shaders/sh_blend_replace/sh_blend_replace.yy",},
|
||||
|
@ -1435,6 +1434,7 @@
|
|||
{"name":"button","order":2,"path":"scripts/button/button.yy",},
|
||||
{"name":"s_node_3d_sphere","order":8,"path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",},
|
||||
{"name":"fd_rectangle_replace_velocity","order":16,"path":"scripts/fd_rectangle_replace_velocity/fd_rectangle_replace_velocity.yy",},
|
||||
{"name":"s_node_group_thumbnail","order":34,"path":"sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy",},
|
||||
{"name":"node_VFX_effector","order":6,"path":"scripts/node_VFX_effector/node_VFX_effector.yy",},
|
||||
{"name":"node_path_shift","order":5,"path":"scripts/node_path_shift/node_path_shift.yy",},
|
||||
{"name":"s_node_wav_file_write","order":17,"path":"sprites/s_node_wav_file_write/s_node_wav_file_write.yy",},
|
||||
|
@ -1556,6 +1556,7 @@
|
|||
{"name":"node_noise_fbm","order":3,"path":"scripts/node_noise_fbm/node_noise_fbm.yy",},
|
||||
{"name":"sh_channel_V","order":6,"path":"shaders/sh_channel_V/sh_channel_V.yy",},
|
||||
{"name":"__shapes","order":3,"path":"scripts/__shapes/__shapes.yy",},
|
||||
{"name":"node_group_thumbnail","order":3,"path":"scripts/node_group_thumbnail/node_group_thumbnail.yy",},
|
||||
{"name":"VCT","order":1,"path":"scripts/VCT/VCT.yy",},
|
||||
{"name":"node_alpha_to_grey","order":3,"path":"scripts/node_alpha_to_grey/node_alpha_to_grey.yy",},
|
||||
{"name":"shell_functions","order":20,"path":"scripts/shell_functions/shell_functions.yy",},
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"generator","folderPath":"folders/nodes/data/generator.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"noise","folderPath":"folders/nodes/data/generator/noise.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"pattern","folderPath":"folders/nodes/data/generator/pattern.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"regions","folderPath":"folders/nodes/data/generator/regions.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"group","folderPath":"folders/nodes/data/group.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"IO","folderPath":"folders/nodes/data/IO.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"network","folderPath":"folders/nodes/data/IO/network.yy",},
|
||||
|
@ -1316,7 +1317,6 @@
|
|||
{"id":{"name":"sh_d3d_ssao_blur","path":"shaders/sh_d3d_ssao_blur/sh_d3d_ssao_blur.yy",},},
|
||||
{"id":{"name":"panel_addon","path":"scripts/panel_addon/panel_addon.yy",},},
|
||||
{"id":{"name":"s_node_text_splice","path":"sprites/s_node_text_splice/s_node_text_splice.yy",},},
|
||||
{"id":{"name":"__atlas","path":"scripts/__atlas/__atlas.yy",},},
|
||||
{"id":{"name":"__node_3d_transform","path":"scripts/__node_3d_transform/__node_3d_transform.yy",},},
|
||||
{"id":{"name":"__d3d_gizmo","path":"scripts/__d3d_gizmo/__d3d_gizmo.yy",},},
|
||||
{"id":{"name":"sh_draw_single_channel","path":"shaders/sh_draw_single_channel/sh_draw_single_channel.yy",},},
|
||||
|
@ -2142,6 +2142,7 @@
|
|||
{"id":{"name":"button","path":"scripts/button/button.yy",},},
|
||||
{"id":{"name":"s_node_3d_sphere","path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",},},
|
||||
{"id":{"name":"fd_rectangle_replace_velocity","path":"scripts/fd_rectangle_replace_velocity/fd_rectangle_replace_velocity.yy",},},
|
||||
{"id":{"name":"s_node_group_thumbnail","path":"sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy",},},
|
||||
{"id":{"name":"node_VFX_effector","path":"scripts/node_VFX_effector/node_VFX_effector.yy",},},
|
||||
{"id":{"name":"sh_blur_gaussian","path":"shaders/sh_blur_gaussian/sh_blur_gaussian.yy",},},
|
||||
{"id":{"name":"node_path_shift","path":"scripts/node_path_shift/node_path_shift.yy",},},
|
||||
|
@ -2284,6 +2285,7 @@
|
|||
{"id":{"name":"node_noise_fbm","path":"scripts/node_noise_fbm/node_noise_fbm.yy",},},
|
||||
{"id":{"name":"sh_channel_V","path":"shaders/sh_channel_V/sh_channel_V.yy",},},
|
||||
{"id":{"name":"__shapes","path":"scripts/__shapes/__shapes.yy",},},
|
||||
{"id":{"name":"node_group_thumbnail","path":"scripts/node_group_thumbnail/node_group_thumbnail.yy",},},
|
||||
{"id":{"name":"VCT","path":"scripts/VCT/VCT.yy",},},
|
||||
{"id":{"name":"node_alpha_to_grey","path":"scripts/node_alpha_to_grey/node_alpha_to_grey.yy",},},
|
||||
{"id":{"name":"shell_functions","path":"scripts/shell_functions/shell_functions.yy",},},
|
||||
|
|
Binary file not shown.
|
@ -364,5 +364,10 @@
|
|||
"widget_rotator_random_range": "Range",
|
||||
"widget_rotator_random_span": "Span",
|
||||
|
||||
"pref_clear_temp": "Clear temp file on close.",
|
||||
"pref_connection_type": "Connection type",
|
||||
"pref_use_alt": "Use ALT for",
|
||||
"meta_old_version": "Created on an older version",
|
||||
|
||||
"" : ""
|
||||
}
|
|
@ -223,5 +223,88 @@
|
|||
"system": "System",
|
||||
"text": "Text",
|
||||
|
||||
"3d_camera": "3D Camera",
|
||||
"add_bones": "Add bones",
|
||||
"add_node": "Add node",
|
||||
"add_number": "Add number",
|
||||
"add_vector2": "Add vector2",
|
||||
"add_vector3": "Add vector3",
|
||||
"add_vector4": "Add vector4",
|
||||
"adjust_control_point": "Adjust control point",
|
||||
"anchor_add_/_remove": "Anchor add / remove",
|
||||
"anchor_remove": "Anchor remove",
|
||||
"array": "Array",
|
||||
"assetbox": "Assetbox",
|
||||
"bg": "Bg",
|
||||
"blend": "Blend",
|
||||
"canvas_blend": "Canvas blend",
|
||||
"canvas": "Canvas",
|
||||
"circle_path": "Circle path",
|
||||
"close_file": "Close file",
|
||||
"collection": "Collection",
|
||||
"color_picker": "Color picker",
|
||||
"comb": "Comb",
|
||||
"copy_property": "Copy property",
|
||||
"delete_(break)": "Delete (break)",
|
||||
"delete_(merge)": "Delete (merge)",
|
||||
"delete_keys": "Delete keys",
|
||||
"detach_bones": "Detach bones",
|
||||
"dialog": "Dialog",
|
||||
"draw_path": "Draw path",
|
||||
"edit_control_point": "Edit control point",
|
||||
"ellipse": "Ellipse",
|
||||
"eraser": "Eraser",
|
||||
"fill": "Fill",
|
||||
"first_frame": "First frame",
|
||||
"focus_content": "Focus content",
|
||||
"full_panel": "Full panel",
|
||||
"grab": "Grab",
|
||||
"ik": "IK",
|
||||
"import_image_array": "Import image array",
|
||||
"import_image": "Import image",
|
||||
"last_frame": "Last frame",
|
||||
"main": "Main",
|
||||
"mesh_edit": "Mesh edit",
|
||||
"mesh_warp": "Mesh Warp",
|
||||
"move_target": "Move Target",
|
||||
"new_file": "New file",
|
||||
"next_frame": "Next frame",
|
||||
"open_notification": "Open notification",
|
||||
"pan": "Pan",
|
||||
"panel": "Panel",
|
||||
"paste_property": "Paste property",
|
||||
"path_anchor": "Path Anchor",
|
||||
"pencil": "Pencil",
|
||||
"pin_mesh": "Pin mesh",
|
||||
"play/pause": "Play/Pause",
|
||||
"preview_focusing_node": "Preview focusing node",
|
||||
"preview_window": "Preview window",
|
||||
"previous_frame": "Previous frame",
|
||||
"push": "Push",
|
||||
"rectangle_path": "Rectangle path",
|
||||
"rectangle": "Rectangle",
|
||||
"remove_bones": "Remove bones",
|
||||
"render_all": "Render all",
|
||||
"resume/pause": "Resume/Pause",
|
||||
"rigid_object": "Rigid Object",
|
||||
"rotate": "Rotate",
|
||||
"rotation": "Rotation",
|
||||
"save_all_current_frame": "Save all current frame",
|
||||
"save_current_frame": "Save current frame",
|
||||
"scrollbar": "Scrollbar",
|
||||
"select_all": "Select all",
|
||||
"selection": "Selection",
|
||||
"shorten": "Shorten",
|
||||
"strand_create": "Strand Create",
|
||||
"stretch": "Stretch",
|
||||
"surfaces": "Surfaces",
|
||||
"toggle_animation": "Toggle animation",
|
||||
"toggle_grid": "Toggle grid",
|
||||
"toggle_preview": "Toggle preview",
|
||||
"toggle_render": "Toggle render",
|
||||
"transform_node": "Transform node",
|
||||
"widget": "Widget",
|
||||
"workshop": "Workshop",
|
||||
|
||||
"" : ""
|
||||
}
|
|
@ -78,7 +78,7 @@ event_inherited();
|
|||
sect_title = string_replace(sect_title, "- ", "");
|
||||
}
|
||||
|
||||
draw_text_add(_xx, yl + hs / 2, sect_title);
|
||||
draw_text_add(_xx, yl + hs / 2, __txt(sect_title));
|
||||
|
||||
yl += hs;
|
||||
hh += hs;
|
||||
|
|
|
@ -73,9 +73,6 @@ if(OS == os_windows && gameframe_is_minimized()) exit;
|
|||
txt += " (groups: " + string(array_length(content)) + ")";
|
||||
draw_tooltip_text("[" + txt + "]");
|
||||
break;
|
||||
case VALUE_TYPE.atlas :
|
||||
draw_tooltip_atlas(content);
|
||||
break;
|
||||
case VALUE_TYPE.buffer :
|
||||
draw_tooltip_buffer(content);
|
||||
break;
|
||||
|
|
|
@ -42,7 +42,7 @@ function __part(_node) constructor {
|
|||
//wig_rot = new wiggleMap(seed, 1, PROJECT.animator.frames_total);
|
||||
//wig_dir = new wiggleMap(seed, 1, PROJECT.animator.frames_total);
|
||||
|
||||
boundary_data = -1;
|
||||
atlas = noone;
|
||||
|
||||
grav = 0;
|
||||
gravDir = -90;
|
||||
|
@ -77,21 +77,32 @@ function __part(_node) constructor {
|
|||
ground_bounce = 0;
|
||||
ground_friction = 1;
|
||||
|
||||
static reset = function() { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
surf = noone;
|
||||
atlas = noone;
|
||||
|
||||
prevx = undefined;
|
||||
prevy = undefined;
|
||||
} #endregion
|
||||
|
||||
static create = function(_surf, _x, _y, _life) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
active = true;
|
||||
surf = _surf;
|
||||
x = _x;
|
||||
y = _y;
|
||||
|
||||
prevx = undefined;
|
||||
prevy = undefined;
|
||||
|
||||
life = _life;
|
||||
life_total = life;
|
||||
node.onPartCreate(self);
|
||||
} #endregion
|
||||
|
||||
static setPhysic = function(_sx, _sy, _ac, _g, _gDir, _turn, _turnSpd) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
speedx = _sx;
|
||||
speedy = _sy;
|
||||
accel = _ac;
|
||||
|
@ -108,6 +119,8 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static setWiggle = function(wiggle_maps) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
//wig_psx.check(_wig_pos[0], _wig_pos[1], seed + 10);
|
||||
//wig_psy.check(_wig_pos[0], _wig_pos[1], seed + 20);
|
||||
//wig_rot.check(_wig_rot[0], _wig_rot[1], seed + 30);
|
||||
|
@ -124,6 +137,8 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static setGround = function(_ground, _ground_offset, _ground_bounce, _ground_frict) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
ground = _ground;
|
||||
ground_y = y + _ground_offset;
|
||||
ground_bounce = _ground_bounce;
|
||||
|
@ -131,6 +146,8 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static setTransform = function(_scx, _scy, _sct, _rot, _rots, _follow) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
sc_sx = _scx;
|
||||
sc_sy = _scy;
|
||||
sct = _sct;
|
||||
|
@ -141,6 +158,8 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static setDraw = function(_col, _blend, _alp, _fade) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
col = _col;
|
||||
blend = _blend;
|
||||
alp = _alp;
|
||||
|
@ -149,12 +168,16 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static kill = function() { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
active = false;
|
||||
|
||||
node.onPartDestroy(self);
|
||||
} #endregion
|
||||
|
||||
static step = function() { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(!active) return;
|
||||
x += speedx;
|
||||
|
||||
|
@ -214,8 +237,11 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static draw = function(exact, surf_w, surf_h) { #region
|
||||
gml_pragma("forceinline");
|
||||
|
||||
var ss = surf;
|
||||
if(is_array(surf)) {
|
||||
|
||||
if(surf != noone && is_array(surf)) {
|
||||
var ind = abs(round((life_total - life) * anim_speed));
|
||||
var len = array_length(surf);
|
||||
|
||||
|
@ -234,8 +260,9 @@ function __part(_node) constructor {
|
|||
}
|
||||
}
|
||||
|
||||
var surface = node.surface_cache[$ ss];
|
||||
//print($"VFX: {surface} ({is_surface(surface)})")
|
||||
var surface = atlas == noone? node.surface_cache[$ ss] : atlas.getSurface();
|
||||
//print($"VFX: {surface} ({is_surface(surface)}), {atlas}")
|
||||
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
var lifeRat = 1 - life / life_total;
|
||||
|
@ -247,22 +274,9 @@ function __part(_node) constructor {
|
|||
var s_w = surface_get_width_safe(surface) * scx;
|
||||
var s_h = surface_get_height_safe(surface) * scy;
|
||||
|
||||
if(boundary_data == -1) {
|
||||
var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot);
|
||||
_xx = drawx + _pp[0];
|
||||
_yy = drawy + _pp[1];
|
||||
} else {
|
||||
var ww = boundary_data[2] + boundary_data[0];
|
||||
var hh = boundary_data[3] + boundary_data[1];
|
||||
|
||||
var cx = (boundary_data[0] + boundary_data[2]) / 2;
|
||||
var cy = (boundary_data[1] + boundary_data[3]) / 2;
|
||||
|
||||
var _pp = point_rotate(-cx, -cy, 0, 0, rot);
|
||||
|
||||
_xx = drawx + cx + _pp[0] * scx;
|
||||
_yy = drawy + cy + _pp[1] * scy;
|
||||
}
|
||||
var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot);
|
||||
_xx = drawx + _pp[0];
|
||||
_yy = drawy + _pp[1];
|
||||
|
||||
if(exact) {
|
||||
_xx = round(_xx);
|
||||
|
@ -284,15 +298,9 @@ function __part(_node) constructor {
|
|||
} #endregion
|
||||
|
||||
static getPivot = function() { #region
|
||||
if(boundary_data == -1)
|
||||
return [x, y];
|
||||
gml_pragma("forceinline");
|
||||
|
||||
var ww = (boundary_data[2] - boundary_data[0]) * scx;
|
||||
var hh = (boundary_data[3] - boundary_data[1]) * scy;
|
||||
var cx = x + boundary_data[0] + ww / 2;
|
||||
var cy = y + boundary_data[1] + hh / 2;
|
||||
|
||||
return [cx, cy];
|
||||
return [x, y];
|
||||
} #endregion
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
function spriteAtlasData(x = 0, y = 0, w = 1, h = 1, surface = noone, index = 0) constructor {
|
||||
self.surface = surface;
|
||||
self.index = index;
|
||||
self.x = x;
|
||||
self.y = y;
|
||||
self.w = w;
|
||||
self.h = h;
|
||||
|
||||
static clone = function() { return new spriteAtlasData(x, y, w, h, surface, index); }
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
function Rectangle(x, y, w, h) constructor {
|
||||
function Rectangle(x = 0, y = 0, w = 0, h = 0) constructor {
|
||||
self.x = x;
|
||||
self.y = y;
|
||||
self.w = w;
|
||||
|
|
|
@ -1,22 +1,61 @@
|
|||
function SurfaceAtlas(surface, position = [ 0, 0 ], rotation = 0, scale = [ 1, 1 ], blend = c_white, alpha = 1) constructor {
|
||||
function SurfaceAtlas(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1) constructor {
|
||||
self.surface = new Surface(surface);
|
||||
self.position = position;
|
||||
self.rotation = rotation;
|
||||
self.scale = scale;
|
||||
self.x = _x;
|
||||
self.y = _y;
|
||||
self.rotation = rot;
|
||||
self.sx = sx;
|
||||
self.sy = sy;
|
||||
self.blend = blend;
|
||||
self.alpha = alpha;
|
||||
|
||||
w = surface_get_width_safe(surface);
|
||||
h = surface_get_height_safe(surface);
|
||||
|
||||
oriSurf = noone;
|
||||
oriSurf_w = w;
|
||||
oriSurf_h = h;
|
||||
|
||||
static setOrginalSurface = function(surf) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
oriSurf = surf;
|
||||
oriSurf_w = surface_get_width_safe(surf);
|
||||
oriSurf_h = surface_get_height_safe(surf);
|
||||
return self;
|
||||
}
|
||||
|
||||
static getSurface = function() {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
return surface.get();
|
||||
}
|
||||
|
||||
static setSurface = function(surface) {
|
||||
gml_pragma("forceinline");
|
||||
self.surface.set(surface);
|
||||
|
||||
w = surface_get_width_safe(surface);
|
||||
h = surface_get_height_safe(surface);
|
||||
}
|
||||
|
||||
static draw = function() {
|
||||
draw_surface_ext_safe(surface.get(), position[0], position[1], scale[0], scale[1], rotation, blend, alpha);
|
||||
gml_pragma("forceinline");
|
||||
|
||||
draw_surface_ext_safe(surface.get(), x, y, sx, sy, rotation, blend, alpha);
|
||||
return self;
|
||||
}
|
||||
|
||||
static clone = function() {
|
||||
return new SurfaceAtlas(surface.get(), position, rotation, scale, blend, alpha);
|
||||
gml_pragma("forceinline");
|
||||
|
||||
return new SurfaceAtlas(getSurface(), x, y, rotation, sx, sy, blend, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
function Surface(surface) constructor {
|
||||
static set = function(surface) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
self.surface = surface;
|
||||
w = surface_get_width_safe(surface);
|
||||
h = surface_get_height_safe(surface);
|
||||
|
@ -24,11 +63,13 @@ function Surface(surface) constructor {
|
|||
}
|
||||
set(surface);
|
||||
|
||||
static get = function() { return surface; }
|
||||
static get = function() { gml_pragma("forceinline"); return surface; }
|
||||
|
||||
static isValid = function() { return is_surface(surface); }
|
||||
static isValid = function() { gml_pragma("forceinline"); return is_surface(surface); }
|
||||
|
||||
static resize = function(w, h) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
surface_resize(surface, w, h);
|
||||
self.w = w;
|
||||
self.h = h;
|
||||
|
@ -36,22 +77,30 @@ function Surface(surface) constructor {
|
|||
}
|
||||
|
||||
static draw = function(x, y, xs = 1, ys = 1, rot = 0, col = c_white, alpha = 1) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
draw_surface_ext_safe(surface, x, y, xs, ys, rot, col, alpha);
|
||||
return self;
|
||||
}
|
||||
|
||||
static drawStretch = function(x, y, w = 1, h = 1, rot = 0, col = c_white, alpha = 1) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
draw_surface_stretched_ext(surface, x, y, w, h, col, alpha);
|
||||
return self;
|
||||
}
|
||||
|
||||
static destroy = function() {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(!isValid()) return;
|
||||
surface_free(surface);
|
||||
}
|
||||
}
|
||||
|
||||
function Surface_get(surface) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_real(surface))
|
||||
return surface;
|
||||
if(is_struct(surface) && struct_has(surface, "surface"))
|
||||
|
|
|
@ -15,7 +15,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
|
||||
inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||
.rejectArray()
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Direct Data" ] );
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Atlas" ] );
|
||||
|
||||
inputs[| 5] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ] )
|
||||
.setDisplay(VALUE_DISPLAY.range);
|
||||
|
@ -78,7 +78,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
|
||||
inputs[| 24] = nodeValue("Scatter", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1)
|
||||
.rejectArray()
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random", "Data" ]);
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, [ "Uniform", "Random" ]);
|
||||
|
||||
inputs[| 25] = nodeValue("Boundary data", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [])
|
||||
.setVisible(false, true);
|
||||
|
@ -99,8 +99,9 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
inputs[| 30] = nodeValue("Distribution map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0)
|
||||
.rejectArray()
|
||||
|
||||
inputs[| 31] = nodeValue("Distribution data", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
inputs[| 31] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [] )
|
||||
.setArrayDepth(1)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 32] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom_range(100000, 999999))
|
||||
.rejectArray();
|
||||
|
@ -148,12 +149,12 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
inputs[| 44] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false )
|
||||
.setDisplay(VALUE_DISPLAY.button, { name: "Trigger", onClick: triggerSpawn, output: true })
|
||||
.rejectArray();
|
||||
|
||||
|
||||
input_len = ds_list_size(inputs);
|
||||
|
||||
input_display_list = [ 32,
|
||||
["Sprite", false], 0, 22, 23, 26,
|
||||
["Spawn", true], 27, 16, 44, 1, 2, 3, 4, 30, 31, 24, 25, 5,
|
||||
["Sprite", false], 0, 31, 22, 23, 26,
|
||||
["Spawn", true], 27, 16, 44, 1, 2, 3, 4, 30, 24, 5,
|
||||
["Movement", true], 29, 6, 18,
|
||||
["Physics", true], 7, 19, 33, 34, 35, 36,
|
||||
["Ground", true], 37, 38, 39, 40,
|
||||
|
@ -195,14 +196,14 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
parts[i] = new __part(self);
|
||||
|
||||
static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { #region
|
||||
var _inSurf = current_data[0];
|
||||
var _inSurf = current_data[ 0];
|
||||
var _atlas = current_data[31];
|
||||
|
||||
var _spawn_amount = current_data[ 2];
|
||||
|
||||
var _spawn_area = current_data[ 3];
|
||||
var _distrib = current_data[ 4];
|
||||
var _dist_map = current_data[30];
|
||||
var _dist_data = current_data[31];
|
||||
var _scatter = current_data[24];
|
||||
|
||||
var _life = current_data[ 5];
|
||||
|
@ -244,6 +245,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
random_set_seed(seed);
|
||||
var _amo = irandom_range(_spawn_amount[0], _spawn_amount[1]);
|
||||
|
||||
//print($"Frame {_time}: Spawning {_amo} particles, seed {seed}, {irandom(99999999)}");
|
||||
for( var i = 0; i < _amo; i++ ) {
|
||||
seed += 100;
|
||||
random_set_seed(seed);
|
||||
|
@ -251,7 +253,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
parts_runner = clamp(parts_runner, 0, array_length(parts) - 1);
|
||||
var part = parts[parts_runner];
|
||||
|
||||
//print($"Frame {_time}: Spawning particle {parts_runner}, seed {seed}, {irandom(99999999)}");
|
||||
part.reset();
|
||||
|
||||
var _spr = _inSurf, _index = 0;
|
||||
if(is_array(_inSurf)) {
|
||||
|
@ -269,36 +271,23 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
var yy = 0;
|
||||
|
||||
if(_pos == -1) {
|
||||
if(_scatter == 2) {
|
||||
var _b_data = current_data[25];
|
||||
if(!is_array(_b_data) || array_length(_b_data) <= 0) return;
|
||||
var _b = _b_data[safe_mod(_index, array_length(_b_data))];
|
||||
if(!is_array(_b) || array_length(_b) != 4) return;
|
||||
|
||||
xx = array_safe_get(_spawn_area, 0) - array_safe_get(_spawn_area, 2);
|
||||
yy = array_safe_get(_spawn_area, 1) - array_safe_get(_spawn_area, 3);
|
||||
|
||||
part.boundary_data = _b;
|
||||
} else {
|
||||
if(_distrib < 2) {
|
||||
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount, seed);
|
||||
xx = sp[0];
|
||||
yy = sp[1];
|
||||
|
||||
part.boundary_data = -1;
|
||||
} else if(_distrib == 2) {
|
||||
var sp = array_safe_get(_posDist, i);
|
||||
if(!is_array(sp)) continue;
|
||||
if(_distrib < 2) {
|
||||
var sp = area_get_random_point(_spawn_area, _distrib, _scatter, spawn_index, _spawn_amount, seed);
|
||||
xx = sp[0];
|
||||
yy = sp[1];
|
||||
} else if(_distrib == 2) {
|
||||
var sp = array_safe_get(_posDist, i);
|
||||
if(!is_array(sp)) continue;
|
||||
|
||||
xx = _spawn_area[0] + _spawn_area[2] * (sp[0] * 2 - 1.);
|
||||
yy = _spawn_area[1] + _spawn_area[3] * (sp[1] * 2 - 1.);
|
||||
} else if(_distrib == 3) {
|
||||
sp = array_safe_get(_dist_data, spawn_index);
|
||||
if(!is_array(sp)) continue;
|
||||
|
||||
_x = sp[0];
|
||||
_y = sp[1];
|
||||
}
|
||||
xx = _spawn_area[0] + _spawn_area[2] * (sp[0] * 2 - 1.);
|
||||
yy = _spawn_area[1] + _spawn_area[3] * (sp[1] * 2 - 1.);
|
||||
} else if(_distrib == 3) {
|
||||
sp = array_safe_get(_atlas, spawn_index,, ARRAY_OVERFLOW.loop);
|
||||
|
||||
if(!is_instanceof(sp, SurfaceAtlas)) continue;
|
||||
xx = sp.x + sp.w / 2;
|
||||
yy = sp.y + sp.h / 2;
|
||||
part.atlas = sp;
|
||||
}
|
||||
} else {
|
||||
xx = _pos[0];
|
||||
|
@ -464,8 +453,9 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
|
|||
|
||||
inputs[| 6].setVisible(!_dirAng);
|
||||
|
||||
inputs[| 25].setVisible(_scatt == 2);
|
||||
inputs[| 24].setVisible(_dist < 2);
|
||||
|
||||
inputs[| 0].setVisible(_dist != 3, _dist != 3);
|
||||
inputs[| 30].setVisible(_dist == 2, _dist == 2);
|
||||
inputs[| 31].setVisible(_dist == 3, _dist == 3);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ function draw_surface_fit(surf, xx, yy, w, h, color = c_white, alpha = 1) {
|
|||
draw_surface_ext_safe(surf, xx - surface_get_width_safe(surf) * ss / 2, yy - surface_get_height_safe(surf) * ss / 2, ss, ss,, color, alpha);
|
||||
}
|
||||
|
||||
function draw_surface_stretch_fit(surf, xx, yy, w, h, sw, sh) {
|
||||
function draw_surface_stretch_fit(surf, xx, yy, w, h, sw = 1, sh = 1) {
|
||||
var ss = min(w / sw, h / sh);
|
||||
draw_surface_stretched_safe(surf, xx - sw * ss / 2, yy - sh * ss / 2, sw * ss, sh * ss);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ function draw_text_bbox(bbox, text) {
|
|||
|
||||
draw_set_halign(fa_center);
|
||||
draw_set_valign(fa_center);
|
||||
|
||||
draw_text_cut(bbox.xc, bbox.yc, text, bbox.w, ss);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,11 @@ function draw_tooltip_gradient(clr) {
|
|||
}
|
||||
|
||||
function draw_tooltip_surface_array(surf) {
|
||||
if(is_instanceof(surf[0], SurfaceAtlas)) {
|
||||
draw_tooltip_atlas(surf);
|
||||
return;
|
||||
}
|
||||
|
||||
var amo = array_length(surf);
|
||||
var col = ceil(sqrt(amo));
|
||||
var row = ceil(amo / col);
|
||||
|
@ -101,6 +106,12 @@ function draw_tooltip_surface(surf) {
|
|||
draw_tooltip_surface_array(array_spread(surf))
|
||||
return;
|
||||
}
|
||||
|
||||
if(is_instanceof(surf, SurfaceAtlas)) {
|
||||
draw_tooltip_atlas(surf);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!is_surface(surf)) return;
|
||||
|
||||
var sw = surface_get_width_safe(surf);
|
||||
|
@ -142,7 +153,7 @@ function draw_tooltip_atlas(atlas) {
|
|||
var _y = sy + i * ui(48 + 8);
|
||||
|
||||
var atl = atlas[i];
|
||||
var surf = atl.surface.get();
|
||||
var surf = atl.getSurface();
|
||||
|
||||
if(!is_surface(surf)) continue;
|
||||
|
||||
|
@ -161,9 +172,9 @@ function draw_tooltip_atlas(atlas) {
|
|||
draw_text_add(sx + ui( 56), _y + ui(32), __txt("Scale"));
|
||||
|
||||
draw_set_text(f_p3, fa_right, fa_top, COLORS._main_text);
|
||||
draw_text_add(sx + ui(160), _y + ui( 0), atl.position);
|
||||
draw_text_add(sx + ui(160), _y + ui( 0), $"{atl.x}, {atl.y}");
|
||||
draw_text_add(sx + ui(160), _y + ui(16), atl.rotation);
|
||||
draw_text_add(sx + ui(160), _y + ui(32), atl.scale);
|
||||
draw_text_add(sx + ui(160), _y + ui(32), $"{atl.sx}, {atl.sy}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
globalvar UNDO_STACK, REDO_STACK;
|
||||
globalvar IS_UNDOING, UNDO_HOLDING;
|
||||
|
||||
|
||||
IS_UNDOING = false;
|
||||
UNDO_HOLDING = false;
|
||||
UNDO_STACK = ds_stack_create();
|
||||
|
|
|
@ -133,6 +133,9 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
|
|||
if(struct_has(_load_content, "graphGrid"))
|
||||
PROJECT.graphGrid = _load_content.graphGrid;
|
||||
|
||||
if(struct_has(_load_content, "attributes"))
|
||||
struct_override(PROJECT.attributes, _load_content.attributes);
|
||||
|
||||
try {
|
||||
if(struct_has(_load_content, "metadata"))
|
||||
METADATA.deserialize(_load_content.metadata);
|
||||
|
@ -201,7 +204,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
|
|||
log_warning("LOAD, update", exception_print(e));
|
||||
}
|
||||
|
||||
Render(, true);
|
||||
Render();
|
||||
|
||||
if(!ds_queue_empty(CONNECTION_CONFLICT)) {
|
||||
var pass = 0;
|
||||
|
@ -236,7 +239,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
|
|||
log_warning("LOAD, connect", exception_print(e));
|
||||
}
|
||||
|
||||
RENDER_ALL_REORDER
|
||||
Render(, true);
|
||||
|
||||
LOADING = false;
|
||||
PROJECT.modified = false;
|
||||
|
|
|
@ -20,7 +20,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
.rejectArrayProcess();
|
||||
|
||||
outputs[| 2] = nodeValue("Bind data", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, [])
|
||||
|
@ -810,7 +810,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
if(!vis) continue;
|
||||
|
||||
var datInd = input_fix_len + i * data_length;
|
||||
var _s = use_data? _bind[i].surface.get() : _data[datInd];
|
||||
var _s = use_data? _bind[i].getSurface() : _data[datInd];
|
||||
if(!is_surface(_s)) continue;
|
||||
|
||||
var _b = use_data? _bind[i].bone : inputs[| datInd].display_data.bone_id;
|
||||
|
@ -847,7 +847,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
(_anc.y * _dsca) + _cen[1] + _mov[1] + _dpos[1]
|
||||
];
|
||||
|
||||
array_push(atlas_data, new SurfaceAtlas(_s, _pos, _rot, _sca));
|
||||
array_push(atlas_data, new SurfaceAtlas(_s, _pos[0], _pos[1], _rot, _sca[0], _sca[1]));
|
||||
array_push(bind_data, {
|
||||
surface: new Surface(_s),
|
||||
bone: _b.ID,
|
||||
|
|
|
@ -5,7 +5,7 @@ function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.atlas, noone)
|
||||
inputs[| 1] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(true, true);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -28,7 +28,7 @@ function Node_Atlas_Draw(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
|
||||
surface_set_shader(outSurf,,, BLEND.alpha);
|
||||
for( var i = 0, n = array_length(atl); i < n; i++ ) {
|
||||
shader_set_interpolation(atl[i].surface.get())
|
||||
shader_set_interpolation(atl[i].getSurface())
|
||||
atl[i].draw();
|
||||
}
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -2,7 +2,7 @@ function Node_Atlas_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
name = "Atlas Get";
|
||||
previewable = true;
|
||||
|
||||
inputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.atlas, noone)
|
||||
inputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(true, true);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
|
@ -42,7 +42,7 @@ function Node_Atlas_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
var alph = [];
|
||||
|
||||
for( var i = 0, n = array_length(atl); i < n; i++ ) {
|
||||
surf[i] = atl[i].surface.get();
|
||||
surf[i] = atl[i].getSurface();
|
||||
posi[i] = atl[i].position;
|
||||
rota[i] = atl[i].rotation;
|
||||
scal[i] = atl[i].scale;
|
||||
|
|
|
@ -2,7 +2,7 @@ function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
name = "Atlas Set";
|
||||
previewable = true;
|
||||
|
||||
inputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.atlas, noone)
|
||||
inputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(true, true);
|
||||
|
||||
inputs[| 1] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, [])
|
||||
|
@ -25,7 +25,7 @@ function Node_Atlas_Set(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
inputs[| 6] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
|
||||
.setArrayDepth(1);
|
||||
|
||||
outputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, noone);
|
||||
outputs[| 0] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
static update = function(frame = PROJECT.animator.current_frame) {
|
||||
var atl = getInputData(0);
|
||||
|
|
|
@ -5,6 +5,8 @@ function Node_create_Blend(_x, _y, _group = noone, _param = {}) {
|
|||
|
||||
function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Blend";
|
||||
atlas_index = 1;
|
||||
manage_atlas = false;
|
||||
|
||||
inputs[| 0] = nodeValue("Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
inputs[| 1] = nodeValue("Foreground", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
@ -48,7 +50,24 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
attribute_surface_depth();
|
||||
|
||||
temp_surface = [ surface_create(1, 1) ];
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
|
||||
blend_temp_surface = temp_surface[1];
|
||||
|
||||
static step = function() { #region
|
||||
var _back = getSingleValue(0);
|
||||
var _fore = getSingleValue(1);
|
||||
var _fill = getSingleValue(5);
|
||||
var _outp = getSingleValue(6);
|
||||
|
||||
var _atlas = is_instanceof(_fore, SurfaceAtlas);
|
||||
|
||||
inputs[| 5].editWidget.data_list = _atlas? [ "None", "Stretch" ] : [ "None", "Stretch", "Tile" ];
|
||||
inputs[| 6].editWidget.data_list = _atlas? [ "Background", "Forground" ] : [ "Background", "Forground", "Mask", "Maximum", "Constant" ];
|
||||
inputs[| 7].setVisible(_outp == 4);
|
||||
|
||||
inputs[| 10].setVisible(_fill == 0 && !_atlas);
|
||||
inputs[| 11].setVisible(_fill == 0 && !_atlas);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _back = _data[0];
|
||||
|
@ -56,7 +75,7 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
var _type = _data[2];
|
||||
var _opacity = _data[3];
|
||||
var _mask = _data[4];
|
||||
var _tile = _data[5];
|
||||
var _fill = _data[5];
|
||||
|
||||
var _outp = _data[6];
|
||||
var _out_dim = _data[7];
|
||||
|
@ -66,64 +85,28 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
var _valign = _data[11];
|
||||
var cDep = attrDepth();
|
||||
|
||||
inputs[| 7].setVisible(_outp == 4);
|
||||
var ww = 1, hh = 1;
|
||||
var _foreDraw = _fore;
|
||||
var ww = 1, hh = 1;
|
||||
var _backDraw = _back;
|
||||
var _foreDraw = _fore;
|
||||
|
||||
inputs[| 10].setVisible(_tile == 0);
|
||||
inputs[| 11].setVisible(_tile == 0);
|
||||
var _atlas = is_instanceof(_fore, SurfaceAtlas);
|
||||
|
||||
if(_tile == 0 && is_surface(_fore)) {
|
||||
ww = surface_get_width_safe(_back);
|
||||
hh = surface_get_height_safe(_back);
|
||||
|
||||
var fw = surface_get_width_safe(_fore);
|
||||
var fh = surface_get_height_safe(_fore);
|
||||
|
||||
temp_surface[0] = surface_verify(temp_surface[0], ww, hh, cDep);
|
||||
_foreDraw = temp_surface[0];
|
||||
|
||||
var sx = 0;
|
||||
var sy = 0;
|
||||
|
||||
switch(_halign) {
|
||||
case 0 : sx = 0; break;
|
||||
case 1 : sx = ww / 2 - fw / 2; break;
|
||||
case 2 : sx = ww - fw; break;
|
||||
}
|
||||
|
||||
switch(_valign) {
|
||||
case 0 : sy = 0; break;
|
||||
case 1 : sy = hh / 2 - fh / 2; break;
|
||||
case 2 : sy = hh - fh; break;
|
||||
}
|
||||
|
||||
surface_set_target(temp_surface[0]);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE
|
||||
draw_surface_safe(_fore, sx, sy);
|
||||
BLEND_NORMAL
|
||||
surface_reset_target();
|
||||
}
|
||||
|
||||
switch(_outp) {
|
||||
switch(_outp) { // Dimension
|
||||
case 0 :
|
||||
ww = surface_get_width_safe(_back);
|
||||
hh = surface_get_height_safe(_back);
|
||||
break;
|
||||
case 1 :
|
||||
if(is_surface(_foreDraw)) {
|
||||
ww = surface_get_width_safe(_foreDraw);
|
||||
hh = surface_get_height_safe(_foreDraw);
|
||||
}
|
||||
ww = surface_get_width_safe(_fore);
|
||||
hh = surface_get_height_safe(_fore);
|
||||
break;
|
||||
case 2 :
|
||||
ww = surface_get_width_safe(_mask);
|
||||
hh = surface_get_height_safe(_mask);
|
||||
break;
|
||||
case 3 :
|
||||
ww = max(surface_get_width_safe(_back), is_surface(_fore)? surface_get_width_safe(_fore) : 1, surface_get_width_safe(_mask));
|
||||
hh = max(surface_get_height_safe(_back), is_surface(_fore)? surface_get_height_safe(_fore) : 1, surface_get_height_safe(_mask));
|
||||
ww = max(surface_get_width_safe(_back), surface_get_width_safe(_fore), surface_get_width_safe(_mask));
|
||||
hh = max(surface_get_height_safe(_back), surface_get_height_safe(_fore), surface_get_height_safe(_mask));
|
||||
break;
|
||||
case 4 :
|
||||
ww = _out_dim[0];
|
||||
|
@ -131,12 +114,69 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
break;
|
||||
}
|
||||
|
||||
_outSurf = surface_verify(_outSurf, ww, hh, cDep);
|
||||
if(_fill == 0) { // Direct placement
|
||||
for( var i = 0; i < 2; i++ )
|
||||
temp_surface[i] = surface_verify(temp_surface[i], ww, hh, cDep);
|
||||
|
||||
_foreDraw = temp_surface[1];
|
||||
|
||||
if(_atlas) {
|
||||
if(_outp == 0) {
|
||||
surface_set_shader(_foreDraw, noone,, BLEND.over);
|
||||
draw_surface_safe(_fore.getSurface(), _fore.x, _fore.y);
|
||||
surface_reset_shader();
|
||||
} else if(_outp == 1) {
|
||||
_backDraw = temp_surface[0];
|
||||
|
||||
surface_set_shader(_foreDraw, noone,, BLEND.over);
|
||||
draw_surface_safe(_fore, 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
surface_set_shader(_backDraw, noone,, BLEND.over);
|
||||
draw_surface_safe(_back, -_fore.x, -_fore.y);
|
||||
surface_reset_shader();
|
||||
}
|
||||
} else if(is_surface(_fore)) {
|
||||
var sx = 0;
|
||||
var sy = 0;
|
||||
|
||||
var fw = surface_get_width_safe(_fore);
|
||||
var fh = surface_get_height_safe(_fore);
|
||||
|
||||
switch(_halign) {
|
||||
case 0 : sx = 0; break;
|
||||
case 1 : sx = ww / 2 - fw / 2; break;
|
||||
case 2 : sx = ww - fw; break;
|
||||
}
|
||||
|
||||
switch(_valign) {
|
||||
case 0 : sy = 0; break;
|
||||
case 1 : sy = hh / 2 - fh / 2; break;
|
||||
case 2 : sy = hh - fh; break;
|
||||
}
|
||||
|
||||
surface_set_shader(_foreDraw, noone,, BLEND.over);
|
||||
draw_surface_safe(_fore, sx, sy);
|
||||
surface_reset_shader();
|
||||
}
|
||||
}
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
draw_surface_blend(_back, _foreDraw, _type, _opacity, _pre_alp, _mask, max(0, _tile - 1));
|
||||
surface_reset_target();
|
||||
var _output = noone;
|
||||
|
||||
if(is_instanceof(_outSurf, SurfaceAtlas))
|
||||
_output = surface_verify(_outSurf.surface.surface, ww, hh, cDep);
|
||||
else
|
||||
_output = surface_verify(_outSurf, ww, hh, cDep);
|
||||
|
||||
surface_set_shader(_output, noone);
|
||||
draw_surface_blend(_backDraw, _foreDraw, _type, _opacity, _pre_alp, _mask, _fill == 2);
|
||||
surface_reset_shader();
|
||||
|
||||
if(_atlas) {
|
||||
var _newAtl = _fore.clone();
|
||||
_newAtl.surface.set(_output);
|
||||
return _newAtl;
|
||||
}
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
|
|
|
@ -324,13 +324,6 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
|
||||
PATCH_STATIC
|
||||
|
||||
//static triggerRender = function() {
|
||||
// for(var i = custom_input_index; i < ds_list_size(inputs); i++) {
|
||||
// var jun_node = inputs[| i].from;
|
||||
// jun_node.triggerRender();
|
||||
// }
|
||||
//}
|
||||
|
||||
static preConnect = function() { #region
|
||||
sortIO();
|
||||
deserialize(load_map, load_scale);
|
||||
|
@ -468,6 +461,23 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
panel.addContext(self);
|
||||
} #endregion
|
||||
|
||||
static getGraphPreviewSurface = function() { #region
|
||||
var _output_junc = outputs[| preview_channel];
|
||||
for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) {
|
||||
if(!nodes[| i].active) continue;
|
||||
if(is_instanceof(nodes[| i], Node_Group_Thumbnail))
|
||||
_output_junc = nodes[| i].inputs[| 0];
|
||||
}
|
||||
|
||||
switch(_output_junc.type) {
|
||||
case VALUE_TYPE.surface :
|
||||
case VALUE_TYPE.dynaSurface :
|
||||
return _output_junc.getValue();
|
||||
}
|
||||
|
||||
return noone;
|
||||
} #endregion
|
||||
|
||||
static processSerialize = function(_map) { #region
|
||||
_map[? "instance_base"] = instanceBase? instanceBase.node_id : noone;
|
||||
} #endregion
|
||||
|
|
|
@ -139,11 +139,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
return _col;
|
||||
}
|
||||
|
||||
surface_set_target(_baseSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(shader);
|
||||
surface_set_shader(_baseSurf, shader);
|
||||
shader_set_uniform_i(uniform_mask_use, _m != DEF_SURFACE);
|
||||
texture_set_stage(uniform_mask, surface_get_texture(_m));
|
||||
|
||||
|
@ -161,10 +157,7 @@ function Node_Color_adjust(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
draw_surface_safe(_surf, 0, 0);
|
||||
gpu_set_colorwriteenable(1, 1, 1, 1);
|
||||
draw_surface_ext_safe(_surf, 0, 0, 1, 1, 0, c_white, _alp);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
|
|
|
@ -240,7 +240,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
.rejectArrayProcess();
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ];
|
||||
|
@ -803,7 +803,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
var _d0 = point_rotate(cx - _sw / 2, cy - _sh / 2, cx, cy, _rot);
|
||||
|
||||
array_push(atlas_data, new SurfaceAtlas(_s, [ _d0[0], _d0[1] ], _rot, [ _sca[0], _sca[1] ]));
|
||||
array_push(atlas_data, new SurfaceAtlas(_s, _d0[0], _d0[1], _rot, _sca[0], _sca[1]));
|
||||
|
||||
surface_set_shader(temp_surface[_bg], sh_sample, true, BLEND.over);
|
||||
blend_temp_surface = temp_surface[2];
|
||||
|
|
|
@ -103,7 +103,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
inspectInput2 = nodeValue("Toggle execution", self, JUNCTION_CONNECT.input, VALUE_TYPE.action, false).setVisible(true, true);
|
||||
|
||||
autoUpdatedTrigger = true;
|
||||
updatedTrigger = nodeValue("Updated", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false).setVisible(true, true);
|
||||
updatedInTrigger = nodeValue("Update", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, false).setVisible(true, true);
|
||||
updatedOutTrigger = nodeValue("Updated", self, JUNCTION_CONNECT.output, VALUE_TYPE.trigger, false).setVisible(true, true);
|
||||
|
||||
updatedInTrigger.tags = VALUE_TAG.updateInTrigger;
|
||||
updatedOutTrigger.tags = VALUE_TAG.updateOutTrigger;
|
||||
|
||||
insp1UpdateTooltip = __txtx("panel_inspector_execute", "Execute node");
|
||||
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
|
||||
|
@ -125,12 +129,14 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
#region --- attributes ----
|
||||
attributes = {
|
||||
update_graph: true,
|
||||
show_update_trigger: false
|
||||
};
|
||||
|
||||
attributeEditors = [
|
||||
"Node",
|
||||
["Update trigger", function() { return attributes.show_update_trigger; }, new checkBox(function() { attributes.show_update_trigger = !attributes.show_update_trigger; }) ]
|
||||
"Node update",
|
||||
["Auto update", function() { return attributes.update_graph; }, new checkBox(function() { attributes.update_graph = !attributes.update_graph; }) ],
|
||||
["Update trigger", function() { return attributes.show_update_trigger; }, new checkBox(function() { attributes.show_update_trigger = !attributes.show_update_trigger; }) ],
|
||||
];
|
||||
#endregion
|
||||
|
||||
|
@ -369,7 +375,14 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(hasInspector1Update()) inspectInput1.name = insp1UpdateTooltip;
|
||||
if(hasInspector2Update()) inspectInput2.name = insp2UpdateTooltip;
|
||||
|
||||
updatedTrigger.setValue(false);
|
||||
if(updatedInTrigger.getValue()) {
|
||||
getInputs();
|
||||
update();
|
||||
|
||||
updatedInTrigger.setValue(false);
|
||||
}
|
||||
|
||||
updatedOutTrigger.setValue(false);
|
||||
} #endregion
|
||||
|
||||
static doStepBegin = function() {}
|
||||
|
@ -417,12 +430,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
static getInputs = function() { #region
|
||||
inputs_data = array_create(ds_list_size(inputs), undefined);
|
||||
//input_hash_raw = "";
|
||||
|
||||
for(var i = 0; i < ds_list_size(inputs); i++) {
|
||||
for(var i = 0; i < ds_list_size(inputs); i++)
|
||||
inputs_data[i] = inputs[| i].getValue(,,, true);
|
||||
//input_hash_raw += string_copy(string(inputs_data[i]), 1, 256);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static forceUpdate = function() { #region
|
||||
|
@ -484,7 +494,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(trigger) onInspector2Update();
|
||||
}
|
||||
|
||||
if(autoUpdatedTrigger) updatedTrigger.setValue(true);
|
||||
updatedOutTrigger.setValue(true);
|
||||
|
||||
if(!is_instanceof(self, Node_Collection))
|
||||
render_time = get_timer() - render_timer;
|
||||
|
@ -522,7 +532,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
LOG_BLOCK_END();
|
||||
} #endregion
|
||||
|
||||
static resetRenderForward = function() {
|
||||
static resetRenderForward = function() { #region
|
||||
setRenderStatus(false);
|
||||
for( var i = 0, n = ds_list_size(outputs); i < n; i++ ) {
|
||||
var _outp = outputs[| i];
|
||||
|
@ -536,7 +546,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
_to.node.resetRenderForward();
|
||||
}
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static resetRender = function() { setRenderStatus(false); }
|
||||
static isRenderActive = function() { return renderActive || (PREF_MAP[? "render_all_export"] && PROJECT.animator.rendering); }
|
||||
|
@ -650,8 +660,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
ind++;
|
||||
}
|
||||
|
||||
updatedTrigger.x = xx + w * _s;
|
||||
updatedTrigger.y = yy + 10;
|
||||
updatedInTrigger.x = xx;
|
||||
updatedInTrigger.y = yy + 10;
|
||||
|
||||
updatedOutTrigger.x = xx + w * _s;
|
||||
updatedOutTrigger.y = yy + 10;
|
||||
|
||||
var inamo = (input_display_list == -1 || !use_display_list)? ds_list_size(inputs) : array_length(input_display_list);
|
||||
var _in = yy + ui(junction_draw_pad_y) * _s;
|
||||
|
@ -774,8 +787,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(hasInspector2Update() && inspectInput2.drawJunction(_s, _mx, _my))
|
||||
hover = inspectInput2;
|
||||
|
||||
if(attributes.show_update_trigger && updatedTrigger.drawJunction(_s, _mx, _my))
|
||||
hover = updatedTrigger;
|
||||
if(attributes.show_update_trigger) {
|
||||
if(updatedInTrigger.drawJunction(_s, _mx, _my)) hover = updatedInTrigger;
|
||||
if(updatedOutTrigger.drawJunction(_s, _mx, _my)) hover = updatedOutTrigger;
|
||||
}
|
||||
|
||||
return hover;
|
||||
} #endregion
|
||||
|
@ -884,6 +899,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(hov) hovering = hov;
|
||||
}
|
||||
|
||||
if(attributes.show_update_trigger) {
|
||||
if(updatedInTrigger.drawConnections(params)) hovering = updatedInTrigger;
|
||||
if(updatedOutTrigger.drawConnections(params)) hovering = updatedOutTrigger;
|
||||
}
|
||||
|
||||
return hovering;
|
||||
} #endregion
|
||||
|
||||
|
@ -1018,7 +1038,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
draw_sprite_stretched_ext(THEME.node_glow, 0, xx - 9, yy - 9, w * _s + 18, h * _s + 18, COLORS._main_value_negative, 1);
|
||||
|
||||
drawNodeBase(xx, yy, _s);
|
||||
if(previewable && ds_list_size(outputs)) {
|
||||
if(previewable) {
|
||||
if(preview_channel >= ds_list_size(outputs))
|
||||
preview_channel = 0;
|
||||
drawPreview(xx, yy, _s);
|
||||
|
@ -1442,7 +1462,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _trigger = [];
|
||||
array_push(_trigger, inspectInput1.serialize(scale, preset));
|
||||
array_push(_trigger, inspectInput2.serialize(scale, preset));
|
||||
array_push(_trigger, updatedTrigger.serialize(scale, preset));
|
||||
array_push(_trigger, updatedInTrigger.serialize(scale, preset));
|
||||
array_push(_trigger, updatedOutTrigger.serialize(scale, preset));
|
||||
_map.inspectInputs = _trigger;
|
||||
_map.renamed = renamed;
|
||||
|
||||
|
@ -1588,8 +1609,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
inspectInput1.applyDeserialize(insInp[0], load_scale, preset);
|
||||
inspectInput2.applyDeserialize(insInp[1], load_scale, preset);
|
||||
|
||||
if(array_length(insInp) > 2)
|
||||
updatedTrigger.applyDeserialize(insInp[2], load_scale, preset);
|
||||
if(array_length(insInp) > 2) updatedInTrigger.applyDeserialize(insInp[2], load_scale, preset);
|
||||
if(array_length(insInp) > 3) updatedOutTrigger.applyDeserialize(insInp[3], load_scale, preset);
|
||||
}
|
||||
|
||||
doApplyDeserialize();
|
||||
|
@ -1623,10 +1644,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
for(var i = 0; i < ds_list_size(inputs); i++)
|
||||
connected &= inputs[| i].connect(log);
|
||||
|
||||
if(struct_has(load_map, "inspectInputs")) {
|
||||
inspectInput1.connect(log);
|
||||
inspectInput2.connect(log);
|
||||
}
|
||||
inspectInput1.connect(log);
|
||||
inspectInput2.connect(log);
|
||||
updatedInTrigger.connect(log);
|
||||
|
||||
if(!connected) ds_queue_enqueue(CONNECTION_CONFLICT, self);
|
||||
|
||||
|
|
|
@ -589,7 +589,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
PROJECT.animator.rendering = false;
|
||||
|
||||
export();
|
||||
updatedTrigger.setValue(true);
|
||||
updatedOutTrigger.setValue(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -702,7 +702,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
}
|
||||
}
|
||||
|
||||
updatedTrigger.setValue(true);
|
||||
updatedOutTrigger.setValue(true);
|
||||
} #endregion
|
||||
|
||||
static doApplyDeserialize = function() { onValueUpdate(3); }
|
||||
|
|
|
@ -3,7 +3,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
destroy_when_upgroup = true;
|
||||
color = COLORS.node_blend_collection;
|
||||
previewable = false;
|
||||
auto_height = false;
|
||||
|
||||
inParent = undefined;
|
||||
|
||||
|
@ -24,13 +23,13 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
data_type_list = [ "Integer", "Float", "Boolean", "Color", "Surface",
|
||||
"File Path", "Curve", "Text", "Object", "Node",
|
||||
"3D object", "Any", "Path", "Particle", "Rigidbody Object",
|
||||
"Fluid Domain", "Struct", "Strands", "Mesh", "Trigger"
|
||||
"Fluid Domain", "Struct", "Strands", "Mesh", "Trigger",
|
||||
];
|
||||
|
||||
data_type_map = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.surface,
|
||||
VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text, VALUE_TYPE.object, VALUE_TYPE.node,
|
||||
VALUE_TYPE.d3object, VALUE_TYPE.any, VALUE_TYPE.pathnode, VALUE_TYPE.particle, VALUE_TYPE.rigid,
|
||||
VALUE_TYPE.fdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger
|
||||
VALUE_TYPE.fdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger,
|
||||
];
|
||||
|
||||
display_list = [
|
||||
|
|
|
@ -3,7 +3,6 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
destroy_when_upgroup = true;
|
||||
color = COLORS.node_blend_collection;
|
||||
previewable = false;
|
||||
auto_height = false;
|
||||
|
||||
attributes.input_priority = group == noone? 0 : ds_list_size(group.inputs);
|
||||
array_push(attributeEditors, "Group");
|
||||
|
|
12
scripts/node_group_thumbnail/node_group_input.yy
Normal file
12
scripts/node_group_thumbnail/node_group_input.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "group",
|
||||
"path": "folders/nodes/data/group.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_group_input",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_group_thumbnail/node_group_thumbnail.gml
Normal file
12
scripts/node_group_thumbnail/node_group_thumbnail.gml
Normal file
|
@ -0,0 +1,12 @@
|
|||
function Node_Group_Thumbnail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Thumbnail";
|
||||
destroy_when_upgroup = true;
|
||||
color = COLORS.node_blend_collection;
|
||||
|
||||
inputs[| 0] = nodeValue("Input", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
|
||||
.setVisible(true, true);
|
||||
|
||||
static getGraphPreviewSurface = function() { #region
|
||||
return getInputData(0);
|
||||
} #endregion
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "__atlas",
|
||||
"name": "node_group_thumbnail",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "geometry",
|
||||
"path": "folders/functions/geometry.yy",
|
||||
"name": "group",
|
||||
"path": "folders/nodes/data/group.yy",
|
||||
},
|
||||
}
|
|
@ -77,7 +77,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, [])
|
||||
outputs[| 1] = nodeValue("Atlas Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
.setArrayDepth(1);
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -350,12 +350,12 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
}
|
||||
|
||||
if(!empty) {
|
||||
array_push(_atl, new spriteAtlasData(_spr_pos[0], _spr_pos[1], ww, hh, _s, array_length(surf_array)));
|
||||
array_push(_atl, new SurfaceAtlas(_s, _spr_pos[0], _spr_pos[1]));
|
||||
array_push(surf_array, _s);
|
||||
}
|
||||
sprite_valid[i] = !empty;
|
||||
} else {
|
||||
array_push(_atl, new spriteAtlasData(_spr_pos[0], _spr_pos[1], ww, hh, _s, array_length(surf_array)));
|
||||
array_push(_atl, new SurfaceAtlas(_s, _spr_pos[0], _spr_pos[1]));
|
||||
array_push(surf_array, _s);
|
||||
sprite_valid[i] = true;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
outputs[| 0] = nodeValue("Packed image", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, []);
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []);
|
||||
|
||||
input_display_list = [
|
||||
0, 4, 1, 2, 3,
|
||||
|
@ -29,9 +29,9 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
for( var i = 0, n = array_length(rect); i < n; i++ ) {
|
||||
var r = rect[i];
|
||||
|
||||
var _surf = r.surface.get();
|
||||
var _sx = r.position[0];
|
||||
var _sy = r.position[1];
|
||||
var _surf = r.getSurface();
|
||||
var _sx = r.x;
|
||||
var _sy = r.y;
|
||||
|
||||
if(!is_surface(_surf)) continue;
|
||||
|
||||
|
@ -66,8 +66,9 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
var s = _inpt[i];
|
||||
if(!is_surface(s)) continue;
|
||||
|
||||
_rects[i] = new spriteAtlasData(0, 0, surface_get_width_safe(s) + _spac * 2,
|
||||
surface_get_height_safe(s) + _spac * 2, s, i);
|
||||
_rects[i] = new SurfaceAtlas(s);
|
||||
_rects[i].w = surface_get_width_safe(s) + _spac * 2;
|
||||
_rects[i].h = surface_get_height_safe(s) + _spac * 2;
|
||||
}
|
||||
|
||||
var pack;
|
||||
|
@ -109,7 +110,7 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
for( var i = 0, n = array_length(rect); i < n; i++ ) {
|
||||
var r = rect[i];
|
||||
|
||||
array_push(atlas, new SurfaceAtlas(r.surface, [ r.x + _spac, r.y + _spac ]));
|
||||
array_push(atlas, new SurfaceAtlas(r.surface, r.x + _spac, r.y + _spac));
|
||||
draw_surface_safe(r.surface, r.x + _spac, r.y + _spac);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,10 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
|
||||
process_amount = 0;
|
||||
process_length = [];
|
||||
dimension_index = 0;
|
||||
dimension_index = 0;
|
||||
|
||||
manage_atlas = true;
|
||||
atlas_index = 0;
|
||||
|
||||
batch_output = false; //Run processData once with all outputs as array.
|
||||
|
||||
|
@ -73,16 +76,27 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
static processDataArray = function(outIndex) { #region
|
||||
var _output = outputs[| outIndex];
|
||||
var _out = _output.getValue();
|
||||
var _atlas = false;
|
||||
var _pAtl = noone;
|
||||
var _data = array_create(ds_list_size(inputs));
|
||||
|
||||
if(process_amount == 1) { #region render single data
|
||||
if(_output.type == VALUE_TYPE.d3object) //passing 3D vertex call
|
||||
return _out;
|
||||
|
||||
if(_output.type == VALUE_TYPE.surface) { //resize surface
|
||||
if(dimension_index == -1)
|
||||
surface_array_free(_out);
|
||||
else {
|
||||
var surf = inputs_data[dimension_index];
|
||||
for(var i = 0; i < ds_list_size(inputs); i++)
|
||||
_data[i] = inputs_data[i];
|
||||
|
||||
if(_output.type == VALUE_TYPE.surface) { // Surface preparation
|
||||
if(manage_atlas) {
|
||||
_pAtl = _data[atlas_index];
|
||||
_atlas = is_instanceof(_pAtl, SurfaceAtlas);
|
||||
|
||||
if(_atlas) _data[atlas_index] = _pAtl.getSurface();
|
||||
}
|
||||
|
||||
if(dimension_index > -1) {
|
||||
var surf = _data[dimension_index];
|
||||
var _sw = 1, _sh = 1;
|
||||
if(inputs[| dimension_index].type == VALUE_TYPE.surface) {
|
||||
if(is_surface(surf)) {
|
||||
|
@ -95,20 +109,31 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
_sh = array_safe_get(surf, 1, 1);
|
||||
}
|
||||
|
||||
_out = surface_verify(_out, _sw, _sh, attrDepth());
|
||||
if(manage_atlas && is_instanceof(_out, SurfaceAtlas)) {
|
||||
surface_free_safe(_out.getSurface())
|
||||
_out = surface_verify(_out.getSurface(), _sw, _sh, attrDepth());
|
||||
} else
|
||||
_out = surface_verify(_out, _sw, _sh, attrDepth());
|
||||
}
|
||||
}
|
||||
|
||||
current_data = inputs_data;
|
||||
current_data = _data;
|
||||
|
||||
if(active_index > -1 && !inputs_data[active_index]) { // skip
|
||||
if(active_index > -1 && !_data[active_index]) { // skip
|
||||
if(inputs[| 0].type == VALUE_TYPE.surface)
|
||||
return surface_clone(inputs_data[0], _out);
|
||||
return surface_clone(_data[0], _out);
|
||||
else
|
||||
return inputs_data[0]
|
||||
return _data[0];
|
||||
}
|
||||
|
||||
var data = processData(_out, _data, outIndex, 0); // Process data
|
||||
|
||||
if(manage_atlas && _atlas && is_surface(data)) { // Convert back to atlas
|
||||
var _atl = _pAtl.clone();
|
||||
_atl.setSurface(data);
|
||||
return _atl;
|
||||
}
|
||||
|
||||
var data = processData(_out, inputs_data, outIndex, 0); /// Process data
|
||||
return data;
|
||||
} #endregion
|
||||
|
||||
|
@ -119,39 +144,57 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
array_resize(_out, process_amount);
|
||||
#endregion
|
||||
|
||||
var _data = array_create(ds_list_size(inputs));
|
||||
|
||||
for(var l = 0; l < process_amount; l++) {
|
||||
for(var i = 0; i < ds_list_size(inputs); i++)
|
||||
_data[i] = all_inputs[i][l];
|
||||
|
||||
if(_output.type == VALUE_TYPE.surface && dimension_index > -1) { #region output surface verification
|
||||
var surf = _data[dimension_index];
|
||||
var _sw = 1, _sh = 1;
|
||||
if(inputs[| dimension_index].type == VALUE_TYPE.surface) {
|
||||
if(is_surface(surf)) {
|
||||
_sw = surface_get_width_safe(surf);
|
||||
_sh = surface_get_height_safe(surf);
|
||||
} else
|
||||
return noone;
|
||||
} else if(is_array(surf)) {
|
||||
_sw = surf[0];
|
||||
_sh = surf[1];
|
||||
if(_output.type == VALUE_TYPE.surface) { #region // Output surface verification
|
||||
if(manage_atlas) {
|
||||
_pAtl = _data[atlas_index];
|
||||
_atlas = is_instanceof(_pAtl, SurfaceAtlas);
|
||||
|
||||
if(_atlas) _data[atlas_index] = _pAtl.getSurface();
|
||||
}
|
||||
|
||||
_out[l] = surface_verify(_out[l], _sw, _sh, attrDepth());
|
||||
if(dimension_index > -1) {
|
||||
var surf = _data[dimension_index];
|
||||
var _sw = 1, _sh = 1;
|
||||
if(inputs[| dimension_index].type == VALUE_TYPE.surface) {
|
||||
if(is_surface(surf)) {
|
||||
_sw = surface_get_width_safe(surf);
|
||||
_sh = surface_get_height_safe(surf);
|
||||
} else
|
||||
return noone;
|
||||
} else if(is_array(surf)) {
|
||||
_sw = surf[0];
|
||||
_sh = surf[1];
|
||||
}
|
||||
|
||||
if(manage_atlas && is_instanceof(_out[l], SurfaceAtlas)) {
|
||||
surface_free_safe(_out[l].surface.surface)
|
||||
_out[l] = surface_verify(_out[l].getSurface(), _sw, _sh, attrDepth());
|
||||
} else
|
||||
_out[l] = surface_verify(_out[l], _sw, _sh, attrDepth());
|
||||
}
|
||||
} #endregion
|
||||
|
||||
if(l == 0 || l == preview_index)
|
||||
current_data = _data;
|
||||
|
||||
if(active_index > -1 && !_data[active_index]) { // skip
|
||||
if(inputs[| 0].type == VALUE_TYPE.surface)
|
||||
if(!_atlas && inputs[| 0].type == VALUE_TYPE.surface)
|
||||
_out[l] = surface_clone(_data[0], _out[l]);
|
||||
else
|
||||
_out[l] = _data[0];
|
||||
} else
|
||||
_out[l] = processData(_out[l], _data, outIndex, l); /// Process data
|
||||
} else {
|
||||
_out[l] = processData(_out[l], _data, outIndex, l); // Process data
|
||||
|
||||
if(manage_atlas && _atlas && is_surface(_out[l])) { // Convert back to atlas
|
||||
var _atl = _pAtl.clone();
|
||||
_atl.setSurface(_out[l]);
|
||||
_out[l] = _atl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _out;
|
||||
|
|
|
@ -108,15 +108,17 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
var group = ds_list_create();
|
||||
addNodeCatagory("Group", group, ["Node_Group"]); #region
|
||||
ds_list_add(group, "Groups");
|
||||
addNodeObject(group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(group, "Output", s_node_group_output,"Node_Group_Output", [1, Node_Group_Output]);
|
||||
addNodeObject(group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(group, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]);
|
||||
addNodeObject(group, "Thumbnail", s_node_group_thumbnail, "Node_Group_Thumbnail", [1, Node_Group_Thumbnail]);
|
||||
#endregion
|
||||
|
||||
var iter = ds_list_create(); #region
|
||||
addNodeCatagory("Loop", iter, ["Node_Iterate"]);
|
||||
ds_list_add(iter, "Groups");
|
||||
addNodeObject(iter, "Input", s_node_loop_input, "Node_Iterator_Input", [1, Node_Iterator_Input]);
|
||||
addNodeObject(iter, "Output", s_node_loop_output, "Node_Iterator_Output", [1, Node_Iterator_Output]);
|
||||
addNodeObject(iter, "Input", s_node_loop_input, "Node_Iterator_Input", [1, Node_Iterator_Input]);
|
||||
addNodeObject(iter, "Output", s_node_loop_output, "Node_Iterator_Output", [1, Node_Iterator_Output]);
|
||||
addNodeObject(iter, "Thumbnail", s_node_group_thumbnail, "Node_Group_Thumbnail", [1, Node_Group_Thumbnail]);
|
||||
|
||||
ds_list_add(iter, "Loops");
|
||||
addNodeObject(iter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]);
|
||||
|
@ -126,8 +128,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
var itere = ds_list_create(); #region
|
||||
addNodeCatagory("Loop", itere, ["Node_Iterate_Each"]);
|
||||
ds_list_add(itere, "Groups");
|
||||
addNodeObject(itere, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(itere, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]);
|
||||
addNodeObject(itere, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(itere, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]);
|
||||
addNodeObject(itere, "Thumbnail", s_node_group_thumbnail, "Node_Group_Thumbnail", [1, Node_Group_Thumbnail]);
|
||||
|
||||
ds_list_add(itere, "Loops");
|
||||
addNodeObject(itere, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]);
|
||||
|
@ -137,8 +140,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
var filter = ds_list_create(); #region
|
||||
addNodeCatagory("Filter", filter, ["Node_Iterate_Filter"]);
|
||||
ds_list_add(filter, "Groups");
|
||||
addNodeObject(filter, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(filter, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]);
|
||||
addNodeObject(filter, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(filter, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]);
|
||||
addNodeObject(filter, "Thumbnail", s_node_group_thumbnail, "Node_Group_Thumbnail", [1, Node_Group_Thumbnail]);
|
||||
|
||||
ds_list_add(filter, "Loops");
|
||||
addNodeObject(filter, "Index", s_node_iterator_index, "Node_Iterator_Index", [1, Node_Iterator_Index]);
|
||||
|
@ -148,8 +152,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
var feed = ds_list_create(); #region
|
||||
addNodeCatagory("Feedback", feed, ["Node_Feedback"]);
|
||||
ds_list_add(feed, "Groups");
|
||||
addNodeObject(feed, "Input", s_node_feedback_input, "Node_Feedback_Input", [1, Node_Feedback_Input]);
|
||||
addNodeObject(feed, "Output", s_node_feedback_output, "Node_Feedback_Output", [1, Node_Feedback_Output]);
|
||||
addNodeObject(feed, "Input", s_node_feedback_input, "Node_Feedback_Input", [1, Node_Feedback_Input]);
|
||||
addNodeObject(feed, "Output", s_node_feedback_output, "Node_Feedback_Output", [1, Node_Feedback_Output]);
|
||||
addNodeObject(feed, "Thumbnail", s_node_group_thumbnail, "Node_Group_Thumbnail", [1, Node_Group_Thumbnail]);
|
||||
#endregion
|
||||
|
||||
var vfx = ds_list_create(); #region
|
||||
|
|
|
@ -43,7 +43,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
|
||||
outputs[| 1] = nodeValue("Atlas Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
.setArrayDepth(1);
|
||||
|
||||
refreshSurface = false;
|
||||
|
@ -204,7 +204,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
case 2 : _sy = py + (hh - _h); break;
|
||||
}
|
||||
|
||||
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], [_sx, _sy]));
|
||||
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], _sx, _sy));
|
||||
draw_surface_safe(inpt[i], _sx, _sy);
|
||||
|
||||
break;
|
||||
|
@ -218,7 +218,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
case 2 : _sx = px + (ww - _w); break;
|
||||
}
|
||||
|
||||
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], [_sx, _sy]));
|
||||
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], _sx, _sy));
|
||||
draw_surface_safe(inpt[i], _sx, _sy);
|
||||
|
||||
break;
|
||||
|
@ -230,7 +230,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
px = padd[2] + _col * _w + max(0, _col) * spac;
|
||||
py = padd[1] + _row * _h + max(0, _row) * spac;
|
||||
|
||||
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], [px, py]));
|
||||
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], px, py));
|
||||
draw_surface_safe(inpt[i], px, py);
|
||||
break;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
case 2 : _sy = py + (hh - _h); break;
|
||||
}
|
||||
|
||||
array_push(_atl, new SurfaceAtlas(inpt[i], [_sx, _sy]));
|
||||
array_push(_atl, new SurfaceAtlas(inpt[i], _sx, _sy));
|
||||
draw_surface_safe(inpt[i], _sx, _sy);
|
||||
|
||||
px += _w + spac;
|
||||
|
@ -384,7 +384,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
case 2 : _sx = px + (ww - _w); break;
|
||||
}
|
||||
|
||||
array_push(_atl, new SurfaceAtlas(inpt[i], [_sx, _sy]));
|
||||
array_push(_atl, new SurfaceAtlas(inpt[i], _sx, _sy));
|
||||
draw_surface_safe(inpt[i], _sx, _sy);
|
||||
|
||||
py += _h + spac;
|
||||
|
@ -412,7 +412,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var _w = surface_get_width_safe(inpt[index]);
|
||||
var _h = surface_get_height_safe(inpt[index]);
|
||||
|
||||
array_push(_atl, new SurfaceAtlas(inpt[index], [px, py]));
|
||||
array_push(_atl, new SurfaceAtlas(inpt[index], px, py));
|
||||
draw_surface_safe(inpt[index], px, py);
|
||||
|
||||
px += _w + spac;
|
||||
|
|
|
@ -30,33 +30,31 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
inputs[| 6] = nodeValue("Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 7] = nodeValue("Start shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16, 4, 4, AREA_SHAPE.rectangle ])
|
||||
.setDisplay(VALUE_DISPLAY.area);
|
||||
inputs[| 7].editWidget.adjust_shape = false;
|
||||
inputs[| 7] = nodeValue("Start position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 16, 16 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 8] = nodeValue("Spawn", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Make object spawn when start.")
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 9] = nodeValue("Generate mesh", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
|
||||
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() {
|
||||
var _tex = getInputData(6);
|
||||
if(is_array(_tex)) {
|
||||
for( var i = 0, n = array_length(_tex); i < n; i++ )
|
||||
generateMesh(i);
|
||||
} else
|
||||
generateMesh();
|
||||
doUpdate();
|
||||
} });
|
||||
.setDisplay(VALUE_DISPLAY.button, { name: "Generate", onClick: function() { generateAllMesh(); } });
|
||||
|
||||
inputs[| 10] = nodeValue("Mesh expansion", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [ -2, 2, 0.1 ] })
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 11] = nodeValue("Texture type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Surface", "Atlas" ])
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 12] = nodeValue("Atlas", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, []);
|
||||
|
||||
outputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.output, VALUE_TYPE.rigid, self);
|
||||
|
||||
input_display_list = [ 8,
|
||||
["Texture", false], 6,
|
||||
["Texture", false], 11, 6, 12,
|
||||
["Physical", false], 0, 1, 2, 3, 4,
|
||||
["Shape", false], 5, 9, 10, 7,
|
||||
["Shape", false], 7, 5, 9, 10,
|
||||
];
|
||||
|
||||
static newMesh = function(index) {
|
||||
|
@ -74,7 +72,22 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
new NodeTool( "Anchor remove", THEME.mesh_tool_delete ),
|
||||
];
|
||||
|
||||
static getPreviewValues = function() { return getInputData(6); }
|
||||
static getPreviewValues = function() {
|
||||
var _typ = getInputData(11);
|
||||
return _typ? getInputData(12) : getInputData(6);
|
||||
}
|
||||
|
||||
static generateAllMesh = function() {
|
||||
var _typ = getInputData(11);
|
||||
var _tex = _typ? getInputData(12) : getInputData(6);
|
||||
|
||||
if(is_array(_tex)) {
|
||||
for( var i = 0, n = array_length(_tex); i < n; i++ )
|
||||
generateMesh(i);
|
||||
} else
|
||||
generateMesh();
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
is_convex = true;
|
||||
hover = -1;
|
||||
|
@ -84,71 +97,95 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
anchor_drag_mx = -1;
|
||||
anchor_drag_my = -1;
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var _shp = getInputData(5);
|
||||
var _box = getInputData(7);
|
||||
|
||||
static drawOverlayPreview = function(_i, _x, _y, _s, _pr_x, _pr_y, _atl_s, _tex_s) { #region
|
||||
var meshes = attributes.mesh;
|
||||
if(preview_index >= array_length(meshes)) return;
|
||||
var _shp = getInputData(5);
|
||||
var _typ = getInputData(11);
|
||||
|
||||
var ww = max(1, surface_get_width_safe(_tex_s));
|
||||
var hh = max(1, surface_get_height_safe(_tex_s));
|
||||
|
||||
if(_typ == 0) {
|
||||
_pr_x -= ww * _s / 2;
|
||||
_pr_y -= hh * _s / 2;
|
||||
} else if(_typ == 1) {
|
||||
_pr_x += _atl_s.x * _s;
|
||||
_pr_y += _atl_s.y * _s;
|
||||
}
|
||||
|
||||
if(_shp == 2 && array_length(meshes) > _i) {
|
||||
draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative);
|
||||
|
||||
var _m = meshes[_i];
|
||||
var _l = array_length(_m);
|
||||
|
||||
for( var i = 0; i < _l; i++ ) {
|
||||
var _px0 = _m[i][0];
|
||||
var _py0 = _m[i][1];
|
||||
var _px1 = _m[safe_mod(i + 1, _l)][0];
|
||||
var _py1 = _m[safe_mod(i + 1, _l)][1];
|
||||
|
||||
_px0 = _pr_x + _px0 * _s;
|
||||
_py0 = _pr_y + _py0 * _s;
|
||||
_px1 = _pr_x + _px1 * _s;
|
||||
_py1 = _pr_y + _py1 * _s;
|
||||
|
||||
draw_line_width(_px0, _py0, _px1, _py1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
draw_surface_ext_safe(_tex_s, _pr_x, _pr_y, _s, _s, 0, c_white, 0.5);
|
||||
} #endregion
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var _shp = getInputData(5);
|
||||
var _pos = getInputData(7);
|
||||
var _typ = getInputData(11);
|
||||
|
||||
var _typ = getInputData(11);
|
||||
var _atl = getInputData(12);
|
||||
var _tex = getInputData(6);
|
||||
|
||||
var _atl_s = _atl;
|
||||
var _tex_s = _tex;
|
||||
|
||||
var _isArr = false;
|
||||
|
||||
if(_typ == 0) {
|
||||
if(is_array(_tex)) {
|
||||
_tex_s = array_safe_get(_tex, preview_index);
|
||||
_isArr = true;
|
||||
}
|
||||
} else if(_typ == 1) {
|
||||
if(is_array(_atl)) {
|
||||
_atl_s = array_safe_get(_atl, preview_index);
|
||||
_isArr = true;
|
||||
}
|
||||
if(_atl_s == 0) return;
|
||||
_tex_s = _atl_s.getSurface();
|
||||
}
|
||||
|
||||
if(previewing == 0) {
|
||||
if(_shp == 2) {
|
||||
var _tex = getInputData(6);
|
||||
if(is_array(_tex)) _tex = _tex[safe_mod(preview_index, array_length(_tex))];
|
||||
var tw = surface_get_width_safe(_tex);
|
||||
var th = surface_get_height_safe(_tex);
|
||||
|
||||
draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative);
|
||||
|
||||
for( var j = 0; j < array_length(meshes); j++ ) {
|
||||
var _m = meshes[j];
|
||||
var _l = array_length(_m);
|
||||
|
||||
for( var i = 0; i < _l; i++ ) {
|
||||
var _px0 = _m[i][0];
|
||||
var _py0 = _m[i][1];
|
||||
var _px1 = _m[safe_mod(i + 1, _l)][0];
|
||||
var _py1 = _m[safe_mod(i + 1, _l)][1];
|
||||
|
||||
_px0 = (_px0 / tw) * 2 - 1;
|
||||
_py0 = (_py0 / th) * 2 - 1;
|
||||
_px1 = (_px1 / tw) * 2 - 1;
|
||||
_py1 = (_py1 / th) * 2 - 1;
|
||||
|
||||
_px0 = _box[0] + (_box[2]) * _px0;
|
||||
_py0 = _box[1] + (_box[3]) * _py0;
|
||||
_px1 = _box[0] + (_box[2]) * _px1;
|
||||
_py1 = _box[1] + (_box[3]) * _py1;
|
||||
|
||||
var _dx0 = _x + _px0 * _s;
|
||||
var _dy0 = _y + _py0 * _s;
|
||||
var _dx1 = _x + _px1 * _s;
|
||||
var _dy1 = _y + _py1 * _s;
|
||||
var _pr_x = _x + _pos[0] * _s;
|
||||
var _pr_y = _y + _pos[1] * _s;
|
||||
|
||||
draw_line_width(_dx0, _dy0, _dx1, _dy1, 1);
|
||||
}
|
||||
if(_isArr) {
|
||||
if(_typ == 0) {
|
||||
for( var i = 0, n = array_length(_tex); i < n; i++ )
|
||||
drawOverlayPreview(i, _x, _y, _s, _pr_x, _pr_y, noone, _tex[i]);
|
||||
} else {
|
||||
for( var i = 0, n = array_length(_atl); i < n; i++ )
|
||||
drawOverlayPreview(i, _x, _y, _s, _pr_x, _pr_y, _atl[i], _atl[i].getSurface());
|
||||
}
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
var x0 = _box[0] - _box[2];
|
||||
var x1 = _box[0] + _box[2];
|
||||
var y0 = _box[1] - _box[3];
|
||||
var y1 = _box[1] + _box[3];
|
||||
|
||||
x0 = _x + x0 * _s;
|
||||
x1 = _x + x1 * _s;
|
||||
y0 = _y + y0 * _s;
|
||||
y1 = _y + y1 * _s;
|
||||
|
||||
draw_rectangle(x0, y0, x1, y1, true);
|
||||
}
|
||||
|
||||
} else
|
||||
drawOverlayPreview(0, _x, _y, _s, _pr_x, _pr_y, _atl, _tex);
|
||||
inputs[| 7].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
return;
|
||||
}
|
||||
|
||||
if(_shp != 2) return;
|
||||
|
||||
var meshes = attributes.mesh;
|
||||
var _hover = -1, _side = 0;
|
||||
draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative);
|
||||
|
||||
|
@ -245,15 +282,20 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
anchor_drag_my = _my;
|
||||
}
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static generateMesh = function(index = 0) {
|
||||
static generateMesh = function(index = 0) { #region
|
||||
var _tex = getInputData(6);
|
||||
var _exp = getInputData(10);
|
||||
var _typ = getInputData(11);
|
||||
var _atl = getInputData(12);
|
||||
|
||||
if(is_array(_tex)) {
|
||||
index = safe_mod(index, array_length(_tex));
|
||||
_tex = _tex[index];
|
||||
if(_typ == 0) {
|
||||
if(is_array(_tex)) _tex = array_safe_get(_tex, index);
|
||||
} else if(_typ == 1) {
|
||||
if(is_array(_atl)) _atl = array_safe_get(_atl, index);
|
||||
if(_atl == 0) return;
|
||||
_tex = _atl.getSurface();
|
||||
}
|
||||
|
||||
if(!is_surface(_tex)) return;
|
||||
|
@ -367,9 +409,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
meshes[index] = mesh;
|
||||
attributes.mesh = meshes;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static removeColinear = function(mesh) {
|
||||
static removeColinear = function(mesh) { #region
|
||||
var len = array_length(mesh), _side = 0;
|
||||
var remSt = [];
|
||||
var tolerance = 5;
|
||||
|
@ -396,9 +438,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
return mesh;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static removeConcave = function(mesh) {
|
||||
static removeConcave = function(mesh) { #region
|
||||
var len = array_length(mesh);
|
||||
if(len <= 3) return;
|
||||
|
||||
|
@ -463,26 +505,15 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
|
||||
return mesh;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onValueUpdate = function(index = 0) {
|
||||
if(index == 5) {
|
||||
var _spos = getInputData(7);
|
||||
var _shape = getInputData(5);
|
||||
_spos[4] = _shape;
|
||||
inputs[| 7].setValue(_spos);
|
||||
}
|
||||
}
|
||||
|
||||
static fixtureCreate = function(fixture, object) {
|
||||
static fixtureCreate = function(fixture, object, dx = 0, dy = 0) { #region
|
||||
var _mov = getInputData(0);
|
||||
var _den = getInputData(1);
|
||||
var _cnt_frc = getInputData(2);
|
||||
var _air_frc = getInputData(3);
|
||||
var _rot_frc = getInputData(4);
|
||||
|
||||
var _spos = getInputData(7);
|
||||
|
||||
if(!_mov) {
|
||||
physics_fixture_set_kinematic(fixture);
|
||||
_den = 0;
|
||||
|
@ -496,32 +527,41 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(group != noone)
|
||||
physics_fixture_set_collision_group(fixture, group.collIndex);
|
||||
|
||||
array_push(object.fixture, physics_fixture_bind_ext(fixture, object, _spos[2], _spos[3]));
|
||||
array_push(object.fixture, physics_fixture_bind_ext(fixture, object, dx, dy));
|
||||
physics_fixture_delete(fixture);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static spawn = function(rpos = noone, index = 0, object = noone) {
|
||||
var _shp = getInputData(5);
|
||||
var _tex = getInputData(6);
|
||||
static spawn = function(index = 0, object = noone) { #region
|
||||
var _shp = getInputData(5);
|
||||
var _tex = getInputData(6);
|
||||
var _typ = getInputData(11);
|
||||
var _atl = getInputData(12);
|
||||
|
||||
if(is_array(_tex)) {
|
||||
index = safe_mod(index, array_length(_tex));
|
||||
_tex = _tex[index];
|
||||
} else
|
||||
index = 0;
|
||||
if(_typ == 0 && is_array(_tex)) { index = safe_mod(index, array_length(_tex)); _tex = array_safe_get(_tex, index); }
|
||||
if(_typ == 1 && is_array(_atl)) { index = safe_mod(index, array_length(_atl)); _atl = array_safe_get(_atl, index); }
|
||||
if(_typ == 1) {
|
||||
if(_atl == 0) return;
|
||||
_tex = _atl.getSurface();
|
||||
}
|
||||
|
||||
var _spos = getInputData(7);
|
||||
|
||||
var ww = max(1, surface_get_width_safe(_tex));
|
||||
var hh = max(1, surface_get_height_safe(_tex));
|
||||
var sw = ww, sh = hh;
|
||||
|
||||
var ox = rpos == noone? _spos[0] : rpos[0];
|
||||
var oy = rpos == noone? _spos[1] : rpos[1];
|
||||
var ox = _spos[0];
|
||||
var oy = _spos[1];
|
||||
|
||||
if(_typ == 1) {
|
||||
ox += _atl.x;
|
||||
oy += _atl.y;
|
||||
sw = 0;
|
||||
sh = 0;
|
||||
}
|
||||
|
||||
if(object == noone) {
|
||||
object = instance_create_depth(ox - _spos[2], oy - _spos[3], 0, oRigidbody);
|
||||
object.xscale = _spos[2] / ww * 2;
|
||||
object.yscale = _spos[3] / hh * 2;
|
||||
object = instance_create_depth(ox - sw / 2, oy - sh / 2, 0, oRigidbody);
|
||||
object.surface = _tex;
|
||||
} else if(instance_exists(object)) {
|
||||
for( var i = 0, n = array_length(object.fixture); i < n; i++ )
|
||||
|
@ -532,12 +572,17 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
if(_shp == 0) {
|
||||
var fixture = physics_fixture_create();
|
||||
physics_fixture_set_box_shape(fixture, _spos[2], _spos[3]);
|
||||
fixtureCreate(fixture, object);
|
||||
|
||||
physics_fixture_set_box_shape(fixture, ww / 2, hh / 2);
|
||||
|
||||
fixtureCreate(fixture, object, ww / 2, hh / 2);
|
||||
} else if(_shp == 1) {
|
||||
var fixture = physics_fixture_create();
|
||||
physics_fixture_set_circle_shape(fixture, min(_spos[2], _spos[3]));
|
||||
fixtureCreate(fixture, object);
|
||||
var rr = min(ww, hh) / 2;
|
||||
|
||||
physics_fixture_set_circle_shape(fixture, rr);
|
||||
|
||||
fixtureCreate(fixture, object, rr, rr);
|
||||
} else if(_shp == 2) {
|
||||
var meshes = attributes.mesh;
|
||||
if(array_safe_get(meshes, index, noone) == noone)
|
||||
|
@ -569,17 +614,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
cx /= len;
|
||||
cy /= len;
|
||||
|
||||
cmx = cx;
|
||||
cmy = cy;
|
||||
|
||||
cx = (cx / ww) * 2 - 1;
|
||||
cy = (cy / hh) * 2 - 1;
|
||||
|
||||
cx = _spos[2] * cx;
|
||||
cy = _spos[3] * cy;
|
||||
|
||||
if(!is_convex) return object;
|
||||
if(len < 3) return object;
|
||||
if(len < 3) return object;
|
||||
|
||||
if(len <= 8) {
|
||||
var fixture = physics_fixture_create();
|
||||
|
@ -589,16 +625,10 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
var _px0 = mesh[i][0];
|
||||
var _py0 = mesh[i][1];
|
||||
|
||||
_px0 = (_px0 / ww) * 2 - 1;
|
||||
_py0 = (_py0 / hh) * 2 - 1;
|
||||
|
||||
_px0 = _spos[2] * _px0;
|
||||
_py0 = _spos[3] * _py0;
|
||||
|
||||
physics_fixture_add_point(fixture, round(_px0), round(_py0));
|
||||
physics_fixture_add_point(fixture, _px0, _py0);
|
||||
}
|
||||
|
||||
fixtureCreate(fixture, object);
|
||||
fixtureCreate(fixture, object, -1, -1);
|
||||
} else {
|
||||
for( var i = 0; i < len; i++ ) {
|
||||
var fixture = physics_fixture_create();
|
||||
|
@ -608,43 +638,30 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
var _py0 = mesh[safe_mod(i + 0, len)][1];
|
||||
var _px1 = mesh[safe_mod(i + 1, len)][0];
|
||||
var _py1 = mesh[safe_mod(i + 1, len)][1];
|
||||
|
||||
_px0 = (_px0 / ww) * 2 - 1;
|
||||
_py0 = (_py0 / hh) * 2 - 1;
|
||||
_px1 = (_px1 / ww) * 2 - 1;
|
||||
_py1 = (_py1 / hh) * 2 - 1;
|
||||
|
||||
_px0 = _spos[2] * _px0;
|
||||
_py0 = _spos[3] * _py0;
|
||||
_px1 = _spos[2] * _px1;
|
||||
_py1 = _spos[3] * _py1;
|
||||
|
||||
var d0 = point_direction(cx, cy, _px0, _py0);
|
||||
var d1 = point_direction(cx, cy, _px1, _py1);
|
||||
|
||||
physics_fixture_add_point(fixture, cx, cy);
|
||||
physics_fixture_add_point(fixture, _px0, _py0);
|
||||
physics_fixture_add_point(fixture, _px1, _py1);
|
||||
|
||||
fixtureCreate(fixture, object);
|
||||
fixtureCreate(fixture, object, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
//with(object) physics_mass_properties(phy_mass, cmx, cmy, phy_inertia);
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = PROJECT.animator.current_frame) {
|
||||
if(!isAnimated()) return;
|
||||
|
||||
//for( var i = 0, n = array_length(object); i < n; i++ )
|
||||
// spawn(noone, i, object[i]);
|
||||
}
|
||||
static update = function(frame = PROJECT.animator.current_frame) { #region
|
||||
//
|
||||
} #endregion
|
||||
|
||||
static step = function() {
|
||||
static step = function() { #region
|
||||
var _shp = getInputData(5);
|
||||
var _tex = getInputData(11);
|
||||
|
||||
inputs[| 6].setVisible(_tex == 0, _tex == 0);
|
||||
inputs[| 12].setVisible(_tex == 1, _tex == 1);
|
||||
|
||||
inputs[| 9].setVisible(_shp == 2);
|
||||
|
||||
var _tex = getInputData(6);
|
||||
|
@ -655,10 +672,12 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
for( var i = array_length(meshes); i < array_length(_tex); i++ )
|
||||
newMesh(i);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static reset = function() {
|
||||
var _tex = getInputData(6);
|
||||
static reset = function() { #region
|
||||
var _typ = getInputData(11);
|
||||
var _tex = _typ? getInputData(12) : getInputData(6);
|
||||
|
||||
for( var i = 0, n = array_length(object); i < n; i++ ) {
|
||||
if(instance_exists(object[i]))
|
||||
instance_destroy(object[i]);
|
||||
|
@ -670,31 +689,35 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
if(is_array(_tex)) {
|
||||
for( var i = 0, n = array_length(_tex); i < n; i++ )
|
||||
object[i] = spawn(noone, i);
|
||||
object[i] = spawn(i);
|
||||
} else
|
||||
object = [ spawn() ];
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var _tex = getInputData(6);
|
||||
if(is_array(_tex) && array_length(_tex)) _tex = _tex[0];
|
||||
var _spos = getInputData(7);
|
||||
var _typ = getInputData(11);
|
||||
var _tex = _typ? getInputData(12) : getInputData(6);
|
||||
|
||||
draw_surface_stretch_fit(_tex, bbox.xc, bbox.yc, bbox.w, bbox.h, _spos[2], _spos[3]);
|
||||
}
|
||||
if(is_array(_tex)) {
|
||||
if(array_empty(_tex)) return;
|
||||
_tex = _tex[0];
|
||||
}
|
||||
|
||||
draw_surface_bbox(_typ? _tex.getSurface() : _tex, bbox);
|
||||
} #endregion
|
||||
|
||||
static attributeSerialize = function() {
|
||||
static attributeSerialize = function() { #region
|
||||
var att = {};
|
||||
|
||||
var mesh = struct_try_get(attributes, "mesh", []);
|
||||
att.mesh = json_stringify(mesh);
|
||||
|
||||
return att;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static attributeDeserialize = function(attr) {
|
||||
static attributeDeserialize = function(attr) { #region
|
||||
if(struct_has(attr, "mesh"))
|
||||
attributes.mesh = json_parse(attr.mesh);
|
||||
}
|
||||
} #endregion
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
name = "Render";
|
||||
name = "Render";
|
||||
color = COLORS.node_blend_simulation;
|
||||
icon = THEME.rigidSim;
|
||||
|
||||
use_cache = CACHE_USE.auto;
|
||||
update_on_frame = true;
|
||||
|
||||
inputs[| 0] = nodeValue("Render dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, DEF_SURF)
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
|
|
|
@ -66,7 +66,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
.rejectArrayProcess();
|
||||
|
||||
input_display_list = [
|
||||
|
@ -261,7 +261,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
var clr = color.eval(grSamp);
|
||||
var alp = random_range_seed(alpha[0], alpha[1], posS); posS++;
|
||||
|
||||
array_push(scatter_data, new SurfaceAtlas(surf, [ _x, _y ], _r, [ _scx, _scy ], clr, alp));
|
||||
array_push(scatter_data, new SurfaceAtlas(surf, _x, _y, _r, _scx, _scy, clr, alp));
|
||||
draw_surface_ext_safe(surf, _x, _y, _scx, _scy, _r, clr, alp);
|
||||
|
||||
if(_dist == 5) {
|
||||
|
|
|
@ -20,7 +20,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, []);
|
||||
outputs[| 1] = nodeValue("Atlas", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []);
|
||||
|
||||
input_display_list = [
|
||||
["Shape", false], 0, 1, 4,
|
||||
|
@ -28,7 +28,6 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
attribute_auto_execute(true);
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
|
||||
surface_buffer = buffer_create(1 * 1 * 4, buffer_fixed, 2);
|
||||
|
@ -53,8 +52,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
static onInspector1Update = function() { separateShape(); }
|
||||
|
||||
static update = function() {
|
||||
if(attributes.auto_exe)
|
||||
separateShape();
|
||||
separateShape();
|
||||
}
|
||||
|
||||
static separateShape = function() {
|
||||
|
@ -127,52 +125,52 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
outputs[| 0].setValue(_val);
|
||||
|
||||
var _atlas = array_create(px);
|
||||
var _pad = 0;
|
||||
|
||||
buffer_delete(surface_buffer);
|
||||
surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2);
|
||||
buffer_get_surface(surface_buffer, temp_surface[res_index], 0);
|
||||
|
||||
for(var i = 0; i < px; i++) {
|
||||
_outSurf = surface_create_valid(ww, hh);
|
||||
var ccx = surface_get_pixel_ext(_pixel_surface, 1 + i, 0);
|
||||
var alpha = (ccx >> 24) & 255;
|
||||
var blue = (ccx >> 16) & 255;
|
||||
var green = (ccx >> 8) & 255;
|
||||
var red = ccx & 255;
|
||||
|
||||
var min_x = floor(red / 255 * ww);
|
||||
var min_y = floor(green / 255 * hh);
|
||||
var max_x = ceil(blue / 255 * ww);
|
||||
var max_y = ceil(alpha / 255 * hh);
|
||||
var t = max_y;
|
||||
var b = min_y;
|
||||
var l = max_x;
|
||||
var r = min_x;
|
||||
|
||||
for( var j = min_x; j < max_x; j++ )
|
||||
for( var k = min_y; k < max_y; k++ ) {
|
||||
var _sc = get_color_buffer(j, k);
|
||||
if(_sc != ccx) continue;
|
||||
|
||||
t = min(t, k);
|
||||
b = max(b, k);
|
||||
l = min(l, j);
|
||||
r = max(r, j);
|
||||
}
|
||||
|
||||
_outSurf = surface_create_valid(r - l + 1 + _pad * 2, b - t + 1 + _pad * 2);
|
||||
_val[i] = _outSurf;
|
||||
|
||||
surface_set_shader(_outSurf, sh_seperate_shape_sep);
|
||||
var ccx = surface_get_pixel_ext(_pixel_surface, 1 + i, 0);
|
||||
var alpha = (ccx >> 24) & 255;
|
||||
var blue = (ccx >> 16) & 255;
|
||||
var green = (ccx >> 8) & 255;
|
||||
var red = ccx & 255;
|
||||
|
||||
var min_x = floor(red / 255 * ww);
|
||||
var min_y = floor(green / 255 * hh);
|
||||
var max_x = ceil(blue / 255 * ww);
|
||||
var max_y = ceil(alpha / 255 * hh);
|
||||
var t = max_y;
|
||||
var b = min_y;
|
||||
var l = max_x;
|
||||
var r = min_x;
|
||||
|
||||
for( var j = min_x; j < max_x; j++ )
|
||||
for( var k = min_y; k < max_y; k++ ) {
|
||||
var _sc = get_color_buffer(j, k);
|
||||
if(_sc != ccx) continue;
|
||||
|
||||
t = min(t, k);
|
||||
b = max(b, k);
|
||||
l = min(l, j);
|
||||
r = max(r, j);
|
||||
}
|
||||
|
||||
_atlas[i] = [l, t, r, b];
|
||||
//_atlas[i] = new SurfaceAtlas(_outSurf, [ r.x + _spac, r.y + _spac ]);
|
||||
|
||||
shader_set_surface("original", _inSurf);
|
||||
shader_set_f("color", red, green, blue, alpha);
|
||||
shader_set_i("override", _ovr);
|
||||
shader_set_f("overColor", colToVec4(_ovrclr));
|
||||
|
||||
draw_surface_safe(temp_surface[res_index], 0, 0);
|
||||
draw_surface_safe(temp_surface[res_index], -l + _pad, -t + _pad);
|
||||
surface_reset_shader();
|
||||
|
||||
_atlas[i] = new SurfaceAtlas(_outSurf, l, t).setOrginalSurface(_inSurf);
|
||||
}
|
||||
|
||||
outputs[| 1].setValue(_atlas);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "generator",
|
||||
"path": "folders/nodes/data/generator.yy",
|
||||
"name": "regions",
|
||||
"path": "folders/nodes/data/generator/regions.yy",
|
||||
},
|
||||
}
|
|
@ -23,7 +23,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, []);
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, []);
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
|
@ -126,7 +126,7 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
sy = hh / 2 - sh / 2;
|
||||
}
|
||||
|
||||
array_push(atlas, new SurfaceAtlas(_surf[j], [ sx, sy ]));
|
||||
array_push(atlas, new SurfaceAtlas(_surf[j], sx, sy));
|
||||
draw_surface_safe(_surf[j], sx, sy);
|
||||
|
||||
if(_axis == 0)
|
||||
|
|
|
@ -132,8 +132,9 @@ enum VALUE_UNIT {
|
|||
}
|
||||
|
||||
enum VALUE_TAG {
|
||||
updateTrigger = 1 << 0,
|
||||
none = 0
|
||||
updateInTrigger = -2,
|
||||
updateOutTrigger = -3,
|
||||
none = 0
|
||||
}
|
||||
|
||||
function value_color(i) { #region
|
||||
|
@ -186,7 +187,7 @@ function value_bit(i) { #region
|
|||
case VALUE_TYPE.color : return 1 << 4;
|
||||
case VALUE_TYPE.gradient : return 1 << 25;
|
||||
case VALUE_TYPE.dynaSurface :
|
||||
case VALUE_TYPE.surface : return 1 << 5;
|
||||
case VALUE_TYPE.surface : return 1 << 5 | 1 << 23;
|
||||
case VALUE_TYPE.path : return 1 << 10;
|
||||
case VALUE_TYPE.text : return 1 << 10;
|
||||
case VALUE_TYPE.object : return 1 << 13;
|
||||
|
@ -200,7 +201,6 @@ function value_bit(i) { #region
|
|||
case VALUE_TYPE.struct : return 1 << 19;
|
||||
case VALUE_TYPE.strands : return 1 << 20;
|
||||
case VALUE_TYPE.mesh : return 1 << 21;
|
||||
case VALUE_TYPE.atlas : return 1 << 23;
|
||||
case VALUE_TYPE.armature : return 1 << 26 | 1 << 19;
|
||||
|
||||
case VALUE_TYPE.node : return 1 << 32;
|
||||
|
@ -275,7 +275,6 @@ function value_type_from_string(str) { #region
|
|||
case "strands" : return VALUE_TYPE.strands;
|
||||
case "mesh" : return VALUE_TYPE.mesh;
|
||||
case "trigger" : return VALUE_TYPE.trigger;
|
||||
case "atlas" : return VALUE_TYPE.atlas;
|
||||
|
||||
case "d3vertex" : return VALUE_TYPE.d3vertex;
|
||||
case "gradient" : return VALUE_TYPE.gradient;
|
||||
|
@ -451,7 +450,7 @@ function nodeValueUnit(_nodeValue) constructor { #region
|
|||
function nodeValue(_name, _node, _connect, _type, _value, _tooltip = "") { return new NodeValue(_name, _node, _connect, _type, _value, _tooltip); }
|
||||
|
||||
function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constructor {
|
||||
static DISPLAY_DATA_KEYS = [ "linked", "angle_display", "bone_id", "area_type", "unit" ];
|
||||
static DISPLAY_DATA_KEYS = [ "linked", "angle_display", "bone_id", "area_type", "unit", "atlas_crop" ];
|
||||
|
||||
#region ---- main ----
|
||||
node = _node;
|
||||
|
@ -544,6 +543,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
draw_line_blend = 1;
|
||||
drawLineIndex = 1;
|
||||
draw_line_vb = noone;
|
||||
draw_junction_index = type;
|
||||
|
||||
junction_drawing = [ THEME.node_junctions_single, type ];
|
||||
|
||||
|
@ -566,9 +566,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
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;
|
||||
|
||||
display_data = {};
|
||||
display_attribute = noone;
|
||||
|
||||
display_data = { update: method(node, node.triggerRender) };
|
||||
display_attribute = noone;
|
||||
|
||||
popup_dialog = noone;
|
||||
#endregion
|
||||
|
@ -719,7 +719,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
editWidget = noone;
|
||||
switch(display_type) {
|
||||
case VALUE_DISPLAY.button : #region
|
||||
editWidget = button(display_data.onClick);
|
||||
editWidget = button(method(node, display_data.onClick));
|
||||
editWidget.text = display_data.name;
|
||||
if(!struct_has(display_data, "output")) display_data.output = false;
|
||||
|
||||
|
@ -1105,6 +1105,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
editWidget = new surfaceBox(function(ind) {
|
||||
return setValueDirect(ind);
|
||||
} );
|
||||
|
||||
if(!struct_has(display_data, "atlas")) display_data.atlas = true;
|
||||
show_in_inspector = true;
|
||||
extract_node = "Node_Canvas";
|
||||
break; #endregion
|
||||
|
@ -1311,6 +1313,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
var val = _getValue(_time, applyUnit, arrIndex, log);
|
||||
|
||||
draw_junction_index = type;
|
||||
if(type == VALUE_TYPE.surface) {
|
||||
var _sval = val;
|
||||
if(is_array(_sval) && !array_empty(_sval))
|
||||
_sval = _sval[0];
|
||||
if(is_instanceof(_sval, SurfaceAtlas))
|
||||
draw_junction_index = VALUE_TYPE.atlas;
|
||||
}
|
||||
|
||||
if(useCache) {
|
||||
is_changed = !isEqual(cache_value[2], val);
|
||||
cache_value[0] = true;
|
||||
|
@ -1498,7 +1509,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(array_length(v) >= 100) return $"[{array_length(v)}]";
|
||||
}
|
||||
|
||||
if(editWidget != noone && instanceof(editWidget) != "textArea" && string_length(string(val)) > 1024)
|
||||
if(editWidget != noone && instanceof(editWidget) == "textBox" && string_length(string(val)) > 1024)
|
||||
val = $"[Long string ({string_length(string(val))} char)]";
|
||||
|
||||
return val;
|
||||
|
@ -1568,8 +1579,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static setValue = function(val = 0, record = true, time = PROJECT.animator.current_frame, _update = true) { #region
|
||||
//if(type == VALUE_TYPE.d3vertex && !is_array(val))
|
||||
// print(val);
|
||||
val = unit.invApply(val);
|
||||
return setValueDirect(val, noone, record, time, _update);
|
||||
} #endregion
|
||||
|
@ -1605,26 +1614,36 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(type == VALUE_TYPE.gradient) updated = true;
|
||||
if(display_type == VALUE_DISPLAY.palette) updated = true;
|
||||
|
||||
if(updated) {
|
||||
if(connect_type == JUNCTION_CONNECT.input) {
|
||||
node.inputs_data[self.index] = animator.getValue(time);
|
||||
|
||||
node.triggerRender();
|
||||
if(_update) node.valueUpdate(self.index);
|
||||
node.clearCacheForward();
|
||||
|
||||
if(fullUpdate) RENDER_ALL
|
||||
else RENDER_PARTIAL
|
||||
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
}
|
||||
|
||||
cache_value[0] = false;
|
||||
if(!updated) return false;
|
||||
|
||||
draw_junction_index = type;
|
||||
if(type == VALUE_TYPE.surface) {
|
||||
var _sval = val;
|
||||
if(is_array(_sval) && !array_empty(_sval))
|
||||
_sval = _sval[0];
|
||||
if(is_instanceof(_sval, SurfaceAtlas))
|
||||
draw_junction_index = VALUE_TYPE.atlas;
|
||||
}
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output) return;
|
||||
|
||||
node.inputs_data[self.index] = animator.getValue(time);
|
||||
|
||||
if(tags != VALUE_TAG.none) return true;
|
||||
|
||||
node.triggerRender();
|
||||
if(_update) node.valueUpdate(self.index);
|
||||
node.clearCacheForward();
|
||||
|
||||
if(fullUpdate) RENDER_ALL
|
||||
else RENDER_PARTIAL
|
||||
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
|
||||
cache_value[0] = false;
|
||||
onValidate();
|
||||
|
||||
return updated;
|
||||
return true;
|
||||
} #endregion
|
||||
|
||||
static isConnectable = function(_valueFrom, checkRecur = true, log = false) { #region
|
||||
|
@ -1857,12 +1876,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(type == VALUE_TYPE.action)
|
||||
junction_drawing = [THEME.node_junction_inspector, 1];
|
||||
else
|
||||
junction_drawing = [isArray()? THEME.node_junctions_array_hover : THEME.node_junctions_single_hover, type];
|
||||
junction_drawing = [isArray()? THEME.node_junctions_array_hover : THEME.node_junctions_single_hover, draw_junction_index];
|
||||
} else {
|
||||
if(type == VALUE_TYPE.action)
|
||||
junction_drawing = [THEME.node_junction_inspector, 0];
|
||||
else
|
||||
junction_drawing = [isArray()? THEME.node_junctions_array : THEME.node_junctions_single, type];
|
||||
junction_drawing = [isArray()? THEME.node_junctions_array : THEME.node_junctions_single, draw_junction_index];
|
||||
}
|
||||
|
||||
draw_sprite_ext(junction_drawing[0], junction_drawing[1], x, y, ss, ss, 0, c_white, 1);
|
||||
|
@ -2130,20 +2149,17 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static isVisible = function() { #region
|
||||
if(!node.active)
|
||||
return false;
|
||||
|
||||
if(value_from)
|
||||
return true;
|
||||
if(!node.active) return false;
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.input) {
|
||||
if(!visible)
|
||||
return false;
|
||||
|
||||
if(is_array(node.input_display_list))
|
||||
return array_exists(node.input_display_list, index);
|
||||
}
|
||||
return visible;
|
||||
if(connect_type == JUNCTION_CONNECT.output)
|
||||
return visible || !ds_list_empty(value_to);
|
||||
|
||||
if(value_from) return true;
|
||||
if(!visible) return false;
|
||||
|
||||
if(is_array(node.input_display_list))
|
||||
return array_exists(node.input_display_list, index);
|
||||
return true;
|
||||
} #endregion
|
||||
|
||||
static extractNode = function(_type = extract_node) { #region
|
||||
|
@ -2201,7 +2217,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static getJunctionTo = function() { #region
|
||||
var to = [];
|
||||
var to = [];
|
||||
|
||||
for(var j = 0; j < ds_list_size(value_to); j++) {
|
||||
var _to = value_to[| j];
|
||||
|
@ -2250,10 +2266,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(!preset && value_from) {
|
||||
_map.from_node = value_from.node.node_id;
|
||||
|
||||
if(value_from.tags & VALUE_TAG.updateTrigger > 0)
|
||||
_map.from_index = -2;
|
||||
else
|
||||
_map.from_index = value_from.index;
|
||||
if(value_from.tags != 0) _map.from_index = value_from.tags;
|
||||
else _map.from_index = value_from.index;
|
||||
} else {
|
||||
_map.from_node = -1;
|
||||
_map.from_index = -1;
|
||||
|
@ -2349,9 +2363,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node);
|
||||
|
||||
if(con_index == -2) {
|
||||
setFrom(_nd.updatedTrigger);
|
||||
} else if(con_index < _ol) {
|
||||
if(con_index == VALUE_TAG.updateInTrigger) setFrom(_nd.updatedInTrigger);
|
||||
else if(con_index == VALUE_TAG.updateOutTrigger) setFrom(_nd.updatedOutTrigger);
|
||||
else if(con_index < _ol) {
|
||||
var _set = setFrom(_nd.outputs[| con_index], false, true);
|
||||
if(_set) return true;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ function sprite_pack_best_fit(rectangles) {
|
|||
return rect2.w * rect2.h - rect1.w * rect1.h;
|
||||
});
|
||||
|
||||
var area = new spriteAtlasData(0, 0, 0, 0);
|
||||
var area = new Rectangle(0, 0, 0, 0);
|
||||
|
||||
var grW = 1;
|
||||
var grH = 1;
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
function Strip(x, y, w, h) constructor {
|
||||
self.x = x;
|
||||
self.y = y;
|
||||
self.w = w;
|
||||
self.h = h;
|
||||
}
|
||||
|
||||
function sprite_pack_skyline(rectangles, width, height) {
|
||||
var maxw = 0;
|
||||
var maxh = 0;
|
||||
|
@ -13,7 +6,7 @@ function sprite_pack_skyline(rectangles, width, height) {
|
|||
return b.w - a.w;
|
||||
});
|
||||
|
||||
var skyline = [ new Strip(0, 0, width, height) ];
|
||||
var skyline = [ new Rectangle(0, 0, width, height) ];
|
||||
var packed = [];
|
||||
|
||||
for (var i = 0; i < array_length(rectangles); i++) {
|
||||
|
@ -39,10 +32,10 @@ function sprite_pack_skyline(rectangles, width, height) {
|
|||
array_push(packed, rect);
|
||||
|
||||
if (bestStrip.w > rect.w)
|
||||
array_push(skyline, new Strip(bestStrip.x + rect.w, bestStrip.y, bestStrip.w - rect.w, bestStrip.h));
|
||||
array_push(skyline, new Rectangle(bestStrip.x + rect.w, bestStrip.y, bestStrip.w - rect.w, bestStrip.h));
|
||||
|
||||
if (bestStrip.h > rect.h)
|
||||
array_push(skyline, new Strip(bestStrip.x, bestStrip.y + rect.h, rect.w, bestStrip.h - rect.h));
|
||||
array_push(skyline, new Rectangle(bestStrip.x, bestStrip.y + rect.h, rect.w, bestStrip.h - rect.h));
|
||||
|
||||
array_remove(skyline, bestStrip);
|
||||
|
||||
|
|
|
@ -212,17 +212,7 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
var wh = 0;
|
||||
var _data = PROJECT.attributes[$ param];
|
||||
|
||||
wh = editW.drawParam(new widgetParam(
|
||||
ui(16),
|
||||
yy,
|
||||
w - ui(16 + 48),
|
||||
TEXTBOX_HEIGHT,
|
||||
_data,
|
||||
{},
|
||||
_m,
|
||||
rx,
|
||||
ry,
|
||||
));
|
||||
wh = editW.drawParam(new widgetParam(ui(16), yy, w - ui(16 + 48), TEXTBOX_HEIGHT, _data, {}, _m, rx, ry));
|
||||
|
||||
yy += wh + ui(8);
|
||||
hh += wh + ui(8);
|
||||
|
|
|
@ -7,7 +7,6 @@ enum RENDER_TYPE {
|
|||
#region globalvar
|
||||
globalvar UPDATE, RENDER_QUEUE, RENDER_ORDER, UPDATE_RENDER_ORDER;
|
||||
UPDATE_RENDER_ORDER = false;
|
||||
|
||||
global.FLAG.render = 0;
|
||||
global.group_inputs = [ "Node_Group_Input", "Node_Feedback_Input", "Node_Iterator_Input", "Node_Iterator_Each_Input" ];
|
||||
|
||||
|
@ -117,6 +116,8 @@ function Render(partial = false, runAction = false) { #region
|
|||
|
||||
if(!_node.active) { LOG_IF(global.FLAG.render == 1, $"Skip inactive {_node.internalName}"); continue; }
|
||||
if(!_node.isRenderActive()) { LOG_IF(global.FLAG.render == 1, $"Skip non-renderActive {_node.internalName}"); continue; }
|
||||
if(!_node.attributes.update_graph) { LOG_IF(global.FLAG.render == 1, $"Skip non-auto update {_node.internalName}"); continue; }
|
||||
|
||||
if(_node.rendered && !_node.isAnimated()) {
|
||||
_node.anim_last_step = false;
|
||||
LOG_IF(global.FLAG.render == 1, $"Skip rendered {_node.internalName}");
|
||||
|
|
|
@ -38,6 +38,7 @@ function save_serialize(project = PROJECT, _outMap = false) {
|
|||
|
||||
_map.previewGrid = project.previewGrid;
|
||||
_map.graphGrid = project.graphGrid;
|
||||
_map.attributes = project.attributes;
|
||||
|
||||
var prev = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
if(!is_surface(prev)) _map.preview = "";
|
||||
|
|
|
@ -7,7 +7,6 @@ function struct_override(original, override) {
|
|||
var _key = args[i];
|
||||
|
||||
if(!struct_has(original, _key)) continue;
|
||||
|
||||
original[$ _key] = override[$ _key];
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,12 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
|||
open_ry = 0;
|
||||
|
||||
align = fa_center;
|
||||
display_data = {};
|
||||
|
||||
cb_atlas_crop = new checkBox(function() {
|
||||
display_data.atlas_crop = !display_data.atlas_crop;
|
||||
display_data.update();
|
||||
});
|
||||
|
||||
static trigger = function() {
|
||||
open = true;
|
||||
|
@ -16,11 +22,16 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
|||
}
|
||||
}
|
||||
|
||||
static drawParam = function(params) {
|
||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
|
||||
static setInteract = function(interactable) {
|
||||
self.interactable = interactable;
|
||||
cb_atlas_crop.interactable = true;
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _surface, _m, _rx, _ry) {
|
||||
static drawParam = function(params) {
|
||||
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m, params.rx, params.ry);
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _surface, _display_data, _m, _rx, _ry) {
|
||||
_h = ui(96);
|
||||
|
||||
x = _x;
|
||||
|
@ -29,13 +40,25 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
|||
h = _h;
|
||||
open_rx = _rx;
|
||||
open_ry = _ry;
|
||||
display_data = _display_data;
|
||||
|
||||
var hoverRect = point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h);
|
||||
var _type = VALUE_TYPE.surface;
|
||||
|
||||
var _surf_single = _surface;
|
||||
if(is_array(_surf_single) && !array_empty(_surf_single))
|
||||
_surf_single = _surf_single[0];
|
||||
|
||||
if(is_instanceof(_surf_single, dynaSurf)) {
|
||||
_type = VALUE_TYPE.dynaSurface;
|
||||
} else if(is_instanceof(_surf_single, SurfaceAtlas)) {
|
||||
_type = VALUE_TYPE.atlas;
|
||||
}
|
||||
|
||||
if(!open) {
|
||||
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);
|
||||
|
||||
if(hover && hoverRect) {
|
||||
if(_type == VALUE_TYPE.surface && hover && hoverRect) {
|
||||
draw_sprite_stretched(THEME.textbox, 1, _x, _y, _w, _h);
|
||||
if(mouse_press(mb_left, active))
|
||||
trigger();
|
||||
|
@ -72,9 +95,23 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
|||
draw_surface_ext_safe(_surface, _sx, _sy, ss, ss, 0, c_white, 1);
|
||||
}
|
||||
|
||||
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + _w - ui(20), _y + _h / 2, 1, COLORS._main_icon);
|
||||
if(_type == VALUE_TYPE.surface)
|
||||
draw_sprite_ui_uniform(THEME.scroll_box_arrow, 0, _x + _w - ui(20), _y + _h / 2, 1, COLORS._main_icon);
|
||||
}
|
||||
|
||||
//if(_type == VALUE_TYPE.atlas) {
|
||||
// draw_sprite_stretched_ext(THEME.ui_panel_inner_bg, 1, _x, _y + _h + ui(8), _w, ui(40), COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
// var set_y = _y + _h + ui(16);
|
||||
// var set_w = ui(64);
|
||||
// var set_h = ui(24);
|
||||
|
||||
// draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
||||
// draw_text_add(_x + ui(16), set_y + set_h / 2, __txt("Crop atlas"));
|
||||
|
||||
// cb_atlas_crop.drawParam(new widgetParam(_x + _w - set_w, set_y, set_w, set_h, display_data.atlas_crop,, _m, _rx, _ry));
|
||||
//}
|
||||
|
||||
if(WIDGET_CURRENT == self)
|
||||
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
|
||||
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
function draw_surface_safe(surface, _x = 0, _y = 0) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
|
||||
surface.draw(_x, _y);
|
||||
return;
|
||||
if(is_struct(surface)) {
|
||||
if(is_instanceof(surface, dynaSurf)) {
|
||||
surface.draw(_x, _y);
|
||||
return;
|
||||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -16,9 +19,12 @@ function draw_surface_safe(surface, _x = 0, _y = 0) {
|
|||
function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawStretch(_x, _y, _w, _h);
|
||||
return;
|
||||
if(is_struct(surface)) {
|
||||
if(is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawStretch(_x, _y, _w, _h);
|
||||
return;
|
||||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -30,9 +36,12 @@ function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
|
|||
function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
|
||||
surface.draw(_x, _y, _xs, _ys, _rot, _col, _alpha);
|
||||
return;
|
||||
if(is_struct(surface)) {
|
||||
if(is_instanceof(surface, dynaSurf)) {
|
||||
surface.draw(_x, _y, _xs, _ys, _rot, _col, _alpha);
|
||||
return;
|
||||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -44,9 +53,12 @@ function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col
|
|||
function draw_surface_tiled_safe(surface, _x, _y) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawTile(_x, _y);
|
||||
return;
|
||||
if(is_struct(surface)) {
|
||||
if(is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawTile(_x, _y);
|
||||
return;
|
||||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -58,9 +70,12 @@ function draw_surface_tiled_safe(surface, _x, _y) {
|
|||
function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c_white, _alpha = 1) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawTile(_x, _y, _xs, _ys, _col, _alpha);
|
||||
return;
|
||||
if(is_struct(surface)) {
|
||||
if(is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawTile(_x, _y, _xs, _ys, _col, _alpha);
|
||||
return;
|
||||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -72,9 +87,12 @@ function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c
|
|||
function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawPart(_l, _t, _w, _h, _x, _y, _xs, _ys, _rot, _col, _alpha);
|
||||
return;
|
||||
if(is_struct(surface)) {
|
||||
if(is_instanceof(surface, dynaSurf)) {
|
||||
surface.drawPart(_l, _t, _w, _h, _x, _y, _xs, _ys, _rot, _col, _alpha);
|
||||
return;
|
||||
} else if(is_instanceof(surface, SurfaceAtlas))
|
||||
surface = surface.getSurface();
|
||||
}
|
||||
if(!is_surface(surface)) return;
|
||||
|
||||
|
@ -131,23 +149,33 @@ function surface_save_safe(surface, path) {
|
|||
return;
|
||||
}
|
||||
|
||||
function surface_get_width_safe(s) {
|
||||
function surface_get_width_safe(s, crop = true) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
return (is_struct(s) && is_instanceof(s, dynaSurf))? s.getWidth() : surface_get_width(s);
|
||||
if(is_struct(s)) {
|
||||
if(is_instanceof(s, dynaSurf)) return s.getWidth();
|
||||
else if(is_instanceof(s, SurfaceAtlas)) return crop? surface_get_width(s.getSurface()) : s.oriSurf_w;
|
||||
}
|
||||
|
||||
return surface_get_width(s);
|
||||
}
|
||||
|
||||
function surface_get_height_safe(s) {
|
||||
function surface_get_height_safe(s, crop = true) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
return (is_struct(s) && is_instanceof(s, dynaSurf))? s.getHeight() : surface_get_height(s);
|
||||
if(is_struct(s)) {
|
||||
if(is_instanceof(s, dynaSurf)) return s.getHeight();
|
||||
else if(is_instanceof(s, SurfaceAtlas)) return crop? surface_get_height(s.getSurface()) : s.oriSurf_h;
|
||||
}
|
||||
|
||||
return surface_get_height(s);
|
||||
}
|
||||
|
||||
//check
|
||||
function is_surface(s) {
|
||||
gml_pragma("forceinline");
|
||||
|
||||
if(is_struct(s) && is_instanceof(s, dynaSurf)) return true;
|
||||
if(is_instanceof(s, dynaSurf) || is_instanceof(s, SurfaceAtlas)) return true;
|
||||
if(is_real(s) && s > 0 && surface_exists(s)) return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ void main() {
|
|||
|
||||
vec3 light_phong = phongLight(normal, lightVector, viewDirection, light_dir_color[i].rgb);
|
||||
|
||||
light_effect += light_phong;
|
||||
light_effect += light_phong * light_dir_intensity[i];
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -278,7 +278,7 @@ void main() {
|
|||
|
||||
vec3 light_phong = phongLight(normal, lightVector, viewDirection, light_pnt_color[i].rgb * light_attenuation);
|
||||
|
||||
light_effect += light_phong;
|
||||
light_effect += light_phong * light_pnt_intensity[i];
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -293,6 +293,8 @@ void main() {
|
|||
final_color.rgb *= light_effect;
|
||||
#endregion
|
||||
|
||||
if(final_color.a < 0.1) discard;
|
||||
|
||||
gl_FragData[0] = final_color;
|
||||
gl_FragData[1] = vec4(0.5 + normal * 0.5, final_color.a);
|
||||
gl_FragData[2] = vec4(vec3(v_cameraDistance), final_color.a);
|
||||
|
|
|
@ -12,6 +12,7 @@ void main() {
|
|||
vec2 uv_coord = v_vTexcoord;
|
||||
if(mat_flip == 1) uv_coord.y = -uv_coord.y;
|
||||
vec4 mat_baseColor = texture2D( gm_BaseTexture, uv_coord );
|
||||
if(mat_baseColor.a < 0.1) discard;
|
||||
|
||||
gl_FragData[0] = vec4(v_worldPosition.xyz, mat_baseColor.a);
|
||||
gl_FragData[1] = vec4(v_viewPosition, mat_baseColor.a);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
74
sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy
Normal file
74
sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_group_thumbnail",
|
||||
"bbox_bottom": 63,
|
||||
"bbox_left": 0,
|
||||
"bbox_right": 63,
|
||||
"bbox_top": 0,
|
||||
"bboxMode": 0,
|
||||
"collisionKind": 1,
|
||||
"collisionTolerance": 0,
|
||||
"DynamicTexturePage": false,
|
||||
"edgeFiltering": false,
|
||||
"For3D": false,
|
||||
"frames": [
|
||||
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"73969580-2c2a-4003-9463-a742cfdd83de",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"3033c2a9-6e3d-4798-a3e1-de1cb30c0402","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "misc",
|
||||
"path": "folders/nodes/icons/misc.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_group_thumbnail",
|
||||
"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":"73969580-2c2a-4003-9463-a742cfdd83de","path":"sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy",},},},"Disabled":false,"id":"1e629b24-d265-4813-8896-966f6d27dcd4","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