Small fixes, mostly dupicated code
(cherry picked from commit 856a8226a5
)
This commit is contained in:
parent
a2cf479f07
commit
3b703d6707
|
@ -480,7 +480,6 @@ RID RasterizerSceneGLES2::reflection_probe_instance_create(RID p_probe) {
|
|||
rpi->current_resolution = 0;
|
||||
rpi->dirty = true;
|
||||
|
||||
rpi->last_pass = 0;
|
||||
rpi->index = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
|
|
@ -1061,12 +1061,11 @@ void RasterizerSceneGLES3::gi_probe_instance_set_light_data(RID p_probe, RID p_b
|
|||
if (p_data.is_valid()) {
|
||||
RasterizerStorageGLES3::GIProbeData *gipd = storage->gi_probe_data_owner.getornull(p_data);
|
||||
ERR_FAIL_COND(!gipd);
|
||||
if (gipd) {
|
||||
gipi->tex_cache = gipd->tex_id;
|
||||
gipi->cell_size_cache.x = 1.0 / gipd->width;
|
||||
gipi->cell_size_cache.y = 1.0 / gipd->height;
|
||||
gipi->cell_size_cache.z = 1.0 / gipd->depth;
|
||||
}
|
||||
|
||||
gipi->tex_cache = gipd->tex_id;
|
||||
gipi->cell_size_cache.x = 1.0 / gipd->width;
|
||||
gipi->cell_size_cache.y = 1.0 / gipd->height;
|
||||
gipi->cell_size_cache.z = 1.0 / gipd->depth;
|
||||
}
|
||||
}
|
||||
void RasterizerSceneGLES3::gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {
|
||||
|
|
|
@ -2255,8 +2255,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) {
|
|||
|
||||
Node *node = state.scene_map[name];
|
||||
ERR_CONTINUE(node->type != Node::TYPE_JOINT);
|
||||
if (node->type != Node::TYPE_JOINT)
|
||||
continue;
|
||||
|
||||
NodeSkeleton *sk = NULL;
|
||||
|
||||
while (node && !sk) {
|
||||
|
|
|
@ -1614,8 +1614,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
|
|||
continue;
|
||||
}
|
||||
|
||||
ERR_CONTINUE(xform_idx == -1);
|
||||
|
||||
Vector<float> data = at.get_value_at_time(snapshots[i]);
|
||||
ERR_CONTINUE(data.empty());
|
||||
|
||||
|
|
|
@ -130,8 +130,7 @@ void InspectorDock::_menu_option(int p_option) {
|
|||
ERR_FAIL_INDEX(idx, methods.size());
|
||||
String name = methods[idx].name;
|
||||
|
||||
if (current)
|
||||
current->call(name);
|
||||
current->call(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -835,7 +835,7 @@ void AnimationTreePlayerEditor::_gui_input(Ref<InputEvent> p_event) {
|
|||
click_motion = Point2(mm->get_position().x, mm->get_position().y);
|
||||
update();
|
||||
}
|
||||
if ((mm->get_button_mask() & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE))) {
|
||||
if (mm->get_button_mask() & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
||||
|
||||
h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
|
||||
v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
|
||||
|
|
|
@ -1858,7 +1858,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
// Confirm the move (only if it was moved)
|
||||
if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && (drag_type == DRAG_MOVE)) {
|
||||
if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT) {
|
||||
if (transform.affine_inverse().xform(b->get_position()) != drag_from) {
|
||||
_commit_canvas_item_state(drag_selection, TTR("Move CanvasItem"), true);
|
||||
}
|
||||
|
|
|
@ -811,10 +811,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
Node *node = e->get();
|
||||
if (node) {
|
||||
if (node && node->get_scene_inherited_state().is_valid()) {
|
||||
scene_tree->emit_signal("open", node->get_scene_inherited_state()->get_path());
|
||||
}
|
||||
if (node && node->get_scene_inherited_state().is_valid()) {
|
||||
scene_tree->emit_signal("open", node->get_scene_inherited_state()->get_path());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
|
|
@ -324,7 +324,6 @@ void EditorSpatialGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref
|
|||
|
||||
ERR_FAIL_COND(!spatial_node);
|
||||
|
||||
ERR_FAIL_COND(!spatial_node);
|
||||
Instance ins;
|
||||
|
||||
Ref<ArrayMesh> mesh = memnew(ArrayMesh);
|
||||
|
|
|
@ -61,8 +61,8 @@ int64_t GDAPI godot_videodecoder_file_seek(void *ptr, int64_t pos, int whence) {
|
|||
// file
|
||||
FileAccess *file = reinterpret_cast<FileAccess *>(ptr);
|
||||
|
||||
size_t len = file->get_len();
|
||||
if (file) {
|
||||
size_t len = file->get_len();
|
||||
switch (whence) {
|
||||
case SEEK_SET: {
|
||||
// Just for explicitness
|
||||
|
|
|
@ -3006,8 +3006,8 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
|||
}
|
||||
}
|
||||
}
|
||||
base_type = base_type.class_type->base_type;
|
||||
}
|
||||
base_type = base_type.class_type->base_type;
|
||||
} break;
|
||||
case GDScriptParser::DataType::SCRIPT:
|
||||
case GDScriptParser::DataType::GDSCRIPT: {
|
||||
|
|
|
@ -895,7 +895,7 @@ void GDScriptTokenizerText::_advance() {
|
|||
}
|
||||
hexa_found = true;
|
||||
} else if (!hexa_found && GETCHAR(i) == 'e') {
|
||||
if (hexa_found || exponent_found) {
|
||||
if (exponent_found) {
|
||||
_make_error("Invalid numeric constant at 'e'");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -67,9 +67,7 @@ void NavigationMeshEditor::_bake_pressed() {
|
|||
NavigationMeshGenerator::clear(node->get_navigation_mesh());
|
||||
NavigationMeshGenerator::bake(node->get_navigation_mesh(), node);
|
||||
|
||||
if (node) {
|
||||
node->update_gizmo();
|
||||
}
|
||||
node->update_gizmo();
|
||||
}
|
||||
|
||||
void NavigationMeshEditor::_clear_pressed() {
|
||||
|
|
|
@ -1923,10 +1923,6 @@ public:
|
|||
zipClose(final_apk, NULL);
|
||||
unzClose(tmp_unaligned);
|
||||
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1165,7 +1165,7 @@ int OS_X11::get_screen_dpi(int p_screen) const {
|
|||
int height_mm = DisplayHeightMM(x11_display, p_screen);
|
||||
double xdpi = (width_mm ? sc.width / (double)width_mm * 25.4 : 0);
|
||||
double ydpi = (height_mm ? sc.height / (double)height_mm * 25.4 : 0);
|
||||
if (xdpi || xdpi)
|
||||
if (xdpi || ydpi)
|
||||
return (xdpi + ydpi) / (xdpi && ydpi ? 2 : 1);
|
||||
|
||||
//could not get dpi
|
||||
|
|
|
@ -1275,9 +1275,6 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
|
|||
|
||||
if (collided) {
|
||||
found_collision = true;
|
||||
}
|
||||
|
||||
if (collided) {
|
||||
|
||||
colliders.push_back(collision);
|
||||
motion = collision.remainder;
|
||||
|
|
|
@ -1203,9 +1203,6 @@ Vector3 KinematicBody::move_and_slide(const Vector3 &p_linear_velocity, const Ve
|
|||
|
||||
if (collided) {
|
||||
found_collision = true;
|
||||
}
|
||||
|
||||
if (collided) {
|
||||
|
||||
colliders.push_back(collision);
|
||||
motion = collision.remainder;
|
||||
|
|
|
@ -59,7 +59,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
|
|||
Ref<InputEventMouseButton> b = p_event;
|
||||
|
||||
if (b.is_valid()) {
|
||||
if (status.disabled || ((1 << (b->get_button_index() - 1)) & button_mask) == 0)
|
||||
if (((1 << (b->get_button_index() - 1)) & button_mask) == 0)
|
||||
return;
|
||||
|
||||
if (status.pressing_button)
|
||||
|
|
|
@ -239,7 +239,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
for (int i = search_from; i >= 0; i--) {
|
||||
|
||||
if (i < 0 || i >= items.size())
|
||||
if (i >= items.size())
|
||||
continue;
|
||||
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
|
|
|
@ -2004,7 +2004,7 @@ bool RichTextLabel::search(const String &p_string, bool p_from_selection, bool p
|
|||
Item *it = main;
|
||||
int charidx = 0;
|
||||
|
||||
if (p_from_selection && selection.active && selection.enabled) {
|
||||
if (p_from_selection && selection.active) {
|
||||
it = selection.to;
|
||||
charidx = selection.to_char + 1;
|
||||
}
|
||||
|
|
|
@ -3930,7 +3930,6 @@ Tree::Tree() {
|
|||
cache.click_item = NULL;
|
||||
cache.click_column = 0;
|
||||
cache.hover_cell = -1;
|
||||
cache.hover_index = -1;
|
||||
last_keypress = 0;
|
||||
focus_in_id = 0;
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ bool HTTPRequest::_update_connection() {
|
|||
call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, PoolByteArray());
|
||||
return true;
|
||||
}
|
||||
if (got_response && body_len < 0) {
|
||||
if (body_len < 0) {
|
||||
// Chunked transfer is done
|
||||
call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
|
||||
return true;
|
||||
|
|
|
@ -268,7 +268,7 @@ void Curve::update_auto_tangents(int i) {
|
|||
}
|
||||
|
||||
if (i + 1 < _points.size()) {
|
||||
if (p.right_mode == TANGENT_LINEAR && i + 1 < _points.size()) {
|
||||
if (p.right_mode == TANGENT_LINEAR) {
|
||||
Vector2 v = (_points[i + 1].pos - p.pos).normalized();
|
||||
p.right_tangent = v.y / v.x;
|
||||
}
|
||||
|
|
|
@ -201,10 +201,8 @@ void AudioRBResampler::clear() {
|
|||
return;
|
||||
|
||||
//should be stopped at this point but just in case
|
||||
if (rb) {
|
||||
memdelete_arr(rb);
|
||||
memdelete_arr(read_buf);
|
||||
}
|
||||
memdelete_arr(rb);
|
||||
memdelete_arr(read_buf);
|
||||
rb = NULL;
|
||||
offset = 0;
|
||||
rb_read_pos = 0;
|
||||
|
|
|
@ -66,7 +66,7 @@ void AudioEffectRecordInstance::_io_thread_process() {
|
|||
|
||||
while (is_recording) {
|
||||
//Check: The current recording has been requested to stop
|
||||
if (is_recording && !base->recording_active) {
|
||||
if (!base->recording_active) {
|
||||
is_recording = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,10 +351,8 @@ bool PhysicsDirectSpaceStateSW::collide_shape(RID p_shape, const Transform &p_sh
|
|||
CollisionSolverSW::CallbackResult cbkres = NULL;
|
||||
|
||||
PhysicsServerSW::CollCbkData *cbkptr = NULL;
|
||||
if (p_result_max > 0) {
|
||||
cbkptr = &cbk;
|
||||
cbkres = PhysicsServerSW::_shape_col_cbk;
|
||||
}
|
||||
cbkptr = &cbk;
|
||||
cbkres = PhysicsServerSW::_shape_col_cbk;
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
||||
|
|
|
@ -586,7 +586,7 @@ bool ConvexPolygonShape2DSW::contains_point(const Vector2 &p_point) const {
|
|||
in = true;
|
||||
}
|
||||
|
||||
return (in && !out) || (!in && out);
|
||||
return in != out;
|
||||
}
|
||||
|
||||
bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const {
|
||||
|
|
|
@ -333,10 +333,8 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
|
|||
CollisionSolver2DSW::CallbackResult cbkres = NULL;
|
||||
|
||||
Physics2DServerSW::CollCbkData *cbkptr = NULL;
|
||||
if (p_result_max > 0) {
|
||||
cbkptr = &cbk;
|
||||
cbkres = Physics2DServerSW::_shape_col_cbk;
|
||||
}
|
||||
cbkptr = &cbk;
|
||||
cbkres = Physics2DServerSW::_shape_col_cbk;
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
||||
|
@ -353,7 +351,7 @@ bool Physics2DDirectSpaceStateSW::collide_shape(RID p_shape, const Transform2D &
|
|||
cbk.valid_depth = 0;
|
||||
|
||||
if (CollisionSolver2DSW::solve(shape, p_shape_xform, p_motion, col_obj->get_shape(shape_idx), col_obj->get_transform() * col_obj->get_shape_transform(shape_idx), Vector2(), cbkres, cbkptr, NULL, p_margin)) {
|
||||
collided = p_result_max == 0 || cbk.amount > 0;
|
||||
collided = cbk.amount > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1864,7 +1864,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
|
|||
//failure
|
||||
} else if (ins->base_type == VS::INSTANCE_LIGHT && ins->visible) {
|
||||
|
||||
if (ins->visible && light_cull_count < MAX_LIGHTS_CULLED) {
|
||||
if (light_cull_count < MAX_LIGHTS_CULLED) {
|
||||
|
||||
InstanceLightData *light = static_cast<InstanceLightData *>(ins->base_data);
|
||||
|
||||
|
@ -1881,7 +1881,7 @@ void VisualServerScene::_prepare_scene(const Transform p_cam_transform, const Ca
|
|||
}
|
||||
} else if (ins->base_type == VS::INSTANCE_REFLECTION_PROBE && ins->visible) {
|
||||
|
||||
if (ins->visible && reflection_probe_cull_count < MAX_REFLECTION_PROBES_CULLED) {
|
||||
if (reflection_probe_cull_count < MAX_REFLECTION_PROBES_CULLED) {
|
||||
|
||||
InstanceReflectionProbeData *reflection_probe = static_cast<InstanceReflectionProbeData *>(ins->base_data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue