diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bullet/rigid_body_bullet.cpp | 6 | ||||
-rw-r--r-- | modules/csg/csg_shape.cpp | 14 | ||||
-rw-r--r-- | modules/csg/csg_shape.h | 2 | ||||
-rw-r--r-- | modules/hdr/image_loader_hdr.cpp | 2 | ||||
-rw-r--r-- | modules/mono/utils/path_utils.cpp | 2 | ||||
-rw-r--r-- | modules/pvr/texture_loader_pvr.cpp | 9 | ||||
-rw-r--r-- | modules/svg/image_loader_svg.cpp | 5 | ||||
-rw-r--r-- | modules/websocket/doc_classes/WebSocketClient.xml | 3 | ||||
-rw-r--r-- | modules/websocket/doc_classes/WebSocketServer.xml | 3 | ||||
-rw-r--r-- | modules/websocket/websocket_multiplayer.cpp | 7 |
10 files changed, 41 insertions, 12 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 09177205b4..22f2214898 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -797,6 +797,9 @@ void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transfor btBody->setLinearVelocity((p_global_transform.getOrigin() - btBody->getWorldTransform().getOrigin()) / space->get_delta_time()); // The kinematic use MotionState class godotMotionState->moveBody(p_global_transform); + } else { + // Is necesasry to avoid wrong location on the rendering side on the next frame + godotMotionState->setWorldTransform(p_global_transform); } CollisionObjectBullet::set_transform__bullet(p_global_transform); } @@ -822,7 +825,8 @@ void RigidBodyBullet::reload_shapes() { // shapes incorrectly do not set the vector in calculateLocalIntertia. // Arbitrary zero is preferable to undefined behaviour. btVector3 inertia(0, 0, 0); - mainShape->calculateLocalInertia(mass, inertia); + if (EMPTY_SHAPE_PROXYTYPE != mainShape->getShapeType()) // Necessary to avoid assertion of the empty shape + mainShape->calculateLocalInertia(mass, inertia); btBody->setMassProps(mass, inertia); } btBody->updateInertiaTensor(); diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index a13f731c11..f62e6f5c40 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -575,6 +575,18 @@ void CSGShape::_validate_property(PropertyInfo &property) const { } } +Array CSGShape::get_meshes() const { + + if (root_mesh.is_valid()) { + Array arr; + arr.resize(2); + arr[0] = Transform(); + arr[1] = root_mesh; + return arr; + } + + return Array(); +} void CSGShape::_bind_methods() { ClassDB::bind_method(D_METHOD("_update_shape"), &CSGShape::_update_shape); @@ -604,6 +616,8 @@ void CSGShape::_bind_methods() { ClassDB::bind_method(D_METHOD("set_calculate_tangents", "enabled"), &CSGShape::set_calculate_tangents); ClassDB::bind_method(D_METHOD("is_calculating_tangents"), &CSGShape::is_calculating_tangents); + ClassDB::bind_method(D_METHOD("get_meshes"), &CSGShape::get_meshes); + ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "Union,Intersection,Subtraction"), "set_operation", "get_operation"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "snap", PROPERTY_HINT_RANGE, "0.0001,1,0.001"), "set_snap", "get_snap"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "calculate_tangents"), "set_calculate_tangents", "is_calculating_tangents"); diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index df503faf2e..1622fb3a15 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -116,6 +116,8 @@ protected: virtual void _validate_property(PropertyInfo &property) const; + Array get_meshes() const; + public: void set_operation(Operation p_operation); Operation get_operation() const; diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp index eb424d36f8..f75a4a926a 100644 --- a/modules/hdr/image_loader_hdr.cpp +++ b/modules/hdr/image_loader_hdr.cpp @@ -33,8 +33,6 @@ #include "core/os/os.h" #include "core/print_string.h" -#include "thirdparty/tinyexr/tinyexr.h" - Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { String header = f->get_token(); diff --git a/modules/mono/utils/path_utils.cpp b/modules/mono/utils/path_utils.cpp index 80f2324e15..6e431f51e7 100644 --- a/modules/mono/utils/path_utils.cpp +++ b/modules/mono/utils/path_utils.cpp @@ -59,7 +59,7 @@ String path_which(const String &p_name) { #ifdef WINDOWS_ENABLED for (int j = 0; j < exts.size(); j++) { - String p2 = p + exts[j]; + String p2 = p + exts[j].to_lower(); // lowercase to reduce risk of case mismatch warning if (FileAccess::exists(p2)) return p2; diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index d3f2f3c272..01e011e64c 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -33,6 +33,7 @@ #include "RgbaBitmap.h" #include "core/os/file_access.h" #include <string.h> +#include <new> static void _pvrtc_decompress(Image *p_img); @@ -215,12 +216,10 @@ static void _compress_pvrtc4(Image *p_img) { int ofs, size, w, h; img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); Javelin::RgbaBitmap bm(w, h); - copymem(bm.GetData(), &r[ofs], size); - { + for (unsigned j = 0; j < size / 4; j++) { Javelin::ColorRgba<unsigned char> *dp = bm.GetData(); - for (int j = 0; j < size / 4; j++) { - SWAP(dp[j].r, dp[j].b); - } + /* red and Green colors are swapped. */ + new (dp) Javelin::ColorRgba<unsigned char>(r[ofs + 4 * j + 2], r[ofs + 4 * j + 1], r[ofs + 4 * j], r[ofs + 4 * j + 3]); } new_img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h); diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index 404ca24482..e36844a1bc 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -109,7 +109,12 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t float upscale = upsample ? 2.0 : 1.0; int w = (int)(svg_image->width * p_scale * upscale); + ERR_EXPLAIN(vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max width.", rtos(p_scale))); + ERR_FAIL_COND_V(w > Image::MAX_WIDTH, ERR_PARAMETER_RANGE_ERROR); + int h = (int)(svg_image->height * p_scale * upscale); + ERR_EXPLAIN(vformat("Can't create image from SVG with scale %s, the resulting image size exceeds max height.", rtos(p_scale))); + ERR_FAIL_COND_V(h > Image::MAX_HEIGHT, ERR_PARAMETER_RANGE_ERROR); PoolVector<uint8_t> dst_image; dst_image.resize(w * h * 4); diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml index 6b73b80350..ffb6d40e30 100644 --- a/modules/websocket/doc_classes/WebSocketClient.xml +++ b/modules/websocket/doc_classes/WebSocketClient.xml @@ -25,7 +25,8 @@ </argument> <description> Connect to the given URL requesting one of the given [code]protocols[/code] as sub-protocol. - If [code]true[/code], is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true. + If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI], connections to non Godot servers will not work, and [signal data_received] will not be emitted. + If [code]false[/code] is passed instead (default), you must call [PacketPeer] functions ([code]put_packet[/code], [code]get_packet[/code], etc.) on the [WebSocketPeer] returned via [code]get_peer(1)[/code] and not on this object directly (e.g. [code]get_peer(1).put_packet(data)[/code]). </description> </method> <method name="disconnect_from_host"> diff --git a/modules/websocket/doc_classes/WebSocketServer.xml b/modules/websocket/doc_classes/WebSocketServer.xml index ba66fdd89b..2932bf782a 100644 --- a/modules/websocket/doc_classes/WebSocketServer.xml +++ b/modules/websocket/doc_classes/WebSocketServer.xml @@ -72,7 +72,8 @@ <description> Start listening on the given port. You can specify the desired subprotocols via the "protocols" array. If the list empty (default), "binary" will be used. - You can use this server as a network peer for [MultiplayerAPI] by passing [code]true[/code] as [code]gd_mp_api[/code]. Note: [signal data_received] will not be fired and clients other than Godot will not work in this case. + If [code]true[/code] is passed as [code]gd_mp_api[/code], the server will behave like a network peer for the [MultiplayerAPI], connections from non Godot clients will not work, and [signal data_received] will not be emitted. + If [code]false[/code] is passed instead (default), you must call [PacketPeer] functions ([code]put_packet[/code], [code]get_packet[/code], etc.), on the [WebSocketPeer] returned via [code]get_peer(ID)[/code] to communicate with the peer with given [code]ID[/code] (e.g. [code]get_peer(ID).get_available_packet_count[/code]). </description> </method> <method name="stop"> diff --git a/modules/websocket/websocket_multiplayer.cpp b/modules/websocket/websocket_multiplayer.cpp index 7c8cc36fad..11caac944b 100644 --- a/modules/websocket/websocket_multiplayer.cpp +++ b/modules/websocket/websocket_multiplayer.cpp @@ -96,6 +96,7 @@ void WebSocketMultiplayerPeer::_bind_methods() { // int WebSocketMultiplayerPeer::get_available_packet_count() const { + ERR_EXPLAIN("Please use get_peer(ID).get_available_packet_count to get available packet count from peers when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED); return _incoming_packets.size(); @@ -103,9 +104,11 @@ int WebSocketMultiplayerPeer::get_available_packet_count() const { Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) { - r_buffer_size = 0; + ERR_EXPLAIN("Please use get_peer(ID).get_packet/var to communicate with peers when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED); + r_buffer_size = 0; + if (_current_packet.data != NULL) { memfree(_current_packet.data); _current_packet.data = NULL; @@ -122,6 +125,7 @@ Error WebSocketMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buff Error WebSocketMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) { + ERR_EXPLAIN("Please use get_peer(ID).put_packet/var to communicate with peers when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, ERR_UNCONFIGURED); PoolVector<uint8_t> buffer = _make_pkt(SYS_NONE, get_unique_id(), _target_peer, p_buffer, p_buffer_size); @@ -154,6 +158,7 @@ void WebSocketMultiplayerPeer::set_target_peer(int p_target_peer) { int WebSocketMultiplayerPeer::get_packet_peer() const { + ERR_EXPLAIN("This function is not available when not using the MultiplayerAPI."); ERR_FAIL_COND_V(!_is_multiplayer, 1); ERR_FAIL_COND_V(_incoming_packets.size() == 0, 1); |