Merge pull request #22446 from akien-mga/fix-warnings

Fix various warnings raised by GCC 5
This commit is contained in:
Rémi Verschelde 2018-09-27 16:48:09 +02:00 committed by GitHub
commit 4cf5bb0276
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 184 additions and 366 deletions

View file

@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation_track_editor.h"
#include "animation_track_editor_plugins.h"
#include "core/os/keyboard.h"
#include "editor/animation_bezier_editor.h"
@ -772,9 +773,6 @@ void AnimationTimelineEdit::_notification(int p_what) {
hsize_rect = Rect2(get_name_limit() - hsize_icon->get_width() - 2 * EDSCALE, (get_size().height - hsize_icon->get_height()) / 2, hsize_icon->get_width(), hsize_icon->get_height());
draw_texture(hsize_icon, hsize_rect.position);
float keys_from = get_value();
float keys_to = keys_from + zoomw / scale;
{
float time_min = 0;
float time_max = animation->get_length();

View file

@ -267,11 +267,6 @@ void EditorProperty::_notification(int p_what) {
} else {
keying_rect = Rect2();
}
//int vs = get_constant("vseparation", "Tree");
Color guide_color = get_color("guide_color", "Tree");
int vs_height = get_size().height; // vs / 2;
// draw_line(Point2(0, vs_height), Point2(get_size().width, vs_height), guide_color);
}
}

View file

@ -39,6 +39,7 @@
#include "scene/3d/camera.h"
#include "scene/gui/popup_menu.h"
#include "servers/visual_server.h"
Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_size) {
Vector<Ref<Mesh> > meshes;
@ -522,7 +523,7 @@ int EditorPlugin::update_overlays() const {
if (SpatialEditor::get_singleton()->is_visible()) {
int count = 0;
for (int i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *vp = SpatialEditor::get_singleton()->get_editor_viewport(i);
if (vp->is_visible()) {
vp->update_surface();

View file

@ -744,7 +744,7 @@ void EditorPropertyDictionary::update_property() {
page->connect("value_changed", this, "_page_changed");
} else {
// Queue childs for deletion, delete immediately might cause errors.
for (size_t i = 1; i < vbox->get_child_count(); i++) {
for (int i = 1; i < vbox->get_child_count(); i++) {
vbox->get_child(i)->queue_delete();
}
}

View file

@ -36,7 +36,6 @@
#include "editor_scale.h"
#include "editor_settings.h"
#include "modules/svg/image_loader_svg.h"
#include "time.h"
static Ref<StyleBoxTexture> make_stylebox(Ref<Texture> p_texture, float p_left, float p_top, float p_right, float p_botton, float p_margin_left = -1, float p_margin_top = -1, float p_margin_right = -1, float p_margin_botton = -1, bool p_draw_center = true) {
Ref<StyleBoxTexture> style(memnew(StyleBoxTexture));
@ -199,8 +198,6 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
exceptions.push_back("StatusWarning");
exceptions.push_back("NodeWarning");
clock_t begin_time = clock();
ImageLoaderSVG::set_convert_colors(&dark_icon_color_dictionary);
// generate icons
@ -235,8 +232,6 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
}
ImageLoaderSVG::set_convert_colors(NULL);
clock_t end_time = clock();
#else
print_line("SVG support disabled, editor icons won't be rendered.");
#endif
@ -260,8 +255,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
bool use_gn_headers = EDITOR_DEF("interface/theme/use_graph_node_headers", false);
Color script_bg_color = EDITOR_DEF("text_editor/highlighting/background_color", Color(0, 0, 0, 0));
Color preset_accent_color;
Color preset_base_color;
float preset_contrast;
@ -1069,8 +1062,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const float mono_value = mono_color.r;
const Color alpha1 = Color(mono_value, mono_value, mono_value, 0.07);
const Color alpha2 = Color(mono_value, mono_value, mono_value, 0.14);
const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.5);
const Color alpha4 = Color(mono_value, mono_value, mono_value, 0.7);
const Color alpha3 = Color(mono_value, mono_value, mono_value, 0.7);
// editor main color
const Color main_color = Color::html(dark_theme ? "#57b3ff" : "#0480ff");
@ -1104,9 +1096,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6);
const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3);
const Color breakpoint_color = error_color;
const Color code_folding_color = alpha4;
const Color code_folding_color = alpha3;
const Color search_result_color = alpha1;
const Color search_result_border_color = alpha4;
const Color search_result_border_color = alpha3;
EditorSettings *setting = EditorSettings::get_singleton();
String text_editor_color_theme = setting->get("text_editor/theme/color_theme");

View file

@ -1910,15 +1910,15 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
NodePath node_path;
GLTFNode *node = state.nodes[E->key()];
for (int i = 0; i < node->godot_nodes.size(); i++) {
for (int n = 0; n < node->godot_nodes.size(); n++) {
if (node->joints.size()) {
Skeleton *sk = (Skeleton *)node->godot_nodes[i];
Skeleton *sk = (Skeleton *)node->godot_nodes[n];
String path = ap->get_parent()->get_path_to(sk);
String bone = sk->get_bone_name(node->joints[i].godot_bone_index);
String bone = sk->get_bone_name(node->joints[n].godot_bone_index);
node_path = path + ":" + bone;
} else {
node_path = ap->get_parent()->get_path_to(node->godot_nodes[i]);
node_path = ap->get_parent()->get_path_to(node->godot_nodes[n]);
}
for (int i = 0; i < track.rotation_track.times.size(); i++) {
@ -1993,8 +1993,8 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
xform.basis.set_quat_scale(rot, scale);
xform.origin = pos;
Skeleton *skeleton = skeletons[node->joints[i].skin];
int bone = node->joints[i].godot_bone_index;
Skeleton *skeleton = skeletons[node->joints[n].skin];
int bone = node->joints[n].godot_bone_index;
xform = skeleton->get_bone_rest(bone).affine_inverse() * xform;
rot = xform.basis.get_rotation_quat();

View file

@ -131,10 +131,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
Ref<AnimationNode> agnode = blend_tree->get_node(E->get());
if (!agnode->is_connected("changed", this, "_node_changed")) {
agnode->connect("changed", this, "_node_changed", varray(agnode->get_instance_id()), CONNECT_DEFERRED);
}
node->set_offset(blend_tree->get_node_position(E->get()) * EDSCALE);
node->set_title(agnode->get_caption());
@ -721,14 +717,6 @@ void AnimationNodeBlendTreeEditor::_scroll_changed(const Vector2 &p_scroll) {
updating = false;
}
void AnimationNodeBlendTreeEditor::_node_changed(ObjectID p_node) {
AnimationNode *an = Object::cast_to<AnimationNode>(ObjectDB::get_instance(p_node));
//if (an && an->get_parent() == blend_tree) {
_update_graph();
//}
}
void AnimationNodeBlendTreeEditor::_bind_methods() {
ClassDB::bind_method("_update_graph", &AnimationNodeBlendTreeEditor::_update_graph);
@ -746,7 +734,6 @@ void AnimationNodeBlendTreeEditor::_bind_methods() {
ClassDB::bind_method("_update_filters", &AnimationNodeBlendTreeEditor::_update_filters);
ClassDB::bind_method("_filter_edited", &AnimationNodeBlendTreeEditor::_filter_edited);
ClassDB::bind_method("_filter_toggled", &AnimationNodeBlendTreeEditor::_filter_toggled);
ClassDB::bind_method("_node_changed", &AnimationNodeBlendTreeEditor::_node_changed);
ClassDB::bind_method("_removed_from_graph", &AnimationNodeBlendTreeEditor::_removed_from_graph);
ClassDB::bind_method("_property_changed", &AnimationNodeBlendTreeEditor::_property_changed);
ClassDB::bind_method("_file_opened", &AnimationNodeBlendTreeEditor::_file_opened);

View file

@ -104,8 +104,6 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin {
void _filter_toggled();
Ref<AnimationNode> _filter_edit;
void _node_changed(ObjectID p_node);
void _property_changed(const StringName &p_property, const Variant &p_value);
void _removed_from_graph();

View file

@ -323,7 +323,6 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
if (mb.is_valid()) {
Vector2 gpoint = mb->get_position();
Vector2 cpoint = node->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
if (mb->get_button_index() == BUTTON_LEFT) {
if (mb->is_pressed()) {

View file

@ -65,14 +65,6 @@ void MeshEditor::_notification(int p_what) {
first_enter = false;
}
}
if (p_what == NOTIFICATION_DRAW) {
Ref<Texture> checkerboard = get_icon("Checkerboard", "EditorIcons");
Size2 size = get_size();
//draw_texture_rect(checkerboard, Rect2(Point2(), size), true);
}
}
void MeshEditor::_update_rotation() {

View file

@ -1276,7 +1276,6 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
word_at_mouse = tx->get_selection_text();
bool has_color = (word_at_mouse == "Color");
int fold_state = 0;
bool foldable = tx->can_fold(row) || tx->is_folded(row);
bool open_docs = false;
bool goto_definition = false;

View file

@ -86,10 +86,7 @@ void ShaderTextEditor::_load_theme_settings() {
Color search_result_border_color = EDITOR_GET("text_editor/highlighting/search_result_border_color");
Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color");
Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
Color basetype_color = EDITOR_GET("text_editor/highlighting/base_type_color");
Color type_color = EDITOR_GET("text_editor/highlighting/engine_type_color");
Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
Color string_color = EDITOR_GET("text_editor/highlighting/string_color");
get_text_edit()->add_color_override("background_color", background_color);
get_text_edit()->add_color_override("completion_background_color", completion_background_color);
@ -140,26 +137,9 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_keyword_color(E->get(), keyword_color);
}
//colorize core types
//Color basetype_color= EDITOR_DEF("text_editor/base_type_color",Color(0.3,0.3,0.0));
//colorize comments
get_text_edit()->add_color_region("/*", "*/", comment_color, false);
get_text_edit()->add_color_region("//", "", comment_color, false);
/*//colorize strings
Color string_color = EDITOR_DEF("text_editor/string_color",Color::hex(0x6b6f00ff));
List<String> strings;
shader->get_shader_mode()->get_string_delimiters(&strings);
for (List<String>::Element *E=strings.front();E;E=E->next()) {
String string = E->get();
String beg = string.get_slice(" ",0);
String end = string.get_slice_count(" ")>1?string.get_slice(" ",1):String();
get_text_edit()->add_color_region(beg,end,string_color,end=="");
}*/
}
void ShaderTextEditor::_check_shader_mode() {

View file

@ -29,9 +29,10 @@
/*************************************************************************/
#include "skeleton_editor_plugin.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/physics_joint.h";
#include "scene/3d/physics_joint.h"
#include "scene/resources/capsule_shape.h"
#include "scene/resources/sphere_shape.h"
#include "spatial_editor_plugin.h"

View file

@ -2075,7 +2075,7 @@ void SpatialEditorViewport::set_message(String p_message, float p_time) {
}
void SpatialEditorPlugin::edited_scene_changed() {
for (int i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
for (uint32_t i = 0; i < SpatialEditor::VIEWPORTS_COUNT; i++) {
SpatialEditorViewport *viewport = SpatialEditor::get_singleton()->get_editor_viewport(i);
if (viewport->is_visible()) {
viewport->notification(Control::NOTIFICATION_VISIBILITY_CHANGED);
@ -2199,7 +2199,7 @@ void SpatialEditorViewport::_notification(int p_what) {
bool shrink = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_HALF_RESOLUTION));
if (shrink != viewport_container->get_stretch_shrink() > 1) {
if (shrink != (viewport_container->get_stretch_shrink() > 1)) {
viewport_container->set_stretch_shrink(shrink ? 2 : 1);
}
@ -4093,7 +4093,7 @@ void SpatialEditor::set_state(const Dictionary &p_state) {
for (int j = 0; j < gizmo_plugins.size(); ++j) {
if (!gizmo_plugins[j]->can_be_hidden()) continue;
int state = EditorSpatialGizmoPlugin::ON_TOP;
for (uint32_t i = 0; i < keys.size(); i++) {
for (int i = 0; i < keys.size(); i++) {
if (gizmo_plugins.write[j]->get_name() == keys[i]) {
state = gizmos_status[keys[i]];
}
@ -4979,32 +4979,29 @@ void SpatialEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
if (!k->is_pressed())
return;
if (ED_IS_SHORTCUT("spatial_editor/tool_select", p_event))
if (ED_IS_SHORTCUT("spatial_editor/tool_select", p_event)) {
_menu_item_pressed(MENU_TOOL_SELECT);
else if (ED_IS_SHORTCUT("spatial_editor/tool_move", p_event))
} else if (ED_IS_SHORTCUT("spatial_editor/tool_move", p_event)) {
_menu_item_pressed(MENU_TOOL_MOVE);
else if (ED_IS_SHORTCUT("spatial_editor/tool_rotate", p_event))
} else if (ED_IS_SHORTCUT("spatial_editor/tool_rotate", p_event)) {
_menu_item_pressed(MENU_TOOL_ROTATE);
else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event))
} else if (ED_IS_SHORTCUT("spatial_editor/tool_scale", p_event)) {
_menu_item_pressed(MENU_TOOL_SCALE);
else if (ED_IS_SHORTCUT("spatial_editor/snap_to_floor", p_event))
} else if (ED_IS_SHORTCUT("spatial_editor/snap_to_floor", p_event)) {
snap_selected_nodes_to_floor();
else if (ED_IS_SHORTCUT("spatial_editor/local_coords", p_event))
} else if (ED_IS_SHORTCUT("spatial_editor/local_coords", p_event)) {
if (are_local_coords_enabled()) {
_menu_item_toggled(false, MENU_TOOL_LOCAL_COORDS);
} else {
_menu_item_toggled(true, MENU_TOOL_LOCAL_COORDS);
}
else if (ED_IS_SHORTCUT("spatial_editor/snap", p_event))
} else if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
if (is_snap_enabled()) {
_menu_item_toggled(false, MENU_TOOL_USE_SNAP);
} else {
_menu_item_toggled(true, MENU_TOOL_USE_SNAP);
}
}
}
}
}

View file

@ -86,7 +86,7 @@ public:
Vector<Vector3> handles;
Vector<Vector3> secondary_handles;
float selectable_icon_size = -1.0f;
float selectable_icon_size;
bool billboard_handle;
bool valid;

View file

@ -97,7 +97,7 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
int lasti = p2->Contour.size() - 1;
Vector2 prev = Vector2(p2->Contour[lasti].X / PRECISION, p2->Contour[lasti].Y / PRECISION);
for (int i = 0; i < p2->Contour.size(); i++) {
for (unsigned int i = 0; i < p2->Contour.size(); i++) {
Vector2 cur = Vector2(p2->Contour[i].X / PRECISION, p2->Contour[i].Y / PRECISION);
if (cur.distance_to(prev) > 0.5) {

View file

@ -715,6 +715,7 @@ EditorSpatialGizmo::EditorSpatialGizmo() {
instanced = false;
spatial_node = NULL;
gizmo_plugin = NULL;
selectable_icon_size = -1.0f;
}
EditorSpatialGizmo::~EditorSpatialGizmo() {