You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Merge pull request #22407 from DualMatrix/step_int
Added step support when exporting integers.
This commit is contained in:
@@ -819,10 +819,10 @@ void EditorPropertyInteger::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyInteger::_value_changed);
|
ClassDB::bind_method(D_METHOD("_value_changed"), &EditorPropertyInteger::_value_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPropertyInteger::setup(int p_min, int p_max, bool p_allow_greater, bool p_allow_lesser) {
|
void EditorPropertyInteger::setup(int p_min, int p_max, int p_step, bool p_allow_greater, bool p_allow_lesser) {
|
||||||
spin->set_min(p_min);
|
spin->set_min(p_min);
|
||||||
spin->set_max(p_max);
|
spin->set_max(p_max);
|
||||||
spin->set_step(1);
|
spin->set_step(p_step);
|
||||||
spin->set_allow_greater(p_allow_greater);
|
spin->set_allow_greater(p_allow_greater);
|
||||||
spin->set_allow_lesser(p_allow_lesser);
|
spin->set_allow_lesser(p_allow_lesser);
|
||||||
}
|
}
|
||||||
@@ -2665,7 +2665,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
||||||
int min = 0, max = 65535;
|
int min = 0, max = 65535, step = 1;
|
||||||
bool greater = true, lesser = true;
|
bool greater = true, lesser = true;
|
||||||
|
|
||||||
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
|
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
|
||||||
@@ -2673,6 +2673,11 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
|
|||||||
lesser = false;
|
lesser = false;
|
||||||
min = p_hint_text.get_slice(",", 0).to_int();
|
min = p_hint_text.get_slice(",", 0).to_int();
|
||||||
max = p_hint_text.get_slice(",", 1).to_int();
|
max = p_hint_text.get_slice(",", 1).to_int();
|
||||||
|
|
||||||
|
if (p_hint_text.get_slice_count(",") >= 3) {
|
||||||
|
step = p_hint_text.get_slice(",", 2).to_int();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 2; i < p_hint_text.get_slice_count(","); i++) {
|
for (int i = 2; i < p_hint_text.get_slice_count(","); i++) {
|
||||||
String slice = p_hint_text.get_slice(",", i).strip_edges();
|
String slice = p_hint_text.get_slice(",", i).strip_edges();
|
||||||
if (slice == "or_greater") {
|
if (slice == "or_greater") {
|
||||||
@@ -2684,7 +2689,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
editor->setup(min, max, greater, lesser);
|
editor->setup(min, max, step, greater, lesser);
|
||||||
|
|
||||||
add_property_editor(p_path, editor);
|
add_property_editor(p_path, editor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void update_property();
|
virtual void update_property();
|
||||||
void setup(int p_min, int p_max, bool p_allow_greater, bool p_allow_lesser);
|
void setup(int p_min, int p_max, int p_step, bool p_allow_greater, bool p_allow_lesser);
|
||||||
EditorPropertyInteger();
|
EditorPropertyInteger();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ void EditorPropertyArray::update_property() {
|
|||||||
} break;
|
} break;
|
||||||
case Variant::INT: {
|
case Variant::INT: {
|
||||||
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
||||||
editor->setup(-100000, 100000, true, true);
|
editor->setup(-100000, 100000, 1, true, true);
|
||||||
prop = editor;
|
prop = editor;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@@ -800,7 +800,7 @@ void EditorPropertyDictionary::update_property() {
|
|||||||
} break;
|
} break;
|
||||||
case Variant::INT: {
|
case Variant::INT: {
|
||||||
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
|
||||||
editor->setup(-100000, 100000, true, true);
|
editor->setup(-100000, 100000, 1, true, true);
|
||||||
prop = editor;
|
prop = editor;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
Reference in New Issue
Block a user