Merge pull request #73847 from smix8/fix_shapecast3d_exception_functions_4.x
Fix ShapeCast3D add and remove exception functions
This commit is contained in:
commit
e849f07335
|
@ -14,7 +14,7 @@
|
||||||
<methods>
|
<methods>
|
||||||
<method name="add_exception">
|
<method name="add_exception">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="node" type="Object" />
|
<param index="0" name="node" type="CollisionObject3D" />
|
||||||
<description>
|
<description>
|
||||||
Adds a collision exception so the shape does not report collisions with the specified [CollisionObject3D] node.
|
Adds a collision exception so the shape does not report collisions with the specified [CollisionObject3D] node.
|
||||||
</description>
|
</description>
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
</method>
|
</method>
|
||||||
<method name="remove_exception">
|
<method name="remove_exception">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="node" type="Object" />
|
<param index="0" name="node" type="CollisionObject3D" />
|
||||||
<description>
|
<description>
|
||||||
Removes a collision exception so the shape does report collisions with the specified [CollisionObject3D] node.
|
Removes a collision exception so the shape does report collisions with the specified [CollisionObject3D] node.
|
||||||
</description>
|
</description>
|
||||||
|
|
|
@ -437,26 +437,18 @@ void ShapeCast3D::add_exception_rid(const RID &p_rid) {
|
||||||
exclude.insert(p_rid);
|
exclude.insert(p_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeCast3D::add_exception(const Object *p_object) {
|
void ShapeCast3D::add_exception(const CollisionObject3D *p_node) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D.");
|
||||||
const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object);
|
add_exception_rid(p_node->get_rid());
|
||||||
if (!co) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_exception_rid(co->get_rid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeCast3D::remove_exception_rid(const RID &p_rid) {
|
void ShapeCast3D::remove_exception_rid(const RID &p_rid) {
|
||||||
exclude.erase(p_rid);
|
exclude.erase(p_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeCast3D::remove_exception(const Object *p_object) {
|
void ShapeCast3D::remove_exception(const CollisionObject3D *p_node) {
|
||||||
ERR_FAIL_NULL(p_object);
|
ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D.");
|
||||||
const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object);
|
remove_exception_rid(p_node->get_rid());
|
||||||
if (!co) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
remove_exception_rid(co->get_rid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeCast3D::clear_exceptions() {
|
void ShapeCast3D::clear_exceptions() {
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "scene/3d/node_3d.h"
|
#include "scene/3d/node_3d.h"
|
||||||
#include "scene/resources/shape_3d.h"
|
#include "scene/resources/shape_3d.h"
|
||||||
|
|
||||||
|
class CollisionObject3D;
|
||||||
|
|
||||||
class ShapeCast3D : public Node3D {
|
class ShapeCast3D : public Node3D {
|
||||||
GDCLASS(ShapeCast3D, Node3D);
|
GDCLASS(ShapeCast3D, Node3D);
|
||||||
|
|
||||||
|
@ -133,9 +135,9 @@ public:
|
||||||
bool is_colliding() const;
|
bool is_colliding() const;
|
||||||
|
|
||||||
void add_exception_rid(const RID &p_rid);
|
void add_exception_rid(const RID &p_rid);
|
||||||
void add_exception(const Object *p_object);
|
void add_exception(const CollisionObject3D *p_node);
|
||||||
void remove_exception_rid(const RID &p_rid);
|
void remove_exception_rid(const RID &p_rid);
|
||||||
void remove_exception(const Object *p_object);
|
void remove_exception(const CollisionObject3D *p_node);
|
||||||
void clear_exceptions();
|
void clear_exceptions();
|
||||||
|
|
||||||
virtual PackedStringArray get_configuration_warnings() const override;
|
virtual PackedStringArray get_configuration_warnings() const override;
|
||||||
|
|
Loading…
Reference in New Issue