From 07707a3627b09544e5f6ac5821a9367e1c654707 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 29 Aug 2021 17:01:07 -0300 Subject: [PATCH] Revert "Display a matrix for Node2D and don't display a duplicate origin" --- doc/classes/Node2D.xml | 2 +- doc/classes/Node3D.xml | 3 --- editor/editor_properties.cpp | 8 +++----- editor/editor_properties.h | 2 +- scene/2d/node_2d.cpp | 4 +--- scene/3d/node_3d.cpp | 29 +++-------------------------- scene/3d/node_3d.h | 2 -- 7 files changed, 9 insertions(+), 41 deletions(-) diff --git a/doc/classes/Node2D.xml b/doc/classes/Node2D.xml index e85b16c1643..cc790b7c28b 100644 --- a/doc/classes/Node2D.xml +++ b/doc/classes/Node2D.xml @@ -115,7 +115,7 @@ - + Local [Transform2D]. diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index b0034e791a6..49901dc4d95 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -255,9 +255,6 @@ - - Local space [Basis] of this node, with respect to the parent node. This is the same as [code]transform.basis[/code]. - World3D space (global) [Transform3D] of this node. diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index d1380e928ad..cb7fffe5922 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(bool p_include_origin) { +EditorPropertyTransform2D::EditorPropertyTransform2D() { GridContainer *g = memnew(GridContainer); g->set_columns(2); add_child(g); @@ -2278,9 +2278,7 @@ EditorPropertyTransform2D::EditorPropertyTransform2D(bool p_include_origin) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); spin[i]->set_flat(true); - if (p_include_origin || i < 4) { - g->add_child(spin[i]); - } + 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])); @@ -3287,7 +3285,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ } break; case Variant::TRANSFORM2D: { - EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D(p_usage != PROPERTY_USAGE_EDITOR)); + EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D); 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 b4b9dc4c469..0cb21bb391f 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(bool p_include_origin = true); + EditorPropertyTransform2D(); }; class EditorPropertyBasis : public EditorProperty { diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 6567598e7aa..6a8788ee6ef 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -421,13 +421,11 @@ void Node2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater,radians"), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scale"), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "skew", PROPERTY_HINT_RANGE, "-89.9,89.9,0.1,radians"), "set_skew", "get_skew"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_global_position", "get_global_position"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "global_rotation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_global_rotation", "get_global_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_global_scale", "get_global_scale"); - - ADD_GROUP("Raw Matrix", ""); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "global_transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_global_transform", "get_global_transform"); ADD_GROUP("Ordering", ""); diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index c4abecfc825..12470939f57 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -220,15 +220,6 @@ void Node3D::_notification(int p_what) { } } -void Node3D::set_basis(const Basis &p_basis) { - data.local_transform = Transform3D(p_basis, data.local_transform.origin); - data.dirty |= DIRTY_VECTORS; - _propagate_transform_changed(this); - if (data.notify_local_transform) { - notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); - } -} - void Node3D::set_transform(const Transform3D &p_transform) { data.local_transform = p_transform; data.dirty |= DIRTY_VECTORS; @@ -247,14 +238,6 @@ void Node3D::set_global_transform(const Transform3D &p_transform) { set_transform(xform); } -Basis Node3D::get_basis() const { - if (data.dirty & DIRTY_LOCAL) { - _update_local_transform(); - } - - return data.local_transform.basis; -} - Transform3D Node3D::get_transform() const { if (data.dirty & DIRTY_LOCAL) { _update_local_transform(); @@ -782,9 +765,7 @@ NodePath Node3D::get_visibility_parent() const { } void Node3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_basis", "basis"), &Node3D::set_basis); - ClassDB::bind_method(D_METHOD("get_basis"), &Node3D::get_basis); - ClassDB::bind_method(D_METHOD("set_transform", "transform"), &Node3D::set_transform); + ClassDB::bind_method(D_METHOD("set_transform", "local"), &Node3D::set_transform); ClassDB::bind_method(D_METHOD("get_transform"), &Node3D::get_transform); ClassDB::bind_method(D_METHOD("set_position", "position"), &Node3D::set_position); ClassDB::bind_method(D_METHOD("get_position"), &Node3D::get_position); @@ -857,12 +838,8 @@ void Node3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation", PROPERTY_HINT_RANGE, "-360,360,0.1,or_lesser,or_greater,radians", PROPERTY_USAGE_EDITOR), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "top_level"), "set_as_top_level", "is_set_as_top_level"); - - ADD_GROUP("Raw Matrix", ""); - // No need to display the full Transform, we already have the translation above. - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "set_transform", "get_transform"); - ADD_PROPERTY(PropertyInfo(Variant::BASIS, "basis", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_basis", "get_basis"); - + ADD_GROUP("Matrix", ""); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform"); ADD_GROUP("Visibility", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "visibility_parent", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "GeometryInstance3D"), "set_visibility_parent", "get_visibility_parent"); diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h index 3d9a7ab075b..0fd0c4e2059 100644 --- a/scene/3d/node_3d.h +++ b/scene/3d/node_3d.h @@ -136,11 +136,9 @@ public: Vector3 get_rotation() const; Vector3 get_scale() const; - void set_basis(const Basis &p_basis); void set_transform(const Transform3D &p_transform); void set_global_transform(const Transform3D &p_transform); - Basis get_basis() const; Transform3D get_transform() const; Transform3D get_global_transform() const;