Merge branch 'develop' into core

This commit is contained in:
Insality
2025-10-27 22:25:45 +02:00
17 changed files with 388 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ local event = require("event.event")
local events = require("event.events") local events = require("event.events")
local settings = require("druid.system.settings") local settings = require("druid.system.settings")
local druid_instance = require("druid.system.druid_instance") local druid_instance = require("druid.system.druid_instance")
local logger = require("druid.system.druid_logger")
local default_style = require("druid.styles.default.style") local default_style = require("druid.styles.default.style")
@@ -193,4 +194,25 @@ function M.unregister_druid_as_widget()
end end
---@param logger_instance druid.logger|table|nil
function M.set_logger(logger_instance)
logger.set_logger(logger_instance)
end
---@param name string?
---@param level string|nil
---@return druid.logger
function M.get_logger(name, level)
if not name then
local current_script_path = debug.getinfo(3).short_src
local basename = string.match(current_script_path, "([^/\\]+)$")
basename = string.match(basename, "(.*)%..*$")
name = basename
end
return setmetatable({ name = name, level = level }, { __index = logger })
end
return M return M

View File

@@ -366,7 +366,8 @@ end
---Check if device is desktop ---Check if device is desktop
---@return boolean ---@return boolean
function M.is_desktop() function M.is_desktop()
return const.CURRENT_SYSTEM_NAME == const.OS.WINDOWS or const.CURRENT_SYSTEM_NAME == const.OS.MAC or const.CURRENT_SYSTEM_NAME == const.OS.LINUX local name = const.CURRENT_SYSTEM_NAME
return name == const.OS.WINDOWS or name == const.OS.MAC or name == const.OS.LINUX
end end
@@ -403,24 +404,44 @@ function M.is_multitouch_supported()
end end
---Simple table to one-line string converter ---Converts table to one-line string
---@param t table ---@param t table
---@return string ---@param depth number?
function M.table_to_string(t) ---@param result string|nil Internal parameter
if not t then ---@return string, boolean result String representation of table, Is max string length reached
return "" function M.table_to_string(t, depth, result)
if type(t) ~= "table" then
return tostring(t) or "", false
end end
local result = "{" depth = depth or 0
result = result or "{"
for key, value in pairs(t) do for key, value in pairs(t) do
if #result > 1 then if #result > 1 then
result = result .. "," result = result .. ", "
end
if type(value) == "table" then
if depth == 0 then
local table_len = 0
for _ in pairs(value) do
table_len = table_len + 1
end
result = result .. key .. ": {... #" .. table_len .. "}"
else
local convert_result, is_limit = M.table_to_string(value, depth - 1, "")
result = result .. key .. ": {" .. convert_result
if is_limit then
break
end
end
else
result = result .. key .. ": " .. tostring(value)
end end
result = result .. key .. ": " .. value
end end
return result .. "}" return result .. "}", false
end end

View File

@@ -0,0 +1,39 @@
local helper = require("druid.helper")
---@class druid.logger
---@field trace fun(_, msg: string, data: any)
---@field debug fun(_, msg: string, data: any)
---@field info fun(_, msg: string, data: any)
---@field warn fun(_, msg: string, data: any)
---@field error fun(_, msg: string, data: any)
local M = {}
local EMPTY_FUNCTION = function(_, message, context) end
---@type druid.logger
local empty_logger = {
trace = EMPTY_FUNCTION,
debug = EMPTY_FUNCTION,
info = EMPTY_FUNCTION,
warn = EMPTY_FUNCTION,
error = EMPTY_FUNCTION,
}
---@type druid.logger
local default_logger = {
trace = function(_, msg, data) print("TRACE: " .. msg, helper.table_to_string(data)) end,
debug = function(_, msg, data) print("DEBUG: " .. msg, helper.table_to_string(data)) end,
info = function(_, msg, data) print("INFO: " .. msg, helper.table_to_string(data)) end,
warn = function(_, msg, data) print("WARN: " .. msg, helper.table_to_string(data)) end,
error = function(_, msg, data) print("ERROR: " .. msg, helper.table_to_string(data)) end
}
local METATABLE = { __index = default_logger }
---@param logger druid.logger|table|nil
function M.set_logger(logger)
METATABLE.__index = logger or empty_logger
end
return setmetatable(M, METATABLE)

View File

@@ -15,6 +15,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -52,6 +53,7 @@ nodes {
} }
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -89,6 +91,7 @@ nodes {
texture: "druid/rect_round2_width2" texture: "druid/rect_round2_width2"
id: "button" id: "button"
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 5.0 x: 5.0
@@ -116,6 +119,7 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "button" parent: "button"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
nodes { nodes {
@@ -147,9 +151,16 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "button" parent: "button"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -15,6 +15,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -27,7 +28,7 @@ nodes {
y: 0.5 y: 0.5
} }
size { size {
x: 360.0 x: 700.0
y: 40.0 y: 40.0
} }
color { color {
@@ -51,6 +52,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -60,7 +62,7 @@ nodes {
x: 200.0 x: 200.0
} }
size { size {
x: 200.0 x: 40.0
y: 40.0 y: 40.0
} }
type: TYPE_BOX type: TYPE_BOX
@@ -73,7 +75,7 @@ nodes {
} }
nodes { nodes {
position { position {
x: -180.0 x: -20.0
} }
size { size {
x: 40.0 x: 40.0
@@ -88,6 +90,7 @@ nodes {
texture: "druid/rect_round2_width2" texture: "druid/rect_round2_width2"
id: "button" id: "button"
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 5.0 x: 5.0
@@ -106,6 +109,7 @@ nodes {
texture: "druid/ui_circle_16" texture: "druid/ui_circle_16"
id: "icon" id: "icon"
parent: "button" parent: "button"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
} }
@@ -128,7 +132,14 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "button" parent: "button"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -77,6 +77,7 @@ end
---@param enabled boolean ---@param enabled boolean
function M:set_enabled(enabled) function M:set_enabled(enabled)
self.button:set_enabled(enabled) self.button:set_enabled(enabled)
gui.set_alpha(self.button.node, enabled and 1 or 0.75)
end end

View File

@@ -15,6 +15,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -51,6 +52,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -137,7 +139,14 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -15,6 +15,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -51,6 +52,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -88,6 +90,7 @@ nodes {
texture: "druid/rect_round2_width2" texture: "druid/rect_round2_width2"
id: "button_left" id: "button_left"
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 5.0 x: 5.0
@@ -109,6 +112,7 @@ nodes {
texture: "druid/icon_arrow" texture: "druid/icon_arrow"
id: "icon_left" id: "icon_left"
parent: "button_left" parent: "button_left"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
} }
@@ -129,6 +133,7 @@ nodes {
texture: "druid/rect_round2_width2" texture: "druid/rect_round2_width2"
id: "button_right" id: "button_right"
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 5.0 x: 5.0
@@ -147,6 +152,7 @@ nodes {
texture: "druid/icon_arrow" texture: "druid/icon_arrow"
id: "icon_right" id: "icon_right"
parent: "button_right" parent: "button_right"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
} }
@@ -170,6 +176,7 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
nodes { nodes {
@@ -204,9 +211,16 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -15,6 +15,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -51,6 +52,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -89,6 +91,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "slider" id: "slider"
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
nodes { nodes {
@@ -105,6 +108,7 @@ nodes {
texture: "druid/ui_circle_8" texture: "druid/ui_circle_8"
id: "slider_back" id: "slider_back"
parent: "slider" parent: "slider"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 4.0 x: 4.0
@@ -130,6 +134,7 @@ nodes {
texture: "druid/ui_circle_8" texture: "druid/ui_circle_8"
id: "slider_pin" id: "slider_pin"
parent: "slider" parent: "slider"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 4.0 x: 4.0
@@ -153,6 +158,7 @@ nodes {
id: "button" id: "button"
pivot: PIVOT_E pivot: PIVOT_E
parent: "E_Anchor" parent: "E_Anchor"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 4.0 x: 4.0
@@ -180,6 +186,7 @@ nodes {
pivot: PIVOT_SE pivot: PIVOT_SE
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "button" parent: "button"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
nodes { nodes {
@@ -214,9 +221,16 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "button" parent: "button"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -15,6 +15,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -51,6 +52,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -88,9 +90,16 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -19,6 +19,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "root" id: "root"
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
layer: "druid"
inherit_alpha: true inherit_alpha: true
visible: false visible: false
} }
@@ -55,6 +56,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "root" parent: "root"
layer: "druid_text_bold"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -113,6 +115,7 @@ nodes {
font: "druid_text_regular" font: "druid_text_regular"
id: "text_x" id: "text_x"
parent: "field_x" parent: "field_x"
layer: "druid_text_regular"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -167,7 +170,7 @@ nodes {
y: 50.0 y: 50.0
} }
type: TYPE_TEXT type: TYPE_TEXT
text: "20.0" text: "20"
id: "rich_input_x/input_text" id: "rich_input_x/input_text"
parent: "rich_input_x/root" parent: "rich_input_x/root"
overridden_fields: 4 overridden_fields: 4
@@ -210,6 +213,7 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "field_x" parent: "field_x"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
nodes { nodes {
@@ -250,6 +254,7 @@ nodes {
font: "druid_text_regular" font: "druid_text_regular"
id: "text_y" id: "text_y"
parent: "field_y" parent: "field_y"
layer: "druid_text_regular"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -304,7 +309,7 @@ nodes {
y: 50.0 y: 50.0
} }
type: TYPE_TEXT type: TYPE_TEXT
text: "20.0" text: "20"
id: "rich_input_y/input_text" id: "rich_input_y/input_text"
parent: "rich_input_y/root" parent: "rich_input_y/root"
overridden_fields: 4 overridden_fields: 4
@@ -347,6 +352,7 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "field_y" parent: "field_y"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
nodes { nodes {
@@ -387,6 +393,7 @@ nodes {
font: "druid_text_regular" font: "druid_text_regular"
id: "text_z" id: "text_z"
parent: "field_z" parent: "field_z"
layer: "druid_text_regular"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -441,7 +448,7 @@ nodes {
y: 50.0 y: 50.0
} }
type: TYPE_TEXT type: TYPE_TEXT
text: "20.0" text: "20"
id: "rich_input_z/input_text" id: "rich_input_z/input_text"
parent: "rich_input_z/root" parent: "rich_input_z/root"
overridden_fields: 4 overridden_fields: 4
@@ -484,7 +491,17 @@ nodes {
pivot: PIVOT_S pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "field_z" parent: "field_z"
layer: "druid"
inherit_alpha: true inherit_alpha: true
} }
layers {
name: "druid"
}
layers {
name: "druid_text_bold"
}
layers {
name: "druid_text_regular"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -24,6 +24,7 @@ nodes {
texture: "druid/ui_circle_16" texture: "druid/ui_circle_16"
id: "root" id: "root"
pivot: PIVOT_N pivot: PIVOT_N
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 8.0 x: 8.0
@@ -50,6 +51,7 @@ nodes {
id: "header" id: "header"
pivot: PIVOT_NE pivot: PIVOT_NE
parent: "root" parent: "root"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 8.0 x: 8.0
@@ -92,6 +94,7 @@ nodes {
z: 1.0 z: 1.0
} }
parent: "header" parent: "header"
layer: "druid_text_regular"
inherit_alpha: true inherit_alpha: true
outline_alpha: 0.0 outline_alpha: 0.0
shadow_alpha: 0.0 shadow_alpha: 0.0
@@ -111,6 +114,7 @@ nodes {
id: "icon_drag" id: "icon_drag"
pivot: PIVOT_NE pivot: PIVOT_NE
parent: "header" parent: "header"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
} }
@@ -129,6 +133,7 @@ nodes {
id: "icon_refresh" id: "icon_refresh"
pivot: PIVOT_NE pivot: PIVOT_NE
parent: "header" parent: "header"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
} }
@@ -150,6 +155,7 @@ nodes {
id: "icon_back" id: "icon_back"
pivot: PIVOT_NW pivot: PIVOT_NW
parent: "header" parent: "header"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
} }
@@ -184,8 +190,8 @@ nodes {
pivot: PIVOT_NW pivot: PIVOT_NW
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "content" parent: "content"
layer: "druid"
inherit_alpha: true inherit_alpha: true
clipping_mode: CLIPPING_MODE_STENCIL
} }
nodes { nodes {
size { size {
@@ -198,6 +204,7 @@ nodes {
pivot: PIVOT_NW pivot: PIVOT_NW
adjust_mode: ADJUST_MODE_STRETCH adjust_mode: ADJUST_MODE_STRETCH
parent: "scroll_view" parent: "scroll_view"
layer: "druid"
inherit_alpha: true inherit_alpha: true
slice9 { slice9 {
x: 8.0 x: 8.0
@@ -214,6 +221,7 @@ nodes {
texture: "druid/empty" texture: "druid/empty"
id: "propeties" id: "propeties"
parent: "content" parent: "content"
layer: "druid"
inherit_alpha: true inherit_alpha: true
size_mode: SIZE_MODE_AUTO size_mode: SIZE_MODE_AUTO
visible: false visible: false
@@ -747,5 +755,89 @@ nodes {
parent: "property_vector3/field_z" parent: "property_vector3/field_z"
template_node_child: true template_node_child: true
} }
nodes {
position {
y: -100.0
}
type: TYPE_TEMPLATE
id: "property_button_small"
parent: "propeties"
inherit_alpha: true
template: "/druid/widget/properties_panel/properties/property_button.gui"
enabled: false
}
nodes {
type: TYPE_BOX
id: "property_button_small/root"
parent: "property_button_small"
template_node_child: true
}
nodes {
size {
x: 700.0
y: 40.0
}
type: TYPE_TEXT
id: "property_button_small/text_name"
parent: "property_button_small/root"
overridden_fields: 4
template_node_child: true
}
nodes {
size {
x: 40.0
y: 40.0
}
type: TYPE_BOX
id: "property_button_small/E_Anchor"
parent: "property_button_small/root"
overridden_fields: 4
template_node_child: true
}
nodes {
position {
x: -20.0
}
size {
x: 40.0
y: 40.0
}
type: TYPE_BOX
id: "property_button_small/button"
parent: "property_button_small/E_Anchor"
overridden_fields: 1
overridden_fields: 4
template_node_child: true
}
nodes {
size {
x: 40.0
y: 4.0
}
type: TYPE_BOX
id: "property_button_small/selected"
parent: "property_button_small/button"
overridden_fields: 4
template_node_child: true
}
nodes {
size {
x: 40.0
y: 50.0
}
type: TYPE_TEXT
text: ">"
id: "property_button_small/text_button"
parent: "property_button_small/button"
overridden_fields: 4
overridden_fields: 8
template_node_child: true
}
layers {
name: "druid"
}
layers {
name: "druid_text_regular"
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -88,6 +88,7 @@ function M:init()
gui.set_enabled(self:get_node("property_checkbox/root"), false) gui.set_enabled(self:get_node("property_checkbox/root"), false)
gui.set_enabled(self:get_node("property_slider/root"), false) gui.set_enabled(self:get_node("property_slider/root"), false)
gui.set_enabled(self:get_node("property_button/root"), false) gui.set_enabled(self:get_node("property_button/root"), false)
gui.set_enabled(self:get_node("property_button_small/root"), false)
gui.set_enabled(self:get_node("property_input/root"), false) gui.set_enabled(self:get_node("property_input/root"), false)
gui.set_enabled(self:get_node("property_text/root"), false) gui.set_enabled(self:get_node("property_text/root"), false)
gui.set_enabled(self:get_node("property_left_right_selector/root"), false) gui.set_enabled(self:get_node("property_left_right_selector/root"), false)
@@ -254,6 +255,12 @@ function M:add_button(on_create)
return self:add_inner_widget(property_button, "property_button", "root", on_create) return self:add_inner_widget(property_button, "property_button", "root", on_create)
end end
---@param on_create fun(button: druid.widget.property_button)|nil
---@return druid.widget.properties_panel
function M:add_button_small(on_create)
return self:add_inner_widget(property_button, "property_button_small", "root", on_create)
end
---@param on_create fun(input: druid.widget.property_input)|nil ---@param on_create fun(input: druid.widget.property_input)|nil
---@return druid.widget.properties_panel ---@return druid.widget.properties_panel
@@ -378,6 +385,7 @@ function M:set_hidden(is_hidden)
gui.set_enabled(self.text_header.node, not self._is_hidden) gui.set_enabled(self.text_header.node, not self._is_hidden)
gui.set_enabled(self.content, not self._is_hidden) gui.set_enabled(self.content, not self._is_hidden)
gui.set_enabled(self.button_refresh.node, not self._is_hidden) gui.set_enabled(self.button_refresh.node, not self._is_hidden)
gui.set_visible(self.button_back.node, not self._is_hidden)
if not self._is_hidden then if not self._is_hidden then
self.is_dirty = true self.is_dirty = true

View File

@@ -4621,6 +4621,48 @@ nodes {
parent: "properties_panel/property_vector3/field_z" parent: "properties_panel/property_vector3/field_z"
template_node_child: true template_node_child: true
} }
nodes {
type: TYPE_TEMPLATE
id: "properties_panel/property_button_small"
parent: "properties_panel/propeties"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/root"
parent: "properties_panel/property_button_small"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "properties_panel/property_button_small/text_name"
parent: "properties_panel/property_button_small/root"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/E_Anchor"
parent: "properties_panel/property_button_small/root"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/button"
parent: "properties_panel/property_button_small/E_Anchor"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/selected"
parent: "properties_panel/property_button_small/button"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "properties_panel/property_button_small/text_button"
parent: "properties_panel/property_button_small/button"
template_node_child: true
}
nodes { nodes {
type: TYPE_TEMPLATE type: TYPE_TEMPLATE
id: "memory_panel" id: "memory_panel"

View File

@@ -40,6 +40,18 @@ nodes {
parent: "properties_panel/header" parent: "properties_panel/header"
template_node_child: true template_node_child: true
} }
nodes {
type: TYPE_BOX
id: "properties_panel/icon_refresh"
parent: "properties_panel/header"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/icon_back"
parent: "properties_panel/header"
template_node_child: true
}
nodes { nodes {
type: TYPE_BOX type: TYPE_BOX
id: "properties_panel/content" id: "properties_panel/content"
@@ -568,5 +580,47 @@ nodes {
parent: "properties_panel/property_vector3/field_z" parent: "properties_panel/property_vector3/field_z"
template_node_child: true template_node_child: true
} }
nodes {
type: TYPE_TEMPLATE
id: "properties_panel/property_button_small"
parent: "properties_panel/propeties"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/root"
parent: "properties_panel/property_button_small"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "properties_panel/property_button_small/text_name"
parent: "properties_panel/property_button_small/root"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/E_Anchor"
parent: "properties_panel/property_button_small/root"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/button"
parent: "properties_panel/property_button_small/E_Anchor"
template_node_child: true
}
nodes {
type: TYPE_BOX
id: "properties_panel/property_button_small/selected"
parent: "properties_panel/property_button_small/button"
template_node_child: true
}
nodes {
type: TYPE_TEXT
id: "properties_panel/property_button_small/text_button"
parent: "properties_panel/property_button_small/button"
template_node_child: true
}
material: "/builtins/materials/gui.material" material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -23,7 +23,7 @@ dependencies#1 = https://github.com/Insality/defold-saver/archive/refs/tags/5.zi
dependencies#2 = https://github.com/Insality/defold-tweener/archive/refs/tags/3.zip dependencies#2 = https://github.com/Insality/defold-tweener/archive/refs/tags/3.zip
dependencies#3 = https://github.com/Insality/panthera/archive/refs/tags/runtime.4.zip dependencies#3 = https://github.com/Insality/panthera/archive/refs/tags/runtime.4.zip
dependencies#4 = https://github.com/Insality/defold-lang/archive/refs/tags/3.zip dependencies#4 = https://github.com/Insality/defold-lang/archive/refs/tags/3.zip
dependencies#5 = https://github.com/Insality/defold-event/archive/refs/tags/12.zip dependencies#5 = https://github.com/Insality/defold-event/archive/refs/tags/13.zip
dependencies#6 = https://github.com/subsoap/defos/archive/refs/tags/v2.8.0.zip dependencies#6 = https://github.com/subsoap/defos/archive/refs/tags/v2.8.0.zip
[library] [library]

View File

@@ -727,14 +727,16 @@ Please support me if you like this project! It will help me keep engaged to upda
- Create with `druid:new_image(node_or_node_id)` - Create with `druid:new_image(node_or_node_id)`
- Currently used to load image from resource path, absolute path or URL - Currently used to load image from resource path, absolute path or URL
- Can be fit inside (keeping aspect ratio) stretched to the node area, depends on the GUI adjust mode - Can be fit inside (keeping aspect ratio) stretched to the node area, depends on the GUI adjust mode
- [Blocker] Fix for internal is_enabled state - [Blocker] Fix for internal `is_enabled` state
- [Button] expose all click functions for the button - [Button] Expose all click functions for the button
- [Scroll] Add `scroll_to_make_node_visible` function - [Scroll] Add `scroll_to_make_node_visible` function
- [Palette] Add Druid Color module - [Palette] Add Druid Color module
- Use `local color = require("druid.color")` to access the module
- Manage color palettes - Manage color palettes
- Color convertations - Color conversions
- Convenient usage - Convenient usage
- [Container] Fix for container stretch mode (stretch and fit is not worked in init function) - [Container] Fix for container stretch mode
- `stretch` and `fit` was not init correctly in the `init` function arguments
- [Rich Text] Using color names from the palette - [Rich Text] Using color names from the palette
- [Rich Text] Add `rich_text:set_split_to_characters(true)` to split each letter node separately - [Rich Text] Add `rich_text:set_split_to_characters(true)` to split each letter node separately
- Weird implementation, but nice to have - Weird implementation, but nice to have