diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-16 09:30:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 09:30:22 +0200 |
commit | 8db8577f1070a5a10410ed41dab27929be2bc612 (patch) | |
tree | afffc4d407c169f355b77aa348717e048dbb0901 /editor/editor_properties.cpp | |
parent | 6cefb8d36847e5535f5070e7c3f6763190769941 (diff) | |
parent | 24905becb26771e14c05d0976628cd494513f49a (diff) |
Merge pull request #39126 from TwistedTwigleg/GSOC_2020_Working_Branch
Skeleton and Skeleton inspector low-level changes
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r-- | editor/editor_properties.cpp | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index cfa0c7a063..74267452e6 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1283,14 +1283,25 @@ void EditorPropertyVector3::_value_changed(double val, const String &p_name) { } void EditorPropertyVector3::update_property() { - Vector3 val = get_edited_object()->get(get_edited_property()); + update_using_vector(get_edited_object()->get(get_edited_property())); +} + +void EditorPropertyVector3::update_using_vector(Vector3 p_vector) { setting = true; - spin[0]->set_value(val.x); - spin[1]->set_value(val.y); - spin[2]->set_value(val.z); + spin[0]->set_value(p_vector.x); + spin[1]->set_value(p_vector.y); + spin[2]->set_value(p_vector.z); setting = false; } +Vector3 EditorPropertyVector3::get_vector() { + Vector3 v3; + v3.x = spin[0]->get_value(); + v3.y = spin[1]->get_value(); + v3.z = spin[2]->get_value(); + return v3; +} + void EditorPropertyVector3::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { Color base = get_theme_color("accent_color", "Editor"); @@ -1434,7 +1445,7 @@ EditorPropertyVector2i::EditorPropertyVector2i(bool p_force_wide) { setting = false; } -///////////////////// RECT2 ///////////////////////// +///////////////////// RECT2i ///////////////////////// void EditorPropertyRect2i::_value_changed(double val, const String &p_name) { if (setting) { @@ -1520,7 +1531,7 @@ EditorPropertyRect2i::EditorPropertyRect2i(bool p_force_wide) { setting = false; } -///////////////////// VECTOR3 ///////////////////////// +///////////////////// VECTOR3i ///////////////////////// void EditorPropertyVector3i::_value_changed(double val, const String &p_name) { if (setting) { @@ -2029,21 +2040,23 @@ void EditorPropertyTransform::_value_changed(double val, const String &p_name) { } void EditorPropertyTransform::update_property() { - Transform val = get_edited_object()->get(get_edited_property()); - setting = true; - spin[0]->set_value(val.basis[0][0]); - spin[1]->set_value(val.basis[1][0]); - spin[2]->set_value(val.basis[2][0]); - spin[3]->set_value(val.basis[0][1]); - spin[4]->set_value(val.basis[1][1]); - spin[5]->set_value(val.basis[2][1]); - spin[6]->set_value(val.basis[0][2]); - spin[7]->set_value(val.basis[1][2]); - spin[8]->set_value(val.basis[2][2]); - spin[9]->set_value(val.origin[0]); - spin[10]->set_value(val.origin[1]); - spin[11]->set_value(val.origin[2]); + update_using_transform(get_edited_object()->get(get_edited_property())); +} +void EditorPropertyTransform::update_using_transform(Transform p_transform) { + setting = true; + spin[0]->set_value(p_transform.basis[0][0]); + spin[1]->set_value(p_transform.basis[1][0]); + spin[2]->set_value(p_transform.basis[2][0]); + spin[3]->set_value(p_transform.basis[0][1]); + spin[4]->set_value(p_transform.basis[1][1]); + spin[5]->set_value(p_transform.basis[2][1]); + spin[6]->set_value(p_transform.basis[0][2]); + spin[7]->set_value(p_transform.basis[1][2]); + spin[8]->set_value(p_transform.basis[2][2]); + spin[9]->set_value(p_transform.origin[0]); + spin[10]->set_value(p_transform.origin[1]); + spin[11]->set_value(p_transform.origin[2]); setting = false; } |