diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | doc/classes/CPUParticles.xml | 3 | ||||
-rw-r--r-- | doc/classes/CPUParticles2D.xml | 3 | ||||
-rw-r--r-- | doc/classes/Light.xml | 2 | ||||
-rw-r--r-- | doc/classes/ParticlesMaterial.xml | 3 | ||||
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 19 | ||||
-rw-r--r-- | editor/connections_dialog.cpp | 44 | ||||
-rw-r--r-- | editor/connections_dialog.h | 2 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 14 | ||||
-rw-r--r-- | modules/websocket/doc_classes/WebSocketServer.xml | 2 | ||||
-rw-r--r-- | platform/windows/context_gl_windows.cpp | 5 | ||||
-rw-r--r-- | platform/windows/joypad_windows.cpp | 5 | ||||
-rwxr-xr-x | platform/windows/os_windows.cpp | 5 | ||||
-rw-r--r-- | scene/2d/cpu_particles_2d.cpp | 6 | ||||
-rw-r--r-- | scene/2d/cpu_particles_2d.h | 1 | ||||
-rw-r--r-- | scene/3d/cpu_particles.cpp | 6 | ||||
-rw-r--r-- | scene/3d/cpu_particles.h | 1 | ||||
-rw-r--r-- | scene/resources/particles_material.cpp | 13 | ||||
-rw-r--r-- | scene/resources/particles_material.h | 1 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 13 |
20 files changed, 113 insertions, 37 deletions
diff --git a/.travis.yml b/.travis.yml index 7350849d6a..c8b123c79c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,7 +94,7 @@ matrix: - name: Linux export template (release_debug, GCC 5, without 3D support) stage: build - env: PLATFORM=x11 TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-5 EXTRA_ARGS="disable_3d=yes" + env: PLATFORM=x11 TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-5 EXTRA_ARGS="CXXFLAGS=-fno-strict-aliasing disable_3d=yes" os: linux compiler: gcc addons: diff --git a/doc/classes/CPUParticles.xml b/doc/classes/CPUParticles.xml index e68b0feb2d..cef0ee7587 100644 --- a/doc/classes/CPUParticles.xml +++ b/doc/classes/CPUParticles.xml @@ -367,5 +367,8 @@ <constant name="EMISSION_SHAPE_DIRECTED_POINTS" value="4" enum="EmissionShape"> Particles will be emitted at a position chosen randomly among [member emission_points]. Particle velocity and rotation will be set based on [member emission_normals]. Particle color will be modulated by [member emission_colors]. </constant> + <constant name="EMISSION_SHAPE_MAX" value="5" enum="EmissionShape"> + Represents the size of the [enum EmissionShape] enum. + </constant> </constants> </class> diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml index c8dbffb4cb..dac00051a9 100644 --- a/doc/classes/CPUParticles2D.xml +++ b/doc/classes/CPUParticles2D.xml @@ -360,5 +360,8 @@ <constant name="EMISSION_SHAPE_DIRECTED_POINTS" value="4" enum="EmissionShape"> Particles will be emitted at a position chosen randomly among [member emission_points]. Particle velocity and rotation will be set based on [member emission_normals]. Particle color will be modulated by [member emission_colors]. </constant> + <constant name="EMISSION_SHAPE_MAX" value="5" enum="EmissionShape"> + Represents the size of the [enum EmissionShape] enum. + </constant> </constants> </class> diff --git a/doc/classes/Light.xml b/doc/classes/Light.xml index fde25ef2c5..ae5bba4f06 100644 --- a/doc/classes/Light.xml +++ b/doc/classes/Light.xml @@ -80,7 +80,7 @@ Constant for accessing [member light_indirect_energy]. </constant> <constant name="PARAM_SPECULAR" value="2" enum="Param"> - Constant for accessing [member light_specular]. + Constant for accessing [member light_specular]. </constant> <constant name="PARAM_RANGE" value="3" enum="Param"> Constant for accessing [member OmniLight.omni_range] or [member SpotLight.spot_range]. diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml index 187ad1688d..1f23649b75 100644 --- a/doc/classes/ParticlesMaterial.xml +++ b/doc/classes/ParticlesMaterial.xml @@ -321,5 +321,8 @@ <constant name="EMISSION_SHAPE_DIRECTED_POINTS" value="4" enum="EmissionShape"> Particles will be emitted at a position determined by sampling a random point on the [member emission_point_texture]. Particle velocity and rotation will be set based on [member emission_normal_texture]. Particle color will be modulated by [member emission_color_texture]. </constant> + <constant name="EMISSION_SHAPE_MAX" value="5" enum="EmissionShape"> + Represents the size of the [enum EmissionShape] enum. + </constant> </constants> </class> diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index fc59486090..24b89aedc2 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -522,9 +522,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener SL::ArrayDeclarationNode *arr_dec_node = (SL::ArrayDeclarationNode *)p_node; StringBuffer<> declaration; - if (arr_dec_node->is_const) { - declaration += "const "; - } declaration += _prestr(arr_dec_node->precision); declaration += _typestr(arr_dec_node->datatype); @@ -540,22 +537,6 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener declaration += "["; declaration += itos(arr_dec_node->declarations[i].size); declaration += "]"; - int sz = arr_dec_node->declarations[i].initializer.size(); - if (sz > 0) { - declaration += "="; - declaration += _typestr(arr_dec_node->datatype); - declaration += "["; - declaration += itos(sz); - declaration += "]"; - declaration += "("; - for (int j = 0; j < sz; j++) { - declaration += _dump_node_code(arr_dec_node->declarations[i].initializer[j], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); - if (j != sz - 1) { - declaration += ", "; - } - } - declaration += ")"; - } } code += declaration.as_string(); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index ec40b3254f..1853133bc7 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -146,7 +146,17 @@ void ConnectDialog::_tree_node_selected() { return; dst_path = source->get_path_to(current); - get_ok()->set_disabled(false); + _update_ok_enabled(); +} + +/* + * Called each time a target node is activated within the target node tree. + */ +void ConnectDialog::_tree_item_activated() { + + if (!get_ok()->is_disabled()) { + get_ok()->emit_signal("pressed"); + } } /* @@ -200,6 +210,27 @@ void ConnectDialog::_remove_bind() { cdbinds->notify_changed(); } +/* + * Enables or disables the connect button. The connect button is enabled if a + * node is selected and valid in the selected mode. + */ +void ConnectDialog::_update_ok_enabled() { + + Node *target = tree->get_selected(); + + if (target == nullptr) { + get_ok()->set_disabled(true); + return; + } + + if (!advanced->is_pressed() && target->get_script().is_null()) { + get_ok()->set_disabled(true); + return; + } + + get_ok()->set_disabled(false); +} + void ConnectDialog::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { @@ -212,8 +243,10 @@ void ConnectDialog::_bind_methods() { ClassDB::bind_method("_advanced_pressed", &ConnectDialog::_advanced_pressed); ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed); ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected); + ClassDB::bind_method("_tree_item_activated", &ConnectDialog::_tree_item_activated); ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind); ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind); + ClassDB::bind_method("_update_ok_enabled", &ConnectDialog::_update_ok_enabled); ADD_SIGNAL(MethodInfo("connected")); } @@ -290,13 +323,12 @@ void ConnectDialog::init(Connection c, bool bEdit) { tree->set_marked(source, true); if (c.target) { - get_ok()->set_disabled(false); set_dst_node(static_cast<Node *>(c.target)); set_dst_method(c.method); - } else { - get_ok()->set_disabled(true); } + _update_ok_enabled(); + bool bDeferred = (c.flags & CONNECT_DEFERRED) == CONNECT_DEFERRED; bool bOneshot = (c.flags & CONNECT_ONESHOT) == CONNECT_ONESHOT; @@ -339,6 +371,8 @@ void ConnectDialog::_advanced_pressed() { error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); } + _update_ok_enabled(); + set_position((get_viewport_rect().size - get_custom_minimum_size()) / 2); } @@ -363,7 +397,7 @@ ConnectDialog::ConnectDialog() { tree = memnew(SceneTreeEditor(false)); tree->set_connecting_signal(true); - tree->get_scene_tree()->connect("item_activated", this, "_ok"); + tree->get_scene_tree()->connect("item_activated", this, "_tree_item_activated"); tree->connect("node_selected", this, "_tree_node_selected"); tree->set_connect_to_script_mode(true); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 8ef4eddea1..c30413953a 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -76,9 +76,11 @@ class ConnectDialog : public ConfirmationDialog { void ok_pressed(); void _cancel_pressed(); void _tree_node_selected(); + void _tree_item_activated(); void _add_bind(); void _remove_bind(); void _advanced_pressed(); + void _update_ok_enabled(); protected: void _notification(int p_what); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index f0e4a4bfdc..1432c3fc63 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -691,13 +691,16 @@ void ScriptTextEditor::_update_bookmark_list() { bookmarks_menu->add_separator(); for (int i = 0; i < bookmark_list.size(); i++) { - String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).strip_edges(); + // Strip edges to remove spaces or tabs. + // Also replace any tabs by spaces, since we can't print tabs in the menu. + String line = code_editor->get_text_edit()->get_line(bookmark_list[i]).replace("\t", " ").strip_edges(); + // Limit the size of the line if too big. if (line.length() > 50) { line = line.substr(0, 50); } - bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - \"" + line + "\""); + bookmarks_menu->add_item(String::num((int)bookmark_list[i] + 1) + " - `" + line + "`"); bookmarks_menu->set_item_metadata(bookmarks_menu->get_item_count() - 1, bookmark_list[i]); } } @@ -841,13 +844,16 @@ void ScriptTextEditor::_update_breakpoint_list() { breakpoints_menu->add_separator(); for (int i = 0; i < breakpoint_list.size(); i++) { - String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).strip_edges(); + // Strip edges to remove spaces or tabs. + // Also replace any tabs by spaces, since we can't print tabs in the menu. + String line = code_editor->get_text_edit()->get_line(breakpoint_list[i]).replace("\t", " ").strip_edges(); + // Limit the size of the line if too big. if (line.length() > 50) { line = line.substr(0, 50); } - breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - \"" + line + "\""); + breakpoints_menu->add_item(String::num((int)breakpoint_list[i] + 1) + " - `" + line + "`"); breakpoints_menu->set_item_metadata(breakpoints_menu->get_item_count() - 1, breakpoint_list[i]); } } diff --git a/modules/websocket/doc_classes/WebSocketServer.xml b/modules/websocket/doc_classes/WebSocketServer.xml index cd47c10f80..2074a10fa9 100644 --- a/modules/websocket/doc_classes/WebSocketServer.xml +++ b/modules/websocket/doc_classes/WebSocketServer.xml @@ -83,7 +83,7 @@ </method> </methods> <members> - <member name="bind_ip" type="String" setter="set_bind_ip" getter="get_bind_ip"> + <member name="bind_ip" type="String" setter="set_bind_ip" getter="get_bind_ip" default=""*""> When not set to [code]*[/code] will restrict incoming connections to the specified IP address. Setting [code]bind_ip[/code] to [code]127.0.0.1[/code] will cause the server to listen only to the local host. </member> <member name="ca_chain" type="X509Certificate" setter="set_ca_chain" getter="get_ca_chain"> diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp index 434d685250..ad62e3a306 100644 --- a/platform/windows/context_gl_windows.cpp +++ b/platform/windows/context_gl_windows.cpp @@ -43,6 +43,11 @@ #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#if defined(__GNUC__) +// Workaround GCC warning from -Wcast-function-type. +#define wglGetProcAddress (void *)wglGetProcAddress +#endif + typedef HGLRC(APIENTRY *PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC, HGLRC, const int *); void ContextGL_Windows::release_current() { diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index c82a90bf7d..49432435b9 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -37,6 +37,11 @@ #define __builtin_bswap32 _byteswap_ulong #endif +#if defined(__GNUC__) +// Workaround GCC warning from -Wcast-function-type. +#define GetProcAddress (void *)GetProcAddress +#endif + DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE *pState) { return ERROR_DEVICE_NOT_CONNECTED; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 3868d0bc63..a6977a7a86 100755 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -74,6 +74,11 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; #define WM_POINTERUPDATE 0x0245 #endif +#if defined(__GNUC__) +// Workaround GCC warning from -Wcast-function-type. +#define GetProcAddress (void *)GetProcAddress +#endif + typedef struct { int count; int screen; diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 8296f35739..c325de00b8 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -422,7 +422,7 @@ bool CPUParticles2D::get_particle_flag(Flags p_flag) const { } void CPUParticles2D::set_emission_shape(EmissionShape p_shape) { - + ERR_FAIL_INDEX(p_shape, EMISSION_SHAPE_MAX); emission_shape = p_shape; _change_notify(); } @@ -772,6 +772,9 @@ void CPUParticles2D::_particles_process(float p_delta) { p.base_color = emission_colors.get(random_idx); } } break; + case EMISSION_SHAPE_MAX: { // Max value for validity check. + break; + } } if (!local_coords) { @@ -1416,6 +1419,7 @@ void CPUParticles2D::_bind_methods() { BIND_ENUM_CONSTANT(EMISSION_SHAPE_RECTANGLE); BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS); BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_MAX); } CPUParticles2D::CPUParticles2D() { diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index 6ffa1f0e97..cbaff70c2a 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -75,6 +75,7 @@ public: EMISSION_SHAPE_RECTANGLE, EMISSION_SHAPE_POINTS, EMISSION_SHAPE_DIRECTED_POINTS, + EMISSION_SHAPE_MAX }; private: diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 0ac424b09e..aa7a413548 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -405,7 +405,7 @@ bool CPUParticles::get_particle_flag(Flags p_flag) const { } void CPUParticles::set_emission_shape(EmissionShape p_shape) { - + ERR_FAIL_INDEX(p_shape, EMISSION_SHAPE_MAX); emission_shape = p_shape; } @@ -784,6 +784,9 @@ void CPUParticles::_particles_process(float p_delta) { p.base_color = emission_colors.get(random_idx); } } break; + case EMISSION_SHAPE_MAX: { // Max value for validity check. + break; + } } if (!local_coords) { @@ -1488,6 +1491,7 @@ void CPUParticles::_bind_methods() { BIND_ENUM_CONSTANT(EMISSION_SHAPE_BOX); BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS); BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_MAX); } CPUParticles::CPUParticles() { diff --git a/scene/3d/cpu_particles.h b/scene/3d/cpu_particles.h index 18f9718e70..d5a549b976 100644 --- a/scene/3d/cpu_particles.h +++ b/scene/3d/cpu_particles.h @@ -75,6 +75,7 @@ public: EMISSION_SHAPE_BOX, EMISSION_SHAPE_POINTS, EMISSION_SHAPE_DIRECTED_POINTS, + EMISSION_SHAPE_MAX }; private: diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index a058f42cb2..412b5c259c 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -198,6 +198,9 @@ void ParticlesMaterial::_update_shader() { code += "uniform sampler2D emission_texture_color : hint_white;\n"; } } break; + case EMISSION_SHAPE_MAX: { // Max value for validity check. + break; + } } code += "uniform vec4 color_value : hint_color;\n"; @@ -283,7 +286,7 @@ void ParticlesMaterial::_update_shader() { code += " float degree_to_rad = pi / 180.0;\n"; code += "\n"; - if (emission_shape >= EMISSION_SHAPE_POINTS) { + if (emission_shape == EMISSION_SHAPE_POINTS || emission_shape == EMISSION_SHAPE_DIRECTED_POINTS) { code += " int point = min(emission_texture_point_count - 1, int(rand_from_seed(alt_seed) * float(emission_texture_point_count)));\n"; code += " ivec2 emission_tex_size = textureSize(emission_texture_points, 0);\n"; code += " ivec2 emission_tex_ofs = ivec2(point % emission_tex_size.x, point / emission_tex_size.x);\n"; @@ -368,6 +371,9 @@ void ParticlesMaterial::_update_shader() { } } } break; + case EMISSION_SHAPE_MAX: { // Max value for validity check. + break; + } } code += " VELOCITY = (EMISSION_TRANSFORM * vec4(VELOCITY, 0.0)).xyz;\n"; code += " TRANSFORM = EMISSION_TRANSFORM * TRANSFORM;\n"; @@ -515,7 +521,7 @@ void ParticlesMaterial::_update_shader() { } else { code += " COLOR = hue_rot_mat * color_value;\n"; } - if (emission_color_texture.is_valid() && emission_shape >= EMISSION_SHAPE_POINTS) { + if (emission_color_texture.is_valid() && (emission_shape == EMISSION_SHAPE_POINTS || emission_shape == EMISSION_SHAPE_DIRECTED_POINTS)) { code += " COLOR *= texelFetch(emission_texture_color, emission_tex_ofs, 0);\n"; } if (trail_color_modifier.is_valid()) { @@ -894,7 +900,7 @@ bool ParticlesMaterial::get_flag(Flags p_flag) const { } void ParticlesMaterial::set_emission_shape(EmissionShape p_shape) { - + ERR_FAIL_INDEX(p_shape, EMISSION_SHAPE_MAX); emission_shape = p_shape; _change_notify(); _queue_shader_change(); @@ -1242,6 +1248,7 @@ void ParticlesMaterial::_bind_methods() { BIND_ENUM_CONSTANT(EMISSION_SHAPE_BOX); BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS); BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_MAX); } ParticlesMaterial::ParticlesMaterial() : diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h index 643c2cb10e..cc860b3812 100644 --- a/scene/resources/particles_material.h +++ b/scene/resources/particles_material.h @@ -69,6 +69,7 @@ public: EMISSION_SHAPE_BOX, EMISSION_SHAPE_POINTS, EMISSION_SHAPE_DIRECTED_POINTS, + EMISSION_SHAPE_MAX }; private: diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 225b382524..2b61d72f6a 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2060,7 +2060,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { //sub-functions //array - { "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, false }, + { "length", TYPE_INT, { TYPE_VOID }, TAG_ARRAY, true }, { NULL, TYPE_VOID, { TYPE_VOID }, TAG_GLOBAL, false } @@ -3888,6 +3888,11 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui if (tk.type == TK_BRACKET_OPEN) { bool unknown_size = false; + if (VisualServer::get_singleton()->is_low_end() && is_const) { + _set_error("Local const arrays are supported only on high-end platform!"); + return ERR_PARSE_ERROR; + } + ArrayDeclarationNode *node = alloc_node<ArrayDeclarationNode>(); node->datatype = type; node->precision = precision; @@ -3923,6 +3928,12 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui tk = _get_token(); if (tk.type == TK_OP_ASSIGN) { + + if (VisualServer::get_singleton()->is_low_end()) { + _set_error("Array initialization is supported only on high-end platform!"); + return ERR_PARSE_ERROR; + } + tk = _get_token(); if (tk.type != TK_CURLY_BRACKET_OPEN) { |