diff options
-rw-r--r-- | doc/classes/ARVRAnchor.xml | 2 | ||||
-rw-r--r-- | doc/classes/AudioStreamPlayer3D.xml | 2 | ||||
-rw-r--r-- | doc/classes/CheckBox.xml | 2 | ||||
-rw-r--r-- | doc/classes/ColorPickerButton.xml | 2 | ||||
-rw-r--r-- | doc/classes/ConeTwistJoint.xml | 2 | ||||
-rw-r--r-- | doc/classes/GridContainer.xml | 2 | ||||
-rw-r--r-- | doc/classes/InterpolatedCamera.xml | 2 | ||||
-rw-r--r-- | doc/classes/LinkButton.xml | 2 | ||||
-rw-r--r-- | doc/classes/Position3D.xml | 2 | ||||
-rw-r--r-- | drivers/wasapi/audio_driver_wasapi.cpp | 17 | ||||
-rw-r--r-- | editor/plugins/mesh_instance_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | modules/bullet/shape_bullet.cpp | 4 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 20 | ||||
-rw-r--r-- | platform/iphone/power_iphone.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/detect.py | 20 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 55 | ||||
-rw-r--r-- | scene/resources/mesh.cpp | 2 |
18 files changed, 113 insertions, 31 deletions
diff --git a/doc/classes/ARVRAnchor.xml b/doc/classes/ARVRAnchor.xml index a8366e3405..fa93d9668c 100644 --- a/doc/classes/ARVRAnchor.xml +++ b/doc/classes/ARVRAnchor.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ARVRAnchor" inherits="Spatial" category="Core" version="3.1"> <brief_description> - Anchor point in AR Space + Anchor point in AR Space. </brief_description> <description> The ARVR Anchor point is a spatial node that maps a real world location identified by the AR platform to a position within the game world. For example, as long as plane detection in ARKit is on, ARKit will identify and update the position of planes (tables, floors, etc) and create anchors for them. diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index 1ab5184684..3418ef7a26 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioStreamPlayer3D" inherits="Spatial" category="Core" version="3.1"> <brief_description> - Plays 3D sound in 3D space + Plays 3D sound in 3D space. </brief_description> <description> Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml index d37f0422bc..fb2cf64d98 100644 --- a/doc/classes/CheckBox.xml +++ b/doc/classes/CheckBox.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="CheckBox" inherits="Button" category="Core" version="3.1"> <brief_description> - Binary choice user interface widget + Binary choice user interface widget. </brief_description> <description> A checkbox allows the user to make a binary choice (choosing only one of two possible options), for example Answer 'yes' or 'no'. diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 717f7e4efc..eb86dc8af8 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ColorPickerButton" inherits="Button" category="Core" version="3.1"> <brief_description> - Button that pops out a [ColorPicker] + Button that pops out a [ColorPicker]. </brief_description> <description> Encapsulates a [ColorPicker] making it accesible by pressing a button, pressing the button will toggle the [ColorPicker] visibility diff --git a/doc/classes/ConeTwistJoint.xml b/doc/classes/ConeTwistJoint.xml index feb3262be0..d6b2f191a4 100644 --- a/doc/classes/ConeTwistJoint.xml +++ b/doc/classes/ConeTwistJoint.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="ConeTwistJoint" inherits="Joint" category="Core" version="3.1"> <brief_description> - A twist joint between two 3D bodies + A twist joint between two 3D bodies. </brief_description> <description> The joint can rotate the bodies across an axis defined by the local x-axes of the [Joint]. diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml index 7f70a8b7b4..346ab9d357 100644 --- a/doc/classes/GridContainer.xml +++ b/doc/classes/GridContainer.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="GridContainer" inherits="Container" category="Core" version="3.1"> <brief_description> - Grid container used to arrange elements in a grid like layout + Grid container used to arrange elements in a grid like layout. </brief_description> <description> Grid container will arrange its children in a grid like structure, the grid columns are specified using the [method set_columns] method and the number of rows will be equal to the number of children in the container divided by the number of columns, for example: if the container has 5 children, and 2 columns, there will be 3 rows in the container. Notice that grid layout will preserve the columns and rows for every size of the container. diff --git a/doc/classes/InterpolatedCamera.xml b/doc/classes/InterpolatedCamera.xml index b4047f450d..d47df796a2 100644 --- a/doc/classes/InterpolatedCamera.xml +++ b/doc/classes/InterpolatedCamera.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="InterpolatedCamera" inherits="Camera" category="Core" version="3.1"> <brief_description> - Camera which moves toward another node + Camera which moves toward another node. </brief_description> <description> InterpolatedCamera is a [Camera] which smoothly moves to match a target node's position and rotation. diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml index f419802958..a09edfad89 100644 --- a/doc/classes/LinkButton.xml +++ b/doc/classes/LinkButton.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="LinkButton" inherits="BaseButton" category="Core" version="3.1"> <brief_description> - Simple button used to represent a link to some resource + Simple button used to represent a link to some resource. </brief_description> <description> This kind of buttons are primarily used when the interaction with the button causes a context change (like linking to a web page). diff --git a/doc/classes/Position3D.xml b/doc/classes/Position3D.xml index de29ac2154..7c0875cc0c 100644 --- a/doc/classes/Position3D.xml +++ b/doc/classes/Position3D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Position3D" inherits="Spatial" category="Core" version="3.1"> <brief_description> - Generic 3D Position hint for editing + Generic 3D Position hint for editing. </brief_description> <description> Generic 3D Position hint for editing. It's just like a plain [Spatial] but displays as a cross in the 3D-Editor at all times. diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 36acfb10d1..aae6c0d308 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -151,7 +151,6 @@ Error AudioDriverWASAPI::init_device(bool reinit) { // Since we're using WASAPI Shared Mode we can't control any of these, we just tag along wasapi_channels = pwfex->nChannels; - mix_rate = pwfex->nSamplesPerSec; format_tag = pwfex->wFormatTag; bits_per_sample = pwfex->wBitsPerSample; @@ -187,7 +186,14 @@ Error AudioDriverWASAPI::init_device(bool reinit) { } } - hr = audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 0, 0, pwfex, NULL); + DWORD streamflags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK; + if (mix_rate != pwfex->nSamplesPerSec) { + streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST; + pwfex->nSamplesPerSec = mix_rate; + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nChannels * (pwfex->wBitsPerSample / 8); + } + + hr = audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, streamflags, 0, 0, pwfex, NULL); ERR_FAIL_COND_V(hr != S_OK, ERR_CANT_OPEN); event = CreateEvent(NULL, FALSE, FALSE, NULL); @@ -223,10 +229,11 @@ Error AudioDriverWASAPI::finish_device() { if (audio_client) { if (active) { audio_client->Stop(); - audio_client->Release(); - audio_client = NULL; active = false; } + + audio_client->Release(); + audio_client = NULL; } if (render_client) { @@ -244,6 +251,8 @@ Error AudioDriverWASAPI::finish_device() { Error AudioDriverWASAPI::init() { + mix_rate = GLOBAL_DEF("audio/mix_rate", DEFAULT_MIX_RATE); + Error err = init_device(); if (err != OK) { ERR_PRINT("WASAPI: init_device error"); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index cb5f7ba76c..7ea2b27744 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -344,6 +344,10 @@ void MeshInstanceEditor::_create_outline_mesh() { err_dialog->set_text(TTR("Mesh has not surface to create outlines from!")); err_dialog->popup_centered_minsize(); return; + } else if (mesh->get_surface_count() == 1 && mesh->surface_get_primitive_type(0) != Mesh::PRIMITIVE_TRIANGLES) { + err_dialog->set_text(TTR("Mesh primitive type is not PRIMITIVE_TRIANGLES!")); + err_dialog->popup_centered_minsize(); + return; } Ref<Mesh> mesho = mesh->create_outline(outline_size->get_value()); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index d8d0a6f013..71a3c90795 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -458,8 +458,6 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) { List<StringName> anim_names; - anim_names.sort_custom<StringName::AlphCompare>(); - frames->get_animation_list(&anim_names); anim_names.sort_custom<StringName::AlphCompare>(); diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 5d8d391bd9..9cbf83689b 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -337,10 +337,10 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) { int src_face_count = faces.size(); if (0 < src_face_count) { - btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh); - // It counts the faces and assert the array contains the correct number of vertices. ERR_FAIL_COND(src_face_count % 3); + + btTriangleMesh *shapeInterface = bulletnew(btTriangleMesh); src_face_count /= 3; PoolVector<Vector3>::Read r = p_faces.read(); const Vector3 *facesr = r.ptr(); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 58c6d73ab2..9e6307c0bf 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -261,14 +261,12 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { /* look for further theora headers */ while (theora_p && (theora_p < 3) && (ret = ogg_stream_packetout(&to, &op))) { if (ret < 0) { - fprintf(stderr, "Error parsing Theora stream headers; " - "corrupt stream?\n"); + fprintf(stderr, "Error parsing Theora stream headers; corrupt stream?\n"); clear(); return; } if (!th_decode_headerin(&ti, &tc, &ts, &op)) { - fprintf(stderr, "Error parsing Theora stream headers; " - "corrupt stream?\n"); + fprintf(stderr, "Error parsing Theora stream headers; corrupt stream?\n"); clear(); return; } @@ -312,9 +310,15 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { td = th_decode_alloc(&ti, ts); px_fmt = ti.pixel_fmt; switch (ti.pixel_fmt) { - case TH_PF_420: printf(" 4:2:0 video\n"); break; - case TH_PF_422: printf(" 4:2:2 video\n"); break; - case TH_PF_444: printf(" 4:4:4 video\n"); break; + case TH_PF_420: + //printf(" 4:2:0 video\n"); + break; + case TH_PF_422: + //printf(" 4:2:2 video\n"); + break; + case TH_PF_444: + //printf(" 4:4:4 video\n"); + break; case TH_PF_RSVD: default: printf(" video\n (UNKNOWN Chroma sampling!)\n"); @@ -519,7 +523,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) { #else if (file && /*!videobuf_ready && */ no_theora && theora_eos) { #endif - printf("video done, stopping\n"); + //printf("video done, stopping\n"); stop(); return; }; diff --git a/platform/iphone/power_iphone.cpp b/platform/iphone/power_iphone.cpp index 95a9aa9705..7f9dadc363 100644 --- a/platform/iphone/power_iphone.cpp +++ b/platform/iphone/power_iphone.cpp @@ -30,7 +30,7 @@ #include "power_iphone.h" -bool OS::PowerState::UpdatePowerInfo() { +bool PowerIphone::UpdatePowerInfo() { return false; } diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 851f4ecb49..be1866987a 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -12,7 +12,7 @@ def get_name(): def can_build(): - return 'EMSCRIPTEN_ROOT' in os.environ or 'EMSCRIPTEN' in os.environ + return 'EM_CONFIG' in os.environ or os.path.exists(os.path.expanduser('~/.emscripten')) def get_opts(): @@ -67,10 +67,20 @@ def configure(env): ## Compiler configuration env['ENV'] = os.environ - if 'EMSCRIPTEN_ROOT' in os.environ: - env.PrependENVPath('PATH', os.environ['EMSCRIPTEN_ROOT']) - elif 'EMSCRIPTEN' in os.environ: - env.PrependENVPath('PATH', os.environ['EMSCRIPTEN']) + + em_config_file = os.getenv('EM_CONFIG') or os.path.expanduser('~/.emscripten') + if not os.path.exists(em_config_file): + raise RuntimeError("Emscripten configuration file '%s' does not exist" % em_config_file) + with open(em_config_file) as f: + em_config = {} + try: + # Emscripten configuration file is a Python file with simple assignments. + exec(f.read(), em_config) + except StandardError as e: + raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e)) + if 'EMSCRIPTEN_ROOT' not in em_config: + raise RuntimeError("'EMSCRIPTEN_ROOT' missing in Emscripten configuration file '%s'" % em_config_file) + env.PrependENVPath('PATH', em_config['EMSCRIPTEN_ROOT']) env['CC'] = 'emcc' env['CXX'] = 'em++' diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index b602839b99..c126dd8f6b 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -265,12 +265,18 @@ void TileMap::_update_dirty_quadrants() { SceneTree *st = SceneTree::get_singleton(); Color debug_collision_color; + Color debug_navigation_color; bool debug_shapes = st && st->is_debugging_collisions_hint(); if (debug_shapes) { debug_collision_color = st->get_debug_collisions_color(); } + bool debug_navigation = st && st->is_debugging_navigation_hint(); + if (debug_navigation) { + debug_navigation_color = st->get_debug_navigation_color(); + } + while (dirty_quadrant_list.first()) { Quadrant &q = *dirty_quadrant_list.first()->self(); @@ -497,6 +503,55 @@ void TileMap::_update_dirty_quadrants() { np.id = pid; np.xform = xform; q.navpoly_ids[E->key()] = np; + + if (debug_navigation) { + RID debug_navigation_item = vs->canvas_item_create(); + vs->canvas_item_set_parent(debug_navigation_item, canvas_item); + vs->canvas_item_set_z_as_relative_to_parent(debug_navigation_item, false); + vs->canvas_item_set_z_index(debug_navigation_item, VS::CANVAS_ITEM_Z_MAX - 2); // Display one below collision debug + + if (debug_navigation_item.is_valid()) { + PoolVector<Vector2> navigation_polygon_vertices = navpoly->get_vertices(); + int vsize = navigation_polygon_vertices.size(); + + if (vsize > 2) { + Vector<Color> colors; + Vector<Vector2> vertices; + vertices.resize(vsize); + colors.resize(vsize); + { + PoolVector<Vector2>::Read vr = navigation_polygon_vertices.read(); + for (int i = 0; i < vsize; i++) { + vertices[i] = vr[i]; + colors[i] = debug_navigation_color; + } + } + + Vector<int> indices; + + for (int i = 0; i < navpoly->get_polygon_count(); i++) { + Vector<int> polygon = navpoly->get_polygon(i); + + for (int j = 2; j < polygon.size(); j++) { + + int kofs[3] = { 0, j - 1, j }; + for (int k = 0; k < 3; k++) { + + int idx = polygon[kofs[k]]; + ERR_FAIL_INDEX(idx, vsize); + indices.push_back(idx); + } + } + } + Transform2D navxform; + navxform.set_origin(offset.floor()); + _fix_cell_transform(navxform, c, npoly_ofs + center_ofs, s); + + vs->canvas_item_set_transform(debug_navigation_item, navxform); + vs->canvas_item_add_triangle_array(debug_navigation_item, indices, vertices, colors); + } + } + } } } diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 949ba12a4c..b832ea1239 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -315,6 +315,8 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { } } + ERR_FAIL_COND_V(arrays.size() != ARRAY_MAX, Ref<ArrayMesh>()); + { PoolVector<int>::Write ir; PoolVector<int> indices = arrays[ARRAY_INDEX]; |