mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- [Code editor] Fix autocomplete show up from empty prompt.
This commit is contained in:
parent
773598d39d
commit
a7fcefa5ef
6 changed files with 37 additions and 9 deletions
|
@ -38,7 +38,7 @@
|
|||
LATEST_VERSION = 11700;
|
||||
VERSION = 11770;
|
||||
SAVE_VERSION = 11700;
|
||||
VERSION_STRING = "1.17.8.003";
|
||||
VERSION_STRING = "1.17.8.004";
|
||||
BUILD_NUMBER = 11770;
|
||||
|
||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||
|
|
|
@ -117,6 +117,8 @@ function hlsl_document_parser(prompt, node = noone) {
|
|||
|
||||
function hlsl_autocomplete_server(prompt, params = []) {
|
||||
var res = [];
|
||||
if(string_trim(prompt) == "") return res;
|
||||
|
||||
var pr_list = ds_priority_create();
|
||||
|
||||
//////////////////////////////////
|
||||
|
|
|
@ -757,9 +757,9 @@ function __initNodes() {
|
|||
addNodeObject(generator, "Pixel Sampler", s_node_pixel_sampler, "Node_Pixel_Sampler", [1, Node_Pixel_Sampler]).setVersion(11730);
|
||||
|
||||
ds_list_add(generator, "Populate");
|
||||
addNodeObject(generator, "Repeat", s_node_repeat, "Node_Repeat", [1, Node_Repeat],, "Repeat image multiple times linearly, or in grid pattern.").setVersion(1100);
|
||||
addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", [1, Node_Scatter],, "Scatter image randomly multiple times.");
|
||||
addNodeObject(generator, "Repeat Texture", s_node_repeat_texture, "Node_Repeat_Texture", [1, Node_Repeat_Texture],, "Repeat texture over larger surface without repeating patterns.");
|
||||
addNodeObject(generator, "Repeat", s_node_repeat, "Node_Repeat", [0, Node_create_Repeat], global.node_repeat_keys, "Repeat image multiple times linearly, or in grid pattern.").setVersion(1100);
|
||||
addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", [1, Node_Scatter],, "Scatter image randomly multiple times.");
|
||||
addNodeObject(generator, "Repeat Texture", s_node_repeat_texture, "Node_Repeat_Texture", [1, Node_Repeat_Texture],, "Repeat texture over larger surface without repeating patterns.");
|
||||
|
||||
ds_list_add(generator, "Simulation");
|
||||
addNodeObject(generator, "Particle", s_node_particle, "Node_Particle", [1, Node_Particle],, "Generate particle effect.");
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
global.node_repeat_keys = [ "repeat polar", "repeat circular" ];
|
||||
|
||||
function Node_create_Repeat(_x, _y, _group = noone, _param = {}) {
|
||||
var _node = new Node_Repeat(_x, _y, _group);
|
||||
var query = struct_try_get(_param, "query", "");
|
||||
|
||||
switch(query) {
|
||||
case "repeat polar" :
|
||||
case "repeat circular" :
|
||||
_node.inputs[| 3].setValue(2);
|
||||
_node.inputs[| 9].unit.setMode(VALUE_UNIT.reference);
|
||||
_node.inputs[| 9].setValueDirect([ 0.5, 0.5 ]);
|
||||
break;
|
||||
}
|
||||
|
||||
return _node;
|
||||
}
|
||||
|
||||
function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Repeat";
|
||||
dimension_index = 1;
|
||||
|
@ -95,11 +113,14 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inputs[| 32] = nodeValue("Start rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
.setDisplay(VALUE_DISPLAY.rotation);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [
|
||||
["Surfaces", true], 0, 1, 16, 17,
|
||||
["Pattern", false], 3, 9, 2, 18, 7, 8,
|
||||
["Pattern", false], 3, 9, 32, 2, 18, 7, 8,
|
||||
["Path", true], 11, 12, 13,
|
||||
["Position", false], 4, 26, 19,
|
||||
["Rotation", false], 5,
|
||||
|
@ -142,6 +163,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
inputs[| 18].setVisible( _pat == 1);
|
||||
inputs[| 19].setVisible( _pat == 1);
|
||||
inputs[| 26].setVisible( _pat == 0);
|
||||
inputs[| 32].setVisible( _pat == 2);
|
||||
|
||||
inputs[| 14].mappableStep();
|
||||
} #endregion
|
||||
|
@ -154,6 +176,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
var _pat = _data[ 3];
|
||||
|
||||
var _spos = _data[ 9];
|
||||
var _srot = _data[32];
|
||||
|
||||
var _rpos = _data[ 4];
|
||||
var _rsta = _data[26];
|
||||
|
@ -222,8 +245,9 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
posx = _spos[0] + _rpos[0] * col + _cls[0] * row;
|
||||
posy = _spos[1] + _rpos[1] * col + _cls[1] * row;
|
||||
|
||||
} else if(_pat == 2) {
|
||||
var aa = _aran[0] + (_aran[1] - _aran[0]) * i / _amo;
|
||||
var aa = _srot + lerp(_aran[0], _aran[1], i / _amo);
|
||||
posx = _spos[0] + lengthdir_x(_arad, aa);
|
||||
posy = _spos[1] + lengthdir_y(_arad, aa);
|
||||
}
|
||||
|
|
|
@ -453,10 +453,10 @@ function nodeValueUnit(_nodeValue) constructor {
|
|||
triggerButton.tooltip = new tooltipSelector("Unit", ["Pixel", "Fraction"]);
|
||||
|
||||
static setMode = function(type) {
|
||||
if(type == "constant" && mode == VALUE_UNIT.constant) return;
|
||||
if(type == "relative" && mode == VALUE_UNIT.reference) return;
|
||||
if((type == "constant" || type == VALUE_UNIT.constant) && mode == VALUE_UNIT.constant) return;
|
||||
if((type == "relative" || type == VALUE_UNIT.reference) && mode == VALUE_UNIT.reference) return;
|
||||
|
||||
mode = type == "constant"? VALUE_UNIT.constant : VALUE_UNIT.reference;
|
||||
mode = (type == "constant" || type == VALUE_UNIT.constant)? VALUE_UNIT.constant : VALUE_UNIT.reference;
|
||||
_nodeValue.cache_value[0] = false;
|
||||
_nodeValue.unitConvert(mode);
|
||||
_nodeValue.node.doUpdate();
|
||||
|
|
|
@ -25,6 +25,8 @@ function pxl_autocomplete_server(prompt, params = [], context = {}) {
|
|||
if(isNumber(prompt)) return [];
|
||||
|
||||
var res = [];
|
||||
if(string_trim(prompt) == "") return res;
|
||||
|
||||
var pr_list = ds_priority_create();
|
||||
|
||||
//////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue