summaryrefslogtreecommitdiff
path: root/scene/2d/skeleton_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/skeleton_2d.cpp')
-rw-r--r--scene/2d/skeleton_2d.cpp46
1 files changed, 22 insertions, 24 deletions
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index cbacb7f579..62787d4488 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -44,7 +44,7 @@ bool Bone2D::_set(const StringName &p_path, const Variant &p_value) {
} else if (path.begins_with("length")) {
set_length(p_value);
} else if (path.begins_with("bone_angle")) {
- set_bone_angle(Math::deg2rad(real_t(p_value)));
+ set_bone_angle(Math::deg_to_rad(real_t(p_value)));
} else if (path.begins_with("default_length")) {
set_length(p_value);
}
@@ -66,7 +66,7 @@ bool Bone2D::_get(const StringName &p_path, Variant &r_ret) const {
} else if (path.begins_with("length")) {
r_ret = get_length();
} else if (path.begins_with("bone_angle")) {
- r_ret = Math::rad2deg(get_bone_angle());
+ r_ret = Math::rad_to_deg(get_bone_angle());
} else if (path.begins_with("default_length")) {
r_ret = get_length();
}
@@ -126,7 +126,7 @@ void Bone2D::_notification(int p_what) {
return;
}
- update();
+ queue_redraw();
#endif // TOOLS_ENABLED
} break;
@@ -143,12 +143,12 @@ void Bone2D::_notification(int p_what) {
return;
}
- update();
+ queue_redraw();
if (get_parent()) {
- Bone2D *parent_bone = Object::cast_to<Bone2D>(get_parent());
- if (parent_bone) {
- parent_bone->update();
+ Bone2D *p_bone = Object::cast_to<Bone2D>(get_parent());
+ if (p_bone) {
+ p_bone->queue_redraw();
}
}
#endif // TOOLS_ENABLED
@@ -192,10 +192,8 @@ void Bone2D::_notification(int p_what) {
cache_transform = tmp_trans;
} break;
- // Bone2D Editor gizmo drawing:
-#ifndef _MSC_VER
-#warning TODO Bone2D gizmo drawing needs to be moved to an editor plugin
-#endif
+ // Bone2D Editor gizmo drawing.
+ // TODO: Bone2D gizmo drawing needs to be moved to an editor plugin.
case NOTIFICATION_DRAW: {
// Only draw the gizmo in the editor!
if (Engine::get_singleton()->is_editor_hint() == false) {
@@ -215,15 +213,15 @@ void Bone2D::_notification(int p_what) {
}
// Undo scaling
- Transform2D editor_gizmo_trans = Transform2D();
+ Transform2D editor_gizmo_trans;
editor_gizmo_trans.set_scale(Vector2(1, 1) / get_global_scale());
RenderingServer::get_singleton()->canvas_item_set_transform(editor_gizmo_rid, editor_gizmo_trans);
- Color bone_color1 = EditorSettings::get_singleton()->get("editors/2d/bone_color1");
- Color bone_color2 = EditorSettings::get_singleton()->get("editors/2d/bone_color2");
- Color bone_ik_color = EditorSettings::get_singleton()->get("editors/2d/bone_ik_color");
- Color bone_outline_color = EditorSettings::get_singleton()->get("editors/2d/bone_outline_color");
- Color bone_selected_color = EditorSettings::get_singleton()->get("editors/2d/bone_selected_color");
+ Color bone_color1 = EDITOR_GET("editors/2d/bone_color1");
+ Color bone_color2 = EDITOR_GET("editors/2d/bone_color2");
+ Color bone_ik_color = EDITOR_GET("editors/2d/bone_ik_color");
+ Color bone_outline_color = EDITOR_GET("editors/2d/bone_outline_color");
+ Color bone_selected_color = EDITOR_GET("editors/2d/bone_selected_color");
bool Bone2D_found = false;
for (int i = 0; i < get_child_count(); i++) {
@@ -319,8 +317,8 @@ void Bone2D::_notification(int p_what) {
#ifdef TOOLS_ENABLED
bool Bone2D::_editor_get_bone_shape(Vector<Vector2> *p_shape, Vector<Vector2> *p_outline_shape, Bone2D *p_other_bone) {
- int bone_width = EditorSettings::get_singleton()->get("editors/2d/bone_width");
- int bone_outline_width = EditorSettings::get_singleton()->get("editors/2d/bone_outline_size");
+ int bone_width = EDITOR_GET("editors/2d/bone_width");
+ int bone_outline_width = EDITOR_GET("editors/2d/bone_outline_size");
if (!is_inside_tree()) {
return false; //may have been removed
@@ -365,7 +363,7 @@ bool Bone2D::_editor_get_bone_shape(Vector<Vector2> *p_shape, Vector<Vector2> *p
void Bone2D::_editor_set_show_bone_gizmo(bool p_show_gizmo) {
_editor_show_bone_gizmo = p_show_gizmo;
- update();
+ queue_redraw();
}
bool Bone2D::_editor_get_show_bone_gizmo() const {
@@ -434,8 +432,8 @@ int Bone2D::get_index_in_skeleton() const {
return skeleton_index;
}
-TypedArray<String> Bone2D::get_configuration_warnings() const {
- TypedArray<String> warnings = Node::get_configuration_warnings();
+PackedStringArray Bone2D::get_configuration_warnings() const {
+ PackedStringArray warnings = Node::get_configuration_warnings();
if (!skeleton) {
if (parent_bone) {
warnings.push_back(RTR("This Bone2D chain should end at a Skeleton2D node."));
@@ -493,7 +491,7 @@ void Bone2D::set_length(real_t p_length) {
length = p_length;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif // TOOLS_ENABLED
}
@@ -505,7 +503,7 @@ void Bone2D::set_bone_angle(real_t p_angle) {
bone_angle = p_angle;
#ifdef TOOLS_ENABLED
- update();
+ queue_redraw();
#endif // TOOLS_ENABLED
}