Merge pull request #72829 from Sauermann/fix-code-simplifications
Some code simplifications
This commit is contained in:
commit
743e26d4f9
|
@ -367,7 +367,6 @@ void EditorSpinSlider::_draw_spin_slider() {
|
||||||
|
|
||||||
if (!hide_slider) {
|
if (!hide_slider) {
|
||||||
if (get_step() == 1) {
|
if (get_step() == 1) {
|
||||||
number_width -= updown->get_width();
|
|
||||||
Ref<Texture2D> updown2 = get_theme_icon(is_read_only() ? SNAME("updown_disabled") : SNAME("updown"), SNAME("SpinBox"));
|
Ref<Texture2D> updown2 = get_theme_icon(is_read_only() ? SNAME("updown_disabled") : SNAME("updown"), SNAME("SpinBox"));
|
||||||
int updown_vofs = (size.height - updown2->get_height()) / 2;
|
int updown_vofs = (size.height - updown2->get_height()) / 2;
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
|
|
|
@ -1576,11 +1576,8 @@ void GDScriptAnalyzer::resolve_function_body(GDScriptParser::FunctionNode *p_fun
|
||||||
|
|
||||||
resolve_suite(p_function->body);
|
resolve_suite(p_function->body);
|
||||||
|
|
||||||
GDScriptParser::DataType return_type = p_function->body->get_datatype();
|
if (!p_function->get_datatype().is_hard_type() && p_function->body->get_datatype().is_set()) {
|
||||||
|
|
||||||
if (!p_function->get_datatype().is_hard_type() && return_type.is_set()) {
|
|
||||||
// Use the suite inferred type if return isn't explicitly set.
|
// Use the suite inferred type if return isn't explicitly set.
|
||||||
return_type.type_source = GDScriptParser::DataType::INFERRED;
|
|
||||||
p_function->set_datatype(p_function->body->get_datatype());
|
p_function->set_datatype(p_function->body->get_datatype());
|
||||||
} else if (p_function->get_datatype().is_hard_type() && (p_function->get_datatype().kind != GDScriptParser::DataType::BUILTIN || p_function->get_datatype().builtin_type != Variant::NIL)) {
|
} else if (p_function->get_datatype().is_hard_type() && (p_function->get_datatype().kind != GDScriptParser::DataType::BUILTIN || p_function->get_datatype().builtin_type != Variant::NIL)) {
|
||||||
if (!p_function->body->has_return && (p_is_lambda || p_function->identifier->name != GDScriptLanguage::get_singleton()->strings._init)) {
|
if (!p_function->body->has_return && (p_is_lambda || p_function->identifier->name != GDScriptLanguage::get_singleton()->strings._init)) {
|
||||||
|
|
|
@ -162,12 +162,10 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
|
||||||
rev_pos.y = 0;
|
rev_pos.y = 0;
|
||||||
rev_pos.normalize();
|
rev_pos.normalize();
|
||||||
|
|
||||||
if (channel_count >= 1) {
|
// Stereo pair.
|
||||||
// Stereo pair
|
|
||||||
float c = rev_pos.x * 0.5 + 0.5;
|
float c = rev_pos.x * 0.5 + 0.5;
|
||||||
reverb_vol.write[0].l = 1.0 - c;
|
reverb_vol.write[0].l = 1.0 - c;
|
||||||
reverb_vol.write[0].r = c;
|
reverb_vol.write[0].r = c;
|
||||||
}
|
|
||||||
|
|
||||||
if (channel_count >= 3) {
|
if (channel_count >= 3) {
|
||||||
// Center pair + Side pair
|
// Center pair + Side pair
|
||||||
|
@ -183,7 +181,6 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p
|
||||||
if (channel_count >= 4) {
|
if (channel_count >= 4) {
|
||||||
// Rear pair
|
// Rear pair
|
||||||
// FIXME: Not sure what math should be done here
|
// FIXME: Not sure what math should be done here
|
||||||
float c = rev_pos.x * 0.5 + 0.5;
|
|
||||||
reverb_vol.write[3].l = 1.0 - c;
|
reverb_vol.write[3].l = 1.0 - c;
|
||||||
reverb_vol.write[3].r = c;
|
reverb_vol.write[3].r = c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ void AnimationPlayer::_animation_update_transforms() {
|
||||||
if (aa->time < pasi.start) {
|
if (aa->time < pasi.start) {
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
} else if (aa->backward) {
|
} else {
|
||||||
if (aa->time > pasi.start) {
|
if (aa->time > pasi.start) {
|
||||||
stop = true;
|
stop = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,7 +380,7 @@ void Viewport::_notification(int p_what) {
|
||||||
if (get_tree()->is_debugging_collisions_hint()) {
|
if (get_tree()->is_debugging_collisions_hint()) {
|
||||||
PhysicsServer2D::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count());
|
PhysicsServer2D::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count());
|
||||||
contact_2d_debug = RenderingServer::get_singleton()->canvas_item_create();
|
contact_2d_debug = RenderingServer::get_singleton()->canvas_item_create();
|
||||||
RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, find_world_2d()->get_canvas());
|
RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, current_canvas);
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
PhysicsServer3D::get_singleton()->space_set_debug_contacts(find_world_3d()->get_space(), get_tree()->get_collision_debug_contact_count());
|
PhysicsServer3D::get_singleton()->space_set_debug_contacts(find_world_3d()->get_space(), get_tree()->get_collision_debug_contact_count());
|
||||||
contact_3d_debug_multimesh = RenderingServer::get_singleton()->multimesh_create();
|
contact_3d_debug_multimesh = RenderingServer::get_singleton()->multimesh_create();
|
||||||
|
|
|
@ -593,12 +593,10 @@ void RenderForwardMobile::_pre_opaque_render(RenderDataRD *p_render_data) {
|
||||||
|
|
||||||
bool render_shadows = p_render_data->directional_shadows.size() || p_render_data->shadows.size();
|
bool render_shadows = p_render_data->directional_shadows.size() || p_render_data->shadows.size();
|
||||||
|
|
||||||
if (render_shadows) {
|
|
||||||
RENDER_TIMESTAMP("Render Shadows");
|
|
||||||
}
|
|
||||||
|
|
||||||
//prepare shadow rendering
|
//prepare shadow rendering
|
||||||
if (render_shadows) {
|
if (render_shadows) {
|
||||||
|
RENDER_TIMESTAMP("Render Shadows");
|
||||||
|
|
||||||
_render_shadow_begin();
|
_render_shadow_begin();
|
||||||
|
|
||||||
//render directional shadows
|
//render directional shadows
|
||||||
|
|
Loading…
Reference in New Issue