Pixel-Composer/scripts/panel_inspector/panel_inspector.gml

488 lines
17 KiB
Plaintext
Raw Normal View History

2022-09-23 13:28:42 +02:00
function Inspector_Custom_Renderer(draw) constructor {
h = 64;
self.draw = draw;
}
2022-11-14 03:16:15 +01:00
function Panel_Inspector() : PanelContent() constructor {
2022-01-13 05:24:03 +01:00
context_str = "Inspector";
inspecting = noone;
2022-12-10 05:06:01 +01:00
top_bar_h = ui(96);
2022-01-13 05:24:03 +01:00
prop_hover = noone;
prop_selecting = noone;
2022-11-14 03:16:15 +01:00
function initSize() {
content_w = w - ui(32);
2022-12-10 05:06:01 +01:00
content_h = h - top_bar_h - ui(12);
2022-11-14 03:16:15 +01:00
}
initSize();
2022-01-13 05:24:03 +01:00
keyframe_dragging = noone;
keyframe_drag_st = 0;
2022-11-03 11:44:49 +01:00
min_w = ui(160);
2022-09-21 06:09:40 +02:00
lineBreak = true;
2022-01-13 05:24:03 +01:00
tb_node_name = new textBox(TEXTBOX_INPUT.text, function(txt) {
if(inspecting) inspecting.name = txt;
})
2022-12-10 05:06:01 +01:00
tb_prop_filter = new textBox(TEXTBOX_INPUT.text, function(txt) {
filter_text = txt;
})
filter_text = "";
2022-09-23 13:28:42 +02:00
addHotkey("Inspector", "Copy property", "C", MOD_KEY.ctrl, function() { propSelectCopy(); });
addHotkey("Inspector", "Paste property", "V", MOD_KEY.ctrl, function() { propSelectPaste(); });
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
group_menu = [
[ "Expand all", function() {
if(inspecting == noone) return;
if(inspecting.input_display_list == -1) return;
var dlist = inspecting.input_display_list;
for( var i = 0; i < array_length(dlist); i++ ) {
if(!is_array(dlist[i])) continue;
dlist[i][@ 1] = false;
}
}],
[ "Collapse all", function() {
if(inspecting == noone) return;
if(inspecting.input_display_list == -1) return;
var dlist = inspecting.input_display_list;
for( var i = 0; i < array_length(dlist); i++ ) {
if(!is_array(dlist[i])) continue;
dlist[i][@ 1] = true;
}
}],
]
2022-11-14 03:16:15 +01:00
function onResize() {
2022-12-10 05:06:01 +01:00
initSize();
2022-11-14 03:16:15 +01:00
contentPane.resize(content_w, content_h);
}
2022-01-13 05:24:03 +01:00
contentPane = new scrollPane(content_w, content_h, function(_y, _m) {
var con_w = contentPane.surface_w;
2022-11-18 03:20:31 +01:00
draw_clear_alpha(COLORS.panel_bg_clear, 0);
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
if(point_in_rectangle(_m[0], _m[1], 0, 0, con_w, content_h) && mouse_press(mb_left, pFOCUS))
prop_selecting = noone;
2022-01-13 05:24:03 +01:00
2022-11-01 03:06:03 +01:00
if(inspecting == noone)
2022-09-21 06:09:40 +02:00
return 0;
inspecting.inspecting = true;
prop_hover = noone;
2022-12-10 05:06:01 +01:00
var jun = noone;
2022-09-23 13:28:42 +02:00
var amo = inspecting.input_display_list == -1? ds_list_size(inspecting.inputs) : array_length(inspecting.input_display_list);
2022-11-03 11:44:49 +01:00
var hh = ui(8);
2022-09-21 06:09:40 +02:00
for(var i = 0; i < amo; i++) {
var xc = con_w / 2;
2022-11-03 11:44:49 +01:00
var yy = hh + _y;
2022-01-13 05:24:03 +01:00
2022-09-21 06:09:40 +02:00
if(inspecting.input_display_list == -1) {
jun = inspecting.inputs[| i];
} else {
2022-09-23 13:28:42 +02:00
var jun_disp = inspecting.input_display_list[i];
if(is_array(jun_disp)) {
var txt = jun_disp[0];
2022-12-10 05:06:01 +01:00
var coll = jun_disp[1] && filter_text == "";
2022-09-21 06:09:40 +02:00
2022-11-14 03:16:15 +01:00
if(pHOVER && point_in_rectangle(_m[0], _m[1], 0, yy, con_w, yy + ui(32))) {
2022-11-18 03:20:31 +01:00
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_hover, 1);
2022-11-01 03:06:03 +01:00
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_left, pFOCUS))
2022-09-23 13:28:42 +02:00
jun_disp[@ 1] = !coll;
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_right, pFOCUS))
menuCall(, , group_menu);
2022-09-21 06:09:40 +02:00
} else
2022-11-18 03:20:31 +01:00
draw_sprite_stretched_ext(THEME.group_label, 0, 0, yy, con_w, ui(32), COLORS.panel_inspector_group_bg, 1);
2022-11-01 03:06:03 +01:00
2022-12-10 05:06:01 +01:00
if(filter_text == "") {
draw_sprite_ui(THEME.arrow, 0, ui(16), yy + ui(32) / 2, 1, 1, -90 + coll * 90, COLORS.panel_inspector_group_bg, 1);
}
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
2022-11-03 11:44:49 +01:00
draw_text(ui(32), yy + ui(32) / 2, txt);
2022-11-01 03:06:03 +01:00
2022-11-03 11:44:49 +01:00
hh += ui(32 + 8);
2022-09-21 06:09:40 +02:00
if(coll) {
var j = i + 1;
while(j < amo) {
var j_jun = inspecting.input_display_list[j];
if(is_array(j_jun))
break;
else
j++;
}
i = j - 1;
continue;
2022-11-03 11:44:49 +01:00
}
continue;
2022-09-23 13:28:42 +02:00
} else if(is_struct(jun_disp) && instanceof(jun_disp) == "Inspector_Custom_Renderer") {
2022-11-14 03:16:15 +01:00
var hov = pHOVER;
var foc = pFOCUS;
2022-11-03 11:44:49 +01:00
jun_disp.draw(ui(6), yy, con_w - ui(12), _m, hov, foc);
hh += jun_disp.h + ui(20);
2022-09-21 06:09:40 +02:00
continue;
2022-01-13 05:24:03 +01:00
}
2022-09-21 06:09:40 +02:00
jun = inspecting.inputs[| inspecting.input_display_list[i]];
}
2022-12-10 05:06:01 +01:00
if(!is_struct(jun) || instanceof(jun) != "NodeValue") continue;
2022-09-27 06:37:28 +02:00
if(!jun.show_in_inspector || jun.type == VALUE_TYPE.object) continue;
2022-12-10 05:06:01 +01:00
if(filter_text != "") {
var pos = string_pos(filter_text, string_lower(jun.name));
if(pos == 0) continue;
}
2022-09-23 13:28:42 +02:00
2022-11-03 11:44:49 +01:00
var lb_h = line_height(f_p0) + ui(8);
var lb_y = yy + lb_h / 2;
var butx = ui(16);
2022-09-23 13:28:42 +02:00
var index = jun.value_from == noone? jun.animator.is_anim : 2;
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1,, 0.8);
2022-11-14 03:16:15 +01:00
if(pHOVER && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) {
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1,, 1);
2022-09-21 06:09:40 +02:00
TOOLTIP = "Toggle animation";
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_left, pFOCUS)) {
2022-09-21 06:09:40 +02:00
if(jun.value_from != noone)
jun.removeFrom();
else
2022-09-23 13:28:42 +02:00
jun.animator.is_anim = !jun.animator.is_anim;
2022-09-21 06:09:40 +02:00
PANEL_ANIMATION.updatePropertyList();
2022-01-13 05:24:03 +01:00
}
2022-09-21 06:09:40 +02:00
}
2022-09-23 13:28:42 +02:00
2022-11-03 11:44:49 +01:00
butx += ui(20);
2022-09-21 06:09:40 +02:00
index = jun.visible;
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.junc_visible, index, butx, lb_y, 1,, 0.8);
2022-11-14 03:16:15 +01:00
if(pHOVER && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) {
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.junc_visible, index, butx, lb_y, 1,, 1);
2022-09-21 06:09:40 +02:00
TOOLTIP = "Visibility";
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_left, pFOCUS))
2022-09-21 06:09:40 +02:00
jun.visible = !jun.visible;
}
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
2022-11-03 11:44:49 +01:00
draw_text(ui(56), lb_y - ui(2), jun.name);
var lb_w = string_width(jun.name) + ui(32);
2022-12-10 05:06:01 +01:00
2022-09-21 06:09:40 +02:00
#region anim
2022-09-23 13:28:42 +02:00
if(lineBreak && jun.animator.is_anim) {
2022-11-03 11:44:49 +01:00
var bx = w - ui(64);
var by = lb_y;
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, pFOCUS, pHOVER, "", THEME.prop_keyframe, 2) == 2) {
2022-09-23 13:28:42 +02:00
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
var _key = jun.animator.values[| j];
2022-09-21 06:09:40 +02:00
if(_key.time > ANIMATOR.current_frame) {
2022-12-10 05:06:01 +01:00
ANIMATOR.setFrame(_key.time);
ANIMATOR.frame_progress = true;
2022-01-13 05:24:03 +01:00
break;
}
}
2022-09-21 06:09:40 +02:00
}
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
bx -= ui(26);
2022-11-18 03:20:31 +01:00
var cc = COLORS.panel_animation_keyframe_unselected;
var kfFocus = false;
2022-09-23 13:28:42 +02:00
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
if(jun.animator.values[| j].time == ANIMATOR.current_frame) {
2022-11-18 03:20:31 +01:00
cc = COLORS.panel_animation_keyframe_selected;
kfFocus = true;
2022-09-21 06:09:40 +02:00
break;
}
}
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, pFOCUS, pHOVER, kfFocus? "Remove keyframe" : "Add keyframe", THEME.prop_keyframe, 1, cc) == 2) {
2022-09-21 06:09:40 +02:00
var _add = false;
2022-09-23 13:28:42 +02:00
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
var _key = jun.animator.values[| j];
2022-09-21 06:09:40 +02:00
if(_key.time == ANIMATOR.current_frame) {
2022-09-23 13:28:42 +02:00
if(ds_list_size(jun.animator.values) > 1)
ds_list_delete(jun.animator.values, j);
2022-09-21 06:09:40 +02:00
_add = true;
break;
} else if(_key.time > ANIMATOR.current_frame) {
2022-09-23 13:28:42 +02:00
ds_list_insert(jun.animator.values, j, new valueKey(ANIMATOR.current_frame, jun.getValue(), jun.animator));
2022-09-21 06:09:40 +02:00
_add = true;
break;
2022-01-13 05:24:03 +01:00
}
}
2022-09-23 13:28:42 +02:00
if(!_add) ds_list_add(jun.animator.values, new valueKey(ANIMATOR.current_frame, jun.getValue(), jun.animator));
2022-09-21 06:09:40 +02:00
}
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
bx -= ui(26);
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, pFOCUS, pHOVER, "", THEME.prop_keyframe, 0) == 2) {
2022-09-21 06:09:40 +02:00
var _t = -1;
2022-09-23 13:28:42 +02:00
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
var _key = jun.animator.values[| j];
2022-09-21 06:09:40 +02:00
if(_key.time < ANIMATOR.current_frame) {
_t = _key.time;
2022-01-13 05:24:03 +01:00
}
}
2022-12-10 05:06:01 +01:00
if(_t > -1) ANIMATOR.setFrame(_t);
ANIMATOR.frame_progress = true;
2022-09-21 06:09:40 +02:00
}
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
var lhf = lb_h / 2 - 4;
2022-11-18 03:20:31 +01:00
draw_set_color(COLORS.panel_inspector_key_separator);
2022-11-03 11:44:49 +01:00
draw_line(bx - ui(20), by - lhf, bx - ui(20), by + lhf);
2022-11-18 03:20:31 +01:00
draw_set_color(COLORS.panel_inspector_key_separator);
2022-11-03 11:44:49 +01:00
draw_line(bx - ui(20), by - lhf, bx - ui(20), by + lhf);
2022-11-18 03:20:31 +01:00
2022-11-03 11:44:49 +01:00
bx -= ui(26 + 12);
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, pFOCUS, pHOVER, "Looping mode " + ON_END_NAME[jun.on_end], THEME.prop_on_end, jun.on_end) == 2)
jun.on_end = safe_mod(jun.on_end + 1, sprite_get_number(THEME.prop_on_end));
2022-09-21 06:09:40 +02:00
}
#endregion
2022-11-03 11:44:49 +01:00
//TODO: Fix padding to be consistant to every widget
var _hsx = ui(32);
var _hsy = yy + lb_h;
var padd = ui(8);
var labelWidth = max(lb_w, min(ui(80) + w * 0.2, ui(200)));
var editBoxW = w - ui(80) - !lineBreak * labelWidth;
var editBoxH = lineBreak? TEXTBOX_HEIGHT : lb_h;
var editBoxX = ui(32) + !lineBreak * labelWidth;
var editBoxY = lineBreak? _hsy : yy;
var widH = lineBreak? editBoxH : 0;
2022-09-21 06:09:40 +02:00
if(jun.editWidget) {
2022-11-14 03:16:15 +01:00
jun.editWidget.active = pFOCUS;
jun.editWidget.hover = pHOVER;
2022-09-21 06:09:40 +02:00
switch(jun.display_type) {
case VALUE_DISPLAY.button :
2022-11-03 11:44:49 +01:00
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, _m);
2022-09-21 06:09:40 +02:00
break;
default :
switch(jun.type) {
case VALUE_TYPE.float :
case VALUE_TYPE.integer :
switch(jun.display_type) {
case VALUE_DISPLAY._default :
case VALUE_DISPLAY.range :
case VALUE_DISPLAY.vector :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_DISPLAY.vector_range :
2022-12-10 05:06:01 +01:00
var ebH = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
widH = lineBreak? ebH : ebH - lb_h;
2022-09-21 06:09:40 +02:00
break;
case VALUE_DISPLAY.enum_scroll :
2022-11-03 11:44:49 +01:00
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.display_data[jun.showValue()], _m, ui(16) + x, top_bar_h + y);
2022-09-21 06:09:40 +02:00
break;
2022-12-10 05:06:01 +01:00
case VALUE_DISPLAY.enum_button :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.display_data[jun.showValue()], _m, ui(16) + x, top_bar_h + y);
break;
2022-09-21 06:09:40 +02:00
case VALUE_DISPLAY.padding :
2022-11-03 11:44:49 +01:00
jun.editWidget.draw(xc, _hsy + ui(32), jun.showValue(), jun.modifier, _m);
widH = ui(192);
2022-09-21 06:09:40 +02:00
break;
case VALUE_DISPLAY.rotation :
case VALUE_DISPLAY.rotation_range :
jun.editWidget.draw(xc, _hsy, jun.showValue(), _m);
2022-11-03 11:44:49 +01:00
widH = ui(96);
2022-09-21 06:09:40 +02:00
break;
case VALUE_DISPLAY.slider :
case VALUE_DISPLAY.slider_range :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_DISPLAY.area :
2022-11-03 11:44:49 +01:00
jun.editWidget.draw(xc, _hsy + ui(40), jun.showValue(), _m);
widH = ui(204);
2022-09-21 06:09:40 +02:00
break;
case VALUE_DISPLAY.puppet_control :
2022-11-14 03:16:15 +01:00
widH = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, jun.showValue(), _m, ui(16) + x, top_bar_h + y);
2022-09-21 06:09:40 +02:00
break;
}
break;
case VALUE_TYPE.boolean :
editBoxX = lineBreak? editBoxX : (labelWidth + con_w) / 2;
2022-11-03 11:44:49 +01:00
jun.editWidget.draw(editBoxX, editBoxY, jun.showValue(), _m, editBoxH);
2022-09-21 06:09:40 +02:00
break;
case VALUE_TYPE.color :
switch(jun.display_type) {
case VALUE_DISPLAY.gradient :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), jun.extra_data, _m);
break;
default :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
}
break;
case VALUE_TYPE.path :
var val = jun.showValue(), txt = "";
var pathExist = jun.value_validation == VALIDATION.pass;
2022-09-21 06:09:40 +02:00
if(is_array(val))
txt = "[" + string(array_length(val)) + "] " + val[0];
else
txt = val;
2022-11-18 03:20:31 +01:00
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, _m,, pathExist? COLORS._main_text : COLORS._main_value_negative);
2022-11-03 11:44:49 +01:00
var icx = editBoxX + editBoxW - ui(16);
2022-09-21 06:09:40 +02:00
var icy = editBoxY + editBoxH / 2;
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(pathExist? THEME.button_path_icon : THEME.button_path_not_found_icon, 0, icx, icy, 1,, 1);
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
2022-11-03 11:44:49 +01:00
draw_text_cut(editBoxX + ui(8), editBoxY + editBoxH / 2, txt, editBoxW - ui(60));
2022-12-10 05:06:01 +01:00
if(!pathExist && pHOVER && point_in_rectangle(_m[0], _m[1], icx - ui(17), icy - ui(17), icx + ui(17), icy + ui(17)))
2022-09-21 06:09:40 +02:00
TOOLTIP = "File not exist";
break;
case VALUE_TYPE.surface :
2022-11-03 11:44:49 +01:00
editBoxH = ui(96);
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m, ui(16) + x, top_bar_h + y);
widH = lineBreak? editBoxH : editBoxH - lb_h;
2022-09-21 06:09:40 +02:00
break;
case VALUE_TYPE.curve :
2022-11-03 11:44:49 +01:00
editBoxH = ui(132);
jun.editWidget.draw(ui(32), _hsy, w - ui(80), editBoxH, jun.showValue(), _m);
widH = editBoxH;
2022-09-21 06:09:40 +02:00
break;
case VALUE_TYPE.text :
var _hh = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m, jun.display_type);
widH = _hh;
break;
}
2022-01-13 05:24:03 +01:00
}
2022-09-21 06:09:40 +02:00
} else if(jun.display_type == VALUE_DISPLAY.label) {
2022-11-18 03:20:31 +01:00
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
2022-11-03 11:44:49 +01:00
draw_text(ui(32), _hsy, jun.display_data);
2022-01-13 05:24:03 +01:00
2022-09-21 06:09:40 +02:00
widH = string_height(jun.display_data);
}
2022-11-03 11:44:49 +01:00
if(false) {
var __hsy = yy;
draw_set_alpha(0.5);
2022-11-18 03:20:31 +01:00
draw_set_color(c_aqua);
2022-11-03 11:44:49 +01:00
draw_rectangle(ui(8), __hsy, contentPane.w - ui(16), __hsy + lb_h, 0); __hsy += lb_h;
2022-11-18 03:20:31 +01:00
draw_set_color(c_red);
2022-11-03 11:44:49 +01:00
draw_rectangle(ui(8), __hsy, contentPane.w - ui(16), __hsy + widH, 0); __hsy += widH;
2022-11-18 03:20:31 +01:00
draw_set_color(c_lime);
2022-11-03 11:44:49 +01:00
draw_rectangle(ui(8), __hsy, contentPane.w - ui(16), __hsy + padd, 0);
draw_set_alpha(1);
}
hh += lb_h + widH + padd;
2022-09-21 06:09:40 +02:00
2022-11-14 03:16:15 +01:00
var _selY = yy - ui(0);
var _selY1 = yy + lb_h + widH + ui(2);
var _selH = _selY1 - _selY;
2022-09-21 06:09:40 +02:00
2022-11-14 03:16:15 +01:00
if(pHOVER && point_in_rectangle(_m[0], _m[1], 4, _selY, contentPane.surface_w - ui(4), _selY + _selH)) {
2022-11-21 06:38:44 +01:00
draw_sprite_stretched_ext(THEME.prop_selecting, 0, 4, _selY, contentPane.surface_w - ui(8), _selH, COLORS._main_accent, 1);
2022-09-21 06:09:40 +02:00
prop_hover = jun;
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_left, pFOCUS))
prop_selecting = jun;
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_right, pFOCUS)) {
__dialog_junction = jun;
var dia = dialogCall(o_dialog_menubox, mouse_mx, mouse_my);
dia.setMenu( [
[ "Reset value", function() {
__dialog_junction.setValue(__dialog_junction.def_val);
}],
[ __dialog_junction.animator.is_anim? "Remove animation" : "Add animation", function() {
__dialog_junction.animator.is_anim = !__dialog_junction.animator.is_anim;
PANEL_ANIMATION.updatePropertyList();
}],
-1,
[ "Copy", function() {
clipboard_set_text(__dialog_junction.getShowString());
}, ["Inspector", "Copy property"]],
[ "Paste", function() {
__dialog_junction.setString(clipboard_get_text());
}, ["Inspector", "Paste property"]],
] );
2022-01-13 05:24:03 +01:00
}
}
}
return hh;
});
function propSelectCopy() {
if(!prop_selecting) return;
clipboard_set_text(prop_selecting.getShowString());
}
function propSelectPaste() {
if(!prop_selecting) return;
prop_selecting.setString(clipboard_get_text());
}
function drawInspectingNode() {
tb_node_name.font = f_h5;
tb_node_name.hide = true;
2022-11-14 03:16:15 +01:00
tb_node_name.active = pFOCUS;
tb_node_name.hover = pHOVER;
2022-01-13 05:24:03 +01:00
tb_node_name.align = fa_center;
2022-11-03 11:44:49 +01:00
tb_node_name.draw(ui(64), ui(14), w - ui(128), ui(32), inspecting.name, [mx, my]);
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
tb_prop_filter.auto_update = true;
tb_prop_filter.font = f_p0;
tb_prop_filter.color = COLORS._main_text_sub;
tb_prop_filter.active = pFOCUS;
tb_prop_filter.hover = pHOVER;
tb_prop_filter.align = fa_center;
tb_prop_filter.draw(ui(64), ui(52), w - ui(128), ui(28), filter_text, [mx, my]);
draw_sprite_ui(THEME.search, 0, ui(80), ui(52 + 14), 1, 1, 0, COLORS._main_icon, 1);
var bx = ui(8);
var by = ui(12);
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, "Presets", THEME.preset, 1) == 2)
dialogCall(o_dialog_preset, x + bx, y + by + ui(36), { "node": inspecting });
2022-01-13 05:24:03 +01:00
if(!inspecting.auto_update) {
2022-11-03 11:44:49 +01:00
var bx = w - ui(44);
var by = ui(12);
2022-01-13 05:24:03 +01:00
2022-12-10 05:06:01 +01:00
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, "Execute node", THEME.sequence_control, 1) == 2)
2022-01-13 05:24:03 +01:00
inspecting.doUpdate();
}
if(inspecting.use_cache) {
2022-12-10 05:06:01 +01:00
var bx = w - ui(44);
var by = ui(12 + 36);
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, "This node cache output for performance.\nClick to clear all cached frames in this node.", THEME.cache) = 2)
2022-01-13 05:24:03 +01:00
inspecting.clearCache();
}
}
2022-11-14 03:16:15 +01:00
function drawContent(panel) {
2022-11-18 03:20:31 +01:00
draw_clear_alpha(COLORS.panel_bg_clear, 0);
2022-09-21 06:09:40 +02:00
lineBreak = w < PREF_MAP[? "inspector_line_break_width"];
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), top_bar_h - ui(8), w - ui(16), h - top_bar_h);
2022-01-13 05:24:03 +01:00
if(inspecting)
drawInspectingNode();
2022-11-14 03:16:15 +01:00
contentPane.active = pHOVER;
2022-11-03 11:44:49 +01:00
contentPane.draw(ui(16), top_bar_h, mx - ui(16), my - top_bar_h);
2022-01-13 05:24:03 +01:00
if(PANEL_GRAPH.node_focus && inspecting != PANEL_GRAPH.node_focus) {
inspecting = PANEL_GRAPH.node_focus;
2022-09-23 13:28:42 +02:00
if(inspecting != noone)
inspecting.onInspect();
2022-01-13 05:24:03 +01:00
contentPane.scroll_y = 0;
contentPane.scroll_y_to = 0;
}
}
}