summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/SCsub10
-rw-r--r--modules/bullet/area_bullet.cpp26
-rw-r--r--modules/bullet/area_bullet.h14
-rw-r--r--modules/bullet/btRayShape.cpp6
-rw-r--r--modules/bullet/bullet_physics_server.cpp18
-rw-r--r--modules/bullet/bullet_physics_server.h4
-rw-r--r--modules/bullet/collision_object_bullet.cpp26
-rw-r--r--modules/bullet/collision_object_bullet.h24
-rw-r--r--modules/bullet/cone_twist_joint_bullet.cpp18
-rw-r--r--modules/bullet/constraint_bullet.cpp5
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.cpp77
-rw-r--r--modules/bullet/generic_6dof_joint_bullet.h5
-rw-r--r--modules/bullet/godot_collision_configuration.cpp4
-rw-r--r--modules/bullet/godot_collision_dispatcher.cpp4
-rw-r--r--modules/bullet/godot_motion_state.h8
-rw-r--r--modules/bullet/godot_ray_world_algorithm.cpp24
-rw-r--r--modules/bullet/godot_result_callbacks.h67
-rw-r--r--modules/bullet/hinge_joint_bullet.cpp28
-rw-r--r--modules/bullet/joint_bullet.cpp4
-rw-r--r--modules/bullet/pin_joint_bullet.cpp8
-rw-r--r--modules/bullet/rigid_body_bullet.cpp107
-rw-r--r--modules/bullet/rigid_body_bullet.h11
-rw-r--r--modules/bullet/shape_bullet.cpp34
-rw-r--r--modules/bullet/slider_joint_bullet.cpp17
-rw-r--r--modules/bullet/soft_body_bullet.cpp14
-rw-r--r--modules/bullet/space_bullet.cpp55
-rw-r--r--modules/bullet/space_bullet.h4
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp4
-rw-r--r--modules/enet/networked_multiplayer_enet.h8
-rw-r--r--modules/etc/SCsub3
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.cpp2
-rw-r--r--modules/gdnative/gdnative.cpp2
-rw-r--r--modules/gdnative/gdnative.h4
-rw-r--r--modules/gdnative/gdnative/basis.cpp2
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/gdnative/quat.cpp2
-rw-r--r--modules/gdnative/gdnative/vector2.cpp2
-rw-r--r--modules/gdnative/gdnative/vector3.cpp2
-rw-r--r--modules/gdnative/gdnative_api.json14
-rw-r--r--modules/gdnative/include/gdnative/basis.h2
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h6
-rw-r--r--modules/gdnative/include/gdnative/quat.h2
-rw-r--r--modules/gdnative/include/gdnative/vector2.h2
-rw-r--r--modules/gdnative/include/gdnative/vector3.h2
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp2
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp10
-rw-r--r--modules/gdnative/nativescript/nativescript.h12
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp4
-rw-r--r--modules/gdnative/pluginscript/pluginscript_script.cpp7
-rw-r--r--modules/gdnative/register_types.cpp25
-rw-r--r--modules/gdscript/SCsub5
-rw-r--r--modules/gdscript/gdscript.cpp6
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
-rw-r--r--modules/gdscript/gdscript_editor.cpp2
-rw-r--r--modules/gdscript/gdscript_function.cpp10
-rw-r--r--modules/gdscript/gdscript_parser.cpp64
-rw-r--r--modules/gdscript/register_types.cpp44
-rw-r--r--modules/gridmap/SCsub5
-rw-r--r--modules/gridmap/grid_map.cpp4
-rw-r--r--modules/gridmap/grid_map.h5
-rw-r--r--modules/mobile_vr/mobile_interface.cpp2
-rw-r--r--modules/mono/SCsub21
-rw-r--r--modules/mono/csharp_script.cpp4
-rw-r--r--modules/mono/editor/csharp_project.cpp2
-rw-r--r--modules/mono/editor/csharp_project.h2
-rw-r--r--modules/mono/glue/cs_files/Error.cs3
-rw-r--r--modules/mono/godotsharp_dirs.cpp2
-rw-r--r--modules/mono/godotsharp_dirs.h2
-rw-r--r--modules/mono/mono_gc_handle.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp2
-rw-r--r--modules/mono/signal_awaiter_utils.cpp6
-rw-r--r--modules/mono/utils/mono_reg_utils.h2
-rw-r--r--modules/mono/utils/string_utils.cpp2
-rw-r--r--modules/openssl/stream_peer_openssl.cpp8
-rw-r--r--modules/opus/audio_stream_opus.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp6
-rw-r--r--modules/squish/image_compress_squish.cpp2
-rw-r--r--modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml53
-rw-r--r--modules/thekla_unwrap/SCsub74
-rw-r--r--modules/thekla_unwrap/config.py7
-rw-r--r--modules/thekla_unwrap/register_types.cpp116
-rw-r--r--modules/thekla_unwrap/register_types.h31
-rw-r--r--modules/theora/doc_classes/VideoStreamTheora.xml18
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp25
-rw-r--r--modules/visual_script/SCsub5
-rw-r--r--modules/visual_script/doc_classes/VisualScript.xml4
-rw-r--r--modules/visual_script/doc_classes/VisualScriptConstructor.xml52
-rw-r--r--modules/visual_script/doc_classes/VisualScriptDeconstruct.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptFunctionCall.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptNode.xml4
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertyGet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptPropertySet.xml2
-rw-r--r--modules/visual_script/doc_classes/VisualScriptYield.xml16
-rw-r--r--modules/visual_script/register_types.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp3
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp6
-rw-r--r--modules/visual_script/visual_script_nodes.cpp8
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.cpp2
-rw-r--r--modules/webm/doc_classes/VideoStreamWebm.xml18
-rw-r--r--modules/webm/video_stream_webm.cpp40
-rw-r--r--modules/webp/SCsub11
101 files changed, 989 insertions, 478 deletions
diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub
index 7a37cca130..0967bca3f2 100644
--- a/modules/bullet/SCsub
+++ b/modules/bullet/SCsub
@@ -1,9 +1,13 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
# build only version 2
# Bullet 2.87
+
+env_bullet = env_modules.Clone()
+
bullet_src__2_x = [
# BulletCollision
"BulletCollision/BroadphaseCollision/btAxisSweep3.cpp"
@@ -181,11 +185,11 @@ thirdparty_src = thirdparty_dir + "src/"
bullet_sources = [thirdparty_src + file for file in bullet_src__2_x]
# include headers
-env.Append(CPPPATH=[thirdparty_src])
+env_bullet.Append(CPPPATH=[thirdparty_src])
-env.add_source_files(env.modules_sources, bullet_sources)
+env_bullet.add_source_files(env.modules_sources, bullet_sources)
# Godot source files
-env.add_source_files(env.modules_sources, "*.cpp")
+env_bullet.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index 54024b4f90..fad6f52cea 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -37,19 +37,19 @@
#include "collision_object_bullet.h"
#include "space_bullet.h"
-AreaBullet::AreaBullet()
- : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA),
- monitorable(true),
- isScratched(false),
- spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED),
- spOv_gravityPoint(false),
- spOv_gravityPointDistanceScale(0),
- spOv_gravityPointAttenuation(1),
- spOv_gravityVec(0, -1, 0),
- spOv_gravityMag(10),
- spOv_linearDump(0.1),
- spOv_angularDump(1),
- spOv_priority(0) {
+AreaBullet::AreaBullet() :
+ RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_AREA),
+ monitorable(true),
+ isScratched(false),
+ spOv_mode(PhysicsServer::AREA_SPACE_OVERRIDE_DISABLED),
+ spOv_gravityPoint(false),
+ spOv_gravityPointDistanceScale(0),
+ spOv_gravityPointAttenuation(1),
+ spOv_gravityVec(0, -1, 0),
+ spOv_gravityMag(10),
+ spOv_linearDump(0.1),
+ spOv_angularDump(1),
+ spOv_priority(0) {
btGhost = bulletnew(btGhostObject);
btGhost->setCollisionShape(compoundShape);
diff --git a/modules/bullet/area_bullet.h b/modules/bullet/area_bullet.h
index f6e3b7e902..95ce62bfed 100644
--- a/modules/bullet/area_bullet.h
+++ b/modules/bullet/area_bullet.h
@@ -47,8 +47,8 @@ public:
ObjectID event_callback_id;
StringName event_callback_method;
- InOutEventCallback()
- : event_callback_id(0) {}
+ InOutEventCallback() :
+ event_callback_id(0) {}
};
enum OverlapState {
@@ -62,10 +62,12 @@ public:
CollisionObjectBullet *object;
OverlapState state;
- OverlappingObjectData()
- : object(NULL), state(OVERLAP_STATE_ENTER) {}
- OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state)
- : object(p_object), state(p_state) {}
+ OverlappingObjectData() :
+ object(NULL),
+ state(OVERLAP_STATE_ENTER) {}
+ OverlappingObjectData(CollisionObjectBullet *p_object, OverlapState p_state) :
+ object(p_object),
+ state(p_state) {}
OverlappingObjectData(const OverlappingObjectData &other) {
operator=(other);
}
diff --git a/modules/bullet/btRayShape.cpp b/modules/bullet/btRayShape.cpp
index ac95faaac6..bbd2b19677 100644
--- a/modules/bullet/btRayShape.cpp
+++ b/modules/bullet/btRayShape.cpp
@@ -33,9 +33,9 @@
#include "LinearMath/btAabbUtil2.h"
#include "math/math_funcs.h"
-btRayShape::btRayShape(btScalar length)
- : btConvexInternalShape(),
- m_shapeAxis(0, 0, 1) {
+btRayShape::btRayShape(btScalar length) :
+ btConvexInternalShape(),
+ m_shapeAxis(0, 0, 1) {
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
setLength(length);
}
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 6e9ed0e318..b233edc0d4 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -78,10 +78,10 @@ void BulletPhysicsServer::_bind_methods() {
//ClassDB::bind_method(D_METHOD("DoTest"), &BulletPhysicsServer::DoTest);
}
-BulletPhysicsServer::BulletPhysicsServer()
- : PhysicsServer(),
- active(true),
- active_spaces_count(0) {}
+BulletPhysicsServer::BulletPhysicsServer() :
+ PhysicsServer(),
+ active(true),
+ active_spaces_count(0) {}
BulletPhysicsServer::~BulletPhysicsServer() {}
@@ -723,16 +723,16 @@ void BulletPhysicsServer::body_set_axis_velocity(RID p_body, const Vector3 &p_ax
body->set_linear_velocity(v);
}
-void BulletPhysicsServer::body_set_axis_lock(RID p_body, PhysicsServer::BodyAxisLock p_lock) {
+void BulletPhysicsServer::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_axis_lock(p_lock);
+ body->set_axis_lock(p_axis, p_lock);
}
-PhysicsServer::BodyAxisLock BulletPhysicsServer::body_get_axis_lock(RID p_body) const {
+bool BulletPhysicsServer::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
const RigidBodyBullet *body = rigid_body_owner.get(p_body);
- ERR_FAIL_COND_V(!body, BODY_AXIS_LOCK_DISABLED);
- return body->get_axis_lock();
+ ERR_FAIL_COND_V(!body, 0);
+ return body->is_axis_locked(p_axis);
}
void BulletPhysicsServer::body_add_collision_exception(RID p_body, RID p_body_b) {
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index ad8137ee2f..8a10c87fc6 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -226,8 +226,8 @@ public:
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse);
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity);
- virtual void body_set_axis_lock(RID p_body, BodyAxisLock p_lock);
- virtual BodyAxisLock body_get_axis_lock(RID p_body) const;
+ virtual void body_set_axis_lock(RID p_body, BodyAxis p_axis, bool p_lock);
+ virtual bool body_is_axis_locked(RID p_body, BodyAxis p_axis) const;
virtual void body_add_collision_exception(RID p_body, RID p_body_b);
virtual void body_remove_collision_exception(RID p_body, RID p_body_b);
diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp
index 5e878b0ee4..88d4108f82 100644
--- a/modules/bullet/collision_object_bullet.cpp
+++ b/modules/bullet/collision_object_bullet.cpp
@@ -50,8 +50,14 @@ void CollisionObjectBullet::ShapeWrapper::set_transform(const btTransform &p_tra
transform = p_transform;
}
-CollisionObjectBullet::CollisionObjectBullet(Type p_type)
- : RIDBullet(), space(NULL), type(p_type), collisionsEnabled(true), m_isStatic(false), bt_collision_object(NULL), body_scale(1., 1., 1.) {}
+CollisionObjectBullet::CollisionObjectBullet(Type p_type) :
+ RIDBullet(),
+ space(NULL),
+ type(p_type),
+ collisionsEnabled(true),
+ m_isStatic(false),
+ bt_collision_object(NULL),
+ body_scale(1., 1., 1.) {}
CollisionObjectBullet::~CollisionObjectBullet() {
// Remove all overlapping
@@ -70,11 +76,17 @@ bool equal(real_t first, real_t second) {
void CollisionObjectBullet::set_body_scale(const Vector3 &p_new_scale) {
if (!equal(p_new_scale[0], body_scale[0]) || !equal(p_new_scale[1], body_scale[1]) || !equal(p_new_scale[2], body_scale[2])) {
- G_TO_B(p_new_scale, body_scale);
+ body_scale = p_new_scale;
on_body_scale_changed();
}
}
+btVector3 CollisionObjectBullet::get_bt_body_scale() const {
+ btVector3 s;
+ G_TO_B(body_scale, s);
+ return s;
+}
+
void CollisionObjectBullet::on_body_scale_changed() {
}
@@ -154,6 +166,7 @@ void CollisionObjectBullet::set_transform(const Transform &p_global_transform) {
Transform CollisionObjectBullet::get_transform() const {
Transform t;
B_TO_G(get_transform__bullet(), t);
+ t.basis.scale(body_scale);
return t;
}
@@ -165,8 +178,9 @@ const btTransform &CollisionObjectBullet::get_transform__bullet() const {
return bt_collision_object->getWorldTransform();
}
-RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type)
- : CollisionObjectBullet(p_type), compoundShape(bulletnew(btCompoundShape(enableDynamicAabbTree, initialChildCapacity))) {
+RigidCollisionObjectBullet::RigidCollisionObjectBullet(Type p_type) :
+ CollisionObjectBullet(p_type),
+ compoundShape(bulletnew(btCompoundShape(enableDynamicAabbTree, initialChildCapacity))) {
}
RigidCollisionObjectBullet::~RigidCollisionObjectBullet() {
@@ -295,7 +309,7 @@ void RigidCollisionObjectBullet::on_shapes_changed() {
}
}
- compoundShape->setLocalScaling(body_scale);
+ compoundShape->setLocalScaling(get_bt_body_scale());
compoundShape->recalculateLocalAabb();
}
diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h
index 153b8ea5bc..7d4659b64e 100644
--- a/modules/bullet/collision_object_bullet.h
+++ b/modules/bullet/collision_object_bullet.h
@@ -70,16 +70,22 @@ public:
btTransform transform;
bool active;
- ShapeWrapper()
- : shape(NULL), bt_shape(NULL), active(true) {}
-
- ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active)
- : shape(p_shape), bt_shape(NULL), active(p_active) {
+ ShapeWrapper() :
+ shape(NULL),
+ bt_shape(NULL),
+ active(true) {}
+
+ ShapeWrapper(ShapeBullet *p_shape, const btTransform &p_transform, bool p_active) :
+ shape(p_shape),
+ bt_shape(NULL),
+ active(p_active) {
set_transform(p_transform);
}
- ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active)
- : shape(p_shape), bt_shape(NULL), active(p_active) {
+ ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) :
+ shape(p_shape),
+ bt_shape(NULL),
+ active(p_active) {
set_transform(p_transform);
}
~ShapeWrapper();
@@ -108,7 +114,7 @@ protected:
bool m_isStatic;
bool ray_pickable;
btCollisionObject *bt_collision_object;
- btVector3 body_scale;
+ Vector3 body_scale;
SpaceBullet *space;
VSet<RID> exceptions;
@@ -140,6 +146,8 @@ public:
_FORCE_INLINE_ bool is_ray_pickable() const { return ray_pickable; }
void set_body_scale(const Vector3 &p_new_scale);
+ const Vector3 &get_body_scale() const { return body_scale; }
+ btVector3 get_bt_body_scale() const;
virtual void on_body_scale_changed();
void add_collision_exception(const CollisionObjectBullet *p_ignoreCollisionObject);
diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp
index f6ac40e001..738835b910 100644
--- a/modules/bullet/cone_twist_joint_bullet.cpp
+++ b/modules/bullet/cone_twist_joint_bullet.cpp
@@ -35,13 +35,23 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame)
- : JointBullet() {
+ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame) :
+ JointBullet() {
+
+ Transform scaled_AFrame(rbAFrame.scaled(rbA->get_body_scale()));
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
+
btTransform btFrameA;
- G_TO_B(rbAFrame, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
+
if (rbB) {
+
+ Transform scaled_BFrame(rbBFrame.scaled(rbB->get_body_scale()));
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(rbBFrame, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
+
coneConstraint = bulletnew(btConeTwistConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
} else {
coneConstraint = bulletnew(btConeTwistConstraint(*rbA->get_bt_rigid_body(), btFrameA));
diff --git a/modules/bullet/constraint_bullet.cpp b/modules/bullet/constraint_bullet.cpp
index 08fc36f274..505579ce9b 100644
--- a/modules/bullet/constraint_bullet.cpp
+++ b/modules/bullet/constraint_bullet.cpp
@@ -33,8 +33,9 @@
#include "collision_object_bullet.h"
#include "space_bullet.h"
-ConstraintBullet::ConstraintBullet()
- : space(NULL), constraint(NULL) {}
+ConstraintBullet::ConstraintBullet() :
+ space(NULL),
+ constraint(NULL) {}
void ConstraintBullet::setup(btTypedConstraint *p_constraint) {
constraint = p_constraint;
diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp
index 647396c24c..da09d4e12f 100644
--- a/modules/bullet/generic_6dof_joint_bullet.cpp
+++ b/modules/bullet/generic_6dof_joint_bullet.cpp
@@ -35,15 +35,23 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA)
- : JointBullet() {
+Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA) :
+ JointBullet() {
+
+ Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
+
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
btTransform btFrameA;
- G_TO_B(frameInA, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
if (rbB) {
+ Transform scaled_BFrame(frameInB.scaled(rbB->get_body_scale()));
+
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(frameInB, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
sixDOFConstraint = bulletnew(btGeneric6DofConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, useLinearReferenceFrameA));
} else {
@@ -109,10 +117,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
ERR_FAIL_INDEX(p_axis, 3);
switch (p_param) {
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
- sixDOFConstraint->getTranslationalLimitMotor()->m_lowerLimit[p_axis] = p_value;
+ limits_lower[0][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
- sixDOFConstraint->getTranslationalLimitMotor()->m_upperLimit[p_axis] = p_value;
+ limits_upper[0][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness = p_value;
@@ -124,10 +134,12 @@ void Generic6DOFJointBullet::set_param(Vector3::Axis p_axis, PhysicsServer::G6DO
sixDOFConstraint->getTranslationalLimitMotor()->m_damping = p_value;
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_loLimit = p_value;
+ limits_lower[1][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_hiLimit = p_value;
+ limits_upper[1][p_axis] = p_value;
+ set_flag(p_axis, PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT, flags[p_axis][p_param]); // Reload bullet parameter
break;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness = p_value;
@@ -159,9 +171,9 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
ERR_FAIL_INDEX_V(p_axis, 3, 0.);
switch (p_param) {
case PhysicsServer::G6DOF_JOINT_LINEAR_LOWER_LIMIT:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_lowerLimit[p_axis];
+ return limits_lower[0][p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_UPPER_LIMIT:
- return sixDOFConstraint->getTranslationalLimitMotor()->m_upperLimit[p_axis];
+ return limits_upper[0][p_axis];
case PhysicsServer::G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS:
return sixDOFConstraint->getTranslationalLimitMotor()->m_limitSoftness;
case PhysicsServer::G6DOF_JOINT_LINEAR_RESTITUTION:
@@ -169,9 +181,9 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
case PhysicsServer::G6DOF_JOINT_LINEAR_DAMPING:
return sixDOFConstraint->getTranslationalLimitMotor()->m_damping;
case PhysicsServer::G6DOF_JOINT_ANGULAR_LOWER_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_loLimit;
+ return limits_lower[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_UPPER_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_hiLimit;
+ return limits_upper[1][p_axis];
case PhysicsServer::G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS:
return sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_limitSoftness;
case PhysicsServer::G6DOF_JOINT_ANGULAR_DAMPING:
@@ -194,48 +206,35 @@ real_t Generic6DOFJointBullet::get_param(Vector3::Axis p_axis, PhysicsServer::G6
void Generic6DOFJointBullet::set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value) {
ERR_FAIL_INDEX(p_axis, 3);
+
+ flags[p_axis][p_flag] = p_value;
+
switch (p_flag) {
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
- if (p_value) {
- if (!get_flag(p_axis, p_flag)) // avoid overwrite, if limited
- sixDOFConstraint->setLimit(p_axis, 0, 0); // Limited
+ if (flags[p_axis][p_flag]) {
+ sixDOFConstraint->setLimit(p_axis, limits_lower[0][p_axis], limits_upper[0][p_axis]);
} else {
- if (get_flag(p_axis, p_flag)) // avoid overwrite, if free
- sixDOFConstraint->setLimit(p_axis, 0, -1); // Free
+ sixDOFConstraint->setLimit(p_axis, 0, -1); // Free
}
break;
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT: {
- int angularAxis = 3 + p_axis;
- if (p_value) {
- if (!get_flag(p_axis, p_flag)) // avoid overwrite, if Limited
- sixDOFConstraint->setLimit(angularAxis, 0, 0); // Limited
+ case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
+ if (flags[p_axis][p_flag]) {
+ sixDOFConstraint->setLimit(p_axis + 3, limits_lower[1][p_axis], limits_upper[1][p_axis]);
} else {
- if (get_flag(p_axis, p_flag)) // avoid overwrite, if free
- sixDOFConstraint->setLimit(angularAxis, 0, -1); // Free
+ sixDOFConstraint->setLimit(p_axis + 3, 0, -1); // Free
}
break;
- }
case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
- //sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] = p_value;
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = p_value;
+ sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor = flags[p_axis][p_flag];
break;
default:
WARN_PRINT("This flag is not supported by Bullet engine");
+ return;
}
}
bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const {
ERR_FAIL_INDEX_V(p_axis, 3, false);
- switch (p_flag) {
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT:
- return sixDOFConstraint->getTranslationalLimitMotor()->isLimited(p_axis);
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT:
- return sixDOFConstraint->getRotationalLimitMotor(p_axis)->isLimited();
- case PhysicsServer::G6DOF_JOINT_FLAG_ENABLE_MOTOR:
- return //sixDOFConstraint->getTranslationalLimitMotor()->m_enableMotor[p_axis] &&
- sixDOFConstraint->getRotationalLimitMotor(p_axis)->m_enableMotor;
- default:
- WARN_PRINT("This flag is not supported by Bullet engine");
- return false;
- }
+
+ return flags[p_axis][p_flag];
}
diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h
index 0d47b823de..ba0ae08800 100644
--- a/modules/bullet/generic_6dof_joint_bullet.h
+++ b/modules/bullet/generic_6dof_joint_bullet.h
@@ -39,6 +39,11 @@ class RigidBodyBullet;
class Generic6DOFJointBullet : public JointBullet {
class btGeneric6DofConstraint *sixDOFConstraint;
+ // First is linear second is angular
+ Vector3 limits_lower[2];
+ Vector3 limits_upper[2];
+ bool flags[3][PhysicsServer::G6DOF_JOINT_FLAG_MAX];
+
public:
Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB, bool useLinearReferenceFrameA);
diff --git a/modules/bullet/godot_collision_configuration.cpp b/modules/bullet/godot_collision_configuration.cpp
index 4e4228cc48..136fb2ee74 100644
--- a/modules/bullet/godot_collision_configuration.cpp
+++ b/modules/bullet/godot_collision_configuration.cpp
@@ -34,8 +34,8 @@
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#include "godot_ray_world_algorithm.h"
-GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo)
- : btDefaultCollisionConfiguration(constructionInfo) {
+GodotCollisionConfiguration::GodotCollisionConfiguration(const btDiscreteDynamicsWorld *world, const btDefaultCollisionConstructionInfo &constructionInfo) :
+ btDefaultCollisionConfiguration(constructionInfo) {
void *mem = NULL;
diff --git a/modules/bullet/godot_collision_dispatcher.cpp b/modules/bullet/godot_collision_dispatcher.cpp
index ea75e4eef4..e0ca29a8f3 100644
--- a/modules/bullet/godot_collision_dispatcher.cpp
+++ b/modules/bullet/godot_collision_dispatcher.cpp
@@ -34,8 +34,8 @@
const int GodotCollisionDispatcher::CASTED_TYPE_AREA = static_cast<int>(CollisionObjectBullet::TYPE_AREA);
-GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration)
- : btCollisionDispatcher(collisionConfiguration) {}
+GodotCollisionDispatcher::GodotCollisionDispatcher(btCollisionConfiguration *collisionConfiguration) :
+ btCollisionDispatcher(collisionConfiguration) {}
bool GodotCollisionDispatcher::needsCollision(const btCollisionObject *body0, const btCollisionObject *body1) {
if (body0->getUserIndex() == CASTED_TYPE_AREA || body1->getUserIndex() == CASTED_TYPE_AREA) {
diff --git a/modules/bullet/godot_motion_state.h b/modules/bullet/godot_motion_state.h
index 5111807394..62ea472446 100644
--- a/modules/bullet/godot_motion_state.h
+++ b/modules/bullet/godot_motion_state.h
@@ -51,10 +51,10 @@ class GodotMotionState : public btMotionState {
RigidBodyBullet *owner;
public:
- GodotMotionState(RigidBodyBullet *p_owner)
- : bodyKinematicWorldTransf(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
- bodyCurrentWorldTransform(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
- owner(p_owner) {}
+ GodotMotionState(RigidBodyBullet *p_owner) :
+ bodyKinematicWorldTransf(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
+ bodyCurrentWorldTransform(btMatrix3x3(1., 0., 0., 0., 1., 0., 0., 0., 1.), btVector3(0., 0., 0.)),
+ owner(p_owner) {}
/// IMPORTANT DON'T USE THIS FUNCTION TO KNOW THE CURRENT BODY TRANSFORM
/// This class is used internally by Bullet
diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp
index 98daf8398e..ba13903548 100644
--- a/modules/bullet/godot_ray_world_algorithm.cpp
+++ b/modules/bullet/godot_ray_world_algorithm.cpp
@@ -34,18 +34,18 @@
#include "btRayShape.h"
#include "collision_object_bullet.h"
-GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world)
- : m_world(world) {}
-
-GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDynamicsWorld *world)
- : m_world(world) {}
-
-GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped)
- : btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap),
- m_manifoldPtr(mf),
- m_ownManifold(false),
- m_world(world),
- m_isSwapped(isSwapped) {}
+GodotRayWorldAlgorithm::CreateFunc::CreateFunc(const btDiscreteDynamicsWorld *world) :
+ m_world(world) {}
+
+GodotRayWorldAlgorithm::SwappedCreateFunc::SwappedCreateFunc(const btDiscreteDynamicsWorld *world) :
+ m_world(world) {}
+
+GodotRayWorldAlgorithm::GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped) :
+ btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap),
+ m_manifoldPtr(mf),
+ m_ownManifold(false),
+ m_world(world),
+ m_isSwapped(isSwapped) {}
GodotRayWorldAlgorithm::~GodotRayWorldAlgorithm() {
if (m_ownManifold && m_manifoldPtr) {
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index ba5142676b..9d2fb1fce4 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -50,12 +50,21 @@ struct GodotFilterCallback : public btOverlapFilterCallback {
struct GodotClosestRayResultCallback : public btCollisionWorld::ClosestRayResultCallback {
const Set<RID> *m_exclude;
bool m_pickRay;
+ int m_shapeId;
public:
- GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude)
- : btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld), m_exclude(p_exclude), m_pickRay(false) {}
+ GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude) :
+ btCollisionWorld::ClosestRayResultCallback(rayFromWorld, rayToWorld),
+ m_exclude(p_exclude),
+ m_pickRay(false),
+ m_shapeId(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
+
+ virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult &rayResult, bool normalInWorldSpace) {
+ m_shapeId = rayResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
+ return btCollisionWorld::ClosestRayResultCallback::addSingleResult(rayResult, normalInWorldSpace);
+ }
};
// store all colliding object
@@ -66,8 +75,11 @@ public:
int count;
const Set<RID> *m_exclude;
- GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude)
- : m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), count(0) {}
+ GodotAllConvexResultCallback(PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
+ m_results(p_results),
+ m_exclude(p_exclude),
+ m_resultMax(p_resultMax),
+ count(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -79,8 +91,10 @@ public:
const RigidBodyBullet *m_self_object;
const bool m_ignore_areas;
- GodotKinClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const RigidBodyBullet *p_self_object, bool p_ignore_areas)
- : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_self_object(p_self_object), m_ignore_areas(p_ignore_areas) {}
+ GodotKinClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const RigidBodyBullet *p_self_object, bool p_ignore_areas) :
+ btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
+ m_self_object(p_self_object),
+ m_ignore_areas(p_ignore_areas) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
};
@@ -90,8 +104,9 @@ public:
const Set<RID> *m_exclude;
int m_shapeId;
- GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude)
- : btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_exclude(p_exclude) {}
+ GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude) :
+ btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
+ m_exclude(p_exclude) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -106,8 +121,12 @@ public:
int m_count;
const Set<RID> *m_exclude;
- GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude)
- : m_self_object(p_self_object), m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), m_count(0) {}
+ GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude) :
+ m_self_object(p_self_object),
+ m_results(p_results),
+ m_exclude(p_exclude),
+ m_resultMax(p_resultMax),
+ m_count(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -123,8 +142,12 @@ public:
int m_count;
const Set<RID> *m_exclude;
- GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude)
- : m_self_object(p_self_object), m_results(p_results), m_exclude(p_exclude), m_resultMax(p_resultMax), m_count(0) {}
+ GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude) :
+ m_self_object(p_self_object),
+ m_results(p_results),
+ m_exclude(p_exclude),
+ m_resultMax(p_resultMax),
+ m_count(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -141,8 +164,12 @@ public:
btVector3 m_rest_info_bt_point;
const Set<RID> *m_exclude;
- GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude)
- : m_self_object(p_self_object), m_result(p_result), m_exclude(p_exclude), m_collided(false), m_min_distance(0) {}
+ GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState::ShapeRestInfo *p_result, const Set<RID> *p_exclude) :
+ m_self_object(p_self_object),
+ m_result(p_result),
+ m_exclude(p_exclude),
+ m_collided(false),
+ m_min_distance(0) {}
virtual bool needsCollision(btBroadphaseProxy *proxy0) const;
@@ -158,12 +185,12 @@ struct GodotDeepPenetrationContactResultCallback : public btManifoldResult {
btScalar m_most_penetrated_distance;
- GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
- : btManifoldResult(body0Wrap, body1Wrap),
- m_pointCollisionObject(NULL),
- m_penetration_distance(0),
- m_other_compound_shape_index(0),
- m_most_penetrated_distance(1e20) {}
+ GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap) :
+ btManifoldResult(body0Wrap, body1Wrap),
+ m_pointCollisionObject(NULL),
+ m_penetration_distance(0),
+ m_other_compound_shape_index(0),
+ m_most_penetrated_distance(1e20) {}
void reset() {
m_pointCollisionObject = NULL;
diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp
index bb70babd99..ee0d6707d6 100644
--- a/modules/bullet/hinge_joint_bullet.cpp
+++ b/modules/bullet/hinge_joint_bullet.cpp
@@ -35,14 +35,22 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB)
- : JointBullet() {
+HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) :
+ JointBullet() {
+
+ Transform scaled_AFrame(frameA.scaled(rbA->get_body_scale()));
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
+
btTransform btFrameA;
- G_TO_B(frameA, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
if (rbB) {
+
+ Transform scaled_BFrame(frameB.scaled(rbB->get_body_scale()));
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(frameB, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB));
} else {
@@ -53,19 +61,19 @@ HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, c
setup(hingeConstraint);
}
-HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB)
- : JointBullet() {
+HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB) :
+ JointBullet() {
btVector3 btPivotA;
btVector3 btAxisA;
- G_TO_B(pivotInA, btPivotA);
- G_TO_B(axisInA, btAxisA);
+ G_TO_B(pivotInA * rbA->get_body_scale(), btPivotA);
+ G_TO_B(axisInA * rbA->get_body_scale(), btAxisA);
if (rbB) {
btVector3 btPivotB;
btVector3 btAxisB;
- G_TO_B(pivotInB, btPivotB);
- G_TO_B(axisInB, btAxisB);
+ G_TO_B(pivotInB * rbB->get_body_scale(), btPivotB);
+ G_TO_B(axisInB * rbB->get_body_scale(), btAxisB);
hingeConstraint = bulletnew(btHingeConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btPivotA, btPivotB, btAxisA, btAxisB));
} else {
diff --git a/modules/bullet/joint_bullet.cpp b/modules/bullet/joint_bullet.cpp
index be544f89bf..c8d91aa257 100644
--- a/modules/bullet/joint_bullet.cpp
+++ b/modules/bullet/joint_bullet.cpp
@@ -32,7 +32,7 @@
#include "joint_bullet.h"
#include "space_bullet.h"
-JointBullet::JointBullet()
- : ConstraintBullet() {}
+JointBullet::JointBullet() :
+ ConstraintBullet() {}
JointBullet::~JointBullet() {}
diff --git a/modules/bullet/pin_joint_bullet.cpp b/modules/bullet/pin_joint_bullet.cpp
index cd9e9a4557..665e825967 100644
--- a/modules/bullet/pin_joint_bullet.cpp
+++ b/modules/bullet/pin_joint_bullet.cpp
@@ -34,14 +34,14 @@
#include "bullet_types_converter.h"
#include "rigid_body_bullet.h"
-PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b)
- : JointBullet() {
+PinJointBullet::PinJointBullet(RigidBodyBullet *p_body_a, const Vector3 &p_pos_a, RigidBodyBullet *p_body_b, const Vector3 &p_pos_b) :
+ JointBullet() {
if (p_body_b) {
btVector3 btPivotA;
btVector3 btPivotB;
- G_TO_B(p_pos_a, btPivotA);
- G_TO_B(p_pos_b, btPivotB);
+ G_TO_B(p_pos_a * p_body_a->get_body_scale(), btPivotA);
+ G_TO_B(p_pos_b * p_body_b->get_body_scale(), btPivotB);
p2pConstraint = bulletnew(btPoint2PointConstraint(*p_body_a->get_bt_rigid_body(),
*p_body_b->get_bt_rigid_body(),
btPivotA,
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index f5ab8221e3..669b2c3f0c 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -176,9 +176,9 @@ PhysicsDirectSpaceState *BulletPhysicsDirectBodyState::get_space_state() {
return body->get_space()->get_direct_state();
}
-RigidBodyBullet::KinematicUtilities::KinematicUtilities(RigidBodyBullet *p_owner)
- : owner(p_owner),
- safe_margin(0.001) {
+RigidBodyBullet::KinematicUtilities::KinematicUtilities(RigidBodyBullet *p_owner) :
+ owner(p_owner),
+ safe_margin(0.001) {
}
RigidBodyBullet::KinematicUtilities::~KinematicUtilities() {
@@ -198,6 +198,8 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
const CollisionObjectBullet::ShapeWrapper *shape_wrapper;
+ btVector3 owner_body_scale(owner->get_bt_body_scale());
+
for (int i = shapes_count - 1; 0 <= i; --i) {
shape_wrapper = &shapes_wrappers[i];
if (!shape_wrapper->active) {
@@ -210,28 +212,29 @@ void RigidBodyBullet::KinematicUtilities::copyAllOwnerShapes() {
switch (shape_wrapper->shape->get_type()) {
case PhysicsServer::SHAPE_SPHERE: {
SphereShapeBullet *sphere = static_cast<SphereShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_sphere(sphere->get_radius() * owner->body_scale[0] + safe_margin);
+ kin_shape_ref = ShapeBullet::create_shape_sphere(sphere->get_radius() * owner_body_scale[0] + safe_margin);
break;
}
case PhysicsServer::SHAPE_BOX: {
BoxShapeBullet *box = static_cast<BoxShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_box((box->get_half_extents() * owner->body_scale) + btVector3(safe_margin, safe_margin, safe_margin));
+ kin_shape_ref = ShapeBullet::create_shape_box((box->get_half_extents() * owner_body_scale) + btVector3(safe_margin, safe_margin, safe_margin));
break;
}
case PhysicsServer::SHAPE_CAPSULE: {
CapsuleShapeBullet *capsule = static_cast<CapsuleShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_capsule(capsule->get_radius() * owner->body_scale[0] + safe_margin, capsule->get_height() * owner->body_scale[1] + safe_margin);
+
+ kin_shape_ref = ShapeBullet::create_shape_capsule(capsule->get_radius() * owner_body_scale[0] + safe_margin, capsule->get_height() * owner_body_scale[1] + safe_margin);
break;
}
case PhysicsServer::SHAPE_CONVEX_POLYGON: {
ConvexPolygonShapeBullet *godot_convex = static_cast<ConvexPolygonShapeBullet *>(shape_wrapper->shape);
kin_shape_ref = ShapeBullet::create_shape_convex(godot_convex->vertices);
- kin_shape_ref->setLocalScaling(owner->body_scale + btVector3(safe_margin, safe_margin, safe_margin));
+ kin_shape_ref->setLocalScaling(owner_body_scale + btVector3(safe_margin, safe_margin, safe_margin));
break;
}
case PhysicsServer::SHAPE_RAY: {
RayShapeBullet *godot_ray = static_cast<RayShapeBullet *>(shape_wrapper->shape);
- kin_shape_ref = ShapeBullet::create_shape_ray(godot_ray->length * owner->body_scale[1] + safe_margin);
+ kin_shape_ref = ShapeBullet::create_shape_ray(godot_ray->length * owner_body_scale[1] + safe_margin);
break;
}
default:
@@ -250,22 +253,23 @@ void RigidBodyBullet::KinematicUtilities::just_delete_shapes(int new_size) {
shapes.resize(new_size);
}
-RigidBodyBullet::RigidBodyBullet()
- : RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
- kinematic_utilities(NULL),
- gravity_scale(1),
- mass(1),
- linearDamp(0),
- angularDamp(0),
- can_sleep(true),
- force_integration_callback(NULL),
- isTransformChanged(false),
- maxCollisionsDetection(0),
- collisionsCount(0),
- maxAreasWhereIam(10),
- areaWhereIamCount(0),
- countGravityPointSpaces(0),
- isScratchedSpaceOverrideModificator(false) {
+RigidBodyBullet::RigidBodyBullet() :
+ RigidCollisionObjectBullet(CollisionObjectBullet::TYPE_RIGID_BODY),
+ kinematic_utilities(NULL),
+ locked_axis(0),
+ gravity_scale(1),
+ mass(1),
+ linearDamp(0),
+ angularDamp(0),
+ can_sleep(true),
+ force_integration_callback(NULL),
+ isTransformChanged(false),
+ maxCollisionsDetection(0),
+ collisionsCount(0),
+ maxAreasWhereIam(10),
+ areaWhereIamCount(0),
+ countGravityPointSpaces(0),
+ isScratchedSpaceOverrideModificator(false) {
godotMotionState = bulletnew(GodotMotionState(this));
@@ -277,7 +281,7 @@ RigidBodyBullet::RigidBodyBullet()
setupBulletCollisionObject(btBody);
set_mode(PhysicsServer::BODY_MODE_RIGID);
- set_axis_lock(PhysicsServer::BODY_AXIS_LOCK_DISABLED);
+ reload_axis_lock();
areasWhereIam.resize(maxAreasWhereIam);
for (int i = areasWhereIam.size() - 1; 0 <= i; --i) {
@@ -498,25 +502,25 @@ void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) {
switch (p_mode) {
case PhysicsServer::BODY_MODE_KINEMATIC:
mode = PhysicsServer::BODY_MODE_KINEMATIC;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0);
init_kinematic_utilities();
break;
case PhysicsServer::BODY_MODE_STATIC:
mode = PhysicsServer::BODY_MODE_STATIC;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0);
break;
case PhysicsServer::BODY_MODE_RIGID: {
mode = PhysicsServer::BODY_MODE_RIGID;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0 == mass ? 1 : mass);
scratch_space_override_modificator();
break;
}
case PhysicsServer::BODY_MODE_CHARACTER: {
mode = PhysicsServer::BODY_MODE_CHARACTER;
- set_axis_lock(axis_lock); // Reload axis lock
+ reload_axis_lock();
_internal_set_mass(0 == mass ? 1 : mass);
scratch_space_override_modificator();
break;
@@ -655,39 +659,28 @@ Vector3 RigidBodyBullet::get_applied_torque() const {
return gTotTorq;
}
-void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxisLock p_lock) {
- axis_lock = p_lock;
-
- if (PhysicsServer::BODY_AXIS_LOCK_DISABLED == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 1., 1.));
- btBody->setAngularFactor(btVector3(1., 1., 1.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_X == axis_lock) {
- btBody->setLinearFactor(btVector3(0., 1., 1.));
- btBody->setAngularFactor(btVector3(1., 0., 0.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_Y == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 0., 1.));
- btBody->setAngularFactor(btVector3(0., 1., 0.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_Z == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 1., 0.));
- btBody->setAngularFactor(btVector3(0., 0., 1.));
+void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock) {
+ if (lock) {
+ locked_axis |= p_axis;
+ } else {
+ locked_axis &= ~p_axis;
}
- if (PhysicsServer::BODY_MODE_CHARACTER == mode) {
- /// When character lock angular
- btBody->setAngularFactor(btVector3(0., 0., 0.));
- }
+ reload_axis_lock();
+}
+
+bool RigidBodyBullet::is_axis_locked(PhysicsServer::BodyAxis p_axis) const {
+ return locked_axis & p_axis;
}
-PhysicsServer::BodyAxisLock RigidBodyBullet::get_axis_lock() const {
- btVector3 vec = btBody->getLinearFactor();
- if (0. == vec.x()) {
- return PhysicsServer::BODY_AXIS_LOCK_X;
- } else if (0. == vec.y()) {
- return PhysicsServer::BODY_AXIS_LOCK_Y;
- } else if (0. == vec.z()) {
- return PhysicsServer::BODY_AXIS_LOCK_Z;
+void RigidBodyBullet::reload_axis_lock() {
+
+ btBody->setLinearFactor(btVector3(!is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_X), !is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Y), !is_axis_locked(PhysicsServer::BODY_AXIS_LINEAR_Z)));
+ if (PhysicsServer::BODY_MODE_CHARACTER == mode) {
+ /// When character angular is always locked
+ btBody->setAngularFactor(btVector3(0., 0., 0.));
} else {
- return PhysicsServer::BODY_AXIS_LOCK_DISABLED;
+ btBody->setAngularFactor(btVector3(!is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_X), !is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Y), !is_axis_locked(PhysicsServer::BODY_AXIS_ANGULAR_Z)));
}
}
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index ab3c3e58b2..c0eb148e24 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -156,8 +156,8 @@ public:
class btConvexShape *shape;
btTransform transform;
- KinematicShape()
- : shape(NULL) {}
+ KinematicShape() :
+ shape(NULL) {}
const bool is_active() const { return shape; }
};
@@ -184,9 +184,9 @@ private:
KinematicUtilities *kinematic_utilities;
PhysicsServer::BodyMode mode;
- PhysicsServer::BodyAxisLock axis_lock;
GodotMotionState *godotMotionState;
btRigidBody *btBody;
+ uint16_t locked_axis;
real_t mass;
real_t gravity_scale;
real_t linearDamp;
@@ -269,8 +269,9 @@ public:
void set_applied_torque(const Vector3 &p_torque);
Vector3 get_applied_torque() const;
- void set_axis_lock(PhysicsServer::BodyAxisLock p_lock);
- PhysicsServer::BodyAxisLock get_axis_lock() const;
+ void set_axis_lock(PhysicsServer::BodyAxis p_axis, bool lock);
+ bool is_axis_locked(PhysicsServer::BodyAxis p_axis) const;
+ void reload_axis_lock();
/// Doc:
/// http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Anti_tunneling_by_Motion_Clamping
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index f51af93a31..572a3b4476 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -130,8 +130,8 @@ btRayShape *ShapeBullet::create_shape_ray(real_t p_length) {
/* PLANE */
-PlaneShapeBullet::PlaneShapeBullet()
- : ShapeBullet() {}
+PlaneShapeBullet::PlaneShapeBullet() :
+ ShapeBullet() {}
void PlaneShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -158,8 +158,8 @@ btCollisionShape *PlaneShapeBullet::create_bt_shape() {
/* Sphere */
-SphereShapeBullet::SphereShapeBullet()
- : ShapeBullet() {}
+SphereShapeBullet::SphereShapeBullet() :
+ ShapeBullet() {}
void SphereShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -183,8 +183,8 @@ btCollisionShape *SphereShapeBullet::create_bt_shape() {
}
/* Box */
-BoxShapeBullet::BoxShapeBullet()
- : ShapeBullet() {}
+BoxShapeBullet::BoxShapeBullet() :
+ ShapeBullet() {}
void BoxShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -211,8 +211,8 @@ btCollisionShape *BoxShapeBullet::create_bt_shape() {
/* Capsule */
-CapsuleShapeBullet::CapsuleShapeBullet()
- : ShapeBullet() {}
+CapsuleShapeBullet::CapsuleShapeBullet() :
+ ShapeBullet() {}
void CapsuleShapeBullet::set_data(const Variant &p_data) {
Dictionary d = p_data;
@@ -244,8 +244,8 @@ btCollisionShape *CapsuleShapeBullet::create_bt_shape() {
/* Convex polygon */
-ConvexPolygonShapeBullet::ConvexPolygonShapeBullet()
- : ShapeBullet() {}
+ConvexPolygonShapeBullet::ConvexPolygonShapeBullet() :
+ ShapeBullet() {}
void ConvexPolygonShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
@@ -286,8 +286,9 @@ btCollisionShape *ConvexPolygonShapeBullet::create_bt_shape() {
/* Concave polygon */
-ConcavePolygonShapeBullet::ConcavePolygonShapeBullet()
- : ShapeBullet(), meshShape(NULL) {}
+ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() :
+ ShapeBullet(),
+ meshShape(NULL) {}
ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() {
if (meshShape) {
@@ -359,8 +360,8 @@ btCollisionShape *ConcavePolygonShapeBullet::create_bt_shape() {
/* Height map shape */
-HeightMapShapeBullet::HeightMapShapeBullet()
- : ShapeBullet() {}
+HeightMapShapeBullet::HeightMapShapeBullet() :
+ ShapeBullet() {}
void HeightMapShapeBullet::set_data(const Variant &p_data) {
ERR_FAIL_COND(p_data.get_type() != Variant::DICTIONARY);
@@ -411,8 +412,9 @@ btCollisionShape *HeightMapShapeBullet::create_bt_shape() {
}
/* Ray shape */
-RayShapeBullet::RayShapeBullet()
- : ShapeBullet(), length(1) {}
+RayShapeBullet::RayShapeBullet() :
+ ShapeBullet(),
+ length(1) {}
void RayShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp
index 2da65677f5..cfcd0b57f6 100644
--- a/modules/bullet/slider_joint_bullet.cpp
+++ b/modules/bullet/slider_joint_bullet.cpp
@@ -35,13 +35,22 @@
#include "bullet_utilities.h"
#include "rigid_body_bullet.h"
-SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB)
- : JointBullet() {
+SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) :
+ JointBullet() {
+
+ Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale()));
+ scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis);
+
btTransform btFrameA;
- G_TO_B(frameInA, btFrameA);
+ G_TO_B(scaled_AFrame, btFrameA);
+
if (rbB) {
+
+ Transform scaled_BFrame(frameInB.scaled(rbB->get_body_scale()));
+ scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis);
+
btTransform btFrameB;
- G_TO_B(frameInB, btFrameB);
+ G_TO_B(scaled_BFrame, btFrameB);
sliderConstraint = bulletnew(btSliderConstraint(*rbA->get_bt_rigid_body(), *rbB->get_bt_rigid_body(), btFrameA, btFrameB, true));
} else {
diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp
index 64ef7bfad2..ef5c8cac6f 100644
--- a/modules/bullet/soft_body_bullet.cpp
+++ b/modules/bullet/soft_body_bullet.cpp
@@ -36,8 +36,18 @@
#include "scene/3d/immediate_geometry.h"
-SoftBodyBullet::SoftBodyBullet()
- : CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY), mass(1), simulation_precision(5), stiffness(0.5f), pressure_coefficient(50), damping_coefficient(0.005), drag_coefficient(0.005), bt_soft_body(NULL), soft_shape_type(SOFT_SHAPETYPE_NONE), isScratched(false), soft_body_shape_data(NULL) {
+SoftBodyBullet::SoftBodyBullet() :
+ CollisionObjectBullet(CollisionObjectBullet::TYPE_SOFT_BODY),
+ mass(1),
+ simulation_precision(5),
+ stiffness(0.5f),
+ pressure_coefficient(50),
+ damping_coefficient(0.005),
+ drag_coefficient(0.005),
+ bt_soft_body(NULL),
+ soft_shape_type(SOFT_SHAPETYPE_NONE),
+ isScratched(false),
+ soft_body_shape_data(NULL) {
test_geometry = memnew(ImmediateGeometry);
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index d8c8cab17a..3ce4b294db 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -50,8 +50,9 @@
#include "ustring.h"
#include <assert.h>
-BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space)
- : PhysicsDirectSpaceState(), space(p_space) {}
+BulletPhysicsDirectSpaceState::BulletPhysicsDirectSpaceState(SpaceBullet *p_space) :
+ PhysicsDirectSpaceState(),
+ space(p_space) {}
int BulletPhysicsDirectSpaceState::intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set<RID> &p_exclude, uint32_t p_collision_mask) {
@@ -96,7 +97,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V
B_TO_G(btResult.m_hitNormalWorld.normalize(), r_result.normal);
CollisionObjectBullet *gObj = static_cast<CollisionObjectBullet *>(btResult.m_collisionObject->getUserPointer());
if (gObj) {
- r_result.shape = 0;
+ r_result.shape = btResult.m_shapeId;
r_result.rid = gObj->get_self();
r_result.collider_id = gObj->get_instance_id();
r_result.collider = 0 == r_result.collider_id ? NULL : ObjectDB::get_instance(r_result.collider_id);
@@ -330,18 +331,18 @@ Vector3 BulletPhysicsDirectSpaceState::get_closest_point_to_object_volume(RID p_
}
}
-SpaceBullet::SpaceBullet(bool p_create_soft_world)
- : broadphase(NULL),
- dispatcher(NULL),
- solver(NULL),
- collisionConfiguration(NULL),
- dynamicsWorld(NULL),
- soft_body_world_info(NULL),
- ghostPairCallback(NULL),
- godotFilterCallback(NULL),
- gravityDirection(0, -1, 0),
- gravityMagnitude(10),
- contactDebugCount(0) {
+SpaceBullet::SpaceBullet(bool p_create_soft_world) :
+ broadphase(NULL),
+ dispatcher(NULL),
+ solver(NULL),
+ collisionConfiguration(NULL),
+ dynamicsWorld(NULL),
+ soft_body_world_info(NULL),
+ ghostPairCallback(NULL),
+ godotFilterCallback(NULL),
+ gravityDirection(0, -1, 0),
+ gravityMagnitude(10),
+ contactDebugCount(0) {
create_empty_world(p_create_soft_world);
direct_access = memnew(BulletPhysicsDirectSpaceState(this));
@@ -939,14 +940,14 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
r_result->collider_shape = r_recover_result.other_compound_shape_index;
r_result->collision_local_shape = r_recover_result.local_shape_most_recovered;
-//{ /// Add manifold point to manage collisions
-// btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid);
-// btManifoldPoint manifoldPoint(result_callabck.m_pointWorld, result_callabck.m_pointWorld, result_callabck.m_pointNormalWorld, result_callabck.m_penetration_distance);
-// manifoldPoint.m_index0 = r_result->collision_local_shape;
-// manifoldPoint.m_index1 = r_result->collider_shape;
-// manifold->addManifoldPoint(manifoldPoint);
-// p_body->get_kinematic_utilities()->m_generatedManifold.push_back(manifold);
-//}
+ //{ /// Add manifold point to manage collisions
+ // btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid);
+ // btManifoldPoint manifoldPoint(result_callabck.m_pointWorld, result_callabck.m_pointWorld, result_callabck.m_pointNormalWorld, result_callabck.m_penetration_distance);
+ // manifoldPoint.m_index0 = r_result->collision_local_shape;
+ // manifoldPoint.m_index1 = r_result->collider_shape;
+ // manifold->addManifoldPoint(manifoldPoint);
+ // p_body->get_kinematic_utilities()->m_generatedManifold.push_back(manifold);
+ //}
#if debug_test_motion
Vector3 sup_line2;
@@ -979,10 +980,10 @@ public:
Vector<btCollisionObject *> result_collision_objects;
public:
- RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask)
- : self_collision_object(p_self_collision_object),
- collision_layer(p_collision_layer),
- collision_mask(p_collision_mask) {}
+ RecoverPenetrationBroadPhaseCallback(const btCollisionObject *p_self_collision_object, uint32_t p_collision_layer, uint32_t p_collision_mask) :
+ self_collision_object(p_self_collision_object),
+ collision_layer(p_collision_layer),
+ collision_mask(p_collision_mask) {}
virtual ~RecoverPenetrationBroadPhaseCallback() {}
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index 99bcfb8563..e5267c01a9 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -185,8 +185,8 @@ private:
const btCollisionObject *other_collision_object;
int local_shape_most_recovered;
- RecoverResult()
- : hasPenetration(false) {}
+ RecoverResult() :
+ hasPenetration(false) {}
};
bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL);
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index ce485956b4..396bebf0ea 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -386,7 +386,7 @@ int NetworkedMultiplayerENet::get_available_packet_count() const {
return incoming_packets.size();
}
-Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
+Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE);
@@ -480,7 +480,7 @@ int NetworkedMultiplayerENet::get_max_packet_size() const {
return 1 << 24; //anything is good
}
-void NetworkedMultiplayerENet::_pop_current_packet() const {
+void NetworkedMultiplayerENet::_pop_current_packet() {
if (current_packet.packet) {
enet_packet_destroy(current_packet.packet);
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 81d517147d..d7bc5c7849 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -86,12 +86,12 @@ private:
CompressionMode compression_mode;
- mutable List<Packet> incoming_packets;
+ List<Packet> incoming_packets;
- mutable Packet current_packet;
+ Packet current_packet;
uint32_t _gen_unique_id() const;
- void _pop_current_packet() const;
+ void _pop_current_packet();
Vector<uint8_t> src_compressor_mem;
Vector<uint8_t> dst_compressor_mem;
@@ -123,7 +123,7 @@ public:
virtual bool is_server() const;
virtual int get_available_packet_count() const;
- virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< buffer is GONE after next get_packet
+ virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size); ///< buffer is GONE after next get_packet
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
virtual int get_max_packet_size() const;
diff --git a/modules/etc/SCsub b/modules/etc/SCsub
index 9c3e703f11..31d8f00ef3 100644
--- a/modules/etc/SCsub
+++ b/modules/etc/SCsub
@@ -34,7 +34,8 @@ env_etc.Append(CPPPATH=[thirdparty_dir])
env_etc.add_source_files(env.modules_sources, "*.cpp")
# upstream uses c++11
-env_etc.Append(CCFLAGS="-std=gnu++11")
+if (not env_etc.msvc):
+ env_etc.Append(CCFLAGS="-std=c++11")
# -ffast-math seems to be incompatible with ec2comp on recent versions of
# GCC and Clang
if '-ffast-math' in env_etc['CCFLAGS']:
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
index 9b0d1ebb31..29e4775e62 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp
@@ -219,7 +219,7 @@ extern "C" {
void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) {
Ref<ARVRInterfaceGDNative> new_interface;
new_interface.instance();
- new_interface->set_interface((godot_arvr_interface_gdnative * const)p_interface);
+ new_interface->set_interface((godot_arvr_interface_gdnative *const)p_interface);
ARVRServer::get_singleton()->add_interface(new_interface);
}
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 21c24fabd8..9c0041cbe0 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -144,7 +144,7 @@ bool GDNative::initialize() {
}
}
- Error err = OS::get_singleton()->open_dynamic_library(path, native_handle,true);
+ Error err = OS::get_singleton()->open_dynamic_library(path, native_handle, true);
if (err != OK) {
return false;
}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index bb260bdd1b..993cd0ece7 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -106,8 +106,8 @@ struct GDNativeCallRegistry {
return singleton;
}
- inline GDNativeCallRegistry()
- : native_calls() {}
+ inline GDNativeCallRegistry() :
+ native_calls() {}
Map<StringName, native_call_cb> native_calls;
diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp
index 39ca754dc7..7a65996036 100644
--- a/modules/gdnative/gdnative/basis.cpp
+++ b/modules/gdnative/gdnative/basis.cpp
@@ -221,7 +221,7 @@ godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godo
return raw_dest;
}
-godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b) {
+godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b) {
godot_basis raw_dest;
Basis *dest = (Basis *)&raw_dest;
const Basis *self = (const Basis *)p_self;
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 92a88e354b..8ff67b10b1 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -52,10 +52,6 @@ godot_object GDAPI *godot_global_get_singleton(char *p_name) {
return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name));
} // result shouldn't be freed
-void GDAPI *godot_get_stack_bottom() {
- return OS::get_singleton()->get_stack_bottom();
-}
-
// MethodBind API
godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) {
diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp
index 2d012c069f..c308e5973d 100644
--- a/modules/gdnative/gdnative/quat.cpp
+++ b/modules/gdnative/gdnative/quat.cpp
@@ -181,7 +181,7 @@ godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_q
return raw_dest;
}
-godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b) {
+godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b) {
godot_quat raw_dest;
Quat *dest = (Quat *)&raw_dest;
const Quat *self = (const Quat *)p_self;
diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp
index 7a5b29e0c4..7be08929b1 100644
--- a/modules/gdnative/gdnative/vector2.cpp
+++ b/modules/gdnative/gdnative/vector2.cpp
@@ -207,7 +207,7 @@ godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, cons
return raw_dest;
}
-godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b) {
+godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b) {
godot_vector2 raw_dest;
Vector2 *dest = (Vector2 *)&raw_dest;
const Vector2 *self = (const Vector2 *)p_self;
diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp
index 11ffb3320b..0027d236f2 100644
--- a/modules/gdnative/gdnative/vector3.cpp
+++ b/modules/gdnative/gdnative/vector3.cpp
@@ -224,7 +224,7 @@ godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, cons
return raw_dest;
}
-godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b) {
+godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b) {
godot_vector3 raw_dest;
Vector3 *dest = (Vector3 *)&raw_dest;
Vector3 *self = (Vector3 *)p_self;
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 488ed93206..06c6e9f410 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -387,7 +387,7 @@
]
},
{
- "name": "godot_vector2_operator_substract",
+ "name": "godot_vector2_operator_subtract",
"return_type": "godot_vector2",
"arguments": [
["const godot_vector2 *", "p_self"],
@@ -663,7 +663,7 @@
]
},
{
- "name": "godot_quat_operator_substract",
+ "name": "godot_quat_operator_subtract",
"return_type": "godot_quat",
"arguments": [
["const godot_quat *", "p_self"],
@@ -907,7 +907,7 @@
]
},
{
- "name": "godot_basis_operator_substract",
+ "name": "godot_basis_operator_subtract",
"return_type": "godot_basis",
"arguments": [
["const godot_basis *", "p_self"],
@@ -1142,7 +1142,7 @@
]
},
{
- "name": "godot_vector3_operator_substract",
+ "name": "godot_vector3_operator_subtract",
"return_type": "godot_vector3",
"arguments": [
["const godot_vector3 *", "p_self"],
@@ -5569,6 +5569,12 @@
]
},
{
+ "name": "godot_get_global_constants",
+ "return_type": "godot_dictionary",
+ "arguments": [
+ ]
+ },
+ {
"name": "godot_register_native_call_type",
"return_type": "void",
"arguments": [
diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h
index 49ca765a01..4898eab24c 100644
--- a/modules/gdnative/include/gdnative/basis.h
+++ b/modules/gdnative/include/gdnative/basis.h
@@ -111,7 +111,7 @@ godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const god
godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b);
-godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b);
+godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b);
godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b);
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 6e69d43469..9d7829a51f 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -115,8 +115,6 @@ typedef enum {
GODOT_ERR_HELP, ///< user requested help!!
GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
- GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though
- GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above
} godot_error;
////// bool
@@ -214,10 +212,6 @@ void GDAPI godot_object_destroy(godot_object *p_o);
godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed
-////// OS API
-
-void GDAPI *godot_get_stack_bottom(); // returns stack bottom of the main thread
-
////// MethodBind API
typedef struct {
diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h
index acae6e3e90..2be9d8849d 100644
--- a/modules/gdnative/include/gdnative/quat.h
+++ b/modules/gdnative/include/gdnative/quat.h
@@ -98,7 +98,7 @@ godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const go
godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b);
-godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b);
+godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b);
godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b);
diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h
index 07105abaf2..4d1117e3aa 100644
--- a/modules/gdnative/include/gdnative/vector2.h
+++ b/modules/gdnative/include/gdnative/vector2.h
@@ -106,7 +106,7 @@ godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const god
godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b);
-godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b);
+godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b);
godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b);
diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h
index 3ed23778ec..135a13acc8 100644
--- a/modules/gdnative/include/gdnative/vector3.h
+++ b/modules/gdnative/include/gdnative/vector3.h
@@ -117,7 +117,7 @@ godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const god
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b);
-godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b);
+godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b);
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b);
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index f9d699fb59..653445c2db 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -468,8 +468,6 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
return source;
}
-//
-
#endif
/*
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index c2c7c27f25..965de062e3 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -437,11 +437,11 @@ NativeScript::~NativeScript() {
#endif
}
-//
-//
-// ScriptInstance stuff
-//
-//
+ //
+ //
+ // ScriptInstance stuff
+ //
+ //
#define GET_SCRIPT_DESC() script->get_script_desc()
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index f0f14e2f30..30fa400cb0 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -76,12 +76,12 @@ struct NativeScriptDesc {
bool is_tool;
- inline NativeScriptDesc()
- : methods(),
- properties(),
- signals_(),
- base(),
- base_native_type() {
+ inline NativeScriptDesc() :
+ methods(),
+ properties(),
+ signals_(),
+ base(),
+ base_native_type() {
zeromem(&create_func, sizeof(godot_instance_create_func));
zeromem(&destroy_func, sizeof(godot_instance_destroy_func));
}
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index 40feb5ae43..e358c2fb69 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -410,8 +410,8 @@ void PluginScriptLanguage::unlock() {
#endif
}
-PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc)
- : _desc(*desc) {
+PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc) :
+ _desc(*desc) {
_resource_loader = memnew(ResourceFormatLoaderPluginScript(this));
_resource_saver = memnew(ResourceFormatSaverPluginScript(this));
diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp
index 4169b07f63..0b71b3b10d 100644
--- a/modules/gdnative/pluginscript/pluginscript_script.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_script.cpp
@@ -423,8 +423,11 @@ ScriptInstance::RPCMode PluginScript::get_rset_mode(const StringName &p_variable
}
}
-PluginScript::PluginScript()
- : _data(NULL), _tool(false), _valid(false), _script_list(this) {
+PluginScript::PluginScript() :
+ _data(NULL),
+ _tool(false),
+ _valid(false),
+ _script_list(this) {
}
void PluginScript::init(PluginScriptLanguage *language) {
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 34099bf528..1cb35ec006 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -99,20 +99,41 @@ static Set<String> get_gdnative_singletons(EditorFileSystemDirectory *p_dir) {
}
static void actual_discoverer_handler() {
+
EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem();
Set<String> file_paths = get_gdnative_singletons(dir);
+ bool changed = false;
+ Array current_files;
+ if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) {
+ current_files = ProjectSettings::get_singleton()->get("gdnative/singletons");
+ }
Array files;
files.resize(file_paths.size());
int i = 0;
for (Set<String>::Element *E = file_paths.front(); E; i++, E = E->next()) {
+ if (!current_files.has(E->get())) {
+ changed = true;
+ }
files.set(i, E->get());
}
- ProjectSettings::get_singleton()->set("gdnative/singletons", files);
+ // Check for removed files
+ if (!changed) {
+ for (int i = 0; i < current_files.size(); i++) {
+ if (!file_paths.has(current_files[i])) {
+ changed = true;
+ break;
+ }
+ }
+ }
- ProjectSettings::get_singleton()->save();
+ if (changed) {
+
+ ProjectSettings::get_singleton()->set("gdnative/singletons", files);
+ ProjectSettings::get_singleton()->save();
+ }
}
static GDNativeSingletonDiscover *discoverer = NULL;
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 0882406761..13870170a5 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_gdscript = env_modules.Clone()
+
+env_gdscript.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 9496d0b310..b75f670906 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -100,7 +100,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
#endif
instance->owner->set_script_instance(instance);
-/* STEP 2, INITIALIZE AND CONSRTUCT */
+ /* STEP 2, INITIALIZE AND CONSRTUCT */
#ifndef NO_THREADS
GDScriptLanguage::singleton->lock->lock();
@@ -876,8 +876,8 @@ void GDScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
#endif
}
-GDScript::GDScript()
- : script_list(this) {
+GDScript::GDScript() :
+ script_list(this) {
_static_ref = this;
valid = false;
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 4cd6472b7f..f9385d7a11 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -806,8 +806,8 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
ERR_FAIL_COND_V(on->arguments.size() != 2, -1);
if (on->arguments[0]->type == GDScriptParser::Node::TYPE_OPERATOR && (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX || static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED)) {
-//SET (chained) MODE!!
+ // SET (chained) MODE!
#ifdef DEBUG_ENABLED
if (static_cast<GDScriptParser::OperatorNode *>(on->arguments[0])->op == GDScriptParser::OperatorNode::OP_INDEX_NAMED) {
const GDScriptParser::OperatorNode *inon = static_cast<GDScriptParser::OperatorNode *>(on->arguments[0]);
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index e7100d835c..adf6780278 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1795,8 +1795,8 @@ static void _find_type_arguments(GDScriptCompletionContext &context, const GDScr
}
} else {
-//regular method
+ //regular method
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
if (p_argidx < m->get_argument_count()) {
PropertyInfo pi = m->get_argument_info(p_argidx);
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index 765a76fec4..ee23f0ea0f 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -250,7 +250,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
-//GDScriptLanguage::get_singleton()->calls++;
+ //GDScriptLanguage::get_singleton()->calls++;
#endif
@@ -515,7 +515,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
} else {
v = "of type '" + _get_var_type(index) + "'";
}
- err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "').";
+ err_text = "Invalid set index " + v + " (on base: '" + _get_var_type(dst) + "') with value of type '" + _get_var_type(value) + "'";
OPCODE_BREAK;
}
#endif
@@ -574,7 +574,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
#ifdef DEBUG_ENABLED
if (!valid) {
String err_type;
- err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "').";
+ err_text = "Invalid set index '" + String(*index) + "' (on base: '" + _get_var_type(dst) + "') with value of type '" + _get_var_type(value) + "'.";
OPCODE_BREAK;
}
#endif
@@ -1432,8 +1432,8 @@ void GDScriptFunction::debug_get_stack_member_state(int p_line, List<Pair<String
}
}
-GDScriptFunction::GDScriptFunction()
- : function_list(this) {
+GDScriptFunction::GDScriptFunction() :
+ function_list(this) {
_stack_size = 0;
_call_size = 0;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index bee9ef1998..8c110143b8 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -597,12 +597,36 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
OperatorNode *op = alloc_node<OperatorNode>();
op->op = OperatorNode::OP_CALL;
+ //Do a quick Array and Dictionary Check. Replace if either require no arguments.
+ bool replaced = false;
+
if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
+ Variant::Type ct = tokenizer->get_token_type();
+ if (p_parsing_constant == false) {
+ if (ct == Variant::ARRAY) {
+ if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
+ ArrayNode *arr = alloc_node<ArrayNode>();
+ expr = arr;
+ replaced = true;
+ tokenizer->advance(3);
+ }
+ }
+ if (ct == Variant::DICTIONARY) {
+ if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
+ DictionaryNode *dict = alloc_node<DictionaryNode>();
+ expr = dict;
+ replaced = true;
+ tokenizer->advance(3);
+ }
+ }
+ }
- TypeNode *tn = alloc_node<TypeNode>();
- tn->vtype = tokenizer->get_token_type();
- op->arguments.push_back(tn);
- tokenizer->advance(2);
+ if (!replaced) {
+ TypeNode *tn = alloc_node<TypeNode>();
+ tn->vtype = tokenizer->get_token_type();
+ op->arguments.push_back(tn);
+ tokenizer->advance(2);
+ }
} else if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_FUNC) {
BuiltInFunctionNode *bn = alloc_node<BuiltInFunctionNode>();
@@ -628,11 +652,11 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
_make_completable_call(0);
completion_node = op;
}
- if (!_parse_arguments(op, op->arguments, p_static, true))
- return NULL;
-
- expr = op;
-
+ if (!replaced) {
+ if (!_parse_arguments(op, op->arguments, p_static, true))
+ return NULL;
+ expr = op;
+ }
} else if (tokenizer->is_token_literal(0, true)) {
// We check with is_token_literal, as this allows us to use match/sync/etc. as a name
//identifier (reference)
@@ -1140,6 +1164,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
bool unary = false;
bool ternary = false;
bool error = false;
+ bool right_to_left = false;
switch (expression[i].op) {
@@ -1194,11 +1219,13 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
case OperatorNode::OP_TERNARY_IF:
priority = 14;
ternary = true;
+ right_to_left = true;
break;
case OperatorNode::OP_TERNARY_ELSE:
priority = 14;
error = true;
- break; // Errors out when found without IF (since IF would consume it)
+ // Rigth-to-left should be false in this case, otherwise it would always error.
+ break;
case OperatorNode::OP_ASSIGN: priority = 15; break;
case OperatorNode::OP_ASSIGN_ADD: priority = 15; break;
@@ -1218,13 +1245,13 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
}
}
- if (priority < min_priority) {
+ if (priority < min_priority || (right_to_left && priority == min_priority)) {
+ // < is used for left to right (default)
+ // <= is used for right to left
if (error) {
_set_error("Unexpected operator");
return NULL;
}
- // < is used for left to right (default)
- // <= is used for right to left
next_op = i;
min_priority = priority;
is_unary = unary;
@@ -2976,10 +3003,9 @@ void GDScriptParser::_parse_extends(ClassNode *p_class) {
case GDScriptTokenizer::TK_IDENTIFIER: {
- StringName identifier = tokenizer->get_token_identifier();
- p_class->extends_class.push_back(identifier);
- }
- break;
+ StringName identifier = tokenizer->get_token_identifier();
+ p_class->extends_class.push_back(identifier);
+ } break;
case GDScriptTokenizer::TK_PERIOD:
break;
@@ -3390,6 +3416,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
_set_error("Can't export null type.");
return;
}
+ if (type == Variant::OBJECT) {
+ _set_error("Can't export raw object type.");
+ return;
+ }
current_export.type = type;
current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 1e007ddb0f..e707032ed8 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -30,6 +30,7 @@
#include "register_types.h"
#include "gdscript.h"
+#include "gdscript_tokenizer.h"
#include "io/file_access_encrypted.h"
#include "io/resource_loader.h"
#include "os/file_access.h"
@@ -38,6 +39,45 @@ GDScriptLanguage *script_language_gd = NULL;
ResourceFormatLoaderGDScript *resource_loader_gd = NULL;
ResourceFormatSaverGDScript *resource_saver_gd = NULL;
+#ifdef TOOLS_ENABLED
+
+#include "editor/editor_export.h"
+#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
+
+class EditorExportGDScript : public EditorExportPlugin {
+
+ GDCLASS(EditorExportGDScript, EditorExportPlugin);
+
+public:
+ virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features) {
+
+ if (!p_path.ends_with(".gd"))
+ return;
+
+ Vector<uint8_t> file = FileAccess::get_file_as_array(p_path);
+ if (file.empty())
+ return;
+ String txt;
+ txt.parse_utf8((const char *)file.ptr(), file.size());
+ file = GDScriptTokenizerBuffer::parse_code_string(txt);
+
+ if (file.empty())
+ return;
+
+ add_file(p_path.get_basename() + ".gdc", file, true);
+ }
+};
+
+static void _editor_init() {
+
+ Ref<EditorExportGDScript> gd_export;
+ gd_export.instance();
+ EditorExport::get_singleton()->add_export_plugin(gd_export);
+}
+
+#endif
+
void register_gdscript_types() {
ClassDB::register_class<GDScript>();
@@ -49,6 +89,10 @@ void register_gdscript_types() {
ResourceLoader::add_resource_format_loader(resource_loader_gd);
resource_saver_gd = memnew(ResourceFormatSaverGDScript);
ResourceSaver::add_resource_format_saver(resource_saver_gd);
+
+#ifdef TOOLS_ENABLED
+ EditorNode::add_init_callback(_editor_init);
+#endif
}
void unregister_gdscript_types() {
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index 0882406761..2ffe15cd33 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_gridmap = env_modules.Clone()
+
+env_gridmap.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index b3a1947647..bebf8bcf8f 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -469,7 +469,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
nm.xform = xform;
if (navigation) {
- nm.id = navigation->navmesh_create(navmesh, xform, this);
+ nm.id = navigation->navmesh_add(navmesh, xform, this);
} else {
nm.id = -1;
}
@@ -556,7 +556,7 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
if (cell_map.has(F->key()) && F->get().id < 0) {
Ref<NavigationMesh> nm = theme->get_item_navmesh(cell_map[F->key()].item);
if (nm.is_valid()) {
- F->get().id = navigation->navmesh_create(nm, F->get().xform, this);
+ F->get().id = navigation->navmesh_add(nm, F->get().xform, this);
}
}
}
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 5bfdf1dac3..ab66bf123e 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -186,6 +186,11 @@ class GridMap : public Spatial {
Vector3 _get_offset() const;
+ struct BakedMesh {
+ Ref<Mesh> mesh;
+ Transform transform;
+ };
+
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp
index 3a0b83d534..35253d5a77 100644
--- a/modules/mobile_vr/mobile_interface.cpp
+++ b/modules/mobile_vr/mobile_interface.cpp
@@ -461,6 +461,7 @@ MobileVRInterface::MobileVRInterface() {
glGenBuffers(1, &half_screen_quad);
glBindBuffer(GL_ARRAY_BUFFER, half_screen_quad);
{
+ /* clang-format off */
const float qv[16] = {
0, -1,
-1, -1,
@@ -471,6 +472,7 @@ MobileVRInterface::MobileVRInterface() {
1, -1,
1, -1,
};
+ /* clang-format on */
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 16, qv, GL_STATIC_DRAW);
}
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index 18a20ecac4..320bbe7090 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -1,6 +1,9 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
+
+env_mono = env_modules.Clone()
from compat import byte_to_str
@@ -43,12 +46,12 @@ def make_cs_files_header(src, dst):
header.write('#endif // _CS_FILES_DATA_H')
-env.add_source_files(env.modules_sources, '*.cpp')
-env.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
-env.add_source_files(env.modules_sources, 'utils/*.cpp')
+env_mono.add_source_files(env.modules_sources, '*.cpp')
+env_mono.add_source_files(env.modules_sources, 'mono_gd/*.cpp')
+env_mono.add_source_files(env.modules_sources, 'utils/*.cpp')
if env['tools']:
- env.add_source_files(env.modules_sources, 'editor/*.cpp')
+ env_mono.add_source_files(env.modules_sources, 'editor/*.cpp')
make_cs_files_header('glue/cs_files', 'glue/cs_compressed.gen.h')
vars = Variables()
@@ -58,12 +61,12 @@ vars.Update(env)
# Glue sources
if env['mono_glue']:
- env.add_source_files(env.modules_sources, 'glue/*.cpp')
+ env_mono.add_source_files(env.modules_sources, 'glue/*.cpp')
else:
- env.Append(CPPDEFINES=['MONO_GLUE_DISABLED'])
+ env_mono.Append(CPPDEFINES=['MONO_GLUE_DISABLED'])
if ARGUMENTS.get('yolo_copy', False):
- env.Append(CPPDEFINES=['YOLO_COPY'])
+ env_mono.Append(CPPDEFINES=['YOLO_COPY'])
# Build GodotSharpTools solution
@@ -201,8 +204,8 @@ def mono_build_solution(source, target, env):
mono_sln_builder = Builder(action = mono_build_solution)
-env.Append(BUILDERS={'MonoBuildSolution': mono_sln_builder})
-env.MonoBuildSolution(
+env_mono.Append(BUILDERS={'MonoBuildSolution': mono_sln_builder})
+env_mono.MonoBuildSolution(
os.path.join(Dir('#bin').abspath, 'GodotSharpTools.dll'),
'editor/GodotSharpTools/GodotSharpTools.sln'
)
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 6fbc309fa3..af5a0334c3 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1885,8 +1885,8 @@ StringName CSharpScript::get_script_name() const {
return name;
}
-CSharpScript::CSharpScript()
- : script_list(this) {
+CSharpScript::CSharpScript() :
+ script_list(this) {
_clear();
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
index bde5f0fd0b..9a1efb4423 100644
--- a/modules/mono/editor/csharp_project.cpp
+++ b/modules/mono/editor/csharp_project.cpp
@@ -117,4 +117,4 @@ void add_item(const String &p_project_path, const String &p_item_type, const Str
ERR_FAIL();
}
}
-} // CSharpProject
+} // namespace CSharpProject
diff --git a/modules/mono/editor/csharp_project.h b/modules/mono/editor/csharp_project.h
index 4832d2251e..44e8325a59 100644
--- a/modules/mono/editor/csharp_project.h
+++ b/modules/mono/editor/csharp_project.h
@@ -39,6 +39,6 @@ String generate_editor_api_project(const String &p_dir, const String &p_core_dll
String generate_game_project(const String &p_dir, const String &p_name, const Vector<String> &p_files = Vector<String>());
void add_item(const String &p_project_path, const String &p_item_type, const String &p_include);
-}
+} // namespace CSharpProject
#endif // CSHARP_PROJECT_H
diff --git a/modules/mono/glue/cs_files/Error.cs b/modules/mono/glue/cs_files/Error.cs
index 3f4a92603d..dee4b88f74 100644
--- a/modules/mono/glue/cs_files/Error.cs
+++ b/modules/mono/glue/cs_files/Error.cs
@@ -42,7 +42,6 @@ namespace Godot
ERR_CYCLIC_LINK = 40,
ERR_BUSY = 44,
ERR_HELP = 46,
- ERR_BUG = 47,
- ERR_WTF = 49
+ ERR_BUG = 47
}
}
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index a0c2508b0d..0f6245a37c 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -192,4 +192,4 @@ String get_project_csproj_path() {
return _GodotSharpDirs::get_singleton().csproj_filepath;
}
#endif
-}
+} // namespace GodotSharpDirs
diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h
index ba2c065210..914df40629 100644
--- a/modules/mono/godotsharp_dirs.h
+++ b/modules/mono/godotsharp_dirs.h
@@ -53,6 +53,6 @@ String get_custom_project_settings_dir();
String get_project_sln_path();
String get_project_csproj_path();
-}
+} // namespace GodotSharpDirs
#endif // GODOTSHARP_DIRS_H
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
index e10e06df0e..121392b3f8 100644
--- a/modules/mono/mono_gc_handle.cpp
+++ b/modules/mono/mono_gc_handle.cpp
@@ -36,7 +36,7 @@ uint32_t MonoGCHandle::make_strong_handle(MonoObject *p_object) {
return mono_gchandle_new(
p_object,
false /* do not pin the object */
- );
+ );
}
uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
@@ -44,7 +44,7 @@ uint32_t MonoGCHandle::make_weak_handle(MonoObject *p_object) {
return mono_gchandle_new_weakref(
p_object,
true /* track_resurrection: allows us to invoke _notification(NOTIFICATION_PREDELETE) while disposing */
- );
+ );
}
Ref<MonoGCHandle> MonoGCHandle::create_strong(MonoObject *p_object) {
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index cfe2148b80..56e8a01567 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -63,4 +63,4 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
return;
}
-}
+} // namespace GDMonoInternals
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
index 7e99df29a1..47cc11cc0a 100644
--- a/modules/mono/signal_awaiter_utils.cpp
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -62,7 +62,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p
return err;
}
-}
+} // namespace SignalAwaiterUtils
Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
@@ -116,8 +116,8 @@ void SignalAwaiterHandle::_bind_methods() {
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "_signal_callback", &SignalAwaiterHandle::_signal_callback, MethodInfo("_signal_callback"));
}
-SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle)
- : MonoGCHandle(p_managed_handle) {
+SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle) :
+ MonoGCHandle(p_managed_handle) {
#ifdef DEBUG_ENABLED
conn_target_id = 0;
diff --git a/modules/mono/utils/mono_reg_utils.h b/modules/mono/utils/mono_reg_utils.h
index 4cc4965acb..599828aa80 100644
--- a/modules/mono/utils/mono_reg_utils.h
+++ b/modules/mono/utils/mono_reg_utils.h
@@ -47,7 +47,7 @@ namespace MonoRegUtils {
MonoRegInfo find_mono();
String find_msbuild_tools_path();
-} // MonoRegUtils
+} // namespace MonoRegUtils
#endif // WINDOWS_ENABLED
diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp
index f26663ea11..8f817771ac 100644
--- a/modules/mono/utils/string_utils.cpp
+++ b/modules/mono/utils/string_utils.cpp
@@ -78,7 +78,7 @@ int sfind(const String &p_text, int p_from) {
return -1;
}
-}
+} // namespace
String sformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) {
if (p_text.length() < 2)
diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp
index 6d1d5485f3..7e8b308cf8 100644
--- a/modules/openssl/stream_peer_openssl.cpp
+++ b/modules/openssl/stream_peer_openssl.cpp
@@ -412,8 +412,12 @@ void StreamPeerOpenSSL::_print_error(int err) {
err = SSL_get_error(ssl, err);
switch (err) {
- case SSL_ERROR_NONE: ERR_PRINT("NO ERROR: The TLS/SSL I/O operation completed"); break;
- case SSL_ERROR_ZERO_RETURN: ERR_PRINT("The TLS/SSL connection has been closed.");
+ case SSL_ERROR_NONE:
+ ERR_PRINT("NO ERROR: The TLS/SSL I/O operation completed");
+ break;
+ case SSL_ERROR_ZERO_RETURN:
+ ERR_PRINT("The TLS/SSL connection has been closed.");
+ break;
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
ERR_PRINT("The operation did not complete.");
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 06eab4c94d..5742102dae 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -62,7 +62,7 @@ int AudioStreamPlaybackOpus::_op_seek_func(void *_stream, opus_int64 _offset, in
fa->seek_end(_offset);
} break;
default: {
- ERR_PRINT("BUG, wtf was whence set to?\n");
+ ERR_PRINT("Opus seek function failure: Unexpected value in _whence\n");
}
}
int ret = fa->eof_reached() ? -1 : 0;
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 03592047ad..4415c888a4 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -239,11 +239,11 @@ ResourceFormatPVR::ResourceFormatPVR() {
Image::_image_compress_pvrtc2_func = _compress_pvrtc4;
}
-/////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
-//PVRTC decompressor, Based on PVRTC decompressor by IMGTEC.
+ //PVRTC decompressor, Based on PVRTC decompressor by IMGTEC.
-/////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
#define PT_INDEX 2
#define BLK_Y_SIZE 4
diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp
index 072f18b990..ac436c3c26 100644
--- a/modules/squish/image_compress_squish.cpp
+++ b/modules/squish/image_compress_squish.cpp
@@ -64,7 +64,7 @@ void image_decompress_squish(Image *p_image) {
} else if (p_image->get_format() == Image::FORMAT_RGTC_RG) {
squish_flags = squish::kBc5;
} else {
- print_line("wtf askd to decompress.. " + itos(p_image->get_format()));
+ print_line("Can't decompress unknown format: " + itos(p_image->get_format()));
ERR_FAIL_COND(true);
return;
}
diff --git a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
index c0f8c6b9c7..4533d59cae 100644
--- a/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
+++ b/modules/stb_vorbis/doc_classes/AudioStreamOGGVorbis.xml
@@ -11,18 +11,49 @@
<demos>
</demos>
<methods>
+ <method name="get_data" qualifiers="const">
+ <return type="PoolByteArray">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_loop_offset" qualifiers="const">
+ <return type="float">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="has_loop" qualifiers="const">
+ <return type="bool">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_data">
+ <return type="void">
+ </return>
+ <argument index="0" name="data" type="PoolByteArray">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_loop">
+ <return type="void">
+ </return>
+ <argument index="0" name="enable" type="bool">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_loop_offset">
+ <return type="void">
+ </return>
+ <argument index="0" name="seconds" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
- <members>
- <member name="data" type="PoolByteArray" setter="set_data" getter="get_data">
- Raw audio data.
- </member>
- <member name="loop" type="bool" setter="set_loop" getter="has_loop">
- If [code]true[/code], audio will loop continuously. Default value: [code]false[/code].
- </member>
- <member name="loop_offset" type="float" setter="set_loop_offset" getter="get_loop_offset">
- If loop is [code]true[/code], loop starts from this position, in seconds.
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/thekla_unwrap/SCsub b/modules/thekla_unwrap/SCsub
new file mode 100644
index 0000000000..c57bf326ea
--- /dev/null
+++ b/modules/thekla_unwrap/SCsub
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_thekla_unwrap = env_modules.Clone()
+
+# Thirdparty source files
+if env['builtin_thekla_atlas']:
+ thirdparty_dir = "#thirdparty/thekla_atlas/"
+ thirdparty_sources = [
+ "nvcore/Memory.cpp",
+ "nvcore/Debug.cpp",
+ "nvcore/StrLib.cpp",
+ "nvcore/FileSystem.cpp",
+ "nvcore/RadixSort.cpp",
+ "nvmath/Basis.cpp",
+ "nvmath/ConvexHull.cpp",
+ "nvmath/Fitting.cpp",
+ "nvmath/Plane.cpp",
+ "nvmath/ProximityGrid.cpp",
+ "nvmath/Random.cpp",
+ "nvmath/Solver.cpp",
+ "nvmath/Sparse.cpp",
+ "nvmath/TypeSerialization.cpp",
+ "poshlib/posh.c",
+ "nvimage/BitMap.cpp",
+ "nvimage/Image.cpp",
+ "nvmesh/BaseMesh.cpp",
+ "nvmesh/MeshBuilder.cpp",
+ "nvmesh/TriMesh.cpp",
+ "nvmesh/QuadTriMesh.cpp",
+ "nvmesh/MeshTopology.cpp",
+ "nvmesh/halfedge/Edge.cpp",
+ "nvmesh/halfedge/Mesh.cpp",
+ "nvmesh/halfedge/Face.cpp",
+ "nvmesh/halfedge/Vertex.cpp",
+ "nvmesh/geometry/Bounds.cpp",
+ "nvmesh/geometry/Measurements.cpp",
+ "nvmesh/raster/Raster.cpp",
+ "nvmesh/param/Atlas.cpp",
+ "nvmesh/param/AtlasBuilder.cpp",
+ "nvmesh/param/AtlasPacker.cpp",
+ "nvmesh/param/LeastSquaresConformalMap.cpp",
+ "nvmesh/param/OrthogonalProjectionMap.cpp",
+ "nvmesh/param/ParameterizationQuality.cpp",
+ "nvmesh/param/SingleFaceMap.cpp",
+ "nvmesh/param/Util.cpp",
+ "nvmesh/weld/VertexWeld.cpp",
+ "nvmesh/weld/Snap.cpp",
+ "thekla/thekla_atlas.cpp"
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_thekla_unwrap.add_source_files(env.modules_sources, thirdparty_sources)
+ env_thekla_unwrap.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/poshlib", thirdparty_dir + "/nvcore", thirdparty_dir + "/nvmesh"])
+
+ # upstream uses c++11
+ if (not env_thekla_unwrap.msvc):
+ env_thekla_unwrap.Append(CXXFLAGS="-std=c++11")
+
+ if env["platform"] == 'x11':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_LINUX", "-DPOSH_COMPILER_GCC"])
+ elif env["platform"] == 'osx':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_DARWIN", "-DPOSH_COMPILER_GCC"])
+ elif env["platform"] == 'windows':
+ if env.msvc:
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_WIN32", "-DNV_CC_MSVC", "-DPOSH_COMPILER_MSVC" ])
+ else:
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_MINGW", "-DNV_CC_GNUC", "-DPOSH_COMPILER_GCC", "-U__STRICT_ANSI__"])
+ env.Append(LIBS=["dbghelp"])
+
+# Godot source files
+env_thekla_unwrap.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/thekla_unwrap/config.py b/modules/thekla_unwrap/config.py
new file mode 100644
index 0000000000..b1ce7d4b91
--- /dev/null
+++ b/modules/thekla_unwrap/config.py
@@ -0,0 +1,7 @@
+def can_build(platform):
+ return platform != "android" and platform != "ios"
+
+def configure(env):
+ if not env['tools']:
+ env['builtin_thekla_atlas'] = False
+ env.disabled_modules.append("thekla_unwrap")
diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp
new file mode 100644
index 0000000000..ab3203068f
--- /dev/null
+++ b/modules/thekla_unwrap/register_types.cpp
@@ -0,0 +1,116 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+#include "thirdparty/thekla_atlas/thekla/thekla_atlas.h"
+#include <stdio.h>
+#include <stdlib.h>
+extern bool (*array_mesh_lightmap_unwrap_callback)(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y);
+
+bool thekla_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_vertices, const float *p_normals, int p_vertex_count, const int *p_indices, const int *p_face_materials, int p_index_count, float **r_uv, int **r_vertex, int *r_vertex_count, int **r_index, int *r_index_count, int *r_size_hint_x, int *r_size_hint_y) {
+
+ //set up input mesh
+ Thekla::Atlas_Input_Mesh input_mesh;
+ input_mesh.face_array = new Thekla::Atlas_Input_Face[p_index_count / 3];
+ for (int i = 0; i < p_index_count / 3; i++) {
+ input_mesh.face_array[i].vertex_index[0] = p_indices[i * 3 + 0];
+ input_mesh.face_array[i].vertex_index[1] = p_indices[i * 3 + 1];
+ input_mesh.face_array[i].vertex_index[2] = p_indices[i * 3 + 2];
+ //printf("face %i - %i, %i, %i - mat %i\n", i, input_mesh.face_array[i].vertex_index[0], input_mesh.face_array[i].vertex_index[1], input_mesh.face_array[i].vertex_index[2], p_face_materials[i]);
+ input_mesh.face_array[i].material_index = p_face_materials[i];
+ }
+ input_mesh.vertex_array = new Thekla::Atlas_Input_Vertex[p_vertex_count];
+ for (int i = 0; i < p_vertex_count; i++) {
+ input_mesh.vertex_array[i].first_colocal = i; //wtf
+ for (int j = 0; j < 3; j++) {
+ input_mesh.vertex_array[i].position[j] = p_vertices[i * 3 + j];
+ input_mesh.vertex_array[i].normal[j] = p_normals[i * 3 + j];
+ }
+ input_mesh.vertex_array[i].uv[0] = 0;
+ input_mesh.vertex_array[i].uv[1] = 0;
+ //printf("vertex %i - %f, %f, %f\n", i, input_mesh.vertex_array[i].position[0], input_mesh.vertex_array[i].position[1], input_mesh.vertex_array[i].position[2]);
+ //printf("normal %i - %f, %f, %f\n", i, input_mesh.vertex_array[i].normal[0], input_mesh.vertex_array[i].normal[1], input_mesh.vertex_array[i].normal[2]);
+ }
+ input_mesh.face_count = p_index_count / 3;
+ input_mesh.vertex_count = p_vertex_count;
+
+ //set up options
+ Thekla::Atlas_Options options;
+ Thekla::atlas_set_default_options(&options);
+ options.packer_options.witness.packing_quality = 1;
+ options.packer_options.witness.texel_area = 1.0 / p_texel_size;
+ options.packer_options.witness.conservative = true;
+
+ //generate
+ Thekla::Atlas_Error err;
+ Thekla::Atlas_Output_Mesh *output = atlas_generate(&input_mesh, &options, &err);
+
+ delete[] input_mesh.face_array;
+ delete[] input_mesh.vertex_array;
+
+ if (err != Thekla::Atlas_Error_Success) {
+ printf("error with atlas\n");
+ } else {
+ *r_vertex = (int *)malloc(sizeof(int) * output->vertex_count);
+ *r_uv = (float *)malloc(sizeof(float) * output->vertex_count * 3);
+ *r_index = (int *)malloc(sizeof(int) * output->index_count);
+
+ // printf("w: %i, h: %i\n", output->atlas_width, output->atlas_height);
+ for (int i = 0; i < output->vertex_count; i++) {
+ (*r_vertex)[i] = output->vertex_array[i].xref;
+ (*r_uv)[i * 2 + 0] = output->vertex_array[i].uv[0] / output->atlas_width;
+ (*r_uv)[i * 2 + 1] = output->vertex_array[i].uv[1] / output->atlas_height;
+ // printf("uv: %f,%f\n", (*r_uv)[i * 2 + 0], (*r_uv)[i * 2 + 1]);
+ }
+ *r_vertex_count = output->vertex_count;
+
+ for (int i = 0; i < output->index_count; i++) {
+ (*r_index)[i] = output->index_array[i];
+ }
+
+ *r_index_count = output->index_count;
+
+ *r_size_hint_x = output->atlas_height;
+ *r_size_hint_y = output->atlas_width;
+ }
+
+ if (output) {
+ atlas_free(output);
+ }
+
+ return err == Thekla::Atlas_Error_Success;
+}
+
+void register_thekla_unwrap_types() {
+
+ array_mesh_lightmap_unwrap_callback = thekla_mesh_lightmap_unwrap_callback;
+}
+
+void unregister_thekla_unwrap_types() {
+}
diff --git a/modules/thekla_unwrap/register_types.h b/modules/thekla_unwrap/register_types.h
new file mode 100644
index 0000000000..2bc3d16c64
--- /dev/null
+++ b/modules/thekla_unwrap/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_thekla_unwrap_types();
+void unregister_thekla_unwrap_types();
diff --git a/modules/theora/doc_classes/VideoStreamTheora.xml b/modules/theora/doc_classes/VideoStreamTheora.xml
index 61884f47fa..6c8806ed72 100644
--- a/modules/theora/doc_classes/VideoStreamTheora.xml
+++ b/modules/theora/doc_classes/VideoStreamTheora.xml
@@ -9,11 +9,21 @@
<demos>
</demos>
<methods>
+ <method name="get_file">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_file">
+ <return type="void">
+ </return>
+ <argument index="0" name="file" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
- <members>
- <member name="file" type="String" setter="set_file" getter="get_file">
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
index 49a4db237a..c88662454c 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -47,6 +47,11 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
f->close();
+ // Re-implementation of tinyexr's LoadEXRFromMemory using Godot types to store the Image data
+ // and Godot's error codes.
+ // When debugging after updating the thirdparty library, check that we're still in sync with
+ // their API usage in LoadEXRFromMemory.
+
EXRVersion exr_version;
EXRImage exr_image;
EXRHeader exr_header;
@@ -68,6 +73,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
return ERR_FILE_CORRUPT;
}
+ // Read HALF channel as FLOAT. (GH-13490)
+ for (int i = 0; i < exr_header.num_channels; i++) {
+ if (exr_header.pixel_types[i] == TINYEXR_PIXELTYPE_HALF) {
+ exr_header.requested_pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT;
+ }
+ }
+
InitEXRImage(&exr_image);
ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w.ptr(), src_image_len, &err);
if (ret != TINYEXR_SUCCESS) {
@@ -95,23 +107,25 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
}
if (idxR == -1) {
- ERR_PRINT("R channel not found");
+ ERR_PRINT("TinyEXR: R channel not found.");
// @todo { free exr_image }
return ERR_FILE_CORRUPT;
}
if (idxG == -1) {
- ERR_PRINT("G channel not found\n")
+ ERR_PRINT("TinyEXR: G channel not found.")
// @todo { free exr_image }
return ERR_FILE_CORRUPT;
}
if (idxB == -1) {
- ERR_PRINT("B channel not found\n")
+ ERR_PRINT("TinyEXR: B channel not found.")
// @todo { free exr_image }
return ERR_FILE_CORRUPT;
}
+ // EXR image data loaded, now parse it into Godot-friendly image data
+
PoolVector<uint8_t> imgdata;
Image::Format format;
@@ -126,7 +140,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
}
{
-
PoolVector<uint8_t>::Write wd = imgdata.write();
uint16_t *iw = (uint16_t *)wd.ptr();
@@ -151,11 +164,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
}
}
- print_line("EXR w: " + itos(exr_image.width) + " h:" + itos(exr_image.height) + " format " + Image::get_format_name(format));
p_image->create(exr_image.width, exr_image.height, false, format, imgdata);
w = PoolVector<uint8_t>::Write();
+ FreeEXRHeader(&exr_header);
+ FreeEXRImage(&exr_image);
+
return OK;
}
diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub
index 0882406761..96ee911ba0 100644
--- a/modules/visual_script/SCsub
+++ b/modules/visual_script/SCsub
@@ -1,7 +1,10 @@
#!/usr/bin/env python
Import('env')
+Import('env_modules')
-env.add_source_files(env.modules_sources, "*.cpp")
+env_vs = env_modules.Clone()
+
+env_vs.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/visual_script/doc_classes/VisualScript.xml b/modules/visual_script/doc_classes/VisualScript.xml
index cc55b72ec7..46bd35dd73 100644
--- a/modules/visual_script/doc_classes/VisualScript.xml
+++ b/modules/visual_script/doc_classes/VisualScript.xml
@@ -495,10 +495,6 @@
</description>
</method>
</methods>
- <members>
- <member name="data" type="Dictionary" setter="_set_data" getter="_get_data">
- </member>
- </members>
<signals>
<signal name="node_ports_changed">
<argument index="0" name="function" type="String">
diff --git a/modules/visual_script/doc_classes/VisualScriptConstructor.xml b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
index f3c6b6a304..cbe8c6c096 100644
--- a/modules/visual_script/doc_classes/VisualScriptConstructor.xml
+++ b/modules/visual_script/doc_classes/VisualScriptConstructor.xml
@@ -11,31 +11,35 @@
<demos>
</demos>
<methods>
+ <method name="get_constructor" qualifiers="const">
+ <return type="Dictionary">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="get_constructor_type" qualifiers="const">
+ <return type="int" enum="Variant.Type">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_constructor">
+ <return type="void">
+ </return>
+ <argument index="0" name="constructor" type="Dictionary">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_constructor_type">
+ <return type="void">
+ </return>
+ <argument index="0" name="type" type="int" enum="Variant.Type">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
- <members>
- <member name="constructor" type="Dictionary" setter="set_constructor" getter="get_constructor">
- The constructor function's method info. Has roughly the following structure:
- [codeblock]
- {
- name = "string",
- args = [{
- name = "string"
- class_name = "string"
- type = TYPE_*
- hint = PROPERTY_HINT_*
- hint_string = "string"
- }]
- default_args = [] # Array of variants
- flags = METHOD_FLAG_*
- id = 0
- return = {type = TYPE_*}
- }
- [/codeblock]
- </member>
- <member name="type" type="int" setter="set_constructor_type" getter="get_constructor_type" enum="Variant.Type">
- The type to be constructed.
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
index 86cf4410ac..0f396564e2 100644
--- a/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
+++ b/modules/visual_script/doc_classes/VisualScriptDeconstruct.xml
@@ -13,8 +13,6 @@
<methods>
</methods>
<members>
- <member name="elem_cache" type="Array" setter="_set_elem_cache" getter="_get_elem_cache">
- </member>
<member name="type" type="int" setter="set_deconstruct_type" getter="get_deconstruct_type" enum="Variant.Type">
The type to deconstruct.
</member>
diff --git a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
index cc2360fc2e..03c47dca7c 100644
--- a/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
+++ b/modules/visual_script/doc_classes/VisualScriptFunctionCall.xml
@@ -11,8 +11,6 @@
<methods>
</methods>
<members>
- <member name="argument_cache" type="Dictionary" setter="_set_argument_cache" getter="_get_argument_cache">
- </member>
<member name="base_script" type="String" setter="set_base_script" getter="get_base_script">
</member>
<member name="base_type" type="String" setter="set_base_type" getter="get_base_type">
diff --git a/modules/visual_script/doc_classes/VisualScriptNode.xml b/modules/visual_script/doc_classes/VisualScriptNode.xml
index 94fed44950..ef7cf7c3b8 100644
--- a/modules/visual_script/doc_classes/VisualScriptNode.xml
+++ b/modules/visual_script/doc_classes/VisualScriptNode.xml
@@ -46,10 +46,6 @@
</description>
</method>
</methods>
- <members>
- <member name="_default_input_values" type="Array" setter="_set_default_input_values" getter="_get_default_input_values">
- </member>
- </members>
<signals>
<signal name="ports_changed">
<description>
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
index f68f0edeea..11c50f2b97 100644
--- a/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPropertyGet.xml
@@ -25,8 +25,6 @@
</member>
<member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertyGet.CallMode">
</member>
- <member name="type_cache" type="int" setter="_set_type_cache" getter="_get_type_cache" enum="Variant.Type">
- </member>
</members>
<constants>
<constant name="CALL_MODE_SELF" value="0" enum="CallMode">
diff --git a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
index d4305af57f..2e96ccc1f6 100644
--- a/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
+++ b/modules/visual_script/doc_classes/VisualScriptPropertySet.xml
@@ -27,8 +27,6 @@
</member>
<member name="set_mode" type="int" setter="set_call_mode" getter="get_call_mode" enum="VisualScriptPropertySet.CallMode">
</member>
- <member name="type_cache" type="Dictionary" setter="_set_type_cache" getter="_get_type_cache">
- </member>
</members>
<constants>
<constant name="CALL_MODE_SELF" value="0" enum="CallMode">
diff --git a/modules/visual_script/doc_classes/VisualScriptYield.xml b/modules/visual_script/doc_classes/VisualScriptYield.xml
index b42fc027cf..72ef586c1f 100644
--- a/modules/visual_script/doc_classes/VisualScriptYield.xml
+++ b/modules/visual_script/doc_classes/VisualScriptYield.xml
@@ -9,10 +9,22 @@
<demos>
</demos>
<methods>
+ <method name="get_yield_mode">
+ <return type="int" enum="VisualScriptYield.YieldMode">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_yield_mode">
+ <return type="void">
+ </return>
+ <argument index="0" name="mode" type="int" enum="VisualScriptYield.YieldMode">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<members>
- <member name="mode" type="int" setter="set_yield_mode" getter="get_yield_mode" enum="VisualScriptYield.YieldMode">
- </member>
<member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time">
</member>
</members>
diff --git a/modules/visual_script/register_types.cpp b/modules/visual_script/register_types.cpp
index b6ce10381d..ecdca7eb42 100644
--- a/modules/visual_script/register_types.cpp
+++ b/modules/visual_script/register_types.cpp
@@ -53,7 +53,7 @@ void register_visual_script_types() {
ClassDB::register_class<VisualScript>();
ClassDB::register_virtual_class<VisualScriptNode>();
- ClassDB::register_virtual_class<VisualScriptFunctionState>();
+ ClassDB::register_class<VisualScriptFunctionState>();
ClassDB::register_class<VisualScriptFunction>();
ClassDB::register_class<VisualScriptOperator>();
ClassDB::register_class<VisualScriptVariableSet>();
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 26f2d687d8..53d93798d9 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -2047,6 +2047,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
function.argument_count = func_node->get_argument_count();
function.max_stack += function.argument_count;
function.flow_stack_size = func_node->is_stack_less() ? 0 : func_node->get_stack_size();
+ max_input_args = MAX(max_input_args, function.argument_count);
}
//multiple passes are required to set up this complex thing..
@@ -2289,7 +2290,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p
binds.push_back(p_binds[i]);
}
binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing
- p_obj->connect(p_signal, this, "_signal_callback", binds);
+ p_obj->connect(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT);
}
bool VisualScriptFunctionState::is_valid() const {
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 59d9540239..a38266acc0 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -731,9 +731,9 @@ void VisualScriptSwitch::_bind_methods() {
VisualScriptSwitch::VisualScriptSwitch() {
}
-//////////////////////////////////////////
-////////////////EVENT ACTION FILTER///////////
-//////////////////////////////////////////
+ //////////////////////////////////////////
+ ////////////////EVENT ACTION FILTER///////////
+ //////////////////////////////////////////
#if 0
int VisualScriptInputFilter::get_output_sequence_port_count() const {
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 95ad7256b3..5f98951bec 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -390,7 +390,7 @@ PropertyInfo VisualScriptOperator::get_input_value_port_info(int p_idx) const {
{ Variant::NIL, Variant::NIL }, //OP_GREATER_EQUAL,
//mathematic
{ Variant::NIL, Variant::NIL }, //OP_ADD,
- { Variant::NIL, Variant::NIL }, //OP_SUBSTRACT,
+ { Variant::NIL, Variant::NIL }, //OP_SUBTRACT,
{ Variant::NIL, Variant::NIL }, //OP_MULTIPLY,
{ Variant::NIL, Variant::NIL }, //OP_DIVIDE,
{ Variant::NIL, Variant::NIL }, //OP_NEGATE,
@@ -433,7 +433,7 @@ PropertyInfo VisualScriptOperator::get_output_value_port_info(int p_idx) const {
Variant::BOOL, //OP_GREATER_EQUAL,
//mathematic
Variant::NIL, //OP_ADD,
- Variant::NIL, //OP_SUBSTRACT,
+ Variant::NIL, //OP_SUBTRACT,
Variant::NIL, //OP_MULTIPLY,
Variant::NIL, //OP_DIVIDE,
Variant::NIL, //OP_NEGATE,
@@ -474,7 +474,7 @@ static const char *op_names[] = {
"GreaterEq", //OP_GREATER_EQUAL,
//mathematic
"Add", //OP_ADD,
- "Subtract", //OP_SUBSTRACT,
+ "Subtract", //OP_SUBTRACT,
"Multiply", //OP_MULTIPLY,
"Divide", //OP_DIVIDE,
"Negate", //OP_NEGATE,
@@ -514,7 +514,7 @@ String VisualScriptOperator::get_text() const {
L"A \u2265 B", //OP_GREATER_EQUAL,
//mathematic
L"A + B", //OP_ADD,
- L"A - B", //OP_SUBSTRACT,
+ L"A - B", //OP_SUBTRACT,
L"A x B", //OP_MULTIPLY,
L"A \u00F7 B", //OP_DIVIDE,
L"\u00AC A", //OP_NEGATE,
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp
index 9fb6fa8197..03c0bfb1c2 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp
@@ -64,7 +64,7 @@ int AudioStreamPlaybackOGGVorbis::_ov_seek_func(void *_f, ogg_int64_t offs, int
fa->seek_end(offs);
} else {
- ERR_PRINT("BUG, wtf was whence set to?\n");
+ ERR_PRINT("Vorbis seek function failure: Unexpected value in _whence\n");
}
int ret = fa->eof_reached() ? -1 : 0;
//printf("returning %i\n",ret);
diff --git a/modules/webm/doc_classes/VideoStreamWebm.xml b/modules/webm/doc_classes/VideoStreamWebm.xml
index 8b6696cfe9..6e8120b1de 100644
--- a/modules/webm/doc_classes/VideoStreamWebm.xml
+++ b/modules/webm/doc_classes/VideoStreamWebm.xml
@@ -9,11 +9,21 @@
<demos>
</demos>
<methods>
+ <method name="get_file">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="set_file">
+ <return type="void">
+ </return>
+ <argument index="0" name="file" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
- <members>
- <member name="file" type="String" setter="set_file" getter="get_file">
- </member>
- </members>
<constants>
</constants>
</class>
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 0fc9df5b58..b055ccf5aa 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -92,21 +92,27 @@ private:
/**/
-VideoStreamPlaybackWebm::VideoStreamPlaybackWebm()
- : audio_track(0),
- webm(NULL),
- video(NULL),
- audio(NULL),
- video_frames(NULL), audio_frame(NULL),
- video_frames_pos(0), video_frames_capacity(0),
- num_decoded_samples(0), samples_offset(-1),
- mix_callback(NULL),
- mix_udata(NULL),
- playing(false), paused(false),
- delay_compensation(0.0),
- time(0.0), video_frame_delay(0.0), video_pos(0.0),
- texture(memnew(ImageTexture)),
- pcm(NULL) {}
+VideoStreamPlaybackWebm::VideoStreamPlaybackWebm() :
+ audio_track(0),
+ webm(NULL),
+ video(NULL),
+ audio(NULL),
+ video_frames(NULL),
+ audio_frame(NULL),
+ video_frames_pos(0),
+ video_frames_capacity(0),
+ num_decoded_samples(0),
+ samples_offset(-1),
+ mix_callback(NULL),
+ mix_udata(NULL),
+ playing(false),
+ paused(false),
+ delay_compensation(0.0),
+ time(0.0),
+ video_frame_delay(0.0),
+ video_pos(0.0),
+ texture(memnew(ImageTexture)),
+ pcm(NULL) {}
VideoStreamPlaybackWebm::~VideoStreamPlaybackWebm() {
delete_pointers();
@@ -403,8 +409,8 @@ void VideoStreamPlaybackWebm::delete_pointers() {
/**/
-VideoStreamWebm::VideoStreamWebm()
- : audio_track(0) {}
+VideoStreamWebm::VideoStreamWebm() :
+ audio_track(0) {}
Ref<VideoStreamPlayback> VideoStreamWebm::instance_playback() {
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index f9295fed47..ea7af1bf9e 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -26,9 +26,6 @@ if env['builtin_libwebp']:
"dsp/alpha_processing_neon.c",
"dsp/alpha_processing_sse2.c",
"dsp/alpha_processing_sse41.c",
- "dsp/argb.c",
- "dsp/argb_mips_dsp_r2.c",
- "dsp/argb_sse2.c",
"dsp/cost.c",
"dsp/cost_mips32.c",
"dsp/cost_mips_dsp_r2.c",
@@ -36,6 +33,9 @@ if env['builtin_libwebp']:
"dsp/cpu.c",
"dsp/dec.c",
"dsp/dec_clip_tables.c",
+ "dsp/ssim.c",
+ "dsp/ssim_sse2.c",
+ "dsp/yuv_neon.c",
"dsp/dec_mips32.c",
"dsp/dec_mips_dsp_r2.c",
"dsp/dec_msa.c",
@@ -84,6 +84,7 @@ if env['builtin_libwebp']:
"dsp/yuv_sse2.c",
"enc/alpha_enc.c",
"enc/analysis_enc.c",
+ "enc/backward_references_cost_enc.c",
"enc/backward_references_enc.c",
"enc/config_enc.c",
"enc/cost_enc.c",
@@ -122,10 +123,10 @@ if env['builtin_libwebp']:
"utils/thread_utils.c",
"utils/utils.c",
]
- thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+ thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources]
env_webp.add_source_files(env.modules_sources, thirdparty_sources)
- env_webp.Append(CPPPATH=[thirdparty_dir])
+ env_webp.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "src/"])
# Godot source files
env_webp.add_source_files(env.modules_sources, "*.cpp")