mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 19:38:05 +01:00
Fix nineslice, combine text.
This commit is contained in:
parent
d1b36d6153
commit
78da868ff0
19 changed files with 113 additions and 70 deletions
|
@ -139,7 +139,7 @@
|
|||
{"name":"path","order":5,"path":"folders/nodes/data/value/path.yy",},
|
||||
{"name":"struct","order":7,"path":"folders/nodes/data/value/struct.yy",},
|
||||
{"name":"surface","order":11,"path":"folders/nodes/data/value/surface.yy",},
|
||||
{"name":"texts","order":6,"path":"folders/nodes/data/value/texts.yy",},
|
||||
{"name":"text","order":6,"path":"folders/nodes/data/value/text.yy",},
|
||||
{"name":"trigger","order":9,"path":"folders/nodes/data/value/trigger.yy",},
|
||||
{"name":"3D","order":133,"path":"folders/nodes/icons/3D.yy",},
|
||||
{"name":"animation","order":135,"path":"folders/nodes/icons/animation.yy",},
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"path","folderPath":"folders/nodes/data/value/path.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"struct","folderPath":"folders/nodes/data/value/struct.yy",},
|
||||
{"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":"text","folderPath":"folders/nodes/data/value/text.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"trigger","folderPath":"folders/nodes/data/value/trigger.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",},
|
||||
|
|
|
@ -23,21 +23,24 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
drag_my = 0;
|
||||
drag_sv = 0;
|
||||
|
||||
static onValueFromUpdate = function(index) {
|
||||
if(index == 0) {
|
||||
var s = getInputData(0);
|
||||
if(is_array(s)) s = s[0];
|
||||
inputs[| 1].setValue([surface_get_width_safe(s), surface_get_height_safe(s)]);
|
||||
}
|
||||
static onValueFromUpdate = function(index = 0) {
|
||||
if(index != 0) return;
|
||||
|
||||
var s = getInputData(0);
|
||||
if(is_array(s)) s = s[0];
|
||||
|
||||
if(!is_surface(s)) return;
|
||||
inputs[| 1].setValue( [ surface_get_width_safe(s), surface_get_height_safe(s) ] );
|
||||
}
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
if(array_length(current_data) < 1) return;
|
||||
|
||||
var _dim = current_data[1];
|
||||
var _splice = current_data[2];
|
||||
for( var i = 0, n = array_length(_splice); i < n; i++ )
|
||||
_splice[i] = round(_splice[i]);
|
||||
|
||||
var _splice = array_create(array_length(current_data[2]));
|
||||
for( var i = 0, n = array_length(current_data[2]); i < n; i++ )
|
||||
_splice[i] = round(current_data[2][i]);
|
||||
|
||||
var sp_r = _x + (_dim[0] - _splice[0]) * _s;
|
||||
var sp_l = _x + _splice[2] * _s;
|
||||
|
|
|
@ -8,17 +8,16 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
|
||||
outputs[| 0] = nodeValue("Path array", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
|
||||
|
||||
static createNewInput = function() {
|
||||
static createNewInput = function() { #region
|
||||
var index = ds_list_size(inputs);
|
||||
|
||||
inputs[| index] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.pathnode, noone )
|
||||
.setVisible(true, true);
|
||||
|
||||
return inputs[| index];
|
||||
}
|
||||
if(!LOADING && !APPENDING) createNewInput();
|
||||
} if(!LOADING && !APPENDING) createNewInput(); #endregion
|
||||
|
||||
static refreshDynamicInput = function() {
|
||||
static refreshDynamicInput = function() { #region
|
||||
var _l = ds_list_create();
|
||||
|
||||
for( var i = 0; i < input_fix_len; i++ )
|
||||
|
@ -38,24 +37,24 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
inputs = _l;
|
||||
|
||||
createNewInput();
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onValueFromUpdate = function(index) {
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
refreshDynamicInput();
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static getLineCount = function() {
|
||||
static getLineCount = function() { #region
|
||||
var l = 0;
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
l += struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static getSegmentCount = function(ind = 0) {
|
||||
static getSegmentCount = function(ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
@ -65,9 +64,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static getLength = function(ind = 0) {
|
||||
static getLength = function(ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
@ -77,9 +76,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static getAccuLength = function(ind = 0) {
|
||||
static getAccuLength = function(ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
@ -89,9 +88,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static get__vec2Ratio = function(_rat, ind = 0) {
|
||||
static get__vec2Ratio = function(_rat, ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
@ -101,9 +100,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
}
|
||||
|
||||
return new __vec2();
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static get__vec2Distance = function(_dist, ind = 0) {
|
||||
static get__vec2Distance = function(_dist, ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
@ -113,9 +112,9 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
}
|
||||
|
||||
return new __vec2();
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static getBoundary = function(ind = 0) {
|
||||
static getBoundary = function(ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
@ -125,13 +124,13 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
outputs[| 0].setValue(self);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
|
||||
}
|
||||
} #endregion
|
||||
}
|
|
@ -104,8 +104,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
var recPath = DIRECTORY + "Nodes/recent.json";
|
||||
global.RECENT_NODES = file_exists(recPath)? json_load_struct(recPath) : [];
|
||||
|
||||
var group = ds_list_create();
|
||||
addNodeCatagory("Group", group, ["Node_Group"]); #region
|
||||
var group = ds_list_create(); #region
|
||||
addNodeCatagory("Group", group, ["Node_Group"]);
|
||||
ds_list_add(group, "Groups");
|
||||
addNodeObject(group, "Input", s_node_group_input, "Node_Group_Input", [1, Node_Group_Input]);
|
||||
addNodeObject(group, "Output", s_node_group_output, "Node_Group_Output", [1, Node_Group_Output]);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -4,21 +4,62 @@ function Node_String_Merge(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
|
||||
w = 96;
|
||||
|
||||
inputs[| 0] = nodeValue("Text A", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "");
|
||||
|
||||
inputs[| 1] = nodeValue("Text B", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "");
|
||||
setIsDynamicInput(1);
|
||||
|
||||
outputs[| 0] = nodeValue("Text", self, JUNCTION_CONNECT.output, VALUE_TYPE.text, "");
|
||||
|
||||
static createNewInput = function() { #region
|
||||
var index = ds_list_size(inputs);
|
||||
|
||||
inputs[| index] = nodeValue("Text", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" )
|
||||
.setVisible(true, true);
|
||||
|
||||
return inputs[| index];
|
||||
} if(!LOADING && !APPENDING) createNewInput(); #endregion
|
||||
|
||||
static refreshDynamicInput = function() { #region
|
||||
var _l = ds_list_create();
|
||||
|
||||
for( var i = 0; i < input_fix_len; i++ )
|
||||
_l[| i] = inputs[| i];
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
if(inputs[| i].value_from || inputs[| i].getValue() != "")
|
||||
ds_list_add(_l, inputs[| i]);
|
||||
}
|
||||
|
||||
for( var i = 0; i < ds_list_size(_l); i++ )
|
||||
_l[| i].index = i;
|
||||
|
||||
ds_list_destroy(inputs);
|
||||
inputs = _l;
|
||||
|
||||
createNewInput();
|
||||
} #endregion
|
||||
|
||||
static onValueUpdate = function(index) { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
||||
static processData = function(_output, _data, _index = 0) {
|
||||
return string(_data[0]) + string(_data[1]);
|
||||
var _str = "";
|
||||
for( var i = 0, n = array_length(_data); i < n; i++ )
|
||||
_str += _data[i];
|
||||
|
||||
return _str;
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var str = getInputData(0);
|
||||
var _str = outputs[| 0].getValue();
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
|
||||
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
|
||||
draw_text_bbox(bbox, str);
|
||||
draw_text_bbox(bbox, _str);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "texts",
|
||||
"path": "folders/nodes/data/value/texts.yy",
|
||||
"name": "text",
|
||||
"path": "folders/nodes/data/value/text.yy",
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue