Skip to content

Commit 25f02fd

Browse files
committed
Update property panel, add small button for more text
1 parent 403d1e0 commit 25f02fd

File tree

4 files changed

+89
-3
lines changed

4 files changed

+89
-3
lines changed

druid/widget/properties_panel/properties/property_checkbox.gui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ nodes {
2727
y: 0.5
2828
}
2929
size {
30-
x: 360.0
30+
x: 700.0
3131
y: 40.0
3232
}
3333
color {
@@ -60,7 +60,7 @@ nodes {
6060
x: 200.0
6161
}
6262
size {
63-
x: 200.0
63+
x: 40.0
6464
y: 40.0
6565
}
6666
type: TYPE_BOX
@@ -73,7 +73,7 @@ nodes {
7373
}
7474
nodes {
7575
position {
76-
x: -180.0
76+
x: -20.0
7777
}
7878
size {
7979
x: 40.0

druid/widget/properties_panel/properties/property_checkbox.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ end
7777
---@param enabled boolean
7878
function M:set_enabled(enabled)
7979
self.button:set_enabled(enabled)
80+
gui.set_alpha(self.button.node, enabled and 1 or 0.75)
8081
end
8182

8283

druid/widget/properties_panel/properties_panel.gui

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,5 +747,82 @@ nodes {
747747
parent: "property_vector3/field_z"
748748
template_node_child: true
749749
}
750+
nodes {
751+
position {
752+
y: -100.0
753+
}
754+
type: TYPE_TEMPLATE
755+
id: "property_button_small"
756+
parent: "propeties"
757+
inherit_alpha: true
758+
template: "/druid/widget/properties_panel/properties/property_button.gui"
759+
}
760+
nodes {
761+
type: TYPE_BOX
762+
id: "property_button_small/root"
763+
parent: "property_button_small"
764+
template_node_child: true
765+
}
766+
nodes {
767+
size {
768+
x: 700.0
769+
y: 40.0
770+
}
771+
type: TYPE_TEXT
772+
id: "property_button_small/text_name"
773+
parent: "property_button_small/root"
774+
overridden_fields: 4
775+
template_node_child: true
776+
}
777+
nodes {
778+
size {
779+
x: 40.0
780+
y: 40.0
781+
}
782+
type: TYPE_BOX
783+
id: "property_button_small/E_Anchor"
784+
parent: "property_button_small/root"
785+
overridden_fields: 4
786+
template_node_child: true
787+
}
788+
nodes {
789+
position {
790+
x: -20.0
791+
}
792+
size {
793+
x: 40.0
794+
y: 40.0
795+
}
796+
type: TYPE_BOX
797+
id: "property_button_small/button"
798+
parent: "property_button_small/E_Anchor"
799+
overridden_fields: 1
800+
overridden_fields: 4
801+
template_node_child: true
802+
}
803+
nodes {
804+
size {
805+
x: 40.0
806+
y: 4.0
807+
}
808+
type: TYPE_BOX
809+
id: "property_button_small/selected"
810+
parent: "property_button_small/button"
811+
overridden_fields: 4
812+
template_node_child: true
813+
}
814+
nodes {
815+
size {
816+
x: 40.0
817+
y: 50.0
818+
}
819+
type: TYPE_TEXT
820+
text: ">"
821+
id: "property_button_small/text_button"
822+
parent: "property_button_small/button"
823+
overridden_fields: 4
824+
overridden_fields: 8
825+
template_node_child: true
826+
}
750827
material: "/builtins/materials/gui.material"
751828
adjust_reference: ADJUST_REFERENCE_PARENT

druid/widget/properties_panel/properties_panel.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function M:init()
8888
gui.set_enabled(self:get_node("property_checkbox/root"), false)
8989
gui.set_enabled(self:get_node("property_slider/root"), false)
9090
gui.set_enabled(self:get_node("property_button/root"), false)
91+
gui.set_enabled(self:get_node("property_button_small/root"), false)
9192
gui.set_enabled(self:get_node("property_input/root"), false)
9293
gui.set_enabled(self:get_node("property_text/root"), false)
9394
gui.set_enabled(self:get_node("property_left_right_selector/root"), false)
@@ -254,6 +255,12 @@ function M:add_button(on_create)
254255
return self:add_inner_widget(property_button, "property_button", "root", on_create)
255256
end
256257

258+
---@param on_create fun(button: druid.widget.property_button)|nil
259+
---@return druid.widget.properties_panel
260+
function M:add_button_small(on_create)
261+
return self:add_inner_widget(property_button, "property_button_small", "root", on_create)
262+
end
263+
257264

258265
---@param on_create fun(input: druid.widget.property_input)|nil
259266
---@return druid.widget.properties_panel
@@ -378,6 +385,7 @@ function M:set_hidden(is_hidden)
378385
gui.set_enabled(self.text_header.node, not self._is_hidden)
379386
gui.set_enabled(self.content, not self._is_hidden)
380387
gui.set_enabled(self.button_refresh.node, not self._is_hidden)
388+
gui.set_visible(self.button_back.node, not self._is_hidden)
381389

382390
if not self._is_hidden then
383391
self.is_dirty = true

0 commit comments

Comments
 (0)