Pixel-Composer/scripts/addonPanel/addonPanel.gml

45 lines
1.2 KiB
Plaintext
Raw Normal View History

2023-05-03 21:42:17 +02:00
global.ADDON_WIDGET = ds_map_create();
global.ADDON_ID = ds_map_create();
2023-05-07 20:55:13 +02:00
function addonPanel(_addon, pane) : PanelContent() constructor {
2023-05-03 21:42:17 +02:00
ID = UUID_generate();
self._addon = _addon;
2023-05-07 20:55:13 +02:00
self.pane = pane;
drawFn = struct_has(pane, "drawFn")? pane.drawFn : "";
drawUIFn = struct_has(pane, "drawUIFn")? pane.drawUIFn : "";
closeFn = struct_has(pane, "closeFn")? pane.closeFn : "";
2023-05-03 21:42:17 +02:00
title = filename_name_only(_addon.directory);
__addon_lua_panel_variable(_addon.thread, self);
2023-04-22 16:23:51 +02:00
showHeader = true;
2023-05-03 21:42:17 +02:00
w = pane.w;
h = pane.h;
2023-04-23 16:47:33 +02:00
2023-04-22 16:23:51 +02:00
function drawGUI() {
2023-05-07 20:55:13 +02:00
if(drawUIFn == "") return;
2023-05-03 21:42:17 +02:00
if(!_addon.ready) return;
lua_add_code(_addon.thread, "panelID = '" + string(ID) + "'");
2023-05-07 20:55:13 +02:00
var runResult = lua_call(_addon.thread, drawUIFn);
2023-04-22 16:23:51 +02:00
}
function onResize() {
}
function drawContent(panel) {
2023-05-07 20:55:13 +02:00
if(drawFn == "") return;
2023-05-03 21:42:17 +02:00
if(!_addon.ready) return;
lua_add_code(_addon.thread, "panelID = '" + string(ID) + "'");
__addon_lua_panel_variable(_addon.thread, self);
2023-05-07 20:55:13 +02:00
var runResult = lua_call(_addon.thread, drawFn);
2023-04-22 16:23:51 +02:00
}
static onClose = function() {
2023-05-07 20:55:13 +02:00
if(closeFn == "") return;
if(!_addon.ready) return;
var runResult = lua_call(_addon.thread, closeFn);
2023-04-22 16:23:51 +02:00
}
}