Skip to content

Commit 74ddc67

Browse files
committed
Update
1 parent 50e59d9 commit 74ddc67

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

druid/druid.script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
-- Place this script nearby with the gui component to able make requests
22
-- To the go namespace from GUI with events systems (cross context)
3+
-- This one is a required to make a unified "Shaders" pipeline in the GUI scripts
4+
-- This required to grab a texture data with `go.get` function
35

46
local defer = require("event.defer")
57

druid/druid_widget.gui_script

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
local druid = require("druid.druid")
1+
--- Attach this script to your GUI file instead custom *.gui_script file
2+
--- This allows to grab a widget from the GO scripts by gui_url
3+
--- To do this you need to call `druid.get_widget` in the GO script
4+
--- The new widget will be created and returned to GO script
5+
--- And now all top level functions from the widget will be available in the GO script
6+
--- Use with caution, this is a new feature, but allow utilize flexability of `event` module
27

8+
local druid = require("druid.druid")
39

410
function init(self)
511
self.druid = druid.new(self)
612
druid.register_druid_as_widget(self.druid)
713
end
814

9-
1015
function final(self)
1116
druid.unregister_druid_as_widget()
1217
self.druid:final()
1318
end
1419

15-
1620
function update(self, dt)
1721
self.druid:update(dt)
1822
end
1923

20-
2124
function on_message(self, message_id, message, sender)
2225
self.druid:on_message(message_id, message, sender)
2326
end
2427

25-
2628
function on_input(self, action_id, action)
2729
return self.druid:on_input(action_id, action)
2830
end

druid/editor_scripts/assign_layers.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,11 @@ end
6060
---Remove a backup file
6161
---@param backup_path string - The path of the backup file to remove
6262
local function remove_backup(backup_path)
63-
print("Removing backup file:", backup_path)
64-
local success, err = os.remove(backup_path)
65-
if not success then
66-
print("Warning: Could not remove backup file:", err)
67-
print("You may want to manually remove it:", backup_path)
68-
else
63+
-- Check file exists and remove it
64+
local file = io.open(backup_path, "r")
65+
if file then
66+
file:close()
67+
os.remove(backup_path)
6968
print("Backup file removed successfully")
7069
end
7170
end

druid/editor_scripts/create_druid_widget.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ local function to_camel_case(snake_str)
99
end
1010

1111

12-
function M.create_druid_widget(opts)
13-
local gui_filepath = editor.get(opts.selection, "path")
12+
function M.create_druid_widget(selection)
13+
local gui_filepath = editor.get(selection, "path")
1414
local filename = gui_filepath:match("([^/]+)%.gui$")
1515
print("Create Druid widget for", gui_filepath)
1616

0 commit comments

Comments
 (0)