diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bullet/bullet_physics_server.cpp | 16 | ||||
-rw-r--r-- | modules/bullet/bullet_physics_server.h | 3 | ||||
-rw-r--r-- | modules/bullet/generic_6dof_joint_bullet.cpp | 8 | ||||
-rw-r--r-- | modules/bullet/generic_6dof_joint_bullet.h | 3 | ||||
-rw-r--r-- | modules/bullet/godot_result_callbacks.cpp | 8 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 4 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.h | 1 | ||||
-rw-r--r-- | modules/gdnative/pluginscript/pluginscript_script.h | 1 | ||||
-rw-r--r-- | modules/gdscript/gdscript.cpp | 1 | ||||
-rw-r--r-- | modules/gdscript/gdscript.h | 2 | ||||
-rw-r--r-- | modules/mono/csharp_script.cpp | 4 | ||||
-rw-r--r-- | modules/mono/csharp_script.h | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script.cpp | 4 | ||||
-rw-r--r-- | modules/visual_script/visual_script.h | 1 |
14 files changed, 56 insertions, 2 deletions
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index 315afe3d72..7bc731e75e 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -1471,6 +1471,22 @@ bool BulletPhysicsServer::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis return generic_6dof_joint->get_flag(p_axis, p_flag); } +void BulletPhysicsServer::generic_6dof_joint_set_precision(RID p_joint, int p_precision) { + JointBullet *joint = joint_owner.get(p_joint); + ERR_FAIL_COND(!joint); + ERR_FAIL_COND(joint->get_type() != JOINT_6DOF); + Generic6DOFJointBullet *generic_6dof_joint = static_cast<Generic6DOFJointBullet *>(joint); + generic_6dof_joint->set_precision(p_precision); +} + +int BulletPhysicsServer::generic_6dof_joint_get_precision(RID p_joint) { + JointBullet *joint = joint_owner.get(p_joint); + ERR_FAIL_COND_V(!joint, 0); + ERR_FAIL_COND_V(joint->get_type() != JOINT_6DOF, 0); + Generic6DOFJointBullet *generic_6dof_joint = static_cast<Generic6DOFJointBullet *>(joint); + return generic_6dof_joint->get_precision(); +} + void BulletPhysicsServer::free(RID p_rid) { if (shape_owner.owns(p_rid)) { diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h index c8c782267e..0cea3f5ba6 100644 --- a/modules/bullet/bullet_physics_server.h +++ b/modules/bullet/bullet_physics_server.h @@ -375,6 +375,9 @@ public: virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable); virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag); + virtual void generic_6dof_joint_set_precision(RID p_joint, int precision); + virtual int generic_6dof_joint_get_precision(RID p_joint); + /* MISC */ virtual void free(RID p_rid); diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp index a94b88d566..812dcd2d56 100644 --- a/modules/bullet/generic_6dof_joint_bullet.cpp +++ b/modules/bullet/generic_6dof_joint_bullet.cpp @@ -265,3 +265,11 @@ bool Generic6DOFJointBullet::get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOF ERR_FAIL_INDEX_V(p_axis, 3, false); return flags[p_axis][p_flag]; } + +void Generic6DOFJointBullet::set_precision(int p_precision) { + sixDOFConstraint->setOverrideNumSolverIterations(MAX(1, p_precision)); +} + +int Generic6DOFJointBullet::get_precision() const { + return sixDOFConstraint->getOverrideNumSolverIterations(); +} diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h index 176127ed6c..848c3a10cd 100644 --- a/modules/bullet/generic_6dof_joint_bullet.h +++ b/modules/bullet/generic_6dof_joint_bullet.h @@ -68,6 +68,9 @@ public: void set_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag, bool p_value); bool get_flag(Vector3::Axis p_axis, PhysicsServer::G6DOFJointAxisFlag p_flag) const; + + void set_precision(int p_precision); + int get_precision() const; }; #endif diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp index 3b44ab838e..0117bb375f 100644 --- a/modules/bullet/godot_result_callbacks.cpp +++ b/modules/bullet/godot_result_callbacks.cpp @@ -102,6 +102,9 @@ bool GodotAllConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0) con } btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) { + if (count >= m_resultMax) + return 1; // not used by bullet + CollisionObjectBullet *gObj = static_cast<CollisionObjectBullet *>(convexResult.m_hitCollisionObject->getUserPointer()); PhysicsDirectSpaceState::ShapeResult &result = m_results[count]; @@ -172,6 +175,9 @@ btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::Loc } bool GodotAllContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const { + if (m_count >= m_resultMax) + return false; + const bool needs = GodotFilterCallback::test_collision_filters(m_collisionFilterGroup, m_collisionFilterMask, proxy0->m_collisionFilterGroup, proxy0->m_collisionFilterMask); if (needs) { btCollisionObject *btObj = static_cast<btCollisionObject *>(proxy0->m_clientObject); @@ -249,6 +255,8 @@ bool GodotContactPairContactResultCallback::needsCollision(btBroadphaseProxy *pr } btScalar GodotContactPairContactResultCallback::addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1) { + if (m_count >= m_resultMax) + return 1; // not used by bullet if (m_self_object == colObj0Wrap->getCollisionObject()) { B_TO_G(cp.m_localPointA, m_results[m_count * 2 + 0]); // Local contact diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index eb133502c4..bcaf3f346e 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -294,6 +294,10 @@ MethodInfo NativeScript::get_method_info(const StringName &p_method) const { return MethodInfo(); } +bool NativeScript::is_valid() const { + return true; +} + bool NativeScript::is_tool() const { NativeScriptDesc *script_data = get_script_desc(); diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 51370f5fbf..e6f3c06ee5 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -160,6 +160,7 @@ public: virtual MethodInfo get_method_info(const StringName &p_method) const; virtual bool is_tool() const; + virtual bool is_valid() const; virtual ScriptLanguage *get_language() const; diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h index 31c6c4d67f..3ade8ac004 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.h +++ b/modules/gdnative/pluginscript/pluginscript_script.h @@ -102,6 +102,7 @@ public: PropertyInfo get_property_info(const StringName &p_property) const; bool is_tool() const { return _tool; } + bool is_valid() const { return true; } virtual ScriptLanguage *get_language() const; diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 1f5f5035f9..538249c8e2 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -867,7 +867,6 @@ bool GDScript::has_script_signal(const StringName &p_signal) const { else if (base_cache.is_valid()) { return base_cache->has_script_signal(p_signal); } - #endif return false; } diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index f344beba9f..752d660ffb 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -141,7 +141,7 @@ protected: static void _bind_methods(); public: - bool is_valid() const { return valid; } + virtual bool is_valid() const { return valid; } const Map<StringName, Ref<GDScript> > &get_subclasses() const { return subclasses; } const Map<StringName, Variant> &get_constants() const { return constants; } diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 700e518cfc..0a54ed5fbd 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2571,6 +2571,10 @@ void CSharpScript::update_exports() { #endif } +bool CSharpScript::is_valid() const { + return true; //TODO return false if invalid +} + bool CSharpScript::has_script_signal(const StringName &p_signal) const { if (_signals.has(p_signal)) return true; diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index fc604df2a0..871d4d7e4c 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -158,6 +158,8 @@ public: virtual void update_exports(); virtual bool is_tool() const { return tool; } + virtual bool is_valid() const; + virtual Ref<Script> get_base_script() const; virtual ScriptLanguage *get_language() const; diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index 186e9e63b1..5b3b3a6769 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -981,6 +981,10 @@ bool VisualScript::is_tool() const { return false; } +bool VisualScript::is_valid() const { + return true; //always valid +} + ScriptLanguage *VisualScript::get_language() const { return VisualScriptLanguage::singleton; diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h index bd666447a3..cdc9159a73 100644 --- a/modules/visual_script/visual_script.h +++ b/modules/visual_script/visual_script.h @@ -341,6 +341,7 @@ public: virtual Error reload(bool p_keep_state = false); virtual bool is_tool() const; + virtual bool is_valid() const; virtual ScriptLanguage *get_language() const; |