Support explicit values in flag properties, add C# flags support

- Add support for explicit values in properties using `PROPERTY_HINT_FLAGS`
that works the same way it does for enums.
- Fix enums and flags in VisualScriptEditor (it wasn't considering the
explicit value).
- Use `PROPERTY_HINT_FLAGS` for C# enums with the FlagsAttribute instead
of `PROPERTY_HINT_ENUM`.
This commit is contained in:
Raul Santos
2022-03-06 18:04:29 +01:00
parent 1baee2189c
commit 329818f20b
10 changed files with 101 additions and 36 deletions

View File

@ -265,9 +265,9 @@ class EditorPropertyFlags : public EditorProperty {
GDCLASS(EditorPropertyFlags, EditorProperty);
VBoxContainer *vbox = nullptr;
Vector<CheckBox *> flags;
Vector<int> flag_indices;
Vector<uint32_t> flag_values;
void _flag_toggled();
void _flag_toggled(int p_index);
protected:
virtual void _set_read_only(bool p_read_only) override;