diff options
42 files changed, 159 insertions, 127 deletions
diff --git a/SConstruct b/SConstruct index 1898e0b5d3..f8c1c82961 100644 --- a/SConstruct +++ b/SConstruct @@ -159,15 +159,16 @@ opts.Add(BoolVariable('minizip', "Enable ZIP archive support using minizip", Tru  opts.Add(BoolVariable('xaudio2', "Enable the XAudio2 audio driver", False))  # Advanced options -opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False)) -opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced 3D GUI nodes and behaviors", False)) -opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')  opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False)) -opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False)) -opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no')))  opts.Add(BoolVariable('progress', "Show a progress indicator during compilation", True)) +opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'all', ('extra', 'all', 'moderate', 'no'))) +opts.Add(BoolVariable('werror', "Treat compiler warnings as errors. Depends on the level of warnings set with 'warnings'", False))  opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False)) +opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '') +opts.Add(BoolVariable('vsproj', "Generate a Visual Studio solution", False))  opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel'))) +opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for a smaller executable", False)) +opts.Add(BoolVariable('disable_advanced_gui', "Disable advanced 3D GUI nodes and behaviors", False))  opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))  opts.Add('system_certs_path', "Use this path as SSL certificates default for editor (for package maintainers)", '') @@ -235,7 +236,6 @@ env_base.platform_apis = platform_apis  if (env_base['target'] == 'debug'):      env_base.Append(CPPDEFINES=['DEBUG_MEMORY_ALLOC','DISABLE_FORCED_INLINE']) -      if (env_base['no_editor_splash']):      env_base.Append(CPPDEFINES=['NO_EDITOR_SPLASH']) @@ -318,33 +318,36 @@ if selected_platform in platform_list:      # must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)      detect.configure(env) -    if (env["warnings"] == 'yes'): -        print("WARNING: warnings=yes is deprecated; assuming warnings=all") - +    # Configure compiler warnings      if env.msvc: -        disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions... +        # Truncations, narrowing conversions, signed/unsigned comparisons... +        disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4018', '/wd4800']          if (env["warnings"] == 'extra'):              env.Append(CCFLAGS=['/Wall']) # Implies /W4 -        elif (env["warnings"] == 'all' or env["warnings"] == 'yes'): +        elif (env["warnings"] == 'all'):              env.Append(CCFLAGS=['/W3'] + disable_nonessential_warnings)          elif (env["warnings"] == 'moderate'): -            # C4244 shouldn't be needed here being a level-3 warning, but it is              env.Append(CCFLAGS=['/W2'] + disable_nonessential_warnings)          else: # 'no'              env.Append(CCFLAGS=['/w'])          # Set exception handling model to avoid warnings caused by Windows system headers.          env.Append(CCFLAGS=['/EHsc']) +        if (env["werror"]): +            env.Append(CCFLAGS=['/WX'])      else: # Rest of the world          disable_nonessential_warnings = ['-Wno-sign-compare']          if (env["warnings"] == 'extra'):              env.Append(CCFLAGS=['-Wall', '-Wextra']) -        elif (env["warnings"] == 'all' or env["warnings"] == 'yes'): +        elif (env["warnings"] == 'all'):              env.Append(CCFLAGS=['-Wall'] + disable_nonessential_warnings)          elif (env["warnings"] == 'moderate'):              env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + disable_nonessential_warnings)          else: # 'no'              env.Append(CCFLAGS=['-w']) -        env.Append(CCFLAGS=['-Werror=return-type']) +        if (env["werror"]): +            env.Append(CCFLAGS=['-Werror']) +        else: # always enable those errors +            env.Append(CCFLAGS=['-Werror=return-type'])      suffix = "." + selected_platform diff --git a/core/class_db.cpp b/core/class_db.cpp index dcc07f8f41..71809d5454 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -809,10 +809,10 @@ void ClassDB::add_signal(StringName p_class, const MethodInfo &p_signal) {  	ClassInfo *type = classes.getptr(p_class);  	ERR_FAIL_COND(!type); -	ClassInfo *check = type;  	StringName sname = p_signal.name; -#ifdef DEBUG_METHODS_ENABLED +#ifdef DEBUG_METHODS_ENABLED +	ClassInfo *check = type;  	while (check) {  		if (check->signal_map.has(sname)) {  			ERR_EXPLAIN("Type " + String(p_class) + " already has signal: " + String(sname)); diff --git a/core/image.cpp b/core/image.cpp index c0002e0cd6..e90ed96499 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -307,6 +307,7 @@ void Image::_get_mipmap_offset_and_size(int p_mipmap, int &r_offset, int &r_widt  	r_width = w;  	r_height = h;  } +  int Image::get_mipmap_offset(int p_mipmap) const {  	ERR_FAIL_INDEX_V(p_mipmap, get_mipmap_count() + 1, -1); @@ -499,8 +500,6 @@ void Image::convert(Format p_new_format) {  	bool gen_mipmaps = mipmaps; -	//mipmaps=false; -  	_copy_internals_from(new_img);  	if (gen_mipmaps) @@ -799,6 +798,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {  	if (interpolate_mipmaps) {  		dst2.create(p_width, p_height, 0, format);  	} +  	bool had_mipmaps = mipmaps;  	if (interpolate_mipmaps && !had_mipmaps) {  		generate_mipmaps(); @@ -951,6 +951,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {  }  void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) { +  	if (!_can_modify(format)) {  		ERR_EXPLAIN("Cannot crop in indexed, compressed or custom image formats.");  		ERR_FAIL(); @@ -996,7 +997,7 @@ void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) {  		}  	} -	if (mipmaps > 0) +	if (has_mipmaps())  		dst.generate_mipmaps();  	_copy_internals_from(dst);  } @@ -1013,10 +1014,10 @@ void Image::flip_y() {  		ERR_FAIL();  	} -	bool gm = mipmaps; - -	if (gm) +	bool used_mipmaps = has_mipmaps(); +	if (used_mipmaps) {  		clear_mipmaps(); +	}  	{  		PoolVector<uint8_t>::Write w = data.write(); @@ -1037,8 +1038,9 @@ void Image::flip_y() {  		}  	} -	if (gm) +	if (used_mipmaps) {  		generate_mipmaps(); +	}  }  void Image::flip_x() { @@ -1048,9 +1050,10 @@ void Image::flip_x() {  		ERR_FAIL();  	} -	bool gm = mipmaps; -	if (gm) +	bool used_mipmaps = has_mipmaps(); +	if (used_mipmaps) {  		clear_mipmaps(); +	}  	{  		PoolVector<uint8_t>::Write w = data.write(); @@ -1071,8 +1074,9 @@ void Image::flip_x() {  		}  	} -	if (gm) +	if (used_mipmaps) {  		generate_mipmaps(); +	}  }  int Image::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps) { @@ -1167,12 +1171,13 @@ void Image::expand_x2_hq2x() {  	ERR_FAIL_COND(!_can_modify(format)); -	Format current = format; -	bool mm = has_mipmaps(); -	if (mm) { +	bool used_mipmaps = has_mipmaps(); +	if (used_mipmaps) {  		clear_mipmaps();  	} +	Format current = format; +  	if (current != FORMAT_RGBA8)  		convert(FORMAT_RGBA8); @@ -1193,7 +1198,7 @@ void Image::expand_x2_hq2x() {  	if (current != FORMAT_RGBA8)  		convert(current); -	if (mipmaps) { +	if (used_mipmaps) {  		generate_mipmaps();  	}  } diff --git a/core/io/compression.cpp b/core/io/compression.cpp index e456a85c65..3c0b6541bd 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -175,7 +175,7 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p  		} break;  		case MODE_ZSTD: {  			ZSTD_DCtx *dctx = ZSTD_createDCtx(); -			if (zstd_long_distance_matching) ZSTD_DCtx_setMaxWindowSize(dctx, 1 << zstd_window_log_size); +			if (zstd_long_distance_matching) ZSTD_DCtx_setMaxWindowSize(dctx, (size_t)1 << zstd_window_log_size);  			int ret = ZSTD_decompressDCtx(dctx, p_dst, p_dst_max_size, p_src, p_src_size);  			ZSTD_freeDCtx(dctx);  			return ret; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index e3c8fb9eb8..40f756ba9a 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -169,11 +169,11 @@ bool PackedSourcePCK::try_open_pack(const String &p_path) {  	uint32_t version = f->get_32();  	uint32_t ver_major = f->get_32();  	uint32_t ver_minor = f->get_32(); -	uint32_t ver_rev = f->get_32(); +	f->get_32(); // ver_rev  	ERR_EXPLAIN("Pack version unsupported: " + itos(version));  	ERR_FAIL_COND_V(version != PACK_VERSION, false); -	ERR_EXPLAIN("Pack created with a newer version of the engine: " + itos(ver_major) + "." + itos(ver_minor) + "." + itos(ver_rev)); +	ERR_EXPLAIN("Pack created with a newer version of the engine: " + itos(ver_major) + "." + itos(ver_minor));  	ERR_FAIL_COND_V(ver_major > VERSION_MAJOR || (ver_major == VERSION_MAJOR && ver_minor > VERSION_MINOR), false);  	for (int i = 0; i < 16; i++) { diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp index 6e51c56357..6ffc963783 100644 --- a/core/math/bsp_tree.cpp +++ b/core/math/bsp_tree.cpp @@ -165,7 +165,6 @@ int BSP_Tree::get_points_inside(const Vector3 *p_points, int p_point_count) cons  	int pass_count = 0;  	const Node *nodesptr = &nodes[0];  	const Plane *planesptr = &planes[0]; -	int plane_count = planes.size();  	int node_count = nodes.size();  	if (node_count == 0) // no nodes! @@ -192,9 +191,9 @@ int BSP_Tree::get_points_inside(const Vector3 *p_points, int p_point_count) cons  				break;  			} -			uint16_t plane = nodesptr[idx].plane;  #ifdef DEBUG_ENABLED - +			int plane_count = planes.size(); +			uint16_t plane = nodesptr[idx].plane;  			ERR_FAIL_INDEX_V(plane, plane_count, false);  #endif diff --git a/core/os/input.cpp b/core/os/input.cpp index 6830df7e81..4cd1f0b24a 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -42,7 +42,7 @@ Input *Input::get_singleton() {  }  void Input::set_mouse_mode(MouseMode p_mode) { -	ERR_FAIL_INDEX(p_mode, 4); +	ERR_FAIL_INDEX((int)p_mode, 4);  	OS::get_singleton()->set_mouse_mode((OS::MouseMode)p_mode);  } diff --git a/core/os/memory.cpp b/core/os/memory.cpp index 041371a6e2..be48c927b6 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -89,8 +89,13 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {  	atomic_increment(&alloc_count);  	if (prepad) { +		// Clang 5 wrongly complains about 's' being unused, +		// while it's used to modify 'mem'. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-variable"  		uint64_t *s = (uint64_t *)mem;  		*s = p_bytes; +#pragma clang diagnostic pop  		uint8_t *s8 = (uint8_t *)mem; diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index 74c6796b06..bb161cd87c 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -5,7 +5,16 @@  	</brief_description>  	<description>  		An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track. -		Animations are just data containers, and must be added to odes such as an [AnimationPlayer] or [AnimationTreePlayer] to be played back. +		[codeblock] +		# This creates an animation that makes the node "Enemy" move to the right by +		# 100 pixels in 1 second.  +		var animation = Animation.new() +		var track_index = animation.add_track(Animation.TYPE_VALUE) +		animation.track_set_path(track_index, "Enemy:position.x") +		animation.track_insert_key(track_index, 0.0, 0) +		animation.track_insert_key(track_index, 0.5, 100) +		[/codeblock] +		Animations are just data containers, and must be added to nodes such as an [AnimationPlayer] or [AnimationTreePlayer] to be played back.  	</description>  	<tutorials>  		<link>http://docs.godotengine.org/en/3.0/tutorials/animation/index.html</link> diff --git a/doc/classes/TextureProgress.xml b/doc/classes/TextureProgress.xml index f74420e8b1..3cbaf0429c 100644 --- a/doc/classes/TextureProgress.xml +++ b/doc/classes/TextureProgress.xml @@ -52,10 +52,13 @@  			[Texture] that draws under the progress bar. The bar's background.  		</member>  		<member name="tint_over" type="Color" setter="set_tint_over" getter="get_tint_over"> +			Multiplies the color of the bar's [code]texture_over[/code] texture. The effect is similar to [member CanvasItem.modulate], except it only affects this specific texture instead of the entire node.  		</member>  		<member name="tint_progress" type="Color" setter="set_tint_progress" getter="get_tint_progress"> +			Multiplies the color of the bar's [code]texture_progress[/code] texture.  		</member>  		<member name="tint_under" type="Color" setter="set_tint_under" getter="get_tint_under"> +			Multiplies the color of the bar's [code]texture_under[/code] texture.  		</member>  	</members>  	<constants> @@ -72,16 +75,19 @@  			The [member texture_progress] fills from bottom to top.  		</constant>  		<constant name="FILL_CLOCKWISE" value="4" enum="FillMode"> -			Turns the node into a radial bar. The [member texture_progress] fills clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to refine its behavior. +			Turns the node into a radial bar. The [member texture_progress] fills clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to control the way the bar fills up.  		</constant>  		<constant name="FILL_COUNTER_CLOCKWISE" value="5" enum="FillMode"> -			Turns the node into a radial bar. The [member texture_progress] fills counter-clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to refine its behavior. +			Turns the node into a radial bar. The [member texture_progress] fills counter-clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to control the way the bar fills up.  		</constant>  		<constant name="FILL_BILINEAR_LEFT_AND_RIGHT" value="6" enum="FillMode"> +			The [member texture_progress] fills from the center, expanding both towards the left and the right.  		</constant>  		<constant name="FILL_BILINEAR_TOP_AND_BOTTOM" value="7" enum="FillMode"> +			The [member texture_progress] fills from the center, expanding both towards the top and the bottom.  		</constant>  		<constant name="FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE" value="8" enum="FillMode"> +			Turns the node into a radial bar. The [member texture_progress] fills radially from the center, expanding both clockwise and counter-clockwise. See [member radial_center_offset], [member radial_initial_angle] and [member radial_fill_degrees] to control the way the bar fills up.  		</constant>  	</constants>  </class> diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 5f4b5428e8..848ac8b78f 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -74,6 +74,7 @@  #include <EGL/eglext.h>  #endif +#ifndef IPHONE_ENABLED  static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {  	if (type == _EXT_DEBUG_TYPE_OTHER_ARB) @@ -120,6 +121,7 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL  	ERR_PRINTS(output);  } +#endif // IPHONE_ENABLED  typedef void (*DEBUGPROCARB)(GLenum source,  		GLenum type, diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index b9e2806ac3..fae010b003 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -1630,7 +1630,7 @@ FRAGMENT_SHADER_CODE  		highp vec4 splane = shadow_coord;  		float shadow_len = length(splane.xyz); -		splane = normalize(splane.xyz); +		splane.xyz = normalize(splane.xyz);  		vec4 clamp_rect = light_clamp; diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 04acb9387e..a4ea889d3b 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -227,10 +227,7 @@ static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t p_len  	PNGReadStatus *rstatus;  	rstatus = (PNGReadStatus *)png_get_io_ptr(png_ptr); -	png_size_t to_read = p_length; -	if (rstatus->size >= 0) { -		to_read = MIN(p_length, rstatus->size - rstatus->offset); -	} +	png_size_t to_read = MIN(p_length, rstatus->size - rstatus->offset);  	memcpy(data, &rstatus->image[rstatus->offset], to_read);  	rstatus->offset += to_read; diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index fcefe0a3b3..54bbbf2dad 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -103,8 +103,6 @@ void ThreadPosix::wait_to_finish_func_posix(Thread *p_thread) {  Error ThreadPosix::set_name_func_posix(const String &p_name) { -	pthread_t running_thread = pthread_self(); -  #ifdef PTHREAD_NO_RENAME  	return ERR_UNAVAILABLE; @@ -117,6 +115,7 @@ Error ThreadPosix::set_name_func_posix(const String &p_name) {  #else +	pthread_t running_thread = pthread_self();  #ifdef PTHREAD_BSD_SET_NAME  	pthread_set_name_np(running_thread, p_name.utf8().get_data());  	int err = 0; // Open/FreeBSD ignore errors in this function diff --git a/editor/doc/doc_dump.cpp b/editor/doc/doc_dump.cpp index 86fd9b436b..f1c337605e 100644 --- a/editor/doc/doc_dump.cpp +++ b/editor/doc/doc_dump.cpp @@ -223,7 +223,7 @@ void DocDump::dump(const String &p_file) {  						hint = "Values: ";  						for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) {  							if (j > 0) hint += ", "; -							hint += arginfo.hint_string.get_slice(",", j) + "=" + itos(1 << j); +							hint += arginfo.hint_string.get_slice(",", j) + "=" + itos((uint64_t)1 << j);  						}  						break;  					case PROPERTY_HINT_FILE: hint = "A file:"; break; diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 455c889224..1a6188862f 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1097,6 +1097,7 @@ Ref<EditorExportPreset> EditorExport::get_export_preset(int p_idx) {  void EditorExport::remove_export_preset(int p_idx) {  	export_presets.remove(p_idx); +	save_presets();  }  void EditorExport::add_export_plugin(const Ref<EditorExportPlugin> &p_plugin) { diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 6e1548df14..a1e8e4d838 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -376,7 +376,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {  	//Register icons + font  	// the resolution and the icon color (dark_theme bool) has not changed, so we do not regenerate the icons -	if (p_theme != NULL && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && p_theme->get_constant("dark_theme", "Editor") == dark_theme) { +	if (p_theme != NULL && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) {  		// register already generated icons  		for (int i = 0; i < editor_icons_count; i++) {  			theme->set_icon(editor_icons_names[i], "EditorIcons", p_theme->get_icon(editor_icons_names[i], "EditorIcons")); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index aa4338d775..b49ed5873b 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -882,7 +882,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  	if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree())  		return false; -	Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform(); +	Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();  	Transform2D xform_inv = xform.affine_inverse();  	Ref<InputEventMouseButton> mb = p_event; @@ -1396,8 +1396,7 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {  		return;  	Transform2D cell_xf = node->get_cell_transform(); - -	Transform2D xform = p_overlay->get_canvas_transform() * node->get_global_transform(); +	Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform();  	Transform2D xform_inv = xform.affine_inverse();  	Size2 screen_size = p_overlay->get_size(); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index f2c04d7326..08f1ece2d4 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -836,6 +836,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {  			editor_data->get_undo_redo().commit_action();  			editor->edit_node(new_node); +			editor_selection->clear(); +			editor_selection->add_node(new_node);  		} break; diff --git a/methods.py b/methods.py index 3add9b1f18..0cf05751a8 100644 --- a/methods.py +++ b/methods.py @@ -22,6 +22,10 @@ def add_source_files(self, sources, filetype, lib_env=None, shared=False):  def disable_warnings(self):      # 'self' is the environment      if self.msvc: +        # We have to remove existing warning level defines before appending /w, +        # otherwise we get: "warning D9025 : overriding '/W3' with '/w'" +        warn_flags = ['/Wall', '/W4', '/W3', '/W2', '/W1', '/WX'] +        self['CCFLAGS'] = [x for x in self['CCFLAGS'] if not x in warn_flags]          self.Append(CCFLAGS=['/w'])      else:          self.Append(CCFLAGS=['-w']) diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp index 919731b52b..063508a25f 100644 --- a/modules/bmp/image_loader_bmp.cpp +++ b/modules/bmp/image_loader_bmp.cpp @@ -42,12 +42,9 @@ Error ImageLoaderBMP::convert_to_image(Ref<Image> p_image,  	if (err == OK) {  		size_t index = 0; -		size_t width = -				static_cast<size_t>(p_header.bmp_info_header.bmp_width < 0 ? -p_header.bmp_info_header.bmp_width : p_header.bmp_info_header.bmp_width); -		size_t height = -				static_cast<size_t>(p_header.bmp_info_header.bmp_height < 0 ? -p_header.bmp_info_header.bmp_height : p_header.bmp_info_header.bmp_height); -		size_t bits_per_pixel = -				static_cast<size_t>(p_header.bmp_info_header.bmp_bit_count); +		size_t width = (size_t)p_header.bmp_info_header.bmp_width; +		size_t height = (size_t)p_header.bmp_info_header.bmp_height; +		size_t bits_per_pixel = (size_t)p_header.bmp_info_header.bmp_bit_count;  		if (p_header.bmp_info_header.bmp_compression != 0) {  			err = FAILED; diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 641e4021d8..37e72bf9f8 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1016,6 +1016,16 @@ NativeScriptLanguage::NativeScriptLanguage() {  #ifdef DEBUG_ENABLED  	profiling = false;  #endif + +	_init_call_type = "nativescript_init"; +	_init_call_name = "nativescript_init"; +	_terminate_call_name = "nativescript_terminate"; +	_noarg_call_type = "nativescript_no_arg"; +	_frame_call_name = "nativescript_frame"; +#ifndef NO_THREADS +	_thread_enter_call_name = "nativescript_thread_enter"; +	_thread_exit_call_name = "nativescript_thread_exit"; +#endif  }  NativeScriptLanguage::~NativeScriptLanguage() { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index ade8ffd280..51370f5fbf 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -277,18 +277,14 @@ public:  	Map<String, Set<NativeScript *> > library_script_users; -	const StringName _init_call_type = "nativescript_init"; -	const StringName _init_call_name = "nativescript_init"; - -	const StringName _terminate_call_name = "nativescript_terminate"; - -	const StringName _noarg_call_type = "nativescript_no_arg"; - -	const StringName _frame_call_name = "nativescript_frame"; - +	StringName _init_call_type; +	StringName _init_call_name; +	StringName _terminate_call_name; +	StringName _noarg_call_type; +	StringName _frame_call_name;  #ifndef NO_THREADS -	const StringName _thread_enter_call_name = "nativescript_thread_enter"; -	const StringName _thread_exit_call_name = "nativescript_thread_exit"; +	StringName _thread_enter_call_name; +	StringName _thread_exit_call_name;  #endif  	NativeScriptLanguage(); @@ -372,11 +368,14 @@ inline NativeScriptDesc *NativeScript::get_script_desc() const {  class NativeReloadNode : public Node {  	GDCLASS(NativeReloadNode, Node) -	bool unloaded = false; +	bool unloaded;  public:  	static void _bind_methods();  	void _notification(int p_what); + +	NativeReloadNode() : +			unloaded(false) {}  };  class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index b935861652..8088dcf17d 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -155,6 +155,7 @@ String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const  	return err_text;  } +#ifdef DEBUG_ENABLED  static String _get_var_type(const Variant *p_type) {  	String basestr; @@ -164,7 +165,6 @@ static String _get_var_type(const Variant *p_type) {  		if (!bobj) {  			basestr = "null instance";  		} else { -#ifdef DEBUG_ENABLED  			if (ObjectDB::instance_validate(bobj)) {  				if (bobj->get_script_instance())  					basestr = bobj->get_class() + " (" + bobj->get_script_instance()->get_script()->get_path().get_file() + ")"; @@ -173,10 +173,6 @@ static String _get_var_type(const Variant *p_type) {  			} else {  				basestr = "previously freed instance";  			} - -#else -			basestr = "Object"; -#endif  		}  	} else { @@ -185,6 +181,7 @@ static String _get_var_type(const Variant *p_type) {  	return basestr;  } +#endif  #if defined(__GNUC__)  #define OPCODES_TABLE                         \ @@ -676,6 +673,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a  			OPCODE(OPCODE_SET_MEMBER) {  				CHECK_SPACE(3); +#ifdef DEBUG_ENABLED  				int indexname = _code_ptr[ip + 1];  				GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count);  				const StringName *index = &_global_names_ptr[indexname]; @@ -683,7 +681,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a  				bool valid;  				bool ok = ClassDB::set_property(p_instance->owner, *index, *src, &valid); -#ifdef DEBUG_ENABLED  				if (!ok) {  					err_text = "Internal error setting property: " + String(*index);  					OPCODE_BREAK; @@ -699,13 +696,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a  			OPCODE(OPCODE_GET_MEMBER) {  				CHECK_SPACE(3); +#ifdef DEBUG_ENABLED  				int indexname = _code_ptr[ip + 1];  				GD_ERR_BREAK(indexname < 0 || indexname >= _global_names_count);  				const StringName *index = &_global_names_ptr[indexname];  				GET_VARIANT_PTR(dst, 2); -				bool ok = ClassDB::get_property(p_instance->owner, *index, *dst); -#ifdef DEBUG_ENABLED +				bool ok = ClassDB::get_property(p_instance->owner, *index, *dst);  				if (!ok) {  					err_text = "Internal error getting property: " + String(*index);  					OPCODE_BREAK; @@ -752,13 +749,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a  			OPCODE(OPCODE_ASSIGN_TYPED_BUILTIN) {  				CHECK_SPACE(4); -				Variant::Type var_type = (Variant::Type)_code_ptr[ip + 1];  				GET_VARIANT_PTR(dst, 2);  				GET_VARIANT_PTR(src, 3); +#ifdef DEBUG_ENABLED +				Variant::Type var_type = (Variant::Type)_code_ptr[ip + 1];  				GD_ERR_BREAK(var_type < 0 || var_type >= Variant::VARIANT_MAX); -#ifdef DEBUG_ENABLED  				if (src->get_type() != var_type) {  					if (Variant::can_convert_strict(src->get_type(), var_type)) {  						Variant::CallError ce; @@ -1282,10 +1279,11 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a  						OPCODE_BREAK;  					}  #endif +  					Object *obj = argobj->operator Object *();  					String signal = argname->operator String(); -#ifdef DEBUG_ENABLED +#ifdef DEBUG_ENABLED  					if (!obj) {  						err_text = "First argument of yield() is null.";  						OPCODE_BREAK; @@ -1302,13 +1300,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a  						OPCODE_BREAK;  					} -#endif  					Error err = obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT); -#ifdef DEBUG_ENABLED  					if (err != OK) {  						err_text = "Error connecting to signal: " + signal + " during yield().";  						OPCODE_BREAK;  					} +#else +					obj->connect(signal, gdfs.ptr(), "_signal_callback", varray(gdfs), Object::CONNECT_ONESHOT);  #endif  				} diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 2fa5084d84..a79fcccaeb 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -56,7 +56,9 @@ T *GDScriptParser::alloc_node() {  	return t;  } +#ifdef DEBUG_ENABLED  static String _find_function_name(const GDScriptParser::OperatorNode *p_call); +#endif // DEBUG_ENABLED  bool GDScriptParser::_end_statement() { @@ -747,7 +749,6 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s  			while (!bfn && b) {  				if (b->variables.has(identifier)) {  					IdentifierNode *id = alloc_node<IdentifierNode>(); -					LocalVarNode *lv = b->variables[identifier];  					id->name = identifier;  					id->declared_block = b;  					id->line = id_line; @@ -755,6 +756,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s  					bfn = true;  #ifdef DEBUG_ENABLED +					LocalVarNode *lv = b->variables[identifier];  					switch (tokenizer->get_token()) {  						case GDScriptTokenizer::TK_OP_ASSIGN_ADD:  						case GDScriptTokenizer::TK_OP_ASSIGN_BIT_AND: diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 478a3125af..2925b46007 100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -53,7 +53,6 @@ static GLView *_instance = NULL;  static bool video_found_error = false;  static bool video_playing = false; -static float video_previous_volume = 0.0f;  static CMTime video_current_time;  void _show_keyboard(String); @@ -248,16 +247,6 @@ static int remove_touch(UITouch *p_touch) {  	return remaining;  }; -static int get_first_id(UITouch *p_touch) { - -	for (int i = 0; i < max_touches; i++) { - -		if (touches[i] != NULL) -			return i; -	}; -	return -1; -}; -  static void clear_touches() {  	for (int i = 0; i < max_touches; i++) { @@ -751,7 +740,6 @@ static void clear_touches() {  		[_instance.moviePlayerController stop];  		[_instance.moviePlayerController.view removeFromSuperview]; -	//[[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume];  	video_playing = false;  }  */ diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 886ff4b332..1c693c9ea8 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -76,11 +76,6 @@  #define NSWindowStyleMaskBorderless NSBorderlessWindowMask  #endif -static NSRect convertRectToBacking(NSRect contentRect) { - -	return [OS_OSX::singleton->window_view convertRectToBacking:contentRect]; -} -  static void get_key_modifier_state(unsigned int p_osx_state, Ref<InputEventWithModifiers> state) {  	state->set_shift((p_osx_state & NSEventModifierFlagShift)); @@ -271,7 +266,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {  		float newDisplayScale = OS_OSX::singleton->is_hidpi_allowed() ? newBackingScaleFactor : 1.0;  		const NSRect contentRect = [OS_OSX::singleton->window_view frame]; -		const NSRect fbRect = contentRect; //convertRectToBacking(contentRect); +		const NSRect fbRect = contentRect;  		OS_OSX::singleton->window_size.width = fbRect.size.width * newDisplayScale;  		OS_OSX::singleton->window_size.height = fbRect.size.height * newDisplayScale; @@ -292,7 +287,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {  	[OS_OSX::singleton->context update];  	const NSRect contentRect = [OS_OSX::singleton->window_view frame]; -	const NSRect fbRect = contentRect; //convertRectToBacking(contentRect); +	const NSRect fbRect = contentRect;  	float displayScale = OS_OSX::singleton->_display_scale();  	OS_OSX::singleton->window_size.width = fbRect.size.width * displayScale; diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 3b86ca76ea..788a39d05d 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -422,14 +422,14 @@ void Camera2D::clear_current() {  void Camera2D::set_limit(Margin p_margin, int p_limit) { -	ERR_FAIL_INDEX(p_margin, 4); +	ERR_FAIL_INDEX((int)p_margin, 4);  	limit[p_margin] = p_limit;  	update();  }  int Camera2D::get_limit(Margin p_margin) const { -	ERR_FAIL_INDEX_V(p_margin, 4, 0); +	ERR_FAIL_INDEX_V((int)p_margin, 4, 0);  	return limit[p_margin];  } @@ -446,14 +446,14 @@ bool Camera2D::is_limit_smoothing_enabled() const {  void Camera2D::set_drag_margin(Margin p_margin, float p_drag_margin) { -	ERR_FAIL_INDEX(p_margin, 4); +	ERR_FAIL_INDEX((int)p_margin, 4);  	drag_margin[p_margin] = p_drag_margin;  	update();  }  float Camera2D::get_drag_margin(Margin p_margin) const { -	ERR_FAIL_INDEX_V(p_margin, 4, 0); +	ERR_FAIL_INDEX_V((int)p_margin, 4, 0);  	return drag_margin[p_margin];  } diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 508ceeaaf9..410b27c691 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -247,7 +247,7 @@ Vector<Point2> CollisionPolygon2D::get_polygon() const {  void CollisionPolygon2D::set_build_mode(BuildMode p_mode) { -	ERR_FAIL_INDEX(p_mode, 2); +	ERR_FAIL_INDEX((int)p_mode, 2);  	build_mode = p_mode;  	if (parent) {  		_build_polygon(); diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index b1f90b72e7..abf022ecb3 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -814,7 +814,7 @@ AudioStreamPlayer3D::AttenuationModel AudioStreamPlayer3D::get_attenuation_model  void AudioStreamPlayer3D::set_out_of_range_mode(OutOfRangeMode p_mode) { -	ERR_FAIL_INDEX(p_mode, 2); +	ERR_FAIL_INDEX((int)p_mode, 2);  	out_of_range_mode = p_mode;  } diff --git a/scene/3d/baked_lightmap.cpp b/scene/3d/baked_lightmap.cpp index c58e318651..8f3fe8577e 100644 --- a/scene/3d/baked_lightmap.cpp +++ b/scene/3d/baked_lightmap.cpp @@ -365,7 +365,7 @@ BakedLightmap::BakeError BakedLightmap::bake(Node *p_from_node, bool p_create_vi  	{  		bake_bounds = AABB(-extents, extents * 2.0);  		int subdiv = nearest_power_of_2_templated(int(bake_bounds.get_longest_axis_size() / bake_cell_size)); -		bake_bounds.size[bake_bounds.get_longest_axis_size()] = subdiv * bake_cell_size; +		bake_bounds.size[bake_bounds.get_longest_axis_index()] = subdiv * bake_cell_size;  		bake_subdiv = nearest_shift(subdiv) + 1;  		capture_subdiv = bake_subdiv; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index dc18895298..b90a4c17f4 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2235,13 +2235,13 @@ String Control::_get_tooltip() const {  void Control::set_focus_neighbour(Margin p_margin, const NodePath &p_neighbour) { -	ERR_FAIL_INDEX(p_margin, 4); +	ERR_FAIL_INDEX((int)p_margin, 4);  	data.focus_neighbour[p_margin] = p_neighbour;  }  NodePath Control::get_focus_neighbour(Margin p_margin) const { -	ERR_FAIL_INDEX_V(p_margin, 4, NodePath()); +	ERR_FAIL_INDEX_V((int)p_margin, 4, NodePath());  	return data.focus_neighbour[p_margin];  } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 0ffaac20f6..b4fd7484e9 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -1042,7 +1042,7 @@ void GraphEdit::set_connection_activity(const StringName &p_from, int p_from_por  		if (E->get().from == p_from && E->get().from_port == p_from_port && E->get().to == p_to && E->get().to_port == p_to_port) { -			if (ABS(E->get().activity != p_activity)) { +			if (ABS(E->get().activity - p_activity) < CMP_EPSILON) {  				//update only if changed  				top_layer->update();  				connections_layer->update(); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 91dab27930..6ff2d232f0 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -511,7 +511,7 @@ void Label::regenerate_word_cache() {  void Label::set_align(Align p_align) { -	ERR_FAIL_INDEX(p_align, 4); +	ERR_FAIL_INDEX((int)p_align, 4);  	align = p_align;  	update();  } @@ -523,7 +523,7 @@ Label::Align Label::get_align() const {  void Label::set_valign(VAlign p_align) { -	ERR_FAIL_INDEX(p_align, 4); +	ERR_FAIL_INDEX((int)p_align, 4);  	valign = p_align;  	update();  } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 9c43d5b308..6f344f1028 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -527,7 +527,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {  void LineEdit::set_align(Align p_align) { -	ERR_FAIL_INDEX(p_align, 4); +	ERR_FAIL_INDEX((int)p_align, 4);  	align = p_align;  	update();  } diff --git a/scene/gui/nine_patch_rect.cpp b/scene/gui/nine_patch_rect.cpp index b8f6ffe6d2..c6a34921c7 100644 --- a/scene/gui/nine_patch_rect.cpp +++ b/scene/gui/nine_patch_rect.cpp @@ -110,7 +110,7 @@ Ref<Texture> NinePatchRect::get_texture() const {  void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) { -	ERR_FAIL_INDEX(p_margin, 4); +	ERR_FAIL_INDEX((int)p_margin, 4);  	margin[p_margin] = p_size;  	update();  	minimum_size_changed(); @@ -132,7 +132,7 @@ void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) {  int NinePatchRect::get_patch_margin(Margin p_margin) const { -	ERR_FAIL_INDEX_V(p_margin, 4, 0); +	ERR_FAIL_INDEX_V((int)p_margin, 4, 0);  	return margin[p_margin];  } diff --git a/scene/gui/texture_progress.cpp b/scene/gui/texture_progress.cpp index d28b4065fb..7ecdccb0e4 100644 --- a/scene/gui/texture_progress.cpp +++ b/scene/gui/texture_progress.cpp @@ -59,14 +59,14 @@ Ref<Texture> TextureProgress::get_over_texture() const {  }  void TextureProgress::set_stretch_margin(Margin p_margin, int p_size) { -	ERR_FAIL_INDEX(p_margin, 4); +	ERR_FAIL_INDEX((int)p_margin, 4);  	stretch_margin[p_margin] = p_size;  	update();  	minimum_size_changed();  }  int TextureProgress::get_stretch_margin(Margin p_margin) const { -	ERR_FAIL_INDEX_V(p_margin, 4, 0); +	ERR_FAIL_INDEX_V((int)p_margin, 4, 0);  	return stretch_margin[p_margin];  } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 47ffbe2ff3..8fd7dc1d7b 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2488,6 +2488,7 @@ void Node::_set_tree(SceneTree *p_tree) {  		tree_changed_b->tree_changed();  } +#ifdef DEBUG_ENABLED  static void _Node_debug_sn(Object *p_obj) {  	Node *n = Object::cast_to<Node>(p_obj); @@ -2509,6 +2510,7 @@ static void _Node_debug_sn(Object *p_obj) {  		path = String(p->get_name()) + "/" + p->get_path_to(n);  	print_line(itos(p_obj->get_instance_id()) + " - Stray Node: " + path + " (Type: " + n->get_class() + ")");  } +#endif // DEBUG_ENABLED  void Node::_print_stray_nodes() { @@ -2518,7 +2520,6 @@ void Node::_print_stray_nodes() {  void Node::print_stray_nodes() {  #ifdef DEBUG_ENABLED -  	ObjectDB::debug_objects(_Node_debug_sn);  #endif  } diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 80ad2ad739..5c01cadcd5 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1901,7 +1901,7 @@ void Animation::value_track_set_update_mode(int p_track, UpdateMode p_mode) {  	ERR_FAIL_INDEX(p_track, tracks.size());  	Track *t = tracks[p_track];  	ERR_FAIL_COND(t->type != TYPE_VALUE); -	ERR_FAIL_INDEX(p_mode, 4); +	ERR_FAIL_INDEX((int)p_mode, 4);  	ValueTrack *vt = static_cast<ValueTrack *>(t);  	vt->update_mode = p_mode; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 0785d3bfc6..6790c35c4b 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -1083,8 +1083,19 @@ void DynamicFont::update_oversampling() {  				E->self()->outline_data_at_size->update_oversampling();  			} +			for (int i = 0; i < E->self()->fallback_data_at_size.size(); i++) { +				if (E->self()->fallback_data_at_size[i].is_valid()) { +					E->self()->fallback_data_at_size.write[i]->update_oversampling(); + +					if (E->self()->has_outline() && E->self()->fallback_outline_data_at_size[i].is_valid()) { +						E->self()->fallback_outline_data_at_size.write[i]->update_oversampling(); +					} +				} +			} +  			changed.push_back(Ref<DynamicFont>(E->self()));  		} +  		E = E->next();  	} diff --git a/scene/resources/material.h b/scene/resources/material.h index 0154874ae4..cf4d19b5a7 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -286,7 +286,7 @@ private:  		mk.key = 0;  		for (int i = 0; i < FEATURE_MAX; i++) {  			if (features[i]) { -				mk.feature_mask |= (1 << i); +				mk.feature_mask |= ((uint64_t)1 << i);  			}  		}  		mk.detail_uv = detail_uv; @@ -295,7 +295,7 @@ private:  		mk.cull_mode = cull_mode;  		for (int i = 0; i < FLAG_MAX; i++) {  			if (flags[i]) { -				mk.flags |= (1 << i); +				mk.flags |= ((uint64_t)1 << i);  			}  		}  		mk.detail_blend_mode = detail_blend_mode; diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index fb81375b0a..69d85eeef3 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -136,7 +136,7 @@ Ref<Texture> StyleBoxTexture::get_normal_map() const {  void StyleBoxTexture::set_margin_size(Margin p_margin, float p_size) { -	ERR_FAIL_INDEX(p_margin, 4); +	ERR_FAIL_INDEX((int)p_margin, 4);  	margin[p_margin] = p_size;  	emit_changed(); @@ -200,7 +200,7 @@ Size2 StyleBoxTexture::get_center_size() const {  void StyleBoxTexture::set_expand_margin_size(Margin p_expand_margin, float p_size) { -	ERR_FAIL_INDEX(p_expand_margin, 4); +	ERR_FAIL_INDEX((int)p_expand_margin, 4);  	expand_margin[p_expand_margin] = p_size;  	emit_changed();  } @@ -223,7 +223,7 @@ void StyleBoxTexture::set_expand_margin_size_all(float p_expand_margin_size) {  float StyleBoxTexture::get_expand_margin_size(Margin p_expand_margin) const { -	ERR_FAIL_INDEX_V(p_expand_margin, 4, 0); +	ERR_FAIL_INDEX_V((int)p_expand_margin, 4, 0);  	return expand_margin[p_expand_margin];  }  |