tile system pass 1
|
@ -404,9 +404,10 @@
|
|||
{"name":"__shapes","order":3,"path":"scripts/__shapes/__shapes.yy",},
|
||||
{"name":"__strandSim","order":2,"path":"scripts/__strandSim/__strandSim.yy",},
|
||||
{"name":"__surface","order":7,"path":"scripts/__surface/__surface.yy",},
|
||||
{"name":"__tiler_animated","order":1,"path":"scripts/__tiler_animated/__tiler_animated.yy",},
|
||||
{"name":"__tiler_autotile","order":6,"path":"scripts/__tiler_autotile/__tiler_autotile.yy",},
|
||||
{"name":"__tiler_brush","order":1,"path":"scripts/__tiler_brush/__tiler_brush.yy",},
|
||||
{"name":"__tiler_tool","order":1,"path":"scripts/__tiler_tool/__tiler_tool.yy",},
|
||||
{"name":"__tiler_brush","order":2,"path":"scripts/__tiler_brush/__tiler_brush.yy",},
|
||||
{"name":"__tiler_tool","order":2,"path":"scripts/__tiler_tool/__tiler_tool.yy",},
|
||||
{"name":"__vec2","order":7,"path":"scripts/__vec2/__vec2.yy",},
|
||||
{"name":"__vec3","order":8,"path":"scripts/__vec3/__vec3.yy",},
|
||||
{"name":"__vec4","order":9,"path":"scripts/__vec4/__vec4.yy",},
|
||||
|
@ -1171,6 +1172,7 @@
|
|||
{"name":"node_threshold","order":9,"path":"scripts/node_threshold/node_threshold.yy",},
|
||||
{"name":"node_tile_random","order":16,"path":"scripts/node_tile_random/node_tile_random.yy",},
|
||||
{"name":"node_tile","order":5,"path":"scripts/node_tile/node_tile.yy",},
|
||||
{"name":"node_tiler_tileset","order":3,"path":"scripts/node_tiler_tileset/node_tiler_tileset.yy",},
|
||||
{"name":"node_time_remap","order":3,"path":"scripts/node_time_remap/node_time_remap.yy",},
|
||||
{"name":"node_timeline_preview","order":2,"path":"scripts/node_timeline_preview/node_timeline_preview.yy",},
|
||||
{"name":"node_to_number","order":14,"path":"scripts/node_to_number/node_to_number.yy",},
|
||||
|
@ -1218,6 +1220,7 @@
|
|||
{"name":"node_value_struct","order":7,"path":"scripts/node_value_struct/node_value_struct.yy",},
|
||||
{"name":"node_value_surface","order":9,"path":"scripts/node_value_surface/node_value_surface.yy",},
|
||||
{"name":"node_value_text","order":14,"path":"scripts/node_value_text/node_value_text.yy",},
|
||||
{"name":"node_value_tileset","order":9,"path":"scripts/node_value_tileset/node_value_tileset.yy",},
|
||||
{"name":"node_value_toggle","order":21,"path":"scripts/node_value_toggle/node_value_toggle.yy",},
|
||||
{"name":"node_value_trigger","order":19,"path":"scripts/node_value_trigger/node_value_trigger.yy",},
|
||||
{"name":"node_value_types","order":2,"path":"scripts/node_value_types/node_value_types.yy",},
|
||||
|
@ -1285,6 +1288,7 @@
|
|||
{"name":"panel_collection","order":1,"path":"scripts/panel_collection/panel_collection.yy",},
|
||||
{"name":"panel_color","order":1,"path":"scripts/panel_color/panel_color.yy",},
|
||||
{"name":"panel_console","order":6,"path":"scripts/panel_console/panel_console.yy",},
|
||||
{"name":"panel_custom_inspector","order":5,"path":"scripts/panel_custom_inspector/panel_custom_inspector.yy",},
|
||||
{"name":"panel_display_additional","order":10,"path":"scripts/panel_display_additional/panel_display_additional.yy",},
|
||||
{"name":"panel_file_explorer","order":12,"path":"scripts/panel_file_explorer/panel_file_explorer.yy",},
|
||||
{"name":"panel_function","order":1,"path":"scripts/panel_function/panel_function.yy",},
|
||||
|
@ -1380,11 +1384,12 @@
|
|||
{"name":"textInput","order":3,"path":"scripts/textInput/textInput.yy",},
|
||||
{"name":"texture_set_repeat","order":1,"path":"scripts/texture_set_repeat/texture_set_repeat.yy",},
|
||||
{"name":"theme_definition","order":14,"path":"scripts/theme_definition/theme_definition.yy",},
|
||||
{"name":"tiler_tool_brush_shape","order":3,"path":"scripts/tiler_tool_brush_shape/tiler_tool_brush_shape.yy",},
|
||||
{"name":"tiler_tool_brush","order":1,"path":"scripts/tiler_tool_brush/tiler_tool_brush.yy",},
|
||||
{"name":"tiler_tool_fill","order":2,"path":"scripts/tiler_tool_fill/tiler_tool_fill.yy",},
|
||||
{"name":"tiler_tool_selection_shape","order":5,"path":"scripts/tiler_tool_selection_shape/tiler_tool_selection_shape.yy",},
|
||||
{"name":"tiler_tool_selection","order":4,"path":"scripts/tiler_tool_selection/tiler_tool_selection.yy",},
|
||||
{"name":"tiler_tool_brush_shape","order":4,"path":"scripts/tiler_tool_brush_shape/tiler_tool_brush_shape.yy",},
|
||||
{"name":"tiler_tool_brush","order":2,"path":"scripts/tiler_tool_brush/tiler_tool_brush.yy",},
|
||||
{"name":"tiler_tool_fill","order":3,"path":"scripts/tiler_tool_fill/tiler_tool_fill.yy",},
|
||||
{"name":"tiler_tool_selection_shape","order":6,"path":"scripts/tiler_tool_selection_shape/tiler_tool_selection_shape.yy",},
|
||||
{"name":"tiler_tool_selection","order":5,"path":"scripts/tiler_tool_selection/tiler_tool_selection.yy",},
|
||||
{"name":"tilesetBox","order":16,"path":"scripts/tilesetBox/tilesetBox.yy",},
|
||||
{"name":"time_source","order":25,"path":"scripts/time_source/time_source.yy",},
|
||||
{"name":"timeline_data","order":18,"path":"scripts/timeline_data/timeline_data.yy",},
|
||||
{"name":"toggleGroup","order":7,"path":"scripts/toggleGroup/toggleGroup.yy",},
|
||||
|
@ -2302,13 +2307,13 @@
|
|||
{"name":"s_node_junction_inspector","order":19,"path":"sprites/s_node_junction_inspector/s_node_junction_inspector.yy",},
|
||||
{"name":"s_node_junction_name_bg","order":20,"path":"sprites/s_node_junction_name_bg/s_node_junction_name_bg.yy",},
|
||||
{"name":"s_node_junction_selecting","order":33,"path":"sprites/s_node_junction_selecting/s_node_junction_selecting.yy",},
|
||||
{"name":"s_node_junctions_bg_2x","order":11,"path":"sprites/s_node_junctions_bg_2x/s_node_junctions_bg_2x.yy",},
|
||||
{"name":"s_node_junctions_bg","order":12,"path":"sprites/s_node_junctions_bg/s_node_junctions_bg.yy",},
|
||||
{"name":"s_node_junctions_outline_2x","order":13,"path":"sprites/s_node_junctions_outline_2x/s_node_junctions_outline_2x.yy",},
|
||||
{"name":"s_node_junctions_outline_hover_2x","order":14,"path":"sprites/s_node_junctions_outline_hover_2x/s_node_junctions_outline_hover_2x.yy",},
|
||||
{"name":"s_node_junctions_outline_hover","order":15,"path":"sprites/s_node_junctions_outline_hover/s_node_junctions_outline_hover.yy",},
|
||||
{"name":"s_node_junctions_outline","order":16,"path":"sprites/s_node_junctions_outline/s_node_junctions_outline.yy",},
|
||||
{"name":"s_node_junctions_single","order":17,"path":"sprites/s_node_junctions_single/s_node_junctions_single.yy",},
|
||||
{"name":"s_node_junctions_bg_2x","order":37,"path":"sprites/s_node_junctions_bg_2x/s_node_junctions_bg_2x.yy",},
|
||||
{"name":"s_node_junctions_bg","order":38,"path":"sprites/s_node_junctions_bg/s_node_junctions_bg.yy",},
|
||||
{"name":"s_node_junctions_outline_2x","order":35,"path":"sprites/s_node_junctions_outline_2x/s_node_junctions_outline_2x.yy",},
|
||||
{"name":"s_node_junctions_outline_hover_2x","order":39,"path":"sprites/s_node_junctions_outline_hover_2x/s_node_junctions_outline_hover_2x.yy",},
|
||||
{"name":"s_node_junctions_outline_hover","order":40,"path":"sprites/s_node_junctions_outline_hover/s_node_junctions_outline_hover.yy",},
|
||||
{"name":"s_node_junctions_outline","order":36,"path":"sprites/s_node_junctions_outline/s_node_junctions_outline.yy",},
|
||||
{"name":"s_node_junctions_single","order":34,"path":"sprites/s_node_junctions_single/s_node_junctions_single.yy",},
|
||||
{"name":"s_node_kuwahara","order":31,"path":"sprites/s_node_kuwahara/s_node_kuwahara.yy",},
|
||||
{"name":"s_node_level_selector","order":33,"path":"sprites/s_node_level_selector/s_node_level_selector.yy",},
|
||||
{"name":"s_node_level","order":32,"path":"sprites/s_node_level/s_node_level.yy",},
|
||||
|
@ -2563,6 +2568,8 @@
|
|||
{"name":"s_node_texture_map","order":53,"path":"sprites/s_node_texture_map/s_node_texture_map.yy",},
|
||||
{"name":"s_node_threshold","order":54,"path":"sprites/s_node_threshold/s_node_threshold.yy",},
|
||||
{"name":"s_node_tile_random","order":22,"path":"sprites/s_node_tile_random/s_node_tile_random.yy",},
|
||||
{"name":"s_node_tileset_drawer","order":41,"path":"sprites/s_node_tileset_drawer/s_node_tileset_drawer.yy",},
|
||||
{"name":"s_node_tileset","order":40,"path":"sprites/s_node_tileset/s_node_tileset.yy",},
|
||||
{"name":"s_node_time_map","order":55,"path":"sprites/s_node_time_map/s_node_time_map.yy",},
|
||||
{"name":"s_node_timeline_preview","order":2,"path":"sprites/s_node_timeline_preview/s_node_timeline_preview.yy",},
|
||||
{"name":"s_node_to_number","order":11,"path":"sprites/s_node_to_number/s_node_to_number.yy",},
|
||||
|
|
|
@ -893,6 +893,7 @@
|
|||
{"id":{"name":"__shapes","path":"scripts/__shapes/__shapes.yy",},},
|
||||
{"id":{"name":"__strandSim","path":"scripts/__strandSim/__strandSim.yy",},},
|
||||
{"id":{"name":"__surface","path":"scripts/__surface/__surface.yy",},},
|
||||
{"id":{"name":"__tiler_animated","path":"scripts/__tiler_animated/__tiler_animated.yy",},},
|
||||
{"id":{"name":"__tiler_autotile","path":"scripts/__tiler_autotile/__tiler_autotile.yy",},},
|
||||
{"id":{"name":"__tiler_brush","path":"scripts/__tiler_brush/__tiler_brush.yy",},},
|
||||
{"id":{"name":"__tiler_tool","path":"scripts/__tiler_tool/__tiler_tool.yy",},},
|
||||
|
@ -1773,6 +1774,7 @@
|
|||
{"id":{"name":"node_threshold","path":"scripts/node_threshold/node_threshold.yy",},},
|
||||
{"id":{"name":"node_tile_random","path":"scripts/node_tile_random/node_tile_random.yy",},},
|
||||
{"id":{"name":"node_tile","path":"scripts/node_tile/node_tile.yy",},},
|
||||
{"id":{"name":"node_tiler_tileset","path":"scripts/node_tiler_tileset/node_tiler_tileset.yy",},},
|
||||
{"id":{"name":"node_tiler","path":"scripts/node_tiler/node_tiler.yy",},},
|
||||
{"id":{"name":"node_time_remap","path":"scripts/node_time_remap/node_time_remap.yy",},},
|
||||
{"id":{"name":"node_timeline_preview","path":"scripts/node_timeline_preview/node_timeline_preview.yy",},},
|
||||
|
@ -1828,6 +1830,7 @@
|
|||
{"id":{"name":"node_value_struct","path":"scripts/node_value_struct/node_value_struct.yy",},},
|
||||
{"id":{"name":"node_value_surface","path":"scripts/node_value_surface/node_value_surface.yy",},},
|
||||
{"id":{"name":"node_value_text","path":"scripts/node_value_text/node_value_text.yy",},},
|
||||
{"id":{"name":"node_value_tileset","path":"scripts/node_value_tileset/node_value_tileset.yy",},},
|
||||
{"id":{"name":"node_value_toggle","path":"scripts/node_value_toggle/node_value_toggle.yy",},},
|
||||
{"id":{"name":"node_value_trigger","path":"scripts/node_value_trigger/node_value_trigger.yy",},},
|
||||
{"id":{"name":"node_value_types","path":"scripts/node_value_types/node_value_types.yy",},},
|
||||
|
@ -1904,6 +1907,7 @@
|
|||
{"id":{"name":"panel_collections_settings","path":"scripts/panel_collections_settings/panel_collections_settings.yy",},},
|
||||
{"id":{"name":"panel_color","path":"scripts/panel_color/panel_color.yy",},},
|
||||
{"id":{"name":"panel_console","path":"scripts/panel_console/panel_console.yy",},},
|
||||
{"id":{"name":"panel_custom_inspector","path":"scripts/panel_custom_inspector/panel_custom_inspector.yy",},},
|
||||
{"id":{"name":"panel_data","path":"scripts/panel_data/panel_data.yy",},},
|
||||
{"id":{"name":"panel_display_additional","path":"scripts/panel_display_additional/panel_display_additional.yy",},},
|
||||
{"id":{"name":"panel_file_explorer","path":"scripts/panel_file_explorer/panel_file_explorer.yy",},},
|
||||
|
@ -2028,6 +2032,7 @@
|
|||
{"id":{"name":"tiler_tool_fill","path":"scripts/tiler_tool_fill/tiler_tool_fill.yy",},},
|
||||
{"id":{"name":"tiler_tool_selection_shape","path":"scripts/tiler_tool_selection_shape/tiler_tool_selection_shape.yy",},},
|
||||
{"id":{"name":"tiler_tool_selection","path":"scripts/tiler_tool_selection/tiler_tool_selection.yy",},},
|
||||
{"id":{"name":"tilesetBox","path":"scripts/tilesetBox/tilesetBox.yy",},},
|
||||
{"id":{"name":"time_source","path":"scripts/time_source/time_source.yy",},},
|
||||
{"id":{"name":"timeline_data","path":"scripts/timeline_data/timeline_data.yy",},},
|
||||
{"id":{"name":"timer_function","path":"scripts/timer_function/timer_function.yy",},},
|
||||
|
@ -3311,6 +3316,8 @@
|
|||
{"id":{"name":"s_node_texture_map","path":"sprites/s_node_texture_map/s_node_texture_map.yy",},},
|
||||
{"id":{"name":"s_node_threshold","path":"sprites/s_node_threshold/s_node_threshold.yy",},},
|
||||
{"id":{"name":"s_node_tile_random","path":"sprites/s_node_tile_random/s_node_tile_random.yy",},},
|
||||
{"id":{"name":"s_node_tileset_drawer","path":"sprites/s_node_tileset_drawer/s_node_tileset_drawer.yy",},},
|
||||
{"id":{"name":"s_node_tileset","path":"sprites/s_node_tileset/s_node_tileset.yy",},},
|
||||
{"id":{"name":"s_node_time_map","path":"sprites/s_node_time_map/s_node_time_map.yy",},},
|
||||
{"id":{"name":"s_node_timeline_preview","path":"sprites/s_node_timeline_preview/s_node_timeline_preview.yy",},},
|
||||
{"id":{"name":"s_node_to_number","path":"sprites/s_node_to_number/s_node_to_number.yy",},},
|
||||
|
|
9
scripts/__tiler_animated/__tiler_animated.gml
Normal file
|
@ -0,0 +1,9 @@
|
|||
function tiler_brush_animated(_index) constructor {
|
||||
name = "animated";
|
||||
index = _index;
|
||||
|
||||
preview_surface = noone;
|
||||
preview_surface_tile = noone;
|
||||
|
||||
open = false;
|
||||
}
|
14
scripts/__tiler_animated/__tiler_animated.yy
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"__tiler_animated",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"__tiler_animated",
|
||||
"parent":{
|
||||
"name":"tools",
|
||||
"path":"folders/nodes/data/tiler/tools.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
"tags":[],
|
||||
}
|
|
@ -28,6 +28,8 @@ function tiler_brush_autotile(_type, _index) constructor {
|
|||
var _dim = surface_get_dimension(surface);
|
||||
drawing_surface = surface_verify(drawing_surface, _dim[0], _dim[1], surface_r8unorm);
|
||||
|
||||
//print($"Drawing start {surface} | {drawing_surface}");
|
||||
|
||||
draw_set_color(c_white);
|
||||
surface_set_target(drawing_surface);
|
||||
DRAW_CLEAR
|
||||
|
|
|
@ -3,7 +3,6 @@ function tiler_brush(node) constructor {
|
|||
brush_indices = [[]];
|
||||
brush_width = 0;
|
||||
brush_height = 0;
|
||||
brush_varient = 0;
|
||||
brush_surface = noone;
|
||||
brush_erase = false;
|
||||
autotiler = noone;
|
||||
|
@ -59,8 +58,10 @@ function tiler_draw_point_brush(brush, _x, _y, _shader = true) {
|
|||
|
||||
for( var i = 0, n = brush.brush_height; i < n; i++ )
|
||||
for( var j = 0, m = brush.brush_width; j < m; j++ ) {
|
||||
shader_set_f("index", brush.brush_erase? -1 : brush.brush_indices[i][j]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : brush.brush_varient);
|
||||
var _b = brush.brush_indices[i][j];
|
||||
|
||||
shader_set_f("index", brush.brush_erase? -1 : _b[0]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : _b[1]);
|
||||
|
||||
var _xx = _x + j;
|
||||
var _yy = _y + i;
|
||||
|
@ -86,8 +87,10 @@ function tiler_draw_line_brush(brush, _x0, _y0, _x1, _y1, _shader = true) {
|
|||
|
||||
for( var i = 0, n = brush.brush_height; i < n; i++ )
|
||||
for( var j = 0, m = brush.brush_width; j < m; j++ ) {
|
||||
shader_set_f("index", brush.brush_erase? -1 : brush.brush_indices[i][j]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : brush.brush_varient);
|
||||
var _b = brush.brush_indices[i][j];
|
||||
|
||||
shader_set_f("index", brush.brush_erase? -1 : _b[0]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : _b[1]);
|
||||
|
||||
var _xx0 = _x0 + j;
|
||||
var _yy0 = _y0 + i;
|
||||
|
@ -143,13 +146,29 @@ function tiler_draw_rect_brush(brush, _x0, _y0, _x1, _y1, _fill, _shader = true)
|
|||
var _may_y = max(_y0, _y1);
|
||||
|
||||
if(_fill) {
|
||||
if(_shader) { shader_set(sh_draw_tile_brush); BLEND_OVERRIDE shader_set_f("index", brush.brush_indices[0][0]); shader_set_f("varient", brush.brush_varient); }
|
||||
if(_shader) {
|
||||
shader_set(sh_draw_tile_brush);
|
||||
BLEND_OVERRIDE
|
||||
var _b = brush.brush_indices[0][0];
|
||||
|
||||
shader_set_f("index", brush.brush_erase? -1 : _b[0]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : _b[1]);
|
||||
}
|
||||
|
||||
draw_rectangle(_min_x, _min_y, _max_x, _may_y, 0);
|
||||
if(_shader) { BLEND_NORMAL shader_reset(); }
|
||||
}
|
||||
|
||||
if(brush.brush_size == 1) {
|
||||
if(_shader) { shader_set(sh_draw_tile_brush); BLEND_OVERRIDE shader_set_f("index", brush.brush_indices[0][0]); shader_set_f("varient", brush.brush_varient); }
|
||||
if(_shader) {
|
||||
shader_set(sh_draw_tile_brush);
|
||||
BLEND_OVERRIDE
|
||||
var _b = brush.brush_indices[0][0];
|
||||
|
||||
shader_set_f("index", brush.brush_erase? -1 : _b[0]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : _b[1]);
|
||||
}
|
||||
|
||||
draw_rectangle(_min_x + 1, _min_y + 1, _max_x - 1, _may_y - 1, 1);
|
||||
if(_shader) { BLEND_NORMAL shader_reset(); }
|
||||
|
||||
|
@ -185,7 +204,14 @@ function tiler_draw_ellp_brush(brush, _x0, _y0, _x1, _y1, _fill, _shader = true)
|
|||
var _min_y = min(_y0, _y1) - 0.5;
|
||||
var _max_y = max(_y0, _y1) - 0.5;
|
||||
|
||||
if(_shader) { shader_set(sh_draw_tile_brush); BLEND_OVERRIDE shader_set_f("index", brush.brush_indices[0][0]); shader_set_f("varient", brush.brush_varient); }
|
||||
if(_shader) {
|
||||
shader_set(sh_draw_tile_brush);
|
||||
BLEND_OVERRIDE
|
||||
var _b = brush.brush_indices[0][0];
|
||||
|
||||
shader_set_f("index", brush.brush_erase? -1 : _b[0]);
|
||||
shader_set_f("varient", brush.brush_erase? 0 : _b[1]);
|
||||
}
|
||||
|
||||
if(_fill) draw_ellipse(_min_x, _min_y, _max_x, _max_y, 0);
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
toggled = false;
|
||||
context = noone;
|
||||
|
||||
base_spr = THEME.button_def;
|
||||
|
||||
static setContext = function(struct) { onClick = method(struct, onClick); return self; }
|
||||
|
||||
static setLua = function(_lua_thread, _lua_key, _lua_func) {
|
||||
|
@ -53,6 +55,11 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
return self;
|
||||
}
|
||||
|
||||
static setBaseSprite = function(_baseSpr) {
|
||||
base_spr = _baseSpr;
|
||||
return self;
|
||||
}
|
||||
|
||||
static setText = function(_text) { text = _text; return self; }
|
||||
static setTooltip = function(_tip) { tooltip = _tip; return self; }
|
||||
|
||||
|
@ -62,7 +69,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
return draw(params.x, params.y, params.w, params.h, params.m);
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _m, spr = THEME.button_def, blend = c_white) {
|
||||
static draw = function(_x, _y, _w, _h, _m, spr = base_spr, blend = c_white) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
LATEST_VERSION = 1_18_00_0;
|
||||
VERSION = 1_18_01_0;
|
||||
SAVE_VERSION = 1_18_02_0;
|
||||
VERSION_STRING = MAC? "1.18.003m" : "1.18.3.003";
|
||||
VERSION_STRING = MAC? "1.18.003m" : "1.18.3.004";
|
||||
BUILD_NUMBER = 1_18_01_0;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
|
|
|
@ -528,7 +528,8 @@ function __initNodes() {
|
|||
addNodeObject(input, "Canvas", s_node_canvas, "Node_Canvas", [1, Node_Canvas], ["draw"], "Draw on surface using brush, eraser, etc.");
|
||||
addNodeObject(input, "Canvas Group", s_node_canvas_group, "Node_Canvas_Group", [1, Node_Canvas_Group],, "Create a group that combines multiple canvas nodes a layers.").setVersion(11740);
|
||||
addNodeObject(input, "Active Canvas", s_node_active_canvas, "Node_Active_Canvas", [1, Node_Active_Canvas], ["draw"], "Draw using parameterized brush.").setVersion(11570);
|
||||
/**/ addNodeObject(input, "Tile Drawer", s_node_svg, "Node_Tile_Drawer", [1, Node_Tile_Drawer],, "Draw using tileset.").setVersion(1_18_02_0);
|
||||
addNodeObject(input, "Tileset", s_node_tileset, "Node_Tile_Tileset", [1, Node_Tile_Tileset],, "Create tileset object.").setVersion(1_18_02_0);
|
||||
addNodeObject(input, "Tile Drawer", s_node_tileset_drawer, "Node_Tile_Drawer", [1, Node_Tile_Drawer],, "Draw using tileset.").setVersion(1_18_02_0);
|
||||
|
||||
ds_list_add(input, "Files");
|
||||
addNodeObject(input, "Text File In", s_node_text_file_read, "Node_Text_File_Read", [1, Node_Text_File_Read], ["txt"], "Load .txt in as text.").setVersion(1080);
|
||||
|
|
|
@ -2,595 +2,20 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
name = "Tile Drawer";
|
||||
bypass_grid = true;
|
||||
|
||||
renaming = noone;
|
||||
rename_text = "";
|
||||
tb_rename = new textBox(TEXTBOX_INPUT.text, function(_name) {
|
||||
if(renaming == noone) return;
|
||||
renaming.name = _name;
|
||||
renaming = noone;
|
||||
});
|
||||
tb_rename.font = f_p2;
|
||||
tb_rename.hide = true;
|
||||
tileset = noone;
|
||||
|
||||
newInput( 0, nodeValue_Surface("Tileset", self, noone));
|
||||
newInput( 0, nodeValue_Tileset("Tileset", self, noone))
|
||||
.setVisible(true, true);
|
||||
|
||||
newInput( 1, nodeValue_IVec2("Map size", self, [ 16, 16 ]));
|
||||
|
||||
newInput( 2, nodeValue_Vec2("Tile size", self, [ 16, 16 ]));
|
||||
newInput( 2, nodeValue_Bool("Animated", self, false));
|
||||
|
||||
#region tile selector
|
||||
tile_selector_surface = 0;
|
||||
tile_selector_mask = 0;
|
||||
tile_selector_h = ui(320);
|
||||
|
||||
tile_selector_x = 0;
|
||||
tile_selector_y = 0;
|
||||
tile_selector_s = 2;
|
||||
tile_selector_s_to = 2;
|
||||
|
||||
tile_dragging = false;
|
||||
tile_drag_sx = 0;
|
||||
tile_drag_sy = 0;
|
||||
tile_drag_mx = 0;
|
||||
tile_drag_my = 0;
|
||||
|
||||
selecting_surface = noone;
|
||||
selecting_surface_tile = noone;
|
||||
|
||||
tile_selecting = false;
|
||||
tile_select_ss = [ 0, 0 ];
|
||||
|
||||
autotile_selector_mask = 0;
|
||||
|
||||
grid_draw = true;
|
||||
|
||||
tile_selector = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) {
|
||||
var _h = tile_selector_h;
|
||||
var _pd = ui(4);
|
||||
var _tileSet = array_safe_get(current_data, 0);
|
||||
var _tileSiz = array_safe_get(current_data, 2);
|
||||
|
||||
var _sx = _x + _pd;
|
||||
var _sy = _y + _pd;
|
||||
var _sw = _w - _pd * 2;
|
||||
var _sh = _h - _pd * 2;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1);
|
||||
tile_selector_surface = surface_verify(tile_selector_surface, _sw, _sh);
|
||||
tile_selector_mask = surface_verify(tile_selector_mask, _sw, _sh);
|
||||
autotile_selector_mask = surface_verify(autotile_selector_mask, _sw, _sh);
|
||||
|
||||
if(!is_surface(_tileSet)) return _h;
|
||||
var _tdim = surface_get_dimension(_tileSet);
|
||||
var _tileAmo = [ floor(_tdim[0] / _tileSiz[0]), floor(_tdim[1] / _tileSiz[1]) ];
|
||||
|
||||
var _tileSel_w = _tileSiz[0] * tile_selector_s;
|
||||
var _tileSel_h = _tileSiz[1] * tile_selector_s;
|
||||
|
||||
var _msx = _m[0] - _sx - tile_selector_x;
|
||||
var _msy = _m[1] - _sy - tile_selector_y;
|
||||
|
||||
var _mtx = floor(_msx / tile_selector_s / _tileSiz[0]);
|
||||
var _mty = floor(_msy / tile_selector_s / _tileSiz[1]);
|
||||
var _mid = _mtx >= 0 && _mtx < _tileAmo[0] && _mty >= 0 && _mty < _tileAmo[1]? _mty * _tileAmo[0] + _mtx : noone;
|
||||
|
||||
var _tileHov_x = tile_selector_x + _mtx * _tileSiz[0] * tile_selector_s;
|
||||
var _tileHov_y = tile_selector_y + _mty * _tileSiz[1] * tile_selector_s;
|
||||
|
||||
var _hov = _hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h);
|
||||
|
||||
#region surface_set_target(tile_selector_surface);
|
||||
surface_set_target(tile_selector_surface);
|
||||
draw_clear(colorMultiply(COLORS.panel_bg_clear, COLORS.node_composite_bg_blend));
|
||||
draw_sprite_tiled_ext(s_transparent, 0, tile_selector_x, tile_selector_y, tile_selector_s, tile_selector_s, colorMultiply(COLORS.panel_preview_transparent, COLORS.node_composite_bg_blend), 1);
|
||||
|
||||
draw_surface_ext(_tileSet, tile_selector_x, tile_selector_y, tile_selector_s, tile_selector_s, 0, c_white, 1);
|
||||
|
||||
if(grid_draw) {
|
||||
var _gw = _tileSiz[0] * tile_selector_s;
|
||||
var _gh = _tileSiz[1] * tile_selector_s;
|
||||
|
||||
var gw = _tdim[0] / _tileSiz[0];
|
||||
var gh = _tdim[1] / _tileSiz[1];
|
||||
|
||||
var cx = tile_selector_x;
|
||||
var cy = tile_selector_y;
|
||||
|
||||
draw_set_color(PROJECT.previewGrid.color);
|
||||
draw_set_alpha(PROJECT.previewGrid.opacity);
|
||||
|
||||
for( var i = 1; i < gw; i++ ) {
|
||||
var _xx = cx + i * _gw;
|
||||
draw_line(_xx, cy, _xx, cy + _tdim[1] * tile_selector_s);
|
||||
}
|
||||
|
||||
for( var i = 1; i < gh; i++ ) {
|
||||
var _yy = cy + i * _gh;
|
||||
draw_line(cx, _yy, cx + _tdim[0] * tile_selector_s, _yy);
|
||||
}
|
||||
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
|
||||
draw_set_color(COLORS.panel_preview_surface_outline);
|
||||
draw_rectangle(tile_selector_x, tile_selector_y, tile_selector_x + _tdim[0] * tile_selector_s - 1, tile_selector_y + _tdim[1] * tile_selector_s - 1, true);
|
||||
|
||||
draw_set_color(c_white);
|
||||
draw_rectangle_width(_tileHov_x - 1, _tileHov_y - 1, _tileHov_x + _tileSel_w, _tileHov_y + _tileSel_h, 1);
|
||||
|
||||
draw_set_color(c_black);
|
||||
draw_rectangle_width(_tileHov_x, _tileHov_y, _tileHov_x + _tileSel_w - 1, _tileHov_y + _tileSel_h - 1, 1);
|
||||
|
||||
if(_hov && _mid > noone && mouse_press(mb_left, _focus)) {
|
||||
|
||||
if(autotile_subtile_selecting == noone) {
|
||||
autotile_selecting = noone;
|
||||
tile_selecting = true;
|
||||
tile_select_ss = [ _mtx, _mty ];
|
||||
|
||||
} else {
|
||||
autotiles[autotile_selecting].index[autotile_subtile_selecting] = _mid;
|
||||
autotile_subtile_selecting++;
|
||||
if(autotile_subtile_selecting >= array_length(autotiles[autotile_selecting].index))
|
||||
autotile_subtile_selecting = noone;
|
||||
}
|
||||
}
|
||||
surface_reset_target();
|
||||
#endregion
|
||||
|
||||
#region surface_set_target(tile_selector_mask);
|
||||
surface_set_target(tile_selector_mask);
|
||||
DRAW_CLEAR
|
||||
draw_set_color(c_white);
|
||||
|
||||
for( var i = 0, n = array_length(brush.brush_indices); i < n; i++ )
|
||||
for( var j = 0, m = array_length(brush.brush_indices[i]); j < m; j++ ) {
|
||||
var _bindex = brush.brush_indices[i][j];
|
||||
var _tileSel_row = floor(_bindex / _tileAmo[0]);
|
||||
var _tileSel_col = safe_mod(_bindex, _tileAmo[0]);
|
||||
var _tileSel_x = tile_selector_x + _tileSel_col * _tileSiz[0] * tile_selector_s;
|
||||
var _tileSel_y = tile_selector_y + _tileSel_row * _tileSiz[1] * tile_selector_s;
|
||||
draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false);
|
||||
}
|
||||
surface_reset_target();
|
||||
#endregion
|
||||
|
||||
#region tile selection
|
||||
if(tile_selecting) {
|
||||
var _ts_sx = clamp(min(tile_select_ss[0], _mtx), 0, _tileAmo[0] - 1);
|
||||
var _ts_sy = clamp(min(tile_select_ss[1], _mty), 0, _tileAmo[1] - 1);
|
||||
var _ts_ex = clamp(max(tile_select_ss[0], _mtx), 0, _tileAmo[0] - 1);
|
||||
var _ts_ey = clamp(max(tile_select_ss[1], _mty), 0, _tileAmo[1] - 1);
|
||||
|
||||
brush.brush_indices = [];
|
||||
brush.brush_width = _ts_ex - _ts_sx + 1;
|
||||
brush.brush_height = _ts_ey - _ts_sy + 1;
|
||||
var _ind = 0;
|
||||
|
||||
for( var i = _ts_sy; i <= _ts_ey; i++ )
|
||||
for( var j = _ts_sx; j <= _ts_ex; j++ )
|
||||
brush.brush_indices[i - _ts_sy][j - _ts_sx] = i * _tileAmo[0] + j;
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
tile_selecting = false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region pan zoom
|
||||
if(tile_dragging) {
|
||||
var _tdx = _m[0] - tile_drag_mx;
|
||||
var _tdy = _m[1] - tile_drag_my;
|
||||
|
||||
tile_selector_x = tile_drag_sx + _tdx;
|
||||
tile_selector_y = tile_drag_sy + _tdy;
|
||||
|
||||
if(mouse_release(mb_middle))
|
||||
tile_dragging = false;
|
||||
}
|
||||
|
||||
if(_hov) {
|
||||
if(mouse_press(mb_middle, _focus)) {
|
||||
tile_dragging = true;
|
||||
tile_drag_sx = tile_selector_x;
|
||||
tile_drag_sy = tile_selector_y;
|
||||
tile_drag_mx = _m[0];
|
||||
tile_drag_my = _m[1];
|
||||
}
|
||||
|
||||
var _s = tile_selector_s;
|
||||
if(key_mod_press(CTRL)) {
|
||||
if(mouse_wheel_up()) { tile_selector_s_to = clamp(tile_selector_s_to * 1.2, 0.5, 4); }
|
||||
if(mouse_wheel_down()) { tile_selector_s_to = clamp(tile_selector_s_to / 1.2, 0.5, 4); }
|
||||
}
|
||||
tile_selector_s = lerp_float(tile_selector_s, tile_selector_s_to, 2);
|
||||
|
||||
if(_s != tile_selector_s) {
|
||||
var _ds = tile_selector_s - _s;
|
||||
|
||||
tile_selector_x -= _msx * _ds / _s;
|
||||
tile_selector_y -= _msy * _ds / _s;
|
||||
}
|
||||
}
|
||||
|
||||
var _tdim_ws = _tdim[0] * tile_selector_s;
|
||||
var _tdim_hs = _tdim[1] * tile_selector_s;
|
||||
var _minx = -(_tdim_ws - _w) - 32;
|
||||
var _miny = -(_tdim_hs - _h) - 32;
|
||||
var _maxx = 32;
|
||||
var _maxy = 32;
|
||||
if(_minx > _maxx) { _minx = (_minx + _maxx) / 2; _maxx = _minx; }
|
||||
if(_miny > _maxy) { _miny = (_miny + _maxy) / 2; _maxy = _miny; }
|
||||
|
||||
tile_selector_x = clamp(tile_selector_x, _minx, _maxx);
|
||||
tile_selector_y = clamp(tile_selector_y, _miny, _maxy);
|
||||
#endregion
|
||||
|
||||
draw_surface(tile_selector_surface, _sx, _sy);
|
||||
|
||||
shader_set(sh_brush_outline);
|
||||
var _brush_tiles = brush.brush_width * brush.brush_height;
|
||||
var _cc = c_white;
|
||||
if(_brush_tiles == 9 || _brush_tiles == 15 || _brush_tiles == 48 || _brush_tiles == 55) _cc = COLORS._main_value_positive;
|
||||
|
||||
shader_set_f("dimension", _sw, _sh);
|
||||
draw_surface_ext(tile_selector_mask, _sx, _sy, 1, 1, 0, _cc, 1);
|
||||
shader_reset();
|
||||
|
||||
if(autotile_selecting != noone) { // autotile
|
||||
var _att = autotiles[autotile_selecting];
|
||||
|
||||
surface_set_target(autotile_selector_mask);
|
||||
DRAW_CLEAR
|
||||
|
||||
draw_set_color(c_white);
|
||||
for( var j = 0, m = array_length(_att.index); j < m; j++ ) {
|
||||
var _bindex = _att.index[j];
|
||||
var _tileSel_row = floor(_bindex / _tileAmo[0]);
|
||||
var _tileSel_col = safe_mod(_bindex, _tileAmo[0]);
|
||||
var _tileSel_x = tile_selector_x + _tileSel_col * _tileSiz[0] * tile_selector_s;
|
||||
var _tileSel_y = tile_selector_y + _tileSel_row * _tileSiz[1] * tile_selector_s;
|
||||
draw_rectangle(_tileSel_x, _tileSel_y, _tileSel_x + _tileSel_w, _tileSel_y + _tileSel_h, false);
|
||||
}
|
||||
surface_reset_target();
|
||||
|
||||
shader_set(sh_brush_outline);
|
||||
shader_set_f("dimension", _sw, _sh);
|
||||
draw_surface_ext(autotile_selector_mask, _sx, _sy, 1, 1, 0, COLORS._main_accent, 1);
|
||||
shader_reset();
|
||||
}
|
||||
|
||||
#region varients
|
||||
var _bw = power(2, ceil(log2(brush.brush_width)));
|
||||
var _bh = power(2, ceil(log2(brush.brush_height)));
|
||||
var _sel_sw = brush.brush_width * _tileSiz[0];
|
||||
var _sel_sh = brush.brush_height * _tileSiz[1];
|
||||
|
||||
selecting_surface = surface_verify(selecting_surface, _bw, _bh, surface_rgba16float);
|
||||
selecting_surface_tile = surface_verify(selecting_surface_tile, _sel_sw, _sel_sh);
|
||||
|
||||
var _ty = _y + _h + ui(8);
|
||||
var _th = ui(48);
|
||||
_h += ui(8) + _th;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _ty, _w, _th, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
var _sx = _x + ui(8);
|
||||
var _variences = [ 0, 1, 2, 3, 8, 16 ];
|
||||
|
||||
if(brush.brush_width * brush.brush_height > 1) {
|
||||
_variences = [ 0 ];
|
||||
brush.brush_varient = 0;
|
||||
}
|
||||
|
||||
for( var v = 0, p = array_length(_variences); v < p; v++ ) {
|
||||
|
||||
surface_set_shader(selecting_surface, sh_draw_tile_brush, true, BLEND.over);
|
||||
for( var i = 0, n = array_length(brush.brush_indices); i < n; i++ )
|
||||
for( var j = 0, m = array_length(brush.brush_indices[i]); j < m; j++ ) {
|
||||
var _bindex = brush.brush_indices[i][j];
|
||||
shader_set_f("index", _bindex);
|
||||
shader_set_f("varient", _variences[v]);
|
||||
draw_point(j, i);
|
||||
}
|
||||
surface_reset_shader();
|
||||
|
||||
var _tileSetDim = surface_get_dimension(_tileSet);
|
||||
|
||||
surface_set_shader(selecting_surface_tile, sh_draw_tile_map, true, BLEND.over);
|
||||
shader_set_2("dimension", [ _sel_sw, _sel_sh ]);
|
||||
shader_set_2("tileSize", _tileSiz);
|
||||
shader_set_2("tileAmo", [ floor(_tileSetDim[0] / _tileSiz[0]), floor(_tileSetDim[1] / _tileSiz[1]) ]);
|
||||
|
||||
shader_set_surface("tileTexture", _tileSet);
|
||||
shader_set_2("tileTextureDim", _tileSetDim);
|
||||
|
||||
shader_set_surface("indexTexture", selecting_surface);
|
||||
shader_set_2("indexTextureDim", surface_get_dimension(selecting_surface));
|
||||
|
||||
draw_empty();
|
||||
surface_reset_shader();
|
||||
|
||||
var _sy = _ty + ui(8);
|
||||
var _ss = (_th - ui(16)) / _sel_sh;
|
||||
var _sw = _ss * _sel_sw;
|
||||
var _sh = _ss * _sel_sh;
|
||||
|
||||
draw_surface_ext(selecting_surface_tile, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
||||
|
||||
var _shov = _hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw, _sy + _sh);
|
||||
var cc = _shov? COLORS._main_icon_light : COLORS._main_icon;
|
||||
if(v == brush.brush_varient)
|
||||
cc = COLORS._main_accent;
|
||||
|
||||
draw_set_color(cc);
|
||||
draw_rectangle(_sx, _sy, _sx + _sw, _sy + _sh, true);
|
||||
|
||||
if(_shov && mouse_press(mb_left, _focus))
|
||||
brush.brush_varient = brush.brush_varient == _variences[v]? 0 : _variences[v];
|
||||
|
||||
_sx += _sw + ui(8);
|
||||
}
|
||||
#endregion
|
||||
|
||||
return _h;
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region ++++ auto tile ++++
|
||||
autotiles = [];
|
||||
|
||||
autotile_selecting = noone;
|
||||
autotile_selector_h = 0;
|
||||
|
||||
autotile_subtile_selecting = noone;
|
||||
|
||||
autotile_selector = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) {
|
||||
var _yy = _y;
|
||||
var _h = 0;
|
||||
|
||||
var _tileSet = array_safe_get(current_data, 0);
|
||||
var _tileSiz = array_safe_get(current_data, 2);
|
||||
|
||||
if(!is_surface(_tileSet)) return _h;
|
||||
var _tdim = surface_get_dimension(_tileSet);
|
||||
var _tileAmo = [ floor(_tdim[0] / _tileSiz[0]), floor(_tdim[1] / _tileSiz[1]) ];
|
||||
|
||||
var bx = _x;
|
||||
var by = _yy;
|
||||
var bs = ui(24);
|
||||
var _brush_tiles = brush.brush_width * brush.brush_height;
|
||||
var _fromSel = (_brush_tiles == 9 || _brush_tiles == 15 || _brush_tiles == 48 || _brush_tiles == 55);
|
||||
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, _fromSel? "New autotile from selection" : "New autotile", THEME.add_16, 0, COLORS._main_value_positive) == 2) {
|
||||
var _new_at = noone;
|
||||
|
||||
if(_brush_tiles == 9) _new_at = new tiler_brush_autotile(AUTOTILE_TYPE.box9, array_spread(brush.brush_indices));
|
||||
else if(_brush_tiles == 15) _new_at = new tiler_brush_autotile(AUTOTILE_TYPE.side15, array_spread(brush.brush_indices));
|
||||
else if(_brush_tiles == 48) _new_at = new tiler_brush_autotile(AUTOTILE_TYPE.top48, array_spread(brush.brush_indices));
|
||||
else if(_brush_tiles == 55) _new_at = new tiler_brush_autotile(AUTOTILE_TYPE.top55, array_spread(brush.brush_indices));
|
||||
|
||||
if(_new_at != noone) {
|
||||
autotile_selecting = array_length(autotiles);
|
||||
array_push(autotiles, _new_at);
|
||||
|
||||
brush.brush_indices = [[ _new_at.index[0] ]];
|
||||
brush.brush_width = 1;
|
||||
brush.brush_height = 1;
|
||||
}
|
||||
}
|
||||
|
||||
_h += bs + ui(8);
|
||||
_yy += bs + ui(8);
|
||||
|
||||
var _pd = ui(4);
|
||||
var _ah = _pd * 2;
|
||||
var del = -1;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _yy, _w, autotile_selector_h, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
_yy += _pd;
|
||||
|
||||
for( var i = 0, n = array_length(autotiles); i < n; i++ ) {
|
||||
var _hg = ui(32);
|
||||
var _at = autotiles[i];
|
||||
|
||||
var _pw = ui(24);
|
||||
var _ph = ui(24);
|
||||
var _px = _x + ui(8);
|
||||
var _py = _yy + ui(4);
|
||||
|
||||
var _prin = array_safe_get(_at.index, 0, noone);
|
||||
|
||||
if(_prin == noone) {
|
||||
draw_set_color(COLORS._main_icon);
|
||||
draw_rectangle(_px, _py, _px + _pw, _py + _ph, true);
|
||||
} else {
|
||||
var _prc = safe_mod(_prin, _tileAmo[0]);
|
||||
var _prr = floor(_prin / _tileAmo[0]);
|
||||
|
||||
var _pr_tx = _prc * _tileSiz[0];
|
||||
var _pr_ty = _prr * _tileSiz[1];
|
||||
|
||||
var _pr_sx = _pw / _tileSiz[0];
|
||||
var _pr_sy = _ph / _tileSiz[1];
|
||||
|
||||
draw_surface_part_ext(_tileSet, _pr_tx, _pr_ty, _tileSiz[0], _tileSiz[1], _px, _py, _pr_sx, _pr_sy, c_white, 1);
|
||||
}
|
||||
|
||||
var _tx = _px + _pw + ui(8);
|
||||
var _hov = _hover && point_in_rectangle(_m[0], _m[1], _x, _yy, _x + _w, _yy + _hg - 1);
|
||||
var _cc = i == autotile_selecting? COLORS._main_accent : (_hov? COLORS._main_text : COLORS._main_text_sub);
|
||||
|
||||
if(renaming == _at) {
|
||||
tb_rename.setFocusHover(_focus, _hover);
|
||||
tb_rename.draw(_tx, _yy, _w - _pw - ui(8), _hg, rename_text, _m);
|
||||
|
||||
} else {
|
||||
draw_set_text(f_p2, fa_left, fa_center, _cc);
|
||||
draw_text_add(_tx, _yy + _hg / 2, _at.name);
|
||||
|
||||
var bs = ui(24);
|
||||
var bx = _w - bs;
|
||||
var by = _yy + _hg / 2 - bs / 2;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, _hov? COLORS._main_value_negative : COLORS._main_icon) == 2)
|
||||
del = i;
|
||||
}
|
||||
|
||||
if(_hov && _m[0] < _x + _w - ui(32)) {
|
||||
if(DOUBLE_CLICK && _focus) {
|
||||
renaming = _at;
|
||||
rename_text = _at.name;
|
||||
|
||||
tb_rename._current_text = _at.name;
|
||||
tb_rename.activate();
|
||||
|
||||
} else if(mouse_press(mb_left, _focus)) {
|
||||
if(_m[0] > _tx) {
|
||||
autotile_selecting = autotile_selecting == i? noone : i;
|
||||
brush.brush_indices = [[ _prin ]];
|
||||
brush.brush_width = 1;
|
||||
brush.brush_height = 1;
|
||||
|
||||
} else {
|
||||
_at.open = !_at.open;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_yy += _hg;
|
||||
_ah += _hg;
|
||||
|
||||
if(_at.open) {
|
||||
_yy += ui(4);
|
||||
_ah += ui(4);
|
||||
|
||||
var _atIdx = _at.index;
|
||||
var _coll = floor(_w - ui(16)) / _tileSiz[0];
|
||||
|
||||
switch(_at.type) {
|
||||
case AUTOTILE_TYPE.box9 : _coll = 3; break;
|
||||
case AUTOTILE_TYPE.side15 : _coll = 5; break;
|
||||
case AUTOTILE_TYPE.top48 : _coll = 8; break;
|
||||
case AUTOTILE_TYPE.top55 : _coll = 11; break;
|
||||
}
|
||||
|
||||
var _roww = ceil(array_length(_atIdx) / _coll);
|
||||
|
||||
var _pre_sx = _x + ui(8);
|
||||
var _pre_sy = _yy;
|
||||
var _pre_sw = _coll * _tileSiz[0];
|
||||
var _pre_sh = _roww * _tileSiz[1];
|
||||
|
||||
var _ss = (_w - ui(16)) / _pre_sw;
|
||||
|
||||
var _bw = power(2, ceil(log2(_coll)));
|
||||
var _bh = power(2, ceil(log2(_roww)));
|
||||
|
||||
_at.preview_surface = surface_verify(_at.preview_surface, _bw, _bh, surface_rgba16float);
|
||||
_at.preview_surface_tile = surface_verify(_at.preview_surface_tile, _pre_sw, _pre_sh);
|
||||
|
||||
surface_set_shader(_at.preview_surface, sh_draw_tile_brush, true, BLEND.over);
|
||||
for( var j = 0, m = array_length(_atIdx); j < m; j++ ) {
|
||||
var _til_row = floor(j / _coll);
|
||||
var _til_col = j % _coll;
|
||||
|
||||
var _bindex = _atIdx[j];
|
||||
shader_set_f("index", _bindex);
|
||||
shader_set_f("varient", 0);
|
||||
draw_point(_til_col, _til_row);
|
||||
}
|
||||
surface_reset_shader();
|
||||
|
||||
var _tileSetDim = surface_get_dimension(_tileSet);
|
||||
|
||||
surface_set_shader(_at.preview_surface_tile, sh_draw_tile_map, true, BLEND.over);
|
||||
shader_set_2("dimension", surface_get_dimension(_at.preview_surface_tile));
|
||||
shader_set_2("tileSize", _tileSiz);
|
||||
shader_set_2("tileAmo", [ floor(_tileSetDim[0] / _tileSiz[0]), floor(_tileSetDim[1] / _tileSiz[1]) ]);
|
||||
|
||||
shader_set_surface("tileTexture", _tileSet);
|
||||
shader_set_2("tileTextureDim", _tileSetDim);
|
||||
|
||||
shader_set_surface("indexTexture", _at.preview_surface);
|
||||
shader_set_2("indexTextureDim", surface_get_dimension(_at.preview_surface));
|
||||
|
||||
draw_empty();
|
||||
surface_reset_shader();
|
||||
|
||||
draw_surface_ext(_at.preview_surface_tile, _pre_sx, _pre_sy, _ss, _ss, 0, c_white, 1);
|
||||
|
||||
draw_set_color(COLORS._main_icon);
|
||||
draw_rectangle(_pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss, true);
|
||||
|
||||
var _dtile_w = _tileSiz[0] * _ss;
|
||||
var _dtile_h = _tileSiz[1] * _ss;
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _pre_sx, _pre_sy, _pre_sx + _pre_sw * _ss, _pre_sy + _pre_sh * _ss)) {
|
||||
var _at_cx = clamp(floor((_m[0] - _pre_sx) / _dtile_w), 0, _coll - 1);
|
||||
var _at_cy = clamp(floor((_m[1] - _pre_sy) / _dtile_h), 0, _roww - 1);
|
||||
|
||||
var _at_id = _at_cy * _coll + _at_cx;
|
||||
if(_at_id >= 0 && _at_id < array_length(_atIdx)) {
|
||||
var _at_c_sx = _pre_sx + _at_cx * _dtile_w;
|
||||
var _at_c_sy = _pre_sy + _at_cy * _dtile_h;
|
||||
|
||||
draw_set_color(COLORS._main_icon_light);
|
||||
draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true);
|
||||
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
autotile_selecting = i;
|
||||
autotile_subtile_selecting = autotile_subtile_selecting == _at_id? noone : _at_id;
|
||||
}
|
||||
|
||||
if(mouse_press(mb_right, _focus))
|
||||
_at.index[_at_id] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if(autotile_selecting == i && autotile_subtile_selecting != noone) {
|
||||
var _at_sl_x = autotile_subtile_selecting % _coll;
|
||||
var _at_sl_y = floor(autotile_subtile_selecting / _coll);
|
||||
|
||||
var _at_c_sx = _pre_sx + _at_sl_x * _dtile_w;
|
||||
var _at_c_sy = _pre_sy + _at_sl_y * _dtile_h;
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_rectangle(_at_c_sx, _at_c_sy, _at_c_sx + _dtile_w, _at_c_sy + _dtile_h, true);
|
||||
}
|
||||
|
||||
_yy += _pre_sh * _ss + ui(4);
|
||||
_ah += _pre_sh * _ss + ui(4);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(del != -1) {
|
||||
array_delete(autotiles, del, 1);
|
||||
autotile_selecting = noone;
|
||||
}
|
||||
|
||||
autotile_selector_h = _ah;
|
||||
return _h + _ah;
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region ++++ brush palette ++++
|
||||
brush_palette = surface_create(1, 1, surface_rgba16float);
|
||||
|
||||
palette_viewer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus, _panel = noone) {
|
||||
var _h = 0;
|
||||
|
||||
return _h;
|
||||
});
|
||||
#endregion
|
||||
|
||||
input_display_list = [
|
||||
["Tileset", false], 0, 2,
|
||||
["Map", false], 1,
|
||||
["Tiles", false], tile_selector,
|
||||
["Autotiles", false], autotile_selector,
|
||||
["Palette", false], palette_viewer
|
||||
]
|
||||
input_display_list = [ 1, 0 ];
|
||||
input_display_list_tileset = ["Tileset", false, noone, noone];
|
||||
input_display_list_autotiles = ["Autotiles", true, noone, noone];
|
||||
input_display_list_palette = ["Palette", true, noone, noone];
|
||||
input_display_list_animated = ["Animated", true, 2, noone];
|
||||
|
||||
newOutput(0, nodeValue_Output("Tile output", self, VALUE_TYPE.surface, noone));
|
||||
|
||||
|
@ -628,14 +53,12 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
#endregion
|
||||
|
||||
#region ++++ tool object ++++
|
||||
brush = new tiler_brush(self);
|
||||
tool_brush = new tiler_tool_brush(self, noone, false);
|
||||
tool_eraser = new tiler_tool_brush(self, noone, true);
|
||||
tool_fill = new tiler_tool_fill( self, noone, tool_attribute);
|
||||
|
||||
tool_brush = new tiler_tool_brush(self, brush, false);
|
||||
tool_eraser = new tiler_tool_brush(self, brush, true);
|
||||
tool_fill = new tiler_tool_fill( self, brush, tool_attribute);
|
||||
|
||||
tool_rectangle = new tiler_tool_shape(self, brush, CANVAS_TOOL_SHAPE.rectangle);
|
||||
tool_ellipse = new tiler_tool_shape(self, brush, CANVAS_TOOL_SHAPE.ellipse);
|
||||
tool_rectangle = new tiler_tool_shape(self, noone, CANVAS_TOOL_SHAPE.rectangle);
|
||||
tool_ellipse = new tiler_tool_shape(self, noone, CANVAS_TOOL_SHAPE.ellipse);
|
||||
#endregion
|
||||
|
||||
#region ++++ tools ++++
|
||||
|
@ -701,9 +124,10 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
}
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny, params) {
|
||||
var _tileSet = current_data[0];
|
||||
if(tileset == noone) return;
|
||||
|
||||
var _mapSize = current_data[1];
|
||||
var _tileSize = current_data[2];
|
||||
var _tileSiz = tileset.tileSize;
|
||||
|
||||
canvas_surface = surface_verify(canvas_surface, _mapSize[0], _mapSize[1], surface_rgba16float);
|
||||
|
||||
|
@ -717,11 +141,11 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
#region surfaces
|
||||
var _dim = attributes.dimension;
|
||||
var _outDim = [ _tileSize[0] * _dim[0], _tileSize[1] * _dim[1] ];
|
||||
var _outDim = [ _tileSiz[0] * _dim[0], _tileSiz[1] * _dim[1] ];
|
||||
|
||||
preview_draw_overlay = surface_verify(preview_draw_overlay, _dim[0], _dim[1], surface_rgba16float);
|
||||
preview_drawing_tile = surface_verify(preview_drawing_tile, _dim[0] * _tileSize[0], _dim[1] * _tileSize[1]);
|
||||
preview_draw_overlay_tile = surface_verify(preview_draw_overlay_tile, _dim[0] * _tileSize[0], _dim[1] * _tileSize[1]);
|
||||
preview_drawing_tile = surface_verify(preview_drawing_tile, _dim[0] * _tileSiz[0], _dim[1] * _tileSiz[1]);
|
||||
preview_draw_overlay_tile = surface_verify(preview_draw_overlay_tile, _dim[0] * _tileSiz[0], _dim[1] * _tileSiz[1]);
|
||||
|
||||
var __s = surface_get_target();
|
||||
var _sw = surface_get_width(__s);
|
||||
|
@ -736,14 +160,18 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
var _currTool = PANEL_PREVIEW.tool_current;
|
||||
var _tool = _currTool == noone? noone : _currTool.getToolObject();
|
||||
|
||||
brush.brush_size = tool_attribute.size;
|
||||
brush.autotiler = autotile_selecting == noone? noone : array_safe_get(autotiles, autotile_selecting, noone);
|
||||
|
||||
if(_tool) {
|
||||
var brush = tileset.brush;
|
||||
|
||||
brush.node = self;
|
||||
brush.brush_size = tool_attribute.size;
|
||||
brush.autotiler = array_safe_get(tileset.autotiles, tileset.autotile_selecting, noone);
|
||||
|
||||
_tool.brush = brush;
|
||||
_tool.subtool = _currTool.selecting;
|
||||
_tool.apply_draw_surface = apply_draw_surface;
|
||||
_tool.drawing_surface = drawing_surface;
|
||||
_tool.tile_size = _tileSize;
|
||||
_tool.tile_size = _tileSiz;
|
||||
|
||||
_tool.step(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
|
@ -759,7 +187,7 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
surface_set_target(preview_draw_mask);
|
||||
DRAW_CLEAR
|
||||
draw_surface_ext(_preview_draw_mask, _x, _y, _s * _tileSize[0], _s * _tileSize[1], 0, c_white, 1);
|
||||
draw_surface_ext(_preview_draw_mask, _x, _y, _s * _tileSiz[0], _s * _tileSiz[1], 0, c_white, 1);
|
||||
surface_reset_target();
|
||||
|
||||
if(_tool.brush_resizable) {
|
||||
|
@ -774,19 +202,15 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
#endregion
|
||||
|
||||
#region draw preview surfaces
|
||||
var _tileSetDim = surface_get_dimension(_tileSet);
|
||||
|
||||
surface_set_shader(preview_drawing_tile, sh_draw_tile_map, true, BLEND.over);
|
||||
shader_set_2("dimension", _outDim);
|
||||
shader_set_2("tileSize", _tileSize);
|
||||
shader_set_2("tileAmo", [ floor(_tileSetDim[0] / _tileSize[0]), floor(_tileSetDim[1] / _tileSize[1]) ]);
|
||||
|
||||
shader_set_surface("tileTexture", _tileSet);
|
||||
shader_set_2("tileTextureDim", _tileSetDim);
|
||||
|
||||
shader_set_surface("indexTexture", drawing_surface);
|
||||
shader_set_2("indexTextureDim", surface_get_dimension(drawing_surface));
|
||||
|
||||
tileset.shader_submit();
|
||||
|
||||
draw_empty();
|
||||
surface_reset_shader();
|
||||
|
||||
|
@ -796,15 +220,12 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
surface_set_shader(preview_draw_overlay_tile, sh_draw_tile_map, true, BLEND.over);
|
||||
shader_set_2("dimension", _outDim);
|
||||
shader_set_2("tileSize", _tileSize);
|
||||
shader_set_2("tileAmo", [ floor(_tileSetDim[0] / _tileSize[0]), floor(_tileSetDim[1] / _tileSize[1]) ]);
|
||||
|
||||
shader_set_surface("tileTexture", _tileSet);
|
||||
shader_set_2("tileTextureDim", _tileSetDim);
|
||||
|
||||
shader_set_surface("indexTexture", preview_draw_overlay);
|
||||
shader_set_2("indexTextureDim", surface_get_dimension(preview_draw_overlay));
|
||||
|
||||
tileset.shader_submit();
|
||||
|
||||
draw_empty();
|
||||
surface_reset_shader();
|
||||
|
||||
|
@ -828,15 +249,34 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
}
|
||||
|
||||
static processData = function(_outData, _data, _output_index, _array_index) {
|
||||
var _tileSet = _data[0];
|
||||
tileset = _data[0];
|
||||
|
||||
if(tileset == noone) {
|
||||
input_display_list = [ 1, 0 ];
|
||||
return _outData;
|
||||
}
|
||||
|
||||
input_display_list_tileset[3] = tileset.tile_selector_toggler;
|
||||
input_display_list_autotiles[3] = tileset.autotile_selector_toggler;
|
||||
input_display_list_palette[3] = tileset.palette_viewer_toggler;
|
||||
input_display_list_animated[3] = tileset.animated_viewer_toggler;
|
||||
|
||||
input_display_list = [ 1, 0,
|
||||
input_display_list_tileset, tileset.tile_selector,
|
||||
input_display_list_autotiles, tileset.autotile_selector,
|
||||
input_display_list_palette, tileset.palette_viewer,
|
||||
input_display_list_animated, tileset.animated_viewer,
|
||||
]
|
||||
|
||||
var _tileSet = tileset.texture;
|
||||
var _tileSiz = tileset.tileSize;
|
||||
var _mapSize = _data[1];
|
||||
var _tileSize = _data[2];
|
||||
var _animated = _data[2];
|
||||
update_on_frame = _animated;
|
||||
|
||||
attributes.dimension[0] = _mapSize[0];
|
||||
attributes.dimension[1] = _mapSize[1];
|
||||
|
||||
//print($"{canvas_surface} [{is_surface(canvas_surface)}] : {drawing_surface} [{is_surface(drawing_surface)}]");
|
||||
|
||||
if(!is_surface(canvas_surface) && buffer_exists(canvas_buffer)) {
|
||||
canvas_surface = surface_create(_mapSize[0], _mapSize[1], surface_rgba16float);
|
||||
buffer_set_surface(canvas_buffer, canvas_surface, 0);
|
||||
|
@ -854,7 +294,7 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
var _tileMap = _outData[1];
|
||||
var _arrIndx = _outData[2];
|
||||
|
||||
var _outDim = [ _tileSize[0] * _mapSize[0], _tileSize[1] * _mapSize[1] ];
|
||||
var _outDim = [ _tileSiz[0] * _mapSize[0], _tileSiz[1] * _mapSize[1] ];
|
||||
|
||||
_tileOut = surface_verify(_tileOut, _outDim[0], _outDim[1]);
|
||||
_tileMap = surface_verify(_tileMap, _mapSize[0], _mapSize[1], surface_rgba16float);
|
||||
|
@ -871,15 +311,13 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
surface_set_shader(_tileOut, sh_draw_tile_map, true, BLEND.over);
|
||||
shader_set_2("dimension", _outDim);
|
||||
shader_set_2("tileSize", _tileSize);
|
||||
shader_set_2("tileAmo", [ floor(_tileSetDim[0] / _tileSize[0]), floor(_tileSetDim[1] / _tileSize[1]) ]);
|
||||
|
||||
shader_set_surface("tileTexture", _tileSet);
|
||||
shader_set_2("tileTextureDim", _tileSetDim);
|
||||
|
||||
shader_set_surface("indexTexture", _tileMap);
|
||||
shader_set_2("indexTextureDim", surface_get_dimension(_tileMap));
|
||||
|
||||
shader_set_f("frame", CURRENT_FRAME);
|
||||
tileset.shader_submit();
|
||||
|
||||
draw_empty();
|
||||
surface_reset_shader();
|
||||
|
||||
|
@ -906,32 +344,18 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
|
||||
static attributeSerialize = function() {
|
||||
var _attr = {
|
||||
autotiles,
|
||||
canvas: buffer_from_surface(canvas_surface),
|
||||
palette: buffer_from_surface(brush_palette),
|
||||
canvas: buffer_from_surface(canvas_surface)
|
||||
};
|
||||
|
||||
return _attr;
|
||||
}
|
||||
|
||||
static attributeDeserialize = function(attr) {
|
||||
var _auto = struct_try_get(attr, "autotiles", []);
|
||||
var _canv = struct_try_get(attr, "canvas", noone);
|
||||
var _palt = struct_try_get(attr, "palette", noone);
|
||||
|
||||
for( var i = 0, n = array_length(_auto); i < n; i++ ) {
|
||||
autotiles[i] = new tiler_brush_autotile(_auto[i].type, _auto[i].index);
|
||||
autotiles[i].name = _auto[i].name;
|
||||
}
|
||||
|
||||
if(_canv) {
|
||||
surface_free_safe(canvas_surface);
|
||||
canvas_surface = surface_from_buffer(_canv);
|
||||
}
|
||||
|
||||
if(_palt) {
|
||||
surface_free_safe(brush_palette);
|
||||
brush_palette = surface_from_buffer(_canv);
|
||||
}
|
||||
}
|
||||
}
|
1354
scripts/node_tiler_tileset/node_tiler_tileset.gml
Normal file
13
scripts/node_tiler_tileset/node_tiler_tileset.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"node_tiler_tileset",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_tiler_tileset",
|
||||
"parent":{
|
||||
"name":"tiler",
|
||||
"path":"folders/nodes/data/tiler.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -989,6 +989,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
editWidget = new outputStructBox();
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.tileset :
|
||||
editWidget = new tilesetBox(self);
|
||||
break;
|
||||
|
||||
case VALUE_TYPE.particle :
|
||||
editWidget = noone;
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
function nodeValue_SDF(_name, _node, _value, _tooltip = "") { return new __NodeValue_SDF(_name, _node, _value, _tooltip); }
|
||||
|
||||
function __NodeValue_SDF(_name, _node, _value, _tooltip = "") : __NodeValue_Object_Generic(_name, _node, VALUE_TYPE.sdf, _value, _tooltip) constructor {
|
||||
|
||||
}
|
||||
function __NodeValue_SDF(_name, _node, _value, _tooltip = "") : __NodeValue_Object_Generic(_name, _node, VALUE_TYPE.sdf, _value, _tooltip) constructor {}
|
3
scripts/node_value_tileset/node_value_tileset.gml
Normal file
|
@ -0,0 +1,3 @@
|
|||
function nodeValue_Tileset(_name, _node, _value, _tooltip = "") { return new __NodeValue_Tileset(_name, _node, _value, _tooltip); }
|
||||
|
||||
function __NodeValue_Tileset(_name, _node, _value, _tooltip = "") : __NodeValue_Object_Generic(_name, _node, VALUE_TYPE.tileset, _value, _tooltip) constructor {}
|
13
scripts/node_value_tileset/node_value_tileset.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"node_value_tileset",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_value_tileset",
|
||||
"parent":{
|
||||
"name":"object",
|
||||
"path":"folders/nodes/values/types/object.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -59,6 +59,8 @@ enum VALUE_TYPE {
|
|||
fdomain = 34,
|
||||
sdf = 35,
|
||||
|
||||
tileset = 36,
|
||||
|
||||
action = 99,
|
||||
}
|
||||
|
||||
|
@ -189,6 +191,7 @@ function value_color(i) {
|
|||
#8fde5d, //audiobit
|
||||
#4da6ff, //flipfluid
|
||||
#c1007c, //3D SDF
|
||||
#ff6b97, //tileset
|
||||
];
|
||||
static JUNCTION_COLORS_LENGTH = array_length(JUNCTION_COLORS);
|
||||
|
||||
|
@ -238,6 +241,7 @@ function value_color_bg_array(i) {
|
|||
#83839b, //PCX
|
||||
#3ca370, //audiobit
|
||||
#4b5bab, //3D SDF
|
||||
#bd4882, //tileset
|
||||
];
|
||||
|
||||
if(i == 99) return $5dde8f;
|
||||
|
@ -289,6 +293,7 @@ function value_bit(i) {
|
|||
case VALUE_TYPE.audioBit : return 1 << 35;
|
||||
case VALUE_TYPE.fdomain : return 1 << 36;
|
||||
case VALUE_TYPE.sdf : return 1 << 37;
|
||||
case VALUE_TYPE.tileset : return 1 << 38;
|
||||
|
||||
case VALUE_TYPE.curve : return 1 << 38;
|
||||
|
||||
|
@ -371,6 +376,7 @@ function value_type_from_string(str) {
|
|||
case "audioBit" : return VALUE_TYPE.audioBit;
|
||||
case "fDomain" : return VALUE_TYPE.fdomain;
|
||||
case "sdf" : return VALUE_TYPE.sdf;
|
||||
case "tileset" : return VALUE_TYPE.tileset;
|
||||
|
||||
case "action" : return VALUE_TYPE.action;
|
||||
}
|
||||
|
|
25
scripts/panel_custom_inspector/panel_custom_inspector.gml
Normal file
|
@ -0,0 +1,25 @@
|
|||
function Panel_Custom_Inspector(_title, _inspector) : PanelContent() constructor {
|
||||
title = __txt(_title);
|
||||
context_str = instanceof(_inspector);
|
||||
padding = 8;
|
||||
|
||||
auto_pin = true;
|
||||
inspector = _inspector;
|
||||
inspector.popupPanel = self;
|
||||
|
||||
function drawContent(panel) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
var pd = in_dialog? ui(0) : ui(8);
|
||||
|
||||
inspector.panel = self;
|
||||
inspector.rx = x;
|
||||
inspector.ry = y;
|
||||
inspector.fixHeight = h - pd * 2;
|
||||
|
||||
var _wdh = inspector.draw(pd, pd, w - pd * 2, [ mx, my ], pHOVER, pFOCUS, self);
|
||||
}
|
||||
|
||||
static onClose = function() {
|
||||
inspector.popupPanel = noone;
|
||||
}
|
||||
}
|
13
scripts/panel_custom_inspector/panel_custom_inspector.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"panel_custom_inspector",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"panel_custom_inspector",
|
||||
"parent":{
|
||||
"name":"inspectors",
|
||||
"path":"folders/panels/inspectors.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -70,7 +70,12 @@ function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constr
|
|||
self.draw = drawFn;
|
||||
node = noone;
|
||||
panel = noone;
|
||||
|
||||
popupPanel = noone;
|
||||
popupDialog = noone;
|
||||
|
||||
h = 64;
|
||||
fixHeight = -1;
|
||||
|
||||
if(registerFn != noone) register = registerFn;
|
||||
else {
|
||||
|
@ -81,8 +86,33 @@ function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constr
|
|||
}
|
||||
|
||||
static setNode = function(node) { self.node = node; return self; }
|
||||
|
||||
static toString = function() { return $"Custon renderer"; }
|
||||
|
||||
static togglePopup = function(_title) {
|
||||
if(popupPanel == noone) {
|
||||
popupPanel = new Panel_Custom_Inspector(_title, self);
|
||||
popupDialog = dialogPanelCall(popupPanel);
|
||||
return;
|
||||
}
|
||||
|
||||
if(instance_exists(popupDialog))
|
||||
instance_destroy(popupDialog);
|
||||
|
||||
if(is_instanceof(popupPanel, PanelContent))
|
||||
popupPanel.close();
|
||||
|
||||
popupPanel = noone;
|
||||
}
|
||||
|
||||
static clone = function() {
|
||||
var _n = new Inspector_Custom_Renderer(draw, register);
|
||||
var _key = variable_instance_get_names(self);
|
||||
|
||||
for( var i = 0, n = array_length(_key); i < n; i++ )
|
||||
_n[$ _key[i]] = self[$ _key[i]];
|
||||
|
||||
return _n;
|
||||
}
|
||||
}
|
||||
|
||||
function Inspector_Sprite(spr) constructor { self.spr = spr; }
|
||||
|
@ -535,59 +565,6 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
|
||||
yy += gvh + ui(8);
|
||||
hh += gvh + ui(8);
|
||||
|
||||
// var bh = ui(36);
|
||||
// var bx = ui(16);
|
||||
// var by = yy;
|
||||
// var bbw = contentPane.surface_w - ui(24);
|
||||
|
||||
// if(var_editing) {
|
||||
// var bw = bbw / 2 - ui(4);
|
||||
|
||||
// if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, pFOCUS, _hover) == 2)
|
||||
// var_editing = !var_editing;
|
||||
|
||||
// var txt = __txt("Apply");
|
||||
// var icon = THEME.accept;
|
||||
// var colr = COLORS._main_value_positive;
|
||||
|
||||
// draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_icon)
|
||||
// var bxc = bx + bw / 2 - (string_width(txt) + ui(48)) / 2;
|
||||
// var byc = by + bh / 2;
|
||||
// draw_sprite_ui(icon, 0, bxc + ui(24), byc,,,, colr);
|
||||
// draw_text_over(bxc + ui(48), byc, txt);
|
||||
|
||||
// bx += bw + ui(4);
|
||||
|
||||
// if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, pFOCUS, _hover) == 2)
|
||||
// PROJECT.globalNode.createValue();
|
||||
|
||||
// var txt = __txt("Add");
|
||||
// var icon = THEME.add;
|
||||
|
||||
// draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_icon)
|
||||
// var bxc = bx + bw / 2 - (string_width(txt) + ui(48)) / 2;
|
||||
// var byc = by + bh / 2;
|
||||
// draw_sprite_ui(icon, 0, bxc + ui(24), byc,,,, colr);
|
||||
// draw_text_over(bxc + ui(48), byc, txt);
|
||||
|
||||
// } else {
|
||||
// var bw = bbw;
|
||||
|
||||
// if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, pFOCUS, _hover) == 2)
|
||||
// var_editing = !var_editing;
|
||||
|
||||
// var txt = __txt("Edit");
|
||||
// var icon = THEME.gear;
|
||||
// var colr = COLORS._main_icon;
|
||||
|
||||
// draw_set_text(f_p0b, fa_left, fa_center, colr)
|
||||
// var bxc = bx + bw / 2 - (string_width(txt) + ui(48)) / 2;
|
||||
// var byc = by + bh / 2;
|
||||
// draw_sprite_ui(icon, 0, bxc + ui(24), byc,,,, colr);
|
||||
// draw_text_over(bxc + ui(48), byc, txt);
|
||||
// }
|
||||
|
||||
break;
|
||||
|
||||
case 3 :
|
||||
|
@ -792,15 +769,34 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
continue;
|
||||
|
||||
} else if(is_instanceof(jun, Inspector_Custom_Renderer)) {
|
||||
jun.register(contentPane);
|
||||
if(jun.popupPanel != noone) {
|
||||
// draw_sprite_stretched_ext(THEME.ui_panel, 0, ui(16), yy, con_w - ui(32), ui(24), COLORS._main_icon, .05);
|
||||
// draw_sprite_stretched_ext(THEME.ui_panel, 1, ui(16), yy, con_w - ui(32), ui(24), COLORS._main_icon, .2);
|
||||
draw_set_text(f_p2, fa_center, fa_center, COLORS._main_icon, .5);
|
||||
draw_text_add(con_w / 2, yy + ui(24) / 2 - ui(2), __txt("Pop-up content"));
|
||||
draw_set_alpha(1);
|
||||
|
||||
hh += ui(24 + 2);
|
||||
continue;
|
||||
}
|
||||
|
||||
jun.fixHeight = -1;
|
||||
jun.panel = self;
|
||||
jun.rx = ui(16) + x;
|
||||
jun.ry = top_bar_h + y;
|
||||
jun.register(contentPane);
|
||||
|
||||
var _wdh = jun.draw(ui(6), yy, con_w - ui(12), _m, _hover, pFOCUS, self) + ui(8);
|
||||
if(!is_undefined(_wdh)) hh += _wdh;
|
||||
continue;
|
||||
|
||||
} else if(is_instanceof(jun, widget)) {
|
||||
jun.setFocusHover(pFOCUS, pHOVER);
|
||||
var param = new widgetParam(ui(6), yy, con_w - ui(12), TEXTBOX_HEIGHT, noone, {}, _m, x, y);
|
||||
var _wdh = jun.drawParam(param);
|
||||
if(!is_undefined(_wdh)) hh += _wdh;
|
||||
continue;
|
||||
|
||||
} else if(is_array(jun)) { // LABEL
|
||||
var pad = i && _colsp == false? ui(4) : 0
|
||||
_colsp = false;
|
||||
|
@ -808,15 +804,33 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
|
||||
var txt = __txt(jun[0]);
|
||||
var coll = jun[1] && filter_text == "";
|
||||
|
||||
var lbx = 0;
|
||||
var lbh = viewMode? ui(32) : ui(26);
|
||||
var lbw = con_w;
|
||||
|
||||
var togl = array_safe_get_fast(jun, 2, noone);
|
||||
if(togl != noone) var toging = _inspecting.getInputData(togl);
|
||||
if(togl != noone) {
|
||||
lbx += ui(40);
|
||||
lbw -= ui(40);
|
||||
var toging = _inspecting.getInputData(togl);
|
||||
}
|
||||
|
||||
var lbx = (togl != noone) * ui(40);
|
||||
var lbw = con_w - lbx;
|
||||
var ltx = lbx + ui(32);
|
||||
var righ = array_safe_get_fast(jun, 3, noone);
|
||||
if(righ != noone) {
|
||||
lbw -= ui(40);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], lbx, yy, con_w, yy + lbh)) {
|
||||
var _bx = lbx + lbw + ui(8);
|
||||
var _by = yy;
|
||||
var _bw = ui(32);
|
||||
var _bh = lbh;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, _bx, _by, _bw, _bh, COLORS.panel_inspector_group_bg, 1);
|
||||
righ.setFocusHover(pFOCUS, pHOVER);
|
||||
righ.draw(_bx + ui(2), _by + ui(2), _bw - ui(4), _bh - ui(4), _m, THEME.button_hide_fill);
|
||||
}
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], lbx, yy, lbx + lbw, yy + lbh)) {
|
||||
contentPane.hover_content = true;
|
||||
draw_sprite_stretched_ext(THEME.s_box_r5_clr, 0, lbx, yy, lbw, lbh, COLORS.panel_inspector_group_hover, 1);
|
||||
|
||||
|
@ -851,6 +865,8 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
draw_sprite_ui(THEME.inspector_checkbox, 1, ui(16), yy + lbh / 2, 1, 1, 0, cc, 1);
|
||||
}
|
||||
|
||||
var ltx = lbx + ui(32);
|
||||
|
||||
draw_set_text(viewMode? f_p0 : f_p1, fa_left, fa_center, COLORS._main_text, aa);
|
||||
draw_text_add(ltx, yy + lbh / 2, txt);
|
||||
draw_set_alpha(1);
|
||||
|
|
37
scripts/tilesetBox/tilesetBox.gml
Normal file
|
@ -0,0 +1,37 @@
|
|||
function tilesetBox(_junction) : widget() constructor {
|
||||
self.junction = _junction;
|
||||
|
||||
b_newTileset = button(function() /*=>*/ {
|
||||
var b = nodeBuild("Node_Tile_Tileset", junction.node.x - 160, junction.node.y);
|
||||
junction.setFrom(b.outputs[0]);
|
||||
});
|
||||
|
||||
b_newTileset.text = __txt("New tileset");
|
||||
|
||||
static trigger = function() { }
|
||||
|
||||
static drawParam = function(params) {
|
||||
setParam(params);
|
||||
return draw(params.x, params.y, params.w, params.data, params.m);
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _tileset, _m) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
h = TEXTBOX_HEIGHT;
|
||||
|
||||
if(_tileset == noone) {
|
||||
b_newTileset.setFocusHover(active, hover);
|
||||
var param = new widgetParam(x, y, w, h, noone, {}, _m, rx, ry);
|
||||
b_newTileset.drawParam(param);
|
||||
|
||||
} else {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, x, y, w, h, COLORS._main_icon_light);
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static clone = function() { return new outputBox(); }
|
||||
}
|
13
scripts/tilesetBox/tilesetBox.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"tilesetBox",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"tilesetBox",
|
||||
"parent":{
|
||||
"name":"widgets",
|
||||
"path":"folders/widgets.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -4,6 +4,6 @@ varying vec4 v_vColour;
|
|||
void main() {
|
||||
vec4 draw = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
|
||||
if(draw.r < 0.) discard;
|
||||
if(draw.a == 0.) discard;
|
||||
gl_FragColor = draw;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ void main() {
|
|||
vec4 mask = texture2D( selectionMask, v_vTexcoord );
|
||||
|
||||
if(mask.r == 0.) discard;
|
||||
if(draw.r < 0.) discard;
|
||||
if(draw.r == -1.) discard;
|
||||
|
||||
gl_FragColor = draw;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec2 dimension;
|
||||
uniform vec2 tileSize;
|
||||
uniform vec2 tileAmo;
|
||||
|
||||
uniform sampler2D tileTexture;
|
||||
uniform vec2 tileTextureDim;
|
||||
|
@ -11,18 +10,40 @@ uniform vec2 tileTextureDim;
|
|||
uniform sampler2D indexTexture;
|
||||
uniform vec2 indexTextureDim;
|
||||
|
||||
uniform float animatedTiles[1024];
|
||||
uniform float animatedTilesIndex[128];
|
||||
uniform float animatedTilesLength[128];
|
||||
uniform float frame;
|
||||
|
||||
int mod(int a, int b) { return a - (a / b) * b; }
|
||||
|
||||
void main() {
|
||||
vec2 px = v_vTexcoord * dimension;
|
||||
gl_FragColor = vec4(0.);
|
||||
|
||||
vec4 samIdx = texture2D( indexTexture, floor(px / tileSize) / indexTextureDim );
|
||||
float index = samIdx.r - 1.;
|
||||
vec2 texTx = vec2(mod(index, tileAmo.x), floor(index / tileAmo.x)) * tileSize;
|
||||
vec2 px = v_vTexcoord * dimension;
|
||||
vec2 tileTx = mod(px, tileSize) / tileSize;
|
||||
vec2 texTx;
|
||||
float index = 0.;
|
||||
|
||||
vec2 tileAmo = floor(tileTextureDim / tileSize);
|
||||
vec4 samIdx = texture2D( indexTexture, floor(px / tileSize) / indexTextureDim );
|
||||
if(samIdx.r == 0.) return;
|
||||
|
||||
if(samIdx.r > 0.) {
|
||||
index = samIdx.r - 1.;
|
||||
|
||||
} if(samIdx.r < 0.) { // animated tiles
|
||||
int aId = int(-samIdx.r - 1.);
|
||||
float aIndex = animatedTilesIndex[aId];
|
||||
float aLength = animatedTilesLength[aId];
|
||||
float animL = mod(frame, float(aLength));
|
||||
index = animatedTiles[int(aIndex + animL)];
|
||||
}
|
||||
|
||||
texTx = vec2(mod(index, tileAmo.x), floor(index / tileAmo.x)) * tileSize;
|
||||
tileTx = mod(px, tileSize) / tileSize;
|
||||
|
||||
float vari = samIdx.g + 0.1;
|
||||
|
||||
float mRotation = mod(floor(vari), 4.);
|
||||
float mFlipH = mod(floor(vari / 8.), 2.);
|
||||
float mFlipV = mod(floor(vari / 16.), 2.);
|
||||
|
|
|
@ -321,6 +321,6 @@ void main() {
|
|||
}
|
||||
|
||||
float res = float(indexes[index]);
|
||||
gl_FragColor = vec4(res + 1., 0., 0., 0.);
|
||||
gl_FragColor = vec4(res + 1., 0., 0., 1.);
|
||||
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 510 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 495 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 374 B After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 424 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 510 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |