local assign_layers = require("druid.editor_scripts.assign_layers") local create_druid_widget = require("druid.editor_scripts.create_druid_widget") local druid_settings = require("druid.editor_scripts.druid_settings") local M = {} local DEFAULT_WIDGET_TEMPLATE_PATH = "/druid/templates/widget_full.lua.template" ---Define preferences schema function M.get_prefs_schema() return { ["druid.widget_template_path"] = editor.prefs.schema.string({ default = DEFAULT_WIDGET_TEMPLATE_PATH, scope = editor.prefs.SCOPE.PROJECT }) } end ---Define the editor commands function M.get_commands() return { { label = "[Druid] Assign Layers", locations = { "Edit" }, query = { selection = {type = "resource", cardinality = "one"} }, active = function(opts) local path = editor.get(opts.selection, "path") return path:match("%.gui$") ~= nil end, run = function(opts) return assign_layers.assign_layers(opts.selection) end }, { label = "[Druid] Create Druid Widget", locations = { "Edit", "Assets" }, query = { selection = {type = "resource", cardinality = "one"} }, active = function(opts) local path = editor.get(opts.selection, "path") return path:match("%.gui$") ~= nil end, run = function(opts) return create_druid_widget.create_druid_widget(opts.selection) end }, { label = "[Druid] Settings", locations = { "Edit" }, run = function() return druid_settings.open_settings() end } } end return M