mirror of
https://github.com/Insality/druid
synced 2025-09-27 10:02:19 +02:00
Update
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
# @license MIT, Insality 2021
|
||||
# @source https://github.com/Insality/druid
|
||||
|
||||
import os
|
||||
import sys
|
||||
import deftree
|
||||
|
||||
current_filepath = os.path.abspath(os.path.dirname(__file__))
|
||||
TEMPLATE_PATH = current_filepath + "/component.lua_template"
|
||||
TEMPLATE_PATH = current_filepath + "/widget.lua_template"
|
||||
|
||||
component_annotations = ""
|
||||
component_functions = ""
|
||||
@@ -44,9 +41,9 @@ def process_component(node_name, component_name):
|
||||
component_define += "\n\tself.{0} = self.druid:new_lang_text(\"{1}\", \"lang_id\")".format(node_name, node_name)
|
||||
|
||||
if node_name.startswith("grid") or node_name.startswith("static_grid"):
|
||||
component_annotations += "\n---@field {0} druid.static_grid".format(node_name)
|
||||
component_annotations += "\n---@field {0} druid.grid".format(node_name)
|
||||
component_define += "\n--TODO: Replace prefab_name with grid element prefab"
|
||||
component_define += "\n\tself.{0} = self.druid:new_static_grid(\"{1}\", \"prefab_name\", 1)".format(node_name, node_name)
|
||||
component_define += "\n\tself.{0} = self.druid:new_grid(\"{1}\", \"prefab_name\", 1)".format(node_name, node_name)
|
||||
|
||||
if node_name.startswith("scroll_view"):
|
||||
field_name = node_name.replace("_view", "")
|
||||
|
@@ -50,7 +50,7 @@ function M.get_commands()
|
||||
},
|
||||
|
||||
{
|
||||
label = "Create Druid Component",
|
||||
label = "Create Druid Widget",
|
||||
locations = { "Edit", "Assets" },
|
||||
query = { selection = {type = "resource", cardinality = "one"} },
|
||||
active = function(opts)
|
||||
@@ -62,7 +62,7 @@ function M.get_commands()
|
||||
print("Run script for", editor.get(file, "path"))
|
||||
save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh")
|
||||
save_file_from_dependency('/druid/editor_scripts/create_druid_component.py', "./build/create_druid_component.py")
|
||||
save_file_from_dependency('/druid/editor_scripts/component.lua_template', "./build/component.lua_template")
|
||||
save_file_from_dependency('/druid/editor_scripts/widget.lua_template', "./build/widget.lua_template")
|
||||
return {
|
||||
{
|
||||
action = "shell",
|
||||
|
@@ -1,9 +1,14 @@
|
||||
---@class widget.TEMPLATE: druid.widget
|
||||
---This is a template for a {COMPONENT_NAME} Druid widget.
|
||||
---Instantiate this template with `druid.new_widget(widget_module, [template_id], [nodes])`.
|
||||
---Read more about Druid Widgets here: ...
|
||||
|
||||
---@class widget.{COMPONENT_TYPE}: druid.widget
|
||||
local M = {}
|
||||
|
||||
|
||||
function M:init()
|
||||
self.root = self:get_node("root")
|
||||
self.button = self.druid:new_button("button"), self.on_button, self)
|
||||
self.button = self.druid:new_button("button", self.on_button, self)
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user