mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-03-04 06:34:48 +01:00
- [Palette Editor] Add preset search bar. - [Gradient Editor] Add preset, palette search bar.
This commit is contained in:
parent
e26ec42524
commit
3aed925ed7
8 changed files with 205 additions and 57 deletions
|
@ -231,13 +231,12 @@
|
||||||
"Node_Group_Input",
|
"Node_Group_Input",
|
||||||
"Node_Group_Output",
|
"Node_Group_Output",
|
||||||
"Node_PB_Output",
|
"Node_PB_Output",
|
||||||
|
|
||||||
{ "label": "Main" },
|
|
||||||
"Node_PB_Dimension",
|
"Node_PB_Dimension",
|
||||||
{ "label": "/PBBOX" },
|
|
||||||
|
{ "label": "PBBOX" },
|
||||||
"Node_PB_Box",
|
"Node_PB_Box",
|
||||||
"Node_PB_Box_BBOX",
|
|
||||||
"Node_PB_Box_Mirror",
|
"Node_PB_Box_Mirror",
|
||||||
|
"Node_PB_Box_BBOX",
|
||||||
|
|
||||||
{ "label": "Draw" },
|
{ "label": "Draw" },
|
||||||
"Node_PB_Draw_Rectangle",
|
"Node_PB_Draw_Rectangle",
|
||||||
|
|
|
@ -94,7 +94,7 @@ event_inherited();
|
||||||
registerFunction("Add Node", "Trigger Favourite", "", MOD_KEY.none, trigger_favourite);
|
registerFunction("Add Node", "Trigger Favourite", "", MOD_KEY.none, trigger_favourite);
|
||||||
|
|
||||||
function rightClick(node) {
|
function rightClick(node) {
|
||||||
if(!is_instanceof(node, NodeObject)) return;
|
if(!is(node, NodeObject)) return;
|
||||||
|
|
||||||
node_menu_selecting = node;
|
node_menu_selecting = node;
|
||||||
var fav = struct_exists(global.FAV_NODES, node.nodeName);
|
var fav = struct_exists(global.FAV_NODES, node.nodeName);
|
||||||
|
@ -221,7 +221,7 @@ event_inherited();
|
||||||
var _inputs = [];
|
var _inputs = [];
|
||||||
var _outputs = [];
|
var _outputs = [];
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
_new_node = _node.build(node_target_x, node_target_y,, _param);
|
_new_node = _node.build(node_target_x, node_target_y,, _param);
|
||||||
if(!_new_node) return;
|
if(!_new_node) return;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ event_inherited();
|
||||||
array_pop(global.RECENT_NODES);
|
array_pop(global.RECENT_NODES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_instanceof(context, Node_Collection_Inline))
|
if(is(context, Node_Collection_Inline))
|
||||||
context.addNode(_new_node);
|
context.addNode(_new_node);
|
||||||
|
|
||||||
for( var i = 0, n = array_length(_new_node.inputs); i < n; i++ )
|
for( var i = 0, n = array_length(_new_node.inputs); i < n; i++ )
|
||||||
|
@ -247,12 +247,12 @@ event_inherited();
|
||||||
if(PANEL_INSPECTOR) PANEL_INSPECTOR.setInspecting(_new_node);
|
if(PANEL_INSPECTOR) PANEL_INSPECTOR.setInspecting(_new_node);
|
||||||
|
|
||||||
if(PANEL_GRAPH) {
|
if(PANEL_GRAPH) {
|
||||||
if(PREFERENCES.node_add_select) PANEL_GRAPH.selectDragNode(_new_node, junction_called == noone);
|
if(PREFERENCES.node_add_select) PANEL_GRAPH.selectDragNode(_new_node, junction_called == noone);
|
||||||
var _ins = instanceof(_new_node);
|
var _ins = instanceof(_new_node);
|
||||||
if(struct_has(HOTKEYS, _ins)) FOCUS_STR = _ins;
|
if(struct_has(HOTKEYS, _ins)) FOCUS_STR = _ins;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(is_instanceof(_node, NodeAction)) { // NOT IMPLEMENTED
|
} else if(is(_node, NodeAction)) { // NOT IMPLEMENTED
|
||||||
var _dat = _node.build(node_target_x, node_target_y,, _param);
|
var _dat = _node.build(node_target_x, node_target_y,, _param);
|
||||||
var _node_in = _dat.inputNode;
|
var _node_in = _dat.inputNode;
|
||||||
var _node_out = _dat.outputNode;
|
var _node_out = _dat.outputNode;
|
||||||
|
@ -275,7 +275,7 @@ event_inherited();
|
||||||
tx = min(tx, _new_list[i].x);
|
tx = min(tx, _new_list[i].x);
|
||||||
ty = min(tx, _new_list[i].y);
|
ty = min(tx, _new_list[i].y);
|
||||||
|
|
||||||
if(is_instanceof(context, Node_Collection_Inline) && !is_instanceof(_new_list[i], Node_Collection_Inline))
|
if(is(context, Node_Collection_Inline) && !is(_new_list[i], Node_Collection_Inline))
|
||||||
context.addNode(_new_list[i]);
|
context.addNode(_new_list[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ event_inherited();
|
||||||
for(var index = 0; index < node_count; index++) {
|
for(var index = 0; index < node_count; index++) {
|
||||||
var _node = _list[index];
|
var _node = _list[index];
|
||||||
if(is_undefined(_node)) continue;
|
if(is_undefined(_node)) continue;
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
if(_node.patreon && !IS_PATREON) continue;
|
if(_node.patreon && !IS_PATREON) continue;
|
||||||
if(is_global && !_node.show_in_global) continue;
|
if(is_global && !_node.show_in_global) continue;
|
||||||
}
|
}
|
||||||
|
@ -566,9 +566,9 @@ event_inherited();
|
||||||
var _boxx = _nx + (grid_width - grid_size) / 2;
|
var _boxx = _nx + (grid_width - grid_size) / 2;
|
||||||
var cc = c_white;
|
var cc = c_white;
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) cc = c_white;
|
if(is(_node, NodeObject)) cc = c_white;
|
||||||
else if(is_instanceof(_node, NodeAction)) cc = COLORS.add_node_blend_action;
|
else if(is(_node, NodeAction)) cc = COLORS.add_node_blend_action;
|
||||||
else if(is_instanceof(_node, AddNodeItem)) cc = COLORS.add_node_blend_generic;
|
else if(is(_node, AddNodeItem)) cc = COLORS.add_node_blend_generic;
|
||||||
else cc = COLORS.dialog_add_node_collection;
|
else cc = COLORS.dialog_add_node_collection;
|
||||||
|
|
||||||
if(!struct_try_get(_node, "hide_bg", false)) {
|
if(!struct_try_get(_node, "hide_bg", false)) {
|
||||||
|
@ -588,7 +588,7 @@ event_inherited();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
_node.drawGrid(_boxx, yy, _m[0], _m[1], grid_size);
|
_node.drawGrid(_boxx, yy, _m[0], _m[1], grid_size);
|
||||||
} else {
|
} else {
|
||||||
var spr_x = _boxx + grid_size / 2;
|
var spr_x = _boxx + grid_size / 2;
|
||||||
|
@ -598,7 +598,7 @@ event_inherited();
|
||||||
if(sprite_exists(_node.spr))
|
if(sprite_exists(_node.spr))
|
||||||
draw_sprite_ui_uniform(_node.spr, 0, spr_x, spr_y, 0.5);
|
draw_sprite_ui_uniform(_node.spr, 0, spr_x, spr_y, 0.5);
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
if(is(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
||||||
draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS.add_node_blend_action);
|
draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS.add_node_blend_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ event_inherited();
|
||||||
for(var i = 0; i < node_count; i++) {
|
for(var i = 0; i < node_count; i++) {
|
||||||
var _node = _list[i];
|
var _node = _list[i];
|
||||||
if(is_undefined(_node)) continue;
|
if(is_undefined(_node)) continue;
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
if(_node.patreon && !IS_PATREON) continue;
|
if(_node.patreon && !IS_PATREON) continue;
|
||||||
if(is_global && !_node.show_in_global) continue;
|
if(is_global && !_node.show_in_global) continue;
|
||||||
}
|
}
|
||||||
|
@ -755,14 +755,14 @@ event_inherited();
|
||||||
draw_sprite_stretched_ext(THEME.node_bg, 1, pd, yy, list_width - pd * 2, list_height, COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.node_bg, 1, pd, yy, list_width - pd * 2, list_height, COLORS._main_accent, 1);
|
||||||
|
|
||||||
if(sFOCUS) {
|
if(sFOCUS) {
|
||||||
if(mouse_press(mb_left, left_free)) buildNode(_node);
|
if(mouse_release(mb_left, left_free)) buildNode(_node);
|
||||||
if(mouse_press(mb_right, right_free)) rightClick(_node);
|
if(mouse_release(mb_right, right_free)) rightClick(_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx;
|
var tx;
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
tx = _node.drawList(pd, yy, _m[0], _m[1], list_height, list_width - pd);
|
tx = _node.drawList(pd, yy, _m[0], _m[1], list_height, list_width - pd);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -775,7 +775,7 @@ event_inherited();
|
||||||
draw_sprite_ext(_node.spr, 0, spr_x, spr_y, ss, ss, 0, c_white, 1);
|
draw_sprite_ext(_node.spr, 0, spr_x, spr_y, ss, ss, 0, c_white, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
if(is(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
||||||
draw_sprite_ui_uniform(THEME.play_action, 0, spr_x + list_height / 2 - 8, spr_y + list_height / 2 - 8, 0.5, COLORS.add_node_blend_action);
|
draw_sprite_ui_uniform(THEME.play_action, 0, spr_x + list_height / 2 - 8, spr_y + list_height / 2 - 8, 0.5, COLORS.add_node_blend_action);
|
||||||
|
|
||||||
tx = pd + list_height + ui(32 + 4);
|
tx = pd + list_height + ui(32 + 4);
|
||||||
|
@ -944,7 +944,7 @@ event_inherited();
|
||||||
|
|
||||||
var match = string_partial_match_res(string_lower(_node.getName()), search_lower, search_split);
|
var match = string_partial_match_res(string_lower(_node.getName()), search_lower, search_split);
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
if(_node.deprecated) continue;
|
if(_node.deprecated) continue;
|
||||||
if(match[0] > -9000 && struct_exists(global.FAV_NODES, _node.nodeName))
|
if(match[0] > -9000 && struct_exists(global.FAV_NODES, _node.nodeName))
|
||||||
match[0] += 10000;
|
match[0] += 10000;
|
||||||
|
@ -1045,9 +1045,9 @@ event_inherited();
|
||||||
|
|
||||||
if(_drw) {
|
if(_drw) {
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) cc = c_white;
|
if(is(_node, NodeObject)) cc = c_white;
|
||||||
else if(is_instanceof(_node, NodeAction)) cc = COLORS.add_node_blend_action;
|
else if(is(_node, NodeAction)) cc = COLORS.add_node_blend_action;
|
||||||
else if(is_instanceof(_node, AddNodeItem)) cc = COLORS.add_node_blend_generic;
|
else if(is(_node, AddNodeItem)) cc = COLORS.add_node_blend_generic;
|
||||||
else cc = COLORS.dialog_add_node_collection;
|
else cc = COLORS.dialog_add_node_collection;
|
||||||
|
|
||||||
if(!struct_try_get(_node, "hide_bg", false)) {
|
if(!struct_try_get(_node, "hide_bg", false)) {
|
||||||
|
@ -1073,7 +1073,7 @@ event_inherited();
|
||||||
buildNode(_node, _param);
|
buildNode(_node, _param);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
_node.drawGrid(_boxx, yy, _m[0], _m[1], grid_size, _param);
|
_node.drawGrid(_boxx, yy, _m[0], _m[1], grid_size, _param);
|
||||||
} else {
|
} else {
|
||||||
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
|
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
|
||||||
|
@ -1094,7 +1094,7 @@ event_inherited();
|
||||||
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
if(is(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
||||||
draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS.add_node_blend_action);
|
draw_sprite_ui_uniform(THEME.play_action, 0, _boxx + grid_size - 16, yy + grid_size - 16, 1, COLORS.add_node_blend_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1220,7 +1220,7 @@ event_inherited();
|
||||||
|
|
||||||
var tx;
|
var tx;
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeObject)) {
|
if(is(_node, NodeObject)) {
|
||||||
var tx = _node.drawList(pd, yy, _m[0], _m[1], list_height, list_width - pd, _param);
|
var tx = _node.drawList(pd, yy, _m[0], _m[1], list_height, list_width - pd, _param);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1241,7 +1241,7 @@ event_inherited();
|
||||||
|
|
||||||
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
||||||
|
|
||||||
if(is_instanceof(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
if(is(_node, NodeAction) && !struct_try_get(_node, "hide_bg", false))
|
||||||
draw_sprite_ui_uniform(THEME.play_action, 0, _sx + list_height / 2 - 8, _sy + list_height / 2 - 8, 0.5, COLORS.add_node_blend_action);
|
draw_sprite_ui_uniform(THEME.play_action, 0, _sx + list_height / 2 - 8, _sy + list_height / 2 - 8, 0.5, COLORS.add_node_blend_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,12 @@ event_inherited();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region preset
|
#region preset
|
||||||
|
function initGradient() {
|
||||||
|
gradientPresets = array_clone(GRADIENTS);
|
||||||
|
currentGradient = gradientPresets;
|
||||||
|
return self;
|
||||||
|
} initGradient();
|
||||||
|
|
||||||
hovering_name = "";
|
hovering_name = "";
|
||||||
|
|
||||||
pal_padding = ui(9);
|
pal_padding = ui(9);
|
||||||
|
@ -101,8 +107,8 @@ event_inherited();
|
||||||
|
|
||||||
var _hover = sHOVER && sp_presets.hover;
|
var _hover = sHOVER && sp_presets.hover;
|
||||||
|
|
||||||
for(var i = 0; i < array_length(GRADIENTS); i++) {
|
for(var i = 0; i < array_length(gradientPresets); i++) {
|
||||||
var _gradient = GRADIENTS[i];
|
var _gradient = gradientPresets[i];
|
||||||
var isHover = point_in_rectangle(_m[0], _m[1], 0, yy, ww, yy + hg);
|
var isHover = point_in_rectangle(_m[0], _m[1], 0, yy, ww, yy + hg);
|
||||||
|
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 3, 0, yy, ww, hg);
|
draw_sprite_stretched(THEME.ui_panel_bg, 3, 0, yy, ww, hg);
|
||||||
|
@ -143,10 +149,49 @@ event_inherited();
|
||||||
return hh;
|
return hh;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//////////////////////// SEARCH ////////////////////////
|
||||||
|
|
||||||
|
gradient_search_string = "";
|
||||||
|
tb_preset_search = new textBox(TEXTBOX_INPUT.text, function(t) /*=>*/ {return searchGradient(t)} )
|
||||||
|
.setFont(f_p2)
|
||||||
|
.setHide(1)
|
||||||
|
.setEmpty(false)
|
||||||
|
.setPadding(ui(24))
|
||||||
|
.setAutoUpdate();
|
||||||
|
|
||||||
|
function searchGradient(t) {
|
||||||
|
gradient_search_string = t;
|
||||||
|
|
||||||
|
if(gradient_search_string == "") {
|
||||||
|
gradientPresets = currentGradient;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradientPresets = [];
|
||||||
|
var _pr = ds_priority_create();
|
||||||
|
|
||||||
|
for( var i = 0, n = array_length(currentGradient); i < n; i++ ) {
|
||||||
|
var _prest = currentGradient[i];
|
||||||
|
var _match = string_partial_match(_prest.name, gradient_search_string);
|
||||||
|
if(_match <= -9999) continue;
|
||||||
|
|
||||||
|
ds_priority_add(_pr, _prest, _match);
|
||||||
|
}
|
||||||
|
|
||||||
|
repeat(ds_priority_size(_pr))
|
||||||
|
array_push(gradientPresets, ds_priority_delete_max(_pr));
|
||||||
|
|
||||||
|
ds_priority_destroy(_pr);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region palette
|
#region palette
|
||||||
function initPalette() { paletePresets = array_clone(PALETTES); return self; } initPalette();
|
function initPalette() {
|
||||||
|
paletePresets = array_clone(PALETTES);
|
||||||
|
currentPresets = paletePresets;
|
||||||
|
return self;
|
||||||
|
} initPalette();
|
||||||
|
|
||||||
palette_selecting = -1;
|
palette_selecting = -1;
|
||||||
preset_show_name = true;
|
preset_show_name = true;
|
||||||
|
@ -242,7 +287,42 @@ event_inherited();
|
||||||
return hh;
|
return hh;
|
||||||
});
|
});
|
||||||
|
|
||||||
//////////////////////// SORT
|
//////////////////////// SEARCH ////////////////////////
|
||||||
|
|
||||||
|
palette_search_string = "";
|
||||||
|
tb_palette_search = new textBox(TEXTBOX_INPUT.text, function(t) /*=>*/ {return searchPalette(t)} )
|
||||||
|
.setFont(f_p2)
|
||||||
|
.setHide(1)
|
||||||
|
.setEmpty(false)
|
||||||
|
.setPadding(ui(24))
|
||||||
|
.setAutoUpdate();
|
||||||
|
|
||||||
|
function searchPalette(t) {
|
||||||
|
palette_search_string = t;
|
||||||
|
|
||||||
|
if(palette_search_string == "") {
|
||||||
|
paletePresets = currentPresets;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
paletePresets = [];
|
||||||
|
var _pr = ds_priority_create();
|
||||||
|
|
||||||
|
for( var i = 0, n = array_length(currentPresets); i < n; i++ ) {
|
||||||
|
var _prest = currentPresets[i];
|
||||||
|
var _match = string_partial_match(_prest.name, palette_search_string);
|
||||||
|
if(_match <= -9999) continue;
|
||||||
|
|
||||||
|
ds_priority_add(_pr, _prest, _match);
|
||||||
|
}
|
||||||
|
|
||||||
|
repeat(ds_priority_size(_pr))
|
||||||
|
array_push(paletePresets, ds_priority_delete_max(_pr));
|
||||||
|
|
||||||
|
ds_priority_destroy(_pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////// SORT ////////////////////////
|
||||||
|
|
||||||
sortPreset_name_a = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p0.name, p1.name)}); }
|
sortPreset_name_a = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p0.name, p1.name)}); }
|
||||||
sortPreset_name_d = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p1.name, p0.name)}); }
|
sortPreset_name_d = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p1.name, p0.name)}); }
|
||||||
|
|
|
@ -43,8 +43,18 @@ draggable = true;
|
||||||
#region presets
|
#region presets
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, presets_x + pal_padding, dialog_y + ui(48), ui(240) - pal_padding * 2, dialog_h - ui(48) - pal_padding);
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, presets_x + pal_padding, dialog_y + ui(48), ui(240) - pal_padding * 2, dialog_h - ui(48) - pal_padding);
|
||||||
|
|
||||||
|
var _px = presets_x + pal_padding + ui(4);
|
||||||
|
var _py = dialog_y + ui(48 + 4);
|
||||||
|
var _pw = sp_palette_w;
|
||||||
|
|
||||||
|
draw_sprite_stretched_ext(THEME.textbox, 1, _px, _py, _pw, ui(24), COLORS._main_icon);
|
||||||
|
tb_preset_search.setFocusHover(sFOCUS, sHOVER);
|
||||||
|
tb_preset_search.draw(_px, _py, _pw, ui(24), gradient_search_string);
|
||||||
|
draw_sprite_ui(THEME.search, 0, _px + ui(12), _py + ui(12), .75, .75, 0, COLORS._main_icon, .5);
|
||||||
|
|
||||||
sp_presets.setFocusHover(sFOCUS, sHOVER);
|
sp_presets.setFocusHover(sFOCUS, sHOVER);
|
||||||
sp_presets.draw(presets_x + pal_padding + ui(4), dialog_y + ui(48) + ui(4));
|
sp_presets.verify(_pw, dialog_h - ui(72 + 24));
|
||||||
|
sp_presets.draw(_px, _py + ui(24 + 8));
|
||||||
|
|
||||||
var bx = presets_x + presets_w - ui(44);
|
var bx = presets_x + presets_w - ui(44);
|
||||||
var by = dialog_y + ui(12);
|
var by = dialog_y + ui(12);
|
||||||
|
@ -63,6 +73,7 @@ draggable = true;
|
||||||
|
|
||||||
file_text_write_all(txt + ".txt", gradStr);
|
file_text_write_all(txt + ".txt", gradStr);
|
||||||
__initGradient();
|
__initGradient();
|
||||||
|
initGradient();
|
||||||
};
|
};
|
||||||
dia.path = DIRECTORY + "Gradients/"
|
dia.path = DIRECTORY + "Gradients/"
|
||||||
}
|
}
|
||||||
|
@ -70,7 +81,7 @@ draggable = true;
|
||||||
bx -= ui(32);
|
bx -= ui(32);
|
||||||
|
|
||||||
var b = buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Refresh"), THEME.refresh_20);
|
var b = buttonInstant(THEME.button_hide_fill, bx, by, bs, bs, mouse_ui, sHOVER, sFOCUS, __txt("Refresh"), THEME.refresh_20);
|
||||||
if(b == 2) __initGradient();
|
if(b == 2) { __initGradient(); initGradient(); }
|
||||||
draggable &= !b;
|
draggable &= !b;
|
||||||
bx -= ui(32);
|
bx -= ui(32);
|
||||||
|
|
||||||
|
@ -87,8 +98,18 @@ draggable = true;
|
||||||
#region palette
|
#region palette
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, palette_x + pal_padding, dialog_y + ui(48), ui(240) - pal_padding * 2, dialog_h - ui(48) - pal_padding);
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, palette_x + pal_padding, dialog_y + ui(48), ui(240) - pal_padding * 2, dialog_h - ui(48) - pal_padding);
|
||||||
|
|
||||||
|
var _px = palette_x + pal_padding + ui(4);
|
||||||
|
var _py = dialog_y + ui(48 + 4);
|
||||||
|
var _pw = sp_palette_w;
|
||||||
|
|
||||||
|
draw_sprite_stretched_ext(THEME.textbox, 1, _px, _py, _pw, ui(24), COLORS._main_icon);
|
||||||
|
tb_palette_search.setFocusHover(sFOCUS, sHOVER);
|
||||||
|
tb_palette_search.draw(_px, _py, _pw, ui(24), palette_search_string);
|
||||||
|
draw_sprite_ui(THEME.search, 0, _px + ui(12), _py + ui(12), .75, .75, 0, COLORS._main_icon, .5);
|
||||||
|
|
||||||
sp_palettes.setFocusHover(sFOCUS, sHOVER);
|
sp_palettes.setFocusHover(sFOCUS, sHOVER);
|
||||||
sp_palettes.draw(palette_x + pal_padding + ui(4), dialog_y + ui(48) + ui(4));
|
sp_palettes.verify(_pw, dialog_h - ui(72 + 24));
|
||||||
|
sp_palettes.draw(_px, _py + ui(24 + 8));
|
||||||
|
|
||||||
var bx = palette_x + palette_w - ui(44);
|
var bx = palette_x + palette_w - ui(44);
|
||||||
var by = dialog_y + ui(12);
|
var by = dialog_y + ui(12);
|
||||||
|
|
|
@ -13,16 +13,15 @@ function __PaletteColor(_color = c_black) constructor {
|
||||||
title_height = 52;
|
title_height = 52;
|
||||||
destroy_on_click_out = true;
|
destroy_on_click_out = true;
|
||||||
|
|
||||||
name = __txtx("palette_editor_title", "Palette editor");
|
name = __txtx("palette_editor_title", "Palette editor");
|
||||||
palette = 0;
|
palette = 0;
|
||||||
paletteObject = [];
|
paletteObject = [];
|
||||||
|
|
||||||
index_sel_start = 0;
|
index_sel_start = 0;
|
||||||
index_selecting = [ 0, 0 ];
|
index_selecting = [ 0, 0 ];
|
||||||
index_dragging = noone;
|
index_dragging = noone;
|
||||||
interactable = true;
|
interactable = true;
|
||||||
drop_target = noone; setDrop = function(d) /*=>*/ { drop_target = d; return self; }
|
drop_target = noone; setDrop = function(d) /*=>*/ { drop_target = d; return self; }
|
||||||
|
|
||||||
mouse_interact = false;
|
mouse_interact = false;
|
||||||
|
|
||||||
mixer = noone;
|
mixer = noone;
|
||||||
|
@ -92,14 +91,18 @@ function __PaletteColor(_color = c_black) constructor {
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region presets
|
#region presets
|
||||||
function initPalette() { paletePresets = array_clone(PALETTES); return self; } initPalette();
|
function initPalette() {
|
||||||
|
paletePresets = array_clone(PALETTES);
|
||||||
|
currentPresets = paletePresets;
|
||||||
|
return self;
|
||||||
|
} initPalette();
|
||||||
|
|
||||||
hovering_name = "";
|
hovering_name = "";
|
||||||
preset_show_name = true;
|
preset_show_name = true;
|
||||||
|
|
||||||
pal_padding = ui(9);
|
pal_padding = ui(9);
|
||||||
sp_preset_w = ui(240) - pal_padding * 2 - ui(8);
|
sp_preset_w = ui(240) - pal_padding * 2 - ui(8);
|
||||||
sp_presets = new scrollPane(sp_preset_w, dialog_h - ui(48 + 8) - pal_padding, function(_y, _m) {
|
sp_presets = new scrollPane(sp_preset_w, dialog_h - ui(48 + 8 + 40) - pal_padding, function(_y, _m) {
|
||||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||||
|
|
||||||
var _hov = sp_presets.hover && sHOVER;
|
var _hov = sp_presets.hover && sHOVER;
|
||||||
|
@ -154,7 +157,42 @@ function __PaletteColor(_color = c_black) constructor {
|
||||||
return hh;
|
return hh;
|
||||||
});
|
});
|
||||||
|
|
||||||
//////////////////////// SORT
|
//////////////////////// SEARCH ////////////////////////
|
||||||
|
|
||||||
|
search_string = "";
|
||||||
|
tb_search = new textBox(TEXTBOX_INPUT.text, function(t) /*=>*/ {return searchPalette(t)} )
|
||||||
|
.setFont(f_p2)
|
||||||
|
.setHide(1)
|
||||||
|
.setEmpty(false)
|
||||||
|
.setPadding(ui(24))
|
||||||
|
.setAutoUpdate();
|
||||||
|
|
||||||
|
function searchPalette(t) {
|
||||||
|
search_string = t;
|
||||||
|
|
||||||
|
if(search_string == "") {
|
||||||
|
paletePresets = currentPresets;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
paletePresets = [];
|
||||||
|
var _pr = ds_priority_create();
|
||||||
|
|
||||||
|
for( var i = 0, n = array_length(currentPresets); i < n; i++ ) {
|
||||||
|
var _prest = currentPresets[i];
|
||||||
|
var _match = string_partial_match(_prest.name, search_string);
|
||||||
|
if(_match <= -9999) continue;
|
||||||
|
|
||||||
|
ds_priority_add(_pr, _prest, _match);
|
||||||
|
}
|
||||||
|
|
||||||
|
repeat(ds_priority_size(_pr))
|
||||||
|
array_push(paletePresets, ds_priority_delete_max(_pr));
|
||||||
|
|
||||||
|
ds_priority_destroy(_pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////// SORT ////////////////////////
|
||||||
|
|
||||||
sortPreset_name_a = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p0.name, p1.name)}); }
|
sortPreset_name_a = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p0.name, p1.name)}); }
|
||||||
sortPreset_name_d = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p1.name, p0.name)}); }
|
sortPreset_name_d = function() /*=>*/ { array_sort(paletePresets, function(p0, p1) /*=>*/ {return string_compare(p1.name, p0.name)}); }
|
||||||
|
@ -241,7 +279,6 @@ function __PaletteColor(_color = c_black) constructor {
|
||||||
if(onApply != noone) onApply(palette);
|
if(onApply != noone) onApply(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onResize() { sp_presets.resize(sp_preset_w, dialog_h - ui(62)); }
|
|
||||||
function checkMouse() {}
|
function checkMouse() {}
|
||||||
|
|
||||||
menu_palette_sort = [
|
menu_palette_sort = [
|
||||||
|
|
|
@ -34,8 +34,18 @@ draggable = true;
|
||||||
#region presets
|
#region presets
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, presets_x + pal_padding, dialog_y + ui(48), ui(240) - pal_padding * 2, dialog_h - ui(48) - pal_padding);
|
draw_sprite_stretched(THEME.ui_panel_bg, 1, presets_x + pal_padding, dialog_y + ui(48), ui(240) - pal_padding * 2, dialog_h - ui(48) - pal_padding);
|
||||||
|
|
||||||
|
var _px = presets_x + pal_padding + ui(4);
|
||||||
|
var _py = dialog_y + ui(48 + 4);
|
||||||
|
var _pw = sp_preset_w;
|
||||||
|
|
||||||
|
draw_sprite_stretched_ext(THEME.textbox, 1, _px, _py, _pw, ui(24), COLORS._main_icon);
|
||||||
|
tb_search.setFocusHover(sFOCUS, sHOVER);
|
||||||
|
tb_search.draw(_px, _py, _pw, ui(24), search_string);
|
||||||
|
draw_sprite_ui(THEME.search, 0, _px + ui(12), _py + ui(12), .75, .75, 0, COLORS._main_icon, .5);
|
||||||
|
|
||||||
sp_presets.setFocusHover(sFOCUS, sHOVER);
|
sp_presets.setFocusHover(sFOCUS, sHOVER);
|
||||||
sp_presets.draw(presets_x + pal_padding + ui(4), dialog_y + ui(48) + ui(4));
|
sp_presets.verify(_pw, dialog_h - ui(72 + 24));
|
||||||
|
sp_presets.draw(_px, _py + ui(24 + 8));
|
||||||
|
|
||||||
var bx = presets_x + presets_w - ui(44);
|
var bx = presets_x + presets_w - ui(44);
|
||||||
var by = dialog_y + ui(12);
|
var by = dialog_y + ui(12);
|
||||||
|
|
|
@ -164,7 +164,7 @@ function Node_PB_Draw(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
||||||
shader_set_i("stroke", _stk );
|
shader_set_i("stroke", _stk );
|
||||||
shader_set_f("stroke_thickness", _stk_thk );
|
shader_set_f("stroke_thickness", _stk_thk );
|
||||||
shader_set_c("stroke_color", _stk_col );
|
shader_set_c("stroke_color", _stk_col );
|
||||||
shader_set_i("stroke_position", _stk_pos );
|
shader_set_i("stroke_position", _stk_thk <= 1? 1 : _stk_pos );
|
||||||
shader_set_i("stroke_corner", _stk_cor );
|
shader_set_i("stroke_corner", _stk_cor );
|
||||||
shader_set_i("stroke_pattern", _stk_pat );
|
shader_set_i("stroke_pattern", _stk_pat );
|
||||||
shader_set_2("stroke_pattern_scale", _stk_pat_sca );
|
shader_set_2("stroke_pattern_scale", _stk_pat_sca );
|
||||||
|
|
|
@ -190,19 +190,20 @@ function Panel_Inspector() : PanelContent() constructor {
|
||||||
drawWidgetInit();
|
drawWidgetInit();
|
||||||
|
|
||||||
#region ---- header labels ----
|
#region ---- header labels ----
|
||||||
tb_node_name = new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { if(inspecting) inspecting.setDisplayName(txt); });
|
tb_node_name = new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { if(inspecting) inspecting.setDisplayName(txt); })
|
||||||
|
.setFont(f_h5)
|
||||||
|
.setHide(1)
|
||||||
|
.setAlign(fa_center);
|
||||||
|
|
||||||
tb_node_name.format = TEXT_AREA_FORMAT.node_title;
|
tb_node_name.format = TEXT_AREA_FORMAT.node_title;
|
||||||
tb_node_name.font = f_h5;
|
|
||||||
tb_node_name.align = fa_center;
|
|
||||||
tb_node_name.hide = true;
|
|
||||||
|
|
||||||
tb_prop_filter = new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { filter_text = txt; });
|
tb_prop_filter = new textBox(TEXTBOX_INPUT.text, function(txt) /*=>*/ { filter_text = txt; })
|
||||||
tb_prop_filter.no_empty = false;
|
.setFont(f_p0)
|
||||||
tb_prop_filter.auto_update = true;
|
.setHide(1)
|
||||||
tb_prop_filter.font = f_p0;
|
.setAlign(fa_center)
|
||||||
tb_prop_filter.color = COLORS._main_text_sub;
|
.setColor(COLORS._main_text_sub)
|
||||||
tb_prop_filter.align = fa_center;
|
.setEmpty(false)
|
||||||
tb_prop_filter.hide = true;
|
.setAutoUpdate()
|
||||||
filter_text = "";
|
filter_text = "";
|
||||||
|
|
||||||
prop_page = 0;
|
prop_page = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue