Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
c2b43403
Unverified
Commit
c2b43403
authored
Jun 11, 2020
by
Yuri Roubinsky
Committed by
GitHub
Jun 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39438 from Chaosus/fix_custom_property_editor
Fix custom property editor layout
parents
ffbea8aa
f6ed4656
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
property_editor.cpp
editor/property_editor.cpp
+25
-4
property_editor.h
editor/property_editor.h
+2
-0
No files found.
editor/property_editor.cpp
View file @
c2b43403
...
...
@@ -326,6 +326,9 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
menu
->
set_size
(
Size2
(
1
,
1
)
*
EDSCALE
);
for
(
int
i
=
0
;
i
<
MAX_VALUE_EDITORS
;
i
++
)
{
if
(
i
<
MAX_VALUE_EDITORS
/
4
)
{
value_hboxes
[
i
]
->
hide
();
}
value_editor
[
i
]
->
hide
();
value_label
[
i
]
->
hide
();
if
(
i
<
4
)
{
...
...
@@ -1701,6 +1704,14 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns, int
set_size
(
Size2
(
cell_margin
+
p_label_w
+
(
cell_width
+
cell_margin
+
p_label_w
)
*
p_columns
,
cell_margin
+
(
cell_height
+
cell_margin
)
*
rows
)
*
EDSCALE
);
for
(
int
i
=
0
;
i
<
MAX_VALUE_EDITORS
;
i
++
)
{
if
(
i
<
MAX_VALUE_EDITORS
/
4
)
{
if
(
i
<=
p_amount
/
4
)
{
value_hboxes
[
i
]
->
show
();
}
else
{
value_hboxes
[
i
]
->
hide
();
}
}
int
c
=
i
%
p_columns
;
int
r
=
i
/
p_columns
;
...
...
@@ -1729,13 +1740,23 @@ CustomPropertyEditor::CustomPropertyEditor() {
read_only
=
false
;
updating
=
false
;
value_vbox
=
memnew
(
VBoxContainer
);
add_child
(
value_vbox
);
for
(
int
i
=
0
;
i
<
MAX_VALUE_EDITORS
;
i
++
)
{
value_editor
[
i
]
=
memnew
(
LineEdit
);
add_child
(
value_editor
[
i
]);
if
(
i
<
MAX_VALUE_EDITORS
/
4
)
{
value_hboxes
[
i
]
=
memnew
(
HBoxContainer
);
value_vbox
->
add_child
(
value_hboxes
[
i
]);
value_hboxes
[
i
]
->
hide
();
}
int
hbox_idx
=
i
/
4
;
value_label
[
i
]
=
memnew
(
Label
);
add_child
(
value_label
[
i
]);
value_editor
[
i
]
->
hide
();
value_hboxes
[
hbox_idx
]
->
add_child
(
value_label
[
i
]);
value_label
[
i
]
->
hide
();
value_editor
[
i
]
=
memnew
(
LineEdit
);
value_hboxes
[
hbox_idx
]
->
add_child
(
value_editor
[
i
]);
value_editor
[
i
]
->
set_h_size_flags
(
Control
::
SIZE_EXPAND_FILL
);
value_editor
[
i
]
->
hide
();
value_editor
[
i
]
->
connect
(
"text_entered"
,
callable_mp
(
this
,
&
CustomPropertyEditor
::
_modified
));
value_editor
[
i
]
->
connect
(
"focus_entered"
,
callable_mp
(
this
,
&
CustomPropertyEditor
::
_focus_enter
));
value_editor
[
i
]
->
connect
(
"focus_exited"
,
callable_mp
(
this
,
&
CustomPropertyEditor
::
_focus_exit
));
...
...
editor/property_editor.h
View file @
c2b43403
...
...
@@ -100,6 +100,8 @@ class CustomPropertyEditor : public PopupPanel {
List
<
String
>
field_names
;
int
hint
;
String
hint_text
;
HBoxContainer
*
value_hboxes
[
MAX_VALUE_EDITORS
/
4
];
VBoxContainer
*
value_vbox
;
LineEdit
*
value_editor
[
MAX_VALUE_EDITORS
];
int
focused_value_editor
;
Label
*
value_label
[
MAX_VALUE_EDITORS
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment