diff options
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/collision_object_2d.cpp | 2 | ||||
-rw-r--r-- | scene/2d/cpu_particles_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/cpu_particles_2d.h | 4 | ||||
-rw-r--r-- | scene/2d/particles_2d.cpp | 9 | ||||
-rw-r--r-- | scene/2d/particles_2d.h | 8 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 33 | ||||
-rw-r--r-- | scene/2d/ray_cast_2d.cpp | 2 |
7 files changed, 41 insertions, 21 deletions
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 1e2184bd41..7ade74e8a6 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -384,7 +384,7 @@ void CollisionObject2D::_bind_methods() { BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "viewport"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx"))); - ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "viewport"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx"))); + ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "viewport", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx"))); ADD_SIGNAL(MethodInfo("mouse_entered")); ADD_SIGNAL(MethodInfo("mouse_exited")); diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index 136d41e2f9..a8e0f0d07f 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -30,9 +30,7 @@ #include "cpu_particles_2d.h" -#include "scene/3d/particles.h" -#include "scene/main/viewport.h" -#include "scene/resources/surface_tool.h" +//#include "scene/resources/particles_material.h" #include "servers/visual_server.h" void CPUParticles2D::set_emitting(bool p_emitting) { diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index fa8e6b54ef..dbe9f59748 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -30,10 +30,10 @@ #ifndef CPU_PARTICLES_2D_H #define CPU_PARTICLES_2D_H + #include "rid.h" #include "scene/2d/node_2d.h" -#include "scene/main/timer.h" -#include "scene/resources/material.h" +#include "scene/resources/texture.h" /** @author Juan Linietsky <reduzio@gmail.com> diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index a4c3057416..7e824cdf75 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -30,10 +30,13 @@ #include "particles_2d.h" -#include "engine.h" -#include "scene/3d/particles.h" +#include "scene/resources/particles_material.h" #include "scene/scene_string_names.h" +#ifdef TOOLS_ENABLED +#include "core/engine.h" +#endif + void Particles2D::set_emitting(bool p_emitting) { VS::get_singleton()->particles_set_emitting(particles, p_emitting); @@ -114,7 +117,7 @@ void Particles2D::set_process_material(const Ref<Material> &p_material) { process_material = p_material; Ref<ParticlesMaterial> pm = p_material; if (pm.is_valid() && !pm->get_flag(ParticlesMaterial::FLAG_DISABLE_Z) && pm->get_gravity() == Vector3(0, -9.8, 0)) { - //likely a new material, modify it! + // Likely a new (3D) material, modify it to match 2D space pm->set_flag(ParticlesMaterial::FLAG_DISABLE_Z, true); pm->set_gravity(Vector3(0, 98, 0)); } diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h index 31a66afb2a..816149ba79 100644 --- a/scene/2d/particles_2d.h +++ b/scene/2d/particles_2d.h @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef PARTICLES_FRAME_H -#define PARTICLES_FRAME_H +#ifndef PARTICLES_2D_H +#define PARTICLES_2D_H +#include "rid.h" #include "scene/2d/node_2d.h" -#include "scene/resources/color_ramp.h" #include "scene/resources/texture.h" class Particles2D : public Node2D { @@ -132,4 +132,4 @@ public: VARIANT_ENUM_CAST(Particles2D::DrawOrder) -#endif // PARTICLES_FRAME_H +#endif // PARTICLES_2D_H diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 1ac7799ec5..dc93414669 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -180,6 +180,10 @@ real_t StaticBody2D::get_constant_angular_velocity() const { #ifndef DISABLE_DEPRECATED void StaticBody2D::set_friction(real_t p_friction) { + if (p_friction == 1.0) { // default value, don't create an override for that + return; + } + ERR_EXPLAIN("The method set_friction has been deprecated and will be removed in the future, use physics material instead.") WARN_DEPRECATED @@ -206,6 +210,10 @@ real_t StaticBody2D::get_friction() const { void StaticBody2D::set_bounce(real_t p_bounce) { + if (p_bounce == 0.0) { // default value, don't create an override for that + return; + } + ERR_EXPLAIN("The method set_bounce has been deprecated and will be removed in the future, use physics material instead.") WARN_DEPRECATED @@ -275,7 +283,7 @@ void StaticBody2D::_bind_methods() { ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_friction", "get_friction"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_bounce", "get_bounce"); #endif // DISABLE_DEPRECATED - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material_override", "get_physics_material_override"); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material_override", "get_physics_material_override"); } StaticBody2D::StaticBody2D() : @@ -396,13 +404,13 @@ void RigidBody2D::_body_inout(int p_status, ObjectID p_instance, int p_body_shap node->disconnect(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree); node->disconnect(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree); if (in_scene) - emit_signal(SceneStringNames::get_singleton()->body_exited, obj); + emit_signal(SceneStringNames::get_singleton()->body_exited, node); } contact_monitor->body_map.erase(E); } if (node && in_scene) { - emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, obj, p_body_shape, p_local_shape); + emit_signal(SceneStringNames::get_singleton()->body_shape_exited, objid, node, p_body_shape, p_local_shape); } } } @@ -599,8 +607,13 @@ real_t RigidBody2D::get_weight() const { #ifndef DISABLE_DEPRECATED void RigidBody2D::set_friction(real_t p_friction) { + if (p_friction == 1.0) { // default value, don't create an override for that + return; + } + ERR_EXPLAIN("The method set_friction has been deprecated and will be removed in the future, use physics material instead.") WARN_DEPRECATED + ERR_FAIL_COND(p_friction < 0 || p_friction > 1); if (physics_material_override.is_null()) { @@ -623,6 +636,10 @@ real_t RigidBody2D::get_friction() const { void RigidBody2D::set_bounce(real_t p_bounce) { + if (p_bounce == 0.0) { // default value, don't create an override for that + return; + } + ERR_EXPLAIN("The method set_bounce has been deprecated and will be removed in the future, use physics material instead.") WARN_DEPRECATED @@ -1028,7 +1045,7 @@ void RigidBody2D::_bind_methods() { ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "friction", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_friction", "get_friction"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "bounce", PROPERTY_HINT_RANGE, "0,1,0.01", 0), "set_bounce", "get_bounce"); #endif // DISABLE_DEPRECATED - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material_override", "get_physics_material_override"); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material_override", "get_physics_material_override"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "gravity_scale", PROPERTY_HINT_RANGE, "-128,128,0.01"), "set_gravity_scale", "get_gravity_scale"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "custom_integrator"), "set_use_custom_integrator", "is_using_custom_integrator"); ADD_PROPERTY(PropertyInfo(Variant::INT, "continuous_cd", PROPERTY_HINT_ENUM, "Disabled,Cast Ray,Cast Shape"), "set_continuous_collision_detection_mode", "get_continuous_collision_detection_mode"); @@ -1046,10 +1063,10 @@ void RigidBody2D::_bind_methods() { ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "applied_force"), "set_applied_force", "get_applied_force"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "applied_torque"), "set_applied_torque", "get_applied_torque"); - ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape"))); - ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape"))); - ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body"))); - ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body"))); + ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape"))); + ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "local_shape"))); + ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); + ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); ADD_SIGNAL(MethodInfo("sleeping_state_changed")); BIND_ENUM_CONSTANT(MODE_RIGID); diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 9582c08110..d9b3cb07fc 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -218,6 +218,8 @@ void RayCast2D::_update_raycast_state() { against_shape = rr.shape; } else { collided = false; + against = 0; + against_shape = 0; } } |