- [Particle] Add array output type.

- UI improvements
This commit is contained in:
Tanasart 2023-11-13 11:38:37 +07:00
parent 2f73cc686d
commit 97882cc902
29 changed files with 187 additions and 176 deletions

View file

@ -386,6 +386,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_export_package.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_grid_setting.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_grid_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_inspector_view.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_keyframe_override.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_minimap_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_icon_node_dropper.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},

Binary file not shown.

View file

@ -11,7 +11,7 @@ if !ready exit;
#endregion
#region nodes
draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(16), dialog_y + ui(44), dialog_w - ui(32), ui(112));
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(16), dialog_y + ui(44), dialog_w - ui(32), ui(112));
var grid_size = ui(64);
var grid_space = ui(16);
var grid_width = grid_size + grid_space;

View file

@ -283,7 +283,7 @@ event_inherited();
BLEND_OVERRIDE;
if(i == ADD_NODE_PAGE) {
draw_sprite_stretched(THEME.ui_panel_bg, 0, 0, _y + hh, category_width, hg);
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, _y + hh, category_width, hg);
} else if(sHOVER && catagory_pane.hover && point_in_rectangle(_m[0], _m[1], 0, _y + hh, category_width - ui(32), _y + hh + hg - 1)) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, _y + hh, category_width, hg, c_white, 0.75);
if(mouse_click(mb_left, sFOCUS)) {
@ -498,7 +498,7 @@ event_inherited();
var _yy = max(lb.y, i == len - 1? ui(8) : min(ui(8), group_labels[i + 1].y - ui(32)));
BLEND_OVERRIDE;
draw_sprite_stretched(THEME.group_label, 0, ui(16), _yy, content_pane.surface_w - ui(32), ui(24));
draw_sprite_stretched_ext(THEME.group_label, 0, ui(16), _yy, content_pane.surface_w - ui(32), ui(24), c_white, 0.3);
BLEND_NORMAL;
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);

View file

@ -3,8 +3,7 @@ if !ready exit;
#region base UI
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
if(sFOCUS)
draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
if(sFOCUS) draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
#endregion
#region search
@ -18,14 +17,14 @@ if !ready exit;
catagory_pane.draw(dialog_x + ui(14), dialog_y + ui(52));
var _x = dialog_x + category_width - ui(12);
draw_sprite_stretched(THEME.ui_panel_bg, 0, _x, dialog_y + ui(52), dialog_w - category_width - ui(2), dialog_h - ui(66));
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x, dialog_y + ui(52), dialog_w - category_width - ui(2), dialog_h - ui(66));
content_pane.setFocusHover(sFOCUS, sHOVER);
content_pane.draw(_x, dialog_y + ui(52));
node_selecting = 0;
} else {
tb_search.setFocusHover(true, true);
draw_sprite_stretched(THEME.ui_panel_bg, 0, dialog_x + ui(14), dialog_y + ui(52), dialog_w - ui(28), dialog_h - ui(66));
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(14), dialog_y + ui(52), dialog_w - ui(28), dialog_h - ui(66));
search_pane.setFocusHover(sFOCUS, sHOVER);
search_pane.draw(dialog_x + ui(16), dialog_y + ui(52));
}

View file

@ -6,7 +6,10 @@ event_inherited();
dialog_h = ui(400);
destroy_on_click_out = true;
dragging = noone;
dragging = noone;
drag_disp = noone;
drag_insert = 0;
drag_shift = 0;
sep_editing = -1;
tb_edit = new textBox(TEXTBOX_INPUT.text, function(str) {
@ -124,7 +127,7 @@ event_inherited();
}
if(dragging != noone && _ly > -1) {
draw_set_color(COLORS._main_icon_dark);
draw_set_color(COLORS._main_icon);
draw_line_round(ui(4), _ly, con_w - ui(4), _ly, 4);
}

View file

@ -16,7 +16,7 @@ if !ready exit;
var pw = dialog_w - ui(padding + padding);
var ph = dialog_h - ui(title_height + padding)
draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sc_group.setFocusHover(sFOCUS, sHOVER);
sc_group.draw(px, py);

View file

@ -16,7 +16,7 @@ if !ready exit;
var pw = dialog_w - ui(padding + padding);
var ph = dialog_h - ui(title_height + padding)
draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sc_group.setFocusHover(sFOCUS, sHOVER);
sc_group.draw(px, py);
#endregion

View file

@ -13,7 +13,7 @@ event_inherited();
content = noone;
destroy_on_click_out = true;
function setContent(content) {
function setContent(content) { #region
self.content = content;
if(struct_has(content, "title_height"))
@ -28,9 +28,9 @@ event_inherited();
content.in_dialog = true;
if(content.auto_pin) destroy_on_click_out = false;
}
} #endregion
function resetMask() {
function resetMask() { #region
if(!content) return;
mask_surface = surface_verify(mask_surface, dialog_w - content.showHeader * padding * 2,
dialog_h - content.showHeader * (padding * 2 + title_height));
@ -42,10 +42,9 @@ event_inherited();
dialog_h - content.showHeader * (padding * 2 + title_height));
gpu_set_blendmode(bm_normal);
surface_reset_target();
}
resetMask();
} resetMask(); #endregion
onResize = function() {
onResize = function() { #region
panel = surface_verify(panel, dialog_w, dialog_h);
resetMask();
@ -55,19 +54,19 @@ event_inherited();
content.onResize();
}
}
} #endregion
function checkClosable() {
function checkClosable() { #region
if(!content) return true;
return content.checkClosable();
}
} #endregion
function onDestroy() {
function onDestroy() { #region
if(content == noone) return;
content.onClose();
}
} #endregion
function remove() {
function remove() { #region
instance_destroy();
}
} #endregion
#endregion

View file

@ -28,7 +28,7 @@ if !ready exit;
resetMask();
surface_set_target(panel);
DRAW_CLEAR
draw_clear(COLORS.panel_bg_clear);
content.drawContent(panel);
gpu_set_blendmode(bm_subtract);

View file

@ -371,15 +371,6 @@ event_inherited();
ds_list_add(pref_appr, __txt("Inspector"));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_inspector_line_break_width", "Inspector line break width"),
"inspector_line_break_width",
new textBox(TEXTBOX_INPUT.number, function(str) {
PREFERENCES.inspector_line_break_width = max(1, round(real(str)));
PREF_SAVE();
})
));
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_inspector_focus_on_double_click", "Focus on double click"),
"inspector_focus_on_double_click",

View file

@ -14,7 +14,10 @@ function __part(_node) constructor {
seed = irandom(99999);
node = _node;
active = false;
surf = noone;
surf = noone;
arr_type = 0;
prevx = 0;
prevy = 0;
x = 0;
@ -246,12 +249,12 @@ function __part(_node) constructor {
drawsy += wig_scy.get(seed + life);
} #endregion
static draw = function(exact, surf_w, surf_h) { #region
static draw = function(exact, surf_w, surf_h, _index = 0) { #region
INLINE
var ss = surf;
if(surf != noone && is_array(surf)) {
if(arr_type == 2 && surf != noone && is_array(surf)) {
var ind = abs(round((life_total - life) * anim_speed));
var len = array_length(surf);
@ -272,14 +275,12 @@ function __part(_node) constructor {
ss = surf[ind];
break;
}
}
} else if(arr_type == 3) ss = ss[_index];
var surface = is_instanceof(ss, SurfaceAtlas)? ss.getSurface() : node.surface_cache[$ ss];
if(!is_surface(surface)) {
//print($"Drawing part failed: Not a surface");
if(!is_surface(surface))
return;
}
var lifeRat = 1 - life / life_total;
var scCurve = sct == noone? 1 : sct.get(lifeRat);
@ -304,16 +305,13 @@ function __part(_node) constructor {
var x1 = _xx + s_w * 1.5;
var y1 = _yy + s_h * 1.5;
if(x0 > surf_w || y0 > surf_h || x1 < 0 || y1 < 0) {
//print($"Drawing part failed: Outside view");
return; //culling
}
if(x0 > surf_w || y0 > surf_h || x1 < 0 || y1 < 0)
return;
var cc = (col == -1)? c_white : col.eval(lifeRat);
if(blend != c_white) cc = colorMultiply(blend, cc);
alp_draw = alp * (alp_fade == noone? 1 : alp_fade.get(lifeRat));
//print($"Draw part [{frame}]: {surface} at {_xx}, {_yy}, scale {drawsx}, {drawsy} - {scCurve} color {cc}, {alp_draw}");
draw_surface_ext_safe(surface, _xx, _yy, scx, scy, drawrot, cc, alp_draw);
} #endregion

View file

@ -68,7 +68,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
.rejectArray();
inputs[| 22] = nodeValue("Surface array", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "Whether to select image from an array in order, at random, or treat array as animation." )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Order", "Animation" ])
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Order", "Animation", "Array" ])
.setVisible(false);
inputs[| 23] = nodeValue("Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] )
@ -256,14 +256,19 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
var _spr = _inSurf, _index = 0;
if(is_array(_inSurf)) {
if(_arr_type == 0) {
_index = irandom(array_length(_inSurf) - 1);
_spr = _inSurf[_index];
} else if(_arr_type == 1) {
_index = safe_mod(spawn_index, array_length(_inSurf));
_spr = _inSurf[_index];
} else if(_arr_type == 2) {
_spr = _inSurf;
switch(_arr_type) {
case 0 :
_index = irandom(array_length(_inSurf) - 1);
_spr = _inSurf[_index];
break;
case 1 :
_index = safe_mod(spawn_index, array_length(_inSurf));
_spr = _inSurf[_index];
break;
case 2 :
case 3 :
_spr = _inSurf;
break;
}
}
var xx = 0;
@ -313,6 +318,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
part.create(_spr, xx, yy, _lif);
part.anim_speed = random_range(_anim_speed[0], _anim_speed[1]);
part.anim_end = _anim_end;
part.arr_type = _arr_type;
var _trn = random_range(_turn[0], _turn[1]);
if(_turnBi) _trn *= choose(-1, 1);

View file

@ -1,8 +1,10 @@
function globalvar_viewer_init() {
var_editing = false;
var_dragging = noone;
var_dragging = noone;
var_drag_disp = noone;
var_drag_insert = 0;
var_drag_shift = 0;
}
function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry) {
@ -26,26 +28,22 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry
var _ins = var_drag_insert;
var_drag_insert = _len;
var _hov = hover && (var_dragging == noone);
var _foc = focus && (var_dragging == noone);
var_drag_shift = lerp_float(var_drag_shift, (var_dragging != noone) * 48, 4);
for( var j = 0; j < _len; j++ ) {
var _inpu = _node.inputs[| j];
var _edit = _inpu.editor;
var _wd_x = wd_x + (var_drag_disp == j) * var_drag_shift;
var wd_h = ui(32);
if(var_dragging != noone) {
if(_m[1] < yy + wd_h && var_drag_insert == _len)
var_drag_insert = j;
if(var_dragging != noone && _m[1] < yy && var_drag_insert == _len)
var_drag_insert = j > var_dragging? j : j - 1;
if(j == _ins) {
draw_set_color(COLORS._main_icon);
draw_line_round(wd_x + ui(8), yy, wd_x + wd_w - ui(16), yy, 4);
}
if(var_dragging == j)
continue;
yy += ui(10);
hh += ui(10);
} else if(j) {
if(j) {
draw_set_color(merge_color(c_black, COLORS.panel_toolbar_separator, 0.75));
draw_line_round(wd_x + ui(8), yy, wd_x + wd_w - ui(16), yy, 4);
@ -53,59 +51,59 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry
hh += ui(10);
}
var bx = wd_x + ui(10);
var by = yy + ui(16);
if(hover && point_in_rectangle(_m[0], _m[1], bx - ui(12), by - ui(12), bx + ui(12), by + ui(12))) {
draw_sprite_stretched_ext(THEME.group_label, 0, bx - ui(12), by - ui(12), ui(24), ui(24), COLORS._main_icon_light, 1);
if(var_dragging == noone) {
var bx = wd_x + ui(10);
var by = yy + ui(16);
if(hover && point_in_rectangle(_m[0], _m[1], bx - ui(12), by - ui(12), bx + ui(12), by + ui(12))) {
draw_sprite_stretched_ext(THEME.group_label, 0, bx - ui(12), by - ui(12), ui(24), ui(24), COLORS._main_icon_light, 1);
if(mouse_press(mb_left, focus)) {
var_dragging = j;
}
} else
draw_sprite_stretched_ext(THEME.group_label, 0, bx - ui(12), by - ui(12), ui(24), ui(24), COLORS._main_icon_light, 0.75);
if(mouse_press(mb_left, _foc)) {
var_drag_disp = j;
var_dragging = j;
var_drag_insert = j;
}
} else
draw_sprite_stretched_ext(THEME.group_label, 0, bx - ui(12), by - ui(12), ui(24), ui(24), COLORS._main_icon_light, 0.75);
draw_sprite_ext(THEME.hamburger, 0, bx, by, 0.5, 0.5, 0, COLORS._main_icon_light, 1);
draw_sprite_ext(THEME.hamburger, 0, bx, by, 0.5, 0.5, 0, COLORS._main_icon_light, 1);
}
_edit.tb_name.setFocusHover(focus, hover);
_edit.sc_type.setFocusHover(focus, hover);
_edit.sc_disp.setFocusHover(focus, hover);
_edit.tb_name.setFocusHover(_foc, _hov);
_edit.sc_type.setFocusHover(_foc, _hov);
_edit.sc_disp.setFocusHover(_foc, _hov);
_edit.tb_name.draw(wd_x + ui(32), yy, wd_w - wd_h - ui(32 + 4), wd_h, _inpu.name, _m, TEXTBOX_INPUT.text);
if(buttonInstant(THEME.button_hide, wd_x + wd_w - wd_h, yy, wd_h, wd_h, _m, focus, hover,, THEME.icon_delete,, COLORS._main_value_negative) == 2)
_edit.tb_name.draw(_wd_x + ui(32), yy, wd_w - wd_h - ui(32 + 4), wd_h, _inpu.name, _m, TEXTBOX_INPUT.text);
if(buttonInstant(THEME.button_hide, _wd_x + wd_w - wd_h, yy, wd_h, wd_h, _m, _foc, _hov,, THEME.icon_delete,, COLORS._main_value_negative) == 2)
del = j;
yy += wd_h + ui(8);
hh += wd_h + ui(8);
_edit.sc_type.draw(wd_x, yy, wd_w / 2 - ui(2), wd_h, _edit.val_type_name[_edit.type_index], _m, rx, ry);
_edit.sc_disp.draw(wd_x + wd_w / 2 + ui(2), yy, wd_w / 2 - ui(2), wd_h, _edit.sc_disp.data_list[_edit.disp_index], _m, rx, ry);
_edit.sc_type.draw(_wd_x, yy, wd_w / 2 - ui(2), wd_h, _edit.val_type_name[_edit.type_index], _m, rx, ry);
_edit.sc_disp.draw(_wd_x + wd_w / 2 + ui(2), yy, wd_w / 2 - ui(2), wd_h, _edit.sc_disp.data_list[_edit.disp_index], _m, rx, ry);
yy += wd_h + ui(4);
hh += wd_h + ui(4);
var wd_h = _inpu.editor.draw(wd_x, yy, wd_w, _m, focus, hover);
var wd_h = _inpu.editor.draw(_wd_x, yy, wd_w, _m, _foc, _hov);
yy += wd_h + ui(4);
hh += wd_h + ui(4);
}
if(var_dragging != noone) {
if(var_drag_insert == _len) {
draw_set_color(COLORS._main_icon);
draw_line_round(wd_x + ui(8), yy, wd_x + wd_w - ui(16), yy, 4);
yy += ui(10);
hh += ui(10);
}
if(mouse_release(mb_left)) {
if(var_drag_insert != var_dragging) {
var _inp = _node.inputs[| var_dragging];
ds_list_delete(_node.inputs, var_dragging);
if(var_drag_insert > var_dragging) var_drag_insert--;
ds_list_insert(_node.inputs, var_drag_insert, _inp);
var_dragging = noone;
var_dragging = var_drag_insert;
var_drag_disp = var_drag_insert;
}
if(mouse_release(mb_left))
var_dragging = noone;
}
if(del != noone)

View file

@ -8,10 +8,11 @@ function drawWidgetInit() {
}
function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _focus = false, _scrollPane = noone, rx = 0, ry = 0) {
var con_w = ww - ui(4);
var xc = xx + ww / 2;
var lb_h = line_get_height(f_p0) + ui(8);
var con_w = ww - ui(4);
var xc = xx + ww / 2;
var _font = lineBreak? f_p0 : f_p1;
var lb_h = line_get_height(_font) + ui(8);
var lb_y = yy + lb_h / 2;
var breakLine = lineBreak || jun.expUse;
@ -79,7 +80,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(global_var) if(string_pos(" ", _name)) cc = COLORS._main_value_negative;
draw_set_text(f_p0, fa_left, fa_center, cc);
draw_set_text(_font, fa_left, fa_center, cc);
var lb_w = string_width(_name) + ui(48);
var lb_x = xx + ui(40);
@ -264,6 +265,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
case VALUE_TYPE.boolean :
param.halign = breakLine? fa_left : fa_center;
param.s = breakLine? ui(24) : editBoxH;
break;
case VALUE_TYPE.d3Material :
@ -273,10 +275,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
case VALUE_TYPE.curve :
param.h = ui(160);
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + param.h)) {
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + param.h))
mbRight = false;
//_scrollPane.scroll_lock = true; // Not good UX-wise
}
break;
}

View file

@ -23,7 +23,8 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
array_insert(input_display_list, 0, ["Output", true], input_len + 0);
array_push(input_display_list, input_len + 1, input_len + 2);
def_surface = -1;
def_surface = -1;
render_amount = 0;
insp2UpdateTooltip = "Clear cache";
insp2UpdateIcon = [ THEME.cache, 0, COLORS._main_icon ];
@ -55,18 +56,27 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
seed = getInputData(32);
} #endregion
static onStep = function() { #region
var _dim = getInputData(input_len + 0);
var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf);
} #endregion
static onUpdate = function(frame = CURRENT_FRAME) { #region
var _dim = getInputData(input_len + 0);
var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
var _inSurf = getInputData(0);
var _arr_type = getInputData(22);
var _dim = getInputData(input_len + 0);
var _outSurf = outputs[| 0].getValue();
if(is_array(_inSurf) && _arr_type == 3) {
var _len = array_length(_inSurf);
if(!is_array(_outSurf))
_outSurf = array_create(_len);
else if(array_length(_outSurf) != _len)
array_resize(_outSurf, _len);
for( var i = 0; i < _len; i++ )
_outSurf[i] = surface_verify(_outSurf[i], _dim[0], _dim[1], attrDepth());
render_amount = _len;
} else {
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
render_amount = 0;
}
outputs[| 0].setValue(_outSurf);
if(CURRENT_FRAME == 0) {
@ -81,36 +91,33 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
var _dim = inputs[| input_len + 0].getValue(_time);
var _exact = inputs[| input_len + 1].getValue(_time);
var _blend = inputs[| input_len + 2].getValue(_time);
var _outSurf = outputs[| 0].getValue();
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
outputs[| 0].setValue(_outSurf);
surface_set_shader(_outSurf);
shader_set_interpolation(_outSurf);
if(_blend == PARTICLE_BLEND_MODE.normal)
BLEND_NORMAL;
else if(_blend == PARTICLE_BLEND_MODE.alpha)
BLEND_ALPHA;
else if(_blend == PARTICLE_BLEND_MODE.additive)
BLEND_ADD;
var surf_w = surface_get_width_safe(_outSurf);
var surf_h = surface_get_height_safe(_outSurf);
//print($"===== Drawing frame {_time} =====");
for(var i = 0; i < attributes.part_amount; i++) {
if(!parts[i].active) continue;
//print($" > Draw part {i} = ({parts[i].x}, {parts[i].y})");
parts[i].draw(_exact, surf_w, surf_h);
}
BLEND_NORMAL;
surface_reset_shader();
if(PROJECT.animator.is_playing) {
//print($"Cache frame {CURRENT_FRAME}");
cacheCurrentFrame(_outSurf);
switch(_blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
if(render_amount == 0) {
surface_set_shader(_outSurf);
shader_set_interpolation(_outSurf);
for(var i = 0; i < attributes.part_amount; i++)
if(parts[i].active) parts[i].draw(_exact, _dim[0], _dim[1]);
surface_reset_shader();
} else if(is_array(_outSurf)) {
for( var o = 0, n = array_length(_outSurf); o < n; o++ ) {
surface_set_shader(_outSurf[o]);
shader_set_interpolation(_outSurf[o]);
for(var i = 0; i < attributes.part_amount; i++)
if(parts[i].active) parts[i].draw(_exact, _dim[0], _dim[1], o);
surface_reset_shader();
}
}
BLEND_NORMAL
if(PROJECT.animator.is_playing)
cacheCurrentFrame(_outSurf);
} #endregion
}

View file

@ -169,7 +169,7 @@ function Panel_Addon() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
if(pFOCUS) WIDGET_CURRENT = tb_search;
tb_search.draw(px, py, pw, ui(32), search_string, [mx, my]);
if(search_string == "") tb_search.sprite_index = 1;

View file

@ -78,7 +78,7 @@ function Panel_Array_Sequence(node) : PanelContent() constructor {
var msx = mx - px;
var msy = my - py;
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sequence_surface = surface_verify(sequence_surface, pw, ph);
surface_set_target(sequence_surface);

View file

@ -50,7 +50,7 @@ function Panel_Color() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
var cont_x = ui(padding);
var cont_y = ui(title_height);

View file

@ -6,7 +6,7 @@ enum ANCHOR {
right = 8
}
function Panel(_parent, _x, _y, _w, _h) constructor {
function Panel(_parent, _x, _y, _w, _h) constructor { #region
parent = _parent;
if(parent) ds_list_add(parent.childs, self);
@ -613,10 +613,13 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
draw_surface(tab_surface, tsx, tsy);
} #endregion
function setTab(tabIndex) { #region
function setTab(tabIndex, forceFocus = false) { #region
if(tabIndex < 0) return;
if(tabIndex >= array_length(content)) return;
if(content_index == tabIndex) return;
if(content_index == tabIndex) {
if(forceFocus) content[tabIndex].onFocusBegin();
return;
}
var prec = array_safe_get(content, content_index);
if(prec) prec.onFocusEnd();
@ -813,8 +816,8 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
array_remove(content, con);
if(con) con.onClose();
if(con == curr) setTab(0);
else setTab(array_find(content, curr));
if(con == curr) setTab(0, true);
else setTab(array_find(content, curr), true);
refresh();
if(hasContent()) return;
@ -828,9 +831,9 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
parent.setContent(otherPanel.content);
ds_list_clear(parent.childs);
} #endregion
}
} #endregion
function PanelContent() constructor {
function PanelContent() constructor { #region
title = "";
icon = noone;
context_str = "";
@ -922,9 +925,9 @@ function PanelContent() constructor {
static checkClosable = function() { return true; }
static onClose = function() {}
}
} #endregion
function setFocus(target, fstring = noone) {
function setFocus(target, fstring = noone) { #region
if(FOCUS != noone && is_struct(FOCUS) && FOCUS.getContent())
FOCUS.getContent().onFocusEnd();
@ -934,4 +937,4 @@ function setFocus(target, fstring = noone) {
if(FOCUS != noone && is_struct(FOCUS) && FOCUS.getContent())
FOCUS.getContent().onFocusBegin();
}
} #endregion

View file

@ -44,7 +44,7 @@ function Panel_Globalvar() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
contentPane.setFocusHover(pFOCUS, pHOVER);
contentPane.draw(px, py, mx - px, my - py);

View file

@ -37,7 +37,7 @@ function Panel_Gradient() : PanelContent() constructor {
var preset = GRADIENTS[ind];
var isHover = pHOVER && point_in_rectangle(_m[0], _m[1], xx, max(0, yy), xx + gw - ui(8), min(sp_gradient.h, yy + hg));
draw_sprite_stretched(THEME.ui_panel_bg, in_dialog, xx, yy, gw - ui(8), hg);
draw_sprite_stretched(THEME.ui_panel_bg, 3, xx, yy, gw - ui(8), hg);
if(isHover)
draw_sprite_stretched_ext(THEME.node_active, 1, xx, yy, gw - ui(8), hg, COLORS._main_accent, 1);
@ -70,7 +70,7 @@ function Panel_Gradient() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sp_gradient.setFocusHover(pFOCUS, pHOVER);
sp_gradient.draw(px, py, mx - px, my - py);

View file

@ -166,7 +166,7 @@ function Panel_History() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sc_history.setFocusHover(pFOCUS, pHOVER);
sc_history.draw(px, py, mx - px, my - py);
}

View file

@ -24,6 +24,8 @@ function Panel_Inspector() : PanelContent() constructor {
content_h = h - top_bar_h - ui(12);
}
initSize();
view_mode_tooltip = new tooltipSelector("View", [ "Compact", "Spacious" ])
#endregion
#region ---- properties ----
@ -292,7 +294,7 @@ function Panel_Inspector() : PanelContent() constructor {
var wh = 0;
var _dataFunc = display[1];
var _data = _dataFunc(meta);
switch(instanceof(meta_tb[j])) {
case "textArea" :
wh = meta_tb[j].draw(ui(16), yy, w - ui(16 + 48), display[2], _data, _m);
@ -551,8 +553,10 @@ function Panel_Inspector() : PanelContent() constructor {
}
#region ++++ draw widget ++++
var lb_h = line_get_height(f_p0) + ui(8);
var lb_w = line_get_width(jun.getName(), f_p0) + ui(16);
var _font = lineBreak? f_p0 : f_p1;
var lb_h = line_get_height(_font) + ui(8);
var lb_w = line_get_width(jun.getName(), _font) + ui(16);
var lb_x = ui(48) + (ui(24) * (jun.color != -1));
var padd = ui(8);
@ -567,7 +571,7 @@ function Panel_Inspector() : PanelContent() constructor {
hh += lb_h + widH + padd;
var _selY1 = yy + lb_h + widH + ui(2);
var _selH = _selY1 - _selY + ui(4);
var _selH = _selY1 - _selY + (lineBreak * ui(4));
if(jun == prop_highlight && prop_highlight_time) {
if(prop_highlight_time == 60)
@ -708,8 +712,7 @@ function Panel_Inspector() : PanelContent() constructor {
if(point_in_rectangle(_m[0], _m[1], 0, 0, con_w, content_h) && mouse_press(mb_left, pFOCUS))
prop_selecting = noone;
if(inspecting == noone) // metadata
return drawMeta(_y, _m);
if(inspecting == noone) return drawMeta(_y, _m);
return drawNodeProperties(_y, _m);
}); #endregion
@ -752,6 +755,11 @@ function Panel_Inspector() : PanelContent() constructor {
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Presets"), THEME.preset, 1) == 2)
dialogCall(o_dialog_preset, x + bx, y + by + ui(36), { "node": inspecting });
by += ui(36);
view_mode_tooltip.index = lineBreak;
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, view_mode_tooltip, THEME.inspector_view, lineBreak) == 2)
lineBreak = !lineBreak;
var bx = w - ui(44);
var by = ui(12);
@ -778,7 +786,6 @@ function Panel_Inspector() : PanelContent() constructor {
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
draw_clear_alpha(COLORS.panel_bg_clear, 0);
lineBreak = w < PREFERENCES.inspector_line_break_width;
draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), top_bar_h - ui(8), w - ui(16), h - top_bar_h);

View file

@ -108,7 +108,7 @@ function Panel_Nodes() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
tb_search.setFocusHover(pFOCUS, pHOVER);
tb_search.draw(px, py, pw, ui(32), search_string, [mx, my]);

View file

@ -174,7 +174,7 @@ function Panel_Notification() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sp_noti.setFocusHover(pHOVER, pHOVER);
sp_noti.draw(px, py, mx - px, my - py);
}

View file

@ -40,7 +40,7 @@ function Panel_Palette() : PanelContent() constructor {
var isHover = pHOVER && point_in_rectangle(_m[0], _m[1], 0, max(0, yy), ww, min(sp_palettes.h, yy + _height));
draw_sprite_stretched(THEME.ui_panel_bg, in_dialog, 0, yy, ww, _height);
draw_sprite_stretched(THEME.ui_panel_bg, 3, 0, yy, ww, _height);
if(isHover)
draw_sprite_stretched_ext(THEME.node_active, 1, 0, yy, ww, _height, COLORS._main_accent, 1);
@ -90,7 +90,7 @@ function Panel_Palette() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
sp_palettes.setFocusHover(pFOCUS, pHOVER);
sp_palettes.draw(px, py, mx - px, my - py);

View file

@ -160,7 +160,7 @@ function Panel_Tunnels() : PanelContent() constructor {
var pw = w - ui(padding + padding);
var ph = h - ui(title_height + padding);
draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
draw_sprite_stretched(THEME.ui_panel_bg, 1, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
if(pFOCUS) WIDGET_CURRENT = tb_search;
tb_search.draw(px, py, pw, ui(32), search_string, [mx, my]);
if(search_string == "")

View file

@ -36,7 +36,6 @@
PREFERENCES.panel_graph_dragging = MOD_KEY.alt;
PREFERENCES.panel_preview_dragging = MOD_KEY.alt;
PREFERENCES.inspector_line_break_width = 500;
PREFERENCES.inspector_focus_on_double_click = true;
PREFERENCES.node_show_render_status = false;