Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
This commit is contained in:
parent
0be6d925dc
commit
07bc4e2f96
409 changed files with 2286 additions and 0 deletions
|
|
@ -128,6 +128,7 @@ void SpriteFrames::remove_frame(const StringName &p_anim, int p_idx) {
|
|||
E->get().frames.remove(p_idx);
|
||||
emit_changed();
|
||||
}
|
||||
|
||||
void SpriteFrames::clear(const StringName &p_anim) {
|
||||
Map<StringName, Anim>::Element *E = animations.find(p_anim);
|
||||
ERR_FAIL_COND_MSG(!E, "Animation '" + String(p_anim) + "' doesn't exist.");
|
||||
|
|
@ -152,6 +153,7 @@ void SpriteFrames::add_animation(const StringName &p_anim) {
|
|||
bool SpriteFrames::has_animation(const StringName &p_anim) const {
|
||||
return animations.has(p_anim);
|
||||
}
|
||||
|
||||
void SpriteFrames::remove_animation(const StringName &p_anim) {
|
||||
animations.erase(p_anim);
|
||||
}
|
||||
|
|
@ -199,6 +201,7 @@ void SpriteFrames::set_animation_speed(const StringName &p_anim, float p_fps) {
|
|||
ERR_FAIL_COND_MSG(!E, "Animation '" + String(p_anim) + "' doesn't exist.");
|
||||
E->get().speed = p_fps;
|
||||
}
|
||||
|
||||
float SpriteFrames::get_animation_speed(const StringName &p_anim) const {
|
||||
const Map<StringName, Anim>::Element *E = animations.find(p_anim);
|
||||
ERR_FAIL_COND_V_MSG(!E, 0, "Animation '" + String(p_anim) + "' doesn't exist.");
|
||||
|
|
@ -210,6 +213,7 @@ void SpriteFrames::set_animation_loop(const StringName &p_anim, bool p_loop) {
|
|||
ERR_FAIL_COND_MSG(!E, "Animation '" + String(p_anim) + "' doesn't exist.");
|
||||
E->get().loop = p_loop;
|
||||
}
|
||||
|
||||
bool SpriteFrames::get_animation_loop(const StringName &p_anim) const {
|
||||
const Map<StringName, Anim>::Element *E = animations.find(p_anim);
|
||||
ERR_FAIL_COND_V_MSG(!E, false, "Animation '" + String(p_anim) + "' doesn't exist.");
|
||||
|
|
@ -225,6 +229,7 @@ void SpriteFrames::_set_frames(const Array &p_frames) {
|
|||
for (int i = 0; i < E->get().frames.size(); i++)
|
||||
E->get().frames.write[i] = p_frames[i];
|
||||
}
|
||||
|
||||
Array SpriteFrames::_get_frames() const {
|
||||
return Array();
|
||||
}
|
||||
|
|
@ -246,6 +251,7 @@ Array SpriteFrames::_get_animations() const {
|
|||
|
||||
return anims;
|
||||
}
|
||||
|
||||
void SpriteFrames::_set_animations(const Array &p_animations) {
|
||||
animations.clear();
|
||||
for (int i = 0; i < p_animations.size(); i++) {
|
||||
|
|
@ -489,6 +495,7 @@ void AnimatedSprite2D::set_frame(int p_frame) {
|
|||
_change_notify("frame");
|
||||
emit_signal(SceneStringNames::get_singleton()->frame_changed);
|
||||
}
|
||||
|
||||
int AnimatedSprite2D::get_frame() const {
|
||||
return frame;
|
||||
}
|
||||
|
|
@ -523,6 +530,7 @@ void AnimatedSprite2D::set_offset(const Point2 &p_offset) {
|
|||
item_rect_changed();
|
||||
_change_notify("offset");
|
||||
}
|
||||
|
||||
Point2 AnimatedSprite2D::get_offset() const {
|
||||
return offset;
|
||||
}
|
||||
|
|
@ -531,6 +539,7 @@ void AnimatedSprite2D::set_flip_h(bool p_flip) {
|
|||
hflip = p_flip;
|
||||
update();
|
||||
}
|
||||
|
||||
bool AnimatedSprite2D::is_flipped_h() const {
|
||||
return hflip;
|
||||
}
|
||||
|
|
@ -539,6 +548,7 @@ void AnimatedSprite2D::set_flip_v(bool p_flip) {
|
|||
vflip = p_flip;
|
||||
update();
|
||||
}
|
||||
|
||||
bool AnimatedSprite2D::is_flipped_v() const {
|
||||
return vflip;
|
||||
}
|
||||
|
|
@ -613,6 +623,7 @@ void AnimatedSprite2D::set_animation(const StringName &p_animation) {
|
|||
_change_notify();
|
||||
update();
|
||||
}
|
||||
|
||||
StringName AnimatedSprite2D::get_animation() const {
|
||||
return animation;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ void Area2D::set_space_override_mode(SpaceOverride p_mode) {
|
|||
space_override = p_mode;
|
||||
PhysicsServer2D::get_singleton()->area_set_space_override_mode(get_rid(), PhysicsServer2D::AreaSpaceOverrideMode(p_mode));
|
||||
}
|
||||
|
||||
Area2D::SpaceOverride Area2D::get_space_override_mode() const {
|
||||
return space_override;
|
||||
}
|
||||
|
|
@ -46,6 +47,7 @@ void Area2D::set_gravity_is_point(bool p_enabled) {
|
|||
gravity_is_point = p_enabled;
|
||||
PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_IS_POINT, p_enabled);
|
||||
}
|
||||
|
||||
bool Area2D::is_gravity_a_point() const {
|
||||
return gravity_is_point;
|
||||
}
|
||||
|
|
@ -63,6 +65,7 @@ void Area2D::set_gravity_vector(const Vector2 &p_vec) {
|
|||
gravity_vec = p_vec;
|
||||
PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY_VECTOR, p_vec);
|
||||
}
|
||||
|
||||
Vector2 Area2D::get_gravity_vector() const {
|
||||
return gravity_vec;
|
||||
}
|
||||
|
|
@ -71,6 +74,7 @@ void Area2D::set_gravity(real_t p_gravity) {
|
|||
gravity = p_gravity;
|
||||
PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_GRAVITY, p_gravity);
|
||||
}
|
||||
|
||||
real_t Area2D::get_gravity() const {
|
||||
return gravity;
|
||||
}
|
||||
|
|
@ -79,6 +83,7 @@ void Area2D::set_linear_damp(real_t p_linear_damp) {
|
|||
linear_damp = p_linear_damp;
|
||||
PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_LINEAR_DAMP, p_linear_damp);
|
||||
}
|
||||
|
||||
real_t Area2D::get_linear_damp() const {
|
||||
return linear_damp;
|
||||
}
|
||||
|
|
@ -96,6 +101,7 @@ void Area2D::set_priority(real_t p_priority) {
|
|||
priority = p_priority;
|
||||
PhysicsServer2D::get_singleton()->area_set_param(get_rid(), PhysicsServer2D::AREA_PARAM_PRIORITY, p_priority);
|
||||
}
|
||||
|
||||
real_t Area2D::get_priority() const {
|
||||
return priority;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@ Ref<AudioStream> AudioStreamPlayer2D::get_stream() const {
|
|||
void AudioStreamPlayer2D::set_volume_db(float p_volume) {
|
||||
volume_db = p_volume;
|
||||
}
|
||||
|
||||
float AudioStreamPlayer2D::get_volume_db() const {
|
||||
return volume_db;
|
||||
}
|
||||
|
|
@ -296,6 +297,7 @@ void AudioStreamPlayer2D::set_pitch_scale(float p_pitch_scale) {
|
|||
ERR_FAIL_COND(p_pitch_scale <= 0.0);
|
||||
pitch_scale = p_pitch_scale;
|
||||
}
|
||||
|
||||
float AudioStreamPlayer2D::get_pitch_scale() const {
|
||||
return pitch_scale;
|
||||
}
|
||||
|
|
@ -350,6 +352,7 @@ void AudioStreamPlayer2D::set_bus(const StringName &p_bus) {
|
|||
bus = p_bus;
|
||||
AudioServer::get_singleton()->unlock();
|
||||
}
|
||||
|
||||
StringName AudioStreamPlayer2D::get_bus() const {
|
||||
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
|
||||
if (AudioServer::get_singleton()->get_bus_name(i) == bus) {
|
||||
|
|
@ -362,6 +365,7 @@ StringName AudioStreamPlayer2D::get_bus() const {
|
|||
void AudioStreamPlayer2D::set_autoplay(bool p_enable) {
|
||||
autoplay = p_enable;
|
||||
}
|
||||
|
||||
bool AudioStreamPlayer2D::is_autoplay_enabled() {
|
||||
return autoplay;
|
||||
}
|
||||
|
|
@ -372,6 +376,7 @@ void AudioStreamPlayer2D::_set_playing(bool p_enable) {
|
|||
else
|
||||
stop();
|
||||
}
|
||||
|
||||
bool AudioStreamPlayer2D::_is_active() const {
|
||||
return active;
|
||||
}
|
||||
|
|
@ -406,6 +411,7 @@ float AudioStreamPlayer2D::get_max_distance() const {
|
|||
void AudioStreamPlayer2D::set_attenuation(float p_curve) {
|
||||
attenuation = p_curve;
|
||||
}
|
||||
|
||||
float AudioStreamPlayer2D::get_attenuation() const {
|
||||
return attenuation;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ void BackBufferCopy::set_copy_mode(CopyMode p_mode) {
|
|||
copy_mode = p_mode;
|
||||
_update_copy_mode();
|
||||
}
|
||||
|
||||
BackBufferCopy::CopyMode BackBufferCopy::get_copy_mode() const {
|
||||
return copy_mode;
|
||||
}
|
||||
|
|
@ -96,5 +97,6 @@ BackBufferCopy::BackBufferCopy() {
|
|||
copy_mode = COPY_MODE_RECT;
|
||||
_update_copy_mode();
|
||||
}
|
||||
|
||||
BackBufferCopy::~BackBufferCopy() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ void Camera2D::set_h_offset(float p_offset) {
|
|||
h_offset_changed = true;
|
||||
_update_scroll();
|
||||
}
|
||||
|
||||
float Camera2D::get_h_offset() const {
|
||||
return h_ofs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ void CanvasModulate::set_color(const Color &p_color) {
|
|||
RS::get_singleton()->canvas_set_modulate(get_canvas(), color);
|
||||
}
|
||||
}
|
||||
|
||||
Color CanvasModulate::get_color() const {
|
||||
return color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ void CollisionObject2D::shape_owner_set_transform(uint32_t p_owner, const Transf
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Transform2D CollisionObject2D::shape_owner_get_transform(uint32_t p_owner) const {
|
||||
ERR_FAIL_COND_V(!shapes.has(p_owner), Transform2D());
|
||||
|
||||
|
|
@ -235,17 +236,20 @@ void CollisionObject2D::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape2
|
|||
|
||||
total_subshapes++;
|
||||
}
|
||||
|
||||
int CollisionObject2D::shape_owner_get_shape_count(uint32_t p_owner) const {
|
||||
ERR_FAIL_COND_V(!shapes.has(p_owner), 0);
|
||||
|
||||
return shapes[p_owner].shapes.size();
|
||||
}
|
||||
|
||||
Ref<Shape2D> CollisionObject2D::shape_owner_get_shape(uint32_t p_owner, int p_shape) const {
|
||||
ERR_FAIL_COND_V(!shapes.has(p_owner), Ref<Shape2D>());
|
||||
ERR_FAIL_INDEX_V(p_shape, shapes[p_owner].shapes.size(), Ref<Shape2D>());
|
||||
|
||||
return shapes[p_owner].shapes[p_shape].shape;
|
||||
}
|
||||
|
||||
int CollisionObject2D::shape_owner_get_shape_index(uint32_t p_owner, int p_shape) const {
|
||||
ERR_FAIL_COND_V(!shapes.has(p_owner), -1);
|
||||
ERR_FAIL_INDEX_V(p_shape, shapes[p_owner].shapes.size(), -1);
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ void CollisionPolygon2D::set_one_way_collision_margin(float p_margin) {
|
|||
float CollisionPolygon2D::get_one_way_collision_margin() const {
|
||||
return one_way_collision_margin;
|
||||
}
|
||||
|
||||
void CollisionPolygon2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_polygon", "polygon"), &CollisionPolygon2D::set_polygon);
|
||||
ClassDB::bind_method(D_METHOD("get_polygon"), &CollisionPolygon2D::get_polygon);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ void CPUParticles2D::set_amount(int p_amount) {
|
|||
|
||||
particle_order.resize(p_amount);
|
||||
}
|
||||
|
||||
void CPUParticles2D::set_lifetime(float p_lifetime) {
|
||||
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
|
||||
lifetime = p_lifetime;
|
||||
|
|
@ -74,15 +75,19 @@ void CPUParticles2D::set_one_shot(bool p_one_shot) {
|
|||
void CPUParticles2D::set_pre_process_time(float p_time) {
|
||||
pre_process_time = p_time;
|
||||
}
|
||||
|
||||
void CPUParticles2D::set_explosiveness_ratio(float p_ratio) {
|
||||
explosiveness_ratio = p_ratio;
|
||||
}
|
||||
|
||||
void CPUParticles2D::set_randomness_ratio(float p_ratio) {
|
||||
randomness_ratio = p_ratio;
|
||||
}
|
||||
|
||||
void CPUParticles2D::set_lifetime_randomness(float p_random) {
|
||||
lifetime_randomness = p_random;
|
||||
}
|
||||
|
||||
void CPUParticles2D::set_use_local_coordinates(bool p_enable) {
|
||||
local_coords = p_enable;
|
||||
set_notify_transform(!p_enable);
|
||||
|
|
@ -95,12 +100,15 @@ void CPUParticles2D::set_speed_scale(float p_scale) {
|
|||
bool CPUParticles2D::is_emitting() const {
|
||||
return emitting;
|
||||
}
|
||||
|
||||
int CPUParticles2D::get_amount() const {
|
||||
return particles.size();
|
||||
}
|
||||
|
||||
float CPUParticles2D::get_lifetime() const {
|
||||
return lifetime;
|
||||
}
|
||||
|
||||
bool CPUParticles2D::get_one_shot() const {
|
||||
return one_shot;
|
||||
}
|
||||
|
|
@ -108,12 +116,15 @@ bool CPUParticles2D::get_one_shot() const {
|
|||
float CPUParticles2D::get_pre_process_time() const {
|
||||
return pre_process_time;
|
||||
}
|
||||
|
||||
float CPUParticles2D::get_explosiveness_ratio() const {
|
||||
return explosiveness_ratio;
|
||||
}
|
||||
|
||||
float CPUParticles2D::get_randomness_ratio() const {
|
||||
return randomness_ratio;
|
||||
}
|
||||
|
||||
float CPUParticles2D::get_lifetime_randomness() const {
|
||||
return lifetime_randomness;
|
||||
}
|
||||
|
|
@ -294,6 +305,7 @@ void CPUParticles2D::set_param(Parameter p_param, float p_value) {
|
|||
|
||||
parameters[p_param] = p_value;
|
||||
}
|
||||
|
||||
float CPUParticles2D::get_param(Parameter p_param) const {
|
||||
ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
|
||||
|
||||
|
|
@ -305,6 +317,7 @@ void CPUParticles2D::set_param_randomness(Parameter p_param, float p_value) {
|
|||
|
||||
randomness[p_param] = p_value;
|
||||
}
|
||||
|
||||
float CPUParticles2D::get_param_randomness(Parameter p_param) const {
|
||||
ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
|
||||
|
||||
|
|
@ -363,6 +376,7 @@ void CPUParticles2D::set_param_curve(Parameter p_param, const Ref<Curve> &p_curv
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Curve> CPUParticles2D::get_param_curve(Parameter p_param) const {
|
||||
ERR_FAIL_INDEX_V(p_param, PARAM_MAX, Ref<Curve>());
|
||||
|
||||
|
|
@ -424,12 +438,15 @@ void CPUParticles2D::set_emission_colors(const Vector<Color> &p_colors) {
|
|||
float CPUParticles2D::get_emission_sphere_radius() const {
|
||||
return emission_sphere_radius;
|
||||
}
|
||||
|
||||
Vector2 CPUParticles2D::get_emission_rect_extents() const {
|
||||
return emission_rect_extents;
|
||||
}
|
||||
|
||||
Vector<Vector2> CPUParticles2D::get_emission_points() const {
|
||||
return emission_points;
|
||||
}
|
||||
|
||||
Vector<Vector2> CPUParticles2D::get_emission_normals() const {
|
||||
return emission_normals;
|
||||
}
|
||||
|
|
@ -441,6 +458,7 @@ Vector<Color> CPUParticles2D::get_emission_colors() const {
|
|||
CPUParticles2D::EmissionShape CPUParticles2D::get_emission_shape() const {
|
||||
return emission_shape;
|
||||
}
|
||||
|
||||
void CPUParticles2D::set_gravity(const Vector2 &p_gravity) {
|
||||
gravity = p_gravity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ void GPUParticles2D::set_amount(int p_amount) {
|
|||
amount = p_amount;
|
||||
RS::get_singleton()->particles_set_amount(particles, amount);
|
||||
}
|
||||
|
||||
void GPUParticles2D::set_lifetime(float p_lifetime) {
|
||||
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
|
||||
lifetime = p_lifetime;
|
||||
|
|
@ -72,18 +73,22 @@ void GPUParticles2D::set_one_shot(bool p_enable) {
|
|||
if (!one_shot)
|
||||
set_process_internal(false);
|
||||
}
|
||||
|
||||
void GPUParticles2D::set_pre_process_time(float p_time) {
|
||||
pre_process_time = p_time;
|
||||
RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
|
||||
}
|
||||
|
||||
void GPUParticles2D::set_explosiveness_ratio(float p_ratio) {
|
||||
explosiveness_ratio = p_ratio;
|
||||
RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
|
||||
}
|
||||
|
||||
void GPUParticles2D::set_randomness_ratio(float p_ratio) {
|
||||
randomness_ratio = p_ratio;
|
||||
RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
|
||||
}
|
||||
|
||||
void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
|
||||
visibility_rect = p_visibility_rect;
|
||||
AABB aabb;
|
||||
|
|
@ -97,6 +102,7 @@ void GPUParticles2D::set_visibility_rect(const Rect2 &p_visibility_rect) {
|
|||
_change_notify("visibility_rect");
|
||||
update();
|
||||
}
|
||||
|
||||
void GPUParticles2D::set_use_local_coordinates(bool p_enable) {
|
||||
local_coords = p_enable;
|
||||
RS::get_singleton()->particles_set_use_local_coordinates(particles, local_coords);
|
||||
|
|
@ -140,9 +146,11 @@ void GPUParticles2D::set_speed_scale(float p_scale) {
|
|||
bool GPUParticles2D::is_emitting() const {
|
||||
return RS::get_singleton()->particles_get_emitting(particles);
|
||||
}
|
||||
|
||||
int GPUParticles2D::get_amount() const {
|
||||
return amount;
|
||||
}
|
||||
|
||||
float GPUParticles2D::get_lifetime() const {
|
||||
return lifetime;
|
||||
}
|
||||
|
|
@ -150,21 +158,27 @@ float GPUParticles2D::get_lifetime() const {
|
|||
bool GPUParticles2D::get_one_shot() const {
|
||||
return one_shot;
|
||||
}
|
||||
|
||||
float GPUParticles2D::get_pre_process_time() const {
|
||||
return pre_process_time;
|
||||
}
|
||||
|
||||
float GPUParticles2D::get_explosiveness_ratio() const {
|
||||
return explosiveness_ratio;
|
||||
}
|
||||
|
||||
float GPUParticles2D::get_randomness_ratio() const {
|
||||
return randomness_ratio;
|
||||
}
|
||||
|
||||
Rect2 GPUParticles2D::get_visibility_rect() const {
|
||||
return visibility_rect;
|
||||
}
|
||||
|
||||
bool GPUParticles2D::get_use_local_coordinates() const {
|
||||
return local_coords;
|
||||
}
|
||||
|
||||
Ref<Material> GPUParticles2D::get_process_material() const {
|
||||
return process_material;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ void Joint2D::set_node_b(const NodePath &p_node_b) {
|
|||
b = p_node_b;
|
||||
_update_joint();
|
||||
}
|
||||
|
||||
NodePath Joint2D::get_node_b() const {
|
||||
return b;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ void Light2D::set_color(const Color &p_color) {
|
|||
color = p_color;
|
||||
RS::get_singleton()->canvas_light_set_color(canvas_light, color);
|
||||
}
|
||||
|
||||
Color Light2D::get_color() const {
|
||||
return color;
|
||||
}
|
||||
|
|
@ -189,6 +190,7 @@ void Light2D::set_z_range_min(int p_min_z) {
|
|||
z_min = p_min_z;
|
||||
RS::get_singleton()->canvas_light_set_z_range(canvas_light, z_min, z_max);
|
||||
}
|
||||
|
||||
int Light2D::get_z_range_min() const {
|
||||
return z_min;
|
||||
}
|
||||
|
|
@ -197,6 +199,7 @@ void Light2D::set_z_range_max(int p_max_z) {
|
|||
z_max = p_max_z;
|
||||
RS::get_singleton()->canvas_light_set_z_range(canvas_light, z_min, z_max);
|
||||
}
|
||||
|
||||
int Light2D::get_z_range_max() const {
|
||||
return z_max;
|
||||
}
|
||||
|
|
@ -205,6 +208,7 @@ void Light2D::set_layer_range_min(int p_min_layer) {
|
|||
layer_min = p_min_layer;
|
||||
RS::get_singleton()->canvas_light_set_layer_range(canvas_light, layer_min, layer_max);
|
||||
}
|
||||
|
||||
int Light2D::get_layer_range_min() const {
|
||||
return layer_min;
|
||||
}
|
||||
|
|
@ -213,6 +217,7 @@ void Light2D::set_layer_range_max(int p_max_layer) {
|
|||
layer_max = p_max_layer;
|
||||
RS::get_singleton()->canvas_light_set_layer_range(canvas_light, layer_min, layer_max);
|
||||
}
|
||||
|
||||
int Light2D::get_layer_range_max() const {
|
||||
return layer_max;
|
||||
}
|
||||
|
|
@ -248,6 +253,7 @@ void Light2D::set_shadow_enabled(bool p_enabled) {
|
|||
shadow = p_enabled;
|
||||
RS::get_singleton()->canvas_light_set_shadow_enabled(canvas_light, shadow);
|
||||
}
|
||||
|
||||
bool Light2D::is_shadow_enabled() const {
|
||||
return shadow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,10 +148,12 @@ void NavigationPolygon::add_outline_at_index(const Vector<Vector2> &p_outline, i
|
|||
int NavigationPolygon::get_polygon_count() const {
|
||||
return polygons.size();
|
||||
}
|
||||
|
||||
Vector<int> NavigationPolygon::get_polygon(int p_idx) {
|
||||
ERR_FAIL_INDEX_V(p_idx, polygons.size(), Vector<int>());
|
||||
return polygons[p_idx].indices;
|
||||
}
|
||||
|
||||
void NavigationPolygon::clear_polygons() {
|
||||
polygons.clear();
|
||||
{
|
||||
|
|
@ -216,6 +218,7 @@ void NavigationPolygon::clear_outlines() {
|
|||
outlines.clear();
|
||||
rect_cache_dirty = true;
|
||||
}
|
||||
|
||||
void NavigationPolygon::make_polygons_from_outlines() {
|
||||
{
|
||||
MutexLock lock(navmesh_generation);
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ float Node2D::get_rotation_degrees() const {
|
|||
float Node2D::get_skew_degrees() const {
|
||||
return Math::rad2deg(get_skew());
|
||||
}
|
||||
|
||||
Size2 Node2D::get_scale() const {
|
||||
if (_xform_dirty)
|
||||
((Node2D *)this)->_update_xform_values();
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ void PhysicsBody2D::set_collision_mask_bit(int p_bit, bool p_value) {
|
|||
mask &= ~(1 << p_bit);
|
||||
set_collision_mask(mask);
|
||||
}
|
||||
|
||||
bool PhysicsBody2D::get_collision_mask_bit(int p_bit) const {
|
||||
return get_collision_mask() & (1 << p_bit);
|
||||
}
|
||||
|
|
@ -168,6 +169,7 @@ void StaticBody2D::set_constant_angular_velocity(real_t p_vel) {
|
|||
Vector2 StaticBody2D::get_constant_linear_velocity() const {
|
||||
return constant_linear_velocity;
|
||||
}
|
||||
|
||||
real_t StaticBody2D::get_constant_angular_velocity() const {
|
||||
return constant_angular_velocity;
|
||||
}
|
||||
|
|
@ -468,6 +470,7 @@ void RigidBody2D::set_mass(real_t p_mass) {
|
|||
_change_notify("weight");
|
||||
PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_MASS, mass);
|
||||
}
|
||||
|
||||
real_t RigidBody2D::get_mass() const {
|
||||
return mass;
|
||||
}
|
||||
|
|
@ -512,6 +515,7 @@ void RigidBody2D::set_gravity_scale(real_t p_gravity_scale) {
|
|||
gravity_scale = p_gravity_scale;
|
||||
PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_GRAVITY_SCALE, gravity_scale);
|
||||
}
|
||||
|
||||
real_t RigidBody2D::get_gravity_scale() const {
|
||||
return gravity_scale;
|
||||
}
|
||||
|
|
@ -521,6 +525,7 @@ void RigidBody2D::set_linear_damp(real_t p_linear_damp) {
|
|||
linear_damp = p_linear_damp;
|
||||
PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_LINEAR_DAMP, linear_damp);
|
||||
}
|
||||
|
||||
real_t RigidBody2D::get_linear_damp() const {
|
||||
return linear_damp;
|
||||
}
|
||||
|
|
@ -530,6 +535,7 @@ void RigidBody2D::set_angular_damp(real_t p_angular_damp) {
|
|||
angular_damp = p_angular_damp;
|
||||
PhysicsServer2D::get_singleton()->body_set_param(get_rid(), PhysicsServer2D::BODY_PARAM_ANGULAR_DAMP, angular_damp);
|
||||
}
|
||||
|
||||
real_t RigidBody2D::get_angular_damp() const {
|
||||
return angular_damp;
|
||||
}
|
||||
|
|
@ -567,6 +573,7 @@ void RigidBody2D::set_angular_velocity(real_t p_velocity) {
|
|||
else
|
||||
PhysicsServer2D::get_singleton()->body_set_state(get_rid(), PhysicsServer2D::BODY_STATE_ANGULAR_VELOCITY, angular_velocity);
|
||||
}
|
||||
|
||||
real_t RigidBody2D::get_angular_velocity() const {
|
||||
return angular_velocity;
|
||||
}
|
||||
|
|
@ -578,6 +585,7 @@ void RigidBody2D::set_use_custom_integrator(bool p_enable) {
|
|||
custom_integrator = p_enable;
|
||||
PhysicsServer2D::get_singleton()->body_set_omit_force_integration(get_rid(), p_enable);
|
||||
}
|
||||
|
||||
bool RigidBody2D::is_using_custom_integrator() {
|
||||
return custom_integrator;
|
||||
}
|
||||
|
|
@ -1105,9 +1113,11 @@ Vector2 KinematicBody2D::move_and_slide_with_snap(const Vector2 &p_linear_veloci
|
|||
bool KinematicBody2D::is_on_floor() const {
|
||||
return on_floor;
|
||||
}
|
||||
|
||||
bool KinematicBody2D::is_on_wall() const {
|
||||
return on_wall;
|
||||
}
|
||||
|
||||
bool KinematicBody2D::is_on_ceiling() const {
|
||||
return on_ceiling;
|
||||
}
|
||||
|
|
@ -1217,6 +1227,7 @@ void KinematicBody2D::_notification(int p_what) {
|
|||
set_notify_local_transform(true);
|
||||
}
|
||||
}
|
||||
|
||||
void KinematicBody2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("move_and_collide", "rel_vec", "infinite_inertia", "exclude_raycast_shapes", "test_only"), &KinematicBody2D::_move, DEFVAL(true), DEFVAL(true), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "up_direction", "stop_on_slope", "max_slides", "floor_max_angle", "infinite_inertia"), &KinematicBody2D::move_and_slide, DEFVAL(Vector2(0, 0)), DEFVAL(false), DEFVAL(4), DEFVAL(Math::deg2rad((float)45)), DEFVAL(true));
|
||||
|
|
@ -1254,6 +1265,7 @@ KinematicBody2D::KinematicBody2D() :
|
|||
on_wall = false;
|
||||
sync_to_physics = false;
|
||||
}
|
||||
|
||||
KinematicBody2D::~KinematicBody2D() {
|
||||
if (motion_cache.is_valid()) {
|
||||
motion_cache->owner = nullptr;
|
||||
|
|
@ -1271,15 +1283,19 @@ KinematicBody2D::~KinematicBody2D() {
|
|||
Vector2 KinematicCollision2D::get_position() const {
|
||||
return collision.collision;
|
||||
}
|
||||
|
||||
Vector2 KinematicCollision2D::get_normal() const {
|
||||
return collision.normal;
|
||||
}
|
||||
|
||||
Vector2 KinematicCollision2D::get_travel() const {
|
||||
return collision.travel;
|
||||
}
|
||||
|
||||
Vector2 KinematicCollision2D::get_remainder() const {
|
||||
return collision.remainder;
|
||||
}
|
||||
|
||||
Object *KinematicCollision2D::get_local_shape() const {
|
||||
if (!owner)
|
||||
return nullptr;
|
||||
|
|
@ -1294,9 +1310,11 @@ Object *KinematicCollision2D::get_collider() const {
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ObjectID KinematicCollision2D::get_collider_id() const {
|
||||
return collision.collider;
|
||||
}
|
||||
|
||||
Object *KinematicCollision2D::get_collider_shape() const {
|
||||
Object *collider = get_collider();
|
||||
if (collider) {
|
||||
|
|
@ -1309,12 +1327,15 @@ Object *KinematicCollision2D::get_collider_shape() const {
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int KinematicCollision2D::get_collider_shape_index() const {
|
||||
return collision.collider_shape;
|
||||
}
|
||||
|
||||
Vector2 KinematicCollision2D::get_collider_velocity() const {
|
||||
return collision.collider_vel;
|
||||
}
|
||||
|
||||
Variant KinematicCollision2D::get_collider_metadata() const {
|
||||
return Variant();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ void Polygon2D::set_color(const Color &p_color) {
|
|||
color = p_color;
|
||||
update();
|
||||
}
|
||||
|
||||
Color Polygon2D::get_color() const {
|
||||
return color;
|
||||
}
|
||||
|
|
@ -387,6 +388,7 @@ void Polygon2D::set_vertex_colors(const Vector<Color> &p_colors) {
|
|||
vertex_colors = p_colors;
|
||||
update();
|
||||
}
|
||||
|
||||
Vector<Color> Polygon2D::get_vertex_colors() const {
|
||||
return vertex_colors;
|
||||
}
|
||||
|
|
@ -404,6 +406,7 @@ void Polygon2D::set_texture(const Ref<Texture2D> &p_texture) {
|
|||
}*/
|
||||
update();
|
||||
}
|
||||
|
||||
Ref<Texture2D> Polygon2D::get_texture() const {
|
||||
return texture;
|
||||
}
|
||||
|
|
@ -448,6 +451,7 @@ void Polygon2D::set_texture_offset(const Vector2 &p_offset) {
|
|||
tex_ofs = p_offset;
|
||||
update();
|
||||
}
|
||||
|
||||
Vector2 Polygon2D::get_texture_offset() const {
|
||||
return tex_ofs;
|
||||
}
|
||||
|
|
@ -456,6 +460,7 @@ void Polygon2D::set_texture_rotation(float p_rot) {
|
|||
tex_rot = p_rot;
|
||||
update();
|
||||
}
|
||||
|
||||
float Polygon2D::get_texture_rotation() const {
|
||||
return tex_rot;
|
||||
}
|
||||
|
|
@ -463,6 +468,7 @@ float Polygon2D::get_texture_rotation() const {
|
|||
void Polygon2D::set_texture_rotation_degrees(float p_rot) {
|
||||
set_texture_rotation(Math::deg2rad(p_rot));
|
||||
}
|
||||
|
||||
float Polygon2D::get_texture_rotation_degrees() const {
|
||||
return Math::rad2deg(get_texture_rotation());
|
||||
}
|
||||
|
|
@ -471,6 +477,7 @@ void Polygon2D::set_texture_scale(const Size2 &p_scale) {
|
|||
tex_scale = p_scale;
|
||||
update();
|
||||
}
|
||||
|
||||
Size2 Polygon2D::get_texture_scale() const {
|
||||
return tex_scale;
|
||||
}
|
||||
|
|
@ -479,6 +486,7 @@ void Polygon2D::set_invert(bool p_invert) {
|
|||
invert = p_invert;
|
||||
update();
|
||||
}
|
||||
|
||||
bool Polygon2D::get_invert() const {
|
||||
return invert;
|
||||
}
|
||||
|
|
@ -487,6 +495,7 @@ void Polygon2D::set_antialiased(bool p_antialiased) {
|
|||
antialiased = p_antialiased;
|
||||
update();
|
||||
}
|
||||
|
||||
bool Polygon2D::get_antialiased() const {
|
||||
return antialiased;
|
||||
}
|
||||
|
|
@ -495,6 +504,7 @@ void Polygon2D::set_invert_border(float p_invert_border) {
|
|||
invert_border = p_invert_border;
|
||||
update();
|
||||
}
|
||||
|
||||
float Polygon2D::get_invert_border() const {
|
||||
return invert_border;
|
||||
}
|
||||
|
|
@ -516,17 +526,21 @@ void Polygon2D::add_bone(const NodePath &p_path, const Vector<float> &p_weights)
|
|||
bone.weights = p_weights;
|
||||
bone_weights.push_back(bone);
|
||||
}
|
||||
|
||||
int Polygon2D::get_bone_count() const {
|
||||
return bone_weights.size();
|
||||
}
|
||||
|
||||
NodePath Polygon2D::get_bone_path(int p_index) const {
|
||||
ERR_FAIL_INDEX_V(p_index, bone_weights.size(), NodePath());
|
||||
return bone_weights[p_index].path;
|
||||
}
|
||||
|
||||
Vector<float> Polygon2D::get_bone_weights(int p_index) const {
|
||||
ERR_FAIL_INDEX_V(p_index, bone_weights.size(), Vector<float>());
|
||||
return bone_weights[p_index].weights;
|
||||
}
|
||||
|
||||
void Polygon2D::erase_bone(int p_idx) {
|
||||
ERR_FAIL_INDEX(p_idx, bone_weights.size());
|
||||
bone_weights.remove(p_idx);
|
||||
|
|
@ -541,6 +555,7 @@ void Polygon2D::set_bone_weights(int p_index, const Vector<float> &p_weights) {
|
|||
bone_weights.write[p_index].weights = p_weights;
|
||||
update();
|
||||
}
|
||||
|
||||
void Polygon2D::set_bone_path(int p_index, const NodePath &p_path) {
|
||||
ERR_FAIL_INDEX(p_index, bone_weights.size());
|
||||
bone_weights.write[p_index].path = p_path;
|
||||
|
|
@ -555,6 +570,7 @@ Array Polygon2D::_get_bones() const {
|
|||
}
|
||||
return bones;
|
||||
}
|
||||
|
||||
void Polygon2D::_set_bones(const Array &p_bones) {
|
||||
ERR_FAIL_COND(p_bones.size() & 1);
|
||||
clear_bones();
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ bool RayCast2D::get_collision_mask_bit(int p_bit) const {
|
|||
bool RayCast2D::is_colliding() const {
|
||||
return collided;
|
||||
}
|
||||
|
||||
Object *RayCast2D::get_collider() const {
|
||||
if (against.is_null())
|
||||
return nullptr;
|
||||
|
|
@ -79,9 +80,11 @@ Object *RayCast2D::get_collider() const {
|
|||
int RayCast2D::get_collider_shape() const {
|
||||
return against_shape;
|
||||
}
|
||||
|
||||
Vector2 RayCast2D::get_collision_point() const {
|
||||
return collision_point;
|
||||
}
|
||||
|
||||
Vector2 RayCast2D::get_collision_normal() const {
|
||||
return collision_normal;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ void Bone2D::_notification(int p_what) {
|
|||
parent_bone = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Bone2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_rest", "rest"), &Bone2D::set_rest);
|
||||
ClassDB::bind_method(D_METHOD("get_rest"), &Bone2D::get_rest);
|
||||
|
|
@ -128,6 +129,7 @@ int Bone2D::get_index_in_skeleton() const {
|
|||
skeleton->_update_bone_setup();
|
||||
return skeleton_index;
|
||||
}
|
||||
|
||||
String Bone2D::get_configuration_warning() const {
|
||||
String warning = Node2D::get_configuration_warning();
|
||||
if (!skeleton) {
|
||||
|
|
@ -268,6 +270,7 @@ void Skeleton2D::_notification(int p_what) {
|
|||
RID Skeleton2D::get_skeleton() const {
|
||||
return skeleton;
|
||||
}
|
||||
|
||||
void Skeleton2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_update_bone_setup"), &Skeleton2D::_update_bone_setup);
|
||||
ClassDB::bind_method(D_METHOD("_update_transform"), &Skeleton2D::_update_transform);
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ void Sprite2D::set_offset(const Point2 &p_offset) {
|
|||
item_rect_changed();
|
||||
_change_notify("offset");
|
||||
}
|
||||
|
||||
Point2 Sprite2D::get_offset() const {
|
||||
return offset;
|
||||
}
|
||||
|
|
@ -214,6 +215,7 @@ void Sprite2D::set_flip_h(bool p_flip) {
|
|||
hflip = p_flip;
|
||||
update();
|
||||
}
|
||||
|
||||
bool Sprite2D::is_flipped_h() const {
|
||||
return hflip;
|
||||
}
|
||||
|
|
@ -222,6 +224,7 @@ void Sprite2D::set_flip_v(bool p_flip) {
|
|||
vflip = p_flip;
|
||||
update();
|
||||
}
|
||||
|
||||
bool Sprite2D::is_flipped_v() const {
|
||||
return vflip;
|
||||
}
|
||||
|
|
@ -298,6 +301,7 @@ void Sprite2D::set_vframes(int p_amount) {
|
|||
item_rect_changed();
|
||||
_change_notify();
|
||||
}
|
||||
|
||||
int Sprite2D::get_vframes() const {
|
||||
return vframes;
|
||||
}
|
||||
|
|
@ -309,6 +313,7 @@ void Sprite2D::set_hframes(int p_amount) {
|
|||
item_rect_changed();
|
||||
_change_notify();
|
||||
}
|
||||
|
||||
int Sprite2D::get_hframes() const {
|
||||
return hframes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1014,6 +1014,7 @@ int TileMap::get_cell(int p_x, int p_y) const {
|
|||
|
||||
return E->get().id;
|
||||
}
|
||||
|
||||
bool TileMap::is_cell_x_flipped(int p_x, int p_y) const {
|
||||
PosKey pk(p_x, p_y);
|
||||
|
||||
|
|
@ -1024,6 +1025,7 @@ bool TileMap::is_cell_x_flipped(int p_x, int p_y) const {
|
|||
|
||||
return E->get().flip_h;
|
||||
}
|
||||
|
||||
bool TileMap::is_cell_y_flipped(int p_x, int p_y) const {
|
||||
PosKey pk(p_x, p_y);
|
||||
|
||||
|
|
@ -1034,6 +1036,7 @@ bool TileMap::is_cell_y_flipped(int p_x, int p_y) const {
|
|||
|
||||
return E->get().flip_v;
|
||||
}
|
||||
|
||||
bool TileMap::is_cell_transposed(int p_x, int p_y) const {
|
||||
PosKey pk(p_x, p_y);
|
||||
|
||||
|
|
@ -1311,6 +1314,7 @@ void TileMap::set_collision_bounce(float p_bounce) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
float TileMap::get_collision_bounce() const {
|
||||
return bounce;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ void VisibilityEnabler2D::set_enabler(Enabler p_enabler, bool p_enable) {
|
|||
ERR_FAIL_INDEX(p_enabler, ENABLER_MAX);
|
||||
enabler[p_enabler] = p_enable;
|
||||
}
|
||||
|
||||
bool VisibilityEnabler2D::is_enabler_enabled(Enabler p_enabler) const {
|
||||
ERR_FAIL_INDEX_V(p_enabler, ENABLER_MAX, false);
|
||||
return enabler[p_enabler];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue