mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
Argument renderer. HLSL uniform
This commit is contained in:
parent
818473dc45
commit
09c9b9bd87
33 changed files with 456 additions and 246 deletions
|
@ -98,7 +98,6 @@
|
|||
{"name":"effects","order":3,"path":"folders/nodes/data/filter/effects.yy",},
|
||||
{"name":"fixes","order":6,"path":"folders/nodes/data/filter/fixes.yy",},
|
||||
{"name":"warps","order":2,"path":"folders/nodes/data/filter/warps.yy",},
|
||||
{"name":"fluidSim","order":2,"path":"folders/nodes/data/simulation/fluidSim.yy",},
|
||||
{"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",},
|
||||
|
@ -122,7 +121,10 @@
|
|||
{"name":"draw","order":3,"path":"folders/nodes/data/pixel builder/draw.yy",},
|
||||
{"name":"effect","order":4,"path":"folders/nodes/data/pixel builder/effect.yy",},
|
||||
{"name":"render","order":3,"path":"folders/nodes/data/render.yy",},
|
||||
{"name":"simulation","order":23,"path":"folders/nodes/data/simulation.yy",},
|
||||
{"name":"fluidSim","order":2,"path":"folders/nodes/data/simulation/fluidSim.yy",},
|
||||
{"name":"strandSim","order":1,"path":"folders/nodes/data/simulation/strandSim.yy",},
|
||||
{"name":"VFX","order":3,"path":"folders/nodes/data/simulation/VFX.yy",},
|
||||
{"name":"transform","order":9,"path":"folders/nodes/data/transform.yy",},
|
||||
{"name":"value","order":4,"path":"folders/nodes/data/value.yy",},
|
||||
{"name":"atlas","order":9,"path":"folders/nodes/data/value/atlas.yy",},
|
||||
|
@ -131,7 +133,6 @@
|
|||
{"name":"struct","order":6,"path":"folders/nodes/data/value/struct.yy",},
|
||||
{"name":"surface","order":10,"path":"folders/nodes/data/value/surface.yy",},
|
||||
{"name":"trigger","order":8,"path":"folders/nodes/data/value/trigger.yy",},
|
||||
{"name":"VFX","order":3,"path":"folders/nodes/data/simulation/VFX.yy",},
|
||||
{"name":"3D","order":133,"path":"folders/nodes/icons/3D.yy",},
|
||||
{"name":"animation","order":135,"path":"folders/nodes/icons/animation.yy",},
|
||||
{"name":"filter","order":141,"path":"folders/nodes/icons/filter.yy",},
|
||||
|
@ -207,7 +208,6 @@
|
|||
{"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",},
|
||||
{"name":"widget","order":3,"path":"folders/VCT/widget.yy",},
|
||||
{"name":"widgets","order":5,"path":"folders/widgets.yy",},
|
||||
{"name":"simulation","order":23,"path":"folders/nodes/data/simulation.yy",},
|
||||
],
|
||||
"ResourceOrderSettings": [
|
||||
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
|
||||
|
@ -846,7 +846,7 @@
|
|||
{"name":"s_node_text_display","order":4,"path":"sprites/s_node_text_display/s_node_text_display.yy",},
|
||||
{"name":"sh_d3d_outline","order":16,"path":"shaders/sh_d3d_outline/sh_d3d_outline.yy",},
|
||||
{"name":"node_strand_render_texture","order":7,"path":"scripts/node_strand_render_texture/node_strand_render_texture.yy",},
|
||||
{"name":"luaRenderer","order":2,"path":"scripts/luaRenderer/luaRenderer.yy",},
|
||||
{"name":"argumentRenderer","order":2,"path":"scripts/argumentRenderer/argumentRenderer.yy",},
|
||||
{"name":"node_blur_zoom","order":3,"path":"scripts/node_blur_zoom/node_blur_zoom.yy",},
|
||||
{"name":"node_bloom","order":3,"path":"scripts/node_bloom/node_bloom.yy",},
|
||||
{"name":"sh_bevel","order":2,"path":"shaders/sh_bevel/sh_bevel.yy",},
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"effects","folderPath":"folders/nodes/data/filter/effects.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"fixes","folderPath":"folders/nodes/data/filter/fixes.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"warps","folderPath":"folders/nodes/data/filter/warps.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"fluidSim","folderPath":"folders/nodes/data/simulation/fluidSim.yy",},
|
||||
{"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",},
|
||||
|
@ -148,8 +147,11 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"draw","folderPath":"folders/nodes/data/pixel builder/draw.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"effect","folderPath":"folders/nodes/data/pixel builder/effect.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"render","folderPath":"folders/nodes/data/render.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"simulation","folderPath":"folders/nodes/data/simulation.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"fluidSim","folderPath":"folders/nodes/data/simulation/fluidSim.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"rigidSim","folderPath":"folders/nodes/data/simulation/rigidSim.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"strandSim","folderPath":"folders/nodes/data/simulation/strandSim.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"VFX","folderPath":"folders/nodes/data/simulation/VFX.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"transform","folderPath":"folders/nodes/data/transform.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"value","folderPath":"folders/nodes/data/value.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"array","folderPath":"folders/nodes/data/value/array.yy",},
|
||||
|
@ -164,7 +166,6 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/nodes/data/value/surface.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"texts","folderPath":"folders/nodes/data/value/texts.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"trigger","folderPath":"folders/nodes/data/value/trigger.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"VFX","folderPath":"folders/nodes/data/simulation/VFX.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"icons","folderPath":"folders/nodes/icons.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"3D","folderPath":"folders/nodes/icons/3D.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"animation","folderPath":"folders/nodes/icons/animation.yy",},
|
||||
|
@ -245,7 +246,6 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"simulation","folderPath":"folders/nodes/data/simulation.yy",},
|
||||
],
|
||||
"IncludedFiles": [
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
|
||||
|
@ -292,6 +292,9 @@
|
|||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"empty.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"1.png.tmp$$","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"code_show_auto.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"code_show_line.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"code_syntax_highlight.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"graphics x2.ai","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"rotator_random_mode.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_3d_preview_settings.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
|
||||
|
@ -1467,7 +1470,7 @@
|
|||
{"id":{"name":"s_node_text_display","path":"sprites/s_node_text_display/s_node_text_display.yy",},},
|
||||
{"id":{"name":"sh_d3d_outline","path":"shaders/sh_d3d_outline/sh_d3d_outline.yy",},},
|
||||
{"id":{"name":"node_strand_render_texture","path":"scripts/node_strand_render_texture/node_strand_render_texture.yy",},},
|
||||
{"id":{"name":"luaRenderer","path":"scripts/luaRenderer/luaRenderer.yy",},},
|
||||
{"id":{"name":"argumentRenderer","path":"scripts/argumentRenderer/argumentRenderer.yy",},},
|
||||
{"id":{"name":"node_blur_zoom","path":"scripts/node_blur_zoom/node_blur_zoom.yy",},},
|
||||
{"id":{"name":"node_bloom","path":"scripts/node_bloom/node_bloom.yy",},},
|
||||
{"id":{"name":"sh_bevel","path":"shaders/sh_bevel/sh_bevel.yy",},},
|
||||
|
|
Binary file not shown.
|
@ -181,13 +181,17 @@
|
|||
var y0 = dialog_y - dialog_resizable * 6;
|
||||
var y1 = dialog_y + dialog_h + dialog_resizable * 6;
|
||||
|
||||
if(destroy_on_click_out && mouse_press(mb_any) && !point_in_rectangle(mouse_mx, mouse_my, x0, y0, x1, y1)) {
|
||||
if(destroy_on_click_out && mouse_press(mb_any) && !point_in_rectangle(mouse_mx, mouse_my, x0, y0, x1, y1)
|
||||
&& checkClosable()) {
|
||||
|
||||
instance_destroy(self);
|
||||
onDestroy();
|
||||
DIALOG_CLICK = false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkClosable() { return true; }
|
||||
|
||||
function onDestroy() {}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ if !ready exit;
|
|||
|
||||
#region window control
|
||||
if(sFOCUS) {
|
||||
if(destroy_on_escape && keyboard_check_pressed(vk_escape))
|
||||
if(destroy_on_escape && keyboard_check_pressed(vk_escape) && checkClosable())
|
||||
instance_destroy(self);
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -57,6 +57,11 @@ event_inherited();
|
|||
}
|
||||
}
|
||||
|
||||
function checkClosable() {
|
||||
if(!content) return true;
|
||||
return content.checkClosable();
|
||||
}
|
||||
|
||||
function onDestroy() {
|
||||
if(!content) return;
|
||||
content.onClose();
|
||||
|
|
|
@ -70,30 +70,15 @@
|
|||
});
|
||||
|
||||
function applyAutoComplete(rep) {
|
||||
var line = array_safe_get(textbox._input_text_line, textbox.cursor_line, "");
|
||||
var _line_curs = textbox.cursor - textbox.char_run;
|
||||
var crop = string_copy(line, 1, _line_curs);
|
||||
var rest = string_copy(line, _line_curs + 1, string_length(line) - _line_curs);
|
||||
var slp = string_splice(crop, [" ", "(", ","], true);
|
||||
slp[array_length(slp) - 1] = rep;
|
||||
var _totAmo = string_length(textbox._input_text);
|
||||
var _prmAmo = string_length(prompt);
|
||||
var _repAmo = string_length(rep);
|
||||
|
||||
var txt = "";
|
||||
for( var i = 0, n = array_length(textbox._input_text_line); i < n; i++ ) {
|
||||
if(i == textbox.cursor_line) {
|
||||
for( var j = 0; j < array_length(slp); j++ )
|
||||
txt += slp[j];
|
||||
txt += rest;
|
||||
continue;
|
||||
}
|
||||
|
||||
txt += textbox._input_text_line[i];
|
||||
}
|
||||
var _sPreC = string_copy(textbox._input_text, 1, textbox.cursor - _prmAmo);
|
||||
var _sPosC = string_copy(textbox._input_text, textbox.cursor + 1, _totAmo - textbox.cursor);
|
||||
|
||||
txt = string_trim(txt, [ "\n" ]);
|
||||
var shf = string_length(rep) - string_length(prompt);
|
||||
|
||||
textbox.cursor += shf;
|
||||
textbox._input_text = txt;
|
||||
textbox._input_text = $"{_sPreC}{rep}{_sPosC}";
|
||||
textbox.cursor += _repAmo - _prmAmo;
|
||||
textbox.cut_line();
|
||||
|
||||
active = false;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function argumentRenderer() {
|
||||
function argumentRenderer(_typeArray = []) {
|
||||
argument_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
argument_renderer.x = _x;
|
||||
argument_renderer.y = _y;
|
||||
|
@ -11,7 +11,6 @@ function argumentRenderer() {
|
|||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var _jType = inputs[| i + 1];
|
||||
var _typ = _jType.getValue();
|
||||
var _h = 0;
|
||||
|
||||
_jType.editWidget.setFocusHover(_focus, _hover);
|
||||
|
@ -28,14 +27,10 @@ function argumentRenderer() {
|
|||
|
||||
var _jValue = inputs[| i + 2];
|
||||
if(_jValue.editWidget != noone) {
|
||||
var params = new widgetParam(tx + ui(64), ty + _th + ui(6), _w - ui(64), TEXTBOX_HEIGHT, _jValue.showValue(), -1, _m, argument_renderer.rx, argument_renderer.ry);
|
||||
|
||||
_jValue.editWidget.setFocusHover(_focus, _hover);
|
||||
if(_typ == 2) {
|
||||
_jValue.editWidget.draw(tx + ui(64), ty + _th + ui(6), _w - ui(64), ui(96), _jValue.showValue(), _m, argument_renderer.rx, argument_renderer.ry);
|
||||
_h += ui(96 + 8);
|
||||
} else {
|
||||
_jValue.editWidget.draw(tx + ui(64), ty + _th + ui(6), _w - ui(64), TEXTBOX_HEIGHT, _jValue.showValue(), _m);
|
||||
_h += TEXTBOX_HEIGHT + ui(8);
|
||||
}
|
||||
_h += _jValue.editWidget.drawParam(params) + ui(8);
|
||||
}
|
||||
|
||||
hh += _h;
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "luaRenderer",
|
||||
"name": "argumentRenderer",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
|
@ -56,12 +56,12 @@
|
|||
global.HLSL_FUNCTIONS[? "sin"] = ["x"];
|
||||
global.HLSL_FUNCTIONS[? "sincos"] = ["x", "out s", "out c"];
|
||||
global.HLSL_FUNCTIONS[? "sinh"] = ["x"];
|
||||
global.HLSL_FUNCTIONS[? "smoothstep"] = ["min", "max", "x"];
|
||||
global.HLSL_FUNCTIONS[? "smoothstep"]= ["min", "max", "x"];
|
||||
global.HLSL_FUNCTIONS[? "sqrt"] = ["x"];
|
||||
global.HLSL_FUNCTIONS[? "step"] = ["y", "x"];
|
||||
global.HLSL_FUNCTIONS[? "tan"] = ["x"];
|
||||
global.HLSL_FUNCTIONS[? "tanh"] = ["x"];
|
||||
global.HLSL_FUNCTIONS[? "transpose"] = ["x"];
|
||||
global.HLSL_FUNCTIONS[? "transpose"]= ["x"];
|
||||
global.HLSL_FUNCTIONS[? "trunc"] = ["x"];
|
||||
#endregion
|
||||
|
||||
|
@ -75,7 +75,7 @@ function hlsl_document_parser(prompt, node = noone) {
|
|||
var _arg_name = node.inputs[| i + 0].getValue();
|
||||
var _arg_type = node.inputs[| i + 1].getValue();
|
||||
|
||||
params = array_push(params, [ _arg_name, array_safe_get(global.HLSL_VAR, _arg_type) ]);
|
||||
array_push(params, [ _arg_name, array_safe_get(global.HLSL_VAR, _arg_type) ]);
|
||||
}
|
||||
|
||||
for( var i = 0, n = array_length(lines); i < n; i++ ) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
global.lua_arguments = [];
|
||||
|
||||
global.lua_reserved = ds_map_create();
|
||||
var reserved = ["and", "break", "do", "else", "elseif", "end", "false",
|
||||
"for", "function", "if", "in", "local", "nil", "not",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
||||
size = 9;
|
||||
function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() constructor {
|
||||
size = _size;
|
||||
inputs = size * size;
|
||||
onModify = _onModify;
|
||||
unit = _unit;
|
||||
|
||||
|
@ -11,7 +12,7 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
var modi = false;
|
||||
|
||||
if(linked) {
|
||||
for( var i = 0; i < size; i++ )
|
||||
for( var i = 0; i < inputs; i++ )
|
||||
modi |= onModify(i, toNumber(val));
|
||||
return modi;
|
||||
}
|
||||
|
@ -22,14 +23,17 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
onModifySingle[0] = function(val) { return onModifyIndex(0, val); }
|
||||
onModifySingle[1] = function(val) { return onModifyIndex(1, val); }
|
||||
onModifySingle[2] = function(val) { return onModifyIndex(2, val); }
|
||||
|
||||
onModifySingle[3] = function(val) { return onModifyIndex(3, val); }
|
||||
|
||||
onModifySingle[4] = function(val) { return onModifyIndex(4, val); }
|
||||
onModifySingle[5] = function(val) { return onModifyIndex(5, val); }
|
||||
|
||||
onModifySingle[6] = function(val) { return onModifyIndex(6, val); }
|
||||
onModifySingle[7] = function(val) { return onModifyIndex(7, val); }
|
||||
onModifySingle[8] = function(val) { return onModifyIndex(8, val); }
|
||||
|
||||
onModifySingle[ 8] = function(val) { return onModifyIndex( 8, val); }
|
||||
onModifySingle[ 9] = function(val) { return onModifyIndex( 9, val); }
|
||||
onModifySingle[10] = function(val) { return onModifyIndex(10, val); }
|
||||
onModifySingle[11] = function(val) { return onModifyIndex(11, val); }
|
||||
|
||||
extras = -1;
|
||||
|
||||
|
@ -37,7 +41,7 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
self.interactable = interactable;
|
||||
b_link.interactable = interactable;
|
||||
|
||||
for( var i = 0; i < size; i++ )
|
||||
for( var i = 0; i < inputs; i++ )
|
||||
tb[i].interactable = interactable;
|
||||
|
||||
if(extras)
|
||||
|
@ -47,7 +51,7 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
static register = function(parent = noone) {
|
||||
b_link.register(parent);
|
||||
|
||||
for( var i = 0; i < size; i++ )
|
||||
for( var i = 0; i < inputs; i++ )
|
||||
tb[i].register(parent);
|
||||
|
||||
if(extras)
|
||||
|
@ -57,13 +61,13 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
unit.triggerButton.register(parent);
|
||||
}
|
||||
|
||||
for(var i = 0; i < size; i++) {
|
||||
for(var i = 0; i < inputs; i++) {
|
||||
tb[i] = new textBox(_type, onModifySingle[i]);
|
||||
tb[i].slidable = true;
|
||||
}
|
||||
|
||||
static setSlideSpeed = function(speed) {
|
||||
for(var i = 0; i < size; i++)
|
||||
for(var i = 0; i < inputs; i++)
|
||||
tb[i].slide_speed = speed;
|
||||
}
|
||||
|
||||
|
@ -97,7 +101,7 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values");
|
||||
|
||||
var hh = TEXTBOX_HEIGHT + ui(8);
|
||||
var th = hh * 3 - ui(8);
|
||||
var th = hh * size - ui(8);
|
||||
|
||||
var bx = _x;
|
||||
var by = _y + th / 2 - ui(32 / 2);
|
||||
|
@ -106,11 +110,11 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
|
|||
_x += ui(28);
|
||||
_w -= ui(28);
|
||||
|
||||
var ww = _w / 3;
|
||||
var ww = _w / size;
|
||||
|
||||
for(var i = 0; i < 3; i++)
|
||||
for(var j = 0; j < 3; j++) {
|
||||
var ind = i * 3 + j;
|
||||
for(var i = 0; i < size; i++)
|
||||
for(var j = 0; j < size; j++) {
|
||||
var ind = i * size + j;
|
||||
tb[ind].setFocusHover(active, hover);
|
||||
|
||||
var bx = _x + ww * j;
|
||||
|
|
|
@ -9,7 +9,7 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Kernel", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, array_create(9))
|
||||
.setDisplay(VALUE_DISPLAY.kernel);
|
||||
.setDisplay(VALUE_DISPLAY.matrix, 3);
|
||||
|
||||
inputs[| 2] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.")
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]);
|
||||
|
|
|
@ -48,7 +48,7 @@ output.color = surfaceColor;")
|
|||
inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
|
||||
|
||||
inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Float", "Int", "Vec2", "Vec3", "Vec4", "Mat3", "Mat4", "Sampler2D" ], { update_hover: false });
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Float", "Int", "Vec2", "Vec3", "Vec4", "Mat3", "Mat4", "Sampler2D", "Color" ], { update_hover: false });
|
||||
inputs[| index + 1].editWidget.interactable = false;
|
||||
|
||||
inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
|
||||
|
@ -65,14 +65,92 @@ output.color = surfaceColor;")
|
|||
|
||||
setIsDynamicInput(3);
|
||||
|
||||
static refreshDynamicInput = function() { #region
|
||||
var _in = ds_list_create();
|
||||
|
||||
for( var i = 0; i < input_fix_len; i++ )
|
||||
ds_list_add(_in, inputs[| i]);
|
||||
|
||||
array_resize(input_display_list, input_display_len);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
if(inputs[| i].getValue() == "") {
|
||||
delete inputs[| i + 0];
|
||||
delete inputs[| i + 1];
|
||||
delete inputs[| i + 2];
|
||||
continue;
|
||||
}
|
||||
|
||||
var inp_type = inputs[| i + 1];
|
||||
var inp_valu = inputs[| i + 2];
|
||||
|
||||
ds_list_add(_in, inputs[| i + 0]);
|
||||
ds_list_add(_in, inp_type);
|
||||
ds_list_add(_in, inp_valu);
|
||||
|
||||
inp_type.editWidget.interactable = true;
|
||||
if(inp_valu.editWidget != noone)
|
||||
inp_valu.editWidget.interactable = true;
|
||||
|
||||
var type = inp_type.getValue();
|
||||
switch(type) {
|
||||
case 1 :
|
||||
inp_valu.type = VALUE_TYPE.integer;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY._default);
|
||||
break;
|
||||
case 0 :
|
||||
inp_valu.type = VALUE_TYPE.float;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY._default);
|
||||
break;
|
||||
case 2 :
|
||||
inp_valu.type = VALUE_TYPE.float;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY.vector, 2);
|
||||
break;
|
||||
case 3 :
|
||||
inp_valu.type = VALUE_TYPE.float;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY.vector, 3);
|
||||
break;
|
||||
case 4 :
|
||||
inp_valu.type = VALUE_TYPE.float;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY.vector, 4);
|
||||
break;
|
||||
case 5 :
|
||||
inp_valu.type = VALUE_TYPE.float;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY.matrix, 3);
|
||||
break;
|
||||
case 6 :
|
||||
inp_valu.type = VALUE_TYPE.float;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY.matrix, 4);
|
||||
break;
|
||||
case 7 :
|
||||
inp_valu.type = VALUE_TYPE.surface;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY._default);
|
||||
break;
|
||||
case 8 :
|
||||
inp_valu.type = VALUE_TYPE.color;
|
||||
inp_valu.setDisplay(VALUE_DISPLAY._default);
|
||||
break;
|
||||
}
|
||||
|
||||
array_push(input_display_list, i + 2);
|
||||
}
|
||||
|
||||
for( var i = 0; i < ds_list_size(_in); i++ )
|
||||
_in[| i].index = i;
|
||||
|
||||
ds_list_destroy(inputs);
|
||||
inputs = _in;
|
||||
|
||||
createNewInput();
|
||||
#endregion
|
||||
} if(!LOADING && !APPENDING) refreshDynamicInput();
|
||||
|
||||
insp1UpdateTooltip = __txt("Compile");
|
||||
insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ];
|
||||
|
||||
static onInspector1Update = function() { //compile
|
||||
refreshShader();
|
||||
}
|
||||
static onInspector1Update = function() { refreshShader(); }
|
||||
|
||||
static refreshShader = function() {
|
||||
static refreshShader = function() { #region
|
||||
var vs = inputs[| 0].getValue();
|
||||
var fs = inputs[| 1].getValue();
|
||||
|
||||
|
@ -113,36 +191,48 @@ struct VertexShaderOutput {
|
|||
};
|
||||
|
||||
struct PixelShaderOutput {
|
||||
float4 color : SV_Target0;
|
||||
float4 color : SV_TARGET0;
|
||||
};
|
||||
"
|
||||
var fs_param = "";
|
||||
var fs_param = "cbuffer Data : register(b10) {";
|
||||
var fs_sample = "";
|
||||
var sampler_slot = 1;
|
||||
|
||||
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) {
|
||||
var _arg_name = inputs[| i + 0].getValue();
|
||||
if(_arg_name == "") continue;
|
||||
|
||||
var _arg_type = inputs[| i + 1].getValue();
|
||||
|
||||
switch(_arg_type) {
|
||||
case 0 : fs_param += $"uniform float {_arg_name};\n"; break; //u_float
|
||||
case 1 : fs_param += $"uniform int {_arg_name};\n"; break; //u_int
|
||||
case 2 : fs_param += $"uniform float2 {_arg_name};\n"; break; //u_vec2
|
||||
case 3 : fs_param += $"uniform float3 {_arg_name};\n"; break; //u_vec3
|
||||
case 4 : fs_param += $"uniform float4 {_arg_name};\n"; break; //u_vec4
|
||||
case 5 : fs_param += $"uniform float3x3 {_arg_name};\n"; break; //u_mat3
|
||||
case 6 : fs_param += $"uniform float4x4 {_arg_name};\n"; break; //u_mat4
|
||||
case 0 : fs_param += $"float {_arg_name};\n"; break; //u_float
|
||||
case 1 : fs_param += $"int {_arg_name};\n"; break; //u_int
|
||||
case 2 : fs_param += $"float2 {_arg_name};\n"; break; //u_vec2
|
||||
case 3 : fs_param += $"float3 {_arg_name};\n"; break; //u_vec3
|
||||
case 4 : fs_param += $"float4 {_arg_name};\n"; break; //u_vec4
|
||||
case 5 : fs_param += $"float3x3 {_arg_name};\n"; break; //u_mat3
|
||||
case 6 : fs_param += $"float4x4 {_arg_name};\n"; break; //u_mat4
|
||||
case 7 : //u_sampler2D
|
||||
fs_param += $"Texture2D {_arg_name}Object : register(t{sampler_slot});\nSamplerState {_arg_name} : register(s{sampler_slot});\n";
|
||||
fs_sample += $"Texture2D {_arg_name}Object : register(t{sampler_slot});\n";
|
||||
fs_sample += $"SamplerState {_arg_name} : register(s{sampler_slot});\n";
|
||||
sampler_slot++;
|
||||
break;
|
||||
case 8 : fs_param += $"float4 {_arg_name};\n"; break; //u_vec4
|
||||
}
|
||||
}
|
||||
|
||||
fs_param += "};\n";
|
||||
fs_param += fs_sample;
|
||||
|
||||
var fs_pos = "\nvoid main(in VertexShaderOutput input, out PixelShaderOutput output) {\n" + fs + "\n}";
|
||||
|
||||
fs = fs_pre + fs_param + fs_pos;
|
||||
file_text_write_all(_dir + "fout.shader", fs);
|
||||
|
||||
print("==================== Compiling ====================");
|
||||
print(fs)
|
||||
print("===================================================\n");
|
||||
|
||||
shader.vs = d3d11_shader_compile_vs(_dir + "vout.shader", "main", "vs_4_0");
|
||||
if (!d3d11_shader_exists(shader.vs))
|
||||
noti_warning(d3d11_get_error_string());
|
||||
|
@ -150,16 +240,22 @@ struct PixelShaderOutput {
|
|||
shader.fs = d3d11_shader_compile_ps(_dir + "fout.shader", "main", "ps_4_0");
|
||||
if (!d3d11_shader_exists(shader.fs))
|
||||
noti_warning(d3d11_get_error_string());
|
||||
}
|
||||
} #endregion
|
||||
if(!LOADING && !APPENDING) refreshShader();
|
||||
|
||||
static onValueUpdate = function(index) {
|
||||
var _refresh = index == 0 || index == 1 || (index > input_fix_len && (index - input_fix_len) % data_length != 2);
|
||||
static onValueUpdate = function(index) { #region
|
||||
var _refresh = index == 0 || index == 1
|
||||
|| (index >= input_fix_len && (index - input_fix_len) % data_length != 2);
|
||||
if(_refresh) refreshShader();
|
||||
}
|
||||
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
|
||||
var _surf = _data[2];
|
||||
if(!is_surface(_surf)) return;
|
||||
if(!is_surface(_surf)) return noone;
|
||||
if(!d3d11_shader_exists(shader.vs)) return noone;
|
||||
|
||||
_output = surface_verify(_output, surface_get_width_safe(_surf), surface_get_height_safe(_surf));
|
||||
|
||||
surface_set_target(_output);
|
||||
|
@ -169,24 +265,71 @@ struct PixelShaderOutput {
|
|||
d3d11_shader_override_ps(shader.fs);
|
||||
|
||||
var uTypes = array_create(8, 0);
|
||||
var sampler_slot = 1;
|
||||
|
||||
d3d11_cbuffer_begin();
|
||||
var _buffer = buffer_create(1, buffer_grow, 1);
|
||||
var _cbSize = 0;
|
||||
|
||||
for( var i = input_fix_len, n = array_length(_data); i < n; i += data_length ) {
|
||||
var _arg_name = _data[i + 0];
|
||||
if(_arg_name == "") continue;
|
||||
|
||||
var _arg_type = _data[i + 1];
|
||||
var _arg_valu = _data[i + 2];
|
||||
var _uni = shader_get_uniform(shader.fs, _arg_name);
|
||||
|
||||
switch(_arg_type) {
|
||||
case 0 : shader_set_f(_arg_name, _arg_valu); break; //u_float
|
||||
case 1 : shader_set_i(_arg_name, _arg_valu); break; //u_int
|
||||
case 2 : shader_set_f(_arg_name, _arg_valu); break; //u_vec2
|
||||
case 3 : shader_set_f(_arg_name, _arg_valu); break; //u_vec3
|
||||
case 4 : shader_set_f(_arg_name, _arg_valu); break; //u_vec4
|
||||
case 5 : shader_set_f(_arg_name, _arg_valu); break; //u_mat3
|
||||
case 6 : shader_set_f(_arg_name, _arg_valu); break; //u_mat4
|
||||
case 7 : shader_set_surface(_arg_name, _arg_valu); break; //u_sampler2D
|
||||
case 1 :
|
||||
d3d11_cbuffer_add_int(1);
|
||||
_cbSize++;
|
||||
|
||||
buffer_write(_buffer, buffer_s32, _arg_valu);
|
||||
break;
|
||||
case 0 :
|
||||
d3d11_cbuffer_add_float(1);
|
||||
_cbSize++;
|
||||
|
||||
buffer_write(_buffer, buffer_f32, _arg_valu);
|
||||
break;
|
||||
case 2 :
|
||||
case 3 :
|
||||
case 4 :
|
||||
case 5 :
|
||||
case 6 :
|
||||
if(is_array(_arg_valu)) {
|
||||
d3d11_cbuffer_add_float(array_length(_arg_valu));
|
||||
_cbSize += array_length(_arg_valu);
|
||||
|
||||
for( var i = 0, n = array_length(_arg_valu); i < n; i++ )
|
||||
buffer_write(_buffer, buffer_f32, _arg_valu[i]);
|
||||
}
|
||||
break;
|
||||
case 8 :
|
||||
var _clr = colToVec4(_arg_valu);
|
||||
d3d11_cbuffer_add_float(4);
|
||||
_cbSize += 4;
|
||||
|
||||
for( var i = 0, n = 4; i < n; i++ )
|
||||
buffer_write(_buffer, buffer_f32, _clr[i]);
|
||||
break;
|
||||
case 7 :
|
||||
if(is_surface(_arg_valu))
|
||||
d3d11_texture_set_stage_ps(sampler_slot, surface_get_texture(_arg_valu));
|
||||
sampler_slot++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
matrix_set(matrix_world, matrix_build(0, 0, 0, 0, 0, 0, surface_get_width_safe(_surf), surface_get_height_safe(_surf), 1));
|
||||
d3d11_cbuffer_add_float(4 - _cbSize % 4);
|
||||
var cbuff = d3d11_cbuffer_end();
|
||||
d3d11_cbuffer_update(cbuff, _buffer);
|
||||
buffer_delete(_buffer);
|
||||
|
||||
d3d11_shader_set_cbuffer_ps(10, cbuff);
|
||||
|
||||
matrix_set(matrix_world, matrix_build(0, 0, 0, 0, 0, 0,
|
||||
surface_get_width_safe(_surf), surface_get_height_safe(_surf), 1));
|
||||
vertex_submit(global.HLSL_VB, pr_trianglestrip, surface_get_texture(_surf));
|
||||
matrix_set(matrix_world, matrix_build_identity());
|
||||
|
||||
|
@ -195,7 +338,7 @@ struct PixelShaderOutput {
|
|||
surface_reset_target();
|
||||
|
||||
return _output;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static postConnect = function() { refreshShader(); }
|
||||
}
|
|
@ -32,7 +32,7 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
outputs[| 1] = nodeValue("Return value", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, 0);
|
||||
|
||||
argumentRenderer();
|
||||
argumentRenderer(global.lua_arguments);
|
||||
|
||||
input_display_list = [ 3, 4,
|
||||
["Function", false], 0, 1,
|
||||
|
|
|
@ -33,7 +33,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
outputs[| 1] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
attribute_surface_depth();
|
||||
argumentRenderer();
|
||||
argumentRenderer(global.lua_arguments);
|
||||
|
||||
input_display_list = [ 3, 4,
|
||||
["Function", false], 0, 1,
|
||||
|
|
|
@ -2,7 +2,7 @@ function Node_PB_Fx_Highlight(_x, _y, _group = noone) : Node_PB_Fx(_x, _y, _grou
|
|||
name = "Highlight";
|
||||
|
||||
inputs[| 1] = nodeValue("Highlight Area", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, array_create(9) )
|
||||
.setDisplay(VALUE_DISPLAY.kernel);
|
||||
.setDisplay(VALUE_DISPLAY.matrix, 3);
|
||||
|
||||
inputs[| 2] = nodeValue("Light Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white );
|
||||
|
||||
|
|
|
@ -79,10 +79,10 @@ enum VALUE_DISPLAY {
|
|||
vector,
|
||||
vector_range,
|
||||
area,
|
||||
kernel,
|
||||
transform,
|
||||
corner,
|
||||
toggle,
|
||||
matrix,
|
||||
|
||||
//Curve
|
||||
curve,
|
||||
|
@ -252,7 +252,7 @@ function typeArray(_type) { #region
|
|||
case VALUE_DISPLAY.padding :
|
||||
case VALUE_DISPLAY.area :
|
||||
case VALUE_DISPLAY.puppet_control :
|
||||
case VALUE_DISPLAY.kernel :
|
||||
case VALUE_DISPLAY.matrix :
|
||||
case VALUE_DISPLAY.transform :
|
||||
|
||||
case VALUE_DISPLAY.curve :
|
||||
|
@ -289,7 +289,7 @@ function typeIncompatible(from, to) { #region
|
|||
if(from.type == VALUE_TYPE.surface && (to.type == VALUE_TYPE.integer || to.type == VALUE_TYPE.float)) {
|
||||
switch(to.display_type) {
|
||||
case VALUE_DISPLAY.area :
|
||||
case VALUE_DISPLAY.kernel :
|
||||
case VALUE_DISPLAY.matrix :
|
||||
case VALUE_DISPLAY.vector_range :
|
||||
case VALUE_DISPLAY.puppet_control :
|
||||
case VALUE_DISPLAY.padding :
|
||||
|
@ -691,8 +691,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
break; #endregion
|
||||
case VALUE_DISPLAY.vector : #region
|
||||
var val = animator.getValue();
|
||||
if(array_length(val) <= 4) {
|
||||
editWidget = new vectorBox(array_length(animator.getValue()), function(index, val) {
|
||||
var len = display_data == -1? array_length(val) : display_data;
|
||||
|
||||
if(len <= 4) {
|
||||
editWidget = new vectorBox(len, function(index, val) {
|
||||
//var _val = animator.getValue();
|
||||
//_val[index] = val;
|
||||
return setValueDirect(val, index);
|
||||
|
@ -700,11 +702,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
|
||||
if(display_data != -1) editWidget.extras = display_data;
|
||||
|
||||
if(array_length(val) == 2) {
|
||||
if(len == 2) {
|
||||
extract_node = [ "Node_Vector2", "Node_Path" ];
|
||||
} else if(array_length(val) == 3)
|
||||
} else if(len == 3)
|
||||
extract_node = "Node_Vector3";
|
||||
else if(array_length(val) == 4)
|
||||
else if(len == 4)
|
||||
extract_node = "Node_Vector4";
|
||||
}
|
||||
|
||||
|
@ -847,8 +849,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
key_inter = CURVE_TYPE.cut;
|
||||
extract_node = "";
|
||||
break; #endregion
|
||||
case VALUE_DISPLAY.kernel : #region
|
||||
editWidget = new matrixGrid(_txt, function(index, val) {
|
||||
case VALUE_DISPLAY.matrix : #region
|
||||
editWidget = new matrixGrid(_txt, display_data, function(index, val) {
|
||||
var _val = animator.getValue();
|
||||
_val[index] = val;
|
||||
return setValueDirect(_val);
|
||||
|
|
|
@ -37,7 +37,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
drag_my = 0;
|
||||
drag_s = [[0, 0], [0, 0]];
|
||||
|
||||
attributes[? "initalset"] = false;
|
||||
attributes[? "initalset"] = LOADING || APPENDING;
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(index == 0 && attributes[? "initalset"] == false) {
|
||||
|
@ -57,7 +57,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
} #endregion
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
if(array_length(current_data) < ds_list_size(inputs)) return;
|
||||
PROCESSOR_OVERLAY_CHECK
|
||||
|
||||
var _surf = outputs[| 0].getValue();
|
||||
if(is_array(_surf)) {
|
||||
|
@ -65,10 +65,10 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
_surf = _surf[preview_index];
|
||||
}
|
||||
|
||||
var tl = array_clone(current_data[1]);
|
||||
var tr = array_clone(current_data[2]);
|
||||
var bl = array_clone(current_data[3]);
|
||||
var br = array_clone(current_data[4]);
|
||||
var tl = array_clone(getInputData(1));
|
||||
var tr = array_clone(getInputData(2));
|
||||
var bl = array_clone(getInputData(3));
|
||||
var br = array_clone(getInputData(4));
|
||||
|
||||
tl[0] = _x + tl[0] * _s;
|
||||
tr[0] = _x + tr[0] * _s;
|
||||
|
@ -114,8 +114,10 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _trx = value_snap(drag_s[1][0] + dx, _snx);
|
||||
var _try = value_snap(drag_s[1][1] + dy, _sny);
|
||||
|
||||
inputs[| 1].setValue([ _tlx, _tly ])
|
||||
if(inputs[| 2].setValue([ _trx, _try ])) UNDO_HOLDING = true;
|
||||
var _up1 = inputs[| 1].setValue([ _tlx, _tly ]);
|
||||
var _up2 = inputs[| 2].setValue([ _trx, _try ]);
|
||||
|
||||
if(_up1 || _up2) UNDO_HOLDING = true;
|
||||
} else if(drag_side == 1) {
|
||||
draw_line_width(tl[0], tl[1], bl[0], bl[1], 3);
|
||||
|
||||
|
@ -125,8 +127,10 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _blx = value_snap(drag_s[1][0] + dx, _snx);
|
||||
var _bly = value_snap(drag_s[1][1] + dy, _sny);
|
||||
|
||||
inputs[| 1].setValue([ _tlx, _tly ]);
|
||||
if(inputs[| 3].setValue([ _blx, _bly ])) UNDO_HOLDING = true;
|
||||
var _up1 = inputs[| 1].setValue([ _tlx, _tly ]);
|
||||
var _up3 = inputs[| 3].setValue([ _blx, _bly ]);
|
||||
|
||||
if(_up1 || _up3) UNDO_HOLDING = true;
|
||||
} else if(drag_side == 2) {
|
||||
draw_line_width(br[0], br[1], tr[0], tr[1], 3);
|
||||
|
||||
|
@ -136,8 +140,10 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _trx = value_snap(drag_s[1][0] + dx, _snx);
|
||||
var _try = value_snap(drag_s[1][1] + dy, _sny);
|
||||
|
||||
inputs[| 4].setValue([ _brx, _bry ]);
|
||||
if(inputs[| 2].setValue([ _trx, _try ])) UNDO_HOLDING = true;
|
||||
var _up4 = inputs[| 4].setValue([ _brx, _bry ]);
|
||||
var _up2 = inputs[| 2].setValue([ _trx, _try ]);
|
||||
|
||||
if(_up4 || _up2) UNDO_HOLDING = true;
|
||||
} else if(drag_side == 3) {
|
||||
draw_line_width(br[0], br[1], bl[0], bl[1], 3);
|
||||
|
||||
|
@ -147,8 +153,10 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _blx = value_snap(drag_s[1][0] + dx, _snx);
|
||||
var _bly = value_snap(drag_s[1][1] + dy, _sny);
|
||||
|
||||
inputs[| 4].setValue([ _brx, _bry ]);
|
||||
if(inputs[| 3].setValue([ _blx, _bly ])) UNDO_HOLDING = true;
|
||||
var _up4 = inputs[| 4].setValue([ _brx, _bry ]);
|
||||
var _up3 = inputs[| 3].setValue([ _blx, _bly ]);
|
||||
|
||||
if(_up4 || _up3) UNDO_HOLDING = true;
|
||||
} else if(active) {
|
||||
draw_set_color(COLORS._main_accent);
|
||||
if(distance_to_line_infinite(_mx, _my, tl[0], tl[1], tr[0], tr[1]) < 12) {
|
||||
|
@ -214,6 +222,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
} else {
|
||||
surface_set_shader(_outSurf, sh_warp_4points);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_dim("dimension", _data[0]);
|
||||
shader_set_f("p0", br[0] / sw, br[1] / sh);
|
||||
shader_set_f("p1", tr[0] / sw, tr[1] / sh);
|
||||
shader_set_f("p2", tl[0] / sw, tl[1] / sh);
|
||||
|
|
|
@ -915,6 +915,8 @@ function PanelContent() constructor {
|
|||
|
||||
function close() { panel.remove(self); }
|
||||
|
||||
static checkClosable = function() { return true; }
|
||||
|
||||
function onClose() {}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,21 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con
|
|||
shift_new_line = !shift_new_line;
|
||||
bx += bs + ui(4);
|
||||
|
||||
var txt = _textArea.show_line_number? "Hide line number" : "Show line number";
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.code_show_line, _textArea.show_line_number) == 2)
|
||||
_textArea.show_line_number = !_textArea.show_line_number;
|
||||
bx += bs + ui(4);
|
||||
|
||||
var txt = _textArea.use_autocomplete? "Disable Autocomplete" : "Enable Autocomplete";
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.code_show_auto, _textArea.use_autocomplete) == 2)
|
||||
_textArea.use_autocomplete = !_textArea.use_autocomplete;
|
||||
bx += bs + ui(4);
|
||||
|
||||
var txt = "Syntax Highlight";
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, txt, THEME.code_syntax_highlight, _textArea.syntax_highlight) == 2)
|
||||
_textArea.syntax_highlight = !_textArea.syntax_highlight;
|
||||
bx += bs + ui(4);
|
||||
|
||||
var bx = w - ui(8) - bs;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [ mx, my ], pFOCUS, pHOVER, "Apply", THEME.accept,, COLORS._main_value_positive) == 2)
|
||||
_textArea.apply();
|
||||
|
@ -48,7 +63,11 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con
|
|||
_textArea.drawParam(new widgetParam(tx, ty, tw, th, _text,, [mx, my], x, y));
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
static checkClosable = function() {
|
||||
return !_textArea.autocomplete_box.active;
|
||||
}
|
||||
|
||||
static onClose = function() {
|
||||
_textArea.apply();
|
||||
context.popup_dialog = noone;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, display_data) {
|
||||
var _val = showValue();
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
|
||||
if(display_data == -1) return hover;
|
||||
|
@ -134,7 +134,7 @@ function preview_overlay_area_padding(interact, active, _x, _y, _s, _mx, _my, _s
|
|||
}
|
||||
|
||||
function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var _val = showValue();
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
|
||||
var __at = array_safe_get(_val, 4);
|
||||
|
@ -243,7 +243,7 @@ function preview_overlay_area_two_point(interact, active, _x, _y, _s, _mx, _my,
|
|||
}
|
||||
|
||||
function preview_overlay_area_span(interact, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var _val = showValue();
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
|
||||
var __ax = array_safe_get(_val, 0);
|
||||
|
@ -341,7 +341,7 @@ function preview_overlay_area_span(interact, active, _x, _y, _s, _mx, _my, _snx,
|
|||
}
|
||||
|
||||
function preview_overlay_area(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, display_data) {
|
||||
var _val = getValue();
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
if(is_array(_val[0])) return hover;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function preview_overlay_puppet(interact, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
var _val = getValue();
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
if(is_array(_val[0])) return hover;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function preview_overlay_rotation(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad) {
|
||||
var _val = getValue();
|
||||
var _val = getValue();
|
||||
var hover = -1;
|
||||
if(is_array(_val)) return hover;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function preview_overlay_scalar(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _angle, _scale, _spr) {
|
||||
var _val = getValue();
|
||||
var _val = getValue();
|
||||
var hover = -1;
|
||||
if(!is_real(_val)) return hover;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _spr) {
|
||||
var _val = getValue();
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
if(is_array(_val[0])) return hover;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
function shader_set_i(uniform, value) {
|
||||
var shader = shader_current();
|
||||
if(shader == -1) return;
|
||||
|
||||
if(is_array(value)) {
|
||||
shader_set_i_array(shader, uniform, value);
|
||||
return;
|
||||
|
@ -22,8 +24,10 @@ function shader_set_i_array(shader, uniform, array) {
|
|||
|
||||
function shader_set_f(uniform, value) {
|
||||
var shader = shader_current();
|
||||
if(shader == -1) return;
|
||||
|
||||
if(is_array(value)) {
|
||||
shader_set_f_array(shader, uniform, value);
|
||||
shader_set_uniform_f_array_safe(shader_get_uniform(shader, uniform), value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -31,17 +35,13 @@ function shader_set_f(uniform, value) {
|
|||
var array = [];
|
||||
for( var i = 1; i < argument_count; i++ )
|
||||
array_push(array, argument[i]);
|
||||
shader_set_f_array(shader, uniform, array)
|
||||
shader_set_uniform_f_array_safe(shader_get_uniform(shader, uniform), array)
|
||||
return;
|
||||
}
|
||||
|
||||
shader_set_uniform_f(shader_get_uniform(shader, uniform), value);
|
||||
}
|
||||
|
||||
function shader_set_f_array(shader, uniform, array, max_length = 128) {
|
||||
shader_set_uniform_f_array_safe(shader_get_uniform(shader, uniform), array, max_length);
|
||||
}
|
||||
|
||||
function shader_set_uniform_f_array_safe(uniform, array, max_length = 128) {
|
||||
if(!is_array(array)) return;
|
||||
if(array_length(array) == 0) return;
|
||||
|
@ -53,6 +53,7 @@ function shader_set_uniform_f_array_safe(uniform, array, max_length = 128) {
|
|||
|
||||
function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
|
||||
var shader = shader_current();
|
||||
if(shader == -1) return;
|
||||
|
||||
if(is_struct(shader) && is_instanceof(shader, dynaSurf))
|
||||
shader = shader.surfaces[0];
|
||||
|
@ -84,6 +85,7 @@ function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
|
|||
function shader_set_surface_dimension(uniform, surface) {
|
||||
var shader = shader_current();
|
||||
if(!is_surface(surface)) return;
|
||||
if(shader == -1) return;
|
||||
|
||||
var texture = surface_get_texture(surface);
|
||||
var tw = texture_get_texel_width(texture);
|
||||
|
|
|
@ -21,6 +21,8 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
|
|||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _h, _surface, _m, _rx, _ry) {
|
||||
_h = ui(96);
|
||||
|
||||
x = _x;
|
||||
y = _y;
|
||||
w = _w;
|
||||
|
|
|
@ -46,6 +46,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
|
||||
parser_server = noone;
|
||||
|
||||
use_autocomplete = true;
|
||||
autocomplete_box = instance_create(0, 0, o_dialog_textbox_autocomplete);
|
||||
autocomplete_box.textbox = self;
|
||||
autocomplete_server = noone;
|
||||
|
@ -55,7 +56,10 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
function_guide_box.textbox = self;
|
||||
function_guide_server = noone;
|
||||
|
||||
shift_new_line = true;
|
||||
shift_new_line = true;
|
||||
show_line_number = true;
|
||||
|
||||
syntax_highlight = true;
|
||||
|
||||
_cl = -1;
|
||||
|
||||
|
@ -83,75 +87,78 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
UNDO_HOLDING = false;
|
||||
} #endregion
|
||||
|
||||
static isCodeFormat = function() {
|
||||
return format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL
|
||||
}
|
||||
|
||||
static onModified = function() { #region
|
||||
if((format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) && autocomplete_server != noone) {
|
||||
var crop = string_copy(_input_text, 1, cursor);
|
||||
var slp = string_splice(crop, [" ", "(", ",", "\n"]);
|
||||
var pmt = array_safe_get(slp, -1,, ARRAY_OVERFLOW.loop);
|
||||
|
||||
var params = [];
|
||||
if(parser_server != noone)
|
||||
params = parser_server(crop, autocomplete_object);
|
||||
|
||||
var data = autocomplete_server(pmt, params);
|
||||
|
||||
if(array_length(data)) {
|
||||
autocomplete_box.data = data;
|
||||
|
||||
autocomplete_box.active = true;
|
||||
autocomplete_box.dialog_x = rx + cursor_pos_x + 1;
|
||||
autocomplete_box.dialog_y = ry + cursor_pos_y + line_get_height() + 1;
|
||||
autocomplete_box.prompt = pmt;
|
||||
autocomplete_box.selecting= 0;
|
||||
} else
|
||||
autocomplete_box.active = false;
|
||||
|
||||
var _c = cursor;
|
||||
var _v = false;
|
||||
var _fn = "";
|
||||
var _el = 0;
|
||||
var amo = 0;
|
||||
|
||||
while(_c > 1) {
|
||||
var cch0 = string_char_at(_input_text, _c - 1);
|
||||
var cch1 = string_char_at(_input_text, _c);
|
||||
|
||||
if(_el == 0 && cch1 == ",") amo++;
|
||||
|
||||
if(_el == 0 && cch1 == "(" && string_variable_valid(cch0))
|
||||
_v = true;
|
||||
else if(cch1 == ")") _el++;
|
||||
else if(cch1 == "(") _el--;
|
||||
|
||||
if(_v) {
|
||||
if(!string_variable_valid(cch0))
|
||||
break;
|
||||
_fn = cch0 + _fn;
|
||||
}
|
||||
|
||||
_c--;
|
||||
}
|
||||
var guide = function_guide_server(_fn);
|
||||
|
||||
if(guide != "") {
|
||||
function_guide_box.active = true;
|
||||
function_guide_box.dialog_x = rx + cursor_pos_x + 1;
|
||||
function_guide_box.dialog_y = ry + cursor_pos_y - 12;
|
||||
function_guide_box.prompt = guide;
|
||||
function_guide_box.index = amo;
|
||||
} else
|
||||
function_guide_box.active = false;
|
||||
if(!isCodeFormat()) return;
|
||||
if(autocomplete_server == noone) return;
|
||||
if(!use_autocomplete) {
|
||||
autocomplete_box.active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var crop = string_copy(_input_text, 1, cursor);
|
||||
var slp = string_splice(crop, [" ", "(", ",", "\n"]);
|
||||
var pmt = array_safe_get(slp, -1,, ARRAY_OVERFLOW.loop);
|
||||
|
||||
var params = [];
|
||||
if(parser_server != noone)
|
||||
params = parser_server(crop, autocomplete_object);
|
||||
|
||||
var data = autocomplete_server(pmt, params);
|
||||
|
||||
if(array_length(data)) {
|
||||
autocomplete_box.data = data;
|
||||
|
||||
autocomplete_box.active = true;
|
||||
autocomplete_box.prompt = pmt;
|
||||
autocomplete_box.selecting= 0;
|
||||
} else
|
||||
autocomplete_box.active = false;
|
||||
|
||||
var _c = cursor;
|
||||
var _v = false;
|
||||
var _fn = "";
|
||||
var _el = 0;
|
||||
var amo = 0;
|
||||
|
||||
while(_c > 1) {
|
||||
var cch0 = string_char_at(_input_text, _c - 1);
|
||||
var cch1 = string_char_at(_input_text, _c);
|
||||
|
||||
if(_el == 0 && cch1 == ",") amo++;
|
||||
|
||||
if(_el == 0 && cch1 == "(" && string_variable_valid(cch0))
|
||||
_v = true;
|
||||
else if(cch1 == ")") _el++;
|
||||
else if(cch1 == "(") _el--;
|
||||
|
||||
if(_v) {
|
||||
if(!string_variable_valid(cch0))
|
||||
break;
|
||||
_fn = cch0 + _fn;
|
||||
}
|
||||
|
||||
_c--;
|
||||
}
|
||||
var guide = function_guide_server(_fn);
|
||||
|
||||
if(guide != "") {
|
||||
function_guide_box.active = true;
|
||||
function_guide_box.dialog_x = rx + cursor_pos_x + 1;
|
||||
function_guide_box.dialog_y = ry + cursor_pos_y - 12;
|
||||
function_guide_box.prompt = guide;
|
||||
function_guide_box.index = amo;
|
||||
} else
|
||||
function_guide_box.active = false;
|
||||
} #endregion
|
||||
|
||||
static breakCharacter = function(ch) { #region
|
||||
switch(format) {
|
||||
case TEXT_AREA_FORMAT.codeHLSL :
|
||||
case TEXT_AREA_FORMAT.codeLUA :
|
||||
return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch);
|
||||
default :
|
||||
return ch == " " || ch == "\n";
|
||||
}
|
||||
if(isCodeFormat())
|
||||
return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch);
|
||||
return ch == " " || ch == "\n";
|
||||
} #endregion
|
||||
|
||||
static onKey = function(key) { #region
|
||||
|
@ -188,7 +195,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
}
|
||||
}
|
||||
|
||||
if(!(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) || !autocomplete_box.active) {
|
||||
if(!(isCodeFormat() && autocomplete_box.active)) {
|
||||
if(key == vk_up) {
|
||||
var _target;
|
||||
|
||||
|
@ -279,7 +286,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
|
||||
var _txtLines = string_splice(_input_text, "\n");
|
||||
var ss = "";
|
||||
var _code = format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL;
|
||||
var _code = isCodeFormat();
|
||||
|
||||
for( var i = 0, n = array_length(_txtLines); i < n; i++ ) {
|
||||
var _txt = _txtLines[i] + (i < array_length(_txtLines)? "\n" : "");
|
||||
|
@ -466,14 +473,6 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
}
|
||||
}
|
||||
|
||||
//if(modified) {
|
||||
// print("==========");
|
||||
// print(_input_text_pre);
|
||||
// print($"cursor: {cursor}");
|
||||
// print($"press: {KEYBOARD_STRING}");
|
||||
// print(_input_text);
|
||||
//}
|
||||
|
||||
KEYBOARD_STRING = "";
|
||||
keyboard_lastkey = -1;
|
||||
#endregion
|
||||
|
@ -559,16 +558,29 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
for( var i = 0, n = array_length(_input_text_line); i < n; i++ ) {
|
||||
_str = _input_text_line[i];
|
||||
|
||||
if(format == TEXT_AREA_FORMAT._default)
|
||||
draw_text_add(ch_x, ch_y, _str);
|
||||
else if(format == TEXT_AREA_FORMAT.codeLUA)
|
||||
draw_code_lua(ch_x, ch_y, _str);
|
||||
else if(format == TEXT_AREA_FORMAT.codeHLSL)
|
||||
draw_code_glsl(ch_x, ch_y, _str);
|
||||
else if(format == TEXT_AREA_FORMAT.delimiter)
|
||||
draw_text_delimiter(ch_x, ch_y, _str);
|
||||
else if(format == TEXT_AREA_FORMAT.path_template)
|
||||
draw_text_path(ch_x, ch_y, _str);
|
||||
switch(format) {
|
||||
case TEXT_AREA_FORMAT._default :
|
||||
draw_text_add(ch_x, ch_y, _str);
|
||||
break;
|
||||
case TEXT_AREA_FORMAT.delimiter :
|
||||
draw_text_delimiter(ch_x, ch_y, _str);
|
||||
break;
|
||||
case TEXT_AREA_FORMAT.path_template :
|
||||
draw_text_path(ch_x, ch_y, _str);
|
||||
break;
|
||||
case TEXT_AREA_FORMAT.codeLUA :
|
||||
if(syntax_highlight)
|
||||
draw_code_lua(ch_x, ch_y, _str);
|
||||
else
|
||||
draw_text_add(ch_x, ch_y, _str);
|
||||
break;
|
||||
case TEXT_AREA_FORMAT.codeHLSL :
|
||||
if(syntax_highlight)
|
||||
draw_code_glsl(ch_x, ch_y, _str);
|
||||
else
|
||||
draw_text_add(ch_x, ch_y, _str);
|
||||
break;
|
||||
}
|
||||
|
||||
ch_y += line_get_height();
|
||||
}
|
||||
|
@ -617,11 +629,16 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
if(target != -999) {
|
||||
if(mouse_press(mb_left, active) || click_block == 1) {
|
||||
cursor = target;
|
||||
cursor_select = -1;
|
||||
click_block = 0;
|
||||
|
||||
autocomplete_box.active = false;
|
||||
} else if(mouse_click(mb_left, active) && cursor != target) {
|
||||
if(cursor_select == -1)
|
||||
cursor_select = cursor;
|
||||
cursor = target;
|
||||
|
||||
autocomplete_box.active = false;
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
@ -657,16 +674,16 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
|
||||
var tx = _x + ui(8);
|
||||
var hh = _h;
|
||||
var pl = line_width;
|
||||
|
||||
if(format == TEXT_AREA_FORMAT._default) {
|
||||
line_width = _w - ui(16);
|
||||
} else if(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) {
|
||||
line_width = _w - ui(16 + code_line_width);
|
||||
tx += ui(code_line_width);
|
||||
} else if(isCodeFormat()) {
|
||||
line_width = _w - ui(16 + code_line_width * show_line_number);
|
||||
tx += ui(code_line_width * show_line_number);
|
||||
}
|
||||
|
||||
if(_stretch_width) line_width = 9999999;
|
||||
|
||||
cursor_tx = tx;
|
||||
|
||||
var c_h = line_get_height();
|
||||
|
@ -675,14 +692,14 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
|
||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, hh, boxColor, 1);
|
||||
|
||||
if(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) {
|
||||
if(isCodeFormat() && show_line_number) {
|
||||
draw_sprite_stretched_ext(THEME.textbox_code, 0, _x, _y, ui(code_line_width), hh, boxColor, 1);
|
||||
draw_set_text(f_code, fa_right, fa_top, COLORS._main_text_sub);
|
||||
|
||||
var lx = _x + ui(code_line_width - 8);
|
||||
for( var i = 0; i < array_length(_input_text_line_index); i++ ) {
|
||||
var ly = _y + ui(7) + i * c_h;
|
||||
draw_text(lx, ly, _input_text_line_index[i]);
|
||||
draw_text_add(lx, ly, _input_text_line_index[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -704,6 +721,8 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
var ch_y = _y + ui(7);
|
||||
var ch_sel_min = -1;
|
||||
var ch_sel_max = -1;
|
||||
var char_line = 0;
|
||||
var curs_found = false;
|
||||
|
||||
char_run = 0;
|
||||
|
||||
|
@ -719,36 +738,37 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
if(cursor_select != -1) {
|
||||
draw_set_color(COLORS.widget_text_highlight);
|
||||
|
||||
if(char_run <= ch_sel_min && char_run + _l > ch_sel_min) {
|
||||
var x1 = tx + string_width(string_copy(_str, 1, ch_sel_min - char_run));
|
||||
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_run));
|
||||
|
||||
if(char_line <= ch_sel_min && char_line + _l > ch_sel_min) {
|
||||
var x1 = tx + string_width(string_copy(_str, 1, ch_sel_min - char_line));
|
||||
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_line));
|
||||
|
||||
draw_roundrect_ext(x1, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
} else if(char_run >= ch_sel_min && char_run + _l < ch_sel_max) {
|
||||
} else if(char_line >= ch_sel_min && char_line + _l < ch_sel_max) {
|
||||
var x2 = tx + string_width(_str);
|
||||
|
||||
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
} else if(char_run > ch_sel_min && char_run <= ch_sel_max && char_run + _l >= ch_sel_max) {
|
||||
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_run));
|
||||
} else if(char_line > ch_sel_min && char_line <= ch_sel_max && char_line + _l >= ch_sel_max) {
|
||||
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_line));
|
||||
|
||||
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, THEME_VALUE.highlight_corner_radius, THEME_VALUE.highlight_corner_radius, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(char_run <= cursor && cursor < char_run + _l) {
|
||||
if(!curs_found && char_line <= cursor && cursor < char_line + _l) {
|
||||
if(format == TEXT_AREA_FORMAT.delimiter) {
|
||||
var str_cur = string_copy(_str, 1, cursor - char_run);
|
||||
var str_cur = string_copy(_str, 1, cursor - char_line);
|
||||
str_cur = string_replace_all(str_cur, " ", "<space>");
|
||||
cursor_pos_x_to = ch_x + string_width(str_cur);
|
||||
} else
|
||||
cursor_pos_x_to = ch_x + string_width(string_copy(_str, 1, cursor - char_run));
|
||||
cursor_pos_x_to = ch_x + string_width(string_copy(_str, 1, cursor - char_line));
|
||||
cursor_pos_y_to = ch_y;
|
||||
cursor_line = i;
|
||||
char_run = char_line;
|
||||
|
||||
break;
|
||||
curs_found = true;
|
||||
}
|
||||
|
||||
char_run += _l;
|
||||
char_line += _l;
|
||||
ch_y += line_get_height();
|
||||
}
|
||||
|
||||
|
@ -769,6 +789,11 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
|
|||
draw_set_color(COLORS._main_text_accent);
|
||||
draw_line_width(cursor_pos_x, cursor_pos_y, cursor_pos_x, cursor_pos_y + c_h, 2);
|
||||
}
|
||||
|
||||
if(autocomplete_box.active) {
|
||||
autocomplete_box.dialog_x = rx + cursor_pos_x + 1;
|
||||
autocomplete_box.dialog_y = ry + cursor_pos_y + line_get_height() + 1;
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(!point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + hh) && mouse_press(mb_left)) {
|
||||
|
|
|
@ -416,9 +416,9 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
|
|||
}
|
||||
|
||||
if(key_mod_press(ALT))
|
||||
draw_text(_x + ui(8), _y + _h / 2, "/2");
|
||||
draw_text_add(_x + ui(8), _y + _h / 2, "/2");
|
||||
else
|
||||
draw_text(_x + ui(8), _y + _h / 2, "x2");
|
||||
draw_text_add(_x + ui(8), _y + _h / 2, "x2");
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
#endregion
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
void main() {
|
||||
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ attribute vec2 in_TextureCoord; // (u,v)
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
void main() {
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Simple passthrough fragment shader
|
||||
// Perspective transform
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
@ -8,6 +8,7 @@ uniform vec2 p0;
|
|||
uniform vec2 p1;
|
||||
uniform vec2 p2;
|
||||
uniform vec2 p3;
|
||||
uniform vec2 dimension;
|
||||
|
||||
/////////////// SAMPLING ///////////////
|
||||
|
||||
|
@ -61,24 +62,33 @@ float unmix( float st, float ed, float val) {
|
|||
return (val - st) / (ed - st);
|
||||
}
|
||||
|
||||
// 2 1
|
||||
// 3 0
|
||||
|
||||
void main() {
|
||||
float px = v_vTexcoord.x;
|
||||
float py = v_vTexcoord.y;
|
||||
float u, v;
|
||||
vec2 uv;
|
||||
|
||||
if (abs(p3.y - p0.y) < 0.001 && abs(p2.y - p1.y) < 0.001) { // trapezoid edge case
|
||||
if (abs(p3.y - p0.y) < 1. / dimension.y && abs(p2.y - p1.y) < 1. / dimension.y) { // trapezoid edge case
|
||||
float t = (py - p2.y) / (p3.y - p2.y);
|
||||
|
||||
u = unmix(mix(p3.x, p2.x, 1. - t), mix(p0.x, p1.x, 1. - t), px);
|
||||
v = t;
|
||||
uv = vec2(u, v);
|
||||
} else if(abs(p2.x - p3.x) < 1. / dimension.x && abs(p1.x - p0.x) < 1. / dimension.x) { // trapezoid edge case
|
||||
float t = (px - p2.x) / (p1.x - p2.x);
|
||||
|
||||
u = t;
|
||||
v = unmix(mix(p1.y, p2.y, 1. - t), mix(p0.y, p3.y, 1. - t), py);
|
||||
uv = vec2(u, v);
|
||||
} else {
|
||||
vec2 A = (p3 - p0) - (p2 - p1);
|
||||
vec2 B = (p0 - p1);
|
||||
vec2 C = (p2 - p1);
|
||||
vec2 D = p1;
|
||||
|
||||
|
||||
float c1 = (B.y * C.x) + (A.y * D.x) - (B.x * C.y) - (A.x * D.y);
|
||||
float c2 = (B.y * D.x) - (B.x * D.y);
|
||||
|
||||
|
|
Loading…
Reference in a new issue