mirror of
https://github.com/Insality/druid
synced 2025-11-26 19:00:52 +01:00
Merge branch 'develop' into core
This commit is contained in:
@@ -2,6 +2,7 @@ local event = require("event.event")
|
||||
local events = require("event.events")
|
||||
local settings = require("druid.system.settings")
|
||||
local druid_instance = require("druid.system.druid_instance")
|
||||
local logger = require("druid.system.druid_logger")
|
||||
|
||||
local default_style = require("druid.styles.default.style")
|
||||
|
||||
@@ -193,4 +194,25 @@ function M.unregister_druid_as_widget()
|
||||
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
|
||||
|
||||
@@ -366,7 +366,8 @@ end
|
||||
---Check if device is desktop
|
||||
---@return boolean
|
||||
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
|
||||
|
||||
|
||||
@@ -403,24 +404,44 @@ function M.is_multitouch_supported()
|
||||
end
|
||||
|
||||
|
||||
---Simple table to one-line string converter
|
||||
---Converts table to one-line string
|
||||
---@param t table
|
||||
---@return string
|
||||
function M.table_to_string(t)
|
||||
if not t then
|
||||
return ""
|
||||
---@param depth number?
|
||||
---@param result string|nil Internal parameter
|
||||
---@return string, boolean result String representation of table, Is max string length reached
|
||||
function M.table_to_string(t, depth, result)
|
||||
if type(t) ~= "table" then
|
||||
return tostring(t) or "", false
|
||||
end
|
||||
|
||||
local result = "{"
|
||||
depth = depth or 0
|
||||
result = result or "{"
|
||||
|
||||
for key, value in pairs(t) do
|
||||
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
|
||||
result = result .. key .. ": " .. value
|
||||
end
|
||||
|
||||
return result .. "}"
|
||||
return result .. "}", false
|
||||
end
|
||||
|
||||
|
||||
|
||||
39
druid/system/druid_logger.lua
Normal file
39
druid/system/druid_logger.lua
Normal 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)
|
||||
@@ -15,6 +15,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -52,6 +53,7 @@ nodes {
|
||||
}
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -89,6 +91,7 @@ nodes {
|
||||
texture: "druid/rect_round2_width2"
|
||||
id: "button"
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 5.0
|
||||
@@ -116,6 +119,7 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "button"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
@@ -147,9 +151,16 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "button"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -15,6 +15,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -27,7 +28,7 @@ nodes {
|
||||
y: 0.5
|
||||
}
|
||||
size {
|
||||
x: 360.0
|
||||
x: 700.0
|
||||
y: 40.0
|
||||
}
|
||||
color {
|
||||
@@ -51,6 +52,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -60,7 +62,7 @@ nodes {
|
||||
x: 200.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
x: 40.0
|
||||
y: 40.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
@@ -73,7 +75,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -180.0
|
||||
x: -20.0
|
||||
}
|
||||
size {
|
||||
x: 40.0
|
||||
@@ -88,6 +90,7 @@ nodes {
|
||||
texture: "druid/rect_round2_width2"
|
||||
id: "button"
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 5.0
|
||||
@@ -106,6 +109,7 @@ nodes {
|
||||
texture: "druid/ui_circle_16"
|
||||
id: "icon"
|
||||
parent: "button"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
@@ -128,7 +132,14 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "button"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -77,6 +77,7 @@ end
|
||||
---@param enabled boolean
|
||||
function M:set_enabled(enabled)
|
||||
self.button:set_enabled(enabled)
|
||||
gui.set_alpha(self.button.node, enabled and 1 or 0.75)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -51,6 +52,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -137,7 +139,14 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -15,6 +15,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -51,6 +52,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -88,6 +90,7 @@ nodes {
|
||||
texture: "druid/rect_round2_width2"
|
||||
id: "button_left"
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 5.0
|
||||
@@ -109,6 +112,7 @@ nodes {
|
||||
texture: "druid/icon_arrow"
|
||||
id: "icon_left"
|
||||
parent: "button_left"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
@@ -129,6 +133,7 @@ nodes {
|
||||
texture: "druid/rect_round2_width2"
|
||||
id: "button_right"
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 5.0
|
||||
@@ -147,6 +152,7 @@ nodes {
|
||||
texture: "druid/icon_arrow"
|
||||
id: "icon_right"
|
||||
parent: "button_right"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
@@ -170,6 +176,7 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
@@ -204,9 +211,16 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "E_Anchor"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -15,6 +15,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -51,6 +52,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -89,6 +91,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "slider"
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
@@ -105,6 +108,7 @@ nodes {
|
||||
texture: "druid/ui_circle_8"
|
||||
id: "slider_back"
|
||||
parent: "slider"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 4.0
|
||||
@@ -130,6 +134,7 @@ nodes {
|
||||
texture: "druid/ui_circle_8"
|
||||
id: "slider_pin"
|
||||
parent: "slider"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 4.0
|
||||
@@ -153,6 +158,7 @@ nodes {
|
||||
id: "button"
|
||||
pivot: PIVOT_E
|
||||
parent: "E_Anchor"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 4.0
|
||||
@@ -180,6 +186,7 @@ nodes {
|
||||
pivot: PIVOT_SE
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "button"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
@@ -214,9 +221,16 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "button"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -15,6 +15,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -51,6 +52,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -88,9 +90,16 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -19,6 +19,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "root"
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
visible: false
|
||||
}
|
||||
@@ -55,6 +56,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "root"
|
||||
layer: "druid_text_bold"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -113,6 +115,7 @@ nodes {
|
||||
font: "druid_text_regular"
|
||||
id: "text_x"
|
||||
parent: "field_x"
|
||||
layer: "druid_text_regular"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -167,7 +170,7 @@ nodes {
|
||||
y: 50.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "20.0"
|
||||
text: "20"
|
||||
id: "rich_input_x/input_text"
|
||||
parent: "rich_input_x/root"
|
||||
overridden_fields: 4
|
||||
@@ -210,6 +213,7 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "field_x"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
@@ -250,6 +254,7 @@ nodes {
|
||||
font: "druid_text_regular"
|
||||
id: "text_y"
|
||||
parent: "field_y"
|
||||
layer: "druid_text_regular"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -304,7 +309,7 @@ nodes {
|
||||
y: 50.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "20.0"
|
||||
text: "20"
|
||||
id: "rich_input_y/input_text"
|
||||
parent: "rich_input_y/root"
|
||||
overridden_fields: 4
|
||||
@@ -347,6 +352,7 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "field_y"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
nodes {
|
||||
@@ -387,6 +393,7 @@ nodes {
|
||||
font: "druid_text_regular"
|
||||
id: "text_z"
|
||||
parent: "field_z"
|
||||
layer: "druid_text_regular"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -441,7 +448,7 @@ nodes {
|
||||
y: 50.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
text: "20.0"
|
||||
text: "20"
|
||||
id: "rich_input_z/input_text"
|
||||
parent: "rich_input_z/root"
|
||||
overridden_fields: 4
|
||||
@@ -484,7 +491,17 @@ nodes {
|
||||
pivot: PIVOT_S
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "field_z"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
}
|
||||
layers {
|
||||
name: "druid"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_bold"
|
||||
}
|
||||
layers {
|
||||
name: "druid_text_regular"
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -24,6 +24,7 @@ nodes {
|
||||
texture: "druid/ui_circle_16"
|
||||
id: "root"
|
||||
pivot: PIVOT_N
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 8.0
|
||||
@@ -50,6 +51,7 @@ nodes {
|
||||
id: "header"
|
||||
pivot: PIVOT_NE
|
||||
parent: "root"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 8.0
|
||||
@@ -92,6 +94,7 @@ nodes {
|
||||
z: 1.0
|
||||
}
|
||||
parent: "header"
|
||||
layer: "druid_text_regular"
|
||||
inherit_alpha: true
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
@@ -111,6 +114,7 @@ nodes {
|
||||
id: "icon_drag"
|
||||
pivot: PIVOT_NE
|
||||
parent: "header"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
@@ -129,6 +133,7 @@ nodes {
|
||||
id: "icon_refresh"
|
||||
pivot: PIVOT_NE
|
||||
parent: "header"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
@@ -150,6 +155,7 @@ nodes {
|
||||
id: "icon_back"
|
||||
pivot: PIVOT_NW
|
||||
parent: "header"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
}
|
||||
@@ -184,8 +190,8 @@ nodes {
|
||||
pivot: PIVOT_NW
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "content"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
clipping_mode: CLIPPING_MODE_STENCIL
|
||||
}
|
||||
nodes {
|
||||
size {
|
||||
@@ -198,6 +204,7 @@ nodes {
|
||||
pivot: PIVOT_NW
|
||||
adjust_mode: ADJUST_MODE_STRETCH
|
||||
parent: "scroll_view"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 8.0
|
||||
@@ -214,6 +221,7 @@ nodes {
|
||||
texture: "druid/empty"
|
||||
id: "propeties"
|
||||
parent: "content"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
size_mode: SIZE_MODE_AUTO
|
||||
visible: false
|
||||
@@ -747,5 +755,89 @@ nodes {
|
||||
parent: "property_vector3/field_z"
|
||||
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"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -88,6 +88,7 @@ function M:init()
|
||||
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_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_text/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)
|
||||
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
|
||||
---@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.content, 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
|
||||
self.is_dirty = true
|
||||
|
||||
Reference in New Issue
Block a user