diff options
Diffstat (limited to 'scene/3d')
30 files changed, 231 insertions, 222 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 6abc2caac8..1ae6f552f4 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -215,7 +215,7 @@ void AudioStreamPlayer3D::_notification(int p_what) { velocity_tracker->reset(get_global_transform().origin); AudioServer::get_singleton()->add_callback(_mix_audios, this); - if (autoplay && !get_tree()->is_editor_hint()) { + if (autoplay && !Engine::get_singleton()->is_editor_hint()) { play(); } } @@ -888,16 +888,16 @@ void AudioStreamPlayer3D::_bind_methods() { ADD_GROUP("Doppler", "doppler_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "doppler_tracking", PROPERTY_HINT_ENUM, "Disabled,Idle,Fixed"), "set_doppler_tracking", "get_doppler_tracking"); - BIND_CONSTANT(ATTENUATION_INVERSE_DISTANCE); - BIND_CONSTANT(ATTENUATION_INVERSE_SQUARE_DISTANCE); - BIND_CONSTANT(ATTENUATION_LOGARITHMIC); + BIND_ENUM_CONSTANT(ATTENUATION_INVERSE_DISTANCE); + BIND_ENUM_CONSTANT(ATTENUATION_INVERSE_SQUARE_DISTANCE); + BIND_ENUM_CONSTANT(ATTENUATION_LOGARITHMIC); - BIND_CONSTANT(OUT_OF_RANGE_MIX); - BIND_CONSTANT(OUT_OF_RANGE_PAUSE); + BIND_ENUM_CONSTANT(OUT_OF_RANGE_MIX); + BIND_ENUM_CONSTANT(OUT_OF_RANGE_PAUSE); - BIND_CONSTANT(DOPPLER_TRACKING_DISABLED); - BIND_CONSTANT(DOPPLER_TRACKING_IDLE_STEP); - BIND_CONSTANT(DOPPLER_TRACKING_FIXED_STEP); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP); + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP); } AudioStreamPlayer3D::AudioStreamPlayer3D() { diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 3c5eb21d38..9db7253fd6 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -564,15 +564,15 @@ void Camera::_bind_methods() { ClassDB::bind_method(D_METHOD("get_doppler_tracking"), &Camera::get_doppler_tracking); //ClassDB::bind_method(D_METHOD("_camera_make_current"),&Camera::_camera_make_current ); - BIND_CONSTANT(PROJECTION_PERSPECTIVE); - BIND_CONSTANT(PROJECTION_ORTHOGONAL); + BIND_ENUM_CONSTANT(PROJECTION_PERSPECTIVE); + BIND_ENUM_CONSTANT(PROJECTION_ORTHOGONAL); - BIND_CONSTANT(KEEP_WIDTH); - BIND_CONSTANT(KEEP_HEIGHT); + BIND_ENUM_CONSTANT(KEEP_WIDTH); + BIND_ENUM_CONSTANT(KEEP_HEIGHT); - BIND_CONSTANT(DOPPLER_TRACKING_DISABLED) - BIND_CONSTANT(DOPPLER_TRACKING_IDLE_STEP) - BIND_CONSTANT(DOPPLER_TRACKING_FIXED_STEP) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_DISABLED) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_IDLE_STEP) + BIND_ENUM_CONSTANT(DOPPLER_TRACKING_FIXED_STEP) } float Camera::get_fov() const { diff --git a/scene/3d/camera.h b/scene/3d/camera.h index 43975892b4..70849791e5 100644 --- a/scene/3d/camera.h +++ b/scene/3d/camera.h @@ -126,9 +126,9 @@ public: virtual Transform get_camera_transform() const; - Vector3 project_ray_normal(const Point2 &p_point) const; - Vector3 project_ray_origin(const Point2 &p_point) const; - Vector3 project_local_ray_normal(const Point2 &p_point) const; + Vector3 project_ray_normal(const Point2 &p_pos) const; + Vector3 project_ray_origin(const Point2 &p_pos) const; + Vector3 project_local_ray_normal(const Point2 &p_pos) const; Point2 unproject_position(const Vector3 &p_pos) const; bool is_position_behind(const Vector3 &p_pos) const; Vector3 project_position(const Point2 &p_point) const; diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp index 065e21fccd..ce047f91c2 100644 --- a/scene/3d/character_camera.cpp +++ b/scene/3d/character_camera.cpp @@ -659,8 +659,8 @@ void CharacterCamera::_bind_methods() { ClassDB::bind_method(D_METHOD("_ray_collision"),&CharacterCamera::_ray_collision); - BIND_CONSTANT( CAMERA_FIXED ); - BIND_CONSTANT( CAMERA_FOLLOW ); + BIND_ENUM_CONSTANT( CAMERA_FIXED ); + BIND_ENUM_CONSTANT( CAMERA_FOLLOW ); } void CharacterCamera::_ray_collision(Vector3 p_point, Vector3 p_normal, int p_subindex, ObjectID p_against,int p_idx) { diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index 4fd215bd1a..2aa6a95718 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -89,13 +89,6 @@ void CollisionShape::_notification(int p_what) { parent->shape_owner_set_transform(owner_id, get_transform()); } } break; - case NOTIFICATION_EXIT_TREE: { - if (parent) { - parent->remove_shape_owner(owner_id); - } - owner_id = 0; - parent = NULL; - } break; case NOTIFICATION_UNPARENTED: { if (parent) { parent->remove_shape_owner(owner_id); diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 2174f924ac..460580d4fe 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1488,10 +1488,10 @@ void GIProbe::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData"), "set_probe_data", "get_probe_data"); - BIND_CONSTANT(SUBDIV_64); - BIND_CONSTANT(SUBDIV_128); - BIND_CONSTANT(SUBDIV_256); - BIND_CONSTANT(SUBDIV_MAX); + BIND_ENUM_CONSTANT(SUBDIV_64); + BIND_ENUM_CONSTANT(SUBDIV_128); + BIND_ENUM_CONSTANT(SUBDIV_256); + BIND_ENUM_CONSTANT(SUBDIV_MAX); } GIProbe::GIProbe() { diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 2eb4bf1e6b..bc8452c7e0 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -52,8 +52,8 @@ public: void set_normal(const Vector3 &p_normal); void set_tangent(const Plane &p_tangent); void set_color(const Color &p_color); - void set_uv(const Vector2 &tex_uv); - void set_uv2(const Vector2 &tex_uv); + void set_uv(const Vector2 &p_uv); + void set_uv2(const Vector2 &p_uv2); void add_vertex(const Vector3 &p_vertex); diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 36a6660bf9..a481018890 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -29,12 +29,14 @@ /*************************************************************************/ #include "interpolated_camera.h" +#include "engine.h" + void InterpolatedCamera::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - if (get_tree()->is_editor_hint() && enabled) + if (Engine::get_singleton()->is_editor_hint() && enabled) set_fixed_process(false); } break; @@ -106,7 +108,7 @@ void InterpolatedCamera::set_interpolation_enabled(bool p_enable) { return; enabled = p_enable; if (p_enable) { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) return; set_process(true); } else diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 977f1f81a7..f4b5cc5731 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "light.h" +#include "engine.h" #include "project_settings.h" #include "scene/resources/surface_tool.h" @@ -106,6 +107,16 @@ Color Light::get_shadow_color() const { return shadow_color; } +void Light::set_shadow_reverse_cull_face(bool p_enable) { + reverse_cull = p_enable; + VS::get_singleton()->light_set_reverse_cull_face_mode(light, reverse_cull); +} + +bool Light::get_shadow_reverse_cull_face() const { + + return reverse_cull; +} + Rect3 Light::get_aabb() const { if (type == VisualServer::LIGHT_DIRECTIONAL) { @@ -140,7 +151,7 @@ void Light::_update_visibility() { #ifdef TOOLS_ENABLED if (editor_only) { - if (!get_tree()->is_editor_hint()) { + if (!Engine::get_singleton()->is_editor_hint()) { editor_ok = false; } else { editor_ok = (get_tree()->get_edited_scene_root() && (this == get_tree()->get_edited_scene_root() || get_owner() == get_tree()->get_edited_scene_root())); @@ -202,6 +213,9 @@ void Light::_bind_methods() { ClassDB::bind_method(D_METHOD("set_color", "color"), &Light::set_color); ClassDB::bind_method(D_METHOD("get_color"), &Light::get_color); + ClassDB::bind_method(D_METHOD("set_shadow_reverse_cull_face", "enable"), &Light::set_shadow_reverse_cull_face); + ClassDB::bind_method(D_METHOD("get_shadow_reverse_cull_face"), &Light::get_shadow_reverse_cull_face); + ClassDB::bind_method(D_METHOD("set_shadow_color", "shadow_color"), &Light::set_shadow_color); ClassDB::bind_method(D_METHOD("get_shadow_color"), &Light::get_shadow_color); @@ -217,25 +231,26 @@ void Light::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_bias", PROPERTY_HINT_RANGE, "-16,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_contact", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_CONTACT_SHADOW_SIZE); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "shadow_max_distance", PROPERTY_HINT_RANGE, "0,65536,0.1"), "set_param", "get_param", PARAM_SHADOW_MAX_DISTANCE); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shadow_reverse_cull_face"), "set_shadow_reverse_cull_face", "get_shadow_reverse_cull_face"); ADD_GROUP("Editor", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_only"), "set_editor_only", "is_editor_only"); ADD_GROUP("", ""); - BIND_CONSTANT(PARAM_ENERGY); - BIND_CONSTANT(PARAM_SPECULAR); - BIND_CONSTANT(PARAM_RANGE); - BIND_CONSTANT(PARAM_ATTENUATION); - BIND_CONSTANT(PARAM_SPOT_ANGLE); - BIND_CONSTANT(PARAM_SPOT_ATTENUATION); - BIND_CONSTANT(PARAM_CONTACT_SHADOW_SIZE); - BIND_CONSTANT(PARAM_SHADOW_MAX_DISTANCE); - BIND_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET); - BIND_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET); - BIND_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET); - BIND_CONSTANT(PARAM_SHADOW_NORMAL_BIAS); - BIND_CONSTANT(PARAM_SHADOW_BIAS); + BIND_ENUM_CONSTANT(PARAM_ENERGY); + BIND_ENUM_CONSTANT(PARAM_SPECULAR); + BIND_ENUM_CONSTANT(PARAM_RANGE); + BIND_ENUM_CONSTANT(PARAM_ATTENUATION); + BIND_ENUM_CONSTANT(PARAM_SPOT_ANGLE); + BIND_ENUM_CONSTANT(PARAM_SPOT_ATTENUATION); + BIND_ENUM_CONSTANT(PARAM_CONTACT_SHADOW_SIZE); + BIND_ENUM_CONSTANT(PARAM_SHADOW_MAX_DISTANCE); + BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_1_OFFSET); + BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_2_OFFSET); + BIND_ENUM_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET); + BIND_ENUM_CONSTANT(PARAM_SHADOW_NORMAL_BIAS); + BIND_ENUM_CONSTANT(PARAM_SHADOW_BIAS); - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_MAX); } Light::Light(VisualServer::LightType p_type) { @@ -244,6 +259,8 @@ Light::Light(VisualServer::LightType p_type) { light = VisualServer::get_singleton()->light_create(p_type); VS::get_singleton()->instance_set_base(get_instance(), light); + reverse_cull = false; + editor_only = false; set_color(Color(1, 1, 1, 1)); set_shadow(false); @@ -318,9 +335,9 @@ void DirectionalLight::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional_shadow_blend_splits"), "set_blend_splits", "is_blend_splits_enabled"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS); - BIND_CONSTANT(SHADOW_ORTHOGONAL); - BIND_CONSTANT(SHADOW_PARALLEL_2_SPLITS); - BIND_CONSTANT(SHADOW_PARALLEL_4_SPLITS); + BIND_ENUM_CONSTANT(SHADOW_ORTHOGONAL); + BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS); + BIND_ENUM_CONSTANT(SHADOW_PARALLEL_4_SPLITS); } DirectionalLight::DirectionalLight() diff --git a/scene/3d/light.h b/scene/3d/light.h index 22ff5c0763..788e948536 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -69,6 +69,7 @@ private: Color shadow_color; bool shadow; bool negative; + bool reverse_cull; uint32_t cull_mask; VS::LightType type; bool editor_only; @@ -110,6 +111,9 @@ public: void set_shadow_color(const Color &p_shadow_color); Color get_shadow_color() const; + void set_shadow_reverse_cull_face(bool p_enable); + bool get_shadow_reverse_cull_face() const; + virtual Rect3 get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 4c93bcfb5e..5d4568f5d3 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -208,6 +208,8 @@ void NavigationMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("get_polygon", "idx"), &NavigationMesh::get_polygon); ClassDB::bind_method(D_METHOD("clear_polygons"), &NavigationMesh::clear_polygons); + ClassDB::bind_method(D_METHOD("create_from_mesh", "mesh"), &NavigationMesh::create_from_mesh); + ClassDB::bind_method(D_METHOD("_set_polygons", "polygons"), &NavigationMesh::_set_polygons); ClassDB::bind_method(D_METHOD("_get_polygons"), &NavigationMesh::_get_polygons); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 081caf4419..70f46e3a0a 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -63,6 +63,8 @@ void Particles::set_one_shot(bool p_one_shot) { one_shot = p_one_shot; VS::get_singleton()->particles_set_one_shot(particles, one_shot); + if (!one_shot && emitting) + VisualServer::get_singleton()->particles_restart(particles); } void Particles::set_pre_process_time(float p_time) { @@ -345,9 +347,10 @@ void Particles::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "draw_pass_" + itos(i + 1), PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_draw_pass_mesh", "get_draw_pass_mesh", i); } - BIND_CONSTANT(DRAW_ORDER_INDEX); - BIND_CONSTANT(DRAW_ORDER_LIFETIME); - BIND_CONSTANT(DRAW_ORDER_VIEW_DEPTH); + BIND_ENUM_CONSTANT(DRAW_ORDER_INDEX); + BIND_ENUM_CONSTANT(DRAW_ORDER_LIFETIME); + BIND_ENUM_CONSTANT(DRAW_ORDER_VIEW_DEPTH); + BIND_CONSTANT(MAX_DRAW_PASSES); } @@ -406,7 +409,7 @@ void ParticlesMaterial::init_shaders() { shader_names->anim_speed = "anim_speed"; shader_names->anim_offset = "anim_offset"; - shader_names->initial_linear_velocity = "initial_linear_velocity_random"; + shader_names->initial_linear_velocity_random = "initial_linear_velocity_random"; shader_names->initial_angle_random = "initial_angle_random"; shader_names->angular_velocity_random = "angular_velocity_random"; shader_names->orbit_velocity_random = "orbit_velocity_random"; @@ -753,18 +756,20 @@ void ParticlesMaterial::_update_shader() { code += " pos.z=0.0; \n"; } code += " //apply linear acceleration\n"; - code += " force+=normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random);\n"; + code += " force+= length(VELOCITY) > 0.0 ? normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random) : vec3(0.0);\n"; code += " //apply radial acceleration\n"; code += " vec3 org = vec3(0.0);\n"; - code += " // if (!p_system->local_coordinates)\n"; - code += " //org=p_transform.origin;\n"; - code += " force+=normalize(pos-org) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random);\n"; + code += " // if (!p_system->local_coordinates)\n"; + code += " //org=p_transform.origin;\n"; + code += " vec3 diff = pos-org;\n"; + code += " force+=length(diff) > 0.0 ? normalize(diff) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random) : vec3(0.0);\n"; code += " //apply tangential acceleration;\n"; if (flags[FLAG_DISABLE_Z]) { - code += " force+=vec3(normalize((pos-org).yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n"; + code += " force+=length(diff.yx) > 0.0 ? vec3(normalize(diff.yx * vec2(-1.0,1.0)),0.0) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n"; } else { - code += " force+=normalize(cross(normalize(pos-org),normalize(gravity))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n"; + code += " vec3 crossDiff = cross(normalize(diff),normalize(gravity));\n"; + code += " force+=length(crossDiff) > 0.0 ? normalize(crossDiff) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random)) : vec3(0.0);\n"; } code += " //apply attractor forces\n"; code += " VELOCITY+=force * DELTA;\n"; @@ -1264,9 +1269,8 @@ int ParticlesMaterial::get_emission_point_count() const { void ParticlesMaterial::set_trail_divisor(int p_divisor) { - VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); trail_divisor = p_divisor; - _change_notify(); + VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->trail_divisor, p_divisor); } int ParticlesMaterial::get_trail_divisor() const { @@ -1484,29 +1488,29 @@ void ParticlesMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "anim_offset_curve", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_param_texture", "get_param_texture", PARAM_ANIM_OFFSET); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "anim_loop"), "set_flag", "get_flag", FLAG_ANIM_LOOP); - BIND_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY); - BIND_CONSTANT(PARAM_ANGULAR_VELOCITY); - BIND_CONSTANT(PARAM_ORBIT_VELOCITY); - BIND_CONSTANT(PARAM_LINEAR_ACCEL); - BIND_CONSTANT(PARAM_RADIAL_ACCEL); - BIND_CONSTANT(PARAM_TANGENTIAL_ACCEL); - BIND_CONSTANT(PARAM_DAMPING); - BIND_CONSTANT(PARAM_ANGLE); - BIND_CONSTANT(PARAM_SCALE); - BIND_CONSTANT(PARAM_HUE_VARIATION); - BIND_CONSTANT(PARAM_ANIM_SPEED); - BIND_CONSTANT(PARAM_ANIM_OFFSET); - BIND_CONSTANT(PARAM_MAX); - - BIND_CONSTANT(FLAG_ALIGN_Y_TO_VELOCITY); - BIND_CONSTANT(FLAG_ROTATE_Y); - BIND_CONSTANT(FLAG_MAX); - - BIND_CONSTANT(EMISSION_SHAPE_POINT); - BIND_CONSTANT(EMISSION_SHAPE_SPHERE); - BIND_CONSTANT(EMISSION_SHAPE_BOX); - BIND_CONSTANT(EMISSION_SHAPE_POINTS); - BIND_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); + BIND_ENUM_CONSTANT(PARAM_INITIAL_LINEAR_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_ORBIT_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ACCEL); + BIND_ENUM_CONSTANT(PARAM_RADIAL_ACCEL); + BIND_ENUM_CONSTANT(PARAM_TANGENTIAL_ACCEL); + BIND_ENUM_CONSTANT(PARAM_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGLE); + BIND_ENUM_CONSTANT(PARAM_SCALE); + BIND_ENUM_CONSTANT(PARAM_HUE_VARIATION); + BIND_ENUM_CONSTANT(PARAM_ANIM_SPEED); + BIND_ENUM_CONSTANT(PARAM_ANIM_OFFSET); + BIND_ENUM_CONSTANT(PARAM_MAX); + + BIND_ENUM_CONSTANT(FLAG_ALIGN_Y_TO_VELOCITY); + BIND_ENUM_CONSTANT(FLAG_ROTATE_Y); + BIND_ENUM_CONSTANT(FLAG_MAX); + + BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINT); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_SPHERE); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_BOX); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_POINTS); + BIND_ENUM_CONSTANT(EMISSION_SHAPE_DIRECTED_POINTS); } ParticlesMaterial::ParticlesMaterial() diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 31ca85a59a..9c1436a47b 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -88,7 +88,7 @@ public: void set_emitting(bool p_emitting); void set_amount(int p_amount); void set_lifetime(float p_lifetime); - void set_one_shot(bool p_enabled); + void set_one_shot(bool p_one_shot); void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index f8df21004e..0ca7f96fd7 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -28,11 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "path.h" + +#include "engine.h" #include "scene/scene_string_names.h" void Path::_notification(int p_what) { #if 0 - if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && get_scene()->is_editor_hint()) { + if (p_what==NOTIFICATION_DRAW && curve.is_valid() && is_inside_scene() && Engine::get_singleton()->is_editor_hint()) { //draw the curve!! for(int i=0;i<curve->get_point_count();i++) { @@ -53,7 +55,7 @@ void Path::_notification(int p_what) { void Path::_curve_changed() { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) update_gizmo(); } @@ -281,10 +283,10 @@ void PathFollow::_bind_methods() { ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow::set_loop); ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow::has_loop); - BIND_CONSTANT(ROTATION_NONE); - BIND_CONSTANT(ROTATION_Y); - BIND_CONSTANT(ROTATION_XY); - BIND_CONSTANT(ROTATION_XYZ); + BIND_ENUM_CONSTANT(ROTATION_NONE); + BIND_ENUM_CONSTANT(ROTATION_Y); + BIND_ENUM_CONSTANT(ROTATION_XY); + BIND_ENUM_CONSTANT(ROTATION_XYZ); } void PathFollow::set_offset(float p_offset) { diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index dc8f72d77e..402cd6314b 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -28,6 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "physics_body.h" + +#include "engine.h" #include "method_bind_ext.gen.inc" #include "scene/scene_string_names.h" @@ -476,13 +478,13 @@ void RigidBody::_notification(int p_what) { #ifdef TOOLS_ENABLED if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { set_notify_local_transform(true); //used for warnings and only in editor } } if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) { - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { update_configuration_warning(); } } @@ -868,10 +870,10 @@ void RigidBody::_bind_methods() { ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body"))); ADD_SIGNAL(MethodInfo("sleeping_state_changed")); - BIND_CONSTANT(MODE_STATIC); - BIND_CONSTANT(MODE_KINEMATIC); - BIND_CONSTANT(MODE_RIGID); - BIND_CONSTANT(MODE_CHARACTER); + BIND_ENUM_CONSTANT(MODE_STATIC); + BIND_ENUM_CONSTANT(MODE_KINEMATIC); + BIND_ENUM_CONSTANT(MODE_RIGID); + BIND_ENUM_CONSTANT(MODE_CHARACTER); } RigidBody::RigidBody() diff --git a/scene/3d/physics_joint.cpp b/scene/3d/physics_joint.cpp index 61d496935b..55007c6dc6 100644 --- a/scene/3d/physics_joint.cpp +++ b/scene/3d/physics_joint.cpp @@ -188,9 +188,9 @@ void PinJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/damping", PROPERTY_HINT_RANGE, "0.01,8.0,0.01"), "set_param", "get_param", PARAM_DAMPING); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "params/impulse_clamp", PROPERTY_HINT_RANGE, "0.0,64.0,0.01"), "set_param", "get_param", PARAM_IMPULSE_CLAMP); - BIND_CONSTANT(PARAM_BIAS); - BIND_CONSTANT(PARAM_DAMPING); - BIND_CONSTANT(PARAM_IMPULSE_CLAMP); + BIND_ENUM_CONSTANT(PARAM_BIAS); + BIND_ENUM_CONSTANT(PARAM_DAMPING); + BIND_ENUM_CONSTANT(PARAM_IMPULSE_CLAMP); } void PinJoint::set_param(Param p_param, float p_value) { @@ -282,19 +282,19 @@ void HingeJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/target_velocity", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_param", "get_param", PARAM_MOTOR_TARGET_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "motor/max_impulse", PROPERTY_HINT_RANGE, "0.01,1024,0.01"), "set_param", "get_param", PARAM_MOTOR_MAX_IMPULSE); - BIND_CONSTANT(PARAM_BIAS); - BIND_CONSTANT(PARAM_LIMIT_UPPER); - BIND_CONSTANT(PARAM_LIMIT_LOWER); - BIND_CONSTANT(PARAM_LIMIT_BIAS); - BIND_CONSTANT(PARAM_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_LIMIT_RELAXATION); - BIND_CONSTANT(PARAM_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(PARAM_MOTOR_MAX_IMPULSE); - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_BIAS); + BIND_ENUM_CONSTANT(PARAM_LIMIT_UPPER); + BIND_ENUM_CONSTANT(PARAM_LIMIT_LOWER); + BIND_ENUM_CONSTANT(PARAM_LIMIT_BIAS); + BIND_ENUM_CONSTANT(PARAM_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LIMIT_RELAXATION); + BIND_ENUM_CONSTANT(PARAM_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_MOTOR_MAX_IMPULSE); + BIND_ENUM_CONSTANT(PARAM_MAX); - BIND_CONSTANT(FLAG_USE_LIMIT); - BIND_CONSTANT(FLAG_ENABLE_MOTOR); - BIND_CONSTANT(FLAG_MAX); + BIND_ENUM_CONSTANT(FLAG_USE_LIMIT); + BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(FLAG_MAX); } void HingeJoint::set_param(Param p_param, float p_value) { @@ -428,31 +428,31 @@ void SliderJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_ortho/restitution", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_ANGULAR_ORTHOGONAL_RESTITUTION); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_ortho/damping", PROPERTY_HINT_RANGE, "0,16.0,0.01"), "set_param", "get_param", PARAM_ANGULAR_ORTHOGONAL_DAMPING); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_UPPER); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_LOWER); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_DAMPING); - BIND_CONSTANT(PARAM_LINEAR_MOTION_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_MOTION_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_MOTION_DAMPING); - BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_ORTHOGONAL_DAMPING); - - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_UPPER); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_LOWER); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_MOTION_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_MOTION_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_MOTION_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_DAMPING); - - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_ORTHOGONAL_DAMPING); + + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ORTHOGONAL_DAMPING); + + BIND_ENUM_CONSTANT(PARAM_MAX); } void SliderJoint::set_param(Param p_param, float p_value) { @@ -560,12 +560,12 @@ void ConeTwistJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_SOFTNESS); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "relaxation", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_RELAXATION); - BIND_CONSTANT(PARAM_SWING_SPAN); - BIND_CONSTANT(PARAM_TWIST_SPAN); - BIND_CONSTANT(PARAM_BIAS); - BIND_CONSTANT(PARAM_SOFTNESS); - BIND_CONSTANT(PARAM_RELAXATION); - BIND_CONSTANT(PARAM_MAX); + BIND_ENUM_CONSTANT(PARAM_SWING_SPAN); + BIND_ENUM_CONSTANT(PARAM_TWIST_SPAN); + BIND_ENUM_CONSTANT(PARAM_BIAS); + BIND_ENUM_CONSTANT(PARAM_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_RELAXATION); + BIND_ENUM_CONSTANT(PARAM_MAX); } void ConeTwistJoint::set_param(Param p_param, float p_value) { @@ -773,26 +773,26 @@ void Generic6DOFJoint::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_motor_z/target_velocity"), "set_param_z", "get_param_z", PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "angular_motor_z/force_limit"), "set_param_z", "get_param_z", PARAM_ANGULAR_MOTOR_FORCE_LIMIT); - BIND_CONSTANT(PARAM_LINEAR_LOWER_LIMIT); - BIND_CONSTANT(PARAM_LINEAR_UPPER_LIMIT); - BIND_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_LINEAR_RESTITUTION); - BIND_CONSTANT(PARAM_LINEAR_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT); - BIND_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT); - BIND_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(PARAM_ANGULAR_DAMPING); - BIND_CONSTANT(PARAM_ANGULAR_RESTITUTION); - BIND_CONSTANT(PARAM_ANGULAR_FORCE_LIMIT); - BIND_CONSTANT(PARAM_ANGULAR_ERP); - BIND_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT); - BIND_CONSTANT(PARAM_MAX); - - BIND_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT); - BIND_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT); - BIND_CONSTANT(FLAG_ENABLE_MOTOR); - BIND_CONSTANT(FLAG_MAX); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_LINEAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_LINEAR_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_LINEAR_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_DAMPING); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_RESTITUTION); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_ERP); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(PARAM_ANGULAR_MOTOR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(PARAM_MAX); + + BIND_ENUM_CONSTANT(FLAG_ENABLE_LINEAR_LIMIT); + BIND_ENUM_CONSTANT(FLAG_ENABLE_ANGULAR_LIMIT); + BIND_ENUM_CONSTANT(FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(FLAG_MAX); } void Generic6DOFJoint::set_param_x(Param p_param, float p_value) { diff --git a/scene/3d/proximity_group.cpp b/scene/3d/proximity_group.cpp index 5441904d81..d0410f2c55 100644 --- a/scene/3d/proximity_group.cpp +++ b/scene/3d/proximity_group.cpp @@ -116,9 +116,9 @@ void ProximityGroup::set_group_name(String p_group_name) { group_name = p_group_name; }; -void ProximityGroup::_notification(int what) { +void ProximityGroup::_notification(int p_what) { - switch (what) { + switch (p_what) { case NOTIFICATION_EXIT_TREE: ++group_version; diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 67e7fb0e12..b0aab6cc4d 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -30,12 +30,14 @@ #include "ray_cast.h" #include "collision_object.h" +#include "engine.h" #include "mesh_instance.h" #include "servers/physics_server.h" + void RayCast::set_cast_to(const Vector3 &p_point) { cast_to = p_point; - if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_collisions_hint())) update_gizmo(); if (is_inside_tree() && get_tree()->is_debugging_collisions_hint()) _update_debug_shape(); @@ -94,7 +96,7 @@ Vector3 RayCast::get_collision_normal() const { void RayCast::set_enabled(bool p_enabled) { enabled = p_enabled; - if (is_inside_tree() && !get_tree()->is_editor_hint()) + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) set_fixed_process(p_enabled); if (!p_enabled) collided = false; @@ -118,7 +120,7 @@ void RayCast::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { - if (enabled && !get_tree()->is_editor_hint()) { + if (enabled && !Engine::get_singleton()->is_editor_hint()) { set_fixed_process(true); if (get_tree()->is_debugging_collisions_hint()) diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 0dc5b58e45..194146b6b3 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -252,8 +252,8 @@ void ReflectionProbe::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "interior_ambient_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_interior_ambient_energy", "get_interior_ambient_energy"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "interior_ambient_contrib", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_interior_ambient_probe_contribution", "get_interior_ambient_probe_contribution"); - BIND_CONSTANT(UPDATE_ONCE); - BIND_CONSTANT(UPDATE_ALWAYS); + BIND_ENUM_CONSTANT(UPDATE_ONCE); + BIND_ENUM_CONSTANT(UPDATE_ALWAYS); } ReflectionProbe::ReflectionProbe() { diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 0d91014314..cee97af244 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -82,9 +82,9 @@ bool Skeleton::_set(const StringName &p_path, const Variant &p_value) { return true; } -bool Skeleton::_get(const StringName &p_name, Variant &r_ret) const { +bool Skeleton::_get(const StringName &p_path, Variant &r_ret) const { - String path = p_name; + String path = p_path; if (!path.begins_with("bones/")) return false; diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h index dc0adbb337..a6546af64e 100644 --- a/scene/3d/skeleton.h +++ b/scene/3d/skeleton.h @@ -91,8 +91,8 @@ class Skeleton : public Spatial { } protected: - bool _get(const StringName &p_name, Variant &r_ret) const; - bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_path, Variant &r_ret) const; + bool _set(const StringName &p_path, const Variant &p_value); void _get_property_list(List<PropertyInfo> *p_list) const; void _notification(int p_what); static void _bind_methods(); @@ -113,7 +113,7 @@ public: void set_bone_parent(int p_bone, int p_parent); int get_bone_parent(int p_bone) const; - void unparent_bone_and_rest(int p_idx); + void unparent_bone_and_rest(int p_bone); void set_bone_disable_rest(int p_bone, bool p_disable); bool is_bone_rest_disabled(int p_bone) const; diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 848b08eb8f..6498238e12 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "spatial.h" +#include "engine.h" #include "message_queue.h" #include "scene/main/viewport.h" #include "scene/scene_string_names.h" @@ -134,7 +135,7 @@ void Spatial::_notification(int p_what) { else data.C = NULL; - if (data.toplevel && !get_tree()->is_editor_hint()) { + if (data.toplevel && !Engine::get_singleton()->is_editor_hint()) { if (data.parent) { data.local_transform = data.parent->get_global_transform() * get_transform(); @@ -178,7 +179,7 @@ void Spatial::_notification(int p_what) { get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_enter_world, NULL, 0); } #ifdef TOOLS_ENABLED - if (get_tree()->is_editor_hint()) { + if (Engine::get_singleton()->is_editor_hint()) { //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,SceneStringNames::get_singleton()->_spatial_editor_group,SceneStringNames::get_singleton()->_request_gizmo,this); get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); @@ -492,7 +493,7 @@ void Spatial::set_as_toplevel(bool p_enabled) { if (data.toplevel == p_enabled) return; - if (is_inside_tree() && !get_tree()->is_editor_hint()) { + if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) { if (p_enabled) set_transform(get_global_transform()); diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h index 65f3eaca93..b8237613a7 100644 --- a/scene/3d/spatial_velocity_tracker.h +++ b/scene/3d/spatial_velocity_tracker.h @@ -20,7 +20,7 @@ protected: public: void reset(const Vector3 &p_new_pos); - void set_track_fixed_step(bool p_use_fixed_step); + void set_track_fixed_step(bool p_track_fixed_step); bool is_tracking_fixed_step() const; void update_position(const Vector3 &p_position); Vector3 get_tracked_linear_velocity() const; diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 978662f7dc..e45cb6d5b9 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -276,14 +276,14 @@ void SpriteBase3D::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "double_sided"), "set_draw_flag", "get_draw_flag", FLAG_DOUBLE_SIDED); ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode"); - BIND_CONSTANT(FLAG_TRANSPARENT); - BIND_CONSTANT(FLAG_SHADED); - BIND_CONSTANT(FLAG_DOUBLE_SIDED); - BIND_CONSTANT(FLAG_MAX); - - BIND_CONSTANT(ALPHA_CUT_DISABLED); - BIND_CONSTANT(ALPHA_CUT_DISCARD); - BIND_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS); + BIND_ENUM_CONSTANT(FLAG_TRANSPARENT); + BIND_ENUM_CONSTANT(FLAG_SHADED); + BIND_ENUM_CONSTANT(FLAG_DOUBLE_SIDED); + BIND_ENUM_CONSTANT(FLAG_MAX); + + BIND_ENUM_CONSTANT(ALPHA_CUT_DISABLED); + BIND_ENUM_CONSTANT(ALPHA_CUT_DISCARD); + BIND_ENUM_CONSTANT(ALPHA_CUT_OPAQUE_PREPASS); } SpriteBase3D::SpriteBase3D() { diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index b4600c00b8..7dc4cd4ffb 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -119,7 +119,7 @@ public: void set_pixel_size(float p_amount); float get_pixel_size() const; - void set_axis(Vector3::Axis p_amount); + void set_axis(Vector3::Axis p_axis); Vector3::Axis get_axis() const; void set_draw_flag(DrawFlags p_flag, bool p_enable); diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 8d927e529e..adf235c525 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -893,9 +893,9 @@ real_t VehicleBody::get_friction() const { return friction; } -void VehicleBody::set_engine_force(float p_force) { +void VehicleBody::set_engine_force(float p_engine_force) { - engine_force = p_force; + engine_force = p_engine_force; } float VehicleBody::get_engine_force() const { diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index 7ed9bce730..d778800814 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -196,7 +196,7 @@ public: void set_engine_force(float p_engine_force); float get_engine_force() const; - void set_brake(float p_force); + void set_brake(float p_brake); float get_brake() const; void set_steering(float p_steering); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index cc81a4cb56..0b77968dca 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -29,11 +29,11 @@ /*************************************************************************/ #include "visibility_notifier.h" +#include "engine.h" #include "scene/3d/camera.h" #include "scene/3d/physics_body.h" #include "scene/animation/animation_player.h" #include "scene/scene_string_names.h" -#include "scene/scene_string_names.h" void VisibilityNotifier::_enter_camera(Camera *p_camera) { @@ -187,7 +187,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; Node *from = this; @@ -200,7 +200,7 @@ void VisibilityEnabler::_notification(int p_what) { if (p_what == NOTIFICATION_EXIT_TREE) { - if (get_tree()->is_editor_hint()) + if (Engine::get_singleton()->is_editor_hint()) return; for (Map<Node *, Variant>::Element *E = nodes.front(); E; E = E->next()) { @@ -252,9 +252,9 @@ void VisibilityEnabler::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "pause_animations"), "set_enabler", "is_enabler_enabled", ENABLER_PAUSE_ANIMATIONS); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "freeze_bodies"), "set_enabler", "is_enabler_enabled", ENABLER_FREEZE_BODIES); - BIND_CONSTANT(ENABLER_FREEZE_BODIES); - BIND_CONSTANT(ENABLER_PAUSE_ANIMATIONS); - BIND_CONSTANT(ENABLER_MAX); + BIND_ENUM_CONSTANT(ENABLER_FREEZE_BODIES); + BIND_ENUM_CONSTANT(ENABLER_PAUSE_ANIMATIONS); + BIND_ENUM_CONSTANT(ENABLER_MAX); } void VisibilityEnabler::set_enabler(Enabler p_enabler, bool p_enable) { diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 1a294d016a..7d61006529 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -231,14 +231,6 @@ void GeometryInstance::_notification(int p_what) { void GeometryInstance::set_flag(Flags p_flag, bool p_value) { ERR_FAIL_INDEX(p_flag, FLAG_MAX); - if (p_flag == FLAG_CAST_SHADOW) { - if (p_value == true) { - set_cast_shadows_setting(SHADOW_CASTING_SETTING_ON); - } else { - set_cast_shadows_setting(SHADOW_CASTING_SETTING_OFF); - } - } - if (flags[p_flag] == p_value) return; @@ -252,14 +244,6 @@ bool GeometryInstance::get_flag(Flags p_flag) const { ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false); - if (p_flag == FLAG_CAST_SHADOW) { - if (shadow_casting_setting == SHADOW_CASTING_SETTING_OFF) { - return false; - } else { - return true; - } - } - return flags[p_flag]; } @@ -330,7 +314,6 @@ void GeometryInstance::_bind_methods() { //ADD_SIGNAL( MethodInfo("visibility_changed")); - BIND_CONSTANT(FLAG_CAST_SHADOW); BIND_CONSTANT(FLAG_VISIBLE_IN_ALL_ROOMS); BIND_CONSTANT(FLAG_MAX); @@ -350,8 +333,6 @@ GeometryInstance::GeometryInstance() { flags[i] = false; } - flags[FLAG_CAST_SHADOW] = true; - shadow_casting_setting = SHADOW_CASTING_SETTING_ON; extra_cull_margin = 0; //VS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0); diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index 9318198e54..694d0c2499 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -84,7 +84,6 @@ class GeometryInstance : public VisualInstance { public: enum Flags { - FLAG_CAST_SHADOW = VS::INSTANCE_FLAG_CAST_SHADOW, FLAG_VISIBLE_IN_ALL_ROOMS = VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, FLAG_USE_BAKED_LIGHT = VS::INSTANCE_FLAG_USE_BAKED_LIGHT, FLAG_MAX = VS::INSTANCE_FLAG_MAX, |