mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 02:17:52 +02:00
Update
This commit is contained in:
parent
ed7ab908ac
commit
34be76777b
@ -10,7 +10,7 @@ local M = {}
|
|||||||
---Get color by string (hex or from palette)
|
---Get color by string (hex or from palette)
|
||||||
---@param color_id string Color id from palette or hex color
|
---@param color_id string Color id from palette or hex color
|
||||||
---@return vector4
|
---@return vector4
|
||||||
function M.get_palette_color(color_id)
|
function M.get_color(color_id)
|
||||||
-- Check is it hex: starts with "#" or contains only 3 or 6 hex symbols
|
-- Check is it hex: starts with "#" or contains only 3 or 6 hex symbols
|
||||||
if type(color_id) == "string" then
|
if type(color_id) == "string" then
|
||||||
if string.sub(color_id, 1, 1) == "#" or string.match(color_id, "^[0-9a-fA-F]+$") then
|
if string.sub(color_id, 1, 1) == "#" or string.match(color_id, "^[0-9a-fA-F]+$") then
|
||||||
@ -45,7 +45,7 @@ end
|
|||||||
---@param color vector4|vector3|string Color in vector4, vector3 or color id from palette
|
---@param color vector4|vector3|string Color in vector4, vector3 or color id from palette
|
||||||
function M.set_color(gui_node, color)
|
function M.set_color(gui_node, color)
|
||||||
if type(color) == "string" then
|
if type(color) == "string" then
|
||||||
color = M.get(color)
|
color = M.get_color(color)
|
||||||
end
|
end
|
||||||
|
|
||||||
gui.set(gui_node, COLOR_X, color.x)
|
gui.set(gui_node, COLOR_X, color.x)
|
||||||
|
@ -111,7 +111,7 @@ local function wrap_widget(widget)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
---Get a binded widget to the current game object.
|
---Get a binded widget to the current game object with "go_widget" gui component name.
|
||||||
--- msg.url(nil, nil, "go_widget") -- current game object
|
--- msg.url(nil, nil, "go_widget") -- current game object
|
||||||
--- msg.url(nil, object_url, "go_widget") -- other game object
|
--- msg.url(nil, object_url, "go_widget") -- other game object
|
||||||
---@generic T: druid.widget
|
---@generic T: druid.widget
|
||||||
|
@ -23,7 +23,7 @@ end
|
|||||||
function M.get_commands()
|
function M.get_commands()
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
label = "Assign Layers",
|
label = "[Druid] Assign Layers",
|
||||||
locations = { "Edit" },
|
locations = { "Edit" },
|
||||||
query = { selection = {type = "resource", cardinality = "one"} },
|
query = { selection = {type = "resource", cardinality = "one"} },
|
||||||
active = function(opts)
|
active = function(opts)
|
||||||
@ -50,7 +50,7 @@ function M.get_commands()
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label = "Create Druid Widget",
|
label = "[Druid] Create Druid Widget",
|
||||||
locations = { "Edit", "Assets" },
|
locations = { "Edit", "Assets" },
|
||||||
query = { selection = {type = "resource", cardinality = "one"} },
|
query = { selection = {type = "resource", cardinality = "one"} },
|
||||||
active = function(opts)
|
active = function(opts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user