From ee7bb9bbb9ebf5f4bb6d046340807e2982879428 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 4 Apr 2021 22:27:00 -0400 Subject: Display a matrix for Node2D and don't display a duplicate origin --- editor/editor_properties.cpp | 8 +++++--- editor/editor_properties.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'editor') diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index cb7fffe592..d1380e928a 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2268,7 +2268,7 @@ void EditorPropertyTransform2D::setup(double p_min, double p_max, double p_step, } } -EditorPropertyTransform2D::EditorPropertyTransform2D() { +EditorPropertyTransform2D::EditorPropertyTransform2D(bool p_include_origin) { GridContainer *g = memnew(GridContainer); g->set_columns(2); add_child(g); @@ -2278,7 +2278,9 @@ EditorPropertyTransform2D::EditorPropertyTransform2D() { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); spin[i]->set_flat(true); - g->add_child(spin[i]); + if (p_include_origin || i < 4) { + g->add_child(spin[i]); + } spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); spin[i]->connect("value_changed", callable_mp(this, &EditorPropertyTransform2D::_value_changed), varray(desc[i])); @@ -3285,7 +3287,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ } break; case Variant::TRANSFORM2D: { - EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); + EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D(p_usage != PROPERTY_USAGE_EDITOR)); EditorPropertyRangeHint hint = _parse_range_hint(p_hint, p_hint_text, default_float_step); editor->setup(hint.min, hint.max, hint.step, hint.hide_slider, hint.suffix); return editor; diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 0cb21bb391..b4b9dc4c46 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -531,7 +531,7 @@ protected: public: virtual void update_property() override; void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String()); - EditorPropertyTransform2D(); + EditorPropertyTransform2D(bool p_include_origin = true); }; class EditorPropertyBasis : public EditorProperty { -- cgit v1.2.3