diff --git a/.gitignore b/.gitignore index 6dced02..cef7422 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ manifest.private.der manifest.public.der /.editor_settings /.deployer_cache + +deployer_version_settings.ini diff --git a/druid/component.lua b/druid/component.lua index 4ed835c..79ef59a 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -410,7 +410,7 @@ local WIDGET_METATABLE = { __index = M } function M.create_widget(self, widget_class, context) local instance = setmetatable({}, { __index = setmetatable(widget_class, WIDGET_METATABLE) - }) + }) --[[@as druid.widget]] instance._component = { _uid = M.create_uid(), @@ -440,7 +440,6 @@ function M.create_widget(self, widget_class, context) instance._meta.parent:__add_child(instance) end - ---@cast instance druid.widget return instance end diff --git a/druid/custom/tiling_node/gui_tiling_node.fp b/druid/custom/tiling_node/gui_tiling_node.fp deleted file mode 100644 index b18e002..0000000 --- a/druid/custom/tiling_node/gui_tiling_node.fp +++ /dev/null @@ -1,83 +0,0 @@ -#version 140 - -uniform sampler2D texture_sampler; - -in vec2 var_texcoord0; -in vec4 var_color; -in vec4 var_uv; -in vec4 var_repeat; // [repeat_x, repeat_y, anchor_x, anchor_y] -in vec4 var_params; // [margin_x, margin_y, offset_x, offset_y] -in vec4 var_uv_rotated; - -out vec4 color_out; - -void main() { - vec2 pivot = var_repeat.zw; - // Margin is a value between 0 and 1 that means offset/padding from the one image to another - vec2 margin = var_params.xy; - vec2 offset = var_params.zw; - vec2 repeat = var_repeat.xy; - - // Atlas UV to local UV [0, 1] - float u = (var_texcoord0.x - var_uv.x) / (var_uv.z - var_uv.x); - float v = (var_texcoord0.y - var_uv.y) / (var_uv.w - var_uv.y); - - // Adjust local UV by the pivot point. So 0:0 will be at the pivot point of node - u = u - (0.5 + pivot.x); - v = v - (0.5 - pivot.y); - - // If rotated, swap UV - if (var_uv_rotated.y < 0.5) { - float temp = u; - u = v; - v = temp; - } - - // Adjust repeat by the margin - repeat.x = repeat.x / (1.0 + margin.x); - repeat.y = repeat.y / (1.0 + margin.y); - - // Repeat is a value between 0 and 1 that represents the number of times the texture is repeated in the atlas. - float tile_u = fract(u * repeat.x); - float tile_v = fract(v * repeat.y); - - float tile_width = 1.0 / repeat.x; - float tile_height = 1.0 / repeat.y; - - // Adjust tile UV by the pivot point. - // Not center is left top corner, need to adjust it to pivot point - tile_u = fract(tile_u + pivot.x + 0.5); - tile_v = fract(tile_v - pivot.y + 0.5); - - // Apply offset - tile_u = fract(tile_u + offset.x); - tile_v = fract(tile_v + offset.y); - - // Extend margins - margin = margin * 0.5; - tile_u = mix(0.0 - margin.x, 1.0 + margin.x, tile_u); - tile_v = mix(0.0 - margin.y, 1.0 + margin.y, tile_v); - float alpha = 0.0; - // If the tile is outside the margins, make it transparent, without IF - alpha = step(0.0, tile_u) * step(tile_u, 1.0) * step(0.0, tile_v) * step(tile_v, 1.0); - - tile_u = clamp(tile_u, 0.0, 1.0); // Keep borders in the range 0-1 - tile_v = clamp(tile_v, 0.0, 1.0); // Keep borders in the range 0-1 - - if (var_uv_rotated.y < 0.5) { - float temp = tile_u; - tile_u = tile_v; - tile_v = temp; - } - - // Remap local UV to the atlas UV - vec2 uv = vec2( - mix(var_uv.x, var_uv.z, tile_u), // Get texture coordinate from the atlas - mix(var_uv.y, var_uv.w, tile_v) // Get texture coordinate from the atlas - //mix(var_uv.x, var_uv.z, tile_u * var_uv_rotated.x + tile_v * var_uv_rotated.z), - //mix(var_uv.y, var_uv.w, 1.0 - (tile_u * var_uv_rotated.y + tile_v * var_uv_rotated.x)) - ); - - lowp vec4 tex = texture(texture_sampler, uv); - color_out = tex * var_color; -} diff --git a/druid/custom/tiling_node/gui_tiling_node.material b/druid/custom/tiling_node/gui_tiling_node.material deleted file mode 100644 index 4c0a29e..0000000 --- a/druid/custom/tiling_node/gui_tiling_node.material +++ /dev/null @@ -1,37 +0,0 @@ -name: "repeat" -tags: "gui" -vertex_program: "/druid/custom/tiling_node/gui_tiling_node.vp" -fragment_program: "/druid/custom/tiling_node/gui_tiling_node.fp" -vertex_constants { - name: "view_proj" - type: CONSTANT_TYPE_VIEWPROJ -} -vertex_constants { - name: "uv_coord" - type: CONSTANT_TYPE_USER - value { - z: 1.0 - w: 1.0 - } -} -vertex_constants { - name: "uv_repeat" - type: CONSTANT_TYPE_USER - value { - x: 1.0 - y: 1.0 - } -} -vertex_constants { - name: "params" - type: CONSTANT_TYPE_USER - value { - } -} -vertex_constants { - name: "uv_rotated" - type: CONSTANT_TYPE_USER - value { - x: 1.0 - } -} diff --git a/druid/custom/tiling_node/gui_tiling_node.vp b/druid/custom/tiling_node/gui_tiling_node.vp deleted file mode 100644 index 93146f7..0000000 --- a/druid/custom/tiling_node/gui_tiling_node.vp +++ /dev/null @@ -1,40 +0,0 @@ -#version 140 - -in mediump vec3 position; -in mediump vec2 texcoord0; -in lowp vec4 color; - -uniform vertex_inputs -{ - highp mat4 view_proj; - highp vec4 uv_coord; - highp vec4 uv_repeat; // [repeat_x, repeat_y, pivot_x, pivot_y] - vec4 uv_rotated; - vec4 params; // [margin_x, margin_y, offset_x, offset_y] -}; - -out mediump vec2 var_texcoord0; -out lowp vec4 var_color; -out highp vec4 var_uv; -out highp vec4 var_repeat; -out vec4 var_params; -out vec4 var_uv_rotated; - -void main() -{ - var_texcoord0 = texcoord0; - var_color = vec4(color.rgb * color.a, color.a); - var_uv = uv_coord; - var_repeat = uv_repeat; - var_params = params; - var_uv_rotated = uv_rotated; - - mat4 transform = mat4( - 1.0, 0, 0, 0.0, - 0, 1.0, 0, 0.0, - 0, 0, 1, 0, - 0.0, position.z, 0, 1.0 - ); - - gl_Position = view_proj * vec4(position.xyz, 1.0) * transform; -} diff --git a/druid/custom/tiling_node/tiling_node.lua b/druid/custom/tiling_node/tiling_node.lua deleted file mode 100644 index bea3cd6..0000000 --- a/druid/custom/tiling_node/tiling_node.lua +++ /dev/null @@ -1,184 +0,0 @@ -local component = require("druid.component") -local helper = require("druid.helper") -local queues = require("event.queues") - ----@class druid.tiling_node: druid.component ----@field animation table ----@field node node ----@field params vector4 ----@field time number -local M = component.create("tiling_node") - -M.PROP_SIZE_X = hash("size.x") -M.PROP_SIZE_Y = hash("size.y") -M.PROP_SCALE_X = hash("scale.x") -M.PROP_SCALE_Y = hash("scale.y") - - ----@param node node|string -function M:init(node) - self.node = self:get_node(node) - self.animation = nil - self.time = 0 - self.margin = 0 - - self.params = gui.get(self.node, "params") --[[@as vector4]] - - self.timer_no_init = timer.delay(0.1, false, function() - print("The druid.script is not found, please add it nearby to the GUI collection", msg.url()) - end) - - queues.push("druid.get_atlas_path", { - texture_name = gui.get_texture(self.node), - sender = msg.url(), - }, self.on_get_atlas_path, self) -end - - ----@param atlas_path string -function M:on_get_atlas_path(atlas_path) - timer.cancel(self.timer_no_init) - self.is_inited = self:init_tiling_animation(atlas_path) - local repeat_x, repeat_y = self:get_repeat_count_from_node() - self:start_animation(repeat_x, repeat_y) -end - - ----@param node node ----@param property string -function M:on_node_property_changed(node, property) - if not self.is_inited or node ~= self.node then - return - end - - if property == "size" or property == "scale" then - local repeat_x, repeat_y = self:get_repeat_count_from_node() - self:set_repeat(repeat_x, repeat_y) - end -end - - -function M:get_repeat_count_from_node() - if not self.is_inited then - return 1, 1 - end - local size_x = gui.get(self.node, M.PROP_SIZE_X) - local size_y = gui.get(self.node, M.PROP_SIZE_Y) - local scale_x = gui.get(self.node, M.PROP_SCALE_X) - local scale_y = gui.get(self.node, M.PROP_SCALE_Y) - - local repeat_x = (size_x / self.animation.width) / scale_x - local repeat_y = (size_y / self.animation.height) / scale_y - - return repeat_x, repeat_y -end - - ----@param atlas_path string ----@return boolean -function M:init_tiling_animation(atlas_path) - if not atlas_path then - print("No atlas path found for node", gui.get_id(self.node), gui.get_texture(self.node)) - print("Probably you should add druid.script at window collection to access resources") - return false - end - - self.animation = helper.get_animation_data_from_node(self.node, atlas_path) - return true -end - - --- Start our repeat shader work ----@param repeat_x number X factor ----@param repeat_y number Y factor -function M:start_animation(repeat_x, repeat_y) - if not self.is_inited then - return - end - - self:set_repeat(repeat_x, repeat_y) - - local node = self.node - local animation = self.animation - local frame = animation.frames[1] - gui.set(node, "uv_coord", frame.uv_coord) - - if #animation.frames > 1 and animation.fps > 0 then - animation.handle = - timer.delay(1/animation.fps, true, function(_, handle, time_elapsed) - local next_rame = animation.frames[animation.current_frame] - gui.set(node, "uv_coord", next_rame.uv_coord) - - animation.current_frame = animation.current_frame + 1 - if animation.current_frame > #animation.frames then - animation.current_frame = 1 - end - end) - end -end - - -function M:final() - local animation = self.animation - if animation.handle then - timer.cancel(animation.handle) - animation.handle = nil - end -end - - ----Update repeat factor values ----@param repeat_x number? X factor ----@param repeat_y number? Y factor -function M:set_repeat(repeat_x, repeat_y) - local animation = self.animation - animation.v.x = repeat_x or animation.v.x - animation.v.y = repeat_y or animation.v.y - - local anchor = helper.get_pivot_offset(gui.get_pivot(self.node)) - animation.v.z = anchor.x - animation.v.w = anchor.y - - gui.set(self.node, "uv_repeat", animation.v) -end - - ----@param offset_perc_x number? X offset ----@param offset_perc_y number? Y offset -function M:set_offset(offset_perc_x, offset_perc_y) - self.params.z = offset_perc_x or self.params.z - self.params.w = offset_perc_y or self.params.w - gui.set(self.node, "params", self.params) - return self -end - - ----@param margin_x number? X margin ----@param margin_y number? Y margin -function M:set_margin(margin_x, margin_y) - self.params.x = margin_x or self.params.x - self.params.y = margin_y or self.params.y - gui.set(self.node, "params", self.params) - return self -end - - ----@param scale number -function M:set_scale(scale) - local current_scale_x = gui.get(self.node, M.PROP_SCALE_X) - local current_scale_y = gui.get(self.node, M.PROP_SCALE_Y) - local current_size_x = gui.get(self.node, M.PROP_SIZE_X) - local current_size_y = gui.get(self.node, M.PROP_SIZE_Y) - - local delta_scale_x = scale / current_scale_x - local delta_scale_y = scale / current_scale_y - gui.set(self.node, M.PROP_SCALE_X, scale) - gui.set(self.node, M.PROP_SCALE_Y, scale) - gui.set(self.node, M.PROP_SIZE_X, current_size_x / delta_scale_x) - gui.set(self.node, M.PROP_SIZE_Y, current_size_y / delta_scale_y) - - return self -end - - -return M diff --git a/druid/editor_scripts/druid.editor_script b/druid/editor_scripts/druid.editor_script index ba9c01b..43057f8 100644 --- a/druid/editor_scripts/druid.editor_script +++ b/druid/editor_scripts/druid.editor_script @@ -18,7 +18,7 @@ function M.get_prefs_schema() ["druid.gui_script_template_path"] = editor.prefs.schema.string({ default = DEFAULT_GUI_SCRIPT_TEMPLATE_PATH, scope = editor.prefs.SCOPE.PROJECT - }) + }), } end diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 52c8b1b..f38b4d5 100755 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -357,7 +357,7 @@ function M:on_input(action_id, action) for i = #components, 1, -1 do local component = components[i] - local input_enabled = component:get_input_enabled() + local input_enabled = component._meta.input_enabled if input_enabled and self:_can_use_input_component(component) then if not is_input_consumed then diff --git a/druid/widget/fps_panel/fps_panel.gui b/druid/widget/fps_panel/fps_panel.gui deleted file mode 100644 index 5b85967..0000000 --- a/druid/widget/fps_panel/fps_panel.gui +++ /dev/null @@ -1,222 +0,0 @@ -fonts { - name: "druid_text_regular" - font: "/druid/fonts/druid_text_regular.font" -} -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 200.0 - y: 140.0 - } - type: TYPE_BOX - id: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - type: TYPE_TEMPLATE - id: "mini_graph" - parent: "root" - inherit_alpha: true - template: "/druid/widget/mini_graph/mini_graph.gui" -} -nodes { - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - id: "mini_graph/root" - parent: "mini_graph" - overridden_fields: 5 - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/header" - parent: "mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - text: "FPS" - id: "mini_graph/text_header" - parent: "mini_graph/header" - overridden_fields: 8 - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/icon_drag" - parent: "mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/content" - parent: "mini_graph/root" - template_node_child: true -} -nodes { - color { - x: 0.525 - y: 0.525 - z: 0.525 - } - type: TYPE_BOX - id: "mini_graph/prefab_line" - parent: "mini_graph/content" - overridden_fields: 5 - template_node_child: true -} -nodes { - color { - x: 0.957 - y: 0.608 - z: 0.608 - } - type: TYPE_BOX - id: "mini_graph/color_low" - parent: "mini_graph/content" - overridden_fields: 5 - template_node_child: true -} -nodes { - size { - x: 200.0 - y: 100.0 - } - type: TYPE_BOX - id: "content" - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -96.0 - y: 12.0 - } - scale { - x: 0.3 - y: 0.3 - } - size { - x: 260.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "12 FPS" - font: "druid_text_regular" - id: "text_min_fps" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "content" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - y: 12.0 - } - scale { - x: 0.3 - y: 0.3 - } - size { - x: 260.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "60 FPS" - font: "druid_text_bold" - id: "text_fps" - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "content" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: -33.4 - y: 30.0 - } - size { - x: 3.0 - y: 8.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "line_second_1" - pivot: PIVOT_N - parent: "content" - inherit_alpha: true -} -nodes { - position { - x: 33.2 - y: 30.0 - } - size { - x: 3.0 - y: 8.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "line_second_2" - pivot: PIVOT_N - parent: "content" - inherit_alpha: true -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/druid/widget/fps_panel/fps_panel.lua b/druid/widget/fps_panel/fps_panel.lua deleted file mode 100644 index 3066133..0000000 --- a/druid/widget/fps_panel/fps_panel.lua +++ /dev/null @@ -1,112 +0,0 @@ --- Title: FPS Panel --- Description: Shows current FPS and graph of the last 3 seconds of performance --- Author: Insality --- Widget: fps_panel --- Depends: insality@mini_graph --- Tags: debug, system - -local helper = require("druid.helper") -local mini_graph = require("druid.widget.mini_graph.mini_graph") - ----@class druid.widget.fps_panel: druid.widget ----@field root node -local M = {} - -local TARGET_FPS = sys.get_config_int("display.update_frequency", 60) -if TARGET_FPS == 0 then - TARGET_FPS = 60 -end - - -function M:init() - self.root = self:get_node("root") - - self.delta_time = 0.1 -- in seconds - self.collect_time = 3 -- in seconds - self.collect_time_counter = 0 - self.graph_samples = self.collect_time / self.delta_time - - -- Store frame time in seconds last collect_time seconds - self.fps_samples = {} - - self.mini_graph = self.druid:new_widget(mini_graph, "mini_graph") - self.mini_graph:set_samples(self.graph_samples) -- show last 30 seconds - self.mini_graph:set_max_value(TARGET_FPS) - - do -- Set parent manually - local parent_node = self.mini_graph.content - local position = helper.get_full_position(parent_node, self.mini_graph.root) - local content = self:get_node("content") - gui.set_parent(content, self.mini_graph.content) - gui.set_position(content, -position) - end - - self.text_min_fps = self.druid:new_text("text_min_fps") - self.text_fps = self.druid:new_text("text_fps") - - self.timer_id = timer.delay(self.delta_time, true, function() - self:push_fps_value() - end) - - --self.container = self.druid:new_container(self.root) - --self.container:add_container(self.mini_graph.container) - --local container_content = self.container:add_container("content") - --container_content:add_container("text_min_fps") - --container_content:add_container("text_fps") -end - - -function M:on_remove() - timer.cancel(self.timer_id) -end - - -function M:update(dt) - if not self.previous_time then - self.previous_time = socket.gettime() - return - end - - local current_time = socket.gettime() - local delta_time = current_time - self.previous_time - self.previous_time = current_time - - self.collect_time_counter = self.collect_time_counter + delta_time - table.insert(self.fps_samples, 1, delta_time) - - while self.collect_time_counter > self.collect_time do - -- Remove last - local removed_value = table.remove(self.fps_samples) - self.collect_time_counter = self.collect_time_counter - removed_value - end -end - - -function M:push_fps_value() - if #self.fps_samples == 0 then - return - end - - local max_frame_time = 0 - local average_frame_time = 0 - local average_samples_count = self.delta_time - local average_collected = 0 - for index = 1, #self.fps_samples do - if average_frame_time < average_samples_count then - average_frame_time = average_frame_time + self.fps_samples[index] - average_collected = average_collected + 1 - end - max_frame_time = math.max(max_frame_time, self.fps_samples[index]) - end - - average_frame_time = average_frame_time / average_collected - - self.mini_graph:push_line_value(1 / average_frame_time) - - self.text_fps:set_text(tostring(math.ceil(1 / average_frame_time) .. " FPS")) - local lowest_value = math.ceil(self.mini_graph:get_lowest_value()) - self.text_min_fps:set_text(lowest_value .. " lowest") -end - - -return M diff --git a/druid/widget/memory_panel/memory_panel.gui b/druid/widget/memory_panel/memory_panel.gui deleted file mode 100644 index 1892972..0000000 --- a/druid/widget/memory_panel/memory_panel.gui +++ /dev/null @@ -1,244 +0,0 @@ -fonts { - name: "druid_text_regular" - font: "/druid/fonts/druid_text_regular.font" -} -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 200.0 - y: 140.0 - } - type: TYPE_BOX - id: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - type: TYPE_TEMPLATE - id: "mini_graph" - parent: "root" - inherit_alpha: true - template: "/druid/widget/mini_graph/mini_graph.gui" -} -nodes { - type: TYPE_BOX - id: "mini_graph/root" - parent: "mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/header" - parent: "mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - text: "Memory" - id: "mini_graph/text_header" - parent: "mini_graph/header" - overridden_fields: 8 - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/icon_drag" - parent: "mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/content" - parent: "mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/prefab_line" - parent: "mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/color_low" - parent: "mini_graph/content" - template_node_child: true -} -nodes { - size { - x: 200.0 - y: 100.0 - } - type: TYPE_BOX - id: "content" - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -96.0 - y: 12.0 - } - scale { - x: 0.3 - y: 0.3 - } - size { - x: 200.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "120.23 KB" - font: "druid_text_regular" - id: "text_max_value" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - adjust_mode: ADJUST_MODE_STRETCH - parent: "content" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 96.0 - y: 12.0 - } - scale { - x: 0.3 - y: 0.3 - } - size { - x: 200.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "120 KB/s" - font: "druid_text_regular" - id: "text_per_second" - pivot: PIVOT_E - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - adjust_mode: ADJUST_MODE_STRETCH - parent: "content" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: -33.4 - y: 30.0 - } - size { - x: 3.0 - y: 8.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "line_second_1" - pivot: PIVOT_N - parent: "content" - inherit_alpha: true -} -nodes { - position { - x: 33.2 - y: 30.0 - } - size { - x: 3.0 - y: 8.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "line_second_2" - pivot: PIVOT_N - parent: "content" - inherit_alpha: true -} -nodes { - position { - y: 12.0 - } - scale { - x: 0.3 - y: 0.3 - } - size { - x: 200.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "120 KB" - font: "druid_text_bold" - id: "text_memory" - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "content" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/druid/widget/memory_panel/memory_panel.lua b/druid/widget/memory_panel/memory_panel.lua deleted file mode 100644 index fafdd01..0000000 --- a/druid/widget/memory_panel/memory_panel.lua +++ /dev/null @@ -1,100 +0,0 @@ -local helper = require("druid.helper") -local mini_graph = require("druid.widget.mini_graph.mini_graph") - ----@class druid.widget.memory_panel: druid.widget ----@field root node -local M = {} - - -function M:init() - self.root = self:get_node("root") - self.delta_time = 0.1 - self.samples_count = 30 - self.memory_limit = 100 - - self.mini_graph = self.druid:new_widget(mini_graph, "mini_graph") - self.mini_graph:set_samples(self.samples_count) - - -- This one is not works with scaled root - --gui.set_parent(self:get_node("content"), self.mini_graph.content, true) - - do -- Set parent manually - local parent_node = self.mini_graph.content - local position = helper.get_full_position(parent_node, self.mini_graph.root) - local content = self:get_node("content") - gui.set_parent(content, self.mini_graph.content) - gui.set_position(content, -position) - end - - self.max_value = self.druid:new_text("text_max_value") - self.text_per_second = self.druid:new_text("text_per_second") - self.text_memory = self.druid:new_text("text_memory") - - self.memory = collectgarbage("count") - self.memory_samples = {} - - self:update_text_memory() - - self.timer_id = timer.delay(self.delta_time, true, function() - self:push_next_value() - end) - - --self.container = self.druid:new_container(self.root) - --self.container:add_container(self.mini_graph.container) - --local container_content = self.container:add_container("content") - --container_content:add_container("text_max_value") - --container_content:add_container("text_per_second") -end - - -function M:on_remove() - timer.cancel(self.timer_id) -end - - -function M:set_low_memory_limit(limit) - self.memory_limit = limit -end - - -function M:push_next_value() - local memory = collectgarbage("count") - local diff = math.max(0, memory - self.memory) - self.memory = memory - self:update_text_memory() - - table.insert(self.memory_samples, diff) - if #self.memory_samples > self.samples_count then - table.remove(self.memory_samples, 1) - end - - self.mini_graph:push_line_value(diff) - - local max_value = math.max(unpack(self.memory_samples)) - max_value = math.max(max_value, self.memory_limit) -- low limit to display - self.mini_graph:set_max_value(max_value) - - local max_memory = math.ceil(self.mini_graph:get_highest_value()) - self.max_value:set_text(max_memory .. " KB") - - local last_second = 0 - local last_second_samples = math.ceil(1 / self.delta_time) - for index = #self.memory_samples - last_second_samples + 1, #self.memory_samples do - last_second = last_second + (self.memory_samples[index] or 0) - end - self.text_per_second:set_text(math.ceil(last_second) .. " KB/s") -end - - -function M:update_text_memory() - local memory = math.ceil(collectgarbage("count")) -- in KB - if memory > 1024 then - memory = memory / 1024 - self.text_memory:set_text(string.format("%.2f", memory) .. " MB") - else - self.text_memory:set_text(memory .. " KB") - end -end - - -return M diff --git a/druid/widget/mini_graph/mini_graph.gui b/druid/widget/mini_graph/mini_graph.gui deleted file mode 100644 index ed5fa6d..0000000 --- a/druid/widget/mini_graph/mini_graph.gui +++ /dev/null @@ -1,178 +0,0 @@ -fonts { - name: "druid_text_regular" - font: "/druid/fonts/druid_text_regular.font" -} -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 200.0 - y: 140.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/ui_circle_16" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - inherit_alpha: true - slice9 { - x: 8.0 - y: 8.0 - z: 8.0 - w: 8.0 - } -} -nodes { - position { - y: 70.0 - } - size { - x: 200.0 - y: 40.0 - } - type: TYPE_BOX - id: "header" - pivot: PIVOT_N - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -92.0 - y: -8.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 260.0 - y: 50.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Mini Graph" - font: "druid_text_bold" - id: "text_header" - pivot: PIVOT_NW - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "header" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 96.0 - y: -4.0 - } - color { - x: 0.306 - y: 0.31 - z: 0.314 - } - type: TYPE_BOX - texture: "druid/icon_drag" - id: "icon_drag" - pivot: PIVOT_NE - parent: "header" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - y: -70.0 - } - size { - x: 200.0 - y: 100.0 - } - color { - x: 0.129 - y: 0.141 - z: 0.157 - } - type: TYPE_BOX - texture: "druid/ui_circle_16" - id: "content" - pivot: PIVOT_S - adjust_mode: ADJUST_MODE_STRETCH - parent: "root" - inherit_alpha: true - slice9 { - x: 8.0 - y: 8.0 - z: 8.0 - w: 8.0 - } - clipping_mode: CLIPPING_MODE_STENCIL - material: "gui_stencil" -} -nodes { - size { - x: 8.0 - y: 70.0 - } - color { - x: 0.957 - y: 0.608 - z: 0.608 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "prefab_line" - pivot: PIVOT_S - parent: "content" - inherit_alpha: true -} -nodes { - position { - x: -10.0 - y: 4.0 - } - size { - x: 8.0 - y: 8.0 - } - color { - x: 0.557 - y: 0.835 - z: 0.62 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "color_low" - parent: "content" - inherit_alpha: true -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT -materials { - name: "gui_stencil" - material: "/druid/materials/stencil/gui_stencil.material" -} diff --git a/druid/widget/mini_graph/mini_graph.lua b/druid/widget/mini_graph/mini_graph.lua deleted file mode 100644 index 10a5237..0000000 --- a/druid/widget/mini_graph/mini_graph.lua +++ /dev/null @@ -1,176 +0,0 @@ -local color = require("druid.color") -local helper = require("druid.helper") - ----Widget to display a several lines with different height in a row ----Init, set amount of samples and max value of value means that the line will be at max height ----Use `push_line_value` to add a new value to the line ----Or `set_line_value` to set a value to the line by index ----Setup colors inside template file (at minimum and maximum) ----@class druid.widget.mini_graph: druid.widget -local M = {} - -local SIZE_Y = hash("size.y") - - -function M:init() - self.root = self:get_node("root") - self.text_header = self.druid:new_text("text_header") - - self.icon_drag = self:get_node("icon_drag") - self.druid:new_drag("header", self.on_drag_widget) - self.druid:new_button("icon_drag", self.toggle_hide) - :set_style(nil) - - self.content = self:get_node("content") - self.layout = self.druid:new_layout(self.content, "horizontal") - :set_margin(0, 0) - :set_padding(0, 0, 0, 0) - - self.prefab_line = self:get_node("prefab_line") - gui.set_enabled(self.prefab_line, false) - - local node_color_low = self:get_node("color_low") - self.color_zero = gui.get_color(node_color_low) - self.color_one = gui.get_color(self.prefab_line) - gui.set_enabled(node_color_low, false) - - self.is_hidden = false - self.max_value = 1 -- in this value line will be at max height - self.lines = {} - self.values = {} - - self.container = self.druid:new_container(self.root) - local container_header = self.container:add_container("header", "stretch_x") - container_header:add_container("text_header") - container_header:add_container("icon_drag") - - self.container:add_container("content", "stretch_x") - self.default_size = self.container:get_size() -end - - -function M:on_remove() - self:clear() -end - - -function M:clear() - self.layout:clear_layout() - for index = 1, #self.lines do - gui.delete_node(self.lines[index]) - end - - self.lines = {} -end - - -function M:set_samples(samples) - self.samples = samples - self:clear() - - local line_width = self.layout:get_size().x / self.samples - for index = 1, self.samples do - local line = gui.clone(self.prefab_line) - gui.set_enabled(line, true) - gui.set(line, "size.x", line_width) - self.layout:add(line) - table.insert(self.lines, line) - end -end - - -function M:get_samples() - return self.samples -end - - ----Set normalized to control the color of the line ---- for index = 1, mini_graph:get_samples() do ---- mini_graph:set_line_value(index, math.random()) ---- end ----@param index number ----@param value number The normalized value from 0 to 1 -function M:set_line_value(index, value) - local line = self.lines[index] - if not line then - return - end - - self.values[index] = value - - local normalized = helper.clamp(value/self.max_value, 0, 1) - local target_color = color.lerp(normalized, self.color_zero, self.color_one) - gui.set_color(line, target_color) - self:set_line_height(index) -end - - ----@return number -function M:get_line_value(index) - return self.values[index] or 0 -end - - -function M:push_line_value(value) - for index = 1, self.samples - 1 do - self:set_line_value(index, self:get_line_value(index + 1)) - end - - self:set_line_value(self.samples, value) -end - - -function M:set_max_value(max_value) - if self.max_value == max_value then - return - end - - self.max_value = max_value - for index = 1, self.samples do - self:set_line_height(index) - end -end - - -function M:set_line_height(index) - local value = self.values[index] or 0 - local normalized = helper.clamp(value / self.max_value, 0, 1) - local size_y = normalized * 70 - gui.set(self.lines[index], SIZE_Y, size_y) -end - - -function M:get_lowest_value() - return math.min(unpack(self.values)) -end - - -function M:get_highest_value() - return math.max(unpack(self.values)) -end - - -function M:on_drag_widget(dx, dy) - if not gui.is_enabled(self.icon_drag) then - return - end - - local position = self.container:get_position() - self.container:set_position(position.x + dx, position.y + dy) -end - - -function M:toggle_hide() - self.is_hidden = not self.is_hidden - local hidden_size = gui.get_size(self:get_node("header")) - - local new_size = self.is_hidden and hidden_size or self.default_size - self.container:set_size(new_size.x, new_size.y, gui.PIVOT_N) - - gui.set_enabled(self.content, not self.is_hidden) - - return self -end - - -return M diff --git a/druid/widget/navigation_handler/navigation_handler.lua b/druid/widget/navigation_handler/navigation_handler.lua deleted file mode 100644 index 76b64b3..0000000 --- a/druid/widget/navigation_handler/navigation_handler.lua +++ /dev/null @@ -1,450 +0,0 @@ --- Title: Navigation Handler --- Description: Adds support for navigating with keyboard and gamepad. --- Author: NaakkaDev --- Widget: navigation_handler --- Tags: input --- Version: 1 - - -local event = require("event.event") -local const = require("druid.const") - - ----Widget force handling GUI navigation via keyboard/gamepad. ---- ----### Setup ----Loads the widget module: ----`local navigation_handler = require("druid.widgets.navigation_handler.navigation_handler")` ---- ----Create the new widget instance: ----`self.nav = self.druid:new_widget(navigation_handler)` ---- ----Set the first component instance (likely a button) to be selected. This is **required**. ----`self.nav:select_component(self.my_button)` ---- ---- ----### Example using the `on_select` event ----``` ----local function on_select_btn(self, new, current) ---- gui.play_flipbook(new.node, "button_selected") ---- gui.play_flipbook(current.node, "button") ----end ----``` ----With `self.nav.on_select:subscribe(on_select_btn)` ---- ---- ----### Notes ----- `on_select` event callback params: (self, component_instance, component_instance). ----- - **self** - Druid self context. ----- - **new** - The component that will be selected next. ----- - **current** - The component that is about to be de-selected. ----- Key triggers in `input.binding` should match your setup. ----- Used `action_id`'s are:' `key_up`, `key_down`, `key_left` and `key_right`. ----@class druid.widget.navigation_handler: druid.widget ----@field on_select event fun(self, component_instance, component_instance) Triggers when a new component is selected. The first component is for the newly selected and the second is for the previous component. ----@field private _weight number The value used to control of the next button diagonal finding logic strictness. ----@field private _tolerance number Determines how lenient the next button finding logic is. Set larger value for further diagonal navigation. ----@field private _select_trigger hash Select trigger for the current component. Defaults to `druid.const.ACTION_SPACE`. ----@field private _selected_triggers table Table of action_ids that can trigger the selected component. Valid only for the current button when set. ----@field private _selected_component druid.component|druid.button|druid.slider Currently selected button instance. ----@field private _deselect_directions table The valid "escape" direction of the current selection. -local M = {} - --- Components that support navigation. -local COMPONENTS = { "button", "slider" } - - ----The constructor for the navigation_handler widget. -function M:init() - self._weight = 10 - self._tolerance = 250 - self._select_trigger = const.ACTION_SPACE - self._selected_triggers = {} - self._selected_component = nil - self._deselect_directions = {} - - -- Events - self.on_select = event.create() -end - - ----@private ----@param action_id hash Action id from on_input. ----@param action table Action from on_input. ----@return boolean is_consumed True if the input was consumed. -function M:on_input(action_id, action) - -- Do nothing if the selected component is not set. - if not self._selected_component then - return - end - - -- Trigger an action with the selected component, e.g. button click. - if self:_action_id_is_trigger(action_id) and self:_selected_is_button() then - ---@type druid.button - local btn = self._selected_component - local is_consume = false - - if action.pressed then - btn.is_repeated_started = false - btn.last_pressed_time = socket.gettime() - btn.on_pressed:trigger(self:get_context(), btn, self) - btn.can_action = true - return is_consume - end - - -- While hold button, repeat rate pick from input.repeat_interval - if action.repeated then - if not btn.on_repeated_click:is_empty() and btn.can_action then - btn:_on_button_repeated_click() - return is_consume - end - end - - if action.released then - return btn:_on_button_release() and is_consume - end - - return not btn.disabled and is_consume - end - - local is_left = action_id == const.ACTION_LEFT - local is_right = action_id == const.ACTION_RIGHT - local is_up = action_id == const.ACTION_UP - local is_down = action_id == const.ACTION_DOWN - - if action.pressed then - ---@type druid.component|nil - local component = nil - - if is_up then - component = self:_find_next_button("up") - elseif is_down then - component = self:_find_next_button("down") - elseif is_left then - component = self:_find_next_button("left") - elseif is_right then - component = self:_find_next_button("right") - end - - if component ~= nil and component ~= self._selected_component then - return self:_on_new_select(component) - end - end - - -- Handle chaning slider values when pressing left or right keys. - if (action.pressed or action.repeated) - and self:_selected_is_slider() - then - local is_directional = is_left or is_right or is_up or is_down - - -- The action_id was not one of the directions so go no further. - if not is_directional then - return false - end - - ---@type druid.slider - local slider = self._selected_component - local value = slider.value - local new_value = 0.01 - local is_horizontal = slider.dist.x > 0 - local negative_value = is_left or is_down - local positive_value = is_right or is_up - - -- Reteurn if a navigation should happen instead of a value change. - if is_horizontal and (is_up or is_down) then - return false - elseif not is_horizontal and (is_left or is_right) then - return false - end - - -- Speedup when holding the button. - if action.repeated and not action.pressed then - new_value = 0.05 - end - - if negative_value then - value = value - new_value - elseif positive_value then - value = value + new_value - end - - slider:set(value) - end - - return false -end - - ----Set the given `druid.component` as selected component. ----@param component druid.component Current druid component that starts as selected. ----@return druid.widget.navigation_handler self -function M:select_component(component) - self._selected_component = component - - -- Select the component if it's a button. - if component.hover then - component.hover:set_hover(true) - end - - return self -end - - ----Sets a new weight value which affects the next button diagonal finding logic. ----@param new_value number ----@return druid.widget.navigation_handler self -function M:set_weight(new_value) - self._weight = new_value - return self -end - - ----Sets a new tolerance value. Can be useful when scale or window size changes. ----@param new_value number How far to allow misalignment on the perpendicular axis when finding the next button. ----@return druid.widget.navigation_handler self The current navigation handler instance. -function M:set_tolerance(new_value) - self._tolerance = new_value - return self -end - - ----Set input action_id name to trigger selected component by keyboard/gamepad. ----@param key hash The action_id of the input key. Example: "key_space". ----@return druid.widget.navigation_handler self The current navigation handler instance. -function M:set_select_trigger(key) - self._select_trigger = key - return self -end - - ----Get current the trigger key for currently selected component. ----@return hash _select_trigger The action_id of the input key. -function M:get_select_trigger() - return self._select_trigger -end - - ----Set the trigger keys for the selected component. Stays valid until the selected component changes. ----@param keys table|string|hash Supports multiple action_ids if the given value is a table with the action_id hashes or strings. ----@return druid.widget.navigation_handler self The current navigation handler instance. -function M:set_temporary_select_triggers(keys) - if type(keys) == "table" then - for index, value in ipairs(keys) do - if type(value) == "string" then - keys[index] = hash(value) - end - end - self._selected_triggers = keys - elseif type(keys) == "string" then - self._selected_triggers = { hash(keys) } - else - self._selected_triggers = { keys } - end - - return self -end - - ----Get the currently selected component. ----@return druid.component|nil _selected_component Selected component, which often is a `druid.button`. -function M:get_selected_component() - return self._selected_component -end - - ----Set the de-select direction for the selected button. If this is set ----then the next button can only be in that direction. ----@param dir string|table Valid directions: "up", "down", "left", "right". Can take multiple values as a table of strings. ----@return druid.widget.navigation_handler self The current navigation handler instance. -function M:set_deselect_directions(dir) - if type(dir) == "table" then - self._deselect_directions = dir - elseif type(dir) == "string" then - self._deselect_directions = { dir } - end - - return self -end - - ----Returns true if the currently selected `druid.component` is a `druid.button`. ----@private ----@return boolean -function M:_selected_is_button() - return self._selected_component._component.name == "button" -end - - ----Returns true if the currently selected `druid.component` is a `druid.slider`. ----@private ----@return boolean -function M:_selected_is_slider() - return self._selected_component._component.name == "slider" -end - - ----Find the best next button based on the direction from the currently selected button. ----@private ----@param dir string Valid directions: "top", "bottom", "left", "right". ----@return druid.component|nil -function M:_find_next_button(dir) - -- Check if the deselect direction is set and - -- the direction is different from it. - if next(self._deselect_directions) ~= nil and not M._valid_direction(self._deselect_directions, dir) then - return nil - end - - local best_component, best_score = nil, math.huge - local screen_pos = gui.get_screen_position(self._selected_component.node) - - -- Use the slider parent node instead of the pin node. - if self._selected_component._component.name == "slider" then - screen_pos = gui.get_screen_position(gui.get_parent(self._selected_component.node)) - end - - ---@type druid.component - for _, input_component in ipairs(self._meta.druid.components_interest[const.ON_INPUT]) do - -- GUI node of the component being iterated. - local node = input_component.node - - -- If it is a slider component then use its parent node instead, - -- since the pin node moves around. - if input_component._component.name == "slider" then - node = gui.get_parent(node) - end - - -- Only check components that are supported. - if input_component ~= self._selected_component and M._valid_component(input_component) then - local pos = gui.get_screen_position(node) - local dx, dy = pos.x - screen_pos.x, pos.y - screen_pos.y - local valid = false - local score = math.huge - - if dir == "right" and dx > 0 and math.abs(dy) <= self._tolerance then - valid = true - score = dx * dx + dy * dy * self._weight - elseif dir == "left" and dx < 0 and math.abs(dy) <= self._tolerance then - valid = true - score = dx * dx + dy * dy * self._weight - elseif dir == "up" and dy > 0 and math.abs(dx) <= self._tolerance then - valid = true - score = dy * dy + dx * dx * self._weight - elseif dir == "down" and dy < 0 and math.abs(dx) <= self._tolerance then - valid = true - score = dy * dy + dx * dx * self._weight - end - - if valid and score < best_score then - best_score = score - best_component = input_component - end - end - end - - return best_component -end - - ----De-select the current selected component. ----@private -function M:_deselect_current() - if self._selected_component.hover then - self._selected_component.hover:set_hover(false) - end - self._selected_component = nil - self._selected_triggers = {} - - -- The deselect direction was used so remove it. - if self._deselect_directions then - self._deselect_directions = {} - end -end - - ----Check if the supplied action_id can trigger the selected component. ----@private ----@param action_id hash ----@return boolean -function M:_action_id_is_trigger(action_id) - for _, key in ipairs(self._selected_triggers) do - if action_id == key then - return true - end - end - - return action_id == self._select_trigger -end - - ----Handle new selection. ----@private ----@param new druid.component Instance of the selected component. ----@return boolean -function M:_on_new_select(new) - ---@type druid.component - local current = self._selected_component - - -- De-select the current component. - self:_deselect_current() - self._selected_component = new - - --- BUTTON - if new._component.name == "button" then - -- Set the active button hover state. - new.hover:set_hover(true) - end - - --- SLIDER - if new._component.name == "slider" then - -- Check if the slider is horizontal, if so then - -- the next component should be above or below of this one. - if new.dist.x > 0 then - self:set_deselect_directions({ "up", "down" }) - end - - -- Check if the slider is vertical, if so then - -- the next component should be left or right of this one. - if new.dist.y > 0 then - self:set_deselect_directions({ "left, right" }) - end - end - - --- EVENT - self.on_select:trigger(self:get_context(), new, current) - - return false -end - - ----Helper method for checking if the given direction is valid. ----@private ----@param dirs table ----@param dir string ----@return boolean -function M._valid_direction(dirs, dir) - for _index, value in ipairs(dirs) do - if value == dir then - return true - end - end - return false -end - - ----Helper method for checking iterating through components. ----Returns true if the given component is in the table of valid components. ----@private ----@param input_component druid.component ----@return boolean -function M._valid_component(input_component) - local component_name = input_component._component.name - for _index, component in ipairs(COMPONENTS) do - if component_name == component then - return true - end - end - return false -end - - -return M diff --git a/druid/widget/properties_panel/properties/property_button.gui b/druid/widget/properties_panel/properties/property_button.gui deleted file mode 100644 index e2c9973..0000000 --- a/druid/widget/properties_panel/properties/property_button.gui +++ /dev/null @@ -1,166 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 350.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Button" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - adjust_mode: ADJUST_MODE_STRETCH - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - size { - x: 200.0 - y: 40.0 - } - type: TYPE_BOX - id: "E_Anchor" - pivot: PIVOT_E - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -100.0 - } - size { - x: 200.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_BOX - texture: "druid/rect_round2_width2" - id: "button" - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true - slice9 { - x: 5.0 - y: 5.0 - z: 5.0 - w: 5.0 - } -} -nodes { - position { - y: -20.0 - } - size { - x: 200.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected" - pivot: PIVOT_S - adjust_mode: ADJUST_MODE_STRETCH - parent: "button" - layer: "druid" - inherit_alpha: true -} -nodes { - scale { - x: 0.5 - y: 0.5 - } - size { - x: 380.0 - y: 50.0 - } - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_TEXT - text: "Button" - font: "druid_text_bold" - id: "text_button" - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - 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 diff --git a/druid/widget/properties_panel/properties/property_button.lua b/druid/widget/properties_panel/properties/property_button.lua deleted file mode 100644 index 34c21ce..0000000 --- a/druid/widget/properties_panel/properties/property_button.lua +++ /dev/null @@ -1,66 +0,0 @@ -local color = require("druid.color") - ----@class druid.widget.property_button: druid.widget ----@field root node ----@field container druid.container ----@field text_name druid.text ----@field button druid.button ----@field text_button druid.text -local M = {} - - -function M:init() - self.root = self:get_node("root") - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim", 0.3) - - self.selected = self:get_node("selected") - gui.set_alpha(self.selected, 0) - - self.button = self.druid:new_button("button", self.on_click) - self.text_button = self.druid:new_text("text_button") - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name", nil, function(_, size) - self.text_button:set_size(size) - end) - self.container:add_container("E_Anchor") -end - - -function M:on_click() - gui.set_alpha(self.selected, 1) - gui.animate(self.selected, "color.w", 0, gui.EASING_INSINE, 0.16) -end - - ----@param text string ----@return druid.widget.property_button -function M:set_text_property(text) - self.text_name:set_text(text) - return self -end - - ----@param text string ----@return druid.widget.property_button -function M:set_text_button(text) - self.text_button:set_text(text) - return self -end - - ----@param enabled boolean ----@return druid.widget.property_button -function M:set_enabled(enabled) - self.button:set_enabled(enabled) - return self -end - - -function M:set_color(color_value) - color.set_color(self:get_node("button"), color_value) -end - - -return M diff --git a/druid/widget/properties_panel/properties/property_checkbox.gui b/druid/widget/properties_panel/properties/property_checkbox.gui deleted file mode 100644 index 9cf5768..0000000 --- a/druid/widget/properties_panel/properties/property_checkbox.gui +++ /dev/null @@ -1,145 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 700.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Checkbox" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - size { - x: 40.0 - y: 40.0 - } - type: TYPE_BOX - id: "E_Anchor" - pivot: PIVOT_E - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -20.0 - } - size { - x: 40.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_BOX - texture: "druid/rect_round2_width2" - id: "button" - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true - slice9 { - x: 5.0 - y: 5.0 - z: 5.0 - w: 5.0 - } -} -nodes { - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_BOX - texture: "druid/ui_circle_16" - id: "icon" - parent: "button" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - y: -20.0 - } - size { - x: 40.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected" - 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 diff --git a/druid/widget/properties_panel/properties/property_checkbox.lua b/druid/widget/properties_panel/properties/property_checkbox.lua deleted file mode 100644 index e091e8f..0000000 --- a/druid/widget/properties_panel/properties/property_checkbox.lua +++ /dev/null @@ -1,84 +0,0 @@ -local event = require("event.event") - ----@class druid.widget.property_checkbox: druid.widget ----@field root node ----@field druid druid.instance ----@field text_name druid.text ----@field button druid.button ----@field selected node -local M = {} - - -function M:init() - self.root = self:get_node("root") - - self.icon = self:get_node("icon") - gui.set_enabled(self.icon, false) - - self.selected = self:get_node("selected") - gui.set_alpha(self.selected, 0) - - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim", 0.3) - - self.button = self.druid:new_button("button", self.on_click) - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name") - self.container:add_container("E_Anchor") - - self.on_change_value = event.create() -end - - ----@param value boolean -function M:set_value(value, is_instant) - if self._value == value then - return - end - - self._value = value - gui.set_enabled(self.icon, value) - self.on_change_value:trigger(value) - - if not is_instant then - gui.set_alpha(self.selected, 1) - gui.animate(self.selected, "color.w", 0, gui.EASING_INSINE, 0.16) - end -end - - ----@return boolean -function M:get_value() - return self._value -end - - -function M:on_click() - self:set_value(not self:get_value()) -end - - ----Set the text property of the checkbox ----@param text string -function M:set_text_property(text) - self.text_name:set_text(text) -end - - ----Set the callback function for when the checkbox value changes ----@param callback function -function M:on_change(callback) - self.on_change_value:subscribe(callback) -end - - ----Set the enabled state of the checkbox ----@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 - - -return M diff --git a/druid/widget/properties_panel/properties/property_input.gui b/druid/widget/properties_panel/properties/property_input.gui deleted file mode 100644 index bb599c9..0000000 --- a/druid/widget/properties_panel/properties/property_input.gui +++ /dev/null @@ -1,152 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 350.0 - y: 50.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Input" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - size { - x: 200.0 - y: 40.0 - } - type: TYPE_BOX - id: "E_Anchor" - pivot: PIVOT_E - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -100.0 - } - type: TYPE_TEMPLATE - id: "rich_input" - parent: "E_Anchor" - inherit_alpha: true - template: "/druid/custom/rich_input/rich_input.gui" -} -nodes { - type: TYPE_BOX - id: "rich_input/root" - parent: "rich_input" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "rich_input/button" - parent: "rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "rich_input/placeholder_text" - parent: "rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "rich_input/input_text" - parent: "rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "rich_input/cursor_node" - parent: "rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "rich_input/cursor_text" - parent: "rich_input/cursor_node" - template_node_child: true -} -nodes { - position { - x: -100.0 - y: -20.0 - } - size { - x: 200.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected" - 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 diff --git a/druid/widget/properties_panel/properties/property_input.lua b/druid/widget/properties_panel/properties/property_input.lua deleted file mode 100644 index 76d1e96..0000000 --- a/druid/widget/properties_panel/properties/property_input.lua +++ /dev/null @@ -1,57 +0,0 @@ -local event = require("event.event") - ----@class druid.widget.property_input: druid.widget ----@field root node ----@field container druid.container ----@field text_name druid.text ----@field button druid.button ----@field druid druid.instance ----@field on_change_value event fun(text: string) -local M = {} - -function M:init() - self.root = self:get_node("root") - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim", 0.3) - - self.selected = self:get_node("selected") - gui.set_alpha(self.selected, 0) - - self.rich_input = self.druid:new_rich_input("rich_input") - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name") - self.container:add_container("E_Anchor") - - self.on_change_value = event.create() - - self.rich_input.input.on_input_unselect:subscribe(function(_, text) - self.on_change_value:trigger(text) - end) -end - - ----@param text string ----@return druid.widget.property_input -function M:set_text_property(text) - self.text_name:set_text(text) - return self -end - - ----@param text string|number ----@return druid.widget.property_input -function M:set_text_value(text) - self.rich_input:set_text(tostring(text)) - return self -end - - ----@param callback fun(self: druid.widget.property_input, text: string) ----@param callback_context any -function M:on_change(callback, callback_context) - self.rich_input.input.on_input_unselect:subscribe(callback, callback_context) -end - - -return M diff --git a/druid/widget/properties_panel/properties/property_left_right_selector.gui b/druid/widget/properties_panel/properties/property_left_right_selector.gui deleted file mode 100644 index 19c6a3d..0000000 --- a/druid/widget/properties_panel/properties/property_left_right_selector.gui +++ /dev/null @@ -1,226 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 360.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Left Right Selector" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - size { - x: 200.0 - y: 40.0 - } - type: TYPE_BOX - id: "E_Anchor" - pivot: PIVOT_E - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -180.0 - } - size { - x: 40.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_BOX - texture: "druid/rect_round2_width2" - id: "button_left" - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true - slice9 { - x: 5.0 - y: 5.0 - z: 5.0 - w: 5.0 - } -} -nodes { - rotation { - z: 180.0 - } - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_BOX - texture: "druid/icon_arrow" - id: "icon_left" - parent: "button_left" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - x: -20.0 - } - size { - x: 40.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_BOX - texture: "druid/rect_round2_width2" - id: "button_right" - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true - slice9 { - x: 5.0 - y: 5.0 - z: 5.0 - w: 5.0 - } -} -nodes { - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_BOX - texture: "druid/icon_arrow" - id: "icon_right" - parent: "button_right" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - x: -100.0 - y: -20.0 - } - size { - x: 120.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected" - pivot: PIVOT_S - adjust_mode: ADJUST_MODE_STRETCH - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true -} -nodes { - position { - x: -100.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 220.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "42" - font: "druid_text_bold" - id: "text_value" - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - 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 diff --git a/druid/widget/properties_panel/properties/property_left_right_selector.lua b/druid/widget/properties_panel/properties/property_left_right_selector.lua deleted file mode 100644 index 2f3dd5d..0000000 --- a/druid/widget/properties_panel/properties/property_left_right_selector.lua +++ /dev/null @@ -1,211 +0,0 @@ -local event = require("event.event") - ----@class druid.widget.property_left_right_selector: druid.widget ----@field root node ----@field druid druid.instance ----@field text_name druid.text ----@field button druid.button ----@field selected node ----@field value string|number ----@field on_change_value event fun(value: string|number) -local M = {} - - -function M:init() - self.root = self:get_node("root") - self.selected = self:get_node("selected") - gui.set_alpha(self.selected, 0) - - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim", 0.3) - - self.text_value = self.druid:new_text("text_value") - self.button_left = self.druid:new_button("button_left", self.on_button_left) - self.button_left.on_repeated_click:subscribe(self.on_button_left, self) - - self.button_right = self.druid:new_button("button_right", self.on_button_right) - self.button_right.on_repeated_click:subscribe(self.on_button_right, self) - - self.on_change_value = event.create() - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name") - self.container:add_container("E_Anchor") -end - - -function M:set_text(text) - self.text_name:set_text(text) - return self -end - - ----Helper to cycle number in range ----@param value number Current value ----@param min number Min range value ----@param max number Max range value ----@param step number Step size ----@param is_loop boolean Is looped ----@return number Cycled value -local function step_number(value, min, max, step, is_loop) - local range = max - min + 1 - if is_loop then - -- Normalize step within range - local effective_step = step - if math.abs(step) >= range then - effective_step = step % range - if effective_step == 0 then - effective_step = step > 0 and range or -range - end - end - - value = value + effective_step - -- Handle wrapping - if max then - while value > max do - value = min + (value - max - 1) - end - end - if min then - while value < min do - value = max - (min - value - 1) - end - end - else - -- Clamp values - value = value + step - if max and value > max then - return max - elseif min and value < min then - return min - end - end - return value -end - - ----Helper to cycle array index with proper step wrapping ----@param array table Array to cycle through ----@param current_value any Current value to find index for ----@param step number Step direction ----@param is_loop boolean If true, cycle values. If false, clamp at ends ----@return any Next value in cycle -local function step_array(array, current_value, step, is_loop) - local index = 1 - for i, v in ipairs(array) do - if v == current_value then - index = i - break - end - end - - if is_loop then - -- Normalize step within array length - local range = #array - local effective_step = step - if math.abs(step) >= range then - effective_step = step % range - if effective_step == 0 then - effective_step = step > 0 and range or -range - end - end - - index = index + effective_step - -- Handle wrapping - while index > range do - index = 1 + (index - range - 1) - end - while index < 1 do - index = range - (1 - index - 1) - end - else - -- Clamp values - index = index + step - if index > #array then - index = #array - elseif index < 1 then - index = 1 - end - end - - return array[index] -end - - -function M:on_button_left() - self:add_step(-1) -end - -function M:on_button_right() - self:add_step(1) -end - - ----@param koef number -1 0 1, on 0 will not move -function M:add_step(koef) - local array_type = self.array_type - if array_type then - local value = self.value - local new_value = step_array(array_type.array, value, koef * array_type.steps, array_type.is_loop) - self:set_value(new_value) - return - end - - - local number_type = self.number_type - if number_type then - local value = tonumber(self.value) --[[@as number]] - local new_value = step_number(value, number_type.min, number_type.max, koef * number_type.steps, number_type.is_loop) - self:set_value(new_value) - return - end -end - - -function M:set_number_type(min, max, is_loop, steps) - self.number_type = { - min = min, - max = max, - steps = steps or 1, - is_loop = is_loop, - } - - return self -end - - -function M:set_array_type(array, is_loop, steps) - self.array_type = { - array = array, - steps = steps or 1, - is_loop = is_loop, - } - - return self -end - - ----@param value string|number -function M:set_value(value, is_instant) - if self.value == value then - return - end - - self.value = value - self.text_value:set_text(tostring(value)) - self.on_change_value:trigger(value) - - if not is_instant then - gui.set_alpha(self.selected, 1) - gui.animate(self.selected, "color.w", 0, gui.EASING_INSINE, 0.16) - end -end - - ----@return string|number -function M:get_value() - return self.value -end - - -return M diff --git a/druid/widget/properties_panel/properties/property_slider.gui b/druid/widget/properties_panel/properties/property_slider.gui deleted file mode 100644 index 22b5b3b..0000000 --- a/druid/widget/properties_panel/properties/property_slider.gui +++ /dev/null @@ -1,236 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 380.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Slider" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - size { - x: 200.0 - y: 40.0 - } - type: TYPE_BOX - id: "E_Anchor" - pivot: PIVOT_E - adjust_mode: ADJUST_MODE_STRETCH - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -133.0 - } - size { - x: 134.0 - y: 40.0 - } - color { - x: 0.129 - y: 0.141 - z: 0.157 - } - type: TYPE_BOX - texture: "druid/empty" - id: "slider" - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true -} -nodes { - size { - x: 134.0 - y: 8.0 - } - color { - x: 0.129 - y: 0.141 - z: 0.157 - } - type: TYPE_BOX - texture: "druid/ui_circle_8" - id: "slider_back" - parent: "slider" - layer: "druid" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } -} -nodes { - position { - x: -55.0 - } - size { - x: 24.0 - y: 24.0 - } - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_BOX - texture: "druid/ui_circle_8" - id: "slider_pin" - parent: "slider" - layer: "druid" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } -} -nodes { - size { - x: 60.0 - y: 40.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_BOX - texture: "druid/rect_round2_width2" - id: "button" - pivot: PIVOT_E - parent: "E_Anchor" - layer: "druid" - inherit_alpha: true - slice9 { - x: 4.0 - y: 4.0 - z: 4.0 - w: 4.0 - } -} -nodes { - position { - y: -20.0 - } - size { - x: 60.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected" - pivot: PIVOT_SE - adjust_mode: ADJUST_MODE_STRETCH - parent: "button" - layer: "druid" - inherit_alpha: true -} -nodes { - position { - x: -30.0 - } - scale { - x: 0.55 - y: 0.55 - } - size { - x: 100.0 - y: 40.0 - } - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_TEXT - text: "25 %" - font: "druid_text_bold" - id: "text_value" - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - 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 diff --git a/druid/widget/properties_panel/properties/property_slider.lua b/druid/widget/properties_panel/properties/property_slider.lua deleted file mode 100644 index 38114b6..0000000 --- a/druid/widget/properties_panel/properties/property_slider.lua +++ /dev/null @@ -1,126 +0,0 @@ -local event = require("event.event") -local helper = require("druid.helper") - ----@class druid.widget.property_slider: druid.widget ----@field root node ----@field container druid.container ----@field druid druid.instance ----@field text_name druid.text ----@field text_value druid.text ----@field slider druid.slider ----@field on_change_value event fun(value:number) -local M = {} - - -function M:init() - self.root = self:get_node("root") - self.selected = self:get_node("selected") - gui.set_alpha(self.selected, 0) - self._value = 0 - - self.min = 0 - self.max = 1 - self.step = 0.01 - - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim", 0.3) - - self.text_value = self.druid:new_text("text_value") - self.slider = self.druid:new_slider("slider_pin", vmath.vector3(55, 0, 0), self.update_value) --[[@as druid.slider]] - self.slider:set_input_node("slider") - - self:set_text_function(function(value) - return math.floor(value * 100) .. "%" - end) - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name") - self.container:add_container("E_Anchor") - - self.on_change_value = event.create() -end - - ----@param callback fun(value:number):string -function M:set_text_function(callback) - self._text_function = callback - self.text_value:set_text(self._text_function(self._value)) -end - - ----Sets the text property of the slider ----@param text string -function M:set_text_property(text) - self.text_name:set_text(text) -end - - ----Sets the callback function for when the slider value changes ----@param callback fun(value:number) -function M:on_change(callback) - self.on_change_value:subscribe(callback) -end - - ----@param value number -function M:set_value(value, is_instant) - local diff = math.abs(self.max - self.min) - self.slider:set((value - self.min) / diff, true) - - local is_changed = self._value ~= value - if not is_changed then - return - end - - self._value = value - self.text_value:set_text(self._text_function(value)) - self.on_change_value:trigger(value) - - if not is_instant then - gui.set_alpha(self.selected, 1) - gui.animate(self.selected, "color.w", 0, gui.EASING_INSINE, 0.16) - end -end - - ----@return number -function M:get_value() - return self._value -end - - -function M:update_value(value) - local current_value = self._value - - local diff = math.abs(self.max - self.min) - -- [0..1] To range - value = value * diff + self.min - - -- Round to steps value (0.1, or 5. Should be divided on this value) - value = math.floor(value / self.step + 0.5) * self.step - - value = helper.clamp(value, self.min, self.max) - - self:set_value(value) -end - - -function M:set_number_type(min, max, step) - self.min = min or 0 - self.max = max or 1 - self.step = step - - self:set_text_function(function(value) - return tostring(value) - end) - - self:set_value(self._value, true) -end - - -function M:_on_slider_change_by_user(value) - self:set_value(value) -end - - -return M diff --git a/druid/widget/properties_panel/properties/property_text.gui b/druid/widget/properties_panel/properties/property_text.gui deleted file mode 100644 index f1a8937..0000000 --- a/druid/widget/properties_panel/properties/property_text.gui +++ /dev/null @@ -1,105 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 400.0 - y: 50.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Text" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 350.0 - y: 50.0 - } - color { - x: 0.722 - y: 0.741 - z: 0.761 - } - type: TYPE_TEXT - text: "Text" - font: "druid_text_bold" - id: "text_right" - pivot: PIVOT_E - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - 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 diff --git a/druid/widget/properties_panel/properties/property_text.lua b/druid/widget/properties_panel/properties/property_text.lua deleted file mode 100644 index ef2ed48..0000000 --- a/druid/widget/properties_panel/properties/property_text.lua +++ /dev/null @@ -1,42 +0,0 @@ ----@class druid.widget.property_text: druid.widget ----@field root node ----@field container druid.container ----@field text_name druid.text ----@field text_right druid.text -local M = {} - -function M:init() - self.root = self:get_node("root") - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim_left", 0.3) - - self.text_right = self.druid:new_text("text_right", "") - --:set_text_adjust("scale_then_trim_left", 0.3) -- TODO: not works? why? - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name", nil, function(_, size) - self.text_name:set_size(size) - end) - self.container:add_container("text_right", nil, function(_, size) - self.text_right:set_size(size) - end) -end - - ----@param text string ----@return druid.widget.property_text -function M:set_text_property(text) - self.text_name:set_text(text) - return self -end - - ----@param text string|nil ----@return druid.widget.property_text -function M:set_text_value(text) - self.text_right:set_text(text or "") - return self -end - - -return M diff --git a/druid/widget/properties_panel/properties/property_vector3.gui b/druid/widget/properties_panel/properties/property_vector3.gui deleted file mode 100644 index f5091e6..0000000 --- a/druid/widget/properties_panel/properties/property_vector3.gui +++ /dev/null @@ -1,507 +0,0 @@ -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -fonts { - name: "druid_text_regular" - font: "/druid/fonts/druid_text_regular.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 40.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "root" - adjust_mode: ADJUST_MODE_STRETCH - layer: "druid" - inherit_alpha: true - visible: false -} -nodes { - position { - x: -200.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 350.0 - y: 50.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Vector3" - font: "druid_text_bold" - id: "text_name" - pivot: PIVOT_W - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "root" - layer: "druid_text_bold" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: 200.0 - } - size { - x: 200.0 - y: 40.0 - } - type: TYPE_BOX - id: "E_Anchor" - pivot: PIVOT_E - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -200.0 - } - size { - x: 66.0 - y: 40.0 - } - type: TYPE_BOX - id: "field_x" - pivot: PIVOT_W - parent: "E_Anchor" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: 7.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 30.0 - y: 40.0 - } - color { - x: 0.31 - y: 0.318 - z: 0.322 - } - type: TYPE_TEXT - text: "X" - 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 -} -nodes { - position { - x: 40.0 - } - type: TYPE_TEMPLATE - id: "rich_input_x" - parent: "field_x" - inherit_alpha: true - template: "/druid/custom/rich_input/rich_input.gui" -} -nodes { - size { - x: 50.0 - y: 40.0 - } - type: TYPE_BOX - id: "rich_input_x/root" - parent: "rich_input_x" - overridden_fields: 4 - template_node_child: true -} -nodes { - size { - x: 50.0 - y: 40.0 - } - type: TYPE_BOX - id: "rich_input_x/button" - parent: "rich_input_x/root" - overridden_fields: 4 - template_node_child: true -} -nodes { - size { - x: 70.0 - y: 50.0 - } - type: TYPE_TEXT - id: "rich_input_x/placeholder_text" - parent: "rich_input_x/root" - overridden_fields: 4 - overridden_fields: 8 - template_node_child: true -} -nodes { - size { - x: 70.0 - y: 50.0 - } - type: TYPE_TEXT - text: "20" - id: "rich_input_x/input_text" - parent: "rich_input_x/root" - overridden_fields: 4 - overridden_fields: 8 - template_node_child: true -} -nodes { - position { - x: 18.0 - } - type: TYPE_BOX - id: "rich_input_x/cursor_node" - parent: "rich_input_x/root" - overridden_fields: 1 - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "rich_input_x/cursor_text" - parent: "rich_input_x/cursor_node" - template_node_child: true -} -nodes { - position { - x: 40.0 - y: -20.0 - } - size { - x: 50.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected_x" - pivot: PIVOT_S - adjust_mode: ADJUST_MODE_STRETCH - parent: "field_x" - layer: "druid" - inherit_alpha: true -} -nodes { - position { - x: -132.0 - } - size { - x: 66.0 - y: 40.0 - } - type: TYPE_BOX - id: "field_y" - pivot: PIVOT_W - parent: "E_Anchor" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: 7.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 30.0 - y: 40.0 - } - color { - x: 0.31 - y: 0.318 - z: 0.322 - } - type: TYPE_TEXT - text: "Y" - 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 -} -nodes { - position { - x: 40.0 - } - type: TYPE_TEMPLATE - id: "rich_input_y" - parent: "field_y" - inherit_alpha: true - template: "/druid/custom/rich_input/rich_input.gui" -} -nodes { - size { - x: 50.0 - y: 40.0 - } - type: TYPE_BOX - id: "rich_input_y/root" - parent: "rich_input_y" - overridden_fields: 4 - template_node_child: true -} -nodes { - size { - x: 50.0 - y: 40.0 - } - type: TYPE_BOX - id: "rich_input_y/button" - parent: "rich_input_y/root" - overridden_fields: 4 - template_node_child: true -} -nodes { - size { - x: 70.0 - y: 50.0 - } - type: TYPE_TEXT - id: "rich_input_y/placeholder_text" - parent: "rich_input_y/root" - overridden_fields: 4 - overridden_fields: 8 - template_node_child: true -} -nodes { - size { - x: 70.0 - y: 50.0 - } - type: TYPE_TEXT - text: "20" - id: "rich_input_y/input_text" - parent: "rich_input_y/root" - overridden_fields: 4 - overridden_fields: 8 - template_node_child: true -} -nodes { - position { - x: 18.0 - } - type: TYPE_BOX - id: "rich_input_y/cursor_node" - parent: "rich_input_y/root" - overridden_fields: 1 - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "rich_input_y/cursor_text" - parent: "rich_input_y/cursor_node" - template_node_child: true -} -nodes { - position { - x: 40.0 - y: -20.0 - } - size { - x: 50.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected_y" - pivot: PIVOT_S - adjust_mode: ADJUST_MODE_STRETCH - parent: "field_y" - layer: "druid" - inherit_alpha: true -} -nodes { - position { - x: -66.0 - } - size { - x: 66.0 - y: 40.0 - } - type: TYPE_BOX - id: "field_z" - pivot: PIVOT_W - parent: "E_Anchor" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: 7.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 30.0 - y: 40.0 - } - color { - x: 0.31 - y: 0.318 - z: 0.322 - } - type: TYPE_TEXT - text: "Z" - 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 -} -nodes { - position { - x: 40.0 - } - type: TYPE_TEMPLATE - id: "rich_input_z" - parent: "field_z" - inherit_alpha: true - template: "/druid/custom/rich_input/rich_input.gui" -} -nodes { - size { - x: 50.0 - y: 40.0 - } - type: TYPE_BOX - id: "rich_input_z/root" - parent: "rich_input_z" - overridden_fields: 4 - template_node_child: true -} -nodes { - size { - x: 50.0 - y: 40.0 - } - type: TYPE_BOX - id: "rich_input_z/button" - parent: "rich_input_z/root" - overridden_fields: 4 - template_node_child: true -} -nodes { - size { - x: 70.0 - y: 50.0 - } - type: TYPE_TEXT - id: "rich_input_z/placeholder_text" - parent: "rich_input_z/root" - overridden_fields: 4 - overridden_fields: 8 - template_node_child: true -} -nodes { - size { - x: 70.0 - y: 50.0 - } - type: TYPE_TEXT - text: "20" - id: "rich_input_z/input_text" - parent: "rich_input_z/root" - overridden_fields: 4 - overridden_fields: 8 - template_node_child: true -} -nodes { - position { - x: 18.0 - } - type: TYPE_BOX - id: "rich_input_z/cursor_node" - parent: "rich_input_z/root" - overridden_fields: 1 - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "rich_input_z/cursor_text" - parent: "rich_input_z/cursor_node" - template_node_child: true -} -nodes { - position { - x: 40.0 - y: -20.0 - } - size { - x: 50.0 - y: 4.0 - } - color { - x: 0.894 - y: 0.506 - z: 0.333 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "selected_z" - 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 diff --git a/druid/widget/properties_panel/properties/property_vector3.lua b/druid/widget/properties_panel/properties/property_vector3.lua deleted file mode 100644 index 820ccbd..0000000 --- a/druid/widget/properties_panel/properties/property_vector3.lua +++ /dev/null @@ -1,75 +0,0 @@ -local event = require("event.event") - - ----@class druid.widget.property_vector3: druid.widget ----@field root node ----@field container druid.container ----@field text_name druid.text ----@field button druid.button ----@field druid druid.instance -local M = {} - -function M:init() - self.root = self:get_node("root") - self.text_name = self.druid:new_text("text_name") - :set_text_adjust("scale_then_trim", 0.3) - - self.selected_x = self:get_node("selected_x") - gui.set_alpha(self.selected_x, 0) - - self.selected_y = self:get_node("selected_y") - gui.set_alpha(self.selected_y, 0) - - self.selected_z = self:get_node("selected_z") - gui.set_alpha(self.selected_z, 0) - - self.rich_input_x = self.druid:new_rich_input("rich_input_x") - self.rich_input_y = self.druid:new_rich_input("rich_input_y") - self.rich_input_z = self.druid:new_rich_input("rich_input_z") - - self.value = vmath.vector3(0) - - self.rich_input_x.input.on_input_unselect:subscribe(function() - self.value.x = tonumber(self.rich_input_x.input:get_text()) or 0 - self.on_change:trigger(self.value) - end) - - self.rich_input_y.input.on_input_unselect:subscribe(function() - self.value.y = tonumber(self.rich_input_y.input:get_text()) or 0 - self.on_change:trigger(self.value) - end) - - self.rich_input_z.input.on_input_unselect:subscribe(function() - self.value.z = tonumber(self.rich_input_z.input:get_text()) or 0 - self.on_change:trigger(self.value) - end) - - self.container = self.druid:new_container(self.root) - self.container:add_container("text_name") - self.container:add_container("E_Anchor") - - self.on_change = event.create() -end - - ----@param text string ----@return druid.widget.property_vector3 -function M:set_text_property(text) - self.text_name:set_text(text) - return self -end - - ----@param x number ----@param y number ----@param z number ----@return druid.widget.property_vector3 -function M:set_value(x, y, z) - self.rich_input_x:set_text(tostring(x)) - self.rich_input_y:set_text(tostring(y)) - self.rich_input_z:set_text(tostring(z)) - return self -end - - -return M diff --git a/druid/widget/properties_panel/properties_panel.gui b/druid/widget/properties_panel/properties_panel.gui deleted file mode 100644 index 9f801af..0000000 --- a/druid/widget/properties_panel/properties_panel.gui +++ /dev/null @@ -1,843 +0,0 @@ -fonts { - name: "druid_text_regular" - font: "/druid/fonts/druid_text_regular.font" -} -fonts { - name: "druid_text_bold" - font: "/druid/fonts/druid_text_bold.font" -} -textures { - name: "druid" - texture: "/druid/druid.atlas" -} -nodes { - size { - x: 400.0 - y: 400.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/ui_circle_16" - id: "root" - pivot: PIVOT_N - layer: "druid" - inherit_alpha: true - slice9 { - x: 8.0 - y: 8.0 - z: 8.0 - w: 8.0 - } -} -nodes { - position { - x: 200.0 - } - size { - x: 400.0 - y: 40.0 - } - color { - x: 0.173 - y: 0.184 - z: 0.204 - } - type: TYPE_BOX - texture: "druid/ui_circle_16" - id: "header" - pivot: PIVOT_NE - parent: "root" - layer: "druid" - inherit_alpha: true - slice9 { - x: 8.0 - y: 8.0 - z: 8.0 - w: 8.0 - } -} -nodes { - position { - x: -392.0 - y: -8.0 - } - scale { - x: 0.5 - y: 0.5 - } - size { - x: 500.0 - y: 50.0 - } - color { - x: 0.463 - y: 0.475 - z: 0.49 - } - type: TYPE_TEXT - text: "Properties" - font: "druid_text_regular" - id: "text_header" - pivot: PIVOT_NW - outline { - x: 1.0 - y: 1.0 - z: 1.0 - } - shadow { - x: 1.0 - y: 1.0 - z: 1.0 - } - parent: "header" - layer: "druid_text_regular" - inherit_alpha: true - outline_alpha: 0.0 - shadow_alpha: 0.0 -} -nodes { - position { - x: -8.0 - y: -4.0 - } - color { - x: 0.306 - y: 0.31 - z: 0.314 - } - type: TYPE_BOX - texture: "druid/icon_drag" - id: "icon_drag" - pivot: PIVOT_NE - parent: "header" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - x: -48.0 - y: -4.0 - } - color { - x: 0.306 - y: 0.31 - z: 0.314 - } - type: TYPE_BOX - texture: "druid/icon_refresh" - id: "icon_refresh" - pivot: PIVOT_NE - parent: "header" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - x: -88.0 - y: -4.0 - } - scale { - x: -1.0 - } - color { - x: 0.306 - y: 0.31 - z: 0.314 - } - type: TYPE_BOX - texture: "druid/icon_arrow" - id: "icon_back" - pivot: PIVOT_NW - parent: "header" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO -} -nodes { - position { - y: -50.0 - } - size { - x: 400.0 - y: 350.0 - } - type: TYPE_BOX - id: "content" - pivot: PIVOT_N - parent: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - position { - x: -200.0 - } - size { - x: 400.0 - y: 350.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "scroll_view" - xanchor: XANCHOR_LEFT - pivot: PIVOT_NW - adjust_mode: ADJUST_MODE_STRETCH - parent: "content" - layer: "druid" - inherit_alpha: true -} -nodes { - size { - x: 400.0 - y: 350.0 - } - type: TYPE_BOX - texture: "druid/pixel" - id: "scroll_content" - pivot: PIVOT_NW - adjust_mode: ADJUST_MODE_STRETCH - parent: "scroll_view" - layer: "druid" - inherit_alpha: true - slice9 { - x: 8.0 - y: 8.0 - w: 6.0 - } - visible: false -} -nodes { - position { - y: -10.0 - } - type: TYPE_BOX - texture: "druid/empty" - id: "propeties" - parent: "content" - layer: "druid" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - type: TYPE_TEMPLATE - id: "property_slider" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_slider.gui" -} -nodes { - type: TYPE_BOX - id: "property_slider/root" - parent: "property_slider" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_slider/text_name" - parent: "property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/E_Anchor" - parent: "property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/slider" - parent: "property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/slider_back" - parent: "property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/slider_pin" - parent: "property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/button" - parent: "property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/selected" - parent: "property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_slider/text_value" - parent: "property_slider/button" - template_node_child: true -} -nodes { - position { - y: -50.0 - } - type: TYPE_TEMPLATE - id: "property_checkbox" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_checkbox.gui" -} -nodes { - type: TYPE_BOX - id: "property_checkbox/root" - parent: "property_checkbox" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_checkbox/text_name" - parent: "property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/E_Anchor" - parent: "property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/button" - parent: "property_checkbox/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/icon" - parent: "property_checkbox/button" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/selected" - parent: "property_checkbox/button" - template_node_child: true -} -nodes { - position { - y: -100.0 - } - type: TYPE_TEMPLATE - id: "property_button" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_button.gui" -} -nodes { - type: TYPE_BOX - id: "property_button/root" - parent: "property_button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_button/text_name" - parent: "property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_button/E_Anchor" - parent: "property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_button/button" - parent: "property_button/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_button/selected" - parent: "property_button/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_button/text_button" - parent: "property_button/button" - template_node_child: true -} -nodes { - position { - y: -150.0 - } - type: TYPE_TEMPLATE - id: "property_input" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_input.gui" -} -nodes { - type: TYPE_BOX - id: "property_input/root" - parent: "property_input" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/text_name" - parent: "property_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/E_Anchor" - parent: "property_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "property_input/rich_input" - parent: "property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/rich_input/root" - parent: "property_input/rich_input" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/rich_input/button" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/rich_input/placeholder_text" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/rich_input/input_text" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/rich_input/cursor_node" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/rich_input/cursor_text" - parent: "property_input/rich_input/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/selected" - parent: "property_input/E_Anchor" - template_node_child: true -} -nodes { - position { - y: -200.0 - } - type: TYPE_TEMPLATE - id: "property_text" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_text.gui" -} -nodes { - type: TYPE_BOX - id: "property_text/root" - parent: "property_text" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_text/text_name" - parent: "property_text/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_text/text_right" - parent: "property_text/root" - template_node_child: true -} -nodes { - position { - y: -250.0 - } - type: TYPE_TEMPLATE - id: "property_left_right_selector" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_left_right_selector.gui" -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/root" - parent: "property_left_right_selector" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_left_right_selector/text_name" - parent: "property_left_right_selector/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/E_Anchor" - parent: "property_left_right_selector/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/button_left" - parent: "property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/icon_left" - parent: "property_left_right_selector/button_left" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/button_right" - parent: "property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/icon_right" - parent: "property_left_right_selector/button_right" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_left_right_selector/selected" - parent: "property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_left_right_selector/text_value" - parent: "property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - position { - y: -300.0 - } - type: TYPE_TEMPLATE - id: "property_vector3" - parent: "propeties" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_vector3.gui" -} -nodes { - type: TYPE_BOX - id: "property_vector3/root" - parent: "property_vector3" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/text_name" - parent: "property_vector3/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/E_Anchor" - parent: "property_vector3/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/field_x" - parent: "property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/text_x" - parent: "property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "property_vector3/rich_input_x" - parent: "property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_x/root" - parent: "property_vector3/rich_input_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_x/button" - parent: "property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_x/placeholder_text" - parent: "property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_x/input_text" - parent: "property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_x/cursor_node" - parent: "property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_x/cursor_text" - parent: "property_vector3/rich_input_x/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/selected_x" - parent: "property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/field_y" - parent: "property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/text_y" - parent: "property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "property_vector3/rich_input_y" - parent: "property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_y/root" - parent: "property_vector3/rich_input_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_y/button" - parent: "property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_y/placeholder_text" - parent: "property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_y/input_text" - parent: "property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_y/cursor_node" - parent: "property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_y/cursor_text" - parent: "property_vector3/rich_input_y/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/selected_y" - parent: "property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/field_z" - parent: "property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/text_z" - parent: "property_vector3/field_z" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "property_vector3/rich_input_z" - parent: "property_vector3/field_z" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_z/root" - parent: "property_vector3/rich_input_z" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_z/button" - parent: "property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_z/placeholder_text" - parent: "property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_z/input_text" - parent: "property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/rich_input_z/cursor_node" - parent: "property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_vector3/rich_input_z/cursor_text" - parent: "property_vector3/rich_input_z/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_vector3/selected_z" - 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 diff --git a/druid/widget/properties_panel/properties_panel.lua b/druid/widget/properties_panel/properties_panel.lua deleted file mode 100644 index 25ff9a1..0000000 --- a/druid/widget/properties_panel/properties_panel.lua +++ /dev/null @@ -1,580 +0,0 @@ -local event = require("event.event") - -local color = require("druid.color") -local helper = require("druid.helper") -local property_checkbox = require("druid.widget.properties_panel.properties.property_checkbox") -local property_slider = require("druid.widget.properties_panel.properties.property_slider") -local property_button = require("druid.widget.properties_panel.properties.property_button") -local property_input = require("druid.widget.properties_panel.properties.property_input") -local property_text = require("druid.widget.properties_panel.properties.property_text") -local property_left_right_selector = require("druid.widget.properties_panel.properties.property_left_right_selector") -local property_vector3 = require("druid.widget.properties_panel.properties.property_vector3") - ----@class druid.widget.properties_panel: druid.widget ----@field root node ----@field scroll druid.scroll ----@field layout druid.layout ----@field container druid.container ----@field container_content druid.container ----@field container_scroll_view druid.container ----@field contaienr_scroll_content druid.container ----@field button_hidden druid.button ----@field text_header druid.text ----@field paginator druid.widget.property_left_right_selector ----@field properties druid.widget[] List of created properties ----@field properties_constructors fun()[] List of properties functions to create a new widget. Used to not spawn non-visible widgets but keep the reference -local M = {} - -local COLOR_BUTTON = "#4E4F50" -local COLOR_REFRESH_ACTIVE = "#8BD092" - -function M:init() - self.root = self:get_node("root") - self.scale_root = gui.get_scale(self.root) - self.content = self:get_node("content") - - self.container = self.druid:new_container(self.root) - self.container:add_container("header") - self.container_content = self.container:add_container("content") - self.container_scroll_view = self.container_content:add_container("scroll_view") - self.contaienr_scroll_content = self.container_scroll_view:add_container("scroll_content") - - self.default_size = self.container:get_size() - self.header_size = gui.get_size(self:get_node("header")) - - -- To have ability to go back to previous scene, collections of all properties to rebuild - self.scenes = {} - - self.properties = {} - self.properties_constructors = {} - self.current_page = 1 - self.properties_per_page = 15 - - self.text_header = self.druid:new_text("text_header") - self.scroll = self.druid:new_scroll("scroll_view", "scroll_content") - self.layout = self.druid:new_layout("scroll_content", "vertical") - :set_hug_content(false, true) - :set_padding(nil, 0) - - self.layout.on_size_changed:subscribe(self.on_size_changed, self) - - self.druid:new_drag("header", self.on_drag_widget) - self.button_hidden = self.druid:new_button("icon_drag", function() - self:set_hidden(not self._is_hidden) - end):set_style(nil) - - self.button_back = self.druid:new_button("icon_back", function() - self:previous_scene() - end) - gui.set_enabled(self.button_back.node, false) - - self.button_refresh = self.druid:new_button("icon_refresh", function() - self:toggle_auto_refresh() - end) - - -- We not using as a part of properties, since it handled in a way to be paginable - self.paginator = self.druid:new_widget(property_left_right_selector, "property_left_right_selector", "root") - self.paginator:set_text("Page") - self.paginator:set_number_type(1, 1, true) - self.paginator:set_value(self.current_page) - self.paginator.on_change_value:subscribe(function(value) - self:set_page(value) - end) - local width = self.layout:get_content_size() - self.paginator.container:set_size(width) - - gui.set_enabled(self.paginator.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_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) - gui.set_enabled(self:get_node("property_vector3/root"), false) -end - - -function M:on_remove() - self:clear() -end - - -function M:toggle_auto_refresh() - self._is_auto_refresh = not self._is_auto_refresh - - if self._is_auto_refresh then - self.is_dirty = true - color.set_color(self.button_refresh.node, COLOR_REFRESH_ACTIVE) - self._timer_refresh = timer.delay(1, true, function() - self.is_dirty = true - end) - else - color.set_color(self.button_refresh.node, COLOR_BUTTON) - timer.cancel(self._timer_refresh) - self._timer_refresh = nil - end -end - - -function M:on_drag_widget(dx, dy) - local position = self.container:get_position() - self.container:set_position(position.x + dx * self.scale_root.x, position.y + dy * self.scale_root.y) -end - - -function M:clear_created_properties() - for index = 1, #self.properties do - local property = self.properties[index] - local root = property.root --[[@as node]] - - if root then - -- If prefab used clone nodes we can remove it - if property:get_nodes() then - gui.delete_node(root) - else - -- Probably we have component placed on scene directly - gui.set_enabled(root, false) - end - end - - self.druid:remove(self.properties[index]) - end - self.properties = {} - - self.layout:clear_layout() - - -- Use paginator as "pinned" widget - self.layout:add(self.paginator.root) -end - - -function M:next_scene() - local scene = { - header = self.text_header:get_text(), - current_page = self.current_page, - } - - helper.add_array(scene, self.properties_constructors) - table.insert(self.scenes, scene) - - self:clear() - - self.is_dirty = true - - gui.set_enabled(self.button_back.node, #self.scenes > 0) -end - - -function M:previous_scene() - local scene = table.remove(self.scenes) - self:clear() - helper.add_array(self.properties_constructors, scene) - - self.text_header:set_text(scene.header) - self.current_page = scene.current_page - - self.is_dirty = true - - gui.set_enabled(self.button_back.node, #self.scenes > 0) -end - - -function M:clear() - self:clear_created_properties() - self.properties_constructors = {} - self.current_page = 1 -end - - -function M:on_size_changed(new_size) - self.container_content:set_size(new_size.x, new_size.y, gui.PIVOT_N) - - self.default_size = vmath.vector3(new_size.x, new_size.y + 50, 0) - if not self._is_hidden then - self.container:set_size(self.default_size.x, self.default_size.y, gui.PIVOT_N) - end - - local width = self.layout:get_size().x - self.layout.padding.x - self.layout.padding.z - for index = 1, #self.properties do - local property = self.properties[index] - local container = property.container --[[@as druid.container]] - if container then - container:set_size(width) - end - end - self.paginator.container:set_size(width) -end - - -function M:update(dt) - if not self.is_dirty then - return - end - - self.is_dirty = false - - self:clear_created_properties() - - local properties_count = #self.properties_constructors - - -- Render all current properties - local start_index = (self.current_page - 1) * self.properties_per_page + 1 - local end_index = start_index + self.properties_per_page - 1 - end_index = math.min(end_index, properties_count) - - local is_paginator_visible = properties_count > self.properties_per_page - gui.set_enabled(self.paginator.root, is_paginator_visible) - self.paginator:set_number_type(1, math.ceil(properties_count / self.properties_per_page), true) - self.paginator.text_value:set_text(self.current_page .. " / " .. math.ceil(properties_count / self.properties_per_page)) - - for index = start_index, end_index do - self.properties_constructors[index]() - end -end - - ----@param on_create fun(checkbox: druid.widget.property_checkbox)|nil ----@return druid.widget.properties_panel -function M:add_checkbox(on_create) - return self:add_inner_widget(property_checkbox, "property_checkbox", "root", on_create) -end - - ----@param on_create fun(slider: druid.widget.property_slider)|nil ----@return druid.widget.properties_panel -function M:add_slider(on_create) - return self:add_inner_widget(property_slider, "property_slider", "root", on_create) -end - - ----@param on_create fun(button: druid.widget.property_button)|nil ----@return druid.widget.properties_panel -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 -function M:add_input(on_create) - return self:add_inner_widget(property_input, "property_input", "root", on_create) -end - - ----@param on_create fun(text: druid.widget.property_text)|nil -function M:add_text(on_create) - return self:add_inner_widget(property_text, "property_text", "root", on_create) -end - - ----@param on_create fun(selector: druid.widget.property_left_right_selector)|nil -function M:add_left_right_selector(on_create) - return self:add_inner_widget(property_left_right_selector, "property_left_right_selector", "root", on_create) -end - - ----@param on_create fun(vector3: druid.widget.property_vector3)|nil -function M:add_vector3(on_create) - return self:add_inner_widget(property_vector3, "property_vector3", "root", on_create) -end - - ----@generic T: druid.widget ----@param widget_class T ----@param template string|nil ----@param nodes table|string|node|nil ----@param on_create fun(widget: T)|nil ----@return druid.widget.properties_panel -function M:add_inner_widget(widget_class, template, nodes, on_create) - table.insert(self.properties_constructors, function() - local widget = self.druid:new_widget(widget_class, template, nodes) - - self:add_property(widget) - if on_create then - on_create(widget) - end - end) - - self.is_dirty = true - - return self -end - - ----@param create_widget_callback fun(): druid.widget ----@return druid.widget.properties_panel -function M:add_widget(create_widget_callback) - table.insert(self.properties_constructors, function() - local widget = create_widget_callback() - self:add_property(widget) - end) - - self.is_dirty = true - - return self -end - - ----@private -function M:create_from_prefab(widget_class, template, nodes) - return self:add_property(self.druid:new_widget(widget_class, template, nodes)) -end - - ----@private -function M:add_property(widget) - gui.set_enabled(widget.root, true) - table.insert(self.properties, widget) - local width = self.layout:get_content_size() - widget.container:set_size(width) - - self.layout:add(widget.root) - - return widget -end - - -function M:remove(widget) - for index = 1, #self.properties do - if self.properties[index] == widget then - self.druid:remove(widget) - self.layout:remove(widget.root) - - -- If prefab used clone nodes we can remove it - if widget:get_nodes() then - gui.delete_node(widget.root) - else - -- Probably we have component placed on scene directly - gui.set_enabled(widget.root, false) - end - - table.remove(self.properties, index) - break - end - end -end - - ----Force to refresh properties next update -function M:set_dirty() - self.is_dirty = true -end - - -function M:set_hidden(is_hidden) - self._is_hidden = is_hidden - local node_header = self:get_node("header") - - local new_size = self._is_hidden and self.header_size or self.default_size - self.container:set_size(new_size.x, new_size.y, gui.PIVOT_N) - - local hidden_width = self.header_size.y + 8 - gui.set(node_header, "size.x", self._is_hidden and hidden_width or self.header_size.x) - - gui.set_visible(node_header, self._is_hidden) - gui.set_visible(self.root, 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.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 - end -end - - -function M:is_hidden() - return self._is_hidden -end - - -function M:load_previous_page() - self.current_page = self.current_page - 1 - self.is_dirty = true -end - - ----@param properties_per_page number -function M:set_properties_per_page(properties_per_page) - self.properties_per_page = properties_per_page -end - - ----Set a page of current scene ----@param page number -function M:set_page(page) - self.current_page = page - self.is_dirty = true -end - - ----Set a text at left top corner of the properties panel ----@param header string -function M:set_header(header) - self.text_header:set_text(header) -end - - ----@param data table -function M:render_lua_table(data) - local component_order = {} - for component_id in pairs(data) do - table.insert(component_order, component_id) - end - table.sort(component_order, function(a, b) - local a_type = type(data[a]) - local b_type = type(data[b]) - if a_type ~= b_type then - return a_type < b_type - end - if type(a) == "number" and type(b) == "number" then - return a < b - end - return tostring(a) < tostring(b) - end) - - for i = 1, #component_order do - local component_id = component_order[i] - self:add_property_component(component_id, data) - end - - local metatable = getmetatable(data) - if metatable and metatable.__index and type(metatable.__index) == "table" then - local metatable_order = {} - for key in pairs(metatable.__index) do - table.insert(metatable_order, key) - end - table.sort(metatable_order) - - for i = 1, #metatable_order do - local component_id = metatable_order[i] - local component = metatable.__index[component_id] - self:add_property_component("M:" .. component_id, data) - end - end -end - - ----@private ----@param component_id string ----@param data table -function M:add_property_component(component_id, data) - local component = data[component_id] - local component_type = type(component) - - if component_type == "table" then - local is_event = event.is_event(component) - if is_event then - self:add_button(function(button) - button:set_text_property(tostring(component_id)) - button:set_text_button("Call Event (" .. #component .. ")") - button.button.on_click:subscribe(function() - component:trigger() - end) - end) - else - self:add_button(function(button) - local is_empty = next(component) == nil - local is_array = component[1] ~= nil - local name = "Inspect" - if is_empty then - name = "Inspect (Empty)" - end - if is_array then - name = "Inspect (" .. #component .. ")" - end - - local button_name = component_id - -- If it's a number or array, try to get the id/name/prefab_id from the component - if type(component) == "table" and type(component_id) == "number" then - local extracted_id = component.name or component.prefab_id or component.node_id or component.id - if extracted_id then - button_name = component_id .. ". " .. extracted_id - end - end - - button:set_text_property(button_name) - button:set_text_button(name) - button.button.on_click:subscribe(function() - self:next_scene() - self:set_header(button_name) - self:render_lua_table(component) - end) - end) - end - end - - if component_type == "string" then - self:add_input(function(input) - input:set_text_property(tostring(component_id)) - input:set_text_value(tostring(data[component_id])) - input:on_change(function(_, value) - data[component_id] = value - end) - end) - end - - if component_type == "number" then - self:add_input(function(input) - input:set_text_property(tostring(component_id)) - input:set_text_value(tostring(helper.round(data[component_id], 3))) - input:on_change(function(_, value) - data[component_id] = tonumber(value) - end) - end) - end - - if component_type == "boolean" then - self:add_checkbox(function(checkbox) - checkbox:set_text_property(tostring(component_id)) - checkbox:set_value(data[component_id]) - checkbox:on_change(function(value) - data[component_id] = value - end) - end) - end - - if component_type == "userdata" then - if types.is_vector3(component) then - ---@cast component vector3 - self:add_vector3(function(vector3) - vector3:set_text_property(tostring(component_id)) - vector3:set_value(data[component_id].x, data[component_id].y, data[component_id].z) - vector3.on_change:subscribe(function(value) - data[component_id].x = value.x - data[component_id].y = value.y - data[component_id].z = value.z - end) - end) - else - self:add_text(function(text) - text:set_text_property(tostring(component_id)) - text:set_text_value(tostring(data[component_id])) - end) - end - end - - if component_type == "function" then - self:add_button(function(button) - button:set_text_property(tostring(component_id)) - button:set_text_button("Call") - button.button.on_click:subscribe(function() - component(data) - end) - end) - end -end - - - -return M diff --git a/example/druid.gui b/example/druid.gui index 54017d6..711500b 100644 --- a/example/druid.gui +++ b/example/druid.gui @@ -3815,1092 +3815,6 @@ nodes { parent: "hover_hint_example/root" template_node_child: true } -nodes { - position { - x: -200.0 - } - type: TYPE_TEMPLATE - id: "property_button" - parent: "widgets" - inherit_alpha: true - template: "/example/components/properties_panel/properties/property_button.gui" -} -nodes { - type: TYPE_BOX - id: "property_button/root" - parent: "property_button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_button/text_name" - parent: "property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_button/button" - parent: "property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_button/selected" - parent: "property_button/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_button/text_button" - parent: "property_button/button" - template_node_child: true -} -nodes { - position { - x: -200.0 - } - type: TYPE_TEMPLATE - id: "property_checkbox" - parent: "widgets" - inherit_alpha: true - template: "/example/components/properties_panel/properties/property_checkbox.gui" -} -nodes { - type: TYPE_BOX - id: "property_checkbox/root" - parent: "property_checkbox" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_checkbox/text_name" - parent: "property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/button" - parent: "property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/icon" - parent: "property_checkbox/button" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_checkbox/selected" - parent: "property_checkbox/button" - template_node_child: true -} -nodes { - position { - x: -200.0 - } - type: TYPE_TEMPLATE - id: "property_slider" - parent: "widgets" - inherit_alpha: true - template: "/example/components/properties_panel/properties/property_slider.gui" -} -nodes { - type: TYPE_BOX - id: "property_slider/root" - parent: "property_slider" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_slider/text_name" - parent: "property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/E_Anchor" - parent: "property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/button" - parent: "property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/selected" - parent: "property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_slider/text_value" - parent: "property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/slider" - parent: "property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/slider_back" - parent: "property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_slider/slider_pin" - parent: "property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "fps_panel" - parent: "widgets" - inherit_alpha: true - template: "/druid/widget/fps_panel/fps_panel.gui" -} -nodes { - type: TYPE_BOX - id: "fps_panel/root" - parent: "fps_panel" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "fps_panel/mini_graph" - parent: "fps_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/root" - parent: "fps_panel/mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/header" - parent: "fps_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/mini_graph/text_header" - parent: "fps_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/icon_drag" - parent: "fps_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/content" - parent: "fps_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/prefab_line" - parent: "fps_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/color_low" - parent: "fps_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/content" - parent: "fps_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/text_min_fps" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/text_fps" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/line_second_1" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/line_second_2" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel" - parent: "widgets" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties_panel.gui" -} -nodes { - type: TYPE_BOX - id: "properties_panel/root" - parent: "properties_panel" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/header" - parent: "properties_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/text_header" - parent: "properties_panel/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/icon_drag" - parent: "properties_panel/header" - 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 { - type: TYPE_BOX - id: "properties_panel/content" - parent: "properties_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/scroll_view" - parent: "properties_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/scroll_content" - parent: "properties_panel/scroll_view" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/propeties" - parent: "properties_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_slider" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/root" - parent: "properties_panel/property_slider" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_slider/text_name" - parent: "properties_panel/property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/E_Anchor" - parent: "properties_panel/property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/slider" - parent: "properties_panel/property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/slider_back" - parent: "properties_panel/property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/slider_pin" - parent: "properties_panel/property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/button" - parent: "properties_panel/property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/selected" - parent: "properties_panel/property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_slider/text_value" - parent: "properties_panel/property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_checkbox" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/root" - parent: "properties_panel/property_checkbox" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_checkbox/text_name" - parent: "properties_panel/property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/E_Anchor" - parent: "properties_panel/property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/button" - parent: "properties_panel/property_checkbox/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/icon" - parent: "properties_panel/property_checkbox/button" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/selected" - parent: "properties_panel/property_checkbox/button" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_button" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/root" - parent: "properties_panel/property_button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_button/text_name" - parent: "properties_panel/property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/E_Anchor" - parent: "properties_panel/property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/button" - parent: "properties_panel/property_button/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/selected" - parent: "properties_panel/property_button/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_button/text_button" - parent: "properties_panel/property_button/button" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_input" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/root" - parent: "properties_panel/property_input" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/text_name" - parent: "properties_panel/property_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/E_Anchor" - parent: "properties_panel/property_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_input/rich_input" - parent: "properties_panel/property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/rich_input/root" - parent: "properties_panel/property_input/rich_input" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/rich_input/button" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/rich_input/placeholder_text" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/rich_input/input_text" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/rich_input/cursor_node" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/rich_input/cursor_text" - parent: "properties_panel/property_input/rich_input/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/selected" - parent: "properties_panel/property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_text" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_text/root" - parent: "properties_panel/property_text" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_text/text_name" - parent: "properties_panel/property_text/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_text/text_right" - parent: "properties_panel/property_text/root" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_left_right_selector" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/root" - parent: "properties_panel/property_left_right_selector" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_left_right_selector/text_name" - parent: "properties_panel/property_left_right_selector/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/E_Anchor" - parent: "properties_panel/property_left_right_selector/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/button_left" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/icon_left" - parent: "properties_panel/property_left_right_selector/button_left" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/button_right" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/icon_right" - parent: "properties_panel/property_left_right_selector/button_right" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/selected" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_left_right_selector/text_value" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/root" - parent: "properties_panel/property_vector3" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_name" - parent: "properties_panel/property_vector3/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/E_Anchor" - parent: "properties_panel/property_vector3/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/field_x" - parent: "properties_panel/property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_x" - parent: "properties_panel/property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3/rich_input_x" - parent: "properties_panel/property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_x/root" - parent: "properties_panel/property_vector3/rich_input_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_x/button" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_x/placeholder_text" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_x/input_text" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_x/cursor_node" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_x/cursor_text" - parent: "properties_panel/property_vector3/rich_input_x/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/selected_x" - parent: "properties_panel/property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/field_y" - parent: "properties_panel/property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_y" - parent: "properties_panel/property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3/rich_input_y" - parent: "properties_panel/property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_y/root" - parent: "properties_panel/property_vector3/rich_input_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_y/button" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_y/placeholder_text" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_y/input_text" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_y/cursor_node" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_y/cursor_text" - parent: "properties_panel/property_vector3/rich_input_y/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/selected_y" - parent: "properties_panel/property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/field_z" - parent: "properties_panel/property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_z" - parent: "properties_panel/property_vector3/field_z" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3/rich_input_z" - parent: "properties_panel/property_vector3/field_z" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_z/root" - parent: "properties_panel/property_vector3/rich_input_z" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_z/button" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_z/placeholder_text" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_z/input_text" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_z/cursor_node" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_z/cursor_text" - parent: "properties_panel/property_vector3/rich_input_z/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/selected_z" - parent: "properties_panel/property_vector3/field_z" - 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 { - type: TYPE_TEMPLATE - id: "memory_panel" - parent: "widgets" - inherit_alpha: true - template: "/druid/widget/memory_panel/memory_panel.gui" -} -nodes { - type: TYPE_BOX - id: "memory_panel/root" - parent: "memory_panel" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "memory_panel/mini_graph" - parent: "memory_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/root" - parent: "memory_panel/mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/header" - parent: "memory_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/mini_graph/text_header" - parent: "memory_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/icon_drag" - parent: "memory_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/content" - parent: "memory_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/prefab_line" - parent: "memory_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/color_low" - parent: "memory_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/content" - parent: "memory_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_max_value" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_per_second" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/line_second_1" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/line_second_2" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_memory" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "mini_graph" - parent: "widgets" - inherit_alpha: true - template: "/druid/widget/mini_graph/mini_graph.gui" -} -nodes { - type: TYPE_BOX - id: "mini_graph/root" - parent: "mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/header" - parent: "mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "mini_graph/text_header" - parent: "mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/icon_drag" - parent: "mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/content" - parent: "mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/prefab_line" - parent: "mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "mini_graph/color_low" - parent: "mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "property_input" - parent: "widgets" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties/property_input.gui" -} -nodes { - type: TYPE_BOX - id: "property_input/root" - parent: "property_input" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/text_name" - parent: "property_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/E_Anchor" - parent: "property_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "property_input/rich_input" - parent: "property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/rich_input/root" - parent: "property_input/rich_input" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/rich_input/button" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/rich_input/placeholder_text" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/rich_input/input_text" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/rich_input/cursor_node" - parent: "property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "property_input/rich_input/cursor_text" - parent: "property_input/rich_input/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "property_input/selected" - parent: "property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "example_tiling_node" - parent: "widgets" - inherit_alpha: true - template: "/example/examples/widgets/tiling_node/example_tiling_node.gui" -} -nodes { - type: TYPE_BOX - id: "example_tiling_node/root" - parent: "example_tiling_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "example_tiling_node/tiling_node" - parent: "example_tiling_node/root" - template_node_child: true -} nodes { size { x: 200.0 diff --git a/example/examples/using_widgets/using_widgets.gui b/example/examples/using_widgets/using_widgets.gui index bfd24e8..5fc85fa 100644 --- a/example/examples/using_widgets/using_widgets.gui +++ b/example/examples/using_widgets/using_widgets.gui @@ -25,89 +25,5 @@ nodes { inherit_alpha: true template: "/druid/widget/fps_panel/fps_panel.gui" } -nodes { - type: TYPE_BOX - id: "fps_panel/root" - parent: "fps_panel" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "fps_panel/mini_graph" - parent: "fps_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/root" - parent: "fps_panel/mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/header" - parent: "fps_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/mini_graph/text_header" - parent: "fps_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/icon_drag" - parent: "fps_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/content" - parent: "fps_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/prefab_line" - parent: "fps_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/color_low" - parent: "fps_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/content" - parent: "fps_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/text_min_fps" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/text_fps" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/line_second_1" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/line_second_2" - parent: "fps_panel/content" - template_node_child: true -} material: "/builtins/materials/gui.material" adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/example/examples/widgets/examples_list.lua b/example/examples/widgets/examples_list.lua index 0376eb2..0734f89 100644 --- a/example/examples/widgets/examples_list.lua +++ b/example/examples/widgets/examples_list.lua @@ -10,181 +10,6 @@ function M.get_examples() root = "hover_hint_example/root", code_url = "example/examples/widgets/hover_hint/hover_hint_example.lua", widget_class = require("example.examples.widgets.hover_hint.hover_hint_example"), - }, - { - name_id = "ui_example_widget_properties_panel", - information_text_id = "ui_example_widget_properties_panel_description", - template = "properties_panel", - root = "properties_panel/root", - code_url = "example/examples/widgets/examples_list.lua", - widget_class = require("druid.widget.properties_panel.properties_panel"), - on_create = function(instance, output_list) - ---@cast instance druid.widget.properties_panel - - instance:add_button(function(button) - button:set_text_button("Button") - button.button.on_click:subscribe(function() - print("Button clicked") - end) - end) - - instance:add_checkbox(function(checkbox) - --print("Checkbox clicked", value) - checkbox:set_text_property("Checkbox") - checkbox.on_change_value:subscribe(function(value) - print("Checkbox clicked", value) - end) - checkbox:set_value(false) - end) - - instance:add_input(function(input) - input:set_text_property("Input") - input:set_text_value("Initial") - input:on_change(function(text) - print("Input changed", text) - end) - end) - - instance:add_left_right_selector(function(selector) - selector:set_template("Arrows Number") - selector.on_change_value:subscribe(function(value) - print("Left Right Selector changed", value) - end) - selector:set_number_type(0, 42, true, 1) - selector:set_value(0) - end) - - instance:add_left_right_selector(function(selector) - selector:set_template("Arrows Array") - selector.on_change_value:subscribe(function(value) - print("Left Right Array value", value) - end) - selector:set_array_type({"Zero", "One", "Two", "Three", "Four", "Five"}, false, 1) - selector:set_value("Zero") - end) - - instance:add_slider(function(slider) - slider:set_text_property("Slider") - slider:set_value(0.5) - slider:on_change(function(value) - print("Slider changed", value) - end) - end) - - instance:add_text(function(text) - text:set_text_property("Text") - text:set_text_value("Hello, World!") - end) - end, - }, - { - name_id = "ui_example_widget_property_button", - information_text_id = "ui_example_widget_property_button_description", - template = "property_button", - root = "property_button/root", - code_url = "example/components/properties_panel/properties/property_button.lua", - widget_class = require("example.components.properties_panel.properties.property_button"), - on_create = function(instance, output_list) - ---@cast instance property_button - instance.button.on_click:subscribe(function() - output_list:add_log_text("Button clicked") - end) - end, - }, - { - name_id = "ui_example_widget_property_input", - information_text_id = "ui_example_widget_property_input_description", - template = "property_input", - root = "property_input/root", - code_url = "example/examples/widgets/examples_list.lua", - widget_class = require("druid.widget.properties_panel.properties.property_input"), - }, - { - name_id = "ui_example_widget_property_slider", - information_text_id = "ui_example_widget_property_slider_description", - template = "property_slider", - root = "property_slider/root", - code_url = "example/components/properties_panel/properties/property_slider.lua", - widget_class = require("example.components.properties_panel.properties.property_slider"), - on_create = function(instance, output_list) - ---@cast instance property_slider - instance.slider.on_change_value:subscribe(function(_, value) - output_list:add_log_text("Slider value: " .. value) - end) - end, - }, - { - name_id = "ui_example_widget_property_checkbox", - information_text_id = "ui_example_widget_property_checkbox_description", - template = "property_checkbox", - root = "property_checkbox/root", - code_url = "example/components/properties_panel/properties/property_checkbox.lua", - widget_class = require("example.components.properties_panel.properties.property_checkbox"), - on_create = function(instance, output_list) - ---@cast instance property_checkbox - instance.button.on_click:subscribe(function() - output_list:add_log_text("Checkbox clicked") - end) - end, - }, - { - name_id = "ui_example_widget_memory_panel", - information_text_id = "ui_example_widget_memory_panel_description", - template = "memory_panel", - root = "memory_panel/root", - code_url = "druid/widget/memory_panel/memory_panel.lua", - widget_class = require("druid.widget.memory_panel.memory_panel"), - on_create = function(instance, output_list) - ---@cast instance druid.widget.memory_panel - print("Memory panel created") - end, - }, - { - name_id = "ui_example_widget_fps_panel", - information_text_id = "ui_example_widget_fps_panel_description", - template = "fps_panel", - root = "fps_panel/root", - code_url = "druid/widget/fps_panel/fps_panel.lua", - widget_class = require("druid.widget.fps_panel.fps_panel"), - on_create = function(instance, output_list) - ---@cast instance druid.widget.fps_panel - print("FPS panel created") - end, - }, - { - name_id = "ui_example_widget_mini_graph", - information_text_id = "ui_example_widget_mini_graph_description", - template = "mini_graph", - root = "mini_graph/root", - code_url = "druid/widget/mini_graph/mini_graph.lua", - widget_class = require("druid.widget.mini_graph.mini_graph"), - on_create = function(instance, output_list) - ---@cast instance druid.widget.mini_graph - instance:set_samples(50) - end, - properties_control = function(instance, properties_panel) - ---@cast instance druid.widget.mini_graph - properties_panel:add_slider("value", 0.5, function(value) - -- Remap to -1, 2 - value = value * 3 - 1 - for index = 1, 50 do - -- Take value each 0.1 step, the higher value at argument value - local x = index * (1 / 50) - local distance = math.abs(x - value) - local line_v = 1 - distance^2 - - instance:set_line_value(index, line_v) - end - end) - end, - }, - { - name_id = "ui_example_widget_tiling_node", - information_text_id = "ui_example_widget_tiling_node_description", - template = "example_tiling_node", - root = "example_tiling_node/root", - code_url = "example/examples/widgets/tiling_node/example_tiling_node.lua", - widget_class = require("example.examples.widgets.tiling_node.example_tiling_node"), } } end diff --git a/example/examples/widgets/fps_panel/example_fps_panel.gui b/example/examples/widgets/fps_panel/example_fps_panel.gui deleted file mode 100644 index 4f01f77..0000000 --- a/example/examples/widgets/fps_panel/example_fps_panel.gui +++ /dev/null @@ -1,104 +0,0 @@ -nodes { - size { - x: 200.0 - y: 100.0 - } - type: TYPE_BOX - id: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - type: TYPE_TEMPLATE - id: "fps_panel" - parent: "root" - inherit_alpha: true - template: "/druid/widget/fps_panel/fps_panel.gui" -} -nodes { - type: TYPE_BOX - id: "fps_panel/root" - parent: "fps_panel" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "fps_panel/mini_graph" - parent: "fps_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/root" - parent: "fps_panel/mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/header" - parent: "fps_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/mini_graph/text_header" - parent: "fps_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/icon_drag" - parent: "fps_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/content" - parent: "fps_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/prefab_line" - parent: "fps_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/mini_graph/color_low" - parent: "fps_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/content" - parent: "fps_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/text_min_fps" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "fps_panel/text_fps" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/line_second_1" - parent: "fps_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "fps_panel/line_second_2" - parent: "fps_panel/content" - template_node_child: true -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/example/examples/widgets/fps_panel/example_fps_panel.lua b/example/examples/widgets/fps_panel/example_fps_panel.lua deleted file mode 100644 index a26b10c..0000000 --- a/example/examples/widgets/fps_panel/example_fps_panel.lua +++ /dev/null @@ -1,12 +0,0 @@ -local fps_panel = require("druid.widget.fps_panel.fps_panel") - ----@class examples.example_fps_panel: druid.widget -local M = {} - - -function M:init() - self.fps_panel = self.druid:new_widget(fps_panel, "fps_panel") -end - - -return M diff --git a/example/examples/widgets/memory_panel/example_memory_panel.gui b/example/examples/widgets/memory_panel/example_memory_panel.gui deleted file mode 100644 index 44ee04a..0000000 --- a/example/examples/widgets/memory_panel/example_memory_panel.gui +++ /dev/null @@ -1,110 +0,0 @@ -nodes { - size { - x: 200.0 - y: 100.0 - } - type: TYPE_BOX - id: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - type: TYPE_TEMPLATE - id: "memory_panel" - parent: "root" - inherit_alpha: true - template: "/druid/widget/memory_panel/memory_panel.gui" -} -nodes { - type: TYPE_BOX - id: "memory_panel/root" - parent: "memory_panel" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "memory_panel/mini_graph" - parent: "memory_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/root" - parent: "memory_panel/mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/header" - parent: "memory_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/mini_graph/text_header" - parent: "memory_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/icon_drag" - parent: "memory_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/content" - parent: "memory_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/prefab_line" - parent: "memory_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/color_low" - parent: "memory_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/content" - parent: "memory_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_max_value" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_per_second" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/line_second_1" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/line_second_2" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_memory" - parent: "memory_panel/content" - template_node_child: true -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/example/examples/widgets/memory_panel/example_memory_panel.lua b/example/examples/widgets/memory_panel/example_memory_panel.lua deleted file mode 100644 index 29d6c45..0000000 --- a/example/examples/widgets/memory_panel/example_memory_panel.lua +++ /dev/null @@ -1,12 +0,0 @@ -local memory_panel = require("druid.widget.memory_panel.memory_panel") - ----@class examples.example_memory_panel: druid.widget -local M = {} - - -function M:init() - self.memory_panel = self.druid:new_widget(memory_panel, "memory_panel") -end - - -return M diff --git a/example/examples/widgets/properties_panel/example_properties_panel.gui b/example/examples/widgets/properties_panel/example_properties_panel.gui deleted file mode 100644 index 032830a..0000000 --- a/example/examples/widgets/properties_panel/example_properties_panel.gui +++ /dev/null @@ -1,626 +0,0 @@ -nodes { - size { - x: 200.0 - y: 100.0 - } - type: TYPE_BOX - id: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel" - parent: "root" - inherit_alpha: true - template: "/druid/widget/properties_panel/properties_panel.gui" -} -nodes { - type: TYPE_BOX - id: "properties_panel/root" - parent: "properties_panel" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/header" - parent: "properties_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/text_header" - parent: "properties_panel/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/icon_drag" - parent: "properties_panel/header" - 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 { - type: TYPE_BOX - id: "properties_panel/content" - parent: "properties_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/scroll_view" - parent: "properties_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/scroll_content" - parent: "properties_panel/scroll_view" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/propeties" - parent: "properties_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_slider" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/root" - parent: "properties_panel/property_slider" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_slider/text_name" - parent: "properties_panel/property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/E_Anchor" - parent: "properties_panel/property_slider/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/slider" - parent: "properties_panel/property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/slider_back" - parent: "properties_panel/property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/slider_pin" - parent: "properties_panel/property_slider/slider" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/button" - parent: "properties_panel/property_slider/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_slider/selected" - parent: "properties_panel/property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_slider/text_value" - parent: "properties_panel/property_slider/button" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_checkbox" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/root" - parent: "properties_panel/property_checkbox" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_checkbox/text_name" - parent: "properties_panel/property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/E_Anchor" - parent: "properties_panel/property_checkbox/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/button" - parent: "properties_panel/property_checkbox/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/icon" - parent: "properties_panel/property_checkbox/button" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_checkbox/selected" - parent: "properties_panel/property_checkbox/button" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_button" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/root" - parent: "properties_panel/property_button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_button/text_name" - parent: "properties_panel/property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/E_Anchor" - parent: "properties_panel/property_button/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/button" - parent: "properties_panel/property_button/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_button/selected" - parent: "properties_panel/property_button/button" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_button/text_button" - parent: "properties_panel/property_button/button" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_input" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/root" - parent: "properties_panel/property_input" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/text_name" - parent: "properties_panel/property_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/E_Anchor" - parent: "properties_panel/property_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_input/rich_input" - parent: "properties_panel/property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/rich_input/root" - parent: "properties_panel/property_input/rich_input" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/rich_input/button" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/rich_input/placeholder_text" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/rich_input/input_text" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/rich_input/cursor_node" - parent: "properties_panel/property_input/rich_input/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_input/rich_input/cursor_text" - parent: "properties_panel/property_input/rich_input/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_input/selected" - parent: "properties_panel/property_input/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_text" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_text/root" - parent: "properties_panel/property_text" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_text/text_name" - parent: "properties_panel/property_text/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_text/text_right" - parent: "properties_panel/property_text/root" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_left_right_selector" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/root" - parent: "properties_panel/property_left_right_selector" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_left_right_selector/text_name" - parent: "properties_panel/property_left_right_selector/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/E_Anchor" - parent: "properties_panel/property_left_right_selector/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/button_left" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/icon_left" - parent: "properties_panel/property_left_right_selector/button_left" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/button_right" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/icon_right" - parent: "properties_panel/property_left_right_selector/button_right" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_left_right_selector/selected" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_left_right_selector/text_value" - parent: "properties_panel/property_left_right_selector/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3" - parent: "properties_panel/propeties" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/root" - parent: "properties_panel/property_vector3" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_name" - parent: "properties_panel/property_vector3/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/E_Anchor" - parent: "properties_panel/property_vector3/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/field_x" - parent: "properties_panel/property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_x" - parent: "properties_panel/property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3/rich_input_x" - parent: "properties_panel/property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_x/root" - parent: "properties_panel/property_vector3/rich_input_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_x/button" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_x/placeholder_text" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_x/input_text" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_x/cursor_node" - parent: "properties_panel/property_vector3/rich_input_x/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_x/cursor_text" - parent: "properties_panel/property_vector3/rich_input_x/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/selected_x" - parent: "properties_panel/property_vector3/field_x" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/field_y" - parent: "properties_panel/property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_y" - parent: "properties_panel/property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3/rich_input_y" - parent: "properties_panel/property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_y/root" - parent: "properties_panel/property_vector3/rich_input_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_y/button" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_y/placeholder_text" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_y/input_text" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_y/cursor_node" - parent: "properties_panel/property_vector3/rich_input_y/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_y/cursor_text" - parent: "properties_panel/property_vector3/rich_input_y/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/selected_y" - parent: "properties_panel/property_vector3/field_y" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/field_z" - parent: "properties_panel/property_vector3/E_Anchor" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/text_z" - parent: "properties_panel/property_vector3/field_z" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "properties_panel/property_vector3/rich_input_z" - parent: "properties_panel/property_vector3/field_z" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_z/root" - parent: "properties_panel/property_vector3/rich_input_z" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_z/button" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_z/placeholder_text" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_z/input_text" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/rich_input_z/cursor_node" - parent: "properties_panel/property_vector3/rich_input_z/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "properties_panel/property_vector3/rich_input_z/cursor_text" - parent: "properties_panel/property_vector3/rich_input_z/cursor_node" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "properties_panel/property_vector3/selected_z" - parent: "properties_panel/property_vector3/field_z" - 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" -adjust_reference: ADJUST_REFERENCE_PARENT diff --git a/example/examples/widgets/properties_panel/example_properties_panel.lua b/example/examples/widgets/properties_panel/example_properties_panel.lua deleted file mode 100644 index 9106f9b..0000000 --- a/example/examples/widgets/properties_panel/example_properties_panel.lua +++ /dev/null @@ -1,67 +0,0 @@ -local properties_panel = require("druid.widget.properties_panel.properties_panel") - ----@class druid.widget.example_properties_panel: druid.widget -local M = {} - - -function M:init() - self.properties_panel = self.druid:new_widget(properties_panel, "properties_panel") - - self.properties_panel:add_button(function(button) - button:set_text_button("Button") - button.button.on_click:subscribe(function() - print("Button clicked") - end) - end) - - self.properties_panel:add_checkbox(function(checkbox) - --print("Checkbox clicked", value) - checkbox:set_text_property("Checkbox") - checkbox.on_change_value:subscribe(function(value) - print("Checkbox clicked", value) - end) - checkbox:set_value(false) - end) - - self.properties_panel:add_input(function(input) - input:set_text_property("Input") - input:set_text_value("Initial") - input:on_change(function(text) - print("Input changed", text) - end) - end) - - self.properties_panel:add_left_right_selector(function(selector) - selector:set_template("Arrows Number") - selector.on_change_value:subscribe(function(value) - print("Left Right Selector changed", value) - end) - selector:set_number_type(0, 42, true, 1) - selector:set_value(0) - end) - - self.properties_panel:add_left_right_selector(function(selector) - selector:set_template("Arrows Array") - selector.on_change_value:subscribe(function(value) - print("Left Right Array value", value) - end) - selector:set_array_type({"Zero", "One", "Two", "Three", "Four", "Five"}, false, 1) - selector:set_value("Zero") - end) - - self.properties_panel:add_slider(function(slider) - slider:set_text_property("Slider") - slider:set_value(0.5) - slider:on_change(function(value) - print("Slider changed", value) - end) - end) - - self.properties_panel:add_text(function(text) - text:set_text_property("Text") - text:set_text_value("Hello, World!") - end) -end - - -return M \ No newline at end of file diff --git a/example/examples/widgets/tiling_node/example_tiling_node.gui b/example/examples/widgets/tiling_node/example_tiling_node.gui deleted file mode 100644 index f98269f..0000000 --- a/example/examples/widgets/tiling_node/example_tiling_node.gui +++ /dev/null @@ -1,34 +0,0 @@ -textures { - name: "tiling_texture" - texture: "/example/examples/widgets/tiling_node/tiling_texture.atlas" -} -nodes { - size { - x: 200.0 - y: 100.0 - } - type: TYPE_BOX - id: "root" - inherit_alpha: true - size_mode: SIZE_MODE_AUTO - visible: false -} -nodes { - size { - x: 900.0 - y: 900.0 - } - type: TYPE_BOX - texture: "tiling_texture/pattern_0004" - id: "tiling_node" - parent: "root" - inherit_alpha: true - alpha: 0.42 - material: "gui_tiling_node" -} -material: "/builtins/materials/gui.material" -adjust_reference: ADJUST_REFERENCE_PARENT -materials { - name: "gui_tiling_node" - material: "/druid/custom/tiling_node/gui_tiling_node.material" -} diff --git a/example/examples/widgets/tiling_node/example_tiling_node.lua b/example/examples/widgets/tiling_node/example_tiling_node.lua deleted file mode 100644 index 53a8522..0000000 --- a/example/examples/widgets/tiling_node/example_tiling_node.lua +++ /dev/null @@ -1,37 +0,0 @@ -local tiling_node = require("druid.custom.tiling_node.tiling_node") - ----@class examples.example_tiling_node: druid.widget -local M = {} - - -function M:init() - self.tiling_node = self.druid:new(tiling_node, self:get_node("tiling_node")) -end - - ----@param properties_panel properties_panel -function M:properties_control(properties_panel) - properties_panel:add_slider("Repeat X", 0, function(value) - local repeat_x = math.floor(value * 10) - self.tiling_node:set_repeat(repeat_x, nil) - end) - properties_panel:add_slider("Repeat Y", 0, function(value) - local repeat_y = math.floor(value * 10) - self.tiling_node:set_repeat(nil, repeat_y) - end) - properties_panel:add_slider("Offset X", 0, function(value) - self.tiling_node:set_offset(value, nil) - end) - properties_panel:add_slider("Offset Y", 0, function(value) - self.tiling_node:set_offset(nil, value) - end) - properties_panel:add_slider("Margin X", 0, function(value) - self.tiling_node:set_margin(value, nil) - end) - properties_panel:add_slider("Margin Y", 0, function(value) - self.tiling_node:set_margin(nil, value) - end) -end - - -return M diff --git a/example/examples/widgets/tiling_node/pattern_0004.png b/example/examples/widgets/tiling_node/pattern_0004.png deleted file mode 100644 index c3adc2e..0000000 Binary files a/example/examples/widgets/tiling_node/pattern_0004.png and /dev/null differ diff --git a/example/examples/widgets/tiling_node/tiling_texture.atlas b/example/examples/widgets/tiling_node/tiling_texture.atlas deleted file mode 100644 index 6135667..0000000 --- a/example/examples/widgets/tiling_node/tiling_texture.atlas +++ /dev/null @@ -1,3 +0,0 @@ -images { - image: "/example/examples/widgets/tiling_node/pattern_0004.png" -} diff --git a/example/other/go_bindings/go_widget.gui b/example/other/go_bindings/go_widget.gui index 7a88d2b..5746dc4 100644 --- a/example/other/go_bindings/go_widget.gui +++ b/example/other/go_bindings/go_widget.gui @@ -62,95 +62,5 @@ nodes { inherit_alpha: true template: "/druid/widget/memory_panel/memory_panel.gui" } -nodes { - type: TYPE_BOX - id: "memory_panel/root" - parent: "memory_panel" - template_node_child: true -} -nodes { - type: TYPE_TEMPLATE - id: "memory_panel/mini_graph" - parent: "memory_panel/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/root" - parent: "memory_panel/mini_graph" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/header" - parent: "memory_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/mini_graph/text_header" - parent: "memory_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/icon_drag" - parent: "memory_panel/mini_graph/header" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/content" - parent: "memory_panel/mini_graph/root" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/prefab_line" - parent: "memory_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/mini_graph/color_low" - parent: "memory_panel/mini_graph/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/content" - parent: "memory_panel/root" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_max_value" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_per_second" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/line_second_1" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_BOX - id: "memory_panel/line_second_2" - parent: "memory_panel/content" - template_node_child: true -} -nodes { - type: TYPE_TEXT - id: "memory_panel/text_memory" - parent: "memory_panel/content" - template_node_child: true -} material: "/druid/materials/gui_world/gui_world.material" adjust_reference: ADJUST_REFERENCE_DISABLED diff --git a/game.project b/game.project index 2a3093d..6d0bd17 100644 --- a/game.project +++ b/game.project @@ -25,6 +25,7 @@ dependencies#3 = https://github.com/Insality/panthera/archive/refs/tags/runtime. dependencies#4 = https://github.com/Insality/defold-lang/archive/refs/tags/3.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#7 = https://github.com/Insality/core/archive/refs/heads/main.zip [library] include_dirs = druid diff --git a/settings_deployer b/settings_deployer index 36ed926..fc147e4 100644 --- a/settings_deployer +++ b/settings_deployer @@ -2,7 +2,7 @@ bob_folder=./ # You can point bob version for project in format "filename:sha" -bob_sha=":868769ba7a3458db12d149188bf3be80a339a85c" +bob_sha="1_11_2:cddb6eb43c32e4930257fcbbb30f19cf28deb081" # Select Defold channel. Values: stable, beta, alpha bob_channel="stable" diff --git a/test/tests/test_rich_text.lua b/test/tests/test_rich_text.lua index d37d819..29bd75a 100644 --- a/test/tests/test_rich_text.lua +++ b/test/tests/test_rich_text.lua @@ -106,12 +106,6 @@ return function() -- Test shadow tag with named color local words = rich_text:set_text("Shadowed Text") - assert(#words > 0) - assert(words[1].shadow ~= nil) - - -- Test shadow tag with RGBA values - words = rich_text:set_text("Shadowed Text") - assert(#words > 0) assert(words[1].shadow ~= nil) assert(words[1].shadow.x < 0.1) -- Black shadow should have low RGB values @@ -131,12 +125,6 @@ return function() -- Test outline tag with named color local words = rich_text:set_text("Outlined Text") - assert(#words > 0) - assert(words[1].outline ~= nil) - - -- Test outline tag with RGBA values - words = rich_text:set_text("Outlined Text") - assert(#words > 0) assert(words[1].outline ~= nil) assert(words[1].outline.x < 0.1) -- Black outline should have low RGB values