|
@@ -178,6 +178,8 @@ void EditorPropertyTextEnum::_bind_methods() {
|
|
|
EditorPropertyTextEnum::EditorPropertyTextEnum() {
|
|
|
options = memnew(OptionButton);
|
|
|
options->set_clip_text(true);
|
|
|
+ options->set_flat(true);
|
|
|
+
|
|
|
add_child(options);
|
|
|
add_focusable(options);
|
|
|
options->connect("item_selected", this, "_option_selected");
|
|
@@ -417,6 +419,7 @@ void EditorPropertyEnum::_bind_methods() {
|
|
|
EditorPropertyEnum::EditorPropertyEnum() {
|
|
|
options = memnew(OptionButton);
|
|
|
options->set_clip_text(true);
|
|
|
+ options->set_flat(true);
|
|
|
add_child(options);
|
|
|
add_focusable(options);
|
|
|
options->connect("item_selected", this, "_option_selected");
|
|
@@ -711,6 +714,7 @@ void EditorPropertyInteger::setup(int p_min, int p_max, bool p_allow_greater, bo
|
|
|
|
|
|
EditorPropertyInteger::EditorPropertyInteger() {
|
|
|
spin = memnew(EditorSpinSlider);
|
|
|
+ spin->set_flat(true);
|
|
|
add_child(spin);
|
|
|
add_focusable(spin);
|
|
|
spin->connect("value_changed", this, "_value_changed");
|
|
@@ -797,6 +801,7 @@ void EditorPropertyFloat::setup(double p_min, double p_max, double p_step, bool
|
|
|
|
|
|
EditorPropertyFloat::EditorPropertyFloat() {
|
|
|
spin = memnew(EditorSpinSlider);
|
|
|
+ spin->set_flat(true);
|
|
|
add_child(spin);
|
|
|
add_focusable(spin);
|
|
|
spin->connect("value_changed", this, "_value_changed");
|
|
@@ -807,6 +812,12 @@ EditorPropertyFloat::EditorPropertyFloat() {
|
|
|
|
|
|
void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
|
|
|
|
|
|
+ Ref<InputEventMouseButton> mb = p_ev;
|
|
|
+ if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
|
|
+ preset->set_global_position(easing_draw->get_global_transform().xform(mb->get_position()));
|
|
|
+ preset->popup();
|
|
|
+ }
|
|
|
+
|
|
|
Ref<InputEventMouseMotion> mm = p_ev;
|
|
|
|
|
|
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
|
@@ -844,7 +855,7 @@ void EditorPropertyEasing::_draw_easing() {
|
|
|
Size2 s = easing_draw->get_size();
|
|
|
Rect2 r(Point2(), s);
|
|
|
r = r.grow(3);
|
|
|
- get_stylebox("normal", "LineEdit")->draw(ci, r);
|
|
|
+ //get_stylebox("normal", "LineEdit")->draw(ci, r);
|
|
|
|
|
|
int points = 48;
|
|
|
|
|
@@ -854,6 +865,7 @@ void EditorPropertyEasing::_draw_easing() {
|
|
|
Ref<Font> f = get_font("font", "Label");
|
|
|
Color color = get_color("font_color", "Label");
|
|
|
|
|
|
+ Vector<Point2> lines;
|
|
|
for (int i = 1; i <= points; i++) {
|
|
|
|
|
|
float ifl = i / float(points);
|
|
@@ -866,10 +878,12 @@ void EditorPropertyEasing::_draw_easing() {
|
|
|
iflp = 1.0 - iflp;
|
|
|
}
|
|
|
|
|
|
- VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(iflp * s.width, prev * s.height), Point2(ifl * s.width, h * s.height), color);
|
|
|
+ lines.push_back(Point2(ifl * s.width, h * s.height));
|
|
|
+ lines.push_back(Point2(iflp * s.width, prev * s.height));
|
|
|
prev = h;
|
|
|
}
|
|
|
|
|
|
+ easing_draw->draw_multiline(lines, color, 1.0, true);
|
|
|
f->draw(ci, Point2(10, 10 + f->get_ascent()), String::num(exp, 2), color);
|
|
|
}
|
|
|
|
|
@@ -877,29 +891,17 @@ void EditorPropertyEasing::update_property() {
|
|
|
easing_draw->update();
|
|
|
}
|
|
|
|
|
|
-void EditorPropertyEasing::_set_preset(float p_val) {
|
|
|
- emit_signal("property_changed", get_edited_property(), p_val);
|
|
|
+void EditorPropertyEasing::_set_preset(int p_preset) {
|
|
|
+ static const float preset_value[EASING_MAX] = { 0.0, 1.0, 2.0, 0.5, -2.0, -0.5 };
|
|
|
+
|
|
|
+ emit_signal("property_changed", get_edited_property(), preset_value[p_preset]);
|
|
|
easing_draw->update();
|
|
|
}
|
|
|
|
|
|
void EditorPropertyEasing::setup(bool p_full, bool p_flip) {
|
|
|
|
|
|
flip = p_flip;
|
|
|
- if (p_full) {
|
|
|
- HBoxContainer *hb2 = memnew(HBoxContainer);
|
|
|
- vb->add_child(hb2);
|
|
|
- button_out_in = memnew(ToolButton);
|
|
|
- button_out_in->set_tooltip(TTR("Out-In"));
|
|
|
- button_out_in->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- button_out_in->connect("pressed", this, "_set_preset", varray(-0.5));
|
|
|
- hb2->add_child(button_out_in);
|
|
|
-
|
|
|
- button_in_out = memnew(ToolButton);
|
|
|
- button_in_out->set_tooltip(TTR("In"));
|
|
|
- button_in_out->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- button_in_out->connect("pressed", this, "_set_preset", varray(-2));
|
|
|
- hb2->add_child(button_in_out);
|
|
|
- }
|
|
|
+ full = p_full;
|
|
|
}
|
|
|
|
|
|
void EditorPropertyEasing::_notification(int p_what) {
|
|
@@ -907,15 +909,19 @@ void EditorPropertyEasing::_notification(int p_what) {
|
|
|
switch (p_what) {
|
|
|
case NOTIFICATION_THEME_CHANGED:
|
|
|
case NOTIFICATION_ENTER_TREE: {
|
|
|
+ preset->clear();
|
|
|
+ preset->add_icon_item(get_icon("CurveConstant", "EditorIcons"), "Zero", EASING_ZERO);
|
|
|
+ preset->add_icon_item(get_icon("CurveLinear", "EditorIcons"), "Linear", EASING_LINEAR);
|
|
|
+ preset->add_icon_item(get_icon("CurveIn", "EditorIcons"), "In", EASING_IN);
|
|
|
+ preset->add_icon_item(get_icon("CurveOut", "EditorIcons"), "Out", EASING_OUT);
|
|
|
+ if (full) {
|
|
|
+ preset->add_icon_item(get_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT);
|
|
|
+ preset->add_icon_item(get_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN);
|
|
|
+ }
|
|
|
easing_draw->set_custom_minimum_size(Size2(0, get_font("font", "Label")->get_height() * 2));
|
|
|
- button_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
|
|
|
- button_out->set_icon(get_icon("CurveOut", "EditorIcons"));
|
|
|
- button_in->set_icon(get_icon("CurveIn", "EditorIcons"));
|
|
|
- button_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
|
|
|
- if (button_out_in)
|
|
|
- button_out_in->set_icon(get_icon("CurveOutIn", "EditorIcons"));
|
|
|
- if (button_in_out)
|
|
|
- button_in_out->set_icon(get_icon("CurveInOut", "EditorIcons"));
|
|
|
+ } break;
|
|
|
+ case NOTIFICATION_RESIZED: {
|
|
|
+
|
|
|
} break;
|
|
|
}
|
|
|
}
|
|
@@ -929,47 +935,18 @@ void EditorPropertyEasing::_bind_methods() {
|
|
|
|
|
|
EditorPropertyEasing::EditorPropertyEasing() {
|
|
|
|
|
|
- vb = memnew(VBoxContainer);
|
|
|
- add_child(vb);
|
|
|
- HBoxContainer *hb = memnew(HBoxContainer);
|
|
|
- set_label_reference(hb);
|
|
|
-
|
|
|
- vb->add_child(hb);
|
|
|
-
|
|
|
- button_linear = memnew(ToolButton);
|
|
|
- button_linear->set_tooltip(TTR("Linear"));
|
|
|
- button_linear->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- button_linear->connect("pressed", this, "_set_preset", varray(1));
|
|
|
- hb->add_child(button_linear);
|
|
|
-
|
|
|
- button_constant = memnew(ToolButton);
|
|
|
- button_constant->set_tooltip(TTR("Linear"));
|
|
|
- button_constant->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- button_constant->connect("pressed", this, "_set_preset", varray(0));
|
|
|
- hb->add_child(button_constant);
|
|
|
-
|
|
|
- button_out = memnew(ToolButton);
|
|
|
- button_out->set_tooltip(TTR("Out"));
|
|
|
- button_out->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- button_out->connect("pressed", this, "_set_preset", varray(0.5));
|
|
|
- hb->add_child(button_out);
|
|
|
-
|
|
|
- button_in = memnew(ToolButton);
|
|
|
- button_in->set_tooltip(TTR("In"));
|
|
|
- button_in->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
- button_in->connect("pressed", this, "_set_preset", varray(2));
|
|
|
- hb->add_child(button_in);
|
|
|
-
|
|
|
- button_in_out = NULL;
|
|
|
- button_out_in = NULL;
|
|
|
-
|
|
|
easing_draw = memnew(Control);
|
|
|
easing_draw->connect("draw", this, "_draw_easing");
|
|
|
easing_draw->connect("gui_input", this, "_drag_easing");
|
|
|
easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE);
|
|
|
- vb->add_child(easing_draw);
|
|
|
+ add_child(easing_draw);
|
|
|
+
|
|
|
+ preset = memnew(PopupMenu);
|
|
|
+ add_child(preset);
|
|
|
+ preset->connect("id_pressed", this, "_set_preset");
|
|
|
|
|
|
flip = false;
|
|
|
+ full = false;
|
|
|
}
|
|
|
|
|
|
///////////////////// VECTOR2 /////////////////////////
|
|
@@ -1012,6 +989,7 @@ EditorPropertyVector2::EditorPropertyVector2() {
|
|
|
static const char *desc[2] = { "x", "y" };
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
vb->add_child(spin[i]);
|
|
|
add_focusable(spin[i]);
|
|
@@ -1066,6 +1044,8 @@ EditorPropertyRect2::EditorPropertyRect2() {
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
+
|
|
|
vb->add_child(spin[i]);
|
|
|
add_focusable(spin[i]);
|
|
|
spin[i]->connect("value_changed", this, "_value_changed");
|
|
@@ -1116,6 +1096,8 @@ EditorPropertyVector3::EditorPropertyVector3() {
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
+
|
|
|
vb->add_child(spin[i]);
|
|
|
add_focusable(spin[i]);
|
|
|
spin[i]->connect("value_changed", this, "_value_changed");
|
|
@@ -1168,6 +1150,7 @@ EditorPropertyPlane::EditorPropertyPlane() {
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
vb->add_child(spin[i]);
|
|
|
add_focusable(spin[i]);
|
|
|
spin[i]->connect("value_changed", this, "_value_changed");
|
|
@@ -1221,6 +1204,8 @@ EditorPropertyQuat::EditorPropertyQuat() {
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
+
|
|
|
vb->add_child(spin[i]);
|
|
|
add_focusable(spin[i]);
|
|
|
spin[i]->connect("value_changed", this, "_value_changed");
|
|
@@ -1282,6 +1267,8 @@ EditorPropertyAABB::EditorPropertyAABB() {
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
+
|
|
|
g->add_child(spin[i]);
|
|
|
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
add_focusable(spin[i]);
|
|
@@ -1340,10 +1327,11 @@ EditorPropertyTransform2D::EditorPropertyTransform2D() {
|
|
|
g->set_columns(2);
|
|
|
add_child(g);
|
|
|
|
|
|
- static const char *desc[6] = { "xx", "xy", "yx", "yy", "ox", "oy" };
|
|
|
+ static const char *desc[6] = { "x", "y", "x", "y", "x", "y" };
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
g->add_child(spin[i]);
|
|
|
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
add_focusable(spin[i]);
|
|
@@ -1408,10 +1396,11 @@ EditorPropertyBasis::EditorPropertyBasis() {
|
|
|
g->set_columns(3);
|
|
|
add_child(g);
|
|
|
|
|
|
- static const char *desc[9] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" };
|
|
|
+ static const char *desc[9] = { "x", "y", "z", "x", "y", "z", "x", "y", "z" };
|
|
|
for (int i = 0; i < 9; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
g->add_child(spin[i]);
|
|
|
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
add_focusable(spin[i]);
|
|
@@ -1482,10 +1471,11 @@ EditorPropertyTransform::EditorPropertyTransform() {
|
|
|
g->set_columns(3);
|
|
|
add_child(g);
|
|
|
|
|
|
- static const char *desc[12] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz", "ox", "oy", "oz" };
|
|
|
+ static const char *desc[12] = { "x", "y", "z", "x", "y", "z", "x", "y", "z", "x", "y", "z" };
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
spin[i] = memnew(EditorSpinSlider);
|
|
|
spin[i]->set_label(desc[i]);
|
|
|
+ spin[i]->set_flat(true);
|
|
|
g->add_child(spin[i]);
|
|
|
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
add_focusable(spin[i]);
|
|
@@ -1844,6 +1834,7 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<T
|
|
|
assign->set_custom_minimum_size(Size2(1, thumbnail_size));
|
|
|
}
|
|
|
preview->set_texture(p_preview);
|
|
|
+ assign->set_text("");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2037,6 +2028,9 @@ void EditorPropertyResource::update_property() {
|
|
|
sub_inspector = memnew(EditorInspector);
|
|
|
sub_inspector->set_enable_v_scroll(false);
|
|
|
|
|
|
+ sub_inspector->set_use_sub_inspector_bg(true);
|
|
|
+ sub_inspector->set_enable_capitalize_paths(true);
|
|
|
+
|
|
|
sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed");
|
|
|
sub_inspector->connect("resource_selected", this, "_sub_inspector_resource_selected");
|
|
|
sub_inspector->connect("object_id_selected", this, "_sub_inspector_object_id_selected");
|