Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary value assignments throughout the codebase #78538

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions editor/animation_track_editor_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,6 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int

Ref<AudioStreamPreview> preview = AudioStreamPreviewGenerator::get_singleton()->generate_preview(stream);

float preview_len = preview->get_length();

int pixel_total_len = len * p_pixels_sec;

len -= end_ofs;
Expand Down Expand Up @@ -918,7 +916,7 @@ void AnimationTrackEditTypeAudio::draw_key(int p_index, float p_pixels_sec, int

Vector<Vector2> points;
points.resize((to_x - from_x) * 2);
preview_len = preview->get_length();
float preview_len = preview->get_length();

for (int i = from_x; i < to_x; i++) {
float ofs = (i - pixel_begin) * preview_len / pixel_total_len;
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum, bool p_is
bool can_ref = !p_type.contains("*") || is_enum_type;

String link_t = p_type; // For links in metadata
String display_t = link_t; // For display purposes
String display_t; // For display purposes.
if (is_enum_type) {
link_t = p_enum; // The link for enums is always the full enum description
display_t = _contextualize_class_specifier(p_enum, edited_class);
Expand Down
2 changes: 1 addition & 1 deletion platform/android/android_input_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicod
ev.instantiate();

Key physical_keycode = godot_code_from_android_code(p_physical_keycode);
Key keycode = physical_keycode;
Key keycode;
if (unicode == '\b') { // 0x08
keycode = Key::BACKSPACE;
} else if (unicode == '\t') { // 0x09
Expand Down
3 changes: 0 additions & 3 deletions scene/gui/item_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,9 +1265,6 @@ void ItemList::_notification(int p_what) {

if (rtl) {
text_ofs.x = size.width - width;
}

if (rtl) {
items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
} else {
items.write[i].text_buf->set_alignment(HORIZONTAL_ALIGNMENT_LEFT);
Expand Down
2 changes: 1 addition & 1 deletion scene/gui/menu_bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void MenuBar::_draw_menu_item(int p_index) {
}

Color color;
Ref<StyleBox> style = theme_cache.normal;
Ref<StyleBox> style;
Rect2 item_rect = _get_menu_item_rect(p_index);

if (menu_cache[p_index].disabled) {
Expand Down
2 changes: 0 additions & 2 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1718,11 +1718,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
gui.last_mouse_focus = gui.mouse_focus;

if (!gui.mouse_focus) {
gui.mouse_focus_mask.clear();
return;
}

gui.mouse_focus_mask.clear();
gui.mouse_focus_mask.set_flag(mouse_button_to_mask(mb->get_button_index()));

if (mb->get_button_index() == MouseButton::LEFT) {
Expand Down
3 changes: 1 addition & 2 deletions servers/rendering/renderer_rd/effects/ss_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ SSEffects::SSEffects() {
for (int pass = 0; pass < 4; pass++) {
for (int subPass = 0; subPass < sub_pass_count; subPass++) {
int a = pass;
int b = subPass;

int spmap[5]{ 0, 1, 4, 3, 2 };
b = spmap[subPass];
int b = spmap[subPass];

float ca, sa;
float angle0 = (float(a) + float(b) / float(sub_pass_count)) * Math_PI * 0.5f;
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/shader_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene
//its a uniform!
const ShaderLanguage::ShaderNode::Uniform &u = shader->uniforms[vnode->name];
if (u.texture_order >= 0) {
StringName name = vnode->name;
StringName name;
if (u.hint == ShaderLanguage::ShaderNode::Uniform::HINT_SCREEN_TEXTURE) {
name = "color_buffer";
if (u.filter >= ShaderLanguage::FILTER_NEAREST_MIPMAP) {
Expand Down