mirror of
https://github.com/Insality/druid.git
synced 2025-11-26 19:00:50 +01:00
Update property panel, add small button for more text
This commit is contained in:
@@ -27,7 +27,7 @@ nodes {
|
||||
y: 0.5
|
||||
}
|
||||
size {
|
||||
x: 360.0
|
||||
x: 700.0
|
||||
y: 40.0
|
||||
}
|
||||
color {
|
||||
@@ -60,7 +60,7 @@ nodes {
|
||||
x: 200.0
|
||||
}
|
||||
size {
|
||||
x: 200.0
|
||||
x: 40.0
|
||||
y: 40.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
@@ -73,7 +73,7 @@ nodes {
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
x: -180.0
|
||||
x: -20.0
|
||||
}
|
||||
size {
|
||||
x: 40.0
|
||||
|
||||
@@ -77,6 +77,7 @@ end
|
||||
---@param enabled boolean
|
||||
function M:set_enabled(enabled)
|
||||
self.button:set_enabled(enabled)
|
||||
gui.set_alpha(self.button.node, enabled and 1 or 0.75)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -747,5 +747,82 @@ nodes {
|
||||
parent: "property_vector3/field_z"
|
||||
template_node_child: true
|
||||
}
|
||||
nodes {
|
||||
position {
|
||||
y: -100.0
|
||||
}
|
||||
type: TYPE_TEMPLATE
|
||||
id: "property_button_small"
|
||||
parent: "propeties"
|
||||
inherit_alpha: true
|
||||
template: "/druid/widget/properties_panel/properties/property_button.gui"
|
||||
}
|
||||
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
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
|
||||
@@ -88,6 +88,7 @@ function M:init()
|
||||
gui.set_enabled(self:get_node("property_checkbox/root"), false)
|
||||
gui.set_enabled(self:get_node("property_slider/root"), false)
|
||||
gui.set_enabled(self:get_node("property_button/root"), false)
|
||||
gui.set_enabled(self:get_node("property_button_small/root"), false)
|
||||
gui.set_enabled(self:get_node("property_input/root"), false)
|
||||
gui.set_enabled(self:get_node("property_text/root"), false)
|
||||
gui.set_enabled(self:get_node("property_left_right_selector/root"), false)
|
||||
@@ -254,6 +255,12 @@ function M:add_button(on_create)
|
||||
return self:add_inner_widget(property_button, "property_button", "root", on_create)
|
||||
end
|
||||
|
||||
---@param on_create fun(button: druid.widget.property_button)|nil
|
||||
---@return druid.widget.properties_panel
|
||||
function M:add_button_small(on_create)
|
||||
return self:add_inner_widget(property_button, "property_button_small", "root", on_create)
|
||||
end
|
||||
|
||||
|
||||
---@param on_create fun(input: druid.widget.property_input)|nil
|
||||
---@return druid.widget.properties_panel
|
||||
@@ -378,6 +385,7 @@ function M:set_hidden(is_hidden)
|
||||
gui.set_enabled(self.text_header.node, not self._is_hidden)
|
||||
gui.set_enabled(self.content, not self._is_hidden)
|
||||
gui.set_enabled(self.button_refresh.node, not self._is_hidden)
|
||||
gui.set_visible(self.button_back.node, not self._is_hidden)
|
||||
|
||||
if not self._is_hidden then
|
||||
self.is_dirty = true
|
||||
|
||||
Reference in New Issue
Block a user