Skip to content

Commit

Permalink
Changed name of the protectedDeletion feature to manualDeletion
Browse files Browse the repository at this point in the history
  • Loading branch information
erayzesen committed Jan 21, 2025
1 parent d177b9a commit e0edeaa
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 57 deletions.
Binary file modified .sconsign.dblite
Binary file not shown.
10 changes: 5 additions & 5 deletions project/examples/7_classic_platformer/main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ key w: jump
"
label_settings = SubResource("LabelSettings_2ckbs")

[node name="QWorldNode" type="QWorldNode" parent="."]
debug_renderer = false
enable_debug_mouse_interactions = true
script = ExtResource("4_5rs6g")

[node name="DoorButton" type="QRigidBodyNode" parent="." node_paths=PackedStringArray("door")]
fixed_rotation = true
mass = 0.1
Expand Down Expand Up @@ -331,11 +336,6 @@ data_uv_maps = Array[PackedInt32Array]([PackedInt32Array(0, 1, 3), PackedInt32Ar
layers = 3
position = Vector2(845, 410)

[node name="QWorldNode" type="QWorldNode" parent="."]
debug_renderer = false
enable_debug_mouse_interactions = true
script = ExtResource("4_5rs6g")

[node name="Coins" type="Node2D" parent="."]

[node name="Coin1" type="QAreaBodyNode" parent="Coins"]
Expand Down
23 changes: 0 additions & 23 deletions project/examples/7_classic_platformer/plant.gd

This file was deleted.

2 changes: 1 addition & 1 deletion src/QuarkPhysics/qbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ QBody::~QBody()
{
for(int i=0;i<_meshes.size();i++){
if (_meshes[i]!=nullptr){
if (_meshes[i]->deleteProtected==false){
if (_meshes[i]->manualDeletion==false){
delete _meshes[i];
_meshes[i]=nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/QuarkPhysics/qbody.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ class QBody{
/**
* By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
*/
bool deleteProtected=false;
bool manualDeletion=false;


friend class QMesh;
Expand Down
2 changes: 1 addition & 1 deletion src/QuarkPhysics/qjoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class QJoint
/**
* By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
*/
bool deleteProtected=false;
bool manualDeletion=false;

friend class QWorld;

Expand Down
4 changes: 2 additions & 2 deletions src/QuarkPhysics/qmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ QMesh::~QMesh()
{
for(int i=0;i<particles.size();i++){
if (particles[i]!=nullptr){
if(particles[i]->deleteProtected==false ){
if(particles[i]->manualDeletion==false ){
delete particles[i];
particles[i]=nullptr;
}
Expand All @@ -54,7 +54,7 @@ QMesh::~QMesh()

for(int i=0;i<springs.size();i++){
if(springs[i]!=nullptr){
if(springs[i]->deleteProtected==false){
if(springs[i]->manualDeletion==false){
delete springs[i];
springs[i]=nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/QuarkPhysics/qmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ struct QMesh
/**
* By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
*/
bool deleteProtected=false;
bool manualDeletion=false;



Expand Down
2 changes: 1 addition & 1 deletion src/QuarkPhysics/qparticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class QParticle
/**
* By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
*/
bool deleteProtected=false;
bool manualDeletion=false;


friend class QMesh;
Expand Down
2 changes: 1 addition & 1 deletion src/QuarkPhysics/qraycast.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class QRaycast
/**
* By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
*/
bool deleteProtected=false;
bool manualDeletion=false;


friend class QWorld;
Expand Down
2 changes: 1 addition & 1 deletion src/QuarkPhysics/qspring.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class QSpring
/**
* By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
*/
bool deleteProtected=false;
bool manualDeletion=false;



Expand Down
8 changes: 4 additions & 4 deletions src/QuarkPhysics/qworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ vector<QManifold> QWorld::TestCollisionWithWorld(QBody *body)
void QWorld::ClearBodies(){
for(int i=0;i<bodies.size();i++){
if (bodies[i]!=nullptr){
if(bodies[i]->deleteProtected==false ){
if(bodies[i]->manualDeletion==false ){
delete bodies[i];
bodies[i]=nullptr;
}
Expand All @@ -648,7 +648,7 @@ void QWorld::ClearBodies(){
QWorld* QWorld::ClearJoints(){
for(int i=0;i<joints.size();i++){
if (joints[i]!=nullptr){
if(joints[i]->deleteProtected==false ){
if(joints[i]->manualDeletion==false ){
delete joints[i];
joints[i]=nullptr;
}
Expand All @@ -662,7 +662,7 @@ QWorld* QWorld::ClearSprings()
{
for(int i=0;i<springs.size();i++){
if (springs[i]!=nullptr){
if(springs[i]->deleteProtected==false){
if(springs[i]->manualDeletion==false){
delete springs[i];
springs[i]=nullptr;
}
Expand All @@ -676,7 +676,7 @@ QWorld* QWorld::ClearRaycasts()
{
for(int i=0;i<raycasts.size();i++){
if (raycasts[i]!=nullptr){
if(raycasts[i]->deleteProtected ==false ){
if(raycasts[i]->manualDeletion ==false ){
delete raycasts[i];
raycasts[i]=nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/qareabody_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class QAreaBodyNode : public QBodyNode {
QAreaBodyNode(){
QAreaBody *areaBodyObject=new QAreaBody();
bodyObject=areaBodyObject;
bodyObject->deleteProtected=true;
bodyObject->manualDeletion=true;
bodyNodeType=QBodyNode::bodyNodeTypes::AREA;
init_events();
//Area Body Events
Expand Down
20 changes: 16 additions & 4 deletions src/qbody_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,21 @@ void QBodyNode::on_post_enter_tree() {
worldNode=(QWorldNode*)root_world_node;
}
}else{
godot::UtilityFunctions::printerr("Quark Physics Error: Physics needs a world! Add a QWorldNode to the root node of the scene. ");

return;
Node *matchedWorldNode=nullptr;
for(size_t i=0;i<root->get_child_count();++i){
Node * child=root->get_child(i);
if (child->is_class("QWorldNode") ){
matchedWorldNode=child;
break;
}
}
if(matchedWorldNode==nullptr){
godot::UtilityFunctions::printerr("Quark Physics Error: Physics needs a world! Add a QWorldNode to the root node of the current scene. ");

return;
}else{
worldNode=(QWorldNode*)matchedWorldNode;
}
}
}

Expand All @@ -70,7 +82,7 @@ void QBodyNode::on_post_enter_tree() {

}
worldNode->add_body(this);
bodyObject->deleteProtected=true;
bodyObject->manualDeletion=true;
isConfigured=true;

}
Expand Down
2 changes: 1 addition & 1 deletion src/qjoint_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class QJointObject: public RefCounted{
public:
QJointObject(){
jointObject=new QJoint(nullptr,QVector(0,0),QVector(0,0),nullptr);
jointObject->deleteProtected=true;
jointObject->manualDeletion=true;
};
~QJointObject(){
if(jointObject!=nullptr){
Expand Down
4 changes: 2 additions & 2 deletions src/qmesh_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,14 +615,14 @@ void QMeshNode::on_post_enter_tree() {
update_mesh_node_data();
QMesh::MeshData qData=convert_mesh_node_data_to_mesh_data();
meshObject=QMesh::CreateWithMeshData( qData );
meshObject->deleteProtected=true;
meshObject->manualDeletion=true;



}else{
QMesh::MeshData qData=convert_mesh_node_data_to_mesh_data();
meshObject=QMesh::CreateWithMeshData(qData ) ;
meshObject->deleteProtected=true;
meshObject->manualDeletion=true;

}
//Creating object and node versions of the mesh
Expand Down
4 changes: 2 additions & 2 deletions src/qparticle_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class QParticleObject: public RefCounted{
public:
QParticleObject(){
particleObject=new QParticle();
particleObject->deleteProtected=true;
particleObject->manualDeletion=true;
};
QParticleObject(QParticle *obj){
particleObject=obj;
particleObject->deleteProtected=true;
particleObject->manualDeletion=true;
};
Ref<QParticleObject> configure(Vector2 position,float radius){
set_position(position);
Expand Down
2 changes: 1 addition & 1 deletion src/qplatformerbody_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class QPlatformerBodyNode : public QRigidBodyNode {
public:
QPlatformerBodyNode(){
bodyObject=new QPlatformerBody();
bodyObject->deleteProtected=true;
bodyObject->manualDeletion=true;
bodyNodeType=QBodyNode::bodyNodeTypes::RIGID;
init_events();
};
Expand Down
2 changes: 1 addition & 1 deletion src/qraycast_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class QRaycastObject: public RefCounted{
public:
QRaycastObject(){
raycastObject=new QRaycast(QVector::Zero(),QVector::Zero(),false);
raycastObject->deleteProtected=true;
raycastObject->manualDeletion=true;
};
~QRaycastObject(){
if(raycastObject!=nullptr){
Expand Down
2 changes: 1 addition & 1 deletion src/qrigidbody_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class QRigidBodyNode : public QBodyNode {
public:
QRigidBodyNode(){
bodyObject=new QRigidBody();
bodyObject->deleteProtected=true;
bodyObject->manualDeletion=true;
bodyNodeType=QBodyNode::bodyNodeTypes::RIGID;
init_events();
};
Expand Down
2 changes: 1 addition & 1 deletion src/qsoftbody_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class QSoftBodyNode : public QBodyNode {
public:
QSoftBodyNode(){
bodyObject=new QSoftBody();
bodyObject->deleteProtected=true;
bodyObject->manualDeletion=true;
bodyNodeType=QBodyNode::bodyNodeTypes::SOFT;
init_events();
};
Expand Down
4 changes: 2 additions & 2 deletions src/qspring_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class QSpringObject: public RefCounted{
public:
QSpringObject(){
springObject=new QSpring(nullptr,nullptr,0.0f,false);
springObject->deleteProtected=true;
springObject->manualDeletion=true;
};
QSpringObject(QSpring *obj){
springObject=obj;
springObject->deleteProtected=true;
springObject->manualDeletion=true;
};
~QSpringObject(){
if(springObject!=nullptr){
Expand Down
1 change: 1 addition & 0 deletions src/qworld_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class QWorldNode: public Node2D{
spatialHashing=new QSpatialHashing(worldObject->bodies,cellSize);
};
~QWorldNode(){

if(worldObject!=nullptr){
delete worldObject;
worldObject=nullptr;
Expand Down

0 comments on commit e0edeaa

Please sign in to comment.